src/HOL/Arith.thy
author nipkow
Tue Apr 08 10:48:42 1997 +0200 (1997-04-08)
changeset 2919 953a47dc0519
parent 2887 00b8ee790d89
child 3235 351565b7321b
permissions -rw-r--r--
Dep. on Provers/nat_transitive
     1 (*  Title:      HOL/Arith.thy
     2     ID:         $Id$
     3     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     4     Copyright   1993  University of Cambridge
     5 
     6 Arithmetic operators and their definitions
     7 *)
     8 
     9 Arith = Nat +
    10 
    11 instance
    12   nat :: {plus, minus, times}
    13 
    14 consts
    15   pred      :: nat => nat
    16   div, mod  :: [nat, nat] => nat  (infixl 70)
    17 
    18 defs
    19   pred_def  "pred(m) == case m of 0 => 0 | Suc n => n"
    20 
    21   mod_def   "m mod n == wfrec (trancl pred_nat)
    22                           (%f j. if j<n then j else f (j-n)) m"
    23   div_def   "m div n == wfrec (trancl pred_nat) 
    24                           (%f j. if j<n then 0 else Suc (f (j-n))) m"
    25 
    26 primrec "op +" nat 
    27   "0 + n = n"
    28   "Suc m + n = Suc(m + n)"
    29 
    30 primrec "op -" nat 
    31   "m - 0 = m"
    32   "m - Suc n = pred(m - n)"
    33 
    34 primrec "op *"  nat 
    35   "0 * n = 0"
    36   "Suc m * n = n + (m * n)"
    37 
    38 end