doc-src/Tutorial/Datatype/Term.thy
author nipkow
Thu, 06 Jul 2000 09:46:56 +0200
changeset 9255 2ceb11a2e190
parent 5851 15ce4c1c8313
permissions -rw-r--r--
*** empty log message ***

Term = Main +
datatype
    'a aexp = IF ('a bexp) ('a aexp) ('a aexp)
            | Sum ('a aexp list)
            | Diff ('a aexp) ('a aexp)
            | Var 'a
            | Num nat
and 'a bexp = Less ('a aexp) ('a aexp)
            | And ('a bexp) ('a bexp)
            | Neg ('a bexp)
datatype ('a,'b)term = Var 'a | App 'b ((('a,'b)term)list)
consts
   subst  :: ('a => ('a,'b)term) => ('a,'b)term      => ('a,'b)term
   substs :: ('a => ('a,'b)term) => ('a,'b)term list => ('a,'b)term list
primrec
  "subst s (Var x) = s x"
  "subst s (App f ts) = App f (substs s ts)"
  "substs s [] = []"
  "substs s (t # ts) = subst s t # substs s ts"
end