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
%default total | |
data MyList : Type -> Type where | |
Nil : {a : Type} -> MyList a | |
(::) : {a : Type} -> a -> MyList a -> MyList a | |
F : MyList a -> Maybe Type | |
F [] = Nothing | |
F ((::) {a} x xs) = Just a | |
G : MyList a -> Maybe Type |
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
data MyList : Type -> Type where | |
Nil : {a : Type} -> MyList a | |
(::) : {a : Type} -> a -> MyList a -> MyList a | |
f : MyList b -> () | |
f [] = () | |
f ((::) {a} x xs) = ?normal | |
g : MyList b -> () | |
g [] = () |
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
-- Example 3.8 from Hanmana and Fiore - page 63 | |
-- (Foundations of GADTS and Inductive Families) | |
data Expr : Type -> Type where | |
Const : Int -> Expr Int | |
IsZero : Expr Int -> Expr Bool | |
If : Expr Bool -> Expr a -> Expr a -> Expr a | |
-- Page 66: Context specialised for the Expr type above | |
-- General form for non-root cases is: |
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
%default total | |
ℕ : Type | |
ℕ = Nat | |
data D : ℕ -> Type where | |
K0 : D Z | |
K1 : {k : ℕ} -> D k -> D (S k) | |
K2 : {k : ℕ} -> D k -> D Z | |
data Ctx : ℕ -> Type where |
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
f : (n : Nat) -> n = n + 0 | |
f 0 = Refl | |
f (S k) = | |
let ih : k = plus k 0 | |
ih = f k | |
in rewrite sym ih in Refl |
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
{- | |
data Λ : List Type -> Type where | |
Var : (xs : List Type) -> Λ xs | |
Lam : Λ (x :: xs) -> Λ xs | |
App : Λ xs -> Λ xs -> Λ xs | |
-} | |
Scoped : Type -> Type | |
Scoped i = i -> List i -> Type |
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
%default total | |
data Fix : (Type -> Type) -> Type where | |
MkFix : f (Fix f) -> Fix f | |
F : Type -> Type | |
F x = x -> x | |
fix : Fix F -> Fix F | |
fix (MkFix f) = f (MkFix f) |
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
%default total | |
data Foo : Type | |
-- comment out the next line to have things type check. | |
data Bar : Foo -> Foo -> Type | |
data Foo : Type where | |
MkFoo : Foo | |
data Bar : Foo -> Foo -> Type where |
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
------------------------------- Base Imports --------------------------------- | |
import Syntax.PreorderReasoning -- for long proofs | |
import Data.List -- for list lemmas | |
------------------------------ Custom Imports -------------------------------- | |
import VerifiedFunctor | |
--------------------------------- Pragmas ------------------------------------ | |
%default total | |
%hide Prelude.(<$>) | |
%hide Prelude.Interfaces.(<*>) |
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 CantGoLeft | |
%default total | |
data Expr : Type -> Type where | |
Val : {a : Type} -> a -> Expr a | |
Add : {a : Type} -> Num a => Expr a -> Expr a -> Expr a | |
App : {a, b : Type} -> Expr (a -> b) -> Expr a -> Expr b | |
Lam : {a, b : Type} -> (a -> Expr b) -> Expr (a -> b) |