Last active
September 18, 2020 19:35
-
-
Save JoeyEremondi/05d25de1df480ff91619868e0784d5da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main | |
%default total | |
mutual | |
data Code : Nat -> Type where | |
N : Code n | |
Fn : (c : Code n) -> (el c -> Code n) -> Code n | |
Ty : (n : Nat) -> Code (S n) | |
el : Code n -> Type | |
el N = Nat | |
el (Fn a b) = (x : el a) -> (el (b x)) | |
el {n = S n} Ty = Type | |
test : (n : Nat) -> el (Ty n) | |
test n = Code n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to figure out why this compiles in Idris 1. As I see it, we write
Type
3 times, so we have 3 level variablesi, j, k
:Code n : Type i
on line 7el n : Type j
on line 12el (Ty n) = Type k
on line 15We know that:
el (Ty n) : Type j
, sok < j
test n = Code n : el (Ty n) = Type k : Type j
, soi < j
andi <= k
Fn
constructor,(c : Code n) -> (el c -> Code n) -> Code n : Type i
, soel c : Type i
. But then el (Ty n) = Type k : Type i, sok < i
So for constraints, we have
k < j
,i < j
,i <= k
andk < i
, the latter two of which are contradictory.What am I misunderstanding? Is a different level variable created for each
n
inCode
,el
andtest
? Or am I wrong thatCode n : Type k
implies thati <= k
?