Files
Julius FischerandClaude Opus 5.5 48d3f9040b
Typecheck / agda (push) Failing after 7s
⊢-∀ / ⊢-∃: the codomain level must be well formed
Over an empty domain the codomain derivation says nothing about the level
l₂, so the set-theoretic model needs Γ ⊢ₗ l₂ (cf. con-leche's
certification tax). This replaces the planned premise on ⊢-≈, which the
model avoids by stating soundness up to conversion. Proofs, tests and
Examples/Issue pass the premise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q7dfaHQ3dYSfqcxR7V5UrJ
2026-11-22 21:27:08 +01:00

77 lines
2.5 KiB
Agda
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
module univTypes.Examples.Issue where
-- Example derivations for the typing rules (universe hierarchy, cumulativity,
-- level-dependent ∀/∃, ≡) and for Value. Checked by typechecking this file.
open import Relation.Binary.PropositionalEquality using (refl)
open import Data.Fin using (zero; suc)
open import univTypes.Specification
open import Agda.Primitive
open import Agda.Builtin.Unit
-- From the issue
basic : Set₁
basic = (t : ⊤) → Set
obfuscated : Setω
obfuscated = (λ (ℓ : ⊤ → Level) → ∀ t → Set (ℓ t)) (λ _ → lzero)
-- In my language
myBasicTerm : Term 0
myBasicTerm = ∀[x⦂ `Unit ] `Set
-- Under `λ ℓ and ∀ t: t is the innermost variable.
t : Term 2
t = ` zero
ℓ : Term 2
ℓ = ` (suc zero)
myObfuscatedTerm : Term 0
myObfuscatedTerm = (`λ[x⦂ ∀[x⦂ `Unit ] `Level ] ( ∀[x⦂ `Unit ] `Setn `latom (ℓ · t))) · (`λ[x⦂ `Unit ] `lvl `lzero)
l0 : ∀ {n} → Lvl n
l0 = `lzero
l1 : ∀ {n} → Lvl n
l1 = `lsuc l0
myBasicTyping : ∅ ⊢ myBasicTerm ⦂ `Setn l0 `⊔ l1
myBasicTyping = ⊢-∀ ⊢-Unit (⊢-Setn ⊢-lzero) (⊢-lsuc ⊢-lzero)
myBasicTyping2 : ∅ ⊢ myBasicTerm ⦂ `Setn l1
myBasicTyping2 = ⊢-≈ (mk-≈ (`Setn l1) (↪~*-step (↪~-~ (~-Setn ⊔-lsuc)) ↪~*-refl) ↪~*-refl) myBasicTyping
myBasicTyping3 : ∅ ⊢ myBasicTerm ⦂ `Setω 0
myBasicTyping3 = ⊢-∀-dep (⊢-Set<Setω ⊢-Unit) (⊢-Setn ⊢-lzero)
myBasicTyping4 : ∅ ⊢ myBasicTerm ⦂ `Setω 0
myBasicTyping4 = ⊢-Set<Setω myBasicTyping2
myObfuscatedTyping : ∅ ⊢ myObfuscatedTerm ⦂ `Setω 0
myObfuscatedTyping =
⊢-· -- Lambda applied to lambda
(⊢-λ (⊢-Set<Setω (⊢-∀ ⊢-Unit ⊢-Level ⊢-lzero)) -- ℓ : ⊤ → Level
(⊢-∀-dep (⊢-Set<Setω ⊢-Unit) -- ∀ t → Set (ℓ t)
(⊢-Setn (⊢-latom (⊢-· (⊢-` (suc zero) refl) (⊢-` zero refl))))))
(⊢-λ -- λ _ → lzero : ⊤ → Level
(⊢-Set<Setω ⊢-Unit) (⊢-lvl ⊢-lzero))
myCoolReduction : myObfuscatedTerm ↪* myBasicTerm
myCoolReduction =
begin
myObfuscatedTerm
↪⟨ β-λ ⟩ -- substitute λ _ → lzero for ℓ
∀[x⦂ `Unit ] `Setn `latom ((`λ[x⦂ `Unit ] `lvl `lzero) · ` zero)
↪⟨ ξ-∀₂ (ξ-Setn (ξ-latom β-λ)) ⟩ -- (λ _ → lzero) t
∀[x⦂ `Unit ] `Setn `latom (`lvl `lzero)
↪⟨ ξ-∀₂ (ξ-Setn β-latom) ⟩ -- latom (lvl lzero) ↪ lzero
myBasicTerm
∎
where open ↪*-Reasoning