src/HOL/Fun.ML
changeset 7014 11ee650edcd2
parent 6829 50459a995aa3
child 7051 9b6bdced3dc6
equal deleted inserted replaced
7013:8a7fb425e04a 7014:11ee650edcd2
    59 qed "image_compose";
    59 qed "image_compose";
    60 
    60 
    61 Goalw [o_def] "UNION A (g o f) = UNION (f``A) g";
    61 Goalw [o_def] "UNION A (g o f) = UNION (f``A) g";
    62 by (Blast_tac 1);
    62 by (Blast_tac 1);
    63 qed "UN_o";
    63 qed "UN_o";
       
    64 
       
    65 (** lemma for proving injectivity of representation functions for **)
       
    66 (** datatypes involving function types                            **)
       
    67 
       
    68 Goalw [o_def]
       
    69   "[| !x y. g (f x) = g y --> f x = y; g o f = g o fa |] ==> f = fa";
       
    70 br ext 1;
       
    71 be allE 1;
       
    72 be allE 1;
       
    73 be mp 1;
       
    74 be fun_cong 1;
       
    75 qed "inj_fun_lemma";
    64 
    76 
    65 
    77 
    66 section "inj";
    78 section "inj";
    67 (**NB: inj now just translates to inj_on**)
    79 (**NB: inj now just translates to inj_on**)
    68 
    80 
   104     "[| inj(f); !!y. y: range(f) ==> P(inv f y) |] ==> P(x)";
   116     "[| inj(f); !!y. y: range(f) ==> P(inv f y) |] ==> P(x)";
   105 by (res_inst_tac [("t", "x")] (oneone RS (inv_f_f RS subst)) 1);
   117 by (res_inst_tac [("t", "x")] (oneone RS (inv_f_f RS subst)) 1);
   106 by (rtac (rangeI RS minor) 1);
   118 by (rtac (rangeI RS minor) 1);
   107 qed "inj_transfer";
   119 qed "inj_transfer";
   108 
   120 
       
   121 Goalw [o_def] "[| inj f; f o g = f o h |] ==> g = h";
       
   122 by (rtac ext 1);
       
   123 by (etac injD 1);
       
   124 by (etac fun_cong 1);
       
   125 qed "inj_o";
   109 
   126 
   110 (*** inj_on f A: f is one-to-one over A ***)
   127 (*** inj_on f A: f is one-to-one over A ***)
   111 
   128 
   112 val prems = Goalw [inj_on_def]
   129 val prems = Goalw [inj_on_def]
   113     "(!! x y. [| f(x) = f(y);  x:A;  y:A |] ==> x=y) ==> inj_on f A";
   130     "(!! x y. [| f(x) = f(y);  x:A;  y:A |] ==> x=y) ==> inj_on f A";