5

In a formalization that I'm working on, I need to lift the Unit type, from Agda standard library, which is defined on universe Set to a polymorphic one like Set a.

How can I do that? I know that I could just define another type, like this one:

record Unit {l} : Set l where
   constructor unit

which is universe polymorphic. But, I believe that should have a more idiomatic solution to this problem. Can someone provide me a solution or if there's no way explain the reason to me?

Rodrigo Ribeiro
  • 3,198
  • 1
  • 18
  • 26

1 Answers1

6

In fact, searching a bit the standard library, I found the tool needed in Level module. The solution is to use the type Lift:

record Lift {a ℓ} (A : Set a) : Set (a ⊔ ℓ) where
  constructor lift
  field lower : A

The unit type

 record ⊤ : Set where
   constructor tt

can be lifted to higher universe levels using Lift ⊤. I found the solution reading part of the following answer.

Community
  • 1
  • 1
Rodrigo Ribeiro
  • 3,198
  • 1
  • 18
  • 26