src/HOL/Arith.thy
author wenzelm
Mon Mar 09 16:30:55 1998 +0100 (1998-03-09)
changeset 4711 75a9ef36b1fe
parent 4360 40e5c97e988d
child 5183 89f162de39cf
permissions -rw-r--r--
removed pred;
clasohm@923
     1
(*  Title:      HOL/Arith.thy
clasohm@923
     2
    ID:         $Id$
clasohm@923
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
clasohm@923
     4
    Copyright   1993  University of Cambridge
clasohm@923
     5
paulson@3366
     6
Arithmetic operators + - and * (for div, mod and dvd, see Divides)
clasohm@923
     7
*)
clasohm@923
     8
clasohm@923
     9
Arith = Nat +
clasohm@923
    10
clasohm@923
    11
instance
paulson@3366
    12
  nat :: {plus, minus, times, power}
clasohm@923
    13
nipkow@4360
    14
(* size of a datatype value; overloaded *)
nipkow@4360
    15
consts size :: 'a => nat
paulson@1796
    16
pusch@2681
    17
primrec "op +" nat 
paulson@3366
    18
  add_0    "0 + n = n"
paulson@3366
    19
  add_Suc  "Suc m + n = Suc(m + n)"
pusch@2681
    20
pusch@2681
    21
primrec "op -" nat 
paulson@3235
    22
  diff_0   "m - 0 = m"
nipkow@4360
    23
  diff_Suc "m - Suc n = (case m - n of 0 => 0 | Suc k => k)"
nipkow@4360
    24
pusch@2681
    25
primrec "op *"  nat 
paulson@3366
    26
  mult_0   "0 * n = 0"
paulson@3366
    27
  mult_Suc "Suc m * n = n + (m * n)"
pusch@2681
    28
clasohm@923
    29
end