Skip to content

Commit 3a31825

Browse files
Some design documentation (here: level polymorphism) (#2322)
* add some design documentation corresponding to issue #312. (Redo of bad 957) * more documentation about LevelPolymorphism * more documentation precision * document issues wrt Relation.Unary, both in design doc and in file itself.
1 parent bd768ae commit 3a31825

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
* Level polymorphism
2+
3+
`` in `Data.Empty` and `` in `Data.Unit` are not `Level`-polymorphic as that
4+
tends to lead to unsolved metas (see discussion at issue #312). This is understandable
5+
as very often the level of (say) `` is under-determined by its surrounding context,
6+
leading to unsolved metas. This is frequent enough that it makes sense for the default
7+
versions to be monomorphic (at Level 0).
8+
9+
But there are other cases where exactly the opposite is needed. for that purpose,
10+
there are level-polymorphic versions in `Data.Empty.Polymorphic` and
11+
`Data.Unit.Polymorphic` respectively.
12+
13+
The same issue happens in `Relation.Unary` which defines `Ø` and `U` at `Level` 0, else
14+
a lot of unsolved metas appear (for example in `Relation.Unary.Properties`). For that
15+
purpose, `Relation.Unary.Polymorphic` exists.

src/Data/Empty.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------
22
-- The Agda standard library
33
--
4-
-- Empty type, judgementally proof irrelevant
4+
-- Empty type, judgementally proof irrelevant, Level-monomorphic
55
------------------------------------------------------------------------
66

77
{-# OPTIONS --cubical-compatible --safe #-}

src/Data/Unit.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------
22
-- The Agda standard library
33
--
4-
-- The unit type
4+
-- The unit type, Level-monomorphic version
55
------------------------------------------------------------------------
66

77
{-# OPTIONS --cubical-compatible --safe #-}

src/Relation/Unary.agda

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ Pred A ℓ = A → Set ℓ
4242
-- Special sets
4343

4444
-- The empty set.
45+
-- Explicitly not level polymorphic as this often causes unsolved metas;
46+
-- see `Relation.Unary.Polymorphic` for a level-polymorphic version.
4547

4648
: Pred A 0ℓ
4749
= λ _
@@ -52,6 +54,7 @@ Pred A ℓ = A → Set ℓ
5254
{ x } = x ≡_
5355

5456
-- The universal set.
57+
-- Explicitly not level polymorphic (see comments for `∅` for more details)
5558

5659
U : Pred A 0ℓ
5760
U = λ _

0 commit comments

Comments
 (0)