This section runs one chain. It starts at \(\mathrm {id}\) and ends at composition, relations and the Yoneda step. Each link uses only the links named in its heading. Composition is not assumed at the start; it appears at link 12 as a computed branch. Until then the only operation in use is application, written \(f(x)\).
The identity uses \(x\) twice: once as what is taken, once as what is returned. Writing the two uses side by side gives the diagonal.
The diagonal has two places, so there are two ways to read it.
The same computation holds with \(\pi _2\). Making and then reading changes nothing.
Define \(e(p) := (\pi _1 p,\ \pi _2 p)\).
So \(e\) is idempotent. A pair is what \(e\) fixes. For every pair \(p\), therefore,
This is extensionality of pairs. It holds for every pair because pairs are defined as the fixed points of \(e\), not built in one special shape.
Links 4 and 5 are given names.
Link 4 is the first triangle identity and link 5 is the second. The word adjunction names this shape: a unit, a counit, and two triangles that return the identity. Nothing is added here; the shape was already computed.
Define \(e_1(p) := \Delta (\pi _1 p)\).
The pairs fixed by \(e_1\):
Write \(E(x,y)\) for “\((x,y)\) is fixed by \(e_1\)”. The diagonal is always fixed:
so \(E(x,x)\) holds. The swap is \(\sigma (p) := (\pi _2 p,\ \pi _1 p)\).
If \(E(x,y)\) then \((x,y) = (x,x)\).
Transport.
Reversal.
so \(E(y,x)\).
Joining. Given \(E(x,y)\) and \(E(y,z)\), transport with \(Q(t) := E(t,z)\) gives \(E(x,z)\).
Hold one place of the pair open for \(a\). The same shape as link 6 appears again.
First triangle:
Second triangle:
A function is what the second triangle fixes, in the same way that a pair is what \(e\) fixes in link 5. Extensionality of functions therefore holds for every function.
Define \(\varphi (k)(c)(a) := k(c,a)\) and \(\psi (h)(c,a) := h(c)(a)\).
So \(\psi \varphi \) and \(\varphi \psi \) return what they were given.
\(K\) comes from reading (link 3). \(S\) comes from the diagonal (link 2) and from \(\varepsilon \) (link 9).
By the second triangle of link 9, \(SKK = \mathrm {id}\).
Define \(B := S(KS)K\).
Composition is this branch:
Its laws are computed.
By the second triangle of link 9, \(\mathrm {id} \circ f = f = f \circ \mathrm {id}\) and \((h \circ g) \circ f = h \circ (g \circ f)\). This is a category. The earlier links can now be rewritten with \(\circ \):
The sameness \(E\) of link 7 is the unit. In one direction:
In the other:
So \(E;R = R\), and \(R;E = R\) in the same way using reversal. For associativity, both \((R;S);T\) and \(R;(S;T)\) at \((a,d)\) say: for some \(b\) and \(c\), \(R(a,b)\), \(S(b,c)\) and \(T(c,d)\).
A relation \(f\) with reverse \(f^\circ \) is a function when
Its kernel \(k := f;f^\circ \) is idempotent.
and conversely
The idempotent of link 7 has returned: for \(f = \mathrm {id}\) the kernel is \(E\).
Let \(\alpha \) satisfy the square \(\alpha _{b'}(f \circ h) = F(f)\bigl (\alpha _b(h)\bigr )\).
The value at \(\mathrm {id}\) fixes the value at every arrow. This is transport (link 8) without reversal.
| Link | From | What appears | Key line |
| 1 | – | identity | \(\mathrm {id}(x) = x\) |
| 2 | 1 | diagonal | \(\Delta (x) = (x,x)\) |
| 3 | 2 | readings | \(\pi _1(x,y) = x\) |
| 4 | 2, 3 | first triangle | \(\pi _1(\Delta x) = \mathrm {id}(x)\) |
| 5 | 3 | second triangle, pairs | \(p = (\pi _1 p, \pi _2 p)\) |
| 6 | 4, 5 | adjunction | \(\eta = \Delta \), \(\varepsilon = (\pi _1,\pi _2)\) |
| 7 | 4 | idempotent, sameness, swap | \(e_1(e_1(p)) = e_1(p)\) |
| 8 | 7 | transport, reversal, joining | \(E(x,y) \Rightarrow E(y,x)\) |
| 9 | 6 | functions, extensionality | \((a \mapsto f(a)) = f\) |
| 10 | 9 | correspondence | \(\psi \varphi (k) = k\), \(\varphi \psi (h) = h\) |
| 11 | 2, 3, 9 | \(K\), \(S\) | \(SKK = \mathrm {id}\) |
| 12 | 11 | composition, category | \(S(KS)K\,g\,f\,x = g(f(x))\) |
| 13 | 7, 8 | relations | \(E;R = R\) |
| 14 | 13 | kernel | \(k;k = k\) |
| 15 | 12 | Yoneda step | \(\alpha _b(f) = F(f)(\alpha _a(\mathrm {id}))\) |
What is used without derivation. Application \(f(x)\) is present from link 1. The words “for some” and “and” in link 13 are used as they stand. Everything else in the table is a computation from the links named in its row.
The chain is checked in one Lean 4 file, IdChain.lean. The file has no imports and uses the Lean core only. It was run in the web editor at live.lean-lang.org under Lean v4.37.0-rc1 and produced no errors and no warnings. The file ends with 22 #print axioms commands, one for each main statement, and each returns “does not depend on any axioms”.
| Link | Lean name | Proof |
| 4 | tri1 | rfl |
| 5 | pair_ext, e_fix | rfl |
| 6 | adj_tri1, adj_tri2 | rfl |
| 7 | e1_idem, E_refl | rfl |
| 8 | transport, E_symm, E_trans, E_app | reading with \(\pi _2\) |
| 9 | fn_tri1, fn_tri2 | rfl |
| 10 | psi_phi, phi_psi | rfl |
| 11 | SKK | rfl |
| 12 | Bc_app, comp_assoc, e1_idem_comp | rfl |
| 13 | unit_left, unit_right, rcomp_assoc | transport |
| 14 | ker_sub, ker_sup, ker_refl | transport |
| 15 | yoneda, yoneda_back | square at \(\mathrm {id}\) |
|
|
What the check rests on. Composition is defined in the file as \(S(KS)K\) and is not used before link 12. The two extensionality statements, pair_ext and fn_tri2, hold by the eta rules of the Lean core for structures and for functions. The sameness \(E\) of link 7 is stated with the core equality, and links 13 and 14 use the core \(\exists \) and \(\wedge \). Equalities between relations are stated pointwise as \(\leftrightarrow \), so propositional extensionality is not used.
IdChain.lean
/-
IdChain.lean
One chain: id → diagonal → readings → triangles → adjunction →
idempotent / sameness → functions → K, S → composition (last, as a
branch) → relations → kernel → Yoneda step.
Lean 4 core only. No imports. No axioms (see the #print axioms block
at the end). Until Link 12 the only operation used is application.
-/
namespace IdChain
/-! ## Link 1: the identity -/
def idf {A : Type} (x : A) : A := x
theorem id_app {A : Type} (x : A) : idf x = x := rfl
/-! ## Link 2 (from 1): the diagonal -/
structure Pair (A B : Type) where
fst : A
snd : B
def diag {A : Type} (x : A) : Pair A A := Pair.mk x x
/-! ## Link 3 (from 2): the two readings -/
def p1 {A B : Type} (p : Pair A B) : A := p.fst
def p2 {A B : Type} (p : Pair A B) : B := p.snd
theorem p1_mk {A B : Type} (x : A) (y : B) : p1 (Pair.mk x y) = x := rfl
theorem p2_mk {A B : Type} (x : A) (y : B) : p2 (Pair.mk x y) = y := rfl
/-! ## Link 4 (from 2, 3): the first triangle -/
theorem tri1 {A : Type} (x : A) : p1 (diag x) = idf x := rfl
theorem tri1_right {A : Type} (x : A) : p2 (diag x) = idf x := rfl
/-! ## Link 5 (from 3): the second triangle and pairs -/
def e {A B : Type} (p : Pair A B) : Pair A B := Pair.mk (p1 p) (p2 p)
theorem e_idem {A B : Type} (p : Pair A B) : e (e p) = e p := rfl
/-- Every pair is fixed by `e`. -/
theorem e_fix {A B : Type} (p : Pair A B) : e p = p := rfl
/-- Extensionality of pairs, for every pair. -/
theorem pair_ext {A B : Type} (p : Pair A B) : p = Pair.mk (p1 p) (p2 p) := rfl
/-! ## Link 6 (from 4, 5): the adjunction (names only) -/
def eta1 {A : Type} : A → Pair A A := diag
/-- Triangle 1: make, then read. -/
theorem adj_tri1 {A : Type} (x : A) : p1 (eta1 x) = x := rfl
/-- Triangle 2: p ↦ (p, p) ↦ (π₁ p, π₂ p) = p. -/
theorem adj_tri2 {A B : Type} (p : Pair A B) :
Pair.mk (p1 (p1 (eta1 p))) (p2 (p2 (eta1 p))) = p := rfl
/-! ## Link 7 (from 4): idempotent, sameness, swap -/
def e1 {A : Type} (p : Pair A A) : Pair A A := diag (p1 p)
theorem e1_idem {A : Type} (p : Pair A A) : e1 (e1 p) = e1 p := rfl
/-- Sameness: the pair `(x, y)` is fixed by `e1`. -/
abbrev E {A : Type} (x y : A) : Prop := e1 (Pair.mk x y) = Pair.mk x y
theorem E_refl {A : Type} (x : A) : E x x := Eq.refl (Pair.mk x x)
theorem E_to_eq {A : Type} {x y : A} (h : E x y) : x = y := congrArg p2 h
theorem E_of_eq {A : Type} {x y : A} (h : x = y) : E x y :=
congrArg (fun t => Pair.mk x t) h
def sw {A B : Type} (p : Pair A B) : Pair B A := Pair.mk (p2 p) (p1 p)
theorem sw_sw {A B : Type} (p : Pair A B) : sw (sw p) = p := rfl
theorem sw_diag {A : Type} (x : A) : sw (diag x) = diag x := rfl
/-! ## Link 8 (from 7): transport, reversal, joining, application -/
/-- Transport: Q(y) = Q(π₂(x,y)) = Q(π₂(x,x)) = Q(x). -/
theorem transport {A : Type} {x y : A} (Q : A → Prop) (h : E x y) (q : Q y) : Q x :=
Eq.mpr (congrArg (fun p => Q (p2 p)) h) q
theorem transport' {A : Type} {x y : A} (Q : A → Prop) (h : E x y) (q : Q x) : Q y :=
Eq.mp (congrArg (fun p => Q (p2 p)) h) q
/-- The swap step of the reversal: σ(x,x) = σ(x,y). -/
theorem sw_step {A : Type} {x y : A} (h : E x y) : Pair.mk x x = Pair.mk y x :=
congrArg sw h
theorem E_symm {A : Type} {x y : A} (h : E x y) : E y x :=
transport (fun t => E y t) h (E_refl y)
theorem E_trans {A : Type} {x y z : A} (h1 : E x y) (h2 : E y z) : E x z :=
transport (fun t => E t z) h1 h2
theorem E_app {A B : Type} (f : A → B) {x y : A} (h : E x y) : E (f x) (f y) :=
transport' (fun t => E (f x) (f t)) h (E_refl (f x))
/-! ## Link 9 (from 6): one place held open -/
def unit2 {C A : Type} (c : C) (a : A) : Pair C A := Pair.mk c a
def ev {A B : Type} (p : Pair (A → B) A) : B := (p1 p) (p2 p)
/-- Triangle 1: ε(η(c), a) = (c, a). -/
theorem fn_tri1 {C A : Type} (c : C) (a : A) :
ev (Pair.mk (unit2 c) a) = Pair.mk c a := rfl
/-- Triangle 2: (a ↦ ε(f, a)) = f. Extensionality of functions, for every function. -/
theorem fn_tri2 {A B : Type} (f : A → B) : (fun a => ev (Pair.mk f a)) = f := rfl
/-! ## Link 10 (from 9): the correspondence -/
def phi {C A B : Type} (k : Pair C A → B) (c : C) (a : A) : B := k (Pair.mk c a)
def psi {C A B : Type} (h : C → A → B) (p : Pair C A) : B := h (p1 p) (p2 p)
theorem psi_phi {C A B : Type} (k : Pair C A → B) : psi (phi k) = k := rfl
theorem phi_psi {C A B : Type} (h : C → A → B) : phi (psi h) = h := rfl
/-! ## Link 11 (from 2, 3, 9): K and S -/
/-- K: read the left place of η(x)(y). -/
def K {A B : Type} (x : A) (y : B) : A := p1 (unit2 x y)
/-- S: use x twice through the diagonal, then apply with ε. -/
def S {A B C : Type} (f : A → B → C) (g : A → B) (x : A) : C :=
ev (Pair.mk (f (p1 (diag x))) (g (p2 (diag x))))
theorem K_app {A B : Type} (x : A) (y : B) : K x y = x := rfl
theorem S_app {A B C : Type} (f : A → B → C) (g : A → B) (x : A) :
S f g x = f x (g x) := rfl
theorem SKK_app {A : Type} (x : A) :
@S A (A → A) A (@K A (A → A)) (@K A A) x = idf x := rfl
theorem SKK {A : Type} :
@S A (A → A) A (@K A (A → A)) (@K A A) = @idf A := rfl
/-! ## Link 12 (from 11): composition, as a branch -/
/-- B := S (K S) K. -/
def Bc {A M C : Type} : (M → C) → (A → M) → A → C :=
@S (M → C) (A → M → C) ((A → M) → A → C)
(@K ((A → M → C) → (A → M) → A → C) (M → C) (@S A M C))
(@K (M → C) A)
theorem Bc_app {A M C : Type} (g : M → C) (f : A → M) (x : A) :
Bc g f x = g (f x) := rfl
def comp {A M C : Type} (g : M → C) (f : A → M) : A → C := Bc g f
theorem comp_id_left {A B : Type} (f : A → B) : comp idf f = f := rfl
theorem comp_id_right {A B : Type} (f : A → B) : comp f idf = f := rfl
theorem comp_assoc {A B C D : Type} (h : C → D) (g : B → C) (f : A → B) :
comp (comp h g) f = comp h (comp g f) := rfl
/-- The earlier links, rewritten with composition. -/
theorem tri1_comp {A : Type} : comp (@p1 A A) (@diag A) = @idf A := rfl
theorem e1_comp {A : Type} : @e1 A = comp (@diag A) (@p1 A A) := rfl
theorem e1_idem_comp {A : Type} : comp (@e1 A) (@e1 A) = @e1 A := rfl
theorem sw_sw_comp {A B : Type} : comp (@sw B A) (@sw A B) = @idf (Pair A B) := rfl
/-! ## Link 13 (from 7, 8): composition of relations -/
abbrev rcomp {A M C : Type} (R : A → M → Prop) (T : M → C → Prop)
(a : A) (c : C) : Prop :=
∃ b, R a b ∧ T b c
theorem unit_left {A C : Type} (R : A → C → Prop) (a : A) (c : C) :
rcomp E R a c ↔ R a c :=
Iff.intro
(fun h => match h with
| ⟨_, hab, hr⟩ => transport (fun t => R t c) hab hr)
(fun r => ⟨a, E_refl a, r⟩)
theorem unit_right {A C : Type} (R : A → C → Prop) (a : A) (c : C) :
rcomp R E a c ↔ R a c :=
Iff.intro
(fun h => match h with
| ⟨_, hr, hbc⟩ => transport' (fun t => R a t) hbc hr)
(fun r => ⟨c, r, E_refl c⟩)
theorem rcomp_assoc {A B C D : Type}
(R : A → B → Prop) (T : B → C → Prop) (U : C → D → Prop) (a : A) (d : D) :
rcomp (rcomp R T) U a d ↔ rcomp R (rcomp T U) a d :=
Iff.intro
(fun h => match h with
| ⟨c, ⟨b, r, t⟩, u⟩ => ⟨b, r, ⟨c, t, u⟩⟩)
(fun h => match h with
| ⟨b, r, ⟨c, t, u⟩⟩ => ⟨c, ⟨b, r, t⟩, u⟩)
/-! ## Link 14 (from 13): the kernel of a function -/
abbrev conv {A B : Type} (R : A → B → Prop) (b : B) (a : A) : Prop := R a b
abbrev rle {A B : Type} (R T : A → B → Prop) : Prop := ∀ a b, R a b → T a b
abbrev ker {A B : Type} (f : A → B → Prop) : A → A → Prop := rcomp f (conv f)
/-- k;k ≤ k, from "the value is one" (f°;f ≤ E). -/
theorem ker_sub {A B : Type} (f : A → B → Prop)
(single : rle (rcomp (conv f) f) E) :
rle (rcomp (ker f) (ker f)) (ker f) :=
fun _ a'' h => match h with
| ⟨a', ⟨b, hab, ha'b⟩, ⟨b', ha'b', ha''b'⟩⟩ =>
⟨b, hab,
transport (fun t => f a'' t) (single b b' ⟨a', ha'b, ha'b'⟩) ha''b'⟩
/-- k ≤ k;k. -/
theorem ker_sup {A B : Type} (f : A → B → Prop) :
rle (ker f) (rcomp (ker f) (ker f)) :=
fun _ a' h => match h with
| ⟨b, hab, ha'b⟩ => ⟨a', ⟨b, hab, ha'b⟩, ⟨b, ha'b, ha'b⟩⟩
/-- The kernel is symmetric. -/
theorem ker_symm {A B : Type} (f : A → B → Prop) (a a' : A) :
ker f a a' → ker f a' a :=
fun h => match h with
| ⟨b, hab, ha'b⟩ => ⟨b, ha'b, hab⟩
/-- E ≤ k, from "a value exists". -/
theorem ker_refl {A B : Type} (f : A → B → Prop) (tot : ∀ a, ∃ b, f a b) :
rle E (ker f) :=
fun a _ h => match tot a with
| ⟨b, hab⟩ => ⟨b, hab, transport' (fun t => f t b) h hab⟩
/-! ## Link 15 (from 12): the Yoneda step -/
/-- The value at the identity fixes the value at every arrow. -/
theorem yoneda
(F : Type → Type)
(map : ∀ (X Y : Type), (X → Y) → F X → F Y)
(A : Type)
(α : ∀ X : Type, (A → X) → F X)
(nat : ∀ (X Y : Type) (g : X → Y) (h : A → X),
α Y (comp g h) = map X Y g (α X h))
(X : Type) (f : A → X) :
α X f = map A X f (α A idf) :=
nat A X f idf
/-- Back: every `x : F A` gives such a family, and its value at the identity is `x`. -/
theorem yoneda_back
(F : Type → Type)
(map : ∀ (X Y : Type), (X → Y) → F X → F Y)
(map_id : ∀ (X : Type) (x : F X), map X X idf x = x)
(map_comp : ∀ (X Y Z : Type) (g : Y → Z) (h : X → Y) (x : F X),
map X Z (comp g h) x = map Y Z g (map X Y h x))
(A : Type) (x : F A) :
(∀ (X Y : Type) (g : X → Y) (h : A → X),
map A Y (comp g h) x = map X Y g (map A X h x))
∧ map A A idf x = x :=
⟨fun X Y g h => map_comp A X Y g h x, map_id A x⟩
/-! ## Axiom check -/
#print axioms tri1
#print axioms pair_ext
#print axioms adj_tri2
#print axioms e1_idem
#print axioms E_symm
#print axioms E_trans
#print axioms E_app
#print axioms fn_tri2
#print axioms psi_phi
#print axioms phi_psi
#print axioms SKK
#print axioms Bc_app
#print axioms comp_assoc
#print axioms e1_idem_comp
#print axioms unit_left
#print axioms unit_right
#print axioms rcomp_assoc
#print axioms ker_sub
#print axioms ker_sup
#print axioms ker_refl
#print axioms yoneda
#print axioms yoneda_back
end IdChain
This section runs one chain from the identity to the number systems. There are two seeds: \(a=a\) and its negation. There is one move: form an idempotent and look at what it fixes. The positive side (links 9–15) is a cartesian closed category obtained from idempotents alone. The negative side (links 16–18) comes from negating \(a=a\). The two sides meet at the numbers (links 19–27). For an idempotent \(e\) we write \(\mathrm {Fix}(e)\) for the things with \(e(x)=x\).
The identity has two places, the one taken and the one returned. They are written side by side.
Define \(e(p) := (\pi _1 p,\ \pi _2 p)\).
A pair is a fixed point of \(e\), so \(p = (\pi _1 p,\ \pi _2 p)\) for every pair. This is the first idempotent of the chain.
Link 4 and link 5 are the two triangle identities.
Join \(\eta \) and \(\varepsilon \) in the other order: \(e_1(p) := \Delta (\pi _1 p)\).
Sameness is what \(e_1\) fixes:
The swap is \(\sigma (p) := (\pi _2 p,\ \pi _1 p)\), with \(\sigma (\sigma (p)) = p\).
If \(E(x,y)\) then \((x,y) = (x,x)\).
With \(Q(t) := E(y,t)\) this gives reversal, with \(Q(t) := E(t,z)\) joining, and with \(Q(t) := E(f\,x, f\,t)\) application.
The idempotent is the constant map \(1(x) := a\).
This is \(a=a\), once. From any idempotent \(b\) there is exactly one arrow to \(1\), namely \(x \mapsto a\).
For idempotents \(a\) and \(b\) define \((a \times b)(p) := \bigl (a(\pi _1 p),\ b(\pi _2 p)\bigr )\).
Its fixed points are the pairs of a fixed point of \(a\) and a fixed point of \(b\). Link 5 is the case \(\mathrm {id} \times \mathrm {id}\).
For idempotents \(a\) and \(b\) define the sandwich \([a \to b](f) := b \circ f \circ a\).
An arrow from \(a\) to \(b\) is a fixed point: \(f = b\,f\,a\). The following are computed from \(a\,a = a\) alone.
Identity. The idempotent is its own identity arrow:
Unit laws.
Composition. If \(f = b\,f\,a\) and \(g = c\,g\,b\) then
so \(g \circ f\) is an arrow from \(a\) to \(c\).
Associativity. Doing maps one after another carries no brackets: \(h\,(g\,f) = (h\,g)\,f\).
Objects are idempotents and arrows are fixed points of the sandwich. This is a category. Links 4 and 7 read in it:
Define \(\varphi (k)(x)(y) := k(x,y)\) and \(\psi (h)(x,y) := h(x)(y)\). If \(k\) is an arrow \(a \times b \to c\), that is \(k(x,y) = c\bigl (k(a\,x, b\,y)\bigr )\), then
If \(h\) is an arrow \(a \to (b \to c)\) then
So \(\mathrm {Fix}[a \times b \to c]\) and \(\mathrm {Fix}[a \to (b \to c)]\) correspond. Passing the two identity arrows across gives the unit and the counit:
The triangles:
The second triangle is extensionality: to be a function is to be fixed by the sandwich. The combinators are
and for \(a = b = c = \mathrm {id}\),
Links 9–12 form a cartesian closed category.
Place \(x\) with \(\Delta \), apply \(f\) and \(g\), and ask whether \(e_1\) fixes the result.
Then \([f = f]\) is everything and \([\pi _1 = \pi _2] = E\). For commuting idempotents \(e\,e' = e'e\):
The idempotent law \(e\,e = e\) reads “\(P\) and \(P\) is \(P\)”. The order is \(e \le e' :\iff e'e = e\). The graph of \(f\) is \([f \pi _1 = \pi _2]\), its kernel is \([f \pi _1 = f \pi _2]\), its fixed points are \([f = \mathrm {id}]\), and \(f\) is injective when its kernel is \(E\).
| Link | Idempotent | Statement | Counting |
| 9 | \(1\) | true | \(1\) |
| 10 | \(a \times b\) | and | product |
| 11 | \(a \to b\) | implies | power |
| 12 | currying | \((c^{b})^{a} = c^{a \cdot b}\) | |
Read as statements, \(K\) and \(S\) are the two axioms of implication and \(\varepsilon \) is detachment:
\(SKK\) is the proof of \(P \Rightarrow P\), that is, of \(a=a\).
Let \(F\) preserve identities and composition. On families \(\alpha \) define \(N(\alpha )(f) := F(f)\bigl (\alpha (\mathrm {id})\bigr )\).
The fixed points are the natural families, and each is fixed by its value at the identity. Link 8 is the first case.
The meaning of the seed is that from \(0\) anything follows: for each \(c\) there is exactly one arrow \(0 \to c\). Negation is \(\neg P := [a \to 0]\). The two seeds differ: \(1\) has the fixed point \(a\), while a fixed point of \(0\) would give everything. No idempotent has \(0\) as its set of fixed points, since \(e(x)\) is always fixed; this is why \(0\) is a seed and not a link.
Negation reverses arrows: \(f : a \to b\) gives \((k \mapsto k \circ f) : \neg b \to \neg a\).
So \(\neg \neg \neg = \neg \) and therefore \(\neg \neg \neg \neg = \neg \neg \). The fixed points of \(\neg \neg \) are the two-valued statements.
The negative connectives are the positive ones turned by negation.
By link 17, \(\neg (P \vee Q) = \neg P \wedge \neg Q\). The truth values are \(\Omega := \{0, 1\}\).
| Positive | Negative |
| \(1\), true | \(0\), false |
| and | or |
| all | some |
| product, power | sum |
Every part is the solution of an equation, \([P] = [\chi _P = 1]\) with \(\chi _P\) valued in \(\Omega \), and the parts of \(X\) form \(2^X := [X \to \Omega ]\), an instance of link 11. Products (link 10), solutions of equations (link 13), the terminal object (link 9), arrows as objects (links 11, 12) and \(\Omega \) are the ingredients of a topos.
Let \(\Phi \) preserve the order on \(2^X\). Define
The closed parts are \(\mathrm {Fix}(\mathrm {cl})\). The least one is \(\mu \Phi := \mathrm {cl}(0)\), and
Zero comes from the negative side, “one more” from the positive side.
The piece added by \(S\) is \(\{x \mid x = n\}\), one instance of \(a=a\). Induction is the statement that \(\mathbb {N}\) is least, and \(\mathbb {N} = 1 + \mathbb {N}\) is \(\Phi (\mu \Phi ) = \mu \Phi \). Further, \(0 \neq S(n)\) because \(n \in S(n)\), and \(S\) is injective because \(m \in n \in m\) does not occur.
Close \(\{(0, \mathrm {id})\}\) under \((n,g) \mapsto (S\,n,\ f \circ g)\). By induction each \(n\) has exactly one \(g\), written \(f^n\).
Truncated subtraction is defined the same way: \(m \mathbin {\dot {-}} 0 = m\), \(S\,m \mathbin {\dot {-}} S\,n = m \mathbin {\dot {-}} n\), \(0 \mathbin {\dot {-}} n = 0\).
On pairs of numbers define \(n(a,b) := (a \mathbin {\dot {-}} b,\ b \mathbin {\dot {-}} a)\). One coordinate of \(n(a,b)\) is \(0\), so \(n(n(a,b)) = n(a,b)\). The fixed points are the pairs with one coordinate \(0\): \((a,0)\) is \(a\) and \((0,b)\) is \(-b\).
Subtraction is the swap and zero is the diagonal.
On pairs \((p,q)\) with \(q \neq 0\) define the reduction \(r(p,q) := (p/g,\ q/g)\), with \(g\) the greatest common divisor. A reduced pair is not reduced further, so \(r\,r = r\). The fixed points are the fractions in lowest terms.
Division is the swap and one is the diagonal.
On \(2^{\mathbb {Q}}\) define
Then \(c\,c = c\) and the fixed points are the cuts. The order is inclusion, and the least upper bound of a bounded family is \(c(\bigcup )\).
On pairs with a conjugation define
The idempotent is \(\mathrm {Re}(x) := (x + x^{*})/2\), and its fixed points are the previous number system.
Order is lost at \(\mathbb {C}\), commutativity at \(\mathbb {H}\), associativity at \(\mathbb {O}\), and the construction stops there.
An idempotent \(j\) on \(\Omega \) (\(j\,j = j\)) has the sheaves as its fixed points, and the sheaves again form a topos (link 19). For \(j = \neg \neg \) the topos is two-valued.
| Link | Idempotent | Fixed points |
| 5 | \(e(p) = (\pi _1 p, \pi _2 p)\) | pairs |
| 7 | \(e_1 = \Delta \pi _1\) | sameness \(E\) |
| 9 | constant \(x \mapsto a\) | \(1\) |
| 10 | \(a \times b\) | product |
| 11 | \(f \mapsto b \circ f \circ a\) | arrows; identity, composition |
| 12 | sandwich, twice | currying; \(\eta \), \(\varepsilon \), \(K\), \(S\) |
| 13 | \(e_1\) on \((f,g)\); \(e\,e'\) | solutions of equations; and |
| 15 | \(N\) | natural families |
| 17 | \(\neg \neg \) | two-valued statements |
| 20 | \(\mathrm {cl}\) | closed parts; \(\mathbb {N}\) |
| 23 | \(n\) | \(\mathbb {Z}\) |
| 24 | reduction \(r\) | \(\mathbb {Q}\) |
| 25 | \(c\) | \(\mathbb {R}\) |
| 26 | \(\mathrm {Re}\) | the previous number system |
| 27 | \(j\) | sheaves |
Seeds. \(a=a\) (link 1) and its negation (link 16). That the two differ is the content of having two seeds.
Standing assumption. Idempotents are themselves things that maps can be applied to. Links 11, 12 and 19 use this.
Logic of the negative side. Links 17 and 18 give a two-valued logic: “or” and “some” are defined through negation.
Numbers. In link 21 a number is both a thing and a collection of things.
Machine check. Links 1–8 are checked in the Lean 4 file IdChain.lean with no axioms. Links 9–27 are hand computations in the present arrangement. In links 23–25 the idempotence of \(n\), \(r\) and \(c\) is stated with a one-line reason and is not yet expanded.
The chain is checked in one Lean 4 file, OneMove.lean (Listing 5). The file has no imports and uses the Lean core only. It was run in the web editor at live.lean-lang.org under Lean v4.37.0-rc1 and produced no errors and no warnings. The file ends with 30 #print axioms commands, and the editor reports 30 messages, each of the form “does not depend on any axioms” (Figure 14).
| Link | Content | Lean names |
| 1–8 | places, pairs, \(e_1\), sameness, transport | tri1, e1_idem, E_trans |
| 9 | terminal object | konst_idem, konst_fix |
| 10 | product | prod_idem |
| 11 | sandwich, identity, unit laws, composition | sand_idem, arr_id, arr_comp |
| 12 | currying, \(\eta \), \(\varepsilon \), triangles, \(K\), \(S\) | curry_arr, tri_one, SKK, Bc_app |
| 13 | solutions of equations, commuting idempotents | sol_iff, comp_idem, fix_right |
| 14 | \(K\), \(S\) as axioms of implication | ax_K, ax_S, id_from_SK |
| 15 | the Yoneda idempotent | yN_idem, yN_fix |
| 16–18 | zero, double negation, or, some | one_ne_zero, dn_idem, lem’, demorgan |
| 20 | closure, least fixed point | cl_idem, mu_closed, mu_open |
| 21–22 | numbers, sum, product | mul_succ, zero_ne_succ, succ_inj |
| 23 | integers | norm_idem, norm_diag, norm_sw |
| 26 | \(i^2 = -1\), \(ij = k\), \(ji = -k\) | ci_sq, ij_eq_k, ji_eq_neg_k |
How the file differs from the text. Links 21 and 22 are realised in the file as “compose \(n\) times” rather than as collections; zero differs from every successor by reading at the two seeds of link 16. Link 23 is computed on a small inductive number type introduced in the file for truncated subtraction. Link 26 is computed on the integers of the Lean core, and the octonions are not included.
Not in the file. Link 19 (the topos), link 24 (the rationals), link 25 (the reals) and link 27 (sheaves) are stated in the text only.
OneMove.lean
/-
OneMove.lean
One source, one move: idempotents and their fixed points.
Seeds: a = a, and its negation.
Move: form an idempotent, look at what it fixes.
Lean 4 core only. No imports. No axioms (see the end).
Coverage, by link of the section:
1-8 places, pairs, e1, sameness, transport
9-12 terminal object, product, arrows (sandwich), currying, K, S
13 solutions of equations, commuting idempotents, order
14 K, S as the axioms of implication
15 the Yoneda idempotent
16-18 zero as the negation of a = a, double negation, or, some
20 closure, least fixed point
21-22 numbers, sum, product (realised as "compose n times")
23 integers: the normalising idempotent on pairs
26 complex numbers and quaternions: i*i = -1, ij = k, ji = -k
(computed on the core integers)
Not in this file: 19 (topos, stated in the text), 24 (rationals),
25 (reals), 27 (sheaves).
-/
namespace OneMove
/-! ## Links 1-8: places -/
def idf {A : Type} (x : A) : A := x
structure Pair (A B : Type) where
fst : A
snd : B
def diag {A : Type} (x : A) : Pair A A := Pair.mk x x
def p1 {A B : Type} (p : Pair A B) : A := p.fst
def p2 {A B : Type} (p : Pair A B) : B := p.snd
theorem tri1 {A : Type} (x : A) : p1 (diag x) = idf x := rfl
def e {A B : Type} (p : Pair A B) : Pair A B := Pair.mk (p1 p) (p2 p)
theorem e_idem {A B : Type} (p : Pair A B) : e (e p) = e p := rfl
theorem pair_ext {A B : Type} (p : Pair A B) : p = Pair.mk (p1 p) (p2 p) := rfl
def e1 {A : Type} (p : Pair A A) : Pair A A := diag (p1 p)
theorem e1_idem {A : Type} (p : Pair A A) : e1 (e1 p) = e1 p := rfl
/-- Sameness: the pair is fixed by `e1`. -/
abbrev E {A : Type} (x y : A) : Prop := e1 (Pair.mk x y) = Pair.mk x y
theorem E_refl {A : Type} (x : A) : E x x := Eq.refl (Pair.mk x x)
theorem E_to_eq {A : Type} {x y : A} (h : E x y) : x = y := congrArg p2 h
theorem E_of_eq {A : Type} {x y : A} (h : x = y) : E x y :=
congrArg (fun t => Pair.mk x t) h
def sw {A B : Type} (p : Pair A B) : Pair B A := Pair.mk (p2 p) (p1 p)
theorem sw_sw {A B : Type} (p : Pair A B) : sw (sw p) = p := rfl
theorem transport {A : Type} {x y : A} (Q : A → Prop) (h : E x y) (q : Q y) : Q x :=
Eq.mpr (congrArg (fun p => Q (p2 p)) h) q
theorem transport' {A : Type} {x y : A} (Q : A → Prop) (h : E x y) (q : Q x) : Q y :=
Eq.mp (congrArg (fun p => Q (p2 p)) h) q
theorem E_symm {A : Type} {x y : A} (h : E x y) : E y x :=
transport (fun t => E y t) h (E_refl y)
theorem E_trans {A : Type} {x y z : A} (h1 : E x y) (h2 : E y z) : E x z :=
transport (fun t => E t z) h1 h2
theorem E_app {A B : Type} (f : A → B) {x y : A} (h : E x y) : E (f x) (f y) :=
transport' (fun t => E (f x) (f t)) h (E_refl (f x))
/-! ## The move: idempotents -/
def Idem {A : Type} (a : A → A) : Prop := ∀ x, a (a x) = a x
theorem idem_id {A : Type} : Idem (@idf A) := fun _ => rfl
theorem idem_e {A B : Type} : Idem (@e A B) := fun _ => rfl
theorem idem_e1 {A : Type} : Idem (@e1 A) := fun _ => rfl
/-! ## Link 9: the terminal object -/
def konst {A : Type} (a : A) : A → A := fun _ => a
theorem konst_idem {A : Type} (a : A) : Idem (konst a) := fun _ => rfl
theorem konst_fix {A : Type} (a x : A) : konst a x = x ↔ x = a :=
Iff.intro (fun h => Eq.symm h) (fun h => Eq.symm h)
/-- Every arrow into `konst a` is the constant one. -/
theorem to_konst {A B : Type} (a : A) (b : B → B) (f : B → A) :
(fun x => konst a (f (b x))) = fun _ => a := rfl
/-! ## Link 10: products -/
def prod {A B : Type} (a : A → A) (b : B → B) (p : Pair A B) : Pair A B :=
Pair.mk (a (p1 p)) (b (p2 p))
theorem prod_idem {A B : Type} {a : A → A} {b : B → B}
(ha : Idem a) (hb : Idem b) : Idem (prod a b) :=
fun p =>
Eq.trans
(congrArg (fun t => Pair.mk t (b (b (p2 p)))) (ha (p1 p)))
(congrArg (fun t => Pair.mk (a (p1 p)) t) (hb (p2 p)))
theorem e_is_prod {A B : Type} : prod (@idf A) (@idf B) = @e A B := rfl
/-! ## Link 11: arrows are the fixed points of the sandwich -/
def sand {A B : Type} (a : A → A) (b : B → B) (f : A → B) : A → B :=
fun x => b (f (a x))
theorem sand_idem {A B : Type} {a : A → A} {b : B → B}
(ha : Idem a) (hb : Idem b) (f : A → B) (x : A) :
sand a b (sand a b f) x = sand a b f x :=
Eq.trans (hb (f (a (a x)))) (congrArg (fun t => b (f t)) (ha x))
def Arr {A B : Type} (a : A → A) (b : B → B) (f : A → B) : Prop :=
∀ x, sand a b f x = f x
/-- The idempotent is its own identity arrow. -/
theorem arr_id {A : Type} {a : A → A} (ha : Idem a) : Arr a a a :=
fun x => Eq.trans (ha (a x)) (ha x)
/-- Right unit law: f ∘ a = f. -/
theorem arr_right {A B : Type} {a : A → A} {b : B → B} {f : A → B}
(ha : Idem a) (hf : Arr a b f) (x : A) : f (a x) = f x :=
Eq.trans (Eq.symm (hf (a x)))
(Eq.trans (congrArg (fun t => b (f t)) (ha x)) (hf x))
/-- Left unit law: b ∘ f = f. -/
theorem arr_left {A B : Type} {a : A → A} {b : B → B} {f : A → B}
(hb : Idem b) (hf : Arr a b f) (x : A) : b (f x) = f x :=
Eq.trans (congrArg b (Eq.symm (hf x)))
(Eq.trans (hb (f (a x))) (hf x))
/-- Composition: arrows compose to an arrow. -/
theorem arr_comp {A B C : Type} {a : A → A} {b : B → B} {c : C → C}
{f : A → B} {g : B → C}
(ha : Idem a) (hc : Idem c) (hf : Arr a b f) (hg : Arr b c g) :
Arr a c (fun x => g (f x)) :=
fun x =>
Eq.trans (congrArg (fun t => c (g t)) (arr_right ha hf x))
(arr_left hc hg (f x))
/-- Associativity: doing maps in a row has no brackets. -/
theorem comp_assoc {A B C D : Type} (h : C → D) (g : B → C) (f : A → B) :
(fun x => h ((fun y => g (f y)) x)) = (fun x => (fun y => h (g y)) (f x)) := rfl
/-- Links 4 and 7 read as arrows: Δ : id → e1 and π₁ : e1 → id. -/
theorem diag_arr {A : Type} : Arr (@idf A) (@e1 A) (@diag A) := fun _ => rfl
theorem p1_arr {A : Type} : Arr (@e1 A) (@idf A) (@p1 A A) := fun _ => rfl
theorem p1_diag {A : Type} (x : A) : p1 (diag x) = x := rfl
theorem diag_p1 {A : Type} (p : Pair A A) : diag (p1 p) = e1 p := rfl
/-! ## Link 12: currying -/
def phi {A B C : Type} (k : Pair A B → C) (x : A) (y : B) : C := k (Pair.mk x y)
def psi {A B C : Type} (h : A → B → C) (p : Pair A B) : C := h (p1 p) (p2 p)
theorem psi_phi {A B C : Type} (k : Pair A B → C) : psi (phi k) = k := rfl
theorem phi_psi {A B C : Type} (h : A → B → C) : phi (psi h) = h := rfl
theorem curry_arr {A B C : Type} {a : A → A} {b : B → B} {c : C → C}
{k : Pair A B → C} (hk : Arr (prod a b) c k) (x : A) (y : B) :
c (phi k (a x) (b y)) = phi k x y :=
hk (Pair.mk x y)
theorem uncurry_arr {A B C : Type} {a : A → A} {b : B → B} {c : C → C}
{h : A → B → C} (hh : ∀ x y, c (h (a x) (b y)) = h x y) :
Arr (prod a b) c (psi h) :=
fun p => hh (p1 p) (p2 p)
def eta {A B : Type} (a : A → A) (b : B → B) : A → B → Pair A B := phi (prod a b)
theorem eta_app {A B : Type} (a : A → A) (b : B → B) (x : A) (y : B) :
eta a b x y = Pair.mk (a x) (b y) := rfl
def eps {B C : Type} (b : B → B) (c : C → C) (p : Pair (B → C) B) : C :=
c ((p1 p) (b (p2 p)))
/-- Triangle 1. -/
theorem tri_one {A B : Type} {a : A → A} {b : B → B}
(ha : Idem a) (hb : Idem b) (x : A) (y : B) :
eps b (prod a b) (Pair.mk (eta a b x) y) = Pair.mk (a x) (b y) :=
Eq.trans
(congrArg (fun t => Pair.mk t (b (b (b y)))) (ha x))
(congrArg (fun t => Pair.mk (a x) t) (Eq.trans (hb (b y)) (hb y)))
/-- Triangle 2: the map y ↦ ε(f, y) is the sandwich of f. -/
theorem tri_two {B C : Type} (b : B → B) (c : C → C) (f : B → C) :
(fun y => eps b c (Pair.mk f y)) = sand b c f := rfl
/-- Triangle 2 on an arrow: extensionality. -/
theorem tri_two_arr {B C : Type} {b : B → B} {c : C → C} {f : B → C}
(hf : Arr b c f) (y : B) : eps b c (Pair.mk f y) = f y := hf y
/-- The combinators, at the identity idempotents. -/
def K {A B : Type} (x : A) (_y : B) : A := x
def S {A B C : Type} (f : A → B → C) (g : A → B) (x : A) : C := f x (g x)
theorem SKK {A : Type} : @S A (A → A) A (@K A (A → A)) (@K A A) = @idf A := rfl
def Bc {A M C : Type} : (M → C) → (A → M) → A → C :=
@S (M → C) (A → M → C) ((A → M) → A → C)
(@K ((A → M → C) → (A → M) → A → C) (M → C) (@S A M C))
(@K (M → C) A)
theorem Bc_app {A M C : Type} (g : M → C) (f : A → M) (x : A) :
Bc g f x = g (f x) := rfl
/-! ## Link 13: solutions of equations; commuting idempotents; order -/
def Sol {X A : Type} (f g : X → A) (x : X) : Prop := E (f x) (g x)
theorem sol_iff {X A : Type} (f g : X → A) (x : X) : Sol f g x ↔ f x = g x :=
Iff.intro (fun h => E_to_eq h) (fun h => E_of_eq h)
theorem sol_refl {X A : Type} (f : X → A) (x : X) : Sol f f x := E_refl (f x)
theorem comp_idem {X : Type} {u v : X → X}
(hu : Idem u) (hv : Idem v) (hc : ∀ y, u (v y) = v (u y)) :
Idem (fun x => u (v x)) :=
fun x =>
Eq.trans
(congrArg u (Eq.trans (Eq.symm (hc (v x))) (congrArg u (hv x))))
(hu (v x))
theorem fix_both {X : Type} {u v : X → X} {x : X}
(h : u x = x) (h' : v x = x) : u (v x) = x :=
Eq.trans (congrArg u h') h
theorem fix_left {X : Type} {u v : X → X} {x : X}
(hu : Idem u) (h : u (v x) = x) : u x = x :=
Eq.trans (congrArg u (Eq.symm h)) (Eq.trans (hu (v x)) h)
theorem fix_right {X : Type} {u v : X → X} {x : X}
(hv : Idem v) (hc : ∀ y, u (v y) = v (u y)) (h : u (v x) = x) : v x = x :=
Eq.trans (congrArg v (Eq.symm h))
(Eq.trans (Eq.trans (Eq.symm (hc (v x))) (congrArg u (hv x))) h)
/-- The order on idempotents. -/
def ile {X : Type} (u v : X → X) : Prop := ∀ x, v (u x) = u x
theorem ile_refl {X : Type} {u : X → X} (hu : Idem u) : ile u u := fun x => hu x
/-! ## Link 14: K and S as the axioms of implication -/
theorem ax_K {P Q : Prop} : P → Q → P := fun p _ => p
theorem ax_S {P Q R : Prop} : (P → Q → R) → (P → Q) → P → R := fun f g p => f p (g p)
theorem detach {P Q : Prop} : (P → Q) → P → Q := fun f p => f p
theorem id_from_SK {P : Prop} : P → P := @ax_S P (P → P) P ax_K ax_K
/-! ## Link 15: the Yoneda idempotent -/
def yN (F : Type → Type) (map : ∀ (X Y : Type), (X → Y) → F X → F Y)
(A : Type) (α : ∀ X : Type, (A → X) → F X) : ∀ X : Type, (A → X) → F X :=
fun X f => map A X f (α A idf)
theorem yN_idem (F : Type → Type) (map : ∀ (X Y : Type), (X → Y) → F X → F Y)
(map_id : ∀ (X : Type) (x : F X), map X X idf x = x)
(A : Type) (α : ∀ X : Type, (A → X) → F X) (X : Type) (f : A → X) :
yN F map A (yN F map A α) X f = yN F map A α X f :=
congrArg (map A X f) (map_id A (α A idf))
/-- A natural family is a fixed point of `yN`. -/
theorem yN_fix (F : Type → Type) (map : ∀ (X Y : Type), (X → Y) → F X → F Y)
(A : Type) (α : ∀ X : Type, (A → X) → F X)
(nat : ∀ (X Y : Type) (g : X → Y) (h : A → X),
α Y (fun x => g (h x)) = map X Y g (α X h))
(X : Type) (f : A → X) :
α X f = yN F map A α X f :=
nat A X f idf
/-! ## Links 16-18: the negative side -/
/-- One: a = a. -/
def OneP : Prop := ∀ (A : Type) (a : A), a = a
theorem one_holds : OneP := fun _ _ => rfl
/-- Zero: the negation of a = a. From it anything follows. -/
def ZeroP : Prop := ∀ C : Prop, OneP → C
theorem zero_elim (h : ZeroP) (C : Prop) : C := h C one_holds
/-- The two seeds differ. -/
theorem one_ne_zero : OneP = ZeroP → ZeroP := fun h => Eq.mp h one_holds
abbrev Not' (P : Prop) : Prop := P → ZeroP
theorem dn_in {P : Prop} : P → Not' (Not' P) := fun p k => k p
theorem dn_triple {P : Prop} : Not' (Not' (Not' P)) → Not' P :=
fun n p => n (fun k => k p)
/-- Double negation is idempotent. -/
theorem dn_idem {P : Prop} : Not' (Not' (Not' (Not' P))) ↔ Not' (Not' P) :=
Iff.intro (fun h => dn_triple h) (fun h => dn_in h)
structure Both (P Q : Prop) : Prop where
l : P
r : Q
abbrev Or' (P Q : Prop) : Prop := Not' (Both (Not' P) (Not' Q))
theorem inl' {P Q : Prop} (p : P) : Or' P Q := fun w => w.l p
theorem inr' {P Q : Prop} (q : Q) : Or' P Q := fun w => w.r q
/-- P or not P. -/
theorem lem' (P : Prop) : Or' P (Not' P) := fun w => w.r w.l
theorem demorgan {P Q : Prop} : Not' (Or' P Q) ↔ Both (Not' P) (Not' Q) :=
Iff.intro
(fun n => Both.mk (fun p => n (inl' p)) (fun q => n (inr' q)))
(fun w o => o w)
abbrev Some' {A : Type} (R : A → Prop) : Prop := Not' (∀ b, Not' (R b))
theorem some_intro {A : Type} {R : A → Prop} (b : A) (r : R b) : Some' R :=
fun w => w b r
/-! ## Link 20: closure and the least fixed point -/
def cl {X : Type} (Φ : (X → Prop) → X → Prop) (P : X → Prop) (x : X) : Prop :=
∀ Q : X → Prop, (∀ y, P y → Q y) → (∀ y, Φ Q y → Q y) → Q x
def Mono {X : Type} (Φ : (X → Prop) → X → Prop) : Prop :=
∀ P Q : X → Prop, (∀ y, P y → Q y) → ∀ y, Φ P y → Φ Q y
theorem le_cl {X : Type} {Φ : (X → Prop) → X → Prop} (P : X → Prop) (y : X)
(h : P y) : cl Φ P y :=
fun _ hPQ _ => hPQ y h
theorem cl_closed {X : Type} {Φ : (X → Prop) → X → Prop} (m : Mono Φ)
(P : X → Prop) (y : X) (h : Φ (cl Φ P) y) : cl Φ P y :=
fun Q hPQ hQ => hQ y (m (cl Φ P) Q (fun _ hz => hz Q hPQ hQ) y h)
/-- Closure is idempotent. -/
theorem cl_idem {X : Type} {Φ : (X → Prop) → X → Prop} (m : Mono Φ)
(P : X → Prop) (x : X) : cl Φ (cl Φ P) x ↔ cl Φ P x :=
Iff.intro
(fun h => h (cl Φ P) (fun _ hy => hy) (fun y hy => cl_closed m P y hy))
(fun h => le_cl (cl Φ P) x h)
/-- The least fixed point: the closure of zero. -/
def mu {X : Type} (Φ : (X → Prop) → X → Prop) : X → Prop := cl Φ (fun _ => ZeroP)
theorem mu_closed {X : Type} {Φ : (X → Prop) → X → Prop} (m : Mono Φ) (y : X)
(h : Φ (mu Φ) y) : mu Φ y :=
cl_closed m (fun _ => ZeroP) y h
theorem mu_open {X : Type} {Φ : (X → Prop) → X → Prop} (m : Mono Φ) (x : X)
(h : mu Φ x) : Φ (mu Φ) x :=
h (Φ (mu Φ))
(fun y z => zero_elim z (Φ (mu Φ) y))
(fun y hy => m (Φ (mu Φ)) (mu Φ) (fun z hz => mu_closed m z hz) y hy)
/-! ## Links 21-22: numbers, realised as "compose n times" -/
abbrev Num : Type 1 := ∀ A : Type, (A → A) → A → A
def zero : Num := fun _ _ a => a
def succ (n : Num) : Num := fun A f a => f (n A f a)
def add (m n : Num) : Num := fun A f a => n A f (m A f a)
def mul (m n : Num) : Num := fun A f a => n A (m A f) a
theorem add_zero (m : Num) : add m zero = m := rfl
theorem add_succ (m n : Num) : add m (succ n) = succ (add m n) := rfl
theorem mul_zero (m : Num) : mul m zero = zero := rfl
theorem mul_succ (m n : Num) : mul m (succ n) = add (mul m n) m := rfl
/-- One is the identity. -/
theorem one_is_id (A : Type) (f : A → A) : succ zero A f = f := rfl
/-- Being a number: the closure of zero under successor. -/
def IsNat (n : Num) : Prop :=
∀ P : Num → Prop, P zero → (∀ m, P m → P (succ m)) → P n
theorem isNat_zero : IsNat zero := fun _ h0 _ => h0
theorem isNat_succ {n : Num} (h : IsNat n) : IsNat (succ n) :=
fun P h0 hs => hs n (h P h0 hs)
theorem num_ind (P : Num → Prop) (h0 : P zero) (hs : ∀ m, P m → P (succ m))
{n : Num} (h : IsNat n) : P n := h P h0 hs
def Same (m n : Num) : Prop :=
∀ (A : Type) (f : A → A) (a : A), m A f a = n A f a
theorem same_refl (n : Num) : Same n n := fun _ _ _ => rfl
/-- 0 is not a successor: read at (Ω, K 0, 1). -/
theorem zero_ne_succ (n : Num) : Same zero (succ n) → ZeroP :=
fun h => one_ne_zero (h Prop (fun _ => ZeroP) OneP)
def shift {A : Type} (f : A → A) (p : Pair A A) : Pair A A :=
Pair.mk (f (p1 p)) (p1 p)
theorem left_read (A : Type) (f : A → A) (a : A) {n : Num} (h : IsNat n) :
p1 (n (Pair A A) (shift f) (diag a)) = n A f a :=
h (fun k => p1 (k (Pair A A) (shift f) (diag a)) = k A f a)
rfl
(fun _ ih => congrArg f ih)
theorem right_read (A : Type) (f : A → A) (a : A) (n : Num) :
p2 (succ n (Pair A A) (shift f) (diag a))
= p1 (n (Pair A A) (shift f) (diag a)) := rfl
/-- Successor is injective. -/
theorem succ_inj {m n : Num} (hm : IsNat m) (hn : IsNat n)
(h : Same (succ m) (succ n)) : Same m n :=
fun A f a =>
Eq.trans (Eq.symm (left_read A f a hm))
(Eq.trans
(congrArg p2 (h (Pair A A) (shift f) (diag a)))
(left_read A f a hn))
/-! ## Link 23: the integers as fixed points of a normalising idempotent -/
inductive Nt : Type where
| z : Nt
| s : Nt → Nt
def pred : Nt → Nt
| Nt.z => Nt.z
| Nt.s a => a
/-- Truncated subtraction. -/
def monus (a : Nt) : Nt → Nt
| Nt.z => a
| Nt.s b => pred (monus a b)
theorem zm : ∀ b : Nt, monus Nt.z b = Nt.z
| Nt.z => rfl
| Nt.s b => congrArg pred (zm b)
theorem monus_ss (a : Nt) : ∀ b : Nt, monus (Nt.s a) (Nt.s b) = monus a b
| Nt.z => rfl
| Nt.s b => congrArg pred (monus_ss a b)
theorem mm : ∀ a : Nt, monus a a = Nt.z
| Nt.z => rfl
| Nt.s a => Eq.trans (monus_ss a a) (mm a)
theorem monus_swap : ∀ a b : Nt, monus (monus a b) (monus b a) = monus a b
| Nt.z, b => congrArg (fun t => monus t b) (zm b)
| Nt.s a, Nt.z => congrArg (fun t => monus (Nt.s a) t) (zm (Nt.s a))
| Nt.s a, Nt.s b =>
Eq.trans
(congrArg (fun t => monus t (monus (Nt.s b) (Nt.s a))) (monus_ss a b))
(Eq.trans
(congrArg (fun t => monus (monus a b) t) (monus_ss b a))
(Eq.trans (monus_swap a b) (Eq.symm (monus_ss a b))))
def norm (p : Pair Nt Nt) : Pair Nt Nt :=
Pair.mk (monus (p1 p) (p2 p)) (monus (p2 p) (p1 p))
/-- The normalisation is idempotent; its fixed points are the integers. -/
theorem norm_idem : Idem norm :=
fun p =>
Eq.trans
(congrArg
(fun t => Pair.mk t (monus (monus (p2 p) (p1 p)) (monus (p1 p) (p2 p))))
(monus_swap (p1 p) (p2 p)))
(congrArg (fun t => Pair.mk (monus (p1 p) (p2 p)) t)
(monus_swap (p2 p) (p1 p)))
/-- The diagonal is zero. -/
theorem norm_diag (a : Nt) : norm (diag a) = Pair.mk Nt.z Nt.z :=
Eq.trans
(congrArg (fun t => Pair.mk t (monus a a)) (mm a))
(congrArg (fun t => Pair.mk Nt.z t) (mm a))
/-- Negation is the swap. -/
theorem norm_sw (p : Pair Nt Nt) : norm (sw p) = sw (norm p) := rfl
/-! ## Link 26: pairs with conjugation, computed on the core integers -/
abbrev Cx : Type := Pair Int Int
def cmul (x y : Cx) : Cx :=
Pair.mk (p1 x * p1 y - p2 y * p2 x) (p2 y * p1 x + p2 x * p1 y)
def cconj (x : Cx) : Cx := Pair.mk (p1 x) (- p2 x)
def cneg (x : Cx) : Cx := Pair.mk (- p1 x) (- p2 x)
def cadd (x y : Cx) : Cx := Pair.mk (p1 x + p1 y) (p2 x + p2 y)
def csub (x y : Cx) : Cx := Pair.mk (p1 x - p1 y) (p2 x - p2 y)
def c0 : Cx := Pair.mk 0 0
def c1 : Cx := Pair.mk 1 0
def ci : Cx := Pair.mk 0 1
/-- i * i = -1. -/
theorem ci_sq : cmul ci ci = (Pair.mk (-1) 0 : Cx) := rfl
abbrev Hq : Type := Pair Cx Cx
def hmul (x y : Hq) : Hq :=
Pair.mk
(csub (cmul (p1 x) (p1 y)) (cmul (cconj (p2 y)) (p2 x)))
(cadd (cmul (p2 y) (p1 x)) (cmul (p2 x) (cconj (p1 y))))
def hneg (x : Hq) : Hq := Pair.mk (cneg (p1 x)) (cneg (p2 x))
def hi : Hq := Pair.mk ci c0
def hj : Hq := Pair.mk c0 c1
def hk : Hq := Pair.mk c0 ci
/-- ij = k and ji = -k: commutativity is lost. -/
theorem ij_eq_k : hmul hi hj = hk := rfl
theorem ji_eq_neg_k : hmul hj hi = hneg hk := rfl
/-! ## Axiom check -/
#print axioms E_trans
#print axioms konst_fix
#print axioms prod_idem
#print axioms sand_idem
#print axioms arr_id
#print axioms arr_comp
#print axioms curry_arr
#print axioms uncurry_arr
#print axioms tri_one
#print axioms tri_two_arr
#print axioms SKK
#print axioms Bc_app
#print axioms comp_idem
#print axioms fix_right
#print axioms yN_idem
#print axioms yN_fix
#print axioms one_ne_zero
#print axioms dn_idem
#print axioms lem'
#print axioms demorgan
#print axioms cl_idem
#print axioms mu_open
#print axioms mul_succ
#print axioms zero_ne_succ
#print axioms succ_inj
#print axioms norm_idem
#print axioms norm_diag
#print axioms ci_sq
#print axioms ij_eq_k
#print axioms ji_eq_neg_k
end OneMove
A space is a set \(X\) with a closure on \(2^X\): an order-preserving map with
This is the idempotent of link 20 with one more line, the last. The closed parts are its fixed points, and the open parts are their negations.
So closed parts are stable under all meets and finite joins. The interior is \(A^{\circ } := \neg \,\overline {\neg A}\), and it is idempotent by link 17:
A map \(f\) is continuous when \(f(\overline {A}) \le \overline {f(A)}\). The open parts are the site on which the sheaves of link 27 live.
Let \(A\) be a commutative ring. Two maps reverse the order:
with \(I \le I(V(I))\) and \(Z \le V(I(Z))\). The computation is that of link 17, where negation was such a pair with itself:
So \(I \mapsto I(V(I))\) is idempotent, and \(Z \mapsto V(I(Z))\) is a closure on the set of primes: by link 28 this is the space \(\mathrm {Spec}\,A\). The radical is idempotent by a direct count of exponents:
The functions on the basic open part \(D(f)\) are the fractions \(A[1/f]\): pairs \((a, f^{n})\) under the kernel \((a,f^{m}) \sim (b,f^{n}) :\iff f^{k}(a f^{n} - b f^{m}) = 0\), as in link 24. Inverting \(f\) twice is inverting it once, \(A[1/f][1/f] = A[1/f]\). When the \(D(f_i)\) cover, \(1 = \sum _i h_i f_i^{\,n}\), and a section vanishing on every \(D(f_i)\) vanishes:
The adjunction has the shape of link 6:
A scheme is a space glued from pieces \(\mathrm {Spec}\,A\) by link 27.
Take \(A := \mathbb {Z}\) in link 29:
For a field extension with group \(G\), two maps again reverse the order:
with \(H \le \mathrm {Gal}(\mathrm {Fix}\,H)\) and \(L \le \mathrm {Fix}(\mathrm {Gal}\,L)\). By the computation of link 17,
The closed subgroups and the closed intermediate fields correspond, each being the fixed points of its idempotent. Here \(\mathrm {Fix}\) is the move of this section in its literal form. The same holds for the Frobenius map \(x \mapsto x^{p}\) in characteristic \(p\):
Completion at \(p\) is idempotent, and its fixed points are the complete rings; \(\mathbb {Z}_p\) is the completion of \(\mathbb {Z}\). For a field \(k\), \(\pi _1^{\text {\'et}}(\mathrm {Spec}\,k) = \mathrm {Gal}(k^{\mathrm {sep}}/k)\).
This is the first structure that comes from the negative side. On \(\Omega \) define the sum \(x + y := (x \wedge \neg y) \vee (\neg x \wedge y)\).
So \(1 + 1 = 0\): twice is nothing. A chain is a finite part of the set of simplices, an element of \(2^{S}\) (link 19), and chains add pointwise by this sum. The boundary of a simplex is the part made of its faces,
extended to chains by the sum. In \(\partial \partial \) each face with two vertices removed occurs twice, once for each order of removal:
Where the positive side has \(e\,e = e\), the negative side has \(\partial \,\partial = 0\). The cycles are the solutions of an equation (link 13), the boundaries are an image, and the second lies in the first:
Here \(Z/B\) is \(Z\) with sameness \(z \sim z' :\iff z + z' \in B\). For sheaves the same quotient measures what global sections fail to preserve: