Typecheck / agda (push) Successful in 5m16s
Model/Mathlib states one field per lemma of Mathlib's ZFSet (Mathlib/SetTheory/ZFC/Basic.lean), with Lean names and statements in Agda syntax. Model/FromMathlib derives the base ZF axioms from it (ω as the least inductive subset of Mathlib's omega). Mathlib's ZFSet has no universes, so Model/ConsistencyZF adds Grothendieck's universe axiom on top: no-False-Mathlib, no-0≡1-Mathlib, no-∀A→A-Mathlib. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q7dfaHQ3dYSfqcxR7V5UrJ
76 lines
3.2 KiB
Agda
76 lines
3.2 KiB
Agda
module univTypes.Model.Mathlib where
|
||
|
||
open import Data.Product using (Σ; _×_)
|
||
open import Data.Sum using (_⊎_)
|
||
open import Relation.Binary.PropositionalEquality using (_≡_; _≢_)
|
||
open import Relation.Nullary using (¬_)
|
||
|
||
-- The rules of Mathlib's ZFSet (Mathlib/SetTheory/ZFC/Basic.lean), one
|
||
-- field per Mathlib lemma, with the Lean names (`_` becomes `-`) and the
|
||
-- Lean statements in Agda syntax: Prop becomes Set, ↔ a pair of
|
||
-- functions, ∃ z ∈ x, … a Σ, ∨ / ∧ become ⊎ / ×.
|
||
--
|
||
-- Differences forced by Agda:
|
||
-- * `em` is Lean's Classical.em, which Mathlib uses throughout;
|
||
-- * `image` takes any Agda function (Mathlib asks for [Definable₁ f]);
|
||
-- * `inductionOn` takes its motive explicitly (Agda cannot infer it);
|
||
-- * `x ∩ y` is unfolded to its definition `ZFSet.sep (· ∈ y) x`;
|
||
-- * `range {α : Type u}` is left out: Mathlib's ZFSet.{u} lives in
|
||
-- Type (u+1), a level above its index types, while our carrier is
|
||
-- a Set ranging over Sets, and `range id` would be Russell's set.
|
||
--
|
||
-- Mathlib's ZFSet.{u} has no universes inside it (con-leche adds them by
|
||
-- assuming inaccessibles); Model/FromMathlib derives the base axioms, and
|
||
-- the chain comes from Grothendieck's universe axiom on top.
|
||
|
||
infix 3 _↔_
|
||
_↔_ : Set → Set → Set
|
||
A ↔ B = (A → B) × (B → A)
|
||
|
||
record Mathlib : Set₁ where
|
||
infix 4 _∈_
|
||
field
|
||
ZFSet : Set
|
||
_∈_ : ZFSet → ZFSet → Set
|
||
|
||
em : (P : Set) → P ⊎ ¬ P
|
||
|
||
-- ext : (∀ z : ZFSet.{u}, z ∈ x ↔ z ∈ y) → x = y
|
||
ext : ∀ {x y} → (∀ z → z ∈ x ↔ z ∈ y) → x ≡ y
|
||
|
||
-- notMem_empty (x) : x ∉ (∅ : ZFSet.{u})
|
||
∅ : ZFSet
|
||
notMem-empty : ∀ x → ¬ (x ∈ ∅)
|
||
|
||
-- mem_insert_iff : x ∈ insert y z ↔ x = y ∨ x ∈ z
|
||
insert : ZFSet → ZFSet → ZFSet
|
||
mem-insert-iff : ∀ {x y z} → x ∈ insert y z ↔ (x ≡ y ⊎ x ∈ z)
|
||
|
||
-- mem_sep : y ∈ ZFSet.sep p x ↔ y ∈ x ∧ p y
|
||
sep : (ZFSet → Set) → ZFSet → ZFSet
|
||
mem-sep : ∀ {p x y} → y ∈ sep p x ↔ (y ∈ x × p y)
|
||
|
||
-- mem_powerset : y ∈ powerset x ↔ y ⊆ x
|
||
powerset : ZFSet → ZFSet
|
||
mem-powerset : ∀ {x y} → y ∈ powerset x ↔ (∀ {z} → z ∈ y → z ∈ x)
|
||
|
||
-- mem_sUnion : y ∈ ⋃₀ x ↔ ∃ z ∈ x, y ∈ z
|
||
⋃₀ : ZFSet → ZFSet
|
||
mem-sUnion : ∀ {x y} → y ∈ ⋃₀ x ↔ (Σ ZFSet λ z → z ∈ x × y ∈ z)
|
||
|
||
-- mem_image [Definable₁ f] : y ∈ image f x ↔ ∃ z ∈ x, f z = y
|
||
image : (ZFSet → ZFSet) → ZFSet → ZFSet
|
||
mem-image : ∀ {f x y} → y ∈ image f x ↔ (Σ ZFSet λ z → z ∈ x × f z ≡ y)
|
||
|
||
-- omega_zero : ∅ ∈ omega
|
||
-- omega_succ : n ∈ omega.{u} → insert n n ∈ omega.{u}
|
||
omega : ZFSet
|
||
omega-zero : ∅ ∈ omega
|
||
omega-succ : ∀ {n} → n ∈ omega → insert n n ∈ omega
|
||
|
||
-- regularity (x : ZFSet.{u}) (h : x ≠ ∅) : ∃ y ∈ x, x ∩ y = ∅
|
||
regularity : ∀ x → x ≢ ∅ → Σ ZFSet λ y → y ∈ x × sep (_∈ y) x ≡ ∅
|
||
|
||
-- inductionOn {p : ZFSet → Prop} (x) (h : ∀ x, (∀ y ∈ x, p y) → p x) : p x
|
||
inductionOn : (p : ZFSet → Set) → ∀ x → (∀ x → (∀ y → y ∈ x → p y) → p x) → p x
|