|
| 1 | +import Mathlib.Analysis.InnerProductSpace.PiL2 -- inefficient import |
| 2 | +import Mathlib.Topology.UniformSpace.Path -- inefficient import |
| 3 | +import Mathlib.Topology.Separation.Connected -- inefficient import |
| 4 | +import Mathlib.Topology.LocallyConstant.Basic -- inefficient import |
| 5 | +import Matroid.ForMathlib.Partition.Set |
| 6 | +import Matroid.Graph.Basic |
| 7 | + |
| 8 | +open Set Function Partition |
| 9 | +variable {α : Type*} [TopologicalSpace α] {S T T₁ T₂ : Set α} {u v w : α} |
| 10 | + |
| 11 | +instance : IsTrans α (JoinedIn S) where |
| 12 | + trans _ _ _ := JoinedIn.trans |
| 13 | + |
| 14 | +instance : Std.Symm (JoinedIn S) where |
| 15 | + symm _ _ := JoinedIn.symm |
| 16 | + |
| 17 | +def ComponentPartition (S : Set α) : Partition (Set α) := Partition.ofRel (JoinedIn Sᶜ) |
| 18 | + |
| 19 | +@[simp] |
| 20 | +lemma componentPartition_supp (S : Set α) : (ComponentPartition S).supp = Sᶜ := by |
| 21 | + ext v |
| 22 | + simp only [ComponentPartition, ofRel_supp, Relation.mem_domain_iff, mem_compl_iff] |
| 23 | + exact ⟨fun ⟨x, hx⟩ => hx.source_mem, fun hv => ⟨v, JoinedIn.refl hv⟩⟩ |
| 24 | + |
| 25 | +@[simp] |
| 26 | +lemma componentPartition_partOf (S : Set α) : |
| 27 | + (ComponentPartition S).partOf v = pathComponentIn Sᶜ v := by |
| 28 | + simp [ComponentPartition, partOf, Relation.fiber, pathComponentIn, comm_of] |
| 29 | + |
| 30 | +lemma mem_componentPartition_iff (S T : Set α) : |
| 31 | + T ∈ ComponentPartition S ↔ ∃ v ∈ Sᶜ, pathComponentIn Sᶜ v = T := by |
| 32 | + refine ⟨fun hT => ?_, fun ⟨v, hv, h⟩ => h ▸ componentPartition_partOf S ▸ partOf_mem <| by simpa⟩ |
| 33 | + obtain ⟨v, hv⟩ := (ComponentPartition S).nonempty_of_mem hT |
| 34 | + exact ⟨v, componentPartition_supp S ▸ (ComponentPartition S).subset_of_mem hT hv, |
| 35 | + componentPartition_partOf S ▸ (ComponentPartition S).eq_partOf_of_mem hT hv |>.symm⟩ |
| 36 | + |
| 37 | +lemma componentPartition_parts (S : Set α) : |
| 38 | + (ComponentPartition S).parts = (pathComponentIn Sᶜ) '' Sᶜ := by |
| 39 | + ext T |
| 40 | + rw [mem_parts, mem_componentPartition_iff, mem_image] |
| 41 | + |
| 42 | +lemma IsClosed.componentPartition_isOpen [LocPathConnectedSpace α] (hT : T ∈ ComponentPartition S) |
| 43 | + (h : IsClosed S) : IsOpen T := by |
| 44 | + obtain ⟨v, hv, rfl⟩ := mem_componentPartition_iff S T |>.mp hT |
| 45 | + exact h.isOpen_compl.pathComponentIn v |
| 46 | + |
| 47 | +lemma frontier_subset_of_mem_componentPartition [LocPathConnectedSpace α] |
| 48 | + (hT : T ∈ ComponentPartition S) (h : IsClosed S) : frontier T ⊆ S := by |
| 49 | + rintro u ⟨huc, hui⟩ |
| 50 | + rw [(h.componentPartition_isOpen hT).interior_eq] at hui |
| 51 | + obtain ⟨v, -, rfl⟩ := mem_componentPartition_iff S T |>.mp hT |
| 52 | + by_contra huS |
| 53 | + have hUopen : IsOpen (pathComponentIn Sᶜ u) := h.isOpen_compl.pathComponentIn u |
| 54 | + have huU : u ∈ pathComponentIn Sᶜ u := mem_pathComponentIn_self huS |
| 55 | + obtain ⟨z, hzU, hzT⟩ := mem_closure_iff_nhds.1 huc _ (hUopen.mem_nhds huU) |
| 56 | + exact hui ((pathComponentIn_congr hzU).symm.trans (pathComponentIn_congr hzT) ▸ huU) |
| 57 | + |
| 58 | +structure AdjRegion (S T₁ T₂ : Set α) : Prop where |
| 59 | + hT₁ : T₁ ∈ ComponentPartition S |
| 60 | + hT₂ : T₂ ∈ ComponentPartition S |
| 61 | + h : (frontier T₁) ∩ (frontier T₂) |>.Nonempty |
0 commit comments