Typecheck / agda (push) Successful in 2m22s
True is the unit type (`True = `Unit, `trivial = `tt). `False : Set has no introduction form; `absurd P e : P for e : False never reduces at the root (neutral when e is). Covered through level equality, confluence, the level normaliser, subject reduction, progress, decidability and strong normalisation (members of False are terms reducing to a neutral term). The set-theory interface gains an empty set, which False denotes; Model/Consistency proves no-False. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q7dfaHQ3dYSfqcxR7V5UrJ
97 lines
3.9 KiB
Agda
97 lines
3.9 KiB
Agda
module univTypes.Model.SetTheory where
|
||
|
||
open import Data.Empty using (⊥)
|
||
open import Data.Nat using (ℕ; zero; suc; _≤_; _<_)
|
||
open import Relation.Binary.PropositionalEquality using (_≡_)
|
||
|
||
-- The set theory the model lives in, as an interface (cf. con-leche's
|
||
-- `SetTheory`). It is a record, passed as a module parameter, so no
|
||
-- postulate is involved; consistency is relative to the existence of an
|
||
-- instance. ZFC with ω·2 inaccessible cardinals κ₀ < κ₁ < … < κ_ω < … has
|
||
-- one: V the sets, U (fin k) = V_{κ_k}, U (ω+ m) = V_{κ_{ω+m}}, graphs for
|
||
-- functions, Kuratowski pairs, von Neumann naturals.
|
||
--
|
||
-- Functions and families are given by meta-level functions V → V (class
|
||
-- functions; replacement makes their restrictions to a set into sets).
|
||
-- Some operations are total but only specified on their intended
|
||
-- arguments (app, fst, snd, toℕ), as in set theory.
|
||
|
||
-- Universe strata: fin k for Set k, ω+ m for Setω m.
|
||
data Stratum : Set where
|
||
fin : ℕ → Stratum
|
||
ω+ : ℕ → Stratum
|
||
|
||
infix 4 _≤ˢ_ _<ˢ_
|
||
|
||
data _≤ˢ_ : Stratum → Stratum → Set where
|
||
fin≤ : ∀ {j k} → j ≤ k → fin j ≤ˢ fin k
|
||
finω : ∀ {j m} → fin j ≤ˢ ω+ m
|
||
ω≤ : ∀ {m m'} → m ≤ m' → ω+ m ≤ˢ ω+ m'
|
||
|
||
data _<ˢ_ : Stratum → Stratum → Set where
|
||
fin< : ∀ {j k} → j < k → fin j <ˢ fin k
|
||
finω : ∀ {j m} → fin j <ˢ ω+ m
|
||
ω< : ∀ {m m'} → m < m' → ω+ m <ˢ ω+ m'
|
||
|
||
record SetTheory : Set₁ where
|
||
infix 4 _∈_
|
||
field
|
||
V : Set
|
||
_∈_ : V → V → Set
|
||
|
||
-- Truth: a one-element set, and equality as a subset of it.
|
||
⋆ : V
|
||
⊤ˢ : V
|
||
⋆∈⊤ : ⋆ ∈ ⊤ˢ
|
||
Id : V → V → V
|
||
Id-intro : ∀ {a} → ⋆ ∈ Id a a
|
||
Id-elim : ∀ {a b x} → x ∈ Id a b → a ≡ b
|
||
|
||
-- The empty set.
|
||
∅ˢ : V
|
||
∅-empty : ∀ {x} → x ∈ ∅ˢ → ⊥
|
||
|
||
-- Dependent functions: graphs over a domain.
|
||
Pi : V → (V → V) → V
|
||
lam : V → (V → V) → V
|
||
app : V → V → V
|
||
dom : V → V
|
||
dom-lam : ∀ {A g} → dom (lam A g) ≡ A
|
||
app-lam : ∀ {A g x} → x ∈ A → app (lam A g) x ≡ g x
|
||
lam-∈ : ∀ {A F g} → (∀ {x} → x ∈ A → g x ∈ F x) → lam A g ∈ Pi A F
|
||
app-∈ : ∀ {A F f x} → f ∈ Pi A F → x ∈ A → app f x ∈ F x
|
||
Pi-dom : ∀ {A F f} → f ∈ Pi A F → dom f ≡ A
|
||
lam-ext : ∀ {A g g'} → (∀ {x} → x ∈ A → g x ≡ g' x) → lam A g ≡ lam A g'
|
||
Pi-ext : ∀ {A F F'} → (∀ {x} → x ∈ A → F x ≡ F' x) → Pi A F ≡ Pi A F'
|
||
|
||
-- Dependent pairs.
|
||
Sig : V → (V → V) → V
|
||
pair : V → V → V
|
||
fst : V → V
|
||
snd : V → V
|
||
fst-pair : ∀ {a b} → fst (pair a b) ≡ a
|
||
snd-pair : ∀ {a b} → snd (pair a b) ≡ b
|
||
pair-∈ : ∀ {A F a b} → a ∈ A → b ∈ F a → pair a b ∈ Sig A F
|
||
fst-∈ : ∀ {A F p} → p ∈ Sig A F → fst p ∈ A
|
||
snd-∈ : ∀ {A F p} → p ∈ Sig A F → snd p ∈ F (fst p)
|
||
Sig-ext : ∀ {A F F'} → (∀ {x} → x ∈ A → F x ≡ F' x) → Sig A F ≡ Sig A F'
|
||
|
||
-- The natural numbers.
|
||
ω : V
|
||
fromℕ : ℕ → V
|
||
toℕ : V → ℕ
|
||
fromℕ-∈ : ∀ {k} → fromℕ k ∈ ω
|
||
toℕ-fromℕ : ∀ k → toℕ (fromℕ k) ≡ k
|
||
ω-elim : ∀ {x} → x ∈ ω → fromℕ (toℕ x) ≡ x
|
||
|
||
-- Cumulative universes, closed under the type formers.
|
||
U : Stratum → V
|
||
U-∈ : ∀ {β β'} → β <ˢ β' → U β ∈ U β'
|
||
U-⊆ : ∀ {β β' x} → β ≤ˢ β' → x ∈ U β → x ∈ U β'
|
||
⊤-U : ⊤ˢ ∈ U (fin 0)
|
||
∅-U : ∅ˢ ∈ U (fin 0)
|
||
ω-U : ω ∈ U (fin 0)
|
||
Id-U : ∀ {a b} → Id a b ∈ U (fin 0)
|
||
Pi-U : ∀ {β A F} → A ∈ U β → (∀ {x} → x ∈ A → F x ∈ U β) → Pi A F ∈ U β
|
||
Sig-U : ∀ {β A F} → A ∈ U β → (∀ {x} → x ∈ A → F x ∈ U β) → Sig A F ∈ U β
|