`Unit : Set and `tt : `Unit, both values and inert under renaming,
substitution, reduction and level equality. Cases added throughout
confluence, conversion, the level normaliser, substitution lemmas,
subject reduction and progress (new head hUnit for canonical forms).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Progress.agda: canonical forms via a generic head lemma (≈-head: type
formers keep their outermost constructor under ↪ and ~), mutual
progress / progressₗ (well-typed terms are normal forms or reduce), and
value-normal (normal forms do not reduce). Tests and docs updated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af
~-lsuc-inj : lsuc l ~ lsuc l' → l ~ l' in LevelEqualityDecision: shift is
injective and readback is injective on well-formed normal forms. TODO
records the analysis of the optional η rule for the coercions.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af
Atoms are now exactly the terms under `latom, so the Atom/View
machinery in Completeness goes away: flatten is total on Lvl with four
cases, and a well-formed entry is just a term in normal form. nf, sound
and complete are generic in the sort; the term order encodes `lvl and
`latom and decodes by sort.
Decidability (_~?_) moves to LevelEqualityDecision, since level
equality properties no longer depend on the normaliser.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af
subject-reduction now covers every typing rule (∀ω/∀-dep, ∃ω/∃-dep,
cumulativity, universes, `lvl), mutually with subject-reductionₗ for
level well-formedness. The new redex `latom (`lvl l) ↪ l is handled by
invert-⊢lvl. Everything typechecks without holes or postulates beyond
functional extensionality.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af
⊢ren and ⊢sub now cover ∀ω/∀-dep/∃ω/∃-dep, the three-premise ⊢-≡,
cumulativity and the new level judgement (⊢renₗ/⊢subₗ, mutually).
Codomain levels weakened under a binder are realigned with
wk-extᵣ-fusion / wk-extₛ-fusion, now generic in the sort.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af
Shape lemmas now follow reduction modulo level equality: a level
equation keeps the outermost constructor by ~→≋. Universes are never
convertible to ∀, ∃ or ≡, which discharges the cumulativity cases of
the typing inversions. New: invert-≈-Setn/-Setω and invert-⊢lvl.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af
≈ is an equivalence by confluence modulo level equality. Congruence,
renaming and substitution all come from one lifting lemma (≈-map) for
functions that preserve ↪ and ~, which replaces the ξₚ* and ↪ₚ*σ
lemmas. ≈-Γ-⊢ covers all typing rules, including ∀ω/∀-dep/∃ω/∃-dep,
cumulativity, and the new level judgement _⊢ₗ_; ≈-Γ-⊢₁ is now an
instance of it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af
Reduction modulo level equality (_↪~*_) is confluent. Complete
development respects level equality (~-⁺): in a redex position both
sides have the same constructor by ~→≋, and the level equations never
look into their arguments. Hence _~_ ; _↪ₚ_ ; _~_ has Takahashi's
triangle property, and confluence follows as for plain reduction.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af
On terms _~_ is a pure congruence now, so its outermost layer can be
read off directly: ~→≋ maps an equation to one layer of matching
constructors with ~-equal arguments. All injectivity lemmas follow,
and different constructors are never ~-equal.
Also: _~_ is stable under renaming and substitution (~-ren, ~-sub,
~σ-sub, ~-[]). Decidability via nf will move to its own module when
the normaliser is ported.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af
Fusion lemmas, parallel reduction and the complete development are now
generic in the sort, with cases for `lvl, `latom and the new redex
`latom (`lvl l). par-triangle loses the level cases in term positions,
which are now ruled out by the sort index.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af
Terms are now indexed by a sort: Term = Tm term, Lvl = Tm level. Level
expressions (`lzero, `lsuc, _`⊔_) live in Lvl and meet terms only through
the coercions `lvl : Lvl → Term and `latom : Term → Lvl, with the new
reduction `latom (`lvl l) ↪ l. Level equality _~_ is unchanged on levels
and a pure congruence on terms, so it can no longer hide or create redexes.
Conversion _≈_ is now a common reduct under reduction modulo level
equality (_↪~*_). Typing gains the level well-formedness judgement _⊢ₗ_.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af
Prove the level normaliser correct: u ~ u' iff nf u ≡ nf u'.
- LevelNormalForm: compare via an encoding of terms as trees (same
order as before); merge without `with` so it passes the termination
checker; shift via map₂; readback without a where block.
- LevelNormalForm/Order: compare is a strict total order, decidable
equality on terms.
- LevelNormalForm/Merge: sortedness, merge laws (associativity via
lookup extensionality), join/shift laws.
- LevelNormalForm/Completeness: well-formed normal forms, the key lemma
flatten (readback L) ≡ L, idempotence, completeness.
- LevelNormalForm/Soundness: denotation of normal forms, soundness.
- LevelEqualityProperties: decision procedure _~?_ and injectivity of
all constructors except lsuc and ⊔ up to ~.
- Tests for the decision procedure; README and TODO updated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af
- SubjectReduction/LevelNormalForm.agda: nf normalises every level
expression in a term to max(c, a₁ + k₁, …) with atoms normalised first,
one entry per atom (largest offset), atoms sorted by a total order on
terms, and the constant dropped when some offset is at least as large.
- Tests/: example derivations for the typing rules, examples for _~_ and
_≈_, and computational tests for nf (all six level equations,
canonical shapes, atoms, idempotence).
- README: level normal form and repository layout; TODO: proof steps
for nf (properties of compare, soundness, completeness, decidability).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af
Loosest to tightest, all above the judgements (4) and context
extension (5):
6 `λ_ ∀[x⦂_]_ ∃[x⦂_]_ (infixr; binder bodies extend to the right)
7 _`,_ (infixr)
8 _`≡_
9 `Setn_ `Setω_ (`Setn l₁ `⊔ l₂ = `Setn (l₁ `⊔ l₂))
10 _`⊔_ (infixl)
11 _·_ (infixl)
12 _[_] (infixl)
13 `_
Previously `_ bound looser than the undeclared operators, so e.g.
` x `⊔ ` y did not parse.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af
- Specification/LevelEquality.agda: _~_ is the congruence closure of the
level equations (associativity, commutativity and idempotence of ⊔,
lzero as unit, lsuc distributing over ⊔, l ⊔ lsuc l = lsuc l).
- Conversion: e₁ ≈ e₂ iff e₁ ↪* u₁, e₂ ↪* u₂ and u₁ ~ u₂.
ConversionProperties and the other proofs still use the old record with a
single common reduct; see TODO.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af
Values:
- val-Setω requires Value l (as val-Setn does), so a reducible Setω term
is no longer a value.
- Rename val-l to val-lzero.
- Add val-⊔: _⊔_ does not reduce, so a join of values is a value.
Typing:
- ⊢-λ requires the domain to be a type (Γ ⊢ t₁ ⦂ Setω l; small types
reach Setω lzero via ⊢-Set≤Setω).
- ∃ mirrors ∀: ⊢-∃, ⊢-∃ω, ⊢-∃-dep.
- ⊢-≡ requires t ⦂ Set l and lives in Set l; the motive of ⊢-subst is in
Set (ren wk l).
- ⊢-Setn and ⊢-Setω require their level to have type Level.
Downstream proofs still need cases for the new rules; see TODO.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af
- ⊢-∀ now determines its result level: Set (l₁ ⊔ l₂), where the codomain
level is a weakened outer level and so cannot mention the bound variable.
- ⊢-∀ω: the same for domain and codomain in Setω.
- ⊢-∀-dep: codomain level may depend on the bound variable
(e.g. ∀ (l : Level) → Set l), result in Setω.
- Cumulativity via lifting rules: Set l ≤ Setω lzero and
Setω l ≤ Setω (lsuc l).
The downstream proofs (ConversionProperties, SubstitutionPreservesTyping,
Inversion, SubjectReduction) do not yet cover the new rules; see TODO.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af
Move the contents of Specification.agda unchanged into
Specification/{Axioms,Syntax,Substitution,Values,Reduction,Conversion,Typing}.agda,
with fixity declarations next to their definitions. Specification.agda
now re-exports all parts, so existing imports keep working. The unused
helper cong₃ moves to Util/Equality.agda.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af