def
definition
contains
show as:
view math explainer →
open explainer
Generate a durable explainer page for this declaration.
open lean source
IndisputableMonolith.Ethics.StakeGraph on GitHub at line 15.
browse module
All declarations in this module, on Recognition.
explainer page
depends on
used by
-
H_SATCARuntime -
jcostEdgeWeight_le_clauses -
Instance -
zAgingChannel_count -
reachable -
aggCoeff_rowMoves_aux_theorem -
mem_toMoves_of_coeff_ne_zero -
phi3_eq -
RSExists_stable -
has_distinguishable_events -
firstPassProgram_nodup -
firstPassSchedule_mem_high_or_immediate -
Recognizer -
J_stationary -
unity_has_no_phi_structure -
self_feasible -
gutenbergRichterCert -
liCoupling -
phi_irrational_information -
simulation_reduces_to_tautology -
simulation_unprovable -
chain_unique_given_edge_pair -
current_chain_distinct -
numberSystemCount -
congruence_offsets_unique -
nine801_eq_9_times_11_sq -
integral_radial_skew_identity_from -
denseDomain_nonempty -
concreteDirectedEulerLedgerSystem -
oscOn_Icc_le_drop_of_antitone -
add_contains_add -
contains -
contains_point -
hi_le_implies_contains_le -
hi_lt_implies_contains_lt -
lo_ge_implies_contains_ge -
lo_gt_implies_contains_gt -
mulPos_contains_mul -
neg_contains_neg -
npow_contains_pow
formal source
12
13namespace StakeGraph
14
15def contains (xs : List Stakeholder) (s : Stakeholder) : Bool :=
16 xs.any (fun x => decide (x = s))
17
18def neighbors (G : StakeGraph) (nodes : List Stakeholder) (s : Stakeholder) : List Stakeholder :=
19 nodes.filter (fun t => G.edge s t)
20
21def reachable (G : StakeGraph) (nodes : List Stakeholder) (src dst : Stakeholder) : Bool :=
22 let rec dfs (front : List Stakeholder) (visited : List Stakeholder) : Bool :=
23 match front with
24 | [] => False
25 | v :: vs =>
26 if decide (v = dst) then True else
27 let nbrs := neighbors G nodes v
28 let fresh := nbrs.filter (fun w => ¬ contains visited w)
29 dfs (vs ++ fresh) (v :: visited)
30 dfs [src] []
31
32def mutualReachable (G : StakeGraph) (nodes : List Stakeholder) (s t : Stakeholder) : Bool :=
33 reachable G nodes s t && reachable G nodes t s
34
35def hasCycle (G : StakeGraph) (nodes : List Stakeholder) : Bool :=
36 nodes.any (fun s => G.edge s s)
37 || nodes.any (fun s =>
38 nodes.any (fun t => (¬ decide (s = t)) && mutualReachable G nodes s t))
39
40end StakeGraph
41end Ethics
42end IndisputableMonolith
43