author | paulson |
Mon, 19 Jul 1999 15:24:35 +0200 | |
changeset 7031 | 972b5f62f476 |
parent 5490 | 85855f65d0c6 |
child 7516 | a1d476251238 |
permissions | -rw-r--r-- |
4648 | 1 |
(* Title: HOL/Vimage |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1998 University of Cambridge |
|
5 |
||
6 |
Inverse image of a function |
|
7 |
*) |
|
8 |
||
9 |
(** Basic rules **) |
|
10 |
||
7031 | 11 |
Goalw [vimage_def] "(a : f-``B) = (f a : B)"; |
12 |
by (Blast_tac 1) ; |
|
13 |
qed "vimage_eq"; |
|
4648 | 14 |
|
4680 | 15 |
Addsimps [vimage_eq]; |
16 |
||
7031 | 17 |
Goal "(a : f-``{b}) = (f a = b)"; |
18 |
by (simp_tac (simpset() addsimps [vimage_eq]) 1) ; |
|
19 |
qed "vimage_singleton_eq"; |
|
4648 | 20 |
|
7031 | 21 |
Goalw [vimage_def] |
22 |
"!!A B f. [| f a = b; b:B |] ==> a : f-``B"; |
|
23 |
by (Blast_tac 1) ; |
|
24 |
qed "vimageI"; |
|
4648 | 25 |
|
5095
4436c62efceb
Added additional theorems needed for inductive definitions.
berghofe
parents:
5069
diff
changeset
|
26 |
Goalw [vimage_def] "f a : A ==> a : f -`` A"; |
4436c62efceb
Added additional theorems needed for inductive definitions.
berghofe
parents:
5069
diff
changeset
|
27 |
by (Fast_tac 1); |
4436c62efceb
Added additional theorems needed for inductive definitions.
berghofe
parents:
5069
diff
changeset
|
28 |
qed "vimageI2"; |
4436c62efceb
Added additional theorems needed for inductive definitions.
berghofe
parents:
5069
diff
changeset
|
29 |
|
7031 | 30 |
val major::prems = Goalw [vimage_def] |
31 |
"[| a: f-``B; !!x.[| f a = x; x:B |] ==> P |] ==> P"; |
|
32 |
by (rtac (major RS CollectE) 1); |
|
33 |
by (blast_tac (claset() addIs prems) 1) ; |
|
34 |
qed "vimageE"; |
|
4648 | 35 |
|
5095
4436c62efceb
Added additional theorems needed for inductive definitions.
berghofe
parents:
5069
diff
changeset
|
36 |
Goalw [vimage_def] "a : f -`` A ==> f a : A"; |
4436c62efceb
Added additional theorems needed for inductive definitions.
berghofe
parents:
5069
diff
changeset
|
37 |
by (Fast_tac 1); |
4436c62efceb
Added additional theorems needed for inductive definitions.
berghofe
parents:
5069
diff
changeset
|
38 |
qed "vimageD"; |
4436c62efceb
Added additional theorems needed for inductive definitions.
berghofe
parents:
5069
diff
changeset
|
39 |
|
4648 | 40 |
AddIs [vimageI]; |
41 |
AddSEs [vimageE]; |
|
42 |
||
43 |
||
44 |
(*** Simple equalities ***) |
|
45 |
||
5069 | 46 |
Goal "(%x. x) -`` B = B"; |
4680 | 47 |
by (Blast_tac 1); |
48 |
qed "ident_vimage"; |
|
49 |
Addsimps [ident_vimage]; |
|
50 |
||
5069 | 51 |
Goal "f-``{} = {}"; |
4648 | 52 |
by (Blast_tac 1); |
53 |
qed "vimage_empty"; |
|
54 |
||
5490 | 55 |
Goal "f-``(-A) = -(f-``A)"; |
4660 | 56 |
by (Blast_tac 1); |
57 |
qed "vimage_Compl"; |
|
58 |
||
5069 | 59 |
Goal "f-``(A Un B) = (f-``A) Un (f-``B)"; |
4648 | 60 |
by (Blast_tac 1); |
61 |
qed "vimage_Un"; |
|
62 |
||
5095
4436c62efceb
Added additional theorems needed for inductive definitions.
berghofe
parents:
5069
diff
changeset
|
63 |
Goal "f -`` (A Int B) = (f -`` A) Int (f -`` B)"; |
4436c62efceb
Added additional theorems needed for inductive definitions.
berghofe
parents:
5069
diff
changeset
|
64 |
by (Fast_tac 1); |
4436c62efceb
Added additional theorems needed for inductive definitions.
berghofe
parents:
5069
diff
changeset
|
65 |
qed "vimage_Int"; |
4436c62efceb
Added additional theorems needed for inductive definitions.
berghofe
parents:
5069
diff
changeset
|
66 |
|
5069 | 67 |
Goal "f-``(UN x:A. B x) = (UN x:A. f -`` B x)"; |
4674 | 68 |
by (Blast_tac 1); |
69 |
qed "vimage_UN"; |
|
70 |
||
5095
4436c62efceb
Added additional theorems needed for inductive definitions.
berghofe
parents:
5069
diff
changeset
|
71 |
bind_thm ("vimage_Collect", allI RS prove_goalw thy [vimage_def] |
4436c62efceb
Added additional theorems needed for inductive definitions.
berghofe
parents:
5069
diff
changeset
|
72 |
"! x. P (f x) = Q x ==> f -`` (Collect P) = Collect Q" |
4436c62efceb
Added additional theorems needed for inductive definitions.
berghofe
parents:
5069
diff
changeset
|
73 |
(fn prems => [cut_facts_tac prems 1, Fast_tac 1])); |
4436c62efceb
Added additional theorems needed for inductive definitions.
berghofe
parents:
5069
diff
changeset
|
74 |
|
4436c62efceb
Added additional theorems needed for inductive definitions.
berghofe
parents:
5069
diff
changeset
|
75 |
Addsimps [vimage_empty, vimage_Un, vimage_Int]; |
4660 | 76 |
|
4648 | 77 |
(*NOT suitable for rewriting because of the recurrence of {a}*) |
5069 | 78 |
Goal "f-``(insert a B) = (f-``{a}) Un (f-``B)"; |
4648 | 79 |
by (Blast_tac 1); |
80 |
qed "vimage_insert"; |
|
81 |
||
5069 | 82 |
Goal "f-``(A-B) = (f-``A) - (f-``B)"; |
4738 | 83 |
by (Blast_tac 1); |
84 |
qed "vimage_Diff"; |
|
4648 | 85 |
|
5069 | 86 |
Goal "f-``UNIV = UNIV"; |
4648 | 87 |
by (Blast_tac 1); |
88 |
qed "vimage_UNIV"; |
|
89 |
Addsimps [vimage_UNIV]; |
|
90 |
||
5069 | 91 |
Goal "(UN x:A. f -`` B x) = f -`` (UN x:A. B x)"; |
4648 | 92 |
by (Blast_tac 1); |
93 |
qed "UN_vimage"; |
|
94 |
Addsimps [UN_vimage]; |
|
95 |
||
4734 | 96 |
(*NOT suitable for rewriting*) |
5069 | 97 |
Goal "f-``B = (UN y: B. f-``{y})"; |
4734 | 98 |
by (Blast_tac 1); |
99 |
qed "vimage_eq_UN"; |
|
100 |
||
4648 | 101 |
|
102 |
(** monotonicity **) |
|
103 |
||
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5122
diff
changeset
|
104 |
Goal "A<=B ==> f-``A <= f-``B"; |
4648 | 105 |
by (Blast_tac 1); |
106 |
qed "vimage_mono"; |