-- -- This file was inspired from our development of
-- SimpleTags.prg.
-- Here we do away with tags, and use only position
-- to represent variables.
-- A Shape is a list of types. The poisiton
-- in the list tells what variable has what type.
data Shape:: *1 where
E :: Shape
P :: *0 ~> Shape ~> Shape
deriving List(s)
-- A count is a natural number, which is indexed
-- by shapes and types.
data Count:: Shape ~> Tag ~> *0 ~> *0 where
Zero:: Count (P t b) a t
Succ:: Count sh nm ty -> (Count (P ty2 sh)) nm ty
deriving Nat(c)
-- A Term is indexed by a Shape which determines what
-- variables are used in the term, and what type those
-- variables have.
data Term:: Shape ~> *0 ~> *0 where
Iconst :: Int -> Term sh Int
Var:: Count i a ty -> Term i ty
Pair:: Term sh a -> Term sh b -> Term sh (a,b)
-- Comments
-- 1) By using position for variable names we get alpha-renaming for free.