Files
Julius FischerandClaude Opus 5.5 cee0d8ef68 Docs: separate level syntax and conversion modulo level equality
README describes the two-sort syntax, why level equations on ordinary
terms break transitivity, conversion as a common reduct under
reduction modulo level equality, and the Church–Rosser proof. TODO
ticks off the level-equality chain and the typing repairs; IDEAS
records the alternatives that were considered and why they fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af
2026-10-22 11:33:43 +02:00

63 lines
2.8 KiB
Markdown
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.
# Other ideas
Alternatives that were considered but not chosen. Decisions are in
`README.md`, open work in `TODO.md`.
## `Bad` predicate for level-dependent ∀
Alternative to the weakened-level formulation of `⊢-∀` (see README,
"Design: universe hierarchy").
`Bad l₂` means "the codomain level `l₂` mentions the bound variable `x`",
defined inductively over terms. A `∀`-type is small if its codomain level is
not `Bad`, and lives in `Setω` otherwise:
```agda
data Bad : Term (suc n) → Set -- l mentions ` zero
⊢-∀ : Γ ⊢ A ⦂ Set l₁
→ Γ , A ⊢ B ⦂ Set l₂
→ ¬ Bad l₂
→ Γ ⊢ ∀[x⦂ A ] B ⦂ Set (l₁ ⊔ strengthen l₂)
⊢-∀ᵇ : Γ ⊢ A ⦂ Setω l₁
→ Γ , A ⊢ B ⦂ Set l₂
→ Bad l₂
→ Γ ⊢ ∀[x⦂ A ] B ⦂ Setω l₁
```
Compared to the chosen formulation it needs a `strengthen` function (moving
`l₂` out of the extended context, defined only when `¬ Bad l₂`) and carries
`Bad` / `¬ Bad` proofs through every lemma. Both are safe for subject
reduction for the same reason: reduction and substitution can only remove a
dependency on `x`, never create one, and a type that drops from `Setω` to
`Set` is still accepted through `Set l ≤ Setω lzero`.
## Level equality: alternatives
Level equality is decided by normalisation inside conversion, over a
separate syntax for level expressions (see README, "Design: level
equality"). Alternatives:
- **Oriented reduction rules for `⊔`.** Simple, but incomplete for the
equations Agda accepts, and idempotence `l ⊔ l ↪ l` as a rule is
non-left-linear, which breaks confluence with untyped β.
- **Meta-level `ℕ` indices** for universes. No universe polymorphism.
- **Level equations on ordinary terms** (the previous design: `lzero`,
`lsuc`, `⊔` as term constructors, `_~_` with the equations at every
term). Level equality then hides and creates redexes:
`(id ⊔ lzero) · Level ~ id · Level ↪ Level`, while the left side has no
redex, so conversion is not transitive.
- **Equations only over neutral atoms.** Not stable under substitution: in
`(λx. (x ⊔ lzero) · Level) · id ~ (λx. x · Level) · id` (with `x`
neutral), β-reduction turns the atom into `id`, after which the two
sides are no longer joinable.
- **Typed conversion** (`Γ ⊢ e₁ ≈ e₂ ⦂ A`, with the level equations only at
type `Level`). Needs a logical relation or a normalisation proof to get
injectivity of type constructors (cf. Abel, Öhman, Vezzosi, POPL 2018:
thousands of lines, for a single universe); with open level terms in the
universe hierarchy this is research-level.
- **Conversion as the equivalence closure** of `↪ ∪ ~`. Transitive by
definition, but injectivity of type constructors then needs the same
Church–Rosser theorem as the chosen definition, so nothing is gained.