Analysis I, Section 3.5: Cartesian products #
I have attempted to make the translation as faithful a paraphrasing as possible of the original text. When there is a choice between a more idiomatic Lean solution and a more faithful translation, I have generally chosen the latter. In particular, there will be places where the Lean code could be "golfed" to be more elegant and idiomatic, but I have consciously avoided doing so.
Main constructions and results of this section:
- Ordered pairs and n-tuples.
- Cartesian products and n-fold products.
- Finite choice.
- Connections with Mathlib counterparts such as
Set.piandSet.prod.
Tips from past users #
Users of the companion who have completed the exercises in this section are welcome to send their tips for future users in this section as PRs.
- (Add tip here)
Definition 3.5.1 (Ordered pair). One could also have used Object × Object to
define OrderedPair here.
Instances For
Exercise 3.5.1, first part
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
A technical operation, turning a object x and a set Y to a set {x} × Y, needed to define
the full Cartesian product
Equations
- Chapter3.SetTheory.Set.slice x Y = Y.replace ⋯
Instances For
Definition 3.5.4 (Cartesian product)
Equations
- X.cartesian Y = Chapter3.SetTheory.union (X.replace ⋯)
Instances For
This instance enables the ×ˢ notation for Cartesian product.
Equations
Equations
Instances For
Equations
Instances For
This equips an OrderedPair with proofs that x ∈ X and y ∈ Y.
Equations
- Chapter3.SetTheory.Set.mk_cartesian x y = ⟨Chapter3.OrderedPair.toObject { fst := ↑x, snd := ↑y }, ⋯⟩
Instances For
Connections with the Mathlib set product, which consists of Lean pairs like (x, y)
equipped with a proof that x is in the left set, and y is in the right set.
Lean pairs like (x, y) are similar to our OrderedPair, but more general.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Example 3.5.5 / Exercise 3.6.5. There is a bijection between X ×ˢ Y and Y ×ˢ X.
Equations
- X.prod_commutator Y = { toFun := sorry, invFun := sorry, left_inv := ⋯, right_inv := ⋯ }
Instances For
Example 3.5.5. A function of two variables can be thought of as a function of a pair.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Definition 3.5.6. The indexing set I plays the role of { i : 1 ≤ i ≤ n } in the text.
See Exercise 3.5.10 below for some connections betweeen this concept and the preceding notion
of Cartesian product and ordered pair.
Equations
- Chapter3.SetTheory.Set.tuple x = ↑fun (i : I.toSubtype) => ⟨↑(x i), ⋯⟩
Instances For
Definition 3.5.6
Equations
Instances For
Example 3.5.8. There is a bijection between (X ×ˢ Y) ×ˢ Z and X ×ˢ (Y ×ˢ Z).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Example 3.5.10. I suspect most of the equivalences will require classical reasoning and only be defined non-computably, but would be happy to learn of counterexamples.
Equations
- Chapter3.SetTheory.Set.singleton_iProd_equiv i X = { toFun := sorry, invFun := sorry, left_inv := ⋯, right_inv := ⋯ }
Instances For
Example 3.5.10
Equations
- I.iProd_of_const_equiv X = { toFun := sorry, invFun := sorry, left_inv := ⋯, right_inv := ⋯ }
Instances For
Here we set up some an analogue of Mathlib Fin n types within the Chapter 3 Set Theory,
with rudimentary API.
Equations
- Chapter3.SetTheory.Set.Fin n = Chapter3.nat.specify fun (m : Chapter3.nat.toSubtype) => Chapter3.SetTheory.Set.nat_equiv.symm m < n
Instances For
Equations
Connections with Mathlib's Fin n
Equations
- One or more equations did not get rendered due to their size.
Instances For
Exercise 3.5.1, second part (requires axiom of regularity)
Equations
- Chapter3.OrderedPair.toObject' = { toFun := fun (p : Chapter3.OrderedPair) => Chapter3.SetTheory.set_to_object {p.fst, Chapter3.SetTheory.set_to_object {p.fst, p.snd}}, inj' := ⋯ }
Instances For
Custom extensionality lemma for Exercise 3.5.2.
Placing @[ext] on the structure would generate a lemma requiring proof of t.x = t'.x,
but these functions have different types when t.X ≠ t'.X. This lemma handles that part.
Equations
- Chapter3.SetTheory.Set.iProd_equiv_tuples n X = { toFun := sorry, invFun := sorry, left_inv := ⋯, right_inv := ⋯ }
Instances For
Exercise 3.5.3. The spirit here is to avoid direct rewrites (which make all of these claims
trivial), and instead use OrderedPair.eq or SetTheory.Set.tuple_inj
Equations
- Chapter3.SetTheory.Set.graph f = (X ×ˢ Y).specify fun (p : (X ×ˢ Y).toSubtype) => f (Chapter3.SetTheory.Set.fst p) = Chapter3.SetTheory.Set.snd p
Instances For
Exercise 3.5.11. This trivially follows from SetTheory.Set.powerset_axiom, but the
exercise is to derive it from SetTheory.Set.exists_powerset instead.
Exercise 3.5.13