95 (*A one-to-one function has an inverse (given using select).*) |
95 (*A one-to-one function has an inverse (given using select).*) |
96 Goalw [inv_def] "inj(f) ==> inv f (f x) = x"; |
96 Goalw [inv_def] "inj(f) ==> inv f (f x) = x"; |
97 by (etac inj_select 1); |
97 by (etac inj_select 1); |
98 qed "inv_f_f"; |
98 qed "inv_f_f"; |
99 |
99 |
|
100 Addsimps [inv_f_f]; |
|
101 |
100 (* Useful??? *) |
102 (* Useful??? *) |
101 val [oneone,minor] = Goal |
103 val [oneone,minor] = Goal |
102 "[| inj(f); !!y. y: range(f) ==> P(inv f y) |] ==> P(x)"; |
104 "[| inj(f); !!y. y: range(f) ==> P(inv f y) |] ==> P(x)"; |
103 by (res_inst_tac [("t", "x")] (oneone RS (inv_f_f RS subst)) 1); |
105 by (res_inst_tac [("t", "x")] (oneone RS (inv_f_f RS subst)) 1); |
104 by (rtac (rangeI RS minor) 1); |
106 by (rtac (rangeI RS minor) 1); |
136 Goalw [inj_on_def] "[| A<=B; inj_on f B |] ==> inj_on f A"; |
138 Goalw [inj_on_def] "[| A<=B; inj_on f B |] ==> inj_on f A"; |
137 by (Blast_tac 1); |
139 by (Blast_tac 1); |
138 qed "subset_inj_on"; |
140 qed "subset_inj_on"; |
139 |
141 |
140 |
142 |
|
143 (** surj **) |
|
144 |
|
145 val [major] = Goalw [surj_def] "(!! x. g(f x) = x) ==> surj g"; |
|
146 by (blast_tac (claset() addIs [major RS sym]) 1); |
|
147 qed "surjI"; |
|
148 |
|
149 Goalw [surj_def] "surj f ==> range f = UNIV"; |
|
150 by Auto_tac; |
|
151 qed "surj_range"; |
|
152 |
|
153 |
141 (*** Lemmas about injective functions and inv ***) |
154 (*** Lemmas about injective functions and inv ***) |
142 |
155 |
143 Goalw [o_def] "[| inj_on f A; inj_on g (range f) |] ==> inj_on (g o f) A"; |
156 Goalw [o_def] "[| inj_on f A; inj_on g (range f) |] ==> inj_on (g o f) A"; |
144 by (fast_tac (claset() addIs [inj_onI] addEs [inj_onD]) 1); |
157 by (fast_tac (claset() addIs [inj_onI] addEs [inj_onD]) 1); |
145 qed "comp_inj_on"; |
158 qed "comp_inj_on"; |
146 |
159 |
147 Goalw [inv_def] "y : range(f) ==> f(inv f y) = y"; |
160 Goalw [inv_def] "y : range(f) ==> f(inv f y) = y"; |
148 by (fast_tac (claset() addIs [selectI]) 1); |
161 by (fast_tac (claset() addIs [selectI]) 1); |
149 qed "f_inv_f"; |
162 qed "f_inv_f"; |
|
163 |
|
164 Goal "surj f ==> f(inv f y) = y"; |
|
165 by (asm_simp_tac (simpset() addsimps [f_inv_f, surj_range]) 1); |
|
166 qed "surj_f_inv_f"; |
150 |
167 |
151 Goal "[| inv f x = inv f y; x: range(f); y: range(f) |] ==> x=y"; |
168 Goal "[| inv f x = inv f y; x: range(f); y: range(f) |] ==> x=y"; |
152 by (rtac (arg_cong RS box_equals) 1); |
169 by (rtac (arg_cong RS box_equals) 1); |
153 by (REPEAT (ares_tac [f_inv_f] 1)); |
170 by (REPEAT (ares_tac [f_inv_f] 1)); |
154 qed "inv_injective"; |
171 qed "inv_injective"; |
155 |
172 |
156 Goal "[| inj(f); A<=range(f) |] ==> inj_on (inv f) A"; |
173 Goal "A <= range(f) ==> inj_on (inv f) A"; |
157 by (fast_tac (claset() addIs [inj_onI] |
174 by (fast_tac (claset() addIs [inj_onI] |
158 addEs [inv_injective,injD]) 1); |
175 addEs [inv_injective, injD]) 1); |
159 qed "inj_on_inv"; |
176 qed "inj_on_inv"; |
|
177 |
|
178 Goal "surj f ==> inj (inv f)"; |
|
179 by (asm_simp_tac (simpset() addsimps [inj_on_inv, surj_range]) 1); |
|
180 qed "surj_imp_inj_inv"; |
160 |
181 |
161 Goalw [inj_on_def] |
182 Goalw [inj_on_def] |
162 "[| inj_on f C; A<=C; B<=C |] ==> f``(A Int B) = f``A Int f``B"; |
183 "[| inj_on f C; A<=C; B<=C |] ==> f``(A Int B) = f``A Int f``B"; |
163 by (Blast_tac 1); |
184 by (Blast_tac 1); |
164 qed "inj_on_image_Int"; |
185 qed "inj_on_image_Int"; |
174 |
195 |
175 Goalw [inj_on_def] "inj f ==> f``(A-B) = f``A - f``B"; |
196 Goalw [inj_on_def] "inj f ==> f``(A-B) = f``A - f``B"; |
176 by (Blast_tac 1); |
197 by (Blast_tac 1); |
177 qed "image_set_diff"; |
198 qed "image_set_diff"; |
178 |
199 |
179 |
200 Goalw [image_def] "inj(f) ==> inv(f)``(f``X) = X"; |
180 val [major] = Goalw [surj_def] "(!! x. g(f x) = x) ==> surj g"; |
201 by Auto_tac; |
181 by (blast_tac (claset() addIs [major RS sym]) 1); |
202 qed "inv_image_comp"; |
182 qed "surjI"; |
|
183 |
|
184 |
203 |
185 val set_cs = claset() delrules [equalityI]; |
204 val set_cs = claset() delrules [equalityI]; |
186 |
205 |
187 |
206 |
188 section "fun_upd"; |
207 section "fun_upd"; |