| author | paulson | 
| Thu, 08 Jan 1998 11:21:45 +0100 | |
| changeset 4521 | c7f56322a84b | 
| parent 4360 | 40e5c97e988d | 
| child 4711 | 75a9ef36b1fe | 
| permissions | -rw-r--r-- | 
| 923 | 1  | 
(* Title: HOL/Arith.thy  | 
2  | 
ID: $Id$  | 
|
3  | 
Author: Lawrence C Paulson, Cambridge University Computer Laboratory  | 
|
4  | 
Copyright 1993 University of Cambridge  | 
|
5  | 
||
| 3366 | 6  | 
Arithmetic operators + - and * (for div, mod and dvd, see Divides)  | 
| 923 | 7  | 
*)  | 
8  | 
||
9  | 
Arith = Nat +  | 
|
10  | 
||
11  | 
instance  | 
|
| 3366 | 12  | 
  nat :: {plus, minus, times, power}
 | 
| 923 | 13  | 
|
| 4360 | 14  | 
(* size of a datatype value; overloaded *)  | 
15  | 
consts size :: 'a => nat  | 
|
| 1796 | 16  | 
|
| 
2681
 
93ed51a91622
definitions of +,-,* replaced by primrec definitions
 
pusch 
parents: 
2099 
diff
changeset
 | 
17  | 
primrec "op +" nat  | 
| 3366 | 18  | 
add_0 "0 + n = n"  | 
19  | 
add_Suc "Suc m + n = Suc(m + n)"  | 
|
| 
2681
 
93ed51a91622
definitions of +,-,* replaced by primrec definitions
 
pusch 
parents: 
2099 
diff
changeset
 | 
20  | 
|
| 
 
93ed51a91622
definitions of +,-,* replaced by primrec definitions
 
pusch 
parents: 
2099 
diff
changeset
 | 
21  | 
primrec "op -" nat  | 
| 
3235
 
351565b7321b
The diff laws must be named: we do "Delsimps [diff_Suc];"
 
paulson 
parents: 
2887 
diff
changeset
 | 
22  | 
diff_0 "m - 0 = m"  | 
| 4360 | 23  | 
diff_Suc "m - Suc n = (case m - n of 0 => 0 | Suc k => k)"  | 
24  | 
||
25  | 
syntax pred :: nat => nat  | 
|
26  | 
translations "pred m" => "m - 1"  | 
|
| 
2681
 
93ed51a91622
definitions of +,-,* replaced by primrec definitions
 
pusch 
parents: 
2099 
diff
changeset
 | 
27  | 
|
| 
 
93ed51a91622
definitions of +,-,* replaced by primrec definitions
 
pusch 
parents: 
2099 
diff
changeset
 | 
28  | 
primrec "op *" nat  | 
| 3366 | 29  | 
mult_0 "0 * n = 0"  | 
30  | 
mult_Suc "Suc m * n = n + (m * n)"  | 
|
| 
2681
 
93ed51a91622
definitions of +,-,* replaced by primrec definitions
 
pusch 
parents: 
2099 
diff
changeset
 | 
31  | 
|
| 923 | 32  | 
end  |