src/HOL/Arith.thy
author nipkow
Thu Dec 04 12:44:37 1997 +0100 (1997-12-04)
changeset 4360 40e5c97e988d
parent 3366 2402c6ab1561
child 4711 75a9ef36b1fe
permissions -rw-r--r--
pred n -> n-1
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
nipkow@4360
    25
syntax pred :: nat => nat
nipkow@4360
    26
translations "pred m" => "m - 1"
pusch@2681
    27
pusch@2681
    28
primrec "op *"  nat 
paulson@3366
    29
  mult_0   "0 * n = 0"
paulson@3366
    30
  mult_Suc "Suc m * n = n + (m * n)"
pusch@2681
    31
clasohm@923
    32
end