DefineSchema : term quotation -> thm
DefineSchema takes its input in exactly the same format as Define.
The termination constraints of a schematic definition are collected on the hypotheses of the definition, and also on the hypotheses of the automatically proved induction theorem, but a termination proof is only attempted when the termination conditions have no occurrences of parameters. This is because, in general, termination can only be proved after some of the parameters of the schema have been instantiated.
- DefineSchema `binRec (x:'a) = if atomic x then (A x:'b) else join (binRec (left x)) (binRec (right x))`; <<HOL message: Definition is schematic in the following variables: "A", "atomic", "join", "left", "right">> Equations stored under "binRec_def". Induction stored under "binRec_ind". > val it = [!x. ~atomic x ==> R (left x) x, !x. ~atomic x ==> R (right x) x, WF R] |- binRec A atomic join left right x = if atomic x then A x else join (binRec A atomic join left right (left x)) (binRec A atomic join left right (right x)) : thm
- DefineSchema `(map [] = []) /\ (map (h::t) = f h :: map t)`; <<HOL message: inventing new type variable names: 'a, 'b>> <<HOL message: Definition is schematic in the following variables: "f">> Equations stored under "map_def". Induction stored under "map_ind". > val it = [] |- (map f [] = []) /\ (map f (h::t) = f h::map f t) : thm