|
5 | 5 |
|
6 | 6 | -- | Martin-Löf Type Theory with cumulative universes. |
7 | 7 | -- |
8 | | --- Extends module 11 (MLTT) by replacing the inconsistent @Type : Type@ rule |
9 | | --- with a cumulative universe hierarchy @Type 0 : Type 1 : Type 2 : ...@. |
| 8 | +-- Extends module 11 (MLTT) by replacing the inconsistent |
| 9 | +-- @Type : Type@ rule with a cumulative universe hierarchy |
| 10 | +-- @Type 0 : Type 1 : Type 2 : ...@. |
10 | 11 | -- |
11 | | --- Types and terms still share a single syntax, core IR, and semantic domain. |
| 12 | +-- Types and terms still share a single syntax, core IR, |
| 13 | +-- and semantic domain. |
12 | 14 | -- |
13 | | --- Russell-style universes (types are their own codes, no separate @El@ |
14 | | --- decoding). Cumulativity means @Type n@ is a subtype of @Type m@ when @n <= |
15 | | --- m@. |
| 15 | +-- Russell-style universes (types are their own codes, no |
| 16 | +-- separate @El@ decoding). Cumulativity means @Type n@ is |
| 17 | +-- a subtype of @Type m@ when @n <= m@. |
16 | 18 | -- |
17 | | --- Universe levels are explicit natural numbers, no inference or polymorphism. |
| 19 | +-- Universe levels are explicit natural numbers, no |
| 20 | +-- inference or polymorphism. |
| 21 | +-- |
| 22 | +-- NOTE: Compound type formers (Pi, Sigma, FuncTy, PairTy, SumTy, records, ADTs) |
| 23 | +-- have dual Synth and Check formation rules. |
| 24 | +-- |
| 25 | +-- The Synth path synthesizes components, extracts their levels with |
| 26 | +-- @expectUniv@, and computes the result level via @maxLevel@. |
| 27 | +-- |
| 28 | +-- The Check path pushes a goal level down to both components, with cumulativity |
| 29 | +-- handling any mismatch. |
| 30 | +-- |
| 31 | +-- The Synth rules are needed because the annotation tactic synthesizes the type |
| 32 | +-- to discover its level bottom-up. Without level variables or inference, there |
| 33 | +-- is no level to push down in synth position, so the level must be computed |
| 34 | +-- from the components. With universe polymorphism (module 13), the Check rules |
| 35 | +-- may subsume the Synth rules, since a level variable can be pushed down |
| 36 | +-- instead. |
18 | 37 | module Main where |
19 | 38 |
|
20 | 39 | -------------------------------------------------------------------------------- |
|
0 commit comments