author | paulson |
Thu, 07 Sep 2000 17:36:37 +0200 | |
changeset 9883 | c1c8647af477 |
parent 9578 | ab26d6c8ebfe |
child 9909 | 111ccda5009b |
permissions | -rw-r--r-- |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
1 |
(* Title: ZF/Integ/Int.ML |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
2 |
ID: $Id$ |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
4 |
Copyright 1993 University of Cambridge |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
5 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
6 |
The integers as equivalence classes over nat*nat. |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
7 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
8 |
Could also prove... |
9548 | 9 |
"znegative(z) ==> $# zmagnitude(z) = $- z" |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
10 |
"~ znegative(z) ==> $# zmagnitude(z) = z" |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
11 |
*) |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
12 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
13 |
AddSEs [quotientE]; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
14 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
15 |
(*** Proving that intrel is an equivalence relation ***) |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
16 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
17 |
(** Natural deduction for intrel **) |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
18 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
19 |
Goalw [intrel_def] |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
20 |
"<<x1,y1>,<x2,y2>>: intrel <-> \ |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
21 |
\ x1: nat & y1: nat & x2: nat & y2: nat & x1#+y2 = x2#+y1"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
22 |
by (Fast_tac 1); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
23 |
qed "intrel_iff"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
24 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
25 |
Goalw [intrel_def] |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
26 |
"[| x1#+y2 = x2#+y1; x1: nat; y1: nat; x2: nat; y2: nat |] \ |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
27 |
\ ==> <<x1,y1>,<x2,y2>>: intrel"; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
28 |
by (fast_tac (claset() addIs prems) 1); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
29 |
qed "intrelI"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
30 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
31 |
(*intrelE is hard to derive because fast_tac tries hyp_subst_tac so soon*) |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
32 |
Goalw [intrel_def] |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
33 |
"p: intrel --> (EX x1 y1 x2 y2. \ |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
34 |
\ p = <<x1,y1>,<x2,y2>> & x1#+y2 = x2#+y1 & \ |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
35 |
\ x1: nat & y1: nat & x2: nat & y2: nat)"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
36 |
by (Fast_tac 1); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
37 |
qed "intrelE_lemma"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
38 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
39 |
val [major,minor] = goal thy |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
40 |
"[| p: intrel; \ |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
41 |
\ !!x1 y1 x2 y2. [| p = <<x1,y1>,<x2,y2>>; x1#+y2 = x2#+y1; \ |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
42 |
\ x1: nat; y1: nat; x2: nat; y2: nat |] ==> Q |] \ |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
43 |
\ ==> Q"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
44 |
by (cut_facts_tac [major RS (intrelE_lemma RS mp)] 1); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
45 |
by (REPEAT (eresolve_tac [asm_rl,exE,conjE,minor] 1)); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
46 |
qed "intrelE"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
47 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
48 |
AddSIs [intrelI]; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
49 |
AddSEs [intrelE]; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
50 |
|
9548 | 51 |
Goal "[| x1 #+ y2 = x2 #+ y1; x2 #+ y3 = x3 #+ y2 |] ==> x1 #+ y3 = x3 #+ y1"; |
52 |
by (rtac sym 1); |
|
53 |
by (REPEAT (etac add_left_cancel 1)); |
|
54 |
by (ALLGOALS Asm_simp_tac); |
|
9491
1a36151ee2fc
natify, a coercion to reduce the number of type constraints in arithmetic
paulson
parents:
9333
diff
changeset
|
55 |
qed "int_trans_lemma"; |
1a36151ee2fc
natify, a coercion to reduce the number of type constraints in arithmetic
paulson
parents:
9333
diff
changeset
|
56 |
|
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
57 |
Goalw [equiv_def, refl_def, sym_def, trans_def] |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
58 |
"equiv(nat*nat, intrel)"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
59 |
by (fast_tac (claset() addSEs [sym, int_trans_lemma]) 1); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
60 |
qed "equiv_intrel"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
61 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
62 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
63 |
Goalw [int_def] "[| m: nat; n: nat |] ==> intrel `` {<m,n>} : int"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
64 |
by (blast_tac (claset() addIs [quotientI]) 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
65 |
qed "image_intrel_int"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
66 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
67 |
|
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
68 |
Addsimps [equiv_intrel RS eq_equiv_class_iff, intrel_iff, |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
69 |
add_0_right, add_succ_right]; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
70 |
Addcongs [conj_cong]; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
71 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
72 |
val eq_intrelD = equiv_intrel RSN (2,eq_equiv_class); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
73 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
74 |
(** int_of: the injection from nat to int **) |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
75 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
76 |
Goalw [int_def,quotient_def,int_of_def] "$#m : int"; |
6153 | 77 |
by Auto_tac; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
78 |
qed "int_of_type"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
79 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
80 |
AddIffs [int_of_type]; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
81 |
AddTCs [int_of_type]; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
82 |
|
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
83 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
84 |
Goalw [int_of_def] "($# m = $# n) <-> natify(m)=natify(n)"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
85 |
by Auto_tac; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
86 |
qed "int_of_eq"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
87 |
AddIffs [int_of_eq]; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
88 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
89 |
Goal "[| $#m = $#n; m: nat; n: nat |] ==> m=n"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
90 |
by (dtac (int_of_eq RS iffD1) 1); |
6153 | 91 |
by Auto_tac; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
92 |
qed "int_of_inject"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
93 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
94 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
95 |
(** intify: coercion from anything to int **) |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
96 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
97 |
Goal "intify(x) : int"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
98 |
by (simp_tac (simpset() addsimps [intify_def]) 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
99 |
qed "intify_in_int"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
100 |
AddIffs [intify_in_int]; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
101 |
AddTCs [intify_in_int]; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
102 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
103 |
Goal "n : int ==> intify(n) = n"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
104 |
by (asm_simp_tac (simpset() addsimps [intify_def]) 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
105 |
qed "intify_ident"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
106 |
Addsimps [intify_ident]; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
107 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
108 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
109 |
(*** Collapsing rules: to remove intify from arithmetic expressions ***) |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
110 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
111 |
Goal "intify(intify(x)) = intify(x)"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
112 |
by (Simp_tac 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
113 |
qed "intify_idem"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
114 |
Addsimps [intify_idem]; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
115 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
116 |
Goal "$# (natify(m)) = $# m"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
117 |
by (simp_tac (simpset() addsimps [int_of_def]) 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
118 |
qed "int_of_natify"; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
119 |
|
9548 | 120 |
Goal "$- (intify(m)) = $- m"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
121 |
by (simp_tac (simpset() addsimps [zminus_def]) 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
122 |
qed "zminus_intify"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
123 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
124 |
Addsimps [int_of_natify, zminus_intify]; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
125 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
126 |
(** Addition **) |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
127 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
128 |
Goal "intify(x) $+ y = x $+ y"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
129 |
by (simp_tac (simpset() addsimps [zadd_def]) 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
130 |
qed "zadd_intify1"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
131 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
132 |
Goal "x $+ intify(y) = x $+ y"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
133 |
by (simp_tac (simpset() addsimps [zadd_def]) 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
134 |
qed "zadd_intify2"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
135 |
Addsimps [zadd_intify1, zadd_intify2]; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
136 |
|
9548 | 137 |
(** Subtraction **) |
138 |
||
139 |
Goal "intify(x) $- y = x $- y"; |
|
140 |
by (simp_tac (simpset() addsimps [zdiff_def]) 1); |
|
141 |
qed "zdiff_intify1"; |
|
142 |
||
143 |
Goal "x $- intify(y) = x $- y"; |
|
144 |
by (simp_tac (simpset() addsimps [zdiff_def]) 1); |
|
145 |
qed "zdiff_intify2"; |
|
146 |
Addsimps [zdiff_intify1, zdiff_intify2]; |
|
147 |
||
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
148 |
(** Multiplication **) |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
149 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
150 |
Goal "intify(x) $* y = x $* y"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
151 |
by (simp_tac (simpset() addsimps [zmult_def]) 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
152 |
qed "zmult_intify1"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
153 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
154 |
Goal "x $* intify(y) = x $* y"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
155 |
by (simp_tac (simpset() addsimps [zmult_def]) 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
156 |
qed "zmult_intify2"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
157 |
Addsimps [zmult_intify1, zmult_intify2]; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
158 |
|
9548 | 159 |
(** Orderings **) |
160 |
||
161 |
Goal "intify(x) $< y <-> x $< y"; |
|
162 |
by (simp_tac (simpset() addsimps [zless_def]) 1); |
|
163 |
qed "zless_intify1"; |
|
164 |
||
165 |
Goal "x $< intify(y) <-> x $< y"; |
|
166 |
by (simp_tac (simpset() addsimps [zless_def]) 1); |
|
167 |
qed "zless_intify2"; |
|
168 |
Addsimps [zless_intify1, zless_intify2]; |
|
169 |
||
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
170 |
Goal "intify(x) $<= y <-> x $<= y"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
171 |
by (simp_tac (simpset() addsimps [zle_def]) 1); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
172 |
qed "zle_intify1"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
173 |
|
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
174 |
Goal "x $<= intify(y) <-> x $<= y"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
175 |
by (simp_tac (simpset() addsimps [zle_def]) 1); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
176 |
qed "zle_intify2"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
177 |
Addsimps [zle_intify1, zle_intify2]; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
178 |
|
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
179 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
180 |
(**** zminus: unary negation on int ****) |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
181 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
182 |
Goalw [congruent_def] "congruent(intrel, %<x,y>. intrel``{<y,x>})"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
183 |
by Safe_tac; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
184 |
by (asm_full_simp_tac (simpset() addsimps add_ac) 1); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
185 |
qed "zminus_congruent"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
186 |
|
9333 | 187 |
val RSLIST = curry (op MRS); |
188 |
||
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
189 |
(*Resolve th against the corresponding facts for zminus*) |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
190 |
val zminus_ize = RSLIST [equiv_intrel, zminus_congruent]; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
191 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
192 |
Goalw [int_def,raw_zminus_def] "z : int ==> raw_zminus(z) : int"; |
6153 | 193 |
by (typecheck_tac (tcset() addTCs [zminus_ize UN_equiv_class_type])); |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
194 |
qed "raw_zminus_type"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
195 |
|
9548 | 196 |
Goalw [zminus_def] "$-z : int"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
197 |
by (simp_tac (simpset() addsimps [zminus_def, raw_zminus_type]) 1); |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
198 |
qed "zminus_type"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
199 |
AddIffs [zminus_type]; |
6153 | 200 |
AddTCs [zminus_type]; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
201 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
202 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
203 |
Goalw [int_def,raw_zminus_def] |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
204 |
"[| raw_zminus(z) = raw_zminus(w); z: int; w: int |] ==> z=w"; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
205 |
by (etac (zminus_ize UN_equiv_class_inject) 1); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
206 |
by Safe_tac; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
207 |
by (auto_tac (claset() addDs [eq_intrelD], simpset() addsimps add_ac)); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
208 |
qed "raw_zminus_inject"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
209 |
|
9548 | 210 |
Goalw [zminus_def] "$-z = $-w ==> intify(z) = intify(w)"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
211 |
by (blast_tac (claset() addSDs [raw_zminus_inject]) 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
212 |
qed "zminus_inject_intify"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
213 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
214 |
AddSDs [zminus_inject_intify]; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
215 |
|
9548 | 216 |
Goal "[| $-z = $-w; z: int; w: int |] ==> z=w"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
217 |
by Auto_tac; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
218 |
qed "zminus_inject"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
219 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
220 |
Goalw [raw_zminus_def] |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
221 |
"[| x: nat; y: nat |] \ |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
222 |
\ ==> raw_zminus(intrel``{<x,y>}) = intrel `` {<y,x>}"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
223 |
by (asm_simp_tac (simpset() addsimps [zminus_ize UN_equiv_class, SigmaI]) 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
224 |
qed "raw_zminus"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
225 |
|
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
226 |
Goalw [zminus_def] |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
227 |
"[| x: nat; y: nat |] \ |
9548 | 228 |
\ ==> $- (intrel``{<x,y>}) = intrel `` {<y,x>}"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
229 |
by (asm_simp_tac (simpset() addsimps [raw_zminus, image_intrel_int]) 1); |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
230 |
qed "zminus"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
231 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
232 |
Goalw [int_def] "z : int ==> raw_zminus (raw_zminus(z)) = z"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
233 |
by (auto_tac (claset(), simpset() addsimps [raw_zminus])); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
234 |
qed "raw_zminus_zminus"; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
235 |
|
9548 | 236 |
Goal "$- ($- z) = intify(z)"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
237 |
by (simp_tac (simpset() addsimps [zminus_def, raw_zminus_type, |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
238 |
raw_zminus_zminus]) 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
239 |
qed "zminus_zminus_intify"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
240 |
|
9548 | 241 |
Goalw [int_of_def] "$- ($#0) = $#0"; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
242 |
by (simp_tac (simpset() addsimps [zminus]) 1); |
9576
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
243 |
qed "zminus_int0"; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
244 |
|
9576
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
245 |
Addsimps [zminus_zminus_intify, zminus_int0]; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
246 |
|
9548 | 247 |
Goal "z : int ==> $- ($- z) = z"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
248 |
by (Asm_simp_tac 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
249 |
qed "zminus_zminus"; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
250 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
251 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
252 |
(**** znegative: the test for negative integers ****) |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
253 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
254 |
(*No natural number is negative!*) |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
255 |
Goalw [znegative_def, int_of_def] "~ znegative($# n)"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
256 |
by Safe_tac; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
257 |
by (dres_inst_tac [("psi", "?lhs=?rhs")] asm_rl 1); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
258 |
by (dres_inst_tac [("psi", "?lhs<?rhs")] asm_rl 1); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
259 |
by (force_tac (claset(), |
9548 | 260 |
simpset() addsimps [add_le_self2 RS le_imp_not_lt, |
261 |
natify_succ]) 1); |
|
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
262 |
qed "not_znegative_int_of"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
263 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
264 |
Addsimps [not_znegative_int_of]; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
265 |
AddSEs [not_znegative_int_of RS notE]; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
266 |
|
9548 | 267 |
Goalw [znegative_def, int_of_def] "znegative($- $# succ(n))"; |
268 |
by (asm_simp_tac (simpset() addsimps [zminus, natify_succ]) 1); |
|
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
269 |
by (blast_tac (claset() addIs [nat_0_le]) 1); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
270 |
qed "znegative_zminus_int_of"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
271 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
272 |
Addsimps [znegative_zminus_int_of]; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
273 |
|
9548 | 274 |
Goalw [znegative_def, int_of_def] "~ znegative($- $# n) ==> natify(n)=0"; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
275 |
by (asm_full_simp_tac (simpset() addsimps [zminus, image_singleton_iff]) 1); |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
276 |
by (dres_inst_tac [("x","0")] spec 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
277 |
by (auto_tac(claset(), |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
278 |
simpset() addsimps [nat_into_Ord RS Ord_0_lt_iff RS iff_sym])); |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
279 |
qed "not_znegative_imp_zero"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
280 |
|
9883 | 281 |
(**** nat_of: coercion of an integer to a natural number ****) |
282 |
||
283 |
Goalw [nat_of_def] "nat_of(intify(z)) = nat_of(z)"; |
|
284 |
by Auto_tac; |
|
285 |
qed "nat_of_intify"; |
|
286 |
Addsimps [nat_of_intify]; |
|
287 |
||
288 |
Goalw [nat_of_def, raw_nat_of_def] "nat_of($# n) = natify(n)"; |
|
289 |
by (auto_tac (claset(), simpset() addsimps [int_of_eq])); |
|
290 |
qed "nat_of_int_of"; |
|
291 |
Addsimps [nat_of_int_of]; |
|
292 |
||
293 |
Goalw [raw_nat_of_def] "raw_nat_of(z) : nat"; |
|
294 |
by Auto_tac; |
|
295 |
by (case_tac "EX! m. m: nat & z = int_of(m)" 1); |
|
296 |
by (asm_simp_tac (simpset() addsimps [the_0]) 2); |
|
297 |
by (rtac theI2 1); |
|
298 |
by Auto_tac; |
|
299 |
qed "raw_nat_of_type"; |
|
300 |
||
301 |
Goalw [nat_of_def] "nat_of(z) : nat"; |
|
302 |
by (simp_tac (simpset() addsimps [raw_nat_of_type]) 1); |
|
303 |
qed "nat_of_type"; |
|
304 |
AddIffs [nat_of_type]; |
|
305 |
AddTCs [nat_of_type]; |
|
306 |
||
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
307 |
(**** zmagnitude: magnitide of an integer, as a natural number ****) |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
308 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
309 |
Goalw [zmagnitude_def] "zmagnitude($# n) = natify(n)"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
310 |
by (auto_tac (claset(), simpset() addsimps [int_of_eq])); |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
311 |
qed "zmagnitude_int_of"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
312 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
313 |
Goal "natify(x)=n ==> $#x = $# n"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
314 |
by (dtac sym 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
315 |
by (asm_simp_tac (simpset() addsimps [int_of_eq]) 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
316 |
qed "natify_int_of_eq"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
317 |
|
9548 | 318 |
Goalw [zmagnitude_def] "zmagnitude($- $# n) = natify(n)"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
319 |
by (rtac the_equality 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
320 |
by (auto_tac((claset() addSDs [not_znegative_imp_zero, natify_int_of_eq], |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
321 |
simpset()) |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
322 |
delIffs [int_of_eq])); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
323 |
by Auto_tac; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
324 |
qed "zmagnitude_zminus_int_of"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
325 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
326 |
Addsimps [zmagnitude_int_of, zmagnitude_zminus_int_of]; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
327 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
328 |
Goalw [zmagnitude_def] "zmagnitude(z) : nat"; |
6153 | 329 |
by (rtac theI2 1); |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
330 |
by Auto_tac; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
331 |
qed "zmagnitude_type"; |
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
332 |
AddIffs [zmagnitude_type]; |
6153 | 333 |
AddTCs [zmagnitude_type]; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
334 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
335 |
Goalw [int_def, znegative_def, int_of_def] |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
336 |
"[| z: int; ~ znegative(z) |] ==> EX n:nat. z = $# n"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
337 |
by (auto_tac(claset() , simpset() addsimps [image_singleton_iff])); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
338 |
by (rename_tac "i j" 1); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
339 |
by (dres_inst_tac [("x", "i")] spec 1); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
340 |
by (dres_inst_tac [("x", "j")] spec 1); |
6153 | 341 |
by (rtac bexI 1); |
342 |
by (rtac (add_diff_inverse2 RS sym) 1); |
|
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
343 |
by Auto_tac; |
8201 | 344 |
by (asm_full_simp_tac (simpset() addsimps [not_lt_iff_le]) 1); |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
345 |
qed "not_zneg_int_of"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
346 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
347 |
Goal "[| z: int; ~ znegative(z) |] ==> $# (zmagnitude(z)) = z"; |
6153 | 348 |
by (dtac not_zneg_int_of 1); |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
349 |
by Auto_tac; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
350 |
qed "not_zneg_mag"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
351 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
352 |
Addsimps [not_zneg_mag]; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
353 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
354 |
Goalw [int_def, znegative_def, int_of_def] |
9576
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
355 |
"[| znegative(z); z: int |] ==> EX n:nat. z = $- ($# succ(n))"; |
9548 | 356 |
by (auto_tac(claset() addSDs [less_imp_succ_add], |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
357 |
simpset() addsimps [zminus, image_singleton_iff])); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
358 |
qed "zneg_int_of"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
359 |
|
9576
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
360 |
Goal "[| znegative(z); z: int |] ==> $# (zmagnitude(z)) = $- z"; |
6153 | 361 |
by (dtac zneg_int_of 1); |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
362 |
by Auto_tac; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
363 |
qed "zneg_mag"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
364 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
365 |
Addsimps [zneg_mag]; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
366 |
|
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
367 |
Goal "z : int ==> EX n: nat. z = $# n | z = $- ($# succ(n))"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
368 |
by (case_tac "znegative(z)" 1); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
369 |
by (blast_tac (claset() addDs [not_zneg_mag, sym]) 2); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
370 |
by (blast_tac (claset() addDs [zneg_int_of]) 1); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
371 |
qed "int_cases"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
372 |
|
9883 | 373 |
Goal "[| ~ znegative(z); z: int |] ==> $# (raw_nat_of(z)) = z"; |
374 |
by (dtac not_zneg_int_of 1); |
|
375 |
by (auto_tac (claset(), simpset() addsimps [raw_nat_of_type])); |
|
376 |
by (auto_tac (claset(), simpset() addsimps [raw_nat_of_def])); |
|
377 |
qed "not_zneg_raw_nat_of"; |
|
378 |
||
379 |
Goal "~ znegative(intify(z)) ==> $# (nat_of(z)) = intify(z)"; |
|
380 |
by (asm_simp_tac (simpset() addsimps [nat_of_def, not_zneg_raw_nat_of]) 1); |
|
381 |
qed "not_zneg_nat_of_intify"; |
|
382 |
||
383 |
Goal "[| ~ znegative(z); z: int |] ==> $# (nat_of(z)) = z"; |
|
384 |
by (asm_simp_tac (simpset() addsimps [not_zneg_nat_of_intify]) 1); |
|
385 |
qed "not_zneg_nat_of"; |
|
386 |
||
387 |
Goalw [nat_of_def, raw_nat_of_def] "znegative(intify(z)) ==> nat_of(z) = 0"; |
|
388 |
by Auto_tac; |
|
389 |
qed "zneg_nat_of"; |
|
390 |
Addsimps [zneg_nat_of]; |
|
391 |
||
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
392 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
393 |
(**** zadd: addition on int ****) |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
394 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
395 |
(** Congruence property for addition **) |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
396 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
397 |
Goalw [congruent2_def] |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
398 |
"congruent2(intrel, %z1 z2. \ |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
399 |
\ let <x1,y1>=z1; <x2,y2>=z2 \ |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
400 |
\ in intrel``{<x1#+x2, y1#+y2>})"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
401 |
(*Proof via congruent2_commuteI seems longer*) |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
402 |
by Safe_tac; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
403 |
by (asm_simp_tac (simpset() addsimps [add_assoc, Let_def]) 1); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
404 |
(*The rest should be trivial, but rearranging terms is hard; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
405 |
add_ac does not help rewriting with the assumptions.*) |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
406 |
by (res_inst_tac [("m1","x1a")] (add_left_commute RS ssubst) 1); |
9491
1a36151ee2fc
natify, a coercion to reduce the number of type constraints in arithmetic
paulson
parents:
9333
diff
changeset
|
407 |
by (res_inst_tac [("m1","x2a")] (add_left_commute RS ssubst) 1); |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
408 |
by (asm_simp_tac (simpset() addsimps [add_assoc RS sym]) 1); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
409 |
qed "zadd_congruent2"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
410 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
411 |
(*Resolve th against the corresponding facts for zadd*) |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
412 |
val zadd_ize = RSLIST [equiv_intrel, zadd_congruent2]; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
413 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
414 |
Goalw [int_def,raw_zadd_def] "[| z: int; w: int |] ==> raw_zadd(z,w) : int"; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
415 |
by (rtac (zadd_ize UN_equiv_class_type2) 1); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
416 |
by (simp_tac (simpset() addsimps [Let_def]) 3); |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
417 |
by (REPEAT (assume_tac 1)); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
418 |
qed "raw_zadd_type"; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
419 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
420 |
Goal "z $+ w : int"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
421 |
by (simp_tac (simpset() addsimps [zadd_def, raw_zadd_type]) 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
422 |
qed "zadd_type"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
423 |
AddIffs [zadd_type]; AddTCs [zadd_type]; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
424 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
425 |
Goalw [raw_zadd_def] |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
426 |
"[| x1: nat; y1: nat; x2: nat; y2: nat |] \ |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
427 |
\ ==> raw_zadd (intrel``{<x1,y1>}, intrel``{<x2,y2>}) = \ |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
428 |
\ intrel `` {<x1#+x2, y1#+y2>}"; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
429 |
by (asm_simp_tac (simpset() addsimps [zadd_ize UN_equiv_class2, SigmaI]) 1); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
430 |
by (simp_tac (simpset() addsimps [Let_def]) 1); |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
431 |
qed "raw_zadd"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
432 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
433 |
Goalw [zadd_def] |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
434 |
"[| x1: nat; y1: nat; x2: nat; y2: nat |] \ |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
435 |
\ ==> (intrel``{<x1,y1>}) $+ (intrel``{<x2,y2>}) = \ |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
436 |
\ intrel `` {<x1#+x2, y1#+y2>}"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
437 |
by (asm_simp_tac (simpset() addsimps [raw_zadd, image_intrel_int]) 1); |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
438 |
qed "zadd"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
439 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
440 |
Goalw [int_def,int_of_def] "z : int ==> raw_zadd ($#0,z) = z"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
441 |
by (auto_tac (claset(), simpset() addsimps [raw_zadd])); |
9548 | 442 |
qed "raw_zadd_int0"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
443 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
444 |
Goal "$#0 $+ z = intify(z)"; |
9548 | 445 |
by (asm_simp_tac (simpset() addsimps [zadd_def, raw_zadd_int0]) 1); |
446 |
qed "zadd_int0_intify"; |
|
447 |
Addsimps [zadd_int0_intify]; |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
448 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
449 |
Goal "z: int ==> $#0 $+ z = z"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
450 |
by (Asm_simp_tac 1); |
9548 | 451 |
qed "zadd_int0"; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
452 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
453 |
Goalw [int_def] |
9548 | 454 |
"[| z: int; w: int |] ==> $- raw_zadd(z,w) = raw_zadd($- z, $- w)"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
455 |
by (auto_tac (claset(), simpset() addsimps [zminus,raw_zadd])); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
456 |
qed "raw_zminus_zadd_distrib"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
457 |
|
9548 | 458 |
Goal "$- (z $+ w) = $- z $+ $- w"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
459 |
by (simp_tac (simpset() addsimps [zadd_def, raw_zminus_zadd_distrib]) 1); |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
460 |
qed "zminus_zadd_distrib"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
461 |
|
9548 | 462 |
Addsimps [zminus_zadd_distrib]; |
463 |
||
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
464 |
Goalw [int_def] "[| z: int; w: int |] ==> raw_zadd(z,w) = raw_zadd(w,z)"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
465 |
by (auto_tac (claset(), simpset() addsimps raw_zadd::add_ac)); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
466 |
qed "raw_zadd_commute"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
467 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
468 |
Goal "z $+ w = w $+ z"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
469 |
by (simp_tac (simpset() addsimps [zadd_def, raw_zadd_commute]) 1); |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
470 |
qed "zadd_commute"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
471 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
472 |
Goalw [int_def] |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
473 |
"[| z1: int; z2: int; z3: int |] \ |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
474 |
\ ==> raw_zadd (raw_zadd(z1,z2),z3) = raw_zadd(z1,raw_zadd(z2,z3))"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
475 |
by (auto_tac (claset(), simpset() addsimps [raw_zadd, add_assoc])); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
476 |
qed "raw_zadd_assoc"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
477 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
478 |
Goal "(z1 $+ z2) $+ z3 = z1 $+ (z2 $+ z3)"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
479 |
by (simp_tac (simpset() addsimps [zadd_def, raw_zadd_type, raw_zadd_assoc]) 1); |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
480 |
qed "zadd_assoc"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
481 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
482 |
(*For AC rewriting*) |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
483 |
Goal "z1$+(z2$+z3) = z2$+(z1$+z3)"; |
6153 | 484 |
by (asm_simp_tac (simpset() addsimps [zadd_assoc RS sym]) 1); |
485 |
by (asm_simp_tac (simpset() addsimps [zadd_commute]) 1); |
|
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
486 |
qed "zadd_left_commute"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
487 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
488 |
(*Integer addition is an AC operator*) |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
489 |
val zadd_ac = [zadd_assoc, zadd_commute, zadd_left_commute]; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
490 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
491 |
Goalw [int_of_def] "$# (m #+ n) = ($#m) $+ ($#n)"; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
492 |
by (asm_simp_tac (simpset() addsimps [zadd]) 1); |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
493 |
qed "int_of_add"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
494 |
|
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
495 |
Goal "$# succ(m) = $# 1 $+ ($# m)"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
496 |
by (simp_tac (simpset() addsimps [int_of_add RS sym, natify_succ]) 1); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
497 |
qed "int_succ_int_1"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
498 |
|
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
499 |
Goalw [int_of_def,zdiff_def] |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
500 |
"[| m: nat; n le m |] ==> $# (m #- n) = ($#m) $- ($#n)"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
501 |
by (ftac lt_nat_in_nat 1); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
502 |
by (asm_simp_tac (simpset() addsimps [zadd,zminus,add_diff_inverse2]) 2); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
503 |
by Auto_tac; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
504 |
qed "int_of_diff"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
505 |
|
9548 | 506 |
Goalw [int_def,int_of_def] "z : int ==> raw_zadd (z, $- z) = $#0"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
507 |
by (auto_tac (claset(), simpset() addsimps [zminus, raw_zadd, add_commute])); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
508 |
qed "raw_zadd_zminus_inverse"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
509 |
|
9548 | 510 |
Goal "z $+ ($- z) = $#0"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
511 |
by (simp_tac (simpset() addsimps [zadd_def]) 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
512 |
by (stac (zminus_intify RS sym) 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
513 |
by (rtac (intify_in_int RS raw_zadd_zminus_inverse) 1); |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
514 |
qed "zadd_zminus_inverse"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
515 |
|
9548 | 516 |
Goal "($- z) $+ z = $#0"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
517 |
by (simp_tac (simpset() addsimps [zadd_commute, zadd_zminus_inverse]) 1); |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
518 |
qed "zadd_zminus_inverse2"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
519 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
520 |
Goal "z $+ $#0 = intify(z)"; |
9548 | 521 |
by (rtac ([zadd_commute, zadd_int0_intify] MRS trans) 1); |
522 |
qed "zadd_int0_right_intify"; |
|
523 |
Addsimps [zadd_int0_right_intify]; |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
524 |
|
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
525 |
Goal "z:int ==> z $+ $#0 = z"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
526 |
by (Asm_simp_tac 1); |
9548 | 527 |
qed "zadd_int0_right"; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
528 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
529 |
Addsimps [zadd_zminus_inverse, zadd_zminus_inverse2]; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
530 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
531 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
532 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
533 |
(**** zmult: multiplication on int ****) |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
534 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
535 |
(** Congruence property for multiplication **) |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
536 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
537 |
Goal "congruent2(intrel, %p1 p2. \ |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
538 |
\ split(%x1 y1. split(%x2 y2. \ |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
539 |
\ intrel``{<x1#*x2 #+ y1#*y2, x1#*y2 #+ y1#*x2>}, p2), p1))"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
540 |
by (rtac (equiv_intrel RS congruent2_commuteI) 1); |
9548 | 541 |
by Auto_tac; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
542 |
(*Proof that zmult is congruent in one argument*) |
9548 | 543 |
by (rename_tac "x y" 1); |
544 |
by (forw_inst_tac [("t", "%u. x#*u")] (sym RS subst_context) 1); |
|
545 |
by (dres_inst_tac [("t", "%u. y#*u")] subst_context 1); |
|
546 |
by (REPEAT (etac add_left_cancel 1)); |
|
547 |
by (asm_simp_tac (simpset() addsimps [add_mult_distrib_left]) 1); |
|
548 |
by Auto_tac; |
|
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
549 |
qed "zmult_congruent2"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
550 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
551 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
552 |
(*Resolve th against the corresponding facts for zmult*) |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
553 |
val zmult_ize = RSLIST [equiv_intrel, zmult_congruent2]; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
554 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
555 |
Goalw [int_def,raw_zmult_def] "[| z: int; w: int |] ==> raw_zmult(z,w) : int"; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
556 |
by (REPEAT (ares_tac [zmult_ize UN_equiv_class_type2, |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
557 |
split_type, add_type, mult_type, |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
558 |
quotientI, SigmaI] 1)); |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
559 |
qed "raw_zmult_type"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
560 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
561 |
Goal "z $* w : int"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
562 |
by (simp_tac (simpset() addsimps [zmult_def, raw_zmult_type]) 1); |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
563 |
qed "zmult_type"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
564 |
AddIffs [zmult_type]; AddTCs [zmult_type]; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
565 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
566 |
Goalw [raw_zmult_def] |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
567 |
"[| x1: nat; y1: nat; x2: nat; y2: nat |] \ |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
568 |
\ ==> raw_zmult(intrel``{<x1,y1>}, intrel``{<x2,y2>}) = \ |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
569 |
\ intrel `` {<x1#*x2 #+ y1#*y2, x1#*y2 #+ y1#*x2>}"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
570 |
by (asm_simp_tac (simpset() addsimps [zmult_ize UN_equiv_class2, SigmaI]) 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
571 |
qed "raw_zmult"; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
572 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
573 |
Goalw [zmult_def] |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
574 |
"[| x1: nat; y1: nat; x2: nat; y2: nat |] \ |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
575 |
\ ==> (intrel``{<x1,y1>}) $* (intrel``{<x2,y2>}) = \ |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
576 |
\ intrel `` {<x1#*x2 #+ y1#*y2, x1#*y2 #+ y1#*x2>}"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
577 |
by (asm_simp_tac (simpset() addsimps [raw_zmult, image_intrel_int]) 1); |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
578 |
qed "zmult"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
579 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
580 |
Goalw [int_def,int_of_def] "z : int ==> raw_zmult ($#0,z) = $#0"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
581 |
by (auto_tac (claset(), simpset() addsimps [raw_zmult])); |
9548 | 582 |
qed "raw_zmult_int0"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
583 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
584 |
Goal "$#0 $* z = $#0"; |
9548 | 585 |
by (simp_tac (simpset() addsimps [zmult_def, raw_zmult_int0]) 1); |
586 |
qed "zmult_int0"; |
|
587 |
Addsimps [zmult_int0]; |
|
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
588 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
589 |
Goalw [int_def,int_of_def] "z : int ==> raw_zmult ($#1,z) = z"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
590 |
by (auto_tac (claset(), simpset() addsimps [raw_zmult])); |
9548 | 591 |
qed "raw_zmult_int1"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
592 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
593 |
Goal "$#1 $* z = intify(z)"; |
9548 | 594 |
by (simp_tac (simpset() addsimps [zmult_def, raw_zmult_int1]) 1); |
595 |
qed "zmult_int1_intify"; |
|
596 |
Addsimps [zmult_int1_intify]; |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
597 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
598 |
Goal "z : int ==> $#1 $* z = z"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
599 |
by (Asm_simp_tac 1); |
9548 | 600 |
qed "zmult_int1"; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
601 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
602 |
Goalw [int_def] "[| z: int; w: int |] ==> raw_zmult(z,w) = raw_zmult(w,z)"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
603 |
by (auto_tac (claset(), simpset() addsimps [raw_zmult] @ add_ac @ mult_ac)); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
604 |
qed "raw_zmult_commute"; |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
605 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
606 |
Goal "z $* w = w $* z"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
607 |
by (simp_tac (simpset() addsimps [zmult_def, raw_zmult_commute]) 1); |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
608 |
qed "zmult_commute"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
609 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
610 |
Goalw [int_def] |
9548 | 611 |
"[| z: int; w: int |] ==> raw_zmult($- z, w) = $- raw_zmult(z, w)"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
612 |
by (auto_tac (claset(), simpset() addsimps [zminus, raw_zmult] @ add_ac)); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
613 |
qed "raw_zmult_zminus"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
614 |
|
9548 | 615 |
Goal "($- z) $* w = $- (z $* w)"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
616 |
by (simp_tac (simpset() addsimps [zmult_def, raw_zmult_zminus]) 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
617 |
by (stac (zminus_intify RS sym) 1 THEN rtac raw_zmult_zminus 1); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
618 |
by Auto_tac; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
619 |
qed "zmult_zminus"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
620 |
Addsimps [zmult_zminus]; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
621 |
|
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
622 |
Goal "w $* ($- z) = $- (w $* z)"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
623 |
by (simp_tac (simpset() addsimps [inst "z" "w" zmult_commute]) 1); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
624 |
qed "zmult_zminus_right"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
625 |
Addsimps [zmult_zminus_right]; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
626 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
627 |
Goalw [int_def] |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
628 |
"[| z1: int; z2: int; z3: int |] \ |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
629 |
\ ==> raw_zmult (raw_zmult(z1,z2),z3) = raw_zmult(z1,raw_zmult(z2,z3))"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
630 |
by (auto_tac (claset(), |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
631 |
simpset() addsimps [raw_zmult, add_mult_distrib_left] @ add_ac @ mult_ac)); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
632 |
qed "raw_zmult_assoc"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
633 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
634 |
Goal "(z1 $* z2) $* z3 = z1 $* (z2 $* z3)"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
635 |
by (simp_tac (simpset() addsimps [zmult_def, raw_zmult_type, |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
636 |
raw_zmult_assoc]) 1); |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
637 |
qed "zmult_assoc"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
638 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
639 |
(*For AC rewriting*) |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
640 |
Goal "z1$*(z2$*z3) = z2$*(z1$*z3)"; |
6153 | 641 |
by (asm_simp_tac (simpset() addsimps [zmult_assoc RS sym]) 1); |
642 |
by (asm_simp_tac (simpset() addsimps [zmult_commute]) 1); |
|
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
643 |
qed "zmult_left_commute"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
644 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
645 |
(*Integer multiplication is an AC operator*) |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
646 |
val zmult_ac = [zmult_assoc, zmult_commute, zmult_left_commute]; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
647 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
648 |
Goalw [int_def] |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
649 |
"[| z1: int; z2: int; w: int |] \ |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
650 |
\ ==> raw_zmult(raw_zadd(z1,z2), w) = \ |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
651 |
\ raw_zadd (raw_zmult(z1,w), raw_zmult(z2,w))"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
652 |
by (auto_tac (claset(), |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
653 |
simpset() addsimps [raw_zadd, raw_zmult, add_mult_distrib_left] @ |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
654 |
add_ac @ mult_ac)); |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
655 |
qed "raw_zadd_zmult_distrib"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
656 |
|
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
657 |
Goal "(z1 $+ z2) $* w = (z1 $* w) $+ (z2 $* w)"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
658 |
by (simp_tac (simpset() addsimps [zmult_def, zadd_def, raw_zadd_type, |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
659 |
raw_zmult_type, raw_zadd_zmult_distrib]) 1); |
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
660 |
qed "zadd_zmult_distrib"; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
661 |
|
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
662 |
Goal "w $* (z1 $+ z2) = (w $* z1) $+ (w $* z2)"; |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
663 |
by (simp_tac (simpset() addsimps [inst "z" "w" zmult_commute, |
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
664 |
zadd_zmult_distrib]) 1); |
9576
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
665 |
qed "zadd_zmult_distrib2"; |
9496
07e33cac5d9c
coercion "intify" to remove type constraints from integer algebraic laws
paulson
parents:
9491
diff
changeset
|
666 |
|
5561
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
667 |
val int_typechecks = |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
668 |
[int_of_type, zminus_type, zmagnitude_type, zadd_type, zmult_type]; |
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
669 |
|
426c1e330903
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
670 |
|
9548 | 671 |
(*** Subtraction laws ***) |
672 |
||
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
673 |
Goal "z $- w : int"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
674 |
by (simp_tac (simpset() addsimps [zdiff_def]) 1); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
675 |
qed "zdiff_type"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
676 |
AddIffs [zdiff_type]; AddTCs [zdiff_type]; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
677 |
|
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
678 |
Goal "$- (z $- y) = y $- z"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
679 |
by (simp_tac (simpset() addsimps [zdiff_def, zadd_commute])1); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
680 |
qed "zminus_zdiff_eq"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
681 |
Addsimps [zminus_zdiff_eq]; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
682 |
|
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
683 |
Goal "$- (z $- y) = y $- z"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
684 |
by (simp_tac (simpset() addsimps [zdiff_def, zadd_commute])1); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
685 |
qed "zminus_zdiff_eq"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
686 |
Addsimps [zminus_zdiff_eq]; |
9548 | 687 |
|
688 |
Goalw [zdiff_def] "(z1 $- z2) $* w = (z1 $* w) $- (z2 $* w)"; |
|
689 |
by (stac zadd_zmult_distrib 1); |
|
690 |
by (simp_tac (simpset() addsimps [zmult_zminus]) 1); |
|
691 |
qed "zdiff_zmult_distrib"; |
|
692 |
||
693 |
val zmult_commute'= inst "z" "w" zmult_commute; |
|
694 |
||
695 |
Goal "w $* (z1 $- z2) = (w $* z1) $- (w $* z2)"; |
|
696 |
by (simp_tac (simpset() addsimps [zmult_commute',zdiff_zmult_distrib]) 1); |
|
697 |
qed "zdiff_zmult_distrib2"; |
|
698 |
||
699 |
Goal "x $+ (y $- z) = (x $+ y) $- z"; |
|
700 |
by (simp_tac (simpset() addsimps zdiff_def::zadd_ac) 1); |
|
701 |
qed "zadd_zdiff_eq"; |
|
702 |
||
703 |
Goal "(x $- y) $+ z = (x $+ z) $- y"; |
|
704 |
by (simp_tac (simpset() addsimps zdiff_def::zadd_ac) 1); |
|
705 |
qed "zdiff_zadd_eq"; |
|
706 |
||
707 |
||
708 |
(*** "Less Than" ***) |
|
709 |
||
710 |
(*"Less than" is a linear ordering*) |
|
711 |
Goalw [int_def, zless_def, znegative_def, zdiff_def] |
|
712 |
"[| z: int; w: int |] ==> z$<w | z=w | w$<z"; |
|
713 |
by Auto_tac; |
|
714 |
by (asm_full_simp_tac |
|
715 |
(simpset() addsimps [zadd, zminus, image_iff, Bex_def]) 1); |
|
716 |
by (res_inst_tac [("i", "xb#+ya"), ("j", "xc #+ y")] Ord_linear_lt 1); |
|
717 |
by (ALLGOALS (force_tac (claset() addSDs [spec], |
|
718 |
simpset() addsimps add_ac))); |
|
719 |
qed "zless_linear_lemma"; |
|
720 |
||
721 |
Goal "z$<w | intify(z)=intify(w) | w$<z"; |
|
722 |
by (cut_inst_tac [("z"," intify(z)"),("w"," intify(w)")] zless_linear_lemma 1); |
|
723 |
by Auto_tac; |
|
724 |
qed "zless_linear"; |
|
725 |
||
726 |
Goal "~ (z$<z)"; |
|
727 |
by (auto_tac (claset(), |
|
9576
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
728 |
simpset() addsimps [zless_def, znegative_def, int_of_def, |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
729 |
zdiff_def])); |
9548 | 730 |
by (rotate_tac 2 1); |
731 |
by Auto_tac; |
|
732 |
qed "zless_not_refl"; |
|
733 |
AddIffs [zless_not_refl]; |
|
734 |
||
9576
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
735 |
Goal "[| x: int; y: int |] ==> (x ~= y) <-> (x $< y | y $< x)"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
736 |
by (cut_inst_tac [("z","x"),("w","y")] zless_linear 1); |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
737 |
by Auto_tac; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
738 |
qed "neq_iff_zless"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
739 |
|
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
740 |
Goal "w $< z ==> intify(w) ~= intify(z)"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
741 |
by Auto_tac; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
742 |
by (subgoal_tac "~ (intify(w) $< intify(z))" 1); |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
743 |
by (etac ssubst 2); |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
744 |
by (Full_simp_tac 1); |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
745 |
by Auto_tac; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
746 |
qed "zless_imp_intify_neq"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
747 |
|
9548 | 748 |
(*This lemma allows direct proofs of other <-properties*) |
749 |
Goalw [zless_def, znegative_def, zdiff_def, int_def] |
|
9578
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
750 |
"[| w $< z; w: int; z: int |] ==> (EX n: nat. z = w $+ $#(succ(n)))"; |
9548 | 751 |
by (auto_tac (claset() addSDs [less_imp_succ_add], |
752 |
simpset() addsimps [zadd, zminus, int_of_def])); |
|
9578
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
753 |
by (res_inst_tac [("x","k")] bexI 1); |
9548 | 754 |
by (etac add_left_cancel 1); |
755 |
by Auto_tac; |
|
9576
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
756 |
val lemma = result(); |
9548 | 757 |
|
9578
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
758 |
Goal "w $< z ==> (EX n: nat. w $+ $#(succ(n)) = intify(z))"; |
9548 | 759 |
by (subgoal_tac "intify(w) $< intify(z)" 1); |
9576
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
760 |
by (dres_inst_tac [("w","intify(w)")] lemma 1); |
9548 | 761 |
by Auto_tac; |
762 |
qed "zless_imp_succ_zadd"; |
|
763 |
||
764 |
Goalw [zless_def, znegative_def, zdiff_def, int_def] |
|
765 |
"w : int ==> w $< w $+ $# succ(n)"; |
|
766 |
by (auto_tac (claset(), |
|
767 |
simpset() addsimps [zadd, zminus, int_of_def, image_iff])); |
|
768 |
by (res_inst_tac [("x","0")] exI 1); |
|
769 |
by Auto_tac; |
|
9576
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
770 |
val lemma = result(); |
9548 | 771 |
|
772 |
Goal "w $< w $+ $# succ(n)"; |
|
9576
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
773 |
by (cut_facts_tac [intify_in_int RS lemma] 1); |
9548 | 774 |
by Auto_tac; |
775 |
qed "zless_succ_zadd"; |
|
776 |
||
9578
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
777 |
Goal "w $< z <-> (EX n: nat. w $+ $#(succ(n)) = intify(z))"; |
9548 | 778 |
by (rtac iffI 1); |
779 |
by (etac zless_imp_succ_zadd 1); |
|
780 |
by Auto_tac; |
|
9578
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
781 |
by (rename_tac "n" 1); |
9548 | 782 |
by (cut_inst_tac [("w","w"),("n","n")] zless_succ_zadd 1); |
783 |
by Auto_tac; |
|
784 |
qed "zless_iff_succ_zadd"; |
|
785 |
||
9883 | 786 |
Goal "[| m: nat; n: nat |] ==> ($#m $< $#n) <-> (m<n)"; |
787 |
by (asm_simp_tac (simpset() addsimps [less_iff_succ_add, zless_iff_succ_zadd, |
|
788 |
int_of_add RS sym]) 1); |
|
789 |
by (blast_tac (claset() addIs [sym]) 1); |
|
790 |
qed "zless_int_of"; |
|
791 |
Addsimps [zless_int_of]; |
|
792 |
||
9548 | 793 |
Goalw [zless_def, znegative_def, zdiff_def, int_def] |
794 |
"[| x $< y; y $< z; x: int; y : int; z: int |] ==> x $< z"; |
|
9883 | 795 |
by (auto_tac (claset(), simpset() addsimps [zadd, zminus, image_iff])); |
9548 | 796 |
by (rename_tac "x1 x2 y1 y2" 1); |
797 |
by (res_inst_tac [("x","x1#+x2")] exI 1); |
|
798 |
by (res_inst_tac [("x","y1#+y2")] exI 1); |
|
799 |
by (auto_tac (claset(), simpset() addsimps [add_lt_mono])); |
|
800 |
by (rtac sym 1); |
|
801 |
by (REPEAT (etac add_left_cancel 1)); |
|
802 |
by Auto_tac; |
|
803 |
qed "zless_trans_lemma"; |
|
804 |
||
805 |
Goal "[| x $< y; y $< z |] ==> x $< z"; |
|
806 |
by (subgoal_tac "intify(x) $< intify(z)" 1); |
|
807 |
by (res_inst_tac [("y", "intify(y)")] zless_trans_lemma 2); |
|
808 |
by Auto_tac; |
|
809 |
qed "zless_trans"; |
|
810 |
||
9576
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
811 |
Goal "z $< w ==> ~ (w $< z)"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
812 |
by (blast_tac (claset() addDs [zless_trans]) 1); |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
813 |
qed "zless_not_sym"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
814 |
|
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
815 |
(* [| z $< w; ~ P ==> w $< z |] ==> P *) |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
816 |
bind_thm ("zless_asym", zless_not_sym RS swap); |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
817 |
|
9578
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
818 |
Goalw [zle_def] "z $< w ==> z $<= w"; |
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
819 |
by (blast_tac (claset() addEs [zless_asym]) 1); |
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
820 |
qed "zless_imp_zle"; |
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
821 |
|
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
822 |
Goal "z $<= w | w $<= z"; |
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
823 |
by (simp_tac (simpset() addsimps [zle_def]) 1); |
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
824 |
by (cut_facts_tac [zless_linear] 1); |
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
825 |
by (Blast_tac 1); |
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
826 |
qed "zle_linear"; |
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
827 |
|
9576
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
828 |
|
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
829 |
(*** "Less Than or Equals", $<= ***) |
9548 | 830 |
|
831 |
Goalw [zle_def] "z $<= z"; |
|
832 |
by Auto_tac; |
|
833 |
qed "zle_refl"; |
|
834 |
||
9578
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
835 |
Goal "x=y ==> x $<= y"; |
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
836 |
by (asm_simp_tac (simpset() addsimps [zle_refl]) 1); |
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
837 |
qed "zle_eq_refl"; |
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
838 |
|
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
839 |
Goalw [zle_def] "[| x $<= y; y $<= x |] ==> intify(x) = intify(y)"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
840 |
by Auto_tac; |
9548 | 841 |
by (blast_tac (claset() addDs [zless_trans]) 1); |
9578
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
842 |
qed "zle_anti_sym_intify"; |
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
843 |
|
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
844 |
Goal "[| x $<= y; y $<= x; x: int; y: int |] ==> x=y"; |
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
845 |
by (dtac zle_anti_sym_intify 1); |
ab26d6c8ebfe
new theory Integ/IntDiv and many more monotonicity laws, etc., for the integers
paulson
parents:
9576
diff
changeset
|
846 |
by Auto_tac; |
9548 | 847 |
qed "zle_anti_sym"; |
848 |
||
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
849 |
Goalw [zle_def] "[| x: int; y: int; z: int; x $<= y; y $<= z |] ==> x $<= z"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
850 |
by Auto_tac; |
9548 | 851 |
by (blast_tac (claset() addIs [zless_trans]) 1); |
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
852 |
val lemma = result(); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
853 |
|
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
854 |
Goal "[| x $<= y; y $<= z |] ==> x $<= z"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
855 |
by (subgoal_tac "intify(x) $<= intify(z)" 1); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
856 |
by (res_inst_tac [("y", "intify(y)")] lemma 2); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
857 |
by Auto_tac; |
9548 | 858 |
qed "zle_trans"; |
859 |
||
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
860 |
Goal "[| i $<= j; j $< k |] ==> i $< k"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
861 |
by (auto_tac (claset(), simpset() addsimps [zle_def])); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
862 |
by (blast_tac (claset() addIs [zless_trans]) 1); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
863 |
by (asm_full_simp_tac (simpset() addsimps [zless_def, zdiff_def, zadd_def]) 1); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
864 |
qed "zle_zless_trans"; |
9548 | 865 |
|
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
866 |
Goal "[| i $< j; j $<= k |] ==> i $< k"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
867 |
by (auto_tac (claset(), simpset() addsimps [zle_def])); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
868 |
by (blast_tac (claset() addIs [zless_trans]) 1); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
869 |
by (asm_full_simp_tac |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
870 |
(simpset() addsimps [zless_def, zdiff_def, zminus_def]) 1); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
871 |
qed "zless_zle_trans"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
872 |
|
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
873 |
Goal "~ (z $< w) <-> (w $<= z)"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
874 |
by (cut_inst_tac [("z","z"),("w","w")] zless_linear 1); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
875 |
by (auto_tac (claset() addDs [zless_trans], simpset() addsimps [zle_def])); |
9576
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
876 |
by (auto_tac (claset() addSDs [zless_imp_intify_neq], simpset())); |
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
877 |
qed "not_zless_iff_zle"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
878 |
|
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
879 |
Goal "~ (z $<= w) <-> (w $< z)"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
880 |
by (simp_tac (simpset() addsimps [not_zless_iff_zle RS iff_sym]) 1); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
881 |
qed "not_zle_iff_zless"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
882 |
|
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
883 |
|
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
884 |
(*** More subtraction laws (for zcompare_rls) ***) |
9548 | 885 |
|
886 |
Goal "(x $- y) $- z = x $- (y $+ z)"; |
|
887 |
by (simp_tac (simpset() addsimps zdiff_def::zadd_ac) 1); |
|
888 |
qed "zdiff_zdiff_eq"; |
|
889 |
||
890 |
Goal "x $- (y $- z) = (x $+ z) $- y"; |
|
891 |
by (simp_tac (simpset() addsimps zdiff_def::zadd_ac) 1); |
|
892 |
qed "zdiff_zdiff_eq2"; |
|
893 |
||
894 |
Goalw [zless_def, zdiff_def] "(x$-y $< z) <-> (x $< z $+ y)"; |
|
895 |
by (simp_tac (simpset() addsimps zadd_ac) 1); |
|
896 |
qed "zdiff_zless_iff"; |
|
897 |
||
898 |
Goalw [zless_def, zdiff_def] "(x $< z$-y) <-> (x $+ y $< z)"; |
|
899 |
by (simp_tac (simpset() addsimps zadd_ac) 1); |
|
900 |
qed "zless_zdiff_iff"; |
|
901 |
||
902 |
Goalw [zdiff_def] "[| x: int; z: int |] ==> (x$-y = z) <-> (x = z $+ y)"; |
|
903 |
by (auto_tac (claset(), simpset() addsimps [zadd_assoc])); |
|
904 |
qed "zdiff_eq_iff"; |
|
905 |
||
906 |
Goalw [zdiff_def] "[| x: int; z: int |] ==> (x = z$-y) <-> (x $+ y = z)"; |
|
907 |
by (auto_tac (claset(), simpset() addsimps [zadd_assoc])); |
|
908 |
qed "eq_zdiff_iff"; |
|
909 |
||
910 |
Goalw [zle_def] "[| x: int; z: int |] ==> (x$-y $<= z) <-> (x $<= z $+ y)"; |
|
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
911 |
by (auto_tac (claset(), simpset() addsimps [zdiff_eq_iff, zdiff_zless_iff])); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
912 |
val lemma = result(); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
913 |
|
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
914 |
Goal "(x$-y $<= z) <-> (x $<= z $+ y)"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
915 |
by (cut_facts_tac [[intify_in_int, intify_in_int] MRS lemma] 1); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
916 |
by (Asm_full_simp_tac 1); |
9548 | 917 |
qed "zdiff_zle_iff"; |
918 |
||
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
919 |
Goalw [zle_def] "[| x: int; z: int |] ==>(x $<= z$-y) <-> (x $+ y $<= z)"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
920 |
by (auto_tac (claset(), simpset() addsimps [zdiff_eq_iff, zless_zdiff_iff])); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
921 |
by (auto_tac (claset(), simpset() addsimps [zdiff_def, zadd_assoc])); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
922 |
val lemma = result(); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
923 |
|
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
924 |
Goal "(x $<= z$-y) <-> (x $+ y $<= z)"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
925 |
by (cut_facts_tac [[intify_in_int, intify_in_int] MRS lemma] 1); |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
926 |
by (Asm_full_simp_tac 1); |
9548 | 927 |
qed "zle_zdiff_iff"; |
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
928 |
|
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
929 |
(*This list of rewrites simplifies (in)equalities by bringing subtractions |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
930 |
to the top and then moving negative terms to the other side. |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
931 |
Use with zadd_ac*) |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
932 |
bind_thms ("zcompare_rls", |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
933 |
[symmetric zdiff_def, |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
934 |
zadd_zdiff_eq, zdiff_zadd_eq, zdiff_zdiff_eq, zdiff_zdiff_eq2, |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
935 |
zdiff_zless_iff, zless_zdiff_iff, zdiff_zle_iff, zle_zdiff_iff, |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
936 |
zdiff_eq_iff, eq_zdiff_iff]); |
9548 | 937 |
|
938 |
||
939 |
(*** Monotonicity/cancellation results that could allow instantiation |
|
940 |
of the CancelNumerals simprocs ***) |
|
941 |
||
942 |
Goal "[| w: int; w': int |] ==> (z $+ w' = z $+ w) <-> (w' = w)"; |
|
943 |
by Safe_tac; |
|
944 |
by (dres_inst_tac [("t", "%x. x $+ ($-z)")] subst_context 1); |
|
945 |
by (asm_full_simp_tac (simpset() addsimps zadd_ac) 1); |
|
946 |
qed "zadd_left_cancel"; |
|
947 |
||
948 |
Goal "(z $+ w' = z $+ w) <-> intify(w') = intify(w)"; |
|
949 |
by (rtac iff_trans 1); |
|
950 |
by (rtac zadd_left_cancel 2); |
|
951 |
by Auto_tac; |
|
952 |
qed "zadd_left_cancel_intify"; |
|
953 |
||
954 |
Addsimps [zadd_left_cancel_intify]; |
|
955 |
||
956 |
Goal "[| w: int; w': int |] ==> (w' $+ z = w $+ z) <-> (w' = w)"; |
|
957 |
by Safe_tac; |
|
958 |
by (dres_inst_tac [("t", "%x. x $+ ($-z)")] subst_context 1); |
|
959 |
by (asm_full_simp_tac (simpset() addsimps zadd_ac) 1); |
|
960 |
qed "zadd_right_cancel"; |
|
961 |
||
962 |
Goal "(w' $+ z = w $+ z) <-> intify(w') = intify(w)"; |
|
963 |
by (rtac iff_trans 1); |
|
964 |
by (rtac zadd_right_cancel 2); |
|
965 |
by Auto_tac; |
|
966 |
qed "zadd_right_cancel_intify"; |
|
967 |
||
968 |
Addsimps [zadd_right_cancel_intify]; |
|
969 |
||
970 |
||
971 |
Goal "(w' $+ z $< w $+ z) <-> (w' $< w)"; |
|
972 |
by (simp_tac (simpset() addsimps [zdiff_zless_iff RS iff_sym]) 1); |
|
973 |
by (simp_tac (simpset() addsimps [zdiff_def, zadd_assoc]) 1); |
|
974 |
qed "zadd_right_cancel_zless"; |
|
975 |
||
976 |
Goal "(z $+ w' $< z $+ w) <-> (w' $< w)"; |
|
977 |
by (simp_tac (simpset() addsimps [inst "z" "z" zadd_commute, |
|
978 |
zadd_right_cancel_zless]) 1); |
|
979 |
qed "zadd_left_cancel_zless"; |
|
980 |
||
981 |
Addsimps [zadd_right_cancel_zless, zadd_left_cancel_zless]; |
|
982 |
||
983 |
||
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
984 |
Goal "(w' $+ z $<= w $+ z) <-> w' $<= w"; |
9548 | 985 |
by (simp_tac (simpset() addsimps [zle_def]) 1); |
986 |
qed "zadd_right_cancel_zle"; |
|
987 |
||
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
988 |
Goal "(z $+ w' $<= z $+ w) <-> w' $<= w"; |
9548 | 989 |
by (simp_tac (simpset() addsimps [inst "z" "z" zadd_commute, |
990 |
zadd_right_cancel_zle]) 1); |
|
991 |
qed "zadd_left_cancel_zle"; |
|
992 |
||
993 |
Addsimps [zadd_right_cancel_zle, zadd_left_cancel_zle]; |
|
994 |
||
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
995 |
|
9576
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
996 |
(*** Comparison laws ***) |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
997 |
|
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
998 |
Goal "($- x $< $- y) <-> (y $< x)"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
999 |
by (simp_tac (simpset() addsimps [zless_def, zdiff_def] @ zadd_ac) 1); |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1000 |
qed "zminus_zless_zminus"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1001 |
Addsimps [zminus_zless_zminus]; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1002 |
|
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1003 |
Goal "($- x $<= $- y) <-> (y $<= x)"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1004 |
by (simp_tac (simpset() addsimps [not_zless_iff_zle RS iff_sym]) 1); |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1005 |
qed "zminus_zle_zminus"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1006 |
Addsimps [zminus_zle_zminus]; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1007 |
|
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1008 |
|
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
1009 |
(*** More inequality lemmas ***) |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
1010 |
|
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
1011 |
Goal "[| x: int; y: int |] ==> (x = $- y) <-> (y = $- x)"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
1012 |
by Auto_tac; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
1013 |
qed "equation_zminus"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
1014 |
|
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
1015 |
Goal "[| x: int; y: int |] ==> ($- x = y) <-> ($- y = x)"; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
1016 |
by Auto_tac; |
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
9548
diff
changeset
|
1017 |
qed "zminus_equation"; |
9576
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1018 |
|
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1019 |
Goal "(intify(x) = $- y) <-> (intify(y) = $- x)"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1020 |
by (cut_inst_tac [("x","intify(x)"), ("y","intify(y)")] equation_zminus 1); |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1021 |
by Auto_tac; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1022 |
qed "equation_zminus_intify"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1023 |
|
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1024 |
Goal "($- x = intify(y)) <-> ($- y = intify(x))"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1025 |
by (cut_inst_tac [("x","intify(x)"), ("y","intify(y)")] zminus_equation 1); |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1026 |
by Auto_tac; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1027 |
qed "zminus_equation_intify"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1028 |
|
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1029 |
|
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1030 |
(** The next several equations are permutative: watch out! **) |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1031 |
|
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1032 |
Goal "(x $< $- y) <-> (y $< $- x)"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1033 |
by (simp_tac (simpset() addsimps [zless_def, zdiff_def] @ zadd_ac) 1); |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1034 |
qed "zless_zminus"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1035 |
|
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1036 |
Goal "($- x $< y) <-> ($- y $< x)"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1037 |
by (simp_tac (simpset() addsimps [zless_def, zdiff_def] @ zadd_ac) 1); |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1038 |
qed "zminus_zless"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1039 |
|
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1040 |
Goal "(x $<= $- y) <-> (y $<= $- x)"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1041 |
by (simp_tac (simpset() addsimps [not_zless_iff_zle RS iff_sym, |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1042 |
zminus_zless]) 1); |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1043 |
qed "zle_zminus"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1044 |
|
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1045 |
Goal "($- x $<= y) <-> ($- y $<= x)"; |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1046 |
by (simp_tac (simpset() addsimps [not_zless_iff_zle RS iff_sym, |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1047 |
zless_zminus]) 1); |
3df14e0a3a51
interim working version: more improvements to the integers
paulson
parents:
9570
diff
changeset
|
1048 |
qed "zminus_zle"; |