Skip to content

Instantly share code, notes, and snippets.

@mgttlinger
Created February 12, 2018 09:16
Show Gist options
  • Save mgttlinger/a369e41c15174c32e511c2de4b3a6be7 to your computer and use it in GitHub Desktop.
Save mgttlinger/a369e41c15174c32e511c2de4b3a6be7 to your computer and use it in GitHub Desktop.
Full polyadic in Idris
module Polyadic
import Data.Vect
parameters (o : Nat -> Type)
mutual
data MT : Nat -> Type where
Pf : novar f = true -> MT 0
Iota1 : MT 1
Iota2 : MT 2
Falsum : MT 0
Basic : o n -> MT n
App : MT n -> (args : Vect n (m ** MT m)) -> MT (foldr (\el, accu => (fst el) + accu) 0 args)
data MF : Type where
FNeg : MF -> MF
FDia : MT n -> Vect n MF -> MF
FProp : Nat -> MF
FNom : Nat -> MF
novar : MF -> Bool
novar (FNeg f) = novar f
novar (FProp _) = False
novar (FNom _) = False
novar (FDia _ args) = all novar args
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment