src/HOL/Hilbert_Choice_lemmas.ML
author wenzelm
Sat, 27 Oct 2001 00:00:05 +0200
changeset 11954 3d1780208bf3
parent 11460 e5fb885bfe3a
child 12372 cd3a09c7dac9
permissions -rw-r--r--
made new-style theory; tuned;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11453
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Hilbert_Choice_lemmas
11454
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
     2
    ID: $Id$
11453
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
     4
    Copyright   2001  University of Cambridge
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
     5
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
     6
Lemmas for Hilbert's epsilon-operator and the Axiom of Choice
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
     7
*)
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
     8
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
     9
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    10
(* ML bindings *)
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    11
val someI = thm "someI";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    12
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    13
section "SOME: Hilbert's Epsilon-operator";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    14
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    15
(*Easier to apply than someI if witness ?a comes from an EX-formula*)
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    16
Goal "EX x. P x ==> P (SOME x. P x)";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    17
by (etac exE 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    18
by (etac someI 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    19
qed "someI_ex";
11460
e5fb885bfe3a tidying and moving the theorem "choice"
paulson
parents: 11454
diff changeset
    20
AddXEs [someI_ex];
11453
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    21
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    22
(*Easier to apply than someI: conclusion has only one occurrence of P*)
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    23
val prems = Goal "[| P a;  !!x. P x ==> Q x |] ==> Q (SOME x. P x)";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    24
by (resolve_tac prems 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    25
by (rtac someI 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    26
by (resolve_tac prems 1) ;
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    27
qed "someI2";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    28
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    29
(*Easier to apply than someI2 if witness ?a comes from an EX-formula*)
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    30
val [major,minor] = Goal "[| EX a. P a; !!x. P x ==> Q x |] ==> Q (SOME x. P x)";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    31
by (rtac (major RS exE) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    32
by (etac someI2 1 THEN etac minor 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    33
qed "someI2_ex";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    34
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    35
val prems = Goal "[| P a;  !!x. P x ==> x=a |] ==> (SOME x. P x) = a";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    36
by (rtac someI2 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    37
by (REPEAT (ares_tac prems 1)) ;
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    38
qed "some_equality";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    39
AddIs [some_equality];
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    40
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    41
Goal "[| EX!x. P x; P a |] ==> (SOME x. P x) = a";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    42
by (rtac some_equality 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    43
by  (atac 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    44
by (etac ex1E 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    45
by (etac all_dupE 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    46
by (dtac mp 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    47
by  (atac 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    48
by (etac ssubst 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    49
by (etac allE 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    50
by (etac mp 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    51
by (atac 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    52
qed "some1_equality";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    53
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    54
Goal "P (SOME x. P x) =  (EX x. P x)";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    55
by (rtac iffI 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    56
by (etac exI 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    57
by (etac exE 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    58
by (etac someI 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    59
qed "some_eq_ex";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    60
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    61
Goal "(SOME y. y=x) = x";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    62
by (rtac some_equality 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    63
by (rtac refl 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    64
by (atac 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    65
qed "some_eq_trivial";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    66
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    67
Goal "(SOME y. x=y) = x";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    68
by (rtac some_equality 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    69
by (rtac refl 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    70
by (etac sym 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    71
qed "some_sym_eq_trivial";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    72
Addsimps [some_eq_trivial, some_sym_eq_trivial];
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    73
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    74
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    75
(** "Axiom" of Choice, proved using the description operator **)
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    76
11460
e5fb885bfe3a tidying and moving the theorem "choice"
paulson
parents: 11454
diff changeset
    77
(*Used in Tools/meson.ML*)
e5fb885bfe3a tidying and moving the theorem "choice"
paulson
parents: 11454
diff changeset
    78
Goal "ALL x. EX y. Q x y ==> EX f. ALL x. Q x (f x)";
e5fb885bfe3a tidying and moving the theorem "choice"
paulson
parents: 11454
diff changeset
    79
by (fast_tac (claset() addEs [someI]) 1);
e5fb885bfe3a tidying and moving the theorem "choice"
paulson
parents: 11454
diff changeset
    80
qed "choice";
11453
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    81
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    82
Goal "ALL x:S. EX y. Q x y ==> EX f. ALL x:S. Q x (f x)";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    83
by (fast_tac (claset() addEs [someI]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    84
qed "bchoice";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    85
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    86
11460
e5fb885bfe3a tidying and moving the theorem "choice"
paulson
parents: 11454
diff changeset
    87
section "Function Inverse";
11453
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    88
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    89
val inv_def = thm "inv_def";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    90
val Inv_def = thm "Inv_def";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    91
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    92
Goal "inv id = id";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    93
by (simp_tac (simpset() addsimps [inv_def,id_def]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    94
qed "inv_id";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    95
Addsimps [inv_id];
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    96
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    97
(*A one-to-one function has an inverse.*)
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    98
Goalw [inv_def] "inj(f) ==> inv f (f x) = x";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
    99
by (asm_simp_tac (simpset() addsimps [inj_eq]) 1); 
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   100
qed "inv_f_f";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   101
Addsimps [inv_f_f];
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   102
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   103
Goal "[| inj(f);  f x = y |] ==> inv f y = x";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   104
by (etac subst 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   105
by (etac inv_f_f 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   106
qed "inv_f_eq";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   107
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   108
Goal "[| inj f; ALL x. f(g x) = x |] ==> inv f = g";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   109
by (blast_tac (claset() addIs [ext, inv_f_eq]) 1); 
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   110
qed "inj_imp_inv_eq";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   111
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   112
(* Useful??? *)
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   113
val [oneone,minor] = Goal
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   114
    "[| inj(f); !!y. y: range(f) ==> P(inv f y) |] ==> P(x)";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   115
by (res_inst_tac [("t", "x")] (oneone RS (inv_f_f RS subst)) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   116
by (rtac (rangeI RS minor) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   117
qed "inj_transfer";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   118
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   119
Goal "(inj f) = (inv f o f = id)";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   120
by (asm_simp_tac (simpset() addsimps [o_def, expand_fun_eq]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   121
by (blast_tac (claset() addIs [inj_inverseI, inv_f_f]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   122
qed "inj_iff";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   123
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   124
Goal "inj f ==> surj (inv f)";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   125
by (blast_tac (claset() addIs [surjI, inv_f_f]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   126
qed "inj_imp_surj_inv";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   127
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   128
Goalw [inv_def] "y : range(f) ==> f(inv f y) = y";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   129
by (fast_tac (claset() addIs [someI]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   130
qed "f_inv_f";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   131
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   132
Goal "surj f ==> f(inv f y) = y";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   133
by (asm_simp_tac (simpset() addsimps [f_inv_f, surj_range]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   134
qed "surj_f_inv_f";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   135
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   136
Goal "[| inv f x = inv f y;  x: range(f);  y: range(f) |] ==> x=y";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   137
by (rtac (arg_cong RS box_equals) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   138
by (REPEAT (ares_tac [f_inv_f] 1));
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   139
qed "inv_injective";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   140
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   141
Goal "A <= range(f) ==> inj_on (inv f) A";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   142
by (fast_tac (claset() addIs [inj_onI] 
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   143
                       addEs [inv_injective, injD]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   144
qed "inj_on_inv";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   145
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   146
Goal "surj f ==> inj (inv f)";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   147
by (asm_simp_tac (simpset() addsimps [inj_on_inv, surj_range]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   148
qed "surj_imp_inj_inv";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   149
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   150
Goal "(surj f) = (f o inv f = id)";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   151
by (asm_simp_tac (simpset() addsimps [o_def, expand_fun_eq]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   152
by (blast_tac (claset() addIs [surjI, surj_f_inv_f]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   153
qed "surj_iff";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   154
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   155
Goal "[| surj f; ALL x. g(f x) = x |] ==> inv f = g";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   156
by (rtac ext 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   157
by (dres_inst_tac [("x","inv f x")] spec 1); 
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   158
by (asm_full_simp_tac (simpset() addsimps [surj_f_inv_f]) 1); 
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   159
qed "surj_imp_inv_eq";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   160
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   161
Goalw [bij_def] "bij f ==> bij (inv f)";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   162
by (asm_simp_tac (simpset() addsimps [inj_imp_surj_inv, surj_imp_inj_inv]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   163
qed "bij_imp_bij_inv";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   164
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   165
val prems = 
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   166
Goalw [inv_def] "[| !! x. g (f x) = x;  !! y. f (g y) = y |] ==> inv f = g";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   167
by (rtac ext 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   168
by (auto_tac (claset(), simpset() addsimps prems));
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   169
qed "inv_equality";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   170
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   171
Goalw [bij_def] "bij f ==> inv (inv f) = f";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   172
by (rtac inv_equality 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   173
by (auto_tac (claset(), simpset() addsimps [surj_f_inv_f]));
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   174
qed "inv_inv_eq";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   175
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   176
(** bij(inv f) implies little about f.  Consider f::bool=>bool such that
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   177
    f(True)=f(False)=True.  Then it's consistent with axiom someI that
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   178
    inv(f) could be any function at all, including the identity function.
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   179
    If inv(f)=id then inv(f) is a bijection, but inj(f), surj(f) and
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   180
    inv(inv(f))=f all fail.
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   181
**)
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   182
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   183
Goalw [bij_def] "[| bij f; bij g |] ==> inv (f o g) = inv g o inv f";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   184
by (rtac (inv_equality) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   185
by (auto_tac (claset(), simpset() addsimps [surj_f_inv_f]));
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   186
qed "o_inv_distrib";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   187
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   188
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   189
Goal "surj f ==> f ` (inv f ` A) = A";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   190
by (asm_simp_tac (simpset() addsimps [image_eq_UN, surj_f_inv_f]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   191
qed "image_surj_f_inv_f";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   192
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   193
Goal "inj f ==> (inv f) ` (f ` A) = A";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   194
by (asm_simp_tac (simpset() addsimps [image_eq_UN]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   195
qed "image_inv_f_f";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   196
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   197
Goalw [image_def] "inj(f) ==> inv(f)`(f`X) = X";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   198
by Auto_tac;
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   199
qed "inv_image_comp";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   200
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   201
Goal "bij f ==> f ` Collect P = {y. P (inv f y)}";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   202
by Auto_tac;
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   203
by (force_tac (claset(), simpset() addsimps [bij_is_inj]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   204
by (blast_tac (claset() addIs [bij_is_surj RS surj_f_inv_f RS sym]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   205
qed "bij_image_Collect_eq";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   206
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   207
Goal "bij f ==> f -` A = inv f ` A";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   208
by Safe_tac;
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   209
by (asm_simp_tac (simpset() addsimps [bij_is_surj RS surj_f_inv_f]) 2);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   210
by (blast_tac (claset() addIs [bij_is_inj RS inv_f_f RS sym]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   211
qed "bij_vimage_eq_inv_image";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   212
11460
e5fb885bfe3a tidying and moving the theorem "choice"
paulson
parents: 11454
diff changeset
   213
e5fb885bfe3a tidying and moving the theorem "choice"
paulson
parents: 11454
diff changeset
   214
section "Inverse of a PI-function (restricted domain)";
11453
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   215
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   216
Goalw [Inv_def] "f ` A = B ==> (lam x: B. (Inv A f) x) : B funcset A";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   217
by (fast_tac (claset() addIs [restrict_in_funcset, someI2]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   218
qed "Inv_funcset";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   219
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   220
Goal "[| inj_on f A;  x : A |] ==> Inv A f (f x) = x";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   221
by (asm_full_simp_tac (simpset() addsimps [Inv_def, inj_on_def]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   222
by (blast_tac (claset() addIs [someI2]) 1); 
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   223
qed "Inv_f_f";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   224
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   225
Goal "y : f`A  ==> f (Inv A f y) = y";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   226
by (asm_simp_tac (simpset() addsimps [Inv_def]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   227
by (fast_tac (claset() addIs [someI2]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   228
qed "f_Inv_f";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   229
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   230
Goal "[| Inv A f x = Inv A f y;  x : f`A;  y : f`A |] ==> x=y";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   231
by (rtac (arg_cong RS box_equals) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   232
by (REPEAT (ares_tac [f_Inv_f] 1));
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   233
qed "Inv_injective";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   234
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   235
Goal "B <= f`A ==> inj_on (Inv A f) B";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   236
by (rtac inj_onI 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   237
by (blast_tac (claset() addIs [inj_onI] addDs [Inv_injective, injD]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   238
qed "inj_on_Inv";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   239
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   240
Goal "[| inj_on f A;  f ` A = B |] \
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   241
\     ==> compose A (lam y:B. (Inv A f) y) f = (lam x: A. x)";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   242
by (asm_simp_tac (simpset() addsimps [compose_def]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   243
by (rtac restrict_ext 1); 
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   244
by Auto_tac; 
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   245
by (etac subst 1); 
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   246
by (asm_full_simp_tac (simpset() addsimps [Inv_f_f]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   247
qed "compose_Inv_id";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   248
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   249
11460
e5fb885bfe3a tidying and moving the theorem "choice"
paulson
parents: 11454
diff changeset
   250
e5fb885bfe3a tidying and moving the theorem "choice"
paulson
parents: 11454
diff changeset
   251
section "split and SOME";
11453
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   252
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   253
(*Can't be added to simpset: loops!*)
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   254
Goal "(SOME x. P x) = (SOME (a,b). P(a,b))";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   255
by (simp_tac (simpset() addsimps [split_Pair_apply]) 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   256
qed "split_paired_Eps";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   257
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   258
Goalw [split_def] "Eps (split P) = (SOME xy. P (fst xy) (snd xy))";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   259
by (rtac refl 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   260
qed "Eps_split";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   261
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   262
Goal "(@(x',y'). x = x' & y = y') = (x,y)";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   263
by (Blast_tac 1);
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   264
qed "Eps_split_eq";
1b15f655da2c partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
diff changeset
   265
Addsimps [Eps_split_eq];
11454
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   266
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   267
11460
e5fb885bfe3a tidying and moving the theorem "choice"
paulson
parents: 11454
diff changeset
   268
section "A relation is wellfounded iff it has no infinite descending chain";
11454
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   269
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   270
Goalw [wf_eq_minimal RS eq_reflection]
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   271
  "wf r = (~(EX f. ALL i. (f(Suc i),f i) : r))";
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   272
by (rtac iffI 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   273
 by (rtac notI 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   274
 by (etac exE 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   275
 by (eres_inst_tac [("x","{w. EX i. w=f i}")] allE 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   276
 by (Blast_tac 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   277
by (etac contrapos_np 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   278
by (Asm_full_simp_tac 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   279
by (Clarify_tac 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   280
by (subgoal_tac "ALL n. nat_rec x (%i y. @z. z:Q & (z,y):r) n : Q" 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   281
 by (res_inst_tac[("x","nat_rec x (%i y. @z. z:Q & (z,y):r)")]exI 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   282
 by (rtac allI 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   283
 by (Simp_tac 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   284
 by (rtac someI2_ex 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   285
  by (Blast_tac 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   286
 by (Blast_tac 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   287
by (rtac allI 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   288
by (induct_tac "n" 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   289
 by (Asm_simp_tac 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   290
by (Simp_tac 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   291
by (rtac someI2_ex 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   292
 by (Blast_tac 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   293
by (Blast_tac 1);
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   294
qed "wf_iff_no_infinite_down_chain";
7514e5e21cb8 Hilbert restructuring: Wellfounded_Relations no longer needs Hilbert_Choice
paulson
parents: 11453
diff changeset
   295