src/HOL/Arith.thy
author paulson
Fri May 30 15:15:57 1997 +0200 (1997-05-30)
changeset 3366 2402c6ab1561
parent 3308 da002cef7090
child 4360 40e5c97e988d
permissions -rw-r--r--
Moving div and mod from Arith to Divides
Moving dvd from ex/Primes to Divides
     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 * (for div, mod and dvd, see Divides)
     7 *)
     8 
     9 Arith = Nat +
    10 
    11 instance
    12   nat :: {plus, minus, times, power}
    13 
    14 consts
    15   pred      :: nat => nat
    16   (* size of a datatype value; overloaded *)
    17   size      :: 'a => nat
    18 
    19 defs
    20   pred_def  "pred(m) == case m of 0 => 0 | Suc n => n"
    21 
    22 primrec "op +" nat 
    23   add_0    "0 + n = n"
    24   add_Suc  "Suc m + n = Suc(m + n)"
    25 
    26 primrec "op -" nat 
    27   diff_0   "m - 0 = m"
    28   diff_Suc "m - Suc n = pred(m - n)"
    29 
    30 primrec "op *"  nat 
    31   mult_0   "0 * n = 0"
    32   mult_Suc "Suc m * n = n + (m * n)"
    33 
    34 end