pi/src/Inductive.idr

24 lines
635 B
Idris

module Inductive
import Data.Vect
import Term
{-
The type of a constructor, indexed like terms
-}
public export
data Constructor : (ctx : Index) -> (tags : Vect n Nat) -> Type where
Tr : Term n v -> Constructor n v -- a term
Sum : Constructor n v -> Constructor (S n) v -> Constructor n v -- Σ _ : #0 , #1
{-
The type of an inductive definition. It is a vector of constructors.
's indexed by the number of constructors as well as the indecies for terms.
-}
public export
Inductive : Nat -> Index -> Vect n Nat -> Type
Inductive cons ctx tags = Vect cons (Constructor ctx (cons :: tags))