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 |
open Vimage;
|
|
10 |
|
|
11 |
(** Basic rules **)
|
|
12 |
|
|
13 |
qed_goalw "vimage_eq" thy [vimage_def]
|
|
14 |
"(a : f-``B) = (f a : B)"
|
|
15 |
(fn _ => [ (Blast_tac 1) ]);
|
|
16 |
|
4680
|
17 |
Addsimps [vimage_eq];
|
|
18 |
|
4648
|
19 |
qed_goal "vimage_singleton_eq" thy
|
|
20 |
"(a : f-``{b}) = (f a = b)"
|
|
21 |
(fn _ => [ simp_tac (simpset() addsimps [vimage_eq]) 1 ]);
|
|
22 |
|
|
23 |
qed_goalw "vimageI" thy [vimage_def]
|
|
24 |
"!!A B f. [| f a = b; b:B |] ==> a : f-``B"
|
|
25 |
(fn _ => [ (Blast_tac 1) ]);
|
|
26 |
|
|
27 |
qed_goalw "vimageE" thy [vimage_def]
|
|
28 |
"[| a: f-``B; !!x.[| f a = x; x:B |] ==> P |] ==> P"
|
|
29 |
(fn major::prems=>
|
|
30 |
[ (rtac (major RS CollectE) 1),
|
|
31 |
(blast_tac (claset() addIs prems) 1) ]);
|
|
32 |
|
|
33 |
AddIs [vimageI];
|
|
34 |
AddSEs [vimageE];
|
|
35 |
|
|
36 |
|
|
37 |
(*** Simple equalities ***)
|
|
38 |
|
4680
|
39 |
goal thy "(%x. x) -`` B = B";
|
|
40 |
by (Blast_tac 1);
|
|
41 |
qed "ident_vimage";
|
|
42 |
Addsimps [ident_vimage];
|
|
43 |
|
4648
|
44 |
goal thy "f-``{} = {}";
|
|
45 |
by (Blast_tac 1);
|
|
46 |
qed "vimage_empty";
|
|
47 |
|
4660
|
48 |
goal thy "f-``(Compl A) = Compl (f-``A)";
|
|
49 |
by (Blast_tac 1);
|
|
50 |
qed "vimage_Compl";
|
|
51 |
|
4648
|
52 |
goal thy "f-``(A Un B) = (f-``A) Un (f-``B)";
|
|
53 |
by (Blast_tac 1);
|
|
54 |
qed "vimage_Un";
|
|
55 |
|
4674
|
56 |
goal thy "f-``(UN x:A. B x) = (UN x:A. f -`` B x)";
|
|
57 |
by (Blast_tac 1);
|
|
58 |
qed "vimage_UN";
|
|
59 |
|
|
60 |
Addsimps [vimage_empty, vimage_Un];
|
4660
|
61 |
|
4648
|
62 |
(*NOT suitable for rewriting because of the recurrence of {a}*)
|
|
63 |
goal thy "f-``(insert a B) = (f-``{a}) Un (f-``B)";
|
|
64 |
by (Blast_tac 1);
|
|
65 |
qed "vimage_insert";
|
|
66 |
|
4738
|
67 |
goal thy "f-``(A Int B) = (f-``A) Int (f-``B)";
|
4648
|
68 |
by (Blast_tac 1);
|
4738
|
69 |
qed "vimage_Int";
|
|
70 |
|
|
71 |
goal thy "f-``(A-B) = (f-``A) - (f-``B)";
|
|
72 |
by (Blast_tac 1);
|
|
73 |
qed "vimage_Diff";
|
4648
|
74 |
|
|
75 |
goal thy "f-``UNIV = UNIV";
|
|
76 |
by (Blast_tac 1);
|
|
77 |
qed "vimage_UNIV";
|
|
78 |
Addsimps [vimage_UNIV];
|
|
79 |
|
|
80 |
goal thy "(UN x:A. f -`` B x) = f -`` (UN x:A. B x)";
|
|
81 |
by (Blast_tac 1);
|
|
82 |
qed "UN_vimage";
|
|
83 |
Addsimps [UN_vimage];
|
|
84 |
|
4734
|
85 |
(*NOT suitable for rewriting*)
|
|
86 |
goal thy "f-``B = (UN y: B. f-``{y})";
|
|
87 |
by (Blast_tac 1);
|
|
88 |
qed "vimage_eq_UN";
|
|
89 |
|
4648
|
90 |
|
|
91 |
(** monotonicity **)
|
|
92 |
|
|
93 |
goal thy "!!f. A<=B ==> f-``A <= f-``B";
|
|
94 |
by (Blast_tac 1);
|
|
95 |
qed "vimage_mono";
|