open import univTypes.Model.SetTheory using (SetTheory) module univTypes.Model.Consistency (S : SetTheory) where open import Data.Empty using (⊥) open import Data.Nat using (zero; suc) open import Data.Fin using (Fin; zero) open import Data.Product using (proj₁; proj₂) renaming (_,_ to ⟨_,_⟩) open import Data.Unit using (tt) open import Relation.Binary.PropositionalEquality using (_≡_; refl; sym; trans; cong; subst) open import Relation.Nullary using (¬_) open import univTypes.Specification open import univTypes.Metatheory.Confluence.Conversion using (≈-sym) open import univTypes.Model.SetTheory using (fin) open SetTheory S open import univTypes.Model.Interpretation S open import univTypes.Model.Conversion S open import univTypes.Model.Soundness S -- Consistency, relative to the set theory S: closed terms of empty types do -- not exist. With ZFC and ω·2 inaccessibles as S, the type theory is -- consistent if that set theory is. private ρ₀ : Env 0 ρ₀ () ρ₀⊨ : ρ₀ ⊨ᶜ ∅ ρ₀⊨ = env λ () ∅≃ : ∅ ≃ᶜ ∅ ∅≃ = ctx≃ λ () 0≢1 : fromℕ 0 ≡ fromℕ 1 → ⊥ 0≢1 p with trans (sym (toℕ-fromℕ 0)) (trans (cong toℕ p) (toℕ-fromℕ 1)) ... | () -- False has no closed member (True = Unit has tt). no-False : ∀ {e : Term 0} → ¬ (∅ ⊢ e ⦂ `False) no-False d = asFalse (sound ∅≃ d) ρ₀ ρ₀⊨ -- No closed proof of zero ≡ suc zero. no-0≡1 : ∀ {e : Term 0} → ¬ (∅ ⊢ e ⦂ `zero `≡ `suc `zero) no-0≡1 d with IsId.okId (asId (sound ∅≃ d)) ρ₀ ρ₀⊨ ... | ⟨ _ , ⟨ wa , ⟨ wb , m ⟩ ⟩ ⟩ = 0≢1 (trans (sym a≡0) (trans (Id-elim m) b≡1)) where module E = IsId (asId (sound ∅≃ d)) a≡0 : ⟦ E.a₁ ⟧ ρ₀ ≡ fromℕ 0 a≡0 = ≈-sem (≈-sym E.a≈) wa tt b≡1 : ⟦ E.b₁ ⟧ ρ₀ ≡ fromℕ 1 b≡1 = trans (≈-sem (≈-sym E.b≈) wb ⟨ tt , fromℕ-∈ ⟩) (cong (λ k → fromℕ (suc k)) (toℕ-fromℕ 0)) -- No closed term of ∀ (A : Set) → A: it would inhabit an empty set. no-∀A→A : ∀ {f : Term 0} → ¬ (∅ ⊢ f ⦂ ∀[x⦂ `Set ] ` zero) no-∀A→A {f = f} d with IsΠ.okΠ (asΠ (sound ∅≃ d)) ρ₀ ρ₀⊨ ... | ⟨ _ , ⟨ wA , ⟨ wB , m ⟩ ⟩ ⟩ = 0≢1 (Id-elim (subst (app (⟦ f ⟧ ρ₀) E ∈_) B≡E (app-∈ m E∈))) where module P = IsΠ (asΠ (sound ∅≃ d)) E : V E = Id (fromℕ 0) (fromℕ 1) A≡U : ⟦ P.A₁ ⟧ ρ₀ ≡ U (fin 0) A≡U = ≈-sem (≈-sym P.A≈) wA tt E∈ : E ∈ ⟦ P.A₁ ⟧ ρ₀ E∈ = subst (E ∈_) (sym A≡U) Id-U B≡E : ⟦ P.B₁ ⟧ (ρ₀ ▹ E) ≡ E B≡E = ≈-sem (≈-sym P.B≈) (wB E∈) tt