Last active
September 18, 2020 19:35
-
-
Save JoeyEremondi/05d25de1df480ff91619868e0784d5da to your computer and use it in GitHub Desktop.
This file contains hidden or 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 |
Author
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
Type3 times, so we have 3 level variablesi, j, k:Code n : Type ion line 7el n : Type jon line 12el (Ty n) = Type kon line 15We know that:
el (Ty n) : Type j, sok < jtest n = Code n : el (Ty n) = Type k : Type j, soi < jandi <= kFnconstructor,(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 < iSo for constraints, we have
k < j,i < j,i <= kandk < i, the latter two of which are contradictory.What am I misunderstanding? Is a different level variable created for each
ninCode,elandtest? Or am I wrong thatCode n : Type kimplies thati <= k?