FormalConjecturesForMathlib/Combinatorics/SimpleGraph/Connectivity.lean
Explanation legend Lean4 Domain Explanation Language (L4DEL)
L4DEL explanations are a separate layer. They do not change the Lean source. Intuition is explanatory prose; numbered items are a reading path; sources link the wording back to evidence.
- L4DEL
- Lean4 Domain Explanation Language
Credit: The upstream authors and contributors retain credit for the project and mathematics. lean4-explainer only renders their pinned source and adds the separately disclosed explanation layer.
Project sources: Pinned project documentation, Formal Conjectures paper, arXiv v1
22 declarations, 0 contain sorry, 0 declared as axioms
Deciding reachability by breadth-first search
This section provides efficient decidability instances for reachability and (pre)connectedness of finite graphs through a breadth-first search (BFS) algorithm.
The algorithm is as follows: we maintain a finset of visited vertices which we grow with all its
neighbors at each round of breadth-first search at, stopping as soon as a round adds no new vertex:
a search costs O((diam G + 1) * (card V) ^ 2) adjacency tests.
Vertices u and v are then reachable if v lies in the BFS-constructed finset of vertices
reachable from u, and a graph is (pre)connected iff it's non-empty and (/empty or) every vertex is
lies in the reachability finset of an arbitrarily-chosen vertex.
Imports (3)
Imported by 3 files
- def
SimpleGraph.InternallyDisjointTwo walks are internally disjoint if they share no vertices other than their endpoints line 32 sourceSource documentation
Two walks are internally disjoint if they share no vertices other than their endpoints.
no axioms what this means
Statement uses:
SimpleGraph,SimpleGraph.WalkProof uses:
List.Disjoint,List.dropLast,List.tail,SimpleGraph.Walk.supportdef InternallyDisjoint {u v x y : V} (p : G.Walk u v) (q : G.Walk x y) : Prop := … - def
SimpleGraph.InfinitelyConnectedWe say a graph is infinitely connected if any two vertices are connected by infinitely many pairwise disjoint paths line 40 sourceSource documentation
We say a graph is infinitely connected if any two vertices are connected by infinitely many pairwise disjoint paths. Note that graphs with at most one vertex are not classed as infinitely connected.
no axioms what this means
Statement uses:
SimpleGraphProof uses:
And,Nontrivial,Pairwise,Exists,Set,SimpleGraph.Walk,Set.Infinite,Membership.mem,SimpleGraph.Walk.IsPath,Set.Pairwise, SimpleGraph.InternallyDisjoint1 instances, coercions and auxiliary constants left out.
def InfinitelyConnected (G : SimpleGraph V) : Prop := Nontrivial V ∧ …
- def
SimpleGraph.IsKConnectedGisk-connected: it has more thankvertices, and it stays connected after the removal of any set of fewer thankvertices line 48 sourceSource documentation
Gisk-connected: it has more thankvertices, and it stays connected after the removal of any set of fewer thankvertices.Mathlib has
SimpleGraph.IsEdgeConnected, but it has no vertex connectivity.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Fintype,SimpleGraph,NatProof uses:
And,LT.lt,Fintype.card,Finset,Finset.card,SimpleGraph.Connected,Compl.compl,Set,SimpleGraph.induce5 instances, coercions and auxiliary constants left out.
def IsKConnected {V : Type*} [Fintype V] (G : SimpleGraph V) (k : ℕ) : Prop := … - theorem
SimpleGraph.not_isKConnected_of_card_leA graph on at mostkvertices is notk-connected line 52 sourceSource documentation
A graph on at most
kvertices is notk-connected.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Fintype,SimpleGraph,Nat,LE.le,Fintype.card,Not, SimpleGraph.IsKConnectedProof uses:
absurd,LT.lt,False,And.left,Finset,Finset.card,SimpleGraph.Connected,Compl.compl,Set,SimpleGraph.induce,Iff.mpr,not_lt12 instances, coercions and auxiliary constants left out.
theorem not_isKConnected_of_card_le {V : Type*} [Fintype V] {G : SimpleGraph V} {k : ℕ} (h : Fintype.card V ≤ k) : ¬ IsKConnected G k := …Mentions: SimpleGraph.IsKConnected
- def
SimpleGraph.bfsStepOne round of breadth-first search:G.bfsStep sconsists of the vertices ofstogether with their neighbours line 77 sourceSource documentation
One round of breadth-first search:
G.bfsStep sconsists of the vertices ofstogether with their neighbours.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
SimpleGraph,Fintype,DecidableEq,DecidableRel,SimpleGraph.Adj,FinsetProof uses:
Finset.filter,Or,Membership.mem,Exists,And,Finset.univ5 instances, coercions and auxiliary constants left out.
def bfsStep : Finset V := {w | w ∈ s ∨ ∃ v ∈ s, G.Adj v w} … - lemma
SimpleGraph.mem_bfsStepline 80 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
SimpleGraph,Fintype,DecidableEq,DecidableRel,SimpleGraph.Adj,Finset,Iff,Membership.mem, SimpleGraph.bfsStep,Or,Exists,AndProof uses:
of_eq_true,Eq.trans,True,congrFun',congrArg,Finset.filter,Finset.univ,true_and,iff_self9 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
- lemma
SimpleGraph.subset_bfsStepline 82 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
SimpleGraph,Fintype,DecidableEq,DecidableRel,SimpleGraph.Adj,Finset,LE.le, SimpleGraph.bfsStepProof uses:
Membership.mem,Iff.mpr,Or,Exists,And, SimpleGraph.mem_bfsStep,Or.inl5 instances, coercions and auxiliary constants left out.
- lemma
SimpleGraph.bfsStep_monoline 84 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
SimpleGraph,Fintype,DecidableEq,DecidableRel,SimpleGraph.Adj,Finset,LE.le, SimpleGraph.bfsStep7 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
- lemma
SimpleGraph.iterate_bfsStep_monoline 87 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
SimpleGraph,Fintype,DecidableEq,DecidableRel,SimpleGraph.Adj,Nat,Finset,LE.le,Nat.iterate, SimpleGraph.bfsStepProof uses:
Nat.recAux,id,HAdd.hAdd,OfNat.ofNat, SimpleGraph.bfsStep_mono9 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
SimpleGraph.subset_iterate_bfsStepline 92 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
SimpleGraph,Fintype,DecidableEq,DecidableRel,SimpleGraph.Adj,Nat,Finset,LE.le,Nat.iterate, SimpleGraph.bfsStepProof uses:
Nat.recAux,subset_rfl,Eq.mpr,HAdd.hAdd,OfNat.ofNat,congrArg,Nat.succ,Function.iterate_succ_apply',le_imp_le_of_le_of_le,le_refl, SimpleGraph.bfsStep_mono, SimpleGraph.subset_bfsStep10 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
SimpleGraph.iterate_bfsStep_subset_of_leline 97 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
SimpleGraph,Fintype,DecidableEq,DecidableRel,SimpleGraph.Adj,Nat,Finset,LE.le,Nat.iterate, SimpleGraph.bfsStepProof uses:
Eq,HAdd.hAdd,Exists,Nat.exists_eq_add_of_le,Eq.mpr,id,congrArg,Function.iterate_add_apply, SimpleGraph.iterate_bfsStep_mono, SimpleGraph.subset_iterate_bfsStep,Eq.symm12 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
SimpleGraph.mem_iterate_bfsStep_of_walkline 102 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
SimpleGraph,Fintype,DecidableEq,DecidableRel,SimpleGraph.Adj,SimpleGraph.Walk,Membership.mem,Finset,Nat.iterate, SimpleGraph.bfsStep,SimpleGraph.Walk.length,Singleton.singletonProof uses:
SimpleGraph.Walk.rec,of_eq_true,Eq.trans,Eq,True,eq_self,Eq.mpr,SimpleGraph.Walk.cons,HAdd.hAdd,Nat,OfNat.ofNat,id,congrArg,SimpleGraph.Walk.length_cons,Nat.succ,Function.iterate_succ_apply, SimpleGraph.iterate_bfsStep_mono,LE.le,Or,Existsand 6 more16 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
- lemma
SimpleGraph.reachable_of_mem_iterate_bfsStepline 109 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
SimpleGraph,Fintype,DecidableEq,DecidableRel,SimpleGraph.Adj,Nat,Membership.mem,Finset,Nat.iterate, SimpleGraph.bfsStep,Singleton.singleton,SimpleGraph.ReachableProof uses:
Nat.recAux,OfNat.ofNat,Eq.rec,Eq,SimpleGraph.Reachable.refl,Eq.mp,congrArg,propext,Finset.mem_singleton,Function.iterate_zero_apply,HAdd.hAdd,Exists,And,Or, SimpleGraph.mem_bfsStep,Nat.succ,Function.iterate_succ_apply',SimpleGraph.Reachable.trans,SimpleGraph.Adj.reachable12 instances, coercions and auxiliary constants left out.
Tactic trace: 9 steps
Open to load the checked before-and-after goal states.
- def
SimpleGraph.bfsIterateIterateG.bfsStepat mostntimes, stopping as soon as no new vertex shows up line 121 sourceSource documentation
Iterate
G.bfsStepat mostntimes, stopping as soon as no new vertex shows up.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
SimpleGraph,Fintype,DecidableEq,DecidableRel,SimpleGraph.Adj,Nat,Finset2 instances, coercions and auxiliary constants left out.
def bfsIterate : ℕ → Finset V → Finset V | 0, s => s | n + 1, s => if (G.bfsStep s).card ≤ s.card then s else bfsIterate n (G.bfsStep s)
- lemma
SimpleGraph.bfsIterate_eq_iterate_bfsStepline 125 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
SimpleGraph,Fintype,DecidableEq,DecidableRel,SimpleGraph.Adj,Nat,Finset,Eq, SimpleGraph.bfsIterate,Nat.iterate, SimpleGraph.bfsStepProof uses:
Nat.recAux,Eq.refl,OfNat.ofNat,Eq.mpr,HAdd.hAdd,ite,LE.le,Finset.card,id,congrArg,Nat.succ,SimpleGraph.bfsIterate.eq_2,dite,congrFun',if_pos,Eq.symm,Finset.eq_of_subset_of_card_le, SimpleGraph.subset_bfsStep,Function.iterate_fixed,Notand 2 more5 instances, coercions and auxiliary constants left out.
Tactic trace: 9 steps
Open to load the checked before-and-after goal states.
- def
SimpleGraph.reachableFinsetThe finset of vertices reachable fromu, computed by breadth-first search line 137 sourceSource documentation
The finset of vertices reachable from
u, computed by breadth-first search.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
SimpleGraph,Fintype,DecidableEq,DecidableRel,SimpleGraph.Adj,FinsetProof uses: SimpleGraph.bfsIterate,
Fintype.card,Singleton.singleton1 instances, coercions and auxiliary constants left out.
def reachableFinset (u : V) : Finset V := G.bfsIterate (Fintype.card V) {u} … - lemma
SimpleGraph.mem_reachableFinsetline 140 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
SimpleGraph,Fintype,DecidableEq,DecidableRel,SimpleGraph.Adj,Iff,Membership.mem,Finset, SimpleGraph.reachableFinset,SimpleGraph.ReachableProof uses:
Eq.mpr, SimpleGraph.bfsIterate,Fintype.card,Singleton.singleton,id,Eq,congrArg,SimpleGraph.reachableFinset.eq_1,Nat.iterate, SimpleGraph.bfsStep, SimpleGraph.bfsIterate_eq_iterate_bfsStep,Iff.intro, SimpleGraph.reachable_of_mem_iterate_bfsStep,SimpleGraph.Reachable.elim_path,SimpleGraph.Path, SimpleGraph.iterate_bfsStep_subset_of_le,SimpleGraph.Walk.length,SimpleGraph.Walk,SimpleGraph.Walk.IsPath,LT.lt.leand 4 more7 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- instance
SimpleGraph.decidableReachableDecides reachability of verticesuandvby performing a breadth-first search fromuline 146 sourceSource documentation
Decides reachability of vertices
uandvby performing a breadth-first search fromu.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
SimpleGraph,Fintype,DecidableEq,DecidableRel,SimpleGraph.Adj,SimpleGraph.ReachableProof uses:
decidable_of_iff,Membership.mem,Finset, SimpleGraph.reachableFinset, SimpleGraph.mem_reachableFinset3 instances, coercions and auxiliary constants left out.
instance decidableReachable : DecidableRel G.Reachable := …
- lemma
SimpleGraph.preconnected_iff_forall_mem_reachableFinsetline 149 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
SimpleGraph,Fintype,DecidableEq,DecidableRel,SimpleGraph.Adj,Iff,SimpleGraph.Preconnected,Membership.mem,Finset, SimpleGraph.reachableFinsetProof uses:
Eq.mpr,SimpleGraph.Reachable,id,Eq,congrArg,forall_congr,Iff.intro,SimpleGraph.Reachable.trans,SimpleGraph.Reachable.symm5 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- instance
SimpleGraph.decidablePreconnectedDecides preconnectedness ofGby checking whether the vertex set is empty and, if not, by performing a breadth-first search from an arbitrarily chosen vertex line 156 sourceSource documentation
Decides preconnectedness of
Gby checking whether the vertex set is empty and, if not, by performing a breadth-first search from an arbitrarily chosen vertex.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
SimpleGraph,Fintype,DecidableEq,DecidableRel,SimpleGraph.Adj,Decidable,SimpleGraph.PreconnectedProof uses:
dite,Eq,Nat,Fintype.card,OfNat.ofNat,Decidable.isTrue,Not,Trunc.lift,decidable_of_iff,Membership.mem,Finset, SimpleGraph.reachableFinset,truncOfCardPos10 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
instance decidablePreconnected : Decidable G.Preconnected := …
- lemma
SimpleGraph.connected_iff_forall_mem_reachableFinsetline 164 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
SimpleGraph,Fintype,DecidableEq,DecidableRel,SimpleGraph.Adj,Iff,SimpleGraph.Connected,Membership.mem,Finset, SimpleGraph.reachableFinsetProof uses:
Eq.mpr,And,SimpleGraph.Preconnected,Nonempty,id,Eq,congrArg,propext,SimpleGraph.connected_iff, SimpleGraph.preconnected_iff_forall_mem_reachableFinset,and_iff_left,Nonempty.intro,Iff.rfl4 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
- instance
SimpleGraph.decidableConnectedDecides preconnectedness ofGby checking whether the vertex set is empty and, if not, by performing a breadth-first search from an arbitrarily chosen vertex line 170 sourceSource documentation
Decides preconnectedness of
Gby checking whether the vertex set is empty and, if not, by performing a breadth-first search from an arbitrarily chosen vertex.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
SimpleGraph,Fintype,DecidableEq,DecidableRel,SimpleGraph.Adj,Decidable,SimpleGraph.ConnectedProof uses:
dite,Eq,Nat,Fintype.card,OfNat.ofNat,Decidable.isFalse,Not,Trunc.lift,decidable_of_iff,Membership.mem,Finset, SimpleGraph.reachableFinset,truncOfCardPos10 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
instance decidableConnected : Decidable G.Connected := …