src/HOL/Inverse_Image.ML
author wenzelm
Sat, 27 Oct 2001 00:00:05 +0200
changeset 11954 3d1780208bf3
parent 10832 e33b47e4246d
permissions -rw-r--r--
made new-style theory; tuned;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
     1
(*  Title:      HOL/Inverse_Image.ML
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
     2
    ID:         $Id$
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
     4
    Copyright   1998  University of Cambridge
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
     5
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
     6
Inverse image of a function
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
     7
*)
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
     8
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
     9
(** Basic rules **)
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    10
10832
e33b47e4246d `` -> and ``` -> ``
nipkow
parents: 10213
diff changeset
    11
Goalw [vimage_def] "(a : f-`B) = (f a : B)";
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    12
by (Blast_tac 1) ;
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    13
qed "vimage_eq";
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    14
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    15
Addsimps [vimage_eq];
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    16
10832
e33b47e4246d `` -> and ``` -> ``
nipkow
parents: 10213
diff changeset
    17
Goal "(a : f-`{b}) = (f a = b)";
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    18
by (simp_tac (simpset() addsimps [vimage_eq]) 1) ;
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    19
qed "vimage_singleton_eq";
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    20
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    21
Goalw [vimage_def]
10832
e33b47e4246d `` -> and ``` -> ``
nipkow
parents: 10213
diff changeset
    22
    "!!A B f. [| f a = b;  b:B |] ==> a : f-`B";
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    23
by (Blast_tac 1) ;
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    24
qed "vimageI";
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    25
10832
e33b47e4246d `` -> and ``` -> ``
nipkow
parents: 10213
diff changeset
    26
Goalw [vimage_def] "f a : A ==> a : f -` A";
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    27
by (Fast_tac 1);
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    28
qed "vimageI2";
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    29
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    30
val major::prems = Goalw [vimage_def]
10832
e33b47e4246d `` -> and ``` -> ``
nipkow
parents: 10213
diff changeset
    31
    "[| a: f-`B;  !!x.[| f a = x;  x:B |] ==> P |] ==> P";
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    32
by (rtac (major RS CollectE) 1);
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    33
by (blast_tac (claset() addIs prems) 1) ;
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    34
qed "vimageE";
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    35
10832
e33b47e4246d `` -> and ``` -> ``
nipkow
parents: 10213
diff changeset
    36
Goalw [vimage_def] "a : f -` A ==> f a : A";
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    37
by (Fast_tac 1);
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    38
qed "vimageD";
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    39
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    40
AddIs  [vimageI];
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    41
AddSEs [vimageE];
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    42
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    43
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    44
(*** Equations ***)
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    45
10832
e33b47e4246d `` -> and ``` -> ``
nipkow
parents: 10213
diff changeset
    46
Goal "f-`{} = {}";
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    47
by (Blast_tac 1);
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    48
qed "vimage_empty";
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    49
10832
e33b47e4246d `` -> and ``` -> ``
nipkow
parents: 10213
diff changeset
    50
Goal "f-`(-A) = -(f-`A)";
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    51
by (Blast_tac 1);
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    52
qed "vimage_Compl";
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    53
10832
e33b47e4246d `` -> and ``` -> ``
nipkow
parents: 10213
diff changeset
    54
Goal "f-`(A Un B) = (f-`A) Un (f-`B)";
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    55
by (Blast_tac 1);
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    56
qed "vimage_Un";
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    57
10832
e33b47e4246d `` -> and ``` -> ``
nipkow
parents: 10213
diff changeset
    58
Goal "f -` (A Int B) = (f -` A) Int (f -` B)";
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    59
by (Fast_tac 1);
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    60
qed "vimage_Int";
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    61
10832
e33b47e4246d `` -> and ``` -> ``
nipkow
parents: 10213
diff changeset
    62
Goal "f -` (Union A) = (UN X:A. f -` X)";
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    63
by (Blast_tac 1);
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    64
qed "vimage_Union";
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    65
10832
e33b47e4246d `` -> and ``` -> ``
nipkow
parents: 10213
diff changeset
    66
Goal "f-`(UN x:A. B x) = (UN x:A. f -` B x)";
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    67
by (Blast_tac 1);
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    68
qed "vimage_UN";
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    69
10832
e33b47e4246d `` -> and ``` -> ``
nipkow
parents: 10213
diff changeset
    70
Goal "f-`(INT x:A. B x) = (INT x:A. f -` B x)";
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    71
by (Blast_tac 1);
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    72
qed "vimage_INT";
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    73
10832
e33b47e4246d `` -> and ``` -> ``
nipkow
parents: 10213
diff changeset
    74
Goal "f -` Collect P = {y. P (f y)}";
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    75
by (Blast_tac 1);
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    76
qed "vimage_Collect_eq";
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    77
Addsimps [vimage_Collect_eq];
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    78
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    79
(*A strange result used in Tools/inductive_package*)
10832
e33b47e4246d `` -> and ``` -> ``
nipkow
parents: 10213
diff changeset
    80
val prems = Goal "(!!x. P (f x) = Q x) ==> f -` (Collect P) = Collect Q";
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    81
by (force_tac (claset(), simpset() addsimps prems) 1);
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    82
qed "vimage_Collect";
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    83
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    84
Addsimps [vimage_empty, vimage_Un, vimage_Int];
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    85
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    86
(*NOT suitable for rewriting because of the recurrence of {a}*)
10832
e33b47e4246d `` -> and ``` -> ``
nipkow
parents: 10213
diff changeset
    87
Goal "f-`(insert a B) = (f-`{a}) Un (f-`B)";
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    88
by (Blast_tac 1);
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    89
qed "vimage_insert";
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    90
10832
e33b47e4246d `` -> and ``` -> ``
nipkow
parents: 10213
diff changeset
    91
Goal "f-`(A-B) = (f-`A) - (f-`B)";
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    92
by (Blast_tac 1);
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    93
qed "vimage_Diff";
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    94
10832
e33b47e4246d `` -> and ``` -> ``
nipkow
parents: 10213
diff changeset
    95
Goal "f-`UNIV = UNIV";
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    96
by (Blast_tac 1);
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    97
qed "vimage_UNIV";
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    98
Addsimps [vimage_UNIV];
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
    99
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
   100
(*NOT suitable for rewriting*)
10832
e33b47e4246d `` -> and ``` -> ``
nipkow
parents: 10213
diff changeset
   101
Goal "f-`B = (UN y: B. f-`{y})";
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
   102
by (Blast_tac 1);
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
   103
qed "vimage_eq_UN";
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
   104
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
   105
(*monotonicity*)
10832
e33b47e4246d `` -> and ``` -> ``
nipkow
parents: 10213
diff changeset
   106
Goal "A<=B ==> f-`A <= f-`B";
10213
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
   107
by (Blast_tac 1);
01c2744a3786 *** empty log message ***
nipkow
parents:
diff changeset
   108
qed "vimage_mono";