xDefine : string -> term quotation -> thm
- set_fixity ("/", Infixl 600); (* tell the parser about "/" *)
> val it = () : unit
- Define
`x/y = if y=0 then NONE else
if x<y then SOME 0
else OPTION_MAP SUC ((x-y)/y)`;
Definition failed! Can't make name for storing definition
because there is no alphanumeric identifier in:
"/".
Try "xDefine <alphanumeric-stem> <eqns-quotation>" instead.
Next the same definition is attempted with xDefine, supplying the name for binding the definition and the induction theorem with in the current theory.
- xDefine "div"
`x/y = if y=0 then NONE else
if x<y then SOME 0
else OPTION_MAP SUC ((x-y)/y)`;
Equations stored under "div_def".
Induction stored under "div_ind".
> val it =
|- x / y =
(if y = 0 then NONE
else
(if x < y then SOME 0
else OPTION_MAP SUC ((x - y) / y))) : thm
bossLib.xDefine is most commonly used. TotalDefn.xDefine is identical to bossLib.xDefine, except that the TotalDefn structure comes with less baggage---it depends only on numLib and pairLib.