Proved choice and bchoice; changed Fun.thy -> thy
authorpaulson
Thu Feb 26 11:07:37 1998 +0100 (1998-02-26)
changeset 4656134d24ddaad3
parent 4655 481628ea8edd
child 4657 941c9b169dc4
Proved choice and bchoice; changed Fun.thy -> thy
src/HOL/Fun.ML
     1.1 --- a/src/HOL/Fun.ML	Thu Feb 26 10:48:19 1998 +0100
     1.2 +++ b/src/HOL/Fun.ML	Thu Feb 26 11:07:37 1998 +0100
     1.3 @@ -6,59 +6,71 @@
     1.4  Lemmas about functions.
     1.5  *)
     1.6  
     1.7 -goal Fun.thy "(f = g) = (!x. f(x)=g(x))";
     1.8 +
     1.9 +goal thy "(f = g) = (!x. f(x)=g(x))";
    1.10  by (rtac iffI 1);
    1.11  by (Asm_simp_tac 1);
    1.12  by (rtac ext 1 THEN Asm_simp_tac 1);
    1.13  qed "expand_fun_eq";
    1.14  
    1.15 -val prems = goal Fun.thy
    1.16 +val prems = goal thy
    1.17      "[| f(x)=u;  !!x. P(x) ==> g(f(x)) = x;  P(x) |] ==> x=g(u)";
    1.18  by (rtac (arg_cong RS box_equals) 1);
    1.19  by (REPEAT (resolve_tac (prems@[refl]) 1));
    1.20  qed "apply_inverse";
    1.21  
    1.22  
    1.23 +(** "Axiom" of Choice, proved using the description operator **)
    1.24 +
    1.25 +goal HOL.thy "!!Q. ALL x. EX y. Q x y ==> EX f. ALL x. Q x (f x)";
    1.26 +by (fast_tac (claset() addEs [selectI]) 1);
    1.27 +qed "choice";
    1.28 +
    1.29 +goal Set.thy "!!S. ALL x:S. EX y. Q x y ==> EX f. ALL x:S. Q x (f x)";
    1.30 +by (fast_tac (claset() addEs [selectI]) 1);
    1.31 +qed "bchoice";
    1.32 +
    1.33 +
    1.34  (*** inj(f): f is a one-to-one function ***)
    1.35  
    1.36 -val prems = goalw Fun.thy [inj_def]
    1.37 +val prems = goalw thy [inj_def]
    1.38      "[| !! x y. f(x) = f(y) ==> x=y |] ==> inj(f)";
    1.39  by (blast_tac (claset() addIs prems) 1);
    1.40  qed "injI";
    1.41  
    1.42 -val [major] = goal Fun.thy "(!!x. g(f(x)) = x) ==> inj(f)";
    1.43 +val [major] = goal thy "(!!x. g(f(x)) = x) ==> inj(f)";
    1.44  by (rtac injI 1);
    1.45  by (etac (arg_cong RS box_equals) 1);
    1.46  by (rtac major 1);
    1.47  by (rtac major 1);
    1.48  qed "inj_inverseI";
    1.49  
    1.50 -val [major,minor] = goalw Fun.thy [inj_def]
    1.51 +val [major,minor] = goalw thy [inj_def]
    1.52      "[| inj(f); f(x) = f(y) |] ==> x=y";
    1.53  by (rtac (major RS spec RS spec RS mp) 1);
    1.54  by (rtac minor 1);
    1.55  qed "injD";
    1.56  
    1.57  (*Useful with the simplifier*)
    1.58 -val [major] = goal Fun.thy "inj(f) ==> (f(x) = f(y)) = (x=y)";
    1.59 +val [major] = goal thy "inj(f) ==> (f(x) = f(y)) = (x=y)";
    1.60  by (rtac iffI 1);
    1.61  by (etac (major RS injD) 1);
    1.62  by (etac arg_cong 1);
    1.63  qed "inj_eq";
    1.64  
    1.65 -val [major] = goal Fun.thy "inj(f) ==> (@x. f(x)=f(y)) = y";
    1.66 +val [major] = goal thy "inj(f) ==> (@x. f(x)=f(y)) = y";
    1.67  by (rtac (major RS injD) 1);
    1.68  by (rtac selectI 1);
    1.69  by (rtac refl 1);
    1.70  qed "inj_select";
    1.71  
    1.72  (*A one-to-one function has an inverse (given using select).*)
    1.73 -val [major] = goalw Fun.thy [inv_def] "inj(f) ==> inv f (f x) = x";
    1.74 +val [major] = goalw thy [inv_def] "inj(f) ==> inv f (f x) = x";
    1.75  by (EVERY1 [rtac (major RS inj_select)]);
    1.76  qed "inv_f_f";
    1.77  
    1.78  (* Useful??? *)
    1.79 -val [oneone,minor] = goal Fun.thy
    1.80 +val [oneone,minor] = goal thy
    1.81      "[| inj(f); !!y. y: range(f) ==> P(inv f y) |] ==> P(x)";
    1.82  by (res_inst_tac [("t", "x")] (oneone RS (inv_f_f RS subst)) 1);
    1.83  by (rtac (rangeI RS minor) 1);
    1.84 @@ -67,36 +79,36 @@
    1.85  
    1.86  (*** inj_onto f A: f is one-to-one over A ***)
    1.87  
    1.88 -val prems = goalw Fun.thy [inj_onto_def]
    1.89 +val prems = goalw thy [inj_onto_def]
    1.90      "(!! x y. [| f(x) = f(y);  x:A;  y:A |] ==> x=y) ==> inj_onto f A";
    1.91  by (blast_tac (claset() addIs prems) 1);
    1.92  qed "inj_ontoI";
    1.93  
    1.94 -val [major] = goal Fun.thy 
    1.95 +val [major] = goal thy 
    1.96      "(!!x. x:A ==> g(f(x)) = x) ==> inj_onto f A";
    1.97  by (rtac inj_ontoI 1);
    1.98  by (etac (apply_inverse RS trans) 1);
    1.99  by (REPEAT (eresolve_tac [asm_rl,major] 1));
   1.100  qed "inj_onto_inverseI";
   1.101  
   1.102 -val major::prems = goalw Fun.thy [inj_onto_def]
   1.103 +val major::prems = goalw thy [inj_onto_def]
   1.104      "[| inj_onto f A;  f(x)=f(y);  x:A;  y:A |] ==> x=y";
   1.105  by (rtac (major RS bspec RS bspec RS mp) 1);
   1.106  by (REPEAT (resolve_tac prems 1));
   1.107  qed "inj_ontoD";
   1.108  
   1.109 -goal Fun.thy "!!x y.[| inj_onto f A;  x:A;  y:A |] ==> (f(x)=f(y)) = (x=y)";
   1.110 +goal thy "!!x y.[| inj_onto f A;  x:A;  y:A |] ==> (f(x)=f(y)) = (x=y)";
   1.111  by (blast_tac (claset() addSDs [inj_ontoD]) 1);
   1.112  qed "inj_onto_iff";
   1.113  
   1.114 -val major::prems = goal Fun.thy
   1.115 +val major::prems = goal thy
   1.116      "[| inj_onto f A;  ~x=y;  x:A;  y:A |] ==> ~ f(x)=f(y)";
   1.117  by (rtac contrapos 1);
   1.118  by (etac (major RS inj_ontoD) 2);
   1.119  by (REPEAT (resolve_tac prems 1));
   1.120  qed "inj_onto_contraD";
   1.121  
   1.122 -goalw Fun.thy [inj_onto_def]
   1.123 +goalw thy [inj_onto_def]
   1.124      "!!A B. [| A<=B; inj_onto f B |] ==> inj_onto f A";
   1.125  by (Blast_tac 1);
   1.126  qed "subset_inj_onto";
   1.127 @@ -104,26 +116,26 @@
   1.128  
   1.129  (*** Lemmas about inj ***)
   1.130  
   1.131 -goalw Fun.thy [o_def]
   1.132 +goalw thy [o_def]
   1.133      "!!f g. [| inj(f);  inj_onto g (range f) |] ==> inj(g o f)";
   1.134  by (fast_tac (claset() addIs [injI] addEs [injD, inj_ontoD]) 1);
   1.135  qed "comp_inj";
   1.136  
   1.137 -val [prem] = goal Fun.thy "inj(f) ==> inj_onto f A";
   1.138 +val [prem] = goal thy "inj(f) ==> inj_onto f A";
   1.139  by (blast_tac (claset() addIs [prem RS injD, inj_ontoI]) 1);
   1.140  qed "inj_imp";
   1.141  
   1.142 -val [prem] = goalw Fun.thy [inv_def] "y : range(f) ==> f(inv f y) = y";
   1.143 +val [prem] = goalw thy [inv_def] "y : range(f) ==> f(inv f y) = y";
   1.144  by (EVERY1 [rtac (prem RS rangeE), rtac selectI, etac sym]);
   1.145  qed "f_inv_f";
   1.146  
   1.147 -val prems = goal Fun.thy
   1.148 +val prems = goal thy
   1.149      "[| inv f x=inv f y; x: range(f);  y: range(f) |] ==> x=y";
   1.150  by (rtac (arg_cong RS box_equals) 1);
   1.151  by (REPEAT (resolve_tac (prems @ [f_inv_f]) 1));
   1.152  qed "inv_injective";
   1.153  
   1.154 -goal Fun.thy "!!f. [| inj(f);  A<=range(f) |] ==> inj_onto (inv f) A";
   1.155 +goal thy "!!f. [| inj(f);  A<=range(f) |] ==> inj_onto (inv f) A";
   1.156  by (fast_tac (claset() addIs [inj_ontoI] 
   1.157                        addEs [inv_injective,injD]) 1);
   1.158  qed "inj_onto_inv";