ZFC Natural numbers #
This file defines the natural numbers in ZF set theory. The definition is based on the construction of the Von Neumann ordinals, where each natural number is represented as the set of all smaller natural numbers.
The set of all natural numbers is defined as the smallest inductive set. Because of the axiom of
separation, the definition relies on the existence of an infinite set, which is provided by the
some_inf constant. It can be shown that the choice of some_inf does not affect the definition of
the natural numbers and leads to isomorphic definitions.
The file also includes the definition of the ZFNat type for ZF natural numbers, and provides
various properties and usual arithmetic operations on natural numbers.
Preliminary definitions #
Natural numbers #
The set of natural numbers Nat is defined as the smallest inductive set.
This definition avoids the use of ω, even though ω may be thought of as ℕ.
Equations
Instances For
Equations
- ZFSet.ZFNat.nat_zero = { zero := ⟨∅, ZFSet.ZFNat.zero_in_Nat⟩ }
Equations
- ZFSet.ZFNat.nat_lt = { lt := fun (x y : ZFSet.ZFNat) => ↑x ∈ ↑y }
Equations
- ZFSet.ZFNat.nat_le = { le := fun (x y : ZFSet.ZFNat) => x < y ∨ x = y }
Any inductive set contains zero.
Any inductive set containing an element also contains its successor.
Nat is the least inductive set: it is contained in every inductive set, with no
restriction to subsets of some_inf.
This is the unrestricted form of inductive_subset_some_inf_contains_Nat; the extra
hypothesis a ⊆ some_inf is eliminated by intersecting a with some_inf first.
The definition of Nat is independent of the witness granted by the axiom of infinity:
intersecting the inductive subsets of any inductive set T yields the same set Nat.
In particular Nat = ⋂₀ ((powerset ω).sep inductive_set), so seeding the construction with
some_inf rather than ω is a choice without observable consequence.
Equations
- ZFSet.ZFNat.nat_one = { one := ZFSet.ZFNat.succ 0 }
Any inductive set a separated by an inductive predicate P is inductive.
Recursion on natural numbers #
The relation built over the successor function is a subrelation of the membership relation.
The induction principle for sets in Nat. This principle is meant to be used for definitional
purposes only.
The predecessor function on natural numbers, defined directly as the union of a set.
Equations
Instances For
The recursion principle for sets in Nat. This principle is meant to be used for definitional
purposes only.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Provides the base case of the recursion principle for sets in Nat.
Provides the inductive step of the recursion principle for sets in Nat.
The recursion principle for natural numbers. This recursor allows inductive definitions over natural numbers to be defined in a more natural way.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Uniqueness half of the universal property of ZFNat: ZFNat.rec is the only family
satisfying the two computation rules rec_zero and rec_succ.
Together with rec_zero/rec_succ this says that (ZFNat, 0, succ) is initial among
sets equipped with a point and an endomorphism.
The predecessor function pred' on natural numbers, defined inductively.
This definition is equivalent to pred, as proven by pred'_eq_pred.
Equations
- m.pred' = ZFSet.ZFNat.rec m 0 fun (x x_1 : ZFSet.ZFNat) => x
Instances For
Arithmetic #
Equations
- ZFSet.ZFNat.instPreorder = { toLE := ZFSet.ZFNat.nat_le, toLT := ZFSet.ZFNat.nat_lt, le_refl := ZFSet.ZFNat.instPreorder._proof_1, le_trans := ⋯, lt_iff_le_not_ge := ⋯ }
Equations
- One or more equations did not get rendered due to their size.
The addition function on natural numbers, defined inductively.
Equations
- n.add m = ZFSet.ZFNat.rec n m fun (x : ZFSet.ZFNat) => ZFSet.ZFNat.succ
Instances For
Equations
- ZFSet.ZFNat.add_inst = { add := ZFSet.ZFNat.add }
Equations
- n.sub m = ZFSet.ZFNat.rec m n fun (x : ZFSet.ZFNat) => ZFSet.ZFNat.pred
Instances For
Equations
- ZFSet.ZFNat.sub_inst = { sub := ZFSet.ZFNat.sub }
The multiplication function on natural numbers, defined inductively.
Equations
- n.mul m = ZFSet.ZFNat.rec n 0 fun (x : ZFSet.ZFNat) (x_1 : ZFSet.ZFNat) => x_1 + m
Instances For
Equations
- ZFSet.ZFNat.mul_inst = { mul := ZFSet.ZFNat.mul }
The power function on natural numbers, defined inductively.
Equations
- n.pow p = ZFSet.ZFNat.rec p 1 fun (x : ZFSet.ZFNat) (x_1 : ZFSet.ZFNat) => x_1 * n
Instances For
Equations
- ZFSet.ZFNat.pow_inst = { pow := ZFSet.ZFNat.pow }
Equations
- ZFSet.ZFNat.nsmul 0 x✝ = 0
- ZFSet.ZFNat.nsmul n.succ x✝ = x✝ + ZFSet.ZFNat.nsmul n x✝
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
- ZFSet.ZFNat.instCommSemiring = { toSemiring := ZFSet.ZFNat.instSemiring, mul_comm := ZFSet.ZFNat.mul_comm }
Equations
- n.toNat = ZFSet.ZFNat.rec n 0 fun (x : ZFSet.ZFNat) => Nat.succ
Instances For
Equations
Instances For
Equations
- ZFSet.ZFNat.equivZFNat_Nat = { toFun := ZFSet.ZFNat.toNat, invFun := ZFSet.ZFNat.ofNat, left_inv := ZFSet.ZFNat.equivZFNat_Nat._proof_1✝, right_inv := ZFSet.ZFNat.equivZFNat_Nat._proof_2✝ }
Instances For
Transfer to ℕ #
equivZFNat_Nat says that ZFNat and ℕ are the same type. Upgraded to a ring isomorphism and
registered as a TransferEquiv, it lets the transfer tactic read a goal about ZFNat in ℕ:
example (n m : ZFNat) : n + m = m + n := by
transfer ZFNat → ℕ =>
rw [Nat.add_comm]
The block is proved in ℕ, and closing it closes the goal about ZFNat. The ring operations,
the numerals and the casts travel through the generic map_… lemmas of the transfer_simps
simp set; what those lemmas do not cover is stated here: succ, the truncated subtraction, the
homogeneous power, and the two order relations.
equivZFNat_Nat as a ring isomorphism.
Equations
- ZFSet.ZFNat.ringEquivNat = { toEquiv := ZFSet.ZFNat.equivZFNat_Nat, map_mul' := ZFSet.ZFNat.toNat_mul, map_add' := ZFSet.ZFNat.toNat_add }
Instances For
Equivalence used by the transfer tactic to move goals between ZFNat and ℕ.