Skip to content

Commit 57f4f44

Browse files
committed
Fill in some of 3.5, fix numbering
1 parent bfc6226 commit 57f4f44

File tree

2 files changed

+50
-40
lines changed

2 files changed

+50
-40
lines changed

analysis/Analysis/Section_3_5.lean

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ abbrev SetTheory.Set.slice (x:Object) (Y:Set) : Set :=
6767
theorem SetTheory.Set.mem_slice (x z:Object) (Y:Set) :
6868
z ∈ (SetTheory.Set.slice x Y) ↔ ∃ y:Y, z = (⟨x, y⟩:OrderedPair) := replacement_axiom _ _
6969

70-
/-- Definition 3.5.2 (Cartesian product) -/
70+
/-- Definition 3.5.4 (Cartesian product) -/
7171
abbrev SetTheory.Set.cartesian (X Y:Set) : Set :=
7272
union (X.replace (P := fun x z ↦ z = slice x Y) (by intros; simp_all))
7373

@@ -86,9 +86,6 @@ theorem SetTheory.Set.mem_cartesian (z:Object) (X Y:Set) :
8686
rintro ⟨ x, y, rfl ⟩; use slice x Y; refine ⟨ by simp, ?_ ⟩
8787
rw [replacement_axiom]; use x
8888

89-
abbrev SetTheory.Set.curry {X Y Z:Set} (f: X ×ˢ Y → Z) : X → Y → Z :=
90-
fun x y ↦ f ⟨ (⟨ x, y ⟩:OrderedPair), by simp ⟩
91-
9289
noncomputable abbrev SetTheory.Set.fst {X Y:Set} (z:X ×ˢ Y) : X :=
9390
((mem_cartesian _ _ _).mp z.property).choose
9491

@@ -102,6 +99,7 @@ theorem SetTheory.Set.pair_eq_fst_snd {X Y:Set} (z:X ×ˢ Y) :
10299
obtain ⟨ x, hx: z.val = (⟨ x, snd z ⟩:OrderedPair)⟩ := (exists_comm.mp this).choose_spec
103100
simp_all [EmbeddingLike.apply_eq_iff_eq]
104101

102+
/-- This equips an `OrderedPair` with proofs that `x ∈ X` and `y ∈ Y`. -/
105103
def SetTheory.Set.mk_cartesian {X Y:Set} (x:X) (y:Y) : X ×ˢ Y :=
106104
⟨(⟨ x, y ⟩:OrderedPair), by simp⟩
107105

@@ -124,47 +122,41 @@ theorem SetTheory.Set.mk_cartesian_fst_snd_eq {X Y: Set} (z: X ×ˢ Y) :
124122
(mk_cartesian (fst z) (snd z)) = z := by
125123
rw [mk_cartesian, Subtype.mk.injEq, pair_eq_fst_snd]
126124

127-
noncomputable abbrev SetTheory.Set.uncurry {X Y Z:Set} (f: X → Y → Z) : X ×ˢ Y → Z :=
128-
fun z ↦ f (fst z) (snd z)
129-
130-
theorem SetTheory.Set.curry_uncurry {X Y Z:Set} (f: X → Y → Z) : curry (uncurry f) = f := by sorry
131-
132-
theorem SetTheory.Set.uncurry_curry {X Y Z:Set} (f: X ×ˢ Y → Z) : uncurry (curry f) = f := by sorry
133-
125+
/-- Example 3.5.5 -/
126+
example : ({1, 2}: Set) ×ˢ ({3, 4, 5}: Set) = ({
127+
((mk_cartesian (1: Nat) (3: Nat)): Object),
128+
((mk_cartesian (1: Nat) (4: Nat)): Object),
129+
((mk_cartesian (1: Nat) (5: Nat)): Object),
130+
((mk_cartesian (2: Nat) (3: Nat)): Object),
131+
((mk_cartesian (2: Nat) (4: Nat)): Object),
132+
((mk_cartesian (2: Nat) (5: Nat)): Object)
133+
}: Set) := by
134+
apply ext;
135+
aesop
136+
137+
/-- Example 3.5.5 / Exercise 3.6.5. There is a bijection between `X ×ˢ Y` and `Y ×ˢ X`. -/
134138
noncomputable abbrev SetTheory.Set.prod_commutator (X Y:Set) : X ×ˢ Y ≃ Y ×ˢ X where
135139
toFun := sorry
136140
invFun := sorry
137141
left_inv := sorry
138142
right_inv := sorry
139143

140-
noncomputable abbrev SetTheory.Set.prod_associator (X Y Z:Set) : (X ×ˢ Y) ×ˢ Z ≃ X ×ˢ (Y ×ˢ Z) where
141-
toFun := sorry
142-
invFun := sorry
143-
left_inv := sorry
144-
right_inv := sorry
144+
/-- Example 3.5.5. A function of two variables can be thought of as a function of a pair. -/
145+
noncomputable abbrev SetTheory.Set.curry_equiv {X Y Z:Set} : (X → Y → Z) ≃ (X ×ˢ Y → Z) where
146+
toFun := fun f z ↦ f (fst z) (snd z)
147+
invFun := fun f x y ↦ f ⟨ (⟨ x, y ⟩:OrderedPair), by simp ⟩
148+
left_inv := by intro; simp
149+
right_inv := by intro; simp [←pair_eq_fst_snd]
145150

146-
/--
147-
Connections with the Mathlib set product, which consists of Lean pairs like `(x, y)`
148-
equipped with a proof that `x` is in the left set, and `y` is in the right set.
149-
Lean pairs like `(x, y)` are similar to our `OrderedPair`, but more general.
150-
-/
151-
noncomputable abbrev SetTheory.Set.prod_equiv_prod (X Y:Set) :
152-
((X ×ˢ Y):_root_.Set Object) ≃ (X:_root_.Set Object) ×ˢ (Y:_root_.Set Object) where
153-
toFun := fun z ↦ ⟨(fst z, snd z), by simp⟩
154-
invFun := sorry
155-
left_inv := sorry
156-
right_inv := sorry
157-
158-
159-
/-- Definition 3.5.7 -/
151+
/-- Definition 3.5.6 -/
160152
abbrev SetTheory.Set.tuple {I:Set} {X: I → Set} (a: ∀ i, X i) : Object :=
161153
((fun i ↦ ⟨ a i, by rw [mem_iUnion]; use i; exact (a i).property ⟩):I → iUnion I X)
162154

163-
/-- Definition 3.5.7 -/
155+
/-- Definition 3.5.6 -/
164156
abbrev SetTheory.Set.iProd {I: Set} (X: I → Set) : Set :=
165157
((iUnion I X)^I).specify (fun t ↦ ∃ a : ∀ i, X i, t = tuple a)
166158

167-
/-- Definition 3.5.7 -/
159+
/-- Definition 3.5.6 -/
168160
theorem SetTheory.Set.mem_iProd {I: Set} {X: I → Set} (t:Object) :
169161
t ∈ iProd X ↔ ∃ a: ∀ i, X i, t = tuple a := by
170162
simp only [iProd, specification_axiom'']; constructor
@@ -180,8 +172,27 @@ theorem SetTheory.Set.tuple_mem_iProd {I: Set} {X: I → Set} (a: ∀ i, X i) :
180172
theorem SetTheory.Set.tuple_inj {I:Set} {X: I → Set} (a b: ∀ i, X i) :
181173
tuple a = tuple b ↔ a = b := by sorry
182174

175+
/-- Example 3.5.8. There is a bijection between `(X ×ˢ Y) ×ˢ Z` and `X ×ˢ (Y ×ˢ Z)`. -/
176+
noncomputable abbrev SetTheory.Set.prod_associator (X Y Z:Set) : (X ×ˢ Y) ×ˢ Z ≃ X ×ˢ (Y ×ˢ Z) where
177+
toFun := fun p ↦ mk_cartesian (fst (fst p)) (mk_cartesian (snd (fst p)) (snd p))
178+
invFun := fun p ↦ mk_cartesian (mk_cartesian (fst p) (fst (snd p))) (snd (snd p))
179+
left_inv := by intro; simp
180+
right_inv := by intro; simp
181+
183182
/--
184-
Example 3.5.11. I suspect most of the equivalences will require classical reasoning and only be
183+
Connections with the Mathlib set product, which consists of Lean pairs like `(x, y)`
184+
equipped with a proof that `x` is in the left set, and `y` is in the right set.
185+
Lean pairs like `(x, y)` are similar to our `OrderedPair`, but more general.
186+
-/
187+
noncomputable abbrev SetTheory.Set.prod_equiv_prod (X Y:Set) :
188+
((X ×ˢ Y):_root_.Set Object) ≃ (X:_root_.Set Object) ×ˢ (Y:_root_.Set Object) where
189+
toFun := fun z ↦ ⟨(fst z, snd z), by simp⟩
190+
invFun := fun z ↦ mk_cartesian ⟨z.val.1, z.prop.1⟩ ⟨z.val.2, z.prop.2
191+
left_inv := by intro; simp
192+
right_inv := by intro; simp
193+
194+
/--
195+
Example 3.5.10. I suspect most of the equivalences will require classical reasoning and only be
185196
defined non-computably, but would be happy to learn of counterexamples.
186197
-/
187198
noncomputable abbrev SetTheory.Set.singleton_iProd_equiv (i:Object) (X:Set) :
@@ -191,29 +202,30 @@ noncomputable abbrev SetTheory.Set.singleton_iProd_equiv (i:Object) (X:Set) :
191202
left_inv := sorry
192203
right_inv := sorry
193204

194-
/-- Example 3.5.11 -/
205+
/-- Example 3.5.10 -/
195206
noncomputable abbrev SetTheory.Set.empty_iProd_equiv (X: (∅:Set) → Set) : iProd X ≃ Unit where
196207
toFun := sorry
197208
invFun := sorry
198209
left_inv := sorry
199210
right_inv := sorry
200211

201-
/-- Example 3.5.11 -/
212+
/-- Example 3.5.10 -/
202213
noncomputable abbrev SetTheory.Set.iProd_of_const_equiv (I:Set) (X: Set) :
203214
iProd (fun i:I ↦ X) ≃ (I → X) where
204215
toFun := sorry
205216
invFun := sorry
206217
left_inv := sorry
207218
right_inv := sorry
208219

220+
/-- Example 3.5.10 -/
209221
noncomputable abbrev SetTheory.Set.iProd_equiv_prod (X: ({0,1}:Set) → Set) :
210222
iProd X ≃ (X ⟨ 0, by simp ⟩) ×ˢ (X ⟨ 1, by simp ⟩) where
211223
toFun := sorry
212224
invFun := sorry
213225
left_inv := sorry
214226
right_inv := sorry
215227

216-
/-- Example 3.5.9 -/
228+
/-- Example 3.5.10 -/
217229
noncomputable abbrev SetTheory.Set.iProd_equiv_prod_triple (X: ({0,1,2}:Set) → Set) :
218230
iProd X ≃ (X ⟨ 0, by simp ⟩) ×ˢ (X ⟨ 1, by simp ⟩) ×ˢ (X ⟨ 2, by simp ⟩) where
219231
toFun := sorry
@@ -292,7 +304,7 @@ noncomputable abbrev SetTheory.Set.Fin_equiv_Fin (n:ℕ) : Fin n ≃ _root_.Fin
292304
left_inv := sorry
293305
right_inv := sorry
294306

295-
/-- Lemma 3.5.12 (finite choice) -/
307+
/-- Lemma 3.5.11 (finite choice) -/
296308
theorem SetTheory.Set.finite_choice {n:ℕ} {X: Fin n → Set} (h: ∀ i, X i ≠ ∅) : iProd X ≠ ∅ := by
297309
-- This proof broadly follows the one in the text
298310
-- (although it is more convenient to induct from 0 rather than 1)
@@ -395,14 +407,12 @@ def SetTheory.Set.union_of_prod :
395407
-- the first line of this construction should be `apply isTrue` or `apply isFalse`.
396408
sorry
397409

398-
399410
/- Exercise 3.5.5 -/
400411
def SetTheory.Set.diff_of_prod :
401412
Decidable (∀ (A B C D:Set), (A ×ˢ B) \ (C ×ˢ D) = (A \ C) ×ˢ (B \ D)) := by
402413
-- the first line of this construction should be `apply isTrue` or `apply isFalse`.
403414
sorry
404415

405-
406416
/--
407417
Exercise 3.5.6.
408418
-/

analysis/Analysis/Section_3_6.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ theorem SetTheory.Set.card_pow {X Y:Set} (hX: X.finite) (hY: Y.finite) :
224224
theorem SetTheory.Set.card_eq_zero {X:Set} (hX: X.finite) :
225225
X.card = 0 ↔ X = ∅ := by sorry
226226

227-
/-- Exercise 3.6.5 -/
227+
/-- Exercise 3.6.5. You might find `SetTheory.Set.prod_commutator` useful. -/
228228
theorem SetTheory.Set.prod_EqualCard_prod (A B:Set) :
229229
EqualCard (A ×ˢ B) (B ×ˢ A) := by sorry
230230

0 commit comments

Comments
 (0)