@@ -356,11 +356,6 @@ lemma isTree_iff_minimal_connected : IsTree G ↔ Minimal Connected G := by
356356 simp only [edges_map, Hom.coe_ofLE, Sym2.map_id, List.map_id_fun, id_eq] at this
357357 simp [this, p.adj_of_mem_edges]
358358
359- /-- Every connected graph has a spanning tree. -/
360- lemma Connected.exists_isTree_le [Finite V] (h : G.Connected) : ∃ T ≤ G, IsTree T := by
361- obtain ⟨T, hTG, hmin⟩ := {H : SimpleGraph V | H.Connected}.toFinite.exists_le_minimal h
362- exact ⟨T, hTG, isTree_of_minimal_connected hmin⟩
363-
364359/--
365360Adding an edge to an acyclic graph preserves acyclicity if the endpoints are not reachable.
366361-/
@@ -461,6 +456,35 @@ theorem maximal_isAcyclic_iff_isTree [Nonempty V] {T : SimpleGraph V} :
461456 Maximal IsAcyclic T ↔ T.IsTree := by
462457 simp [← connected_top.maximal_le_isAcyclic_iff_isTree le_top]
463458
459+ /-- Every acyclic subgraph can be extended to a spanning forest. -/
460+ theorem exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic {H : SimpleGraph V} (hH_le : H ≤ G)
461+ (hH_isAcyclic : H.IsAcyclic) :
462+ ∃ F : SimpleGraph V, H ≤ F ∧ F ≤ G ∧ F.IsAcyclic ∧ F.Reachable = G.Reachable := by
463+ obtain ⟨F, hF⟩ := G.exists_maximal_isAcyclic_of_le_isAcyclic hH_le hH_isAcyclic
464+ use F
465+ grind [maximal_isAcyclic_iff_reachable_eq, Maximal]
466+
467+ /-- Every graph has a spanning forest. -/
468+ theorem exists_isAcyclic_reachable_eq_le :
469+ ∃ F ≤ G, F.IsAcyclic ∧ F.Reachable = G.Reachable := by
470+ obtain ⟨F, hF⟩ := G.exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic bot_le isAcyclic_bot
471+ use F
472+ grind
473+
474+ /-- Every acyclic subgraph of a connected graph can be extended to a spanning tree. -/
475+ lemma Connected.exists_isTree_le_of_le_of_isAcyclic {H : SimpleGraph V} (h : G.Connected)
476+ (hH_le : H ≤ G) (hH_isAcyclic : H.IsAcyclic) :
477+ ∃ F : SimpleGraph V, H ≤ F ∧ F ≤ G ∧ F.IsTree := by
478+ obtain ⟨F, hF⟩ := G.exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic hH_le hH_isAcyclic
479+ use F
480+ grind [IsTree, Connected, preconnected_iff_reachable_eq_top]
481+
482+ /-- Every connected graph has a spanning tree. -/
483+ lemma Connected.exists_isTree_le (h : G.Connected) : ∃ T ≤ G, IsTree T := by
484+ obtain ⟨F, hF⟩ := G.exists_isAcyclic_reachable_eq_le_of_le_of_isAcyclic bot_le isAcyclic_bot
485+ use F
486+ grind [IsTree, Connected, preconnected_iff_reachable_eq_top]
487+
464488/-- Every connected graph on `n` vertices has at least `n-1` edges. -/
465489lemma Connected.card_vert_le_card_edgeSet_add_one (h : G.Connected) :
466490 Nat.card V ≤ Nat.card G.edgeSet + 1 := by
0 commit comments