Skip to content

Commit f26b7d5

Browse files
committed
indexed de Morgan
1 parent 5aef80d commit f26b7d5

2 files changed

Lines changed: 55 additions & 4 deletions

File tree

Minimathlib/Set.lean

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ def compl {X : Type u} (s : Set X) : Set X := fun x => ¬s x
3838
-- (⋃ intervals) x = ∃ i, intervals i x = ∃ i, i ≤ x ∧ x ≤ i+1 (covers all reals)
3939
def iUnion {X : Type u} {ι : Type u} (s : ι → Set X) : Set X := fun x => ∃ i, s i x
4040

41+
-- Indexed intersection: element is in all sets from the family
42+
-- Example: if halflines i := fun x => x ≥ i, then
43+
-- (⋂ halflines) x = ∀ i, halflines i x = ∀ i, x ≥ i (only satisfied by no real number)
44+
def iInter {X : Type u} {ι : Type u} (s : ι → Set X) : Set X := fun x => ∀ i, s i x
45+
4146
protected def Mem (s : Set α) (a : α) : Prop := s a
4247

4348
instance : Membership α (Set α) := ⟨Set.Mem⟩
@@ -48,6 +53,7 @@ infixl:70 " ∩ " => Set.inter
4853
infixl:65 "" => Set.union
4954
postfix:max "" => Set.compl
5055
notation "" f => Set.iUnion f
56+
notation "" f => Set.iInter f
5157

5258
-- Basic subset relation
5359
def subset (s t : Set X) : Prop := ∀ x, x ∈ s → x ∈ t
@@ -80,5 +86,40 @@ theorem compl_inter {X : Type u} (s t : Set X) : (s ∩ t)ᶜ = sᶜ ∪ tᶜ :=
8086

8187
theorem compl_union {X : Type u} (s t : Set X) : (s ∪ t)ᶜ = sᶜ ∩ tᶜ := by ode_to_grind
8288

89+
-- De Morgan's laws for indexed unions and intersections
90+
theorem compl_iUnion {X : Type u} {ι : Type u} (s : ι → Set X) : (⋃ s)ᶜ = ⋂ (fun i => (s i)ᶜ) := by
91+
apply ext
92+
intro x
93+
constructor
94+
· intro h i hi
95+
-- h : ¬∃ i, s i x, hi : s i x, goal: False
96+
exact h ⟨i, hi⟩
97+
· intro h ⟨i, hi⟩
98+
-- h : ∀ i, ¬s i x, hi : s i x, goal: False
99+
exact h i hi
100+
101+
theorem compl_iInter {X : Type u} {ι : Type u} (s : ι → Set X) : (⋂ s)ᶜ = ⋃ (fun i => (s i)ᶜ) := by
102+
apply ext
103+
intro x
104+
constructor
105+
· intro h
106+
-- h : ¬∀ i, s i x, goal: ∃ i, ¬s i x
107+
-- Use classical logic via excluded middle
108+
classical
109+
have em : (∃ i, ¬s i x) ∨ ¬(∃ i, ¬s i x) := Classical.em (∃ i, ¬s i x)
110+
cases em with
111+
| inl hex => exact hex
112+
| inr hnex =>
113+
-- hnex : ¬∃ i, ¬s i x, which means ∀ i, s i x
114+
exfalso
115+
apply h
116+
intro i
117+
-- Need to show s i x from ¬∃ i, ¬s i x
118+
have : ¬¬s i x := fun hi => hnex ⟨i, hi⟩
119+
exact Classical.not_not.mp this
120+
· intro ⟨i, hi⟩ h
121+
-- hi : ¬s i x, h : ∀ i, s i x, goal: False
122+
exact hi (h i)
123+
83124

84125
end Set

Minimathlib/Topology.lean

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,23 @@ theorem isClosed_univ : isClosed (𝒰 : Set X) := by
2929

3030
open TopologicalSpace
3131

32-
-- De Morgan's laws for closed sets
33-
theorem isClosed_iUnion : ∀ {ι : Type u} (s : ι → Set X), (∀ i, isClosed (s i)) → isClosed (⋃ s) := by
34-
intro ι s i
32+
-- Correct theorems for closed sets
33+
theorem isClosed_iInter : ∀ {ι : Type u} (s : ι → Set X), (∀ i, isClosed (s i)) → isClosed (⋂ s) := by
34+
intro ι s h
35+
unfold isClosed
36+
-- Goal: isOpen (⋂ s)ᶜ
37+
rw [Set.compl_iInter]
38+
-- Goal: isOpen (⋃ (fun i => (s i)ᶜ))
39+
-- Each (s i)ᶜ is open since s i is closed
3540
sorry
3641

3742
theorem isClosed_union : ∀ s t : Set X, isClosed s → isClosed t → isClosed (s ∪ t) := by
38-
sorry
43+
intro s t hs ht
44+
unfold isClosed
45+
rw [Set.compl_union]
46+
apply isOpen_inter
47+
· exact hs
48+
· exact ht
3949

4050
-- Neighborhood definitions and properties
4151
def nhds (x : X) : Set (Set X) := fun s => ∃ t, isOpen t ∧ x ∈ t ∧ t ⊆ s

0 commit comments

Comments
 (0)