author | kleing |
Sat, 01 Mar 2003 16:45:51 +0100 | |
changeset 13840 | 399c8103a98f |
parent 8936 | a1c426541757 |
permissions | -rw-r--r-- |
5078 | 1 |
(* Title: HOL/Integ/Ring.ML |
2 |
ID: $Id$ |
|
3 |
Author: Tobias Nipkow |
|
4 |
Copyright 1996 TU Muenchen |
|
5 |
||
6 |
Derives a few equational consequences about rings |
|
7 |
and defines cring_simpl, a simplification tactic for commutative rings. |
|
8 |
*) |
|
9 |
||
10 |
Goal "!!x::'a::cring. x*(y*z)=y*(x*z)"; |
|
11 |
by (rtac trans 1); |
|
12 |
by (rtac times_commute 1); |
|
13 |
by (rtac trans 1); |
|
14 |
by (rtac times_assoc 1); |
|
15 |
by (simp_tac (HOL_basic_ss addsimps [times_commute]) 1); |
|
16 |
qed "times_commuteL"; |
|
17 |
||
18 |
val times_cong = read_instantiate [("f1","op *")] (arg_cong RS cong); |
|
19 |
||
8936
a1c426541757
Now that 0 is overloaded, constant "zero" and its type class "zero" are
paulson
parents:
5078
diff
changeset
|
20 |
Goal "!!x::'a::ring. 0*x = 0"; |
5078 | 21 |
by (rtac trans 1); |
22 |
by (rtac right_inv 2); |
|
23 |
by (rtac trans 1); |
|
24 |
by (rtac plus_cong 2); |
|
25 |
by (rtac refl 3); |
|
26 |
by (rtac trans 2); |
|
27 |
by (rtac times_cong 3); |
|
28 |
by (rtac zeroL 3); |
|
29 |
by (rtac refl 3); |
|
30 |
by (rtac (distribR RS sym) 2); |
|
31 |
by (rtac trans 1); |
|
32 |
by (rtac (plus_assoc RS sym) 2); |
|
33 |
by (rtac trans 1); |
|
34 |
by (rtac plus_cong 2); |
|
35 |
by (rtac refl 2); |
|
36 |
by (rtac (right_inv RS sym) 2); |
|
37 |
by (rtac (zeroR RS sym) 1); |
|
38 |
qed "mult_zeroL"; |
|
39 |
||
8936
a1c426541757
Now that 0 is overloaded, constant "zero" and its type class "zero" are
paulson
parents:
5078
diff
changeset
|
40 |
Goal "!!x::'a::ring. x*0 = 0"; |
5078 | 41 |
by (rtac trans 1); |
42 |
by (rtac right_inv 2); |
|
43 |
by (rtac trans 1); |
|
44 |
by (rtac plus_cong 2); |
|
45 |
by (rtac refl 3); |
|
46 |
by (rtac trans 2); |
|
47 |
by (rtac times_cong 3); |
|
48 |
by (rtac zeroL 4); |
|
49 |
by (rtac refl 3); |
|
50 |
by (rtac (distribL RS sym) 2); |
|
51 |
by (rtac trans 1); |
|
52 |
by (rtac (plus_assoc RS sym) 2); |
|
53 |
by (rtac trans 1); |
|
54 |
by (rtac plus_cong 2); |
|
55 |
by (rtac refl 2); |
|
56 |
by (rtac (right_inv RS sym) 2); |
|
57 |
by (rtac (zeroR RS sym) 1); |
|
58 |
qed "mult_zeroR"; |
|
59 |
||
8936
a1c426541757
Now that 0 is overloaded, constant "zero" and its type class "zero" are
paulson
parents:
5078
diff
changeset
|
60 |
Goal "!!x::'a::ring. (0-x)*y = 0-(x*y)"; |
5078 | 61 |
by (rtac trans 1); |
62 |
by (rtac zeroL 2); |
|
63 |
by (rtac trans 1); |
|
64 |
by (rtac plus_cong 2); |
|
65 |
by (rtac refl 3); |
|
66 |
by (rtac mult_zeroL 2); |
|
67 |
by (rtac trans 1); |
|
68 |
by (rtac plus_cong 2); |
|
69 |
by (rtac refl 3); |
|
70 |
by (rtac times_cong 2); |
|
71 |
by (rtac left_inv 2); |
|
72 |
by (rtac refl 2); |
|
73 |
by (rtac trans 1); |
|
74 |
by (rtac plus_cong 2); |
|
75 |
by (rtac refl 3); |
|
76 |
by (rtac (distribR RS sym) 2); |
|
77 |
by (rtac trans 1); |
|
78 |
by (rtac (plus_assoc RS sym) 2); |
|
79 |
by (rtac trans 1); |
|
80 |
by (rtac plus_cong 2); |
|
81 |
by (rtac refl 2); |
|
82 |
by (rtac (right_inv RS sym) 2); |
|
83 |
by (rtac (zeroR RS sym) 1); |
|
84 |
qed "mult_invL"; |
|
85 |
||
8936
a1c426541757
Now that 0 is overloaded, constant "zero" and its type class "zero" are
paulson
parents:
5078
diff
changeset
|
86 |
Goal "!!x::'a::ring. x*(0-y) = 0-(x*y)"; |
5078 | 87 |
by (rtac trans 1); |
88 |
by (rtac zeroL 2); |
|
89 |
by (rtac trans 1); |
|
90 |
by (rtac plus_cong 2); |
|
91 |
by (rtac refl 3); |
|
92 |
by (rtac mult_zeroR 2); |
|
93 |
by (rtac trans 1); |
|
94 |
by (rtac plus_cong 2); |
|
95 |
by (rtac refl 3); |
|
96 |
by (rtac times_cong 2); |
|
97 |
by (rtac refl 2); |
|
98 |
by (rtac left_inv 2); |
|
99 |
by (rtac trans 1); |
|
100 |
by (rtac plus_cong 2); |
|
101 |
by (rtac refl 3); |
|
102 |
by (rtac (distribL RS sym) 2); |
|
103 |
by (rtac trans 1); |
|
104 |
by (rtac (plus_assoc RS sym) 2); |
|
105 |
by (rtac trans 1); |
|
106 |
by (rtac plus_cong 2); |
|
107 |
by (rtac refl 2); |
|
108 |
by (rtac (right_inv RS sym) 2); |
|
109 |
by (rtac (zeroR RS sym) 1); |
|
110 |
qed "mult_invR"; |
|
111 |
||
112 |
Goal "x*(y-z) = (x*y - x*z::'a::ring)"; |
|
113 |
by (mk_group1_tac 1); |
|
114 |
by (simp_tac (HOL_basic_ss addsimps [distribL,mult_invR]) 1); |
|
115 |
qed "minus_distribL"; |
|
116 |
||
117 |
Goal "(x-y)*z = (x*z - y*z::'a::ring)"; |
|
118 |
by (mk_group1_tac 1); |
|
119 |
by (simp_tac (HOL_basic_ss addsimps [distribR,mult_invL]) 1); |
|
120 |
qed "minus_distribR"; |
|
121 |
||
122 |
val cring_simps = [times_assoc,times_commute,times_commuteL, |
|
123 |
distribL,distribR,minus_distribL,minus_distribR] |
|
124 |
@ agroup2_simps; |
|
125 |
||
126 |
val cring_tac = |
|
127 |
let val ss = HOL_basic_ss addsimps cring_simps |
|
128 |
in simp_tac ss end; |
|
129 |
||
130 |
||
131 |
(*** The order [minus_plusL3,minus_plusL2] is important because minus_plusL3 |
|
132 |
MUST be tried first |
|
133 |
val cring_simp = |
|
134 |
let val phase1 = simpset() addsimps |
|
135 |
[plus_minusL,minus_plusR,minus_minusR,plus_minusR] |
|
136 |
val phase2 = HOL_ss addsimps [minus_plusL3,minus_plusL2, |
|
137 |
zeroL,zeroR,mult_zeroL,mult_zeroR] |
|
138 |
in simp_tac phase1 THEN' simp_tac phase2 end; |
|
139 |
***) |