Typecheck / agda (push) Successful in 2m30s
Model/Grothendieck states ZF (base axioms) plus Grothendieck's universe axiom from SGA 4 (every set is a member of a universe: transitive, closed under pairing, power set and unions of families). Model/FromGrothendieck derives our ZF record from it: the chain by iterating the axiom from ω, the limit Setω 0 as a universe containing all Set k (replacement over ω). Model/ConsistencyZF adds no-False-UA, no-0≡1-UA, no-∀A→A-UA. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q7dfaHQ3dYSfqcxR7V5UrJ
172 lines
6.5 KiB
Agda
172 lines
6.5 KiB
Agda
open import univTypes.Model.Grothendieck using (ZFCU; ZFBase; UniverseAxiom; IsUniverse)
|
||
|
||
module univTypes.Model.FromGrothendieck (G : ZFCU) where
|
||
|
||
open import Data.Empty using (⊥; ⊥-elim)
|
||
open import Data.Nat using (ℕ; zero; suc; _<_; s≤s)
|
||
open import Data.Nat.Properties using (<-cmp; m≤n⇒m<n∨m≡n)
|
||
open import Data.Product using (Σ; _×_; proj₁; proj₂) renaming (_,_ to ⟨_,_⟩)
|
||
open import Data.Sum using (_⊎_; inj₁; inj₂)
|
||
open import Relation.Binary using (tri<; tri≈; tri>)
|
||
open import Relation.Binary.PropositionalEquality using (_≡_; refl; sym; trans; cong; subst)
|
||
|
||
open import univTypes.Model.SetTheory using (Stratum; fin; ω+)
|
||
open import univTypes.Model.ZF using (ZF)
|
||
|
||
open ZFCU G
|
||
open ZFBase base
|
||
open UniverseAxiom ua
|
||
module U (x : V) = IsUniverse (𝕌-is x)
|
||
|
||
-- Our ZF record (Model/ZF), from ZFC with Grothendieck's universe axiom:
|
||
-- the chain of universes is obtained by iterating the universe axiom,
|
||
-- with replacement over ω for the limit Setω 0.
|
||
|
||
-- Basics ----------------------------------------------------------------------------------------
|
||
|
||
sng : V → V
|
||
sng a = upair a a
|
||
|
||
sng-in : ∀ {z a} → z ∈ sng a → z ≡ a
|
||
sng-in p with upair-in p
|
||
... | inj₁ q = q
|
||
... | inj₂ q = q
|
||
|
||
-- The empty set: an ∈-minimal member of the (nonempty, transitive) 𝕌 ω.
|
||
private
|
||
minimal : Σ V λ y → y ∈ 𝕌 ω × (∀ z → z ∈ y → z ∈ 𝕌 ω → ⊥)
|
||
minimal = regularity (𝕌 ω) ⟨ ω , 𝕌-∋ ω ⟩
|
||
|
||
∅ : V
|
||
∅ = proj₁ minimal
|
||
|
||
∉∅ : ∀ {z} → z ∈ ∅ → ⊥
|
||
∉∅ {z} z∈ = proj₂ (proj₂ minimal) z z∈ (U.trans ω (proj₁ (proj₂ minimal)) z∈)
|
||
|
||
-- Numerals ------------------------------------------------------------------------------------
|
||
|
||
succᶻ : V → V
|
||
succᶻ x = ⋃ (upair x (upair x x))
|
||
|
||
num : ℕ → V
|
||
num zero = ∅
|
||
num (suc k) = succᶻ (num k)
|
||
|
||
num-∈ : ∀ k → num k ∈ ω
|
||
num-∈ zero = ω-zero (λ z → ∉∅)
|
||
num-∈ (suc k) = ω-suc (num-∈ k)
|
||
|
||
num-< : ∀ {j k} → j < k → num j ∈ num k
|
||
num-< {j} {suc k} (s≤s j≤k) with m≤n⇒m<n∨m≡n j≤k
|
||
... | inj₁ j<k = ⋃-intro upair-l (num-< j<k)
|
||
... | inj₂ refl = ⋃-intro upair-r upair-l
|
||
|
||
∉self : ∀ {x} → x ∈ x → ⊥
|
||
∉self {x} x∈x with regularity (sng x) ⟨ x , upair-l ⟩
|
||
... | ⟨ y , ⟨ y∈ , min ⟩ ⟩ with sng-in y∈
|
||
... | refl = min y x∈x upair-l
|
||
|
||
num-inj : ∀ {j k} → num j ≡ num k → j ≡ k
|
||
num-inj {j} {k} e with <-cmp j k
|
||
... | tri< j<k _ _ = ⊥-elim (∉self (subst (num j ∈_) (sym e) (num-< j<k)))
|
||
... | tri≈ _ j≡k _ = j≡k
|
||
... | tri> _ _ k<j = ⊥-elim (∉self (subst (num k ∈_) e (num-< k<j)))
|
||
|
||
toℕ : V → ℕ
|
||
toℕ x with em (Σ ℕ λ k → num k ≡ x)
|
||
... | inj₁ ⟨ k , _ ⟩ = k
|
||
... | inj₂ _ = 0
|
||
|
||
toℕ-num : ∀ k → toℕ (num k) ≡ k
|
||
toℕ-num k with em (Σ ℕ λ j → num j ≡ num k)
|
||
... | inj₁ ⟨ j , e ⟩ = num-inj e
|
||
... | inj₂ ¬p = ⊥-elim (¬p ⟨ k , refl ⟩)
|
||
|
||
-- The chain -----------------------------------------------------------------------------------
|
||
|
||
-- Set k: iterate the universe axiom from ω.
|
||
finU : ℕ → V
|
||
finU zero = 𝕌 ω
|
||
finU (suc k) = 𝕌 (finU k)
|
||
|
||
-- All Set k, as a set (replacement over ω).
|
||
allFin : V
|
||
allFin = image (λ n → finU (toℕ n)) ω
|
||
|
||
finU-∈ : ∀ k → finU k ∈ allFin
|
||
finU-∈ k = subst (λ j → finU j ∈ allFin) (toℕ-num k) (image-intro {f = λ n → finU (toℕ n)} (num-∈ k))
|
||
|
||
-- Setω m: iterate from a universe containing all Set k.
|
||
ωU : ℕ → V
|
||
ωU zero = 𝕌 allFin
|
||
ωU (suc m) = 𝕌 (ωU m)
|
||
|
||
-- Every universe of the chain is 𝕌 of something.
|
||
seed : Stratum → V
|
||
seed (fin zero) = ω
|
||
seed (fin (suc k)) = finU k
|
||
seed (ω+ zero) = allFin
|
||
seed (ω+ (suc m)) = ωU m
|
||
|
||
univ : Stratum → V
|
||
univ β = 𝕌 (seed β)
|
||
|
||
private
|
||
univ-fin : ∀ k → univ (fin k) ≡ finU k
|
||
univ-fin zero = refl
|
||
univ-fin (suc k) = refl
|
||
|
||
univ-ωU : ∀ m → univ (ω+ m) ≡ ωU m
|
||
univ-ωU zero = refl
|
||
univ-ωU (suc m) = refl
|
||
|
||
-- Grothendieck closure gives the closure we use -----------------------------------------------
|
||
|
||
image-id : ∀ x → image (λ y → y) x ≡ x
|
||
image-id x = ext (λ z z∈ → let ⟨ w , ⟨ w∈ , e ⟩ ⟩ = image-in z∈ in subst (_∈ x) (sym e) w∈)
|
||
(λ z z∈ → image-intro {f = λ y → y} z∈)
|
||
|
||
-- A replacement image is a union of singletons.
|
||
image-⋃ : ∀ f x → image f x ≡ ⋃ (image (λ w → sng (f w)) x)
|
||
image-⋃ f x = ext to from
|
||
where
|
||
to : ∀ z → z ∈ image f x → z ∈ ⋃ (image (λ w → sng (f w)) x)
|
||
to z z∈ with image-in z∈
|
||
... | ⟨ w , ⟨ w∈ , refl ⟩ ⟩ = ⋃-intro (image-intro {f = λ w → sng (f w)} w∈) upair-l
|
||
from : ∀ z → z ∈ ⋃ (image (λ w → sng (f w)) x) → z ∈ image f x
|
||
from z z∈ with ⋃-in z∈
|
||
... | ⟨ y , ⟨ y∈ , z∈y ⟩ ⟩ with image-in y∈
|
||
... | ⟨ w , ⟨ w∈ , refl ⟩ ⟩ = subst (_∈ image f x) (sym (sng-in z∈y)) (image-intro {f = f} w∈)
|
||
|
||
univ-⋃ : ∀ β {x} → x ∈ univ β → ⋃ x ∈ univ β
|
||
univ-⋃ β {x} x∈ = subst (λ s → ⋃ s ∈ univ β) (image-id x)
|
||
(U.family (seed β) x∈ (λ i i∈ → U.trans (seed β) x∈ i∈))
|
||
|
||
univ-image : ∀ β {f x} → x ∈ univ β → (∀ w → w ∈ x → f w ∈ univ β) → image f x ∈ univ β
|
||
univ-image β {f} {x} x∈ f∈ =
|
||
subst (_∈ univ β) (sym (image-⋃ f x)) (U.family (seed β) x∈ (λ w w∈ → U.pair (seed β) (f∈ w w∈) (f∈ w w∈)))
|
||
|
||
-- The ZF record -------------------------------------------------------------------------------------
|
||
|
||
toZF : ZF
|
||
toZF = record
|
||
{ V = V ; _∈_ = _∈_ ; em = em ; ext = ext
|
||
; upair = upair ; upair-in = upair-in ; upair-l = upair-l ; upair-r = upair-r
|
||
; ⋃ = ⋃ ; ⋃-in = ⋃-in ; ⋃-intro = ⋃-intro
|
||
; 𝒫 = 𝒫 ; 𝒫-in = 𝒫-in ; 𝒫-intro = 𝒫-intro
|
||
; image = image ; image-in = image-in ; image-intro = image-intro
|
||
; regularity = regularity
|
||
; ω = ω ; ω-zero = ω-zero ; ω-suc = ω-suc ; ω-ind = ω-ind
|
||
; univ = univ
|
||
; univ-trans = λ β → U.trans (seed β)
|
||
; univ-upair = λ β → U.pair (seed β)
|
||
; univ-⋃ = univ-⋃
|
||
; univ-𝒫 = λ β → U.power (seed β)
|
||
; univ-image = univ-image
|
||
; univ-ω = 𝕌-∋ ω
|
||
; univ-fin-suc = λ k → subst (λ u → u ∈ univ (fin (suc k))) (sym (univ-fin k)) (𝕌-∋ (finU k))
|
||
; univ-ω-suc = λ m → subst (λ u → u ∈ univ (ω+ (suc m))) (sym (univ-ωU m)) (𝕌-∋ (ωU m))
|
||
; univ-lim = λ k → subst (λ u → u ∈ univ (ω+ 0)) (sym (univ-fin k))
|
||
(U.trans allFin (𝕌-∋ allFin) (finU-∈ k))
|
||
}
|