Compat.new_infix_prim_rec_definition : (string * term) -> thm
|- !e f. ?! fn. (fn 0 = e) /\ (!n. fn(SUC n) = f(fn n)n)Evaluating
new_infix_prim_rec_definition ("fun_DEF", Term `(fun 0 x = f_1[x]) /\ (fun (SUC n) x = f_2[fun n x', n, x])`);where all the free variables in the term x' are contained in {n,x}, automatically proves the theorem:
|- ?fun. !x. fun 0 x = f_1[x] /\ !x. fun (SUC n) x = f_2[fun n x', n, x]and then declares a new constant fun with this property and infix status as its specification. This constant specification is returned as a theorem and is saved with name fun_DEF in the current theory segment.
The ML function new_infix_prim_rec_definition is, in fact, slightly more general than is indicated above. In particular, a curried primitive recursive function can be defined by primitive recursion on either one of its arguments using this ML function. The ML function new_infix_prim_rec_definition also allows the user to partially specify the value of a function defined (possibly recursively) on the natural numbers by giving its value for only one of 0 or SUC n.
new_infix_prim_rec_definition ("ADD", (--`($+ 0 n = n) /\ ($+ (SUC m) n = SUC($+ m n))`--))The $'s are there (as documentation) to indicate that the constant + is being declared to be an infix. Evaluating this ML expression will create the following constant specification in the current theory segment:
ADD = |- (!n. 0 + n = n) /\ (!m n. (SUC m) + n = SUC(m + n))