src/HOL/Vimage.ML
author paulson
Mon, 19 Jul 1999 15:24:35 +0200
changeset 7031 972b5f62f476
parent 5490 85855f65d0c6
child 7516 a1d476251238
permissions -rw-r--r--
getting rid of qed_goal
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Vimage
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
     2
    ID:         $Id$
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
     4
    Copyright   1998  University of Cambridge
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
     5
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
     6
Inverse image of a function
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
     7
*)
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
     8
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
     9
(** Basic rules **)
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    10
7031
972b5f62f476 getting rid of qed_goal
paulson
parents: 5490
diff changeset
    11
Goalw [vimage_def] "(a : f-``B) = (f a : B)";
972b5f62f476 getting rid of qed_goal
paulson
parents: 5490
diff changeset
    12
by (Blast_tac 1) ;
972b5f62f476 getting rid of qed_goal
paulson
parents: 5490
diff changeset
    13
qed "vimage_eq";
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    14
4680
c9d352428201 New theorem and simprules
paulson
parents: 4674
diff changeset
    15
Addsimps [vimage_eq];
c9d352428201 New theorem and simprules
paulson
parents: 4674
diff changeset
    16
7031
972b5f62f476 getting rid of qed_goal
paulson
parents: 5490
diff changeset
    17
Goal "(a : f-``{b}) = (f a = b)";
972b5f62f476 getting rid of qed_goal
paulson
parents: 5490
diff changeset
    18
by (simp_tac (simpset() addsimps [vimage_eq]) 1) ;
972b5f62f476 getting rid of qed_goal
paulson
parents: 5490
diff changeset
    19
qed "vimage_singleton_eq";
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    20
7031
972b5f62f476 getting rid of qed_goal
paulson
parents: 5490
diff changeset
    21
Goalw [vimage_def]
972b5f62f476 getting rid of qed_goal
paulson
parents: 5490
diff changeset
    22
    "!!A B f. [| f a = b;  b:B |] ==> a : f-``B";
972b5f62f476 getting rid of qed_goal
paulson
parents: 5490
diff changeset
    23
by (Blast_tac 1) ;
972b5f62f476 getting rid of qed_goal
paulson
parents: 5490
diff changeset
    24
qed "vimageI";
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    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
972b5f62f476 getting rid of qed_goal
paulson
parents: 5490
diff changeset
    30
val major::prems = Goalw [vimage_def]
972b5f62f476 getting rid of qed_goal
paulson
parents: 5490
diff changeset
    31
    "[| a: f-``B;  !!x.[| f a = x;  x:B |] ==> P |] ==> P";
972b5f62f476 getting rid of qed_goal
paulson
parents: 5490
diff changeset
    32
by (rtac (major RS CollectE) 1);
972b5f62f476 getting rid of qed_goal
paulson
parents: 5490
diff changeset
    33
by (blast_tac (claset() addIs prems) 1) ;
972b5f62f476 getting rid of qed_goal
paulson
parents: 5490
diff changeset
    34
qed "vimageE";
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    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
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    40
AddIs  [vimageI];
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    41
AddSEs [vimageE];
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    42
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    43
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    44
(*** Simple equalities ***)
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    45
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4738
diff changeset
    46
Goal "(%x. x) -`` B = B";
4680
c9d352428201 New theorem and simprules
paulson
parents: 4674
diff changeset
    47
by (Blast_tac 1);
c9d352428201 New theorem and simprules
paulson
parents: 4674
diff changeset
    48
qed "ident_vimage";
c9d352428201 New theorem and simprules
paulson
parents: 4674
diff changeset
    49
Addsimps [ident_vimage];
c9d352428201 New theorem and simprules
paulson
parents: 4674
diff changeset
    50
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4738
diff changeset
    51
Goal "f-``{} = {}";
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    52
by (Blast_tac 1);
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    53
qed "vimage_empty";
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    54
5490
85855f65d0c6 From Compl(A) to -A
paulson
parents: 5143
diff changeset
    55
Goal "f-``(-A) = -(f-``A)";
4660
63f0b2601792 New vimage laws
paulson
parents: 4648
diff changeset
    56
by (Blast_tac 1);
63f0b2601792 New vimage laws
paulson
parents: 4648
diff changeset
    57
qed "vimage_Compl";
63f0b2601792 New vimage laws
paulson
parents: 4648
diff changeset
    58
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4738
diff changeset
    59
Goal "f-``(A Un B) = (f-``A) Un (f-``B)";
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    60
by (Blast_tac 1);
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    61
qed "vimage_Un";
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    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
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4738
diff changeset
    67
Goal "f-``(UN x:A. B x) = (UN x:A. f -`` B x)";
4674
248b876c2fa8 New theorems
paulson
parents: 4660
diff changeset
    68
by (Blast_tac 1);
248b876c2fa8 New theorems
paulson
parents: 4660
diff changeset
    69
qed "vimage_UN";
248b876c2fa8 New theorems
paulson
parents: 4660
diff changeset
    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
63f0b2601792 New vimage laws
paulson
parents: 4648
diff changeset
    76
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    77
(*NOT suitable for rewriting because of the recurrence of {a}*)
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4738
diff changeset
    78
Goal "f-``(insert a B) = (f-``{a}) Un (f-``B)";
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    79
by (Blast_tac 1);
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    80
qed "vimage_insert";
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    81
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4738
diff changeset
    82
Goal "f-``(A-B) = (f-``A) - (f-``B)";
4738
699a91d01d6d New, stronger rewrites
paulson
parents: 4734
diff changeset
    83
by (Blast_tac 1);
699a91d01d6d New, stronger rewrites
paulson
parents: 4734
diff changeset
    84
qed "vimage_Diff";
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    85
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4738
diff changeset
    86
Goal "f-``UNIV = UNIV";
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    87
by (Blast_tac 1);
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    88
qed "vimage_UNIV";
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    89
Addsimps [vimage_UNIV];
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    90
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4738
diff changeset
    91
Goal "(UN x:A. f -`` B x) = f -`` (UN x:A. B x)";
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    92
by (Blast_tac 1);
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    93
qed "UN_vimage";
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    94
Addsimps [UN_vimage];
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    95
4734
6a7c70b053cc new theorem
paulson
parents: 4680
diff changeset
    96
(*NOT suitable for rewriting*)
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4738
diff changeset
    97
Goal "f-``B = (UN y: B. f-``{y})";
4734
6a7c70b053cc new theorem
paulson
parents: 4680
diff changeset
    98
by (Blast_tac 1);
6a7c70b053cc new theorem
paulson
parents: 4680
diff changeset
    99
qed "vimage_eq_UN";
6a7c70b053cc new theorem
paulson
parents: 4680
diff changeset
   100
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
   101
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
   102
(** monotonicity **)
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
   103
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5122
diff changeset
   104
Goal "A<=B ==> f-``A <= f-``B";
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
   105
by (Blast_tac 1);
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
   106
qed "vimage_mono";