src/HOL/Vimage.ML
author oheimb
Mon, 27 Apr 1998 19:29:19 +0200
changeset 4836 fc5773ae2790
parent 4738 699a91d01d6d
child 5069 3ea049f7979d
permissions -rw-r--r--
added option_map_eq_Some via AddIffs
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
open Vimage;
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    10
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    11
(** Basic rules **)
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    12
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    13
qed_goalw "vimage_eq" thy [vimage_def]
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    14
    "(a : f-``B) = (f a : B)"
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    15
 (fn _ => [ (Blast_tac 1) ]);
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    16
4680
c9d352428201 New theorem and simprules
paulson
parents: 4674
diff changeset
    17
Addsimps [vimage_eq];
c9d352428201 New theorem and simprules
paulson
parents: 4674
diff changeset
    18
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    19
qed_goal "vimage_singleton_eq" thy
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    20
    "(a : f-``{b}) = (f a = b)"
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    21
 (fn _ => [ simp_tac (simpset() addsimps [vimage_eq]) 1 ]);
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    22
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    23
qed_goalw "vimageI" thy [vimage_def]
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    24
    "!!A B f. [| f a = b;  b:B |] ==> a : f-``B"
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    25
 (fn _ => [ (Blast_tac 1) ]);
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    26
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    27
qed_goalw "vimageE" thy [vimage_def]
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    28
    "[| a: f-``B;  !!x.[| f a = x;  x:B |] ==> P |] ==> P"
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    29
 (fn major::prems=>
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    30
  [ (rtac (major RS CollectE) 1),
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    31
    (blast_tac (claset() addIs prems) 1) ]);
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    32
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    33
AddIs  [vimageI];
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    34
AddSEs [vimageE];
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    35
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    36
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    37
(*** Simple equalities ***)
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    38
4680
c9d352428201 New theorem and simprules
paulson
parents: 4674
diff changeset
    39
goal thy "(%x. x) -`` B = B";
c9d352428201 New theorem and simprules
paulson
parents: 4674
diff changeset
    40
by (Blast_tac 1);
c9d352428201 New theorem and simprules
paulson
parents: 4674
diff changeset
    41
qed "ident_vimage";
c9d352428201 New theorem and simprules
paulson
parents: 4674
diff changeset
    42
Addsimps [ident_vimage];
c9d352428201 New theorem and simprules
paulson
parents: 4674
diff changeset
    43
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    44
goal thy "f-``{} = {}";
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    45
by (Blast_tac 1);
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    46
qed "vimage_empty";
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    47
4660
63f0b2601792 New vimage laws
paulson
parents: 4648
diff changeset
    48
goal thy "f-``(Compl A) = Compl (f-``A)";
63f0b2601792 New vimage laws
paulson
parents: 4648
diff changeset
    49
by (Blast_tac 1);
63f0b2601792 New vimage laws
paulson
parents: 4648
diff changeset
    50
qed "vimage_Compl";
63f0b2601792 New vimage laws
paulson
parents: 4648
diff changeset
    51
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    52
goal thy "f-``(A Un B) = (f-``A) Un (f-``B)";
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    53
by (Blast_tac 1);
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    54
qed "vimage_Un";
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    55
4674
248b876c2fa8 New theorems
paulson
parents: 4660
diff changeset
    56
goal thy "f-``(UN x:A. B x) = (UN x:A. f -`` B x)";
248b876c2fa8 New theorems
paulson
parents: 4660
diff changeset
    57
by (Blast_tac 1);
248b876c2fa8 New theorems
paulson
parents: 4660
diff changeset
    58
qed "vimage_UN";
248b876c2fa8 New theorems
paulson
parents: 4660
diff changeset
    59
248b876c2fa8 New theorems
paulson
parents: 4660
diff changeset
    60
Addsimps [vimage_empty, vimage_Un];
4660
63f0b2601792 New vimage laws
paulson
parents: 4648
diff changeset
    61
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    62
(*NOT suitable for rewriting because of the recurrence of {a}*)
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    63
goal thy "f-``(insert a B) = (f-``{a}) Un (f-``B)";
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    64
by (Blast_tac 1);
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    65
qed "vimage_insert";
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    66
4738
699a91d01d6d New, stronger rewrites
paulson
parents: 4734
diff changeset
    67
goal thy "f-``(A Int B) = (f-``A) Int (f-``B)";
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    68
by (Blast_tac 1);
4738
699a91d01d6d New, stronger rewrites
paulson
parents: 4734
diff changeset
    69
qed "vimage_Int";
699a91d01d6d New, stronger rewrites
paulson
parents: 4734
diff changeset
    70
699a91d01d6d New, stronger rewrites
paulson
parents: 4734
diff changeset
    71
goal thy "f-``(A-B) = (f-``A) - (f-``B)";
699a91d01d6d New, stronger rewrites
paulson
parents: 4734
diff changeset
    72
by (Blast_tac 1);
699a91d01d6d New, stronger rewrites
paulson
parents: 4734
diff changeset
    73
qed "vimage_Diff";
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    74
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    75
goal thy "f-``UNIV = UNIV";
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    76
by (Blast_tac 1);
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    77
qed "vimage_UNIV";
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    78
Addsimps [vimage_UNIV];
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    79
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    80
goal thy "(UN x:A. f -`` B x) = f -`` (UN x:A. B x)";
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    81
by (Blast_tac 1);
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    82
qed "UN_vimage";
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    83
Addsimps [UN_vimage];
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    84
4734
6a7c70b053cc new theorem
paulson
parents: 4680
diff changeset
    85
(*NOT suitable for rewriting*)
6a7c70b053cc new theorem
paulson
parents: 4680
diff changeset
    86
goal thy "f-``B = (UN y: B. f-``{y})";
6a7c70b053cc new theorem
paulson
parents: 4680
diff changeset
    87
by (Blast_tac 1);
6a7c70b053cc new theorem
paulson
parents: 4680
diff changeset
    88
qed "vimage_eq_UN";
6a7c70b053cc new theorem
paulson
parents: 4680
diff changeset
    89
4648
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    90
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    91
(** monotonicity **)
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    92
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    93
goal thy "!!f. A<=B ==> f-``A <= f-``B";
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    94
by (Blast_tac 1);
f04da668581c New theory of the inverse image of a function
paulson
parents:
diff changeset
    95
qed "vimage_mono";