equal
deleted
inserted
replaced
9 yields normalized results. |
9 yields normalized results. |
10 *) |
10 *) |
11 |
11 |
12 set proof_timing; |
12 set proof_timing; |
13 |
13 |
14 (** Addition **) |
14 (*** Addition ***) |
15 |
15 |
16 Goal "(#13::int) + #19 = #32"; |
16 Goal "(#13::int) + #19 = #32"; |
17 by (Simp_tac 1); |
17 by (Simp_tac 1); |
18 result(); |
18 result(); |
19 |
19 |
27 |
27 |
28 Goal "(#93746::int) + #-46375 = #47371"; |
28 Goal "(#93746::int) + #-46375 = #47371"; |
29 by (Simp_tac 1); |
29 by (Simp_tac 1); |
30 result(); |
30 result(); |
31 |
31 |
32 (** Negation **) |
32 (*** Negation ***) |
33 |
33 |
34 Goal "- (#65745::int) = #-65745"; |
34 Goal "- (#65745::int) = #-65745"; |
35 by (Simp_tac 1); |
35 by (Simp_tac 1); |
36 result(); |
36 result(); |
37 |
37 |
38 Goal "- (#-54321::int) = #54321"; |
38 Goal "- (#-54321::int) = #54321"; |
39 by (Simp_tac 1); |
39 by (Simp_tac 1); |
40 result(); |
40 result(); |
41 |
41 |
42 |
42 |
43 (** Multiplication **) |
43 (*** Multiplication ***) |
44 |
44 |
45 Goal "(#13::int) * #19 = #247"; |
45 Goal "(#13::int) * #19 = #247"; |
46 by (Simp_tac 1); |
46 by (Simp_tac 1); |
47 result(); |
47 result(); |
48 |
48 |
81 Goal "(#1234567::int) <= #1234567"; |
81 Goal "(#1234567::int) <= #1234567"; |
82 by (Simp_tac 1); |
82 by (Simp_tac 1); |
83 result(); |
83 result(); |
84 |
84 |
85 |
85 |
86 (** Testing the cancellation of complementary terms **) |
86 (*** Division and Remainder ***) |
|
87 |
|
88 Goal "(#10::int) div #3 = #3"; |
|
89 by (Simp_tac 1); |
|
90 result(); |
|
91 |
|
92 Goal "(#10::int) mod #3 = #1"; |
|
93 by (Simp_tac 1); |
|
94 result(); |
|
95 |
|
96 (** A negative divisor **) |
|
97 |
|
98 Goal "(#10::int) div #-3 = #-4"; |
|
99 by (Simp_tac 1); |
|
100 result(); |
|
101 |
|
102 Goal "(#10::int) mod #-3 = #-2"; |
|
103 by (Simp_tac 1); |
|
104 result(); |
|
105 |
|
106 (** A negative dividend |
|
107 [ The definition agrees with mathematical convention but not with |
|
108 the hardware of most computers ] |
|
109 **) |
|
110 |
|
111 Goal "(#-10::int) div #3 = #-4"; |
|
112 by (Simp_tac 1); |
|
113 result(); |
|
114 |
|
115 Goal "(#-10::int) mod #3 = #2"; |
|
116 by (Simp_tac 1); |
|
117 result(); |
|
118 |
|
119 (** A negative dividend AND divisor **) |
|
120 |
|
121 Goal "(#-10::int) div #-3 = #3"; |
|
122 by (Simp_tac 1); |
|
123 result(); |
|
124 |
|
125 Goal "(#-10::int) mod #-3 = #-1"; |
|
126 by (Simp_tac 1); |
|
127 result(); |
|
128 |
|
129 (** A few bigger examples **) |
|
130 |
|
131 Goal "(#8452::int) mod #3 = #1"; |
|
132 by (Simp_tac 1); |
|
133 result(); |
|
134 |
|
135 Goal "(#59485::int) div #434 = #137"; |
|
136 by (Simp_tac 1); |
|
137 result(); |
|
138 |
|
139 Goal "(#1000006::int) mod #10 = #6"; |
|
140 by (Simp_tac 1); |
|
141 result(); |
|
142 |
|
143 |
|
144 (*** Testing the cancellation of complementary terms ***) |
87 |
145 |
88 Goal "y + (x + -x) = (#0::int) + y"; |
146 Goal "y + (x + -x) = (#0::int) + y"; |
89 by (Simp_tac 1); |
147 by (Simp_tac 1); |
90 result(); |
148 result(); |
91 |
149 |
189 by (ALLGOALS (asm_simp_tac (simpset() addsimps [bin_minus_BIT]))); |
247 by (ALLGOALS (asm_simp_tac (simpset() addsimps [bin_minus_BIT]))); |
190 by (resolve_tac normal.intrs 1); |
248 by (resolve_tac normal.intrs 1); |
191 by (assume_tac 1); |
249 by (assume_tac 1); |
192 by (asm_full_simp_tac (simpset() addsimps [normal_Pls_eq_0]) 1); |
250 by (asm_full_simp_tac (simpset() addsimps [normal_Pls_eq_0]) 1); |
193 by (asm_full_simp_tac |
251 by (asm_full_simp_tac |
194 (simpset_of Int.thy addsimps [number_of_minus, iszero_def, |
252 (simpset_of Int.thy |
195 zminus_exchange]) 1); |
253 addsimps [number_of_minus, iszero_def, |
|
254 read_instantiate [("y","int 0")] zminus_equation]) 1); |
|
255 by (etac not_sym 1); |
196 qed "bin_minus_normal"; |
256 qed "bin_minus_normal"; |
197 |
257 |
198 Goal "w : normal ==> z: normal --> bin_mult w z : normal"; |
258 Goal "w : normal ==> z: normal --> bin_mult w z : normal"; |
199 by (etac normal.induct 1); |
259 by (etac normal.induct 1); |
200 by (ALLGOALS |
260 by (ALLGOALS |