Typecheck / agda (push) Failing after 1m5s
Decidability/Statement.agda states Decidable-≈ and Decidable-≈ₗ for well-typed terms (conversion is undecidable on untyped terms) and the normalisation property the proof is expected to go through. TODO and README updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af
5.4 KiB
5.4 KiB
TODO
Design decisions are in README.md; this file tracks the work.
Level equality (chosen approach)
~ is level equality lifted to whole terms; ≈ is conversion.
- Separate level syntax.
Tmindexed by a sort (Term,Lvl), coercions`lvl/`latomwith`latom (`lvl l) ↪ l, level well-formedness_⊢ₗ_(see README). Ordinary terms no longer carry level equations. - Equational theory.
_~_as the congruence closure of the level equations (Specification/LevelEquality.agda). - Structure of
~on terms.~→≋: one layer of matching constructors; injectivity of every term constructor; different constructors are never~-equal (LevelEqualityProperties.agda). - Stability.
~is stable under renaming and substitution (~-ren,~-sub,~σ-sub,~-[]). - Commutation with complete development.
u ~ u' → u⁺ ~ u'⁺(ConfluenceModulo.agda). - Church–Rosser modulo
~._↪~*_is confluent, via the triangle property of~ ; ↪ₚ ; ~(ConfluenceModulo.agda). - Conversion.
≈is a common reduct under_↪~*_; equivalence, congruence, renaming, substitution (ConversionProperties.agda). - Downstream proofs.
Inversion.agda,SubstitutionPreservesTyping.agda,SubjectReduction.agda(subject reduction holds for the full system). - Level normal forms.
nf,compareand its order laws, soundness and completeness, ported to the separate level syntax (LevelNormalForm.agda,LevelNormalForm/). - Decidability.
_~?_ : Dec (u ~ u')inLevelEqualityDecision.agda, tested by computation. Reference for the algebra: Bezem & Coquand, Loop-checking and the uniform word problem for join-semilattices with an inflationary endomorphism (TCS 2022). - Injectivity of
lsuc:~-lsuc-inj : lsuc l ~ lsuc l' → l ~ l'via the normaliser (LevelEqualityDecision.agda). - η for the coercions (optional, only if an example needs it):
`lvl (`latom e)andeare not convertible (only`latom (`lvl l) ↪ lholds). This matters when level-typed terms are compared as terms, e.g.F (lvl (latom x ⊔ lzero))vsF xforF : Level → Set, or in≡. - As a reduction rule`lvl (`latom e) ↪ e: left-linear, its only overlap withβ-latomis trivial, and subject reduction needs onlyT ≈ Levelfrom inverting⊢-lvl(plusLevel≉Setn). - Cost:~hides η-redexes (`lvl (`latom e `⊔ `latom e) ~ `lvl (`latom e) ↪ e), so~-⁺fails.⁺would have to contract`lvl lwhenevernf l ≡latom e, makingConfluenceModulodepend on the normaliser's soundness and completeness. - As an equation in→≋instead: breaks(different heads become~`-equal), so not recommended.
Universe hierarchy (typing)
- Cumulativity: lifting rules
⊢-Set≤Setωand⊢-Setω≤. ⊢-∀split into⊢-∀,⊢-∀ωand⊢-∀-dep(result level determined by the premises; level-dependent codomains only inSet, so∀ (l : Level) → Setω lis rejected). Checked with example derivations, e.g.∀ (l : Level) → Set l : Setω lzero.⊢-Setnand⊢-Setωrequire the level to be well formed (Γ ⊢ₗ l).⊢-λrequires the domain to be a type:Γ ⊢ t₁ ⦂ Setω l(small domains reachSetω lzerovia⊢-Set≤Setω).⊢-∃mirrors⊢-∀:⊢-∃,⊢-∃ω,⊢-∃-dep.⊢-≡requiresΓ ⊢ t ⦂ Set land lives inSet l; the motive of⊢-substis inSet (ren wk l).- Unit type:
`Unit : Set(⊢-Unit) with`tt : `Unit(⊢-tt); both are values, inert under reduction and~, and covered by confluence, the level normaliser, subject reduction and progress. - Proofs for the new rules:
≈-Γ-⊢,⊢ren/⊢sub(weakened levels realigned withwk-extᵣ-fusion/wk-extₛ-fusion), inversion through the lifting rules (universes are never convertible to∀,∃or≡), subject reduction.
Values
val-SetωrequiresValue l, asval-Setndoes.val-lrenamed toval-lzero.val-⊔:_⊔_of values is a value (⊔does not reduce; level equality is handled by conversion).val-lvl,val-latom(`latom eis a value ifeis neutral).Valuedescribes normal forms (values under binders), matching the full reduction relation;Neutralthe stuck terms.- Progress for open terms:
progress : Γ ⊢ e ⦂ t → Value e ⊎ ∃[ e' ] e ↪ e'(withprogressₗfor levels), andvalue-normal : Value e → ¬ (e ↪ e')(Progress.agda).
Decidability of conversion
Statements in Decidability/Statement.agda.
- Normalisation: every well-typed term reduces to a normal form
(
Value). Needs a logical relation (reducibility candidates), with the universe hierarchy and level-dependent ∀ inSetω. - Normal forms: convertible normal forms are
~-equal (fromconfluence-moduloandvalue-normal). Decidable-≈/Decidable-≈ₗ: normalise both sides and compare the normal forms with_~?_(LevelEqualityDecision).