src/HOL/Fun.ML
changeset 11395 2eeaa1077b73
parent 10832 e33b47e4246d
child 11446 882d6b54cebf
equal deleted inserted replaced
11394:e88c2c89f98e 11395:2eeaa1077b73
   142 qed "inj_o";
   142 qed "inj_o";
   143 
   143 
   144 (*** inj_on f A: f is one-to-one over A ***)
   144 (*** inj_on f A: f is one-to-one over A ***)
   145 
   145 
   146 val prems = Goalw [inj_on_def]
   146 val prems = Goalw [inj_on_def]
   147     "(!! x y. [| f(x) = f(y);  x:A;  y:A |] ==> x=y) ==> inj_on f A";
   147     "(!! x y. [|  x:A;  y:A;  f(x) = f(y) |] ==> x=y) ==> inj_on f A";
   148 by (blast_tac (claset() addIs prems) 1);
   148 by (blast_tac (claset() addIs prems) 1);
   149 qed "inj_onI";
   149 qed "inj_onI";
   150 bind_thm ("injI", inj_onI);                  (*for compatibility*)
   150 bind_thm ("injI", inj_onI);                  (*for compatibility*)
   151 
   151 
   152 val [major] = Goal 
   152 val [major] = Goal 
   575 val prems = Goalw [restrict_def, Pi_def]
   575 val prems = Goalw [restrict_def, Pi_def]
   576      "(!!x. x: A ==> f x: B x) ==> (lam x: A. f x) : Pi A B";
   576      "(!!x. x: A ==> f x: B x) ==> (lam x: A. f x) : Pi A B";
   577 by (asm_simp_tac (simpset() addsimps prems) 1);
   577 by (asm_simp_tac (simpset() addsimps prems) 1);
   578 qed "restrictI";
   578 qed "restrictI";
   579 
   579 
   580 Goal "x: A ==> (lam y: A. f y) x = f x";
   580 Goal "(lam y: A. f y) x = (if x : A then f x else (@ y. True))";
   581 by (asm_simp_tac (simpset() addsimps [restrict_def]) 1);
   581 by (asm_simp_tac (simpset() addsimps [restrict_def]) 1);
   582 qed "restrict_apply1";
   582 qed "restrict_apply";
   583 
   583 Addsimps [restrict_apply];
   584 Goal "[| x: A; f : A funcset B |] ==> (lam y: A. f y) x : B";
       
   585 by (asm_full_simp_tac (simpset() addsimps [restrict_apply1,Pi_def]) 1);
       
   586 qed "restrict_apply1_mem";
       
   587 
       
   588 Goal "x ~: A ==> (lam y: A. f y) x =  (@ y. True)";
       
   589 by (asm_simp_tac (simpset() addsimps [restrict_def]) 1);
       
   590 qed "restrict_apply2";
       
   591 
   584 
   592 val prems = Goal
   585 val prems = Goal
   593     "(!!x. x: A ==> f x = g x) ==> (lam x: A. f x) = (lam x: A. g x)";
   586     "(!!x. x: A ==> f x = g x) ==> (lam x: A. f x) = (lam x: A. g x)";
   594 by (rtac ext 1);
   587 by (rtac ext 1);
   595 by (auto_tac (claset(),
   588 by (auto_tac (claset(),
   610 Goalw [Inv_def] "[| f ` A = B; f : A funcset B |] \
   603 Goalw [Inv_def] "[| f ` A = B; f : A funcset B |] \
   611 \                ==> (lam x: B. (Inv A f) x) : B funcset A";
   604 \                ==> (lam x: B. (Inv A f) x) : B funcset A";
   612 by (fast_tac (claset() addIs [restrict_in_funcset, someI2]) 1);
   605 by (fast_tac (claset() addIs [restrict_in_funcset, someI2]) 1);
   613 qed "Inv_funcset";
   606 qed "Inv_funcset";
   614 
   607 
   615 
   608 Goal "[| inj_on f A;  f: A funcset (f`A);  x : A |] \
   616 Goal "[| f: A funcset B;  inj_on f A;  f ` A = B;  x: A |] \
   609 \     ==> Inv A f (f x) = x";
   617 \     ==> (lam y: B. (Inv A f) y) (f x) = x";
       
   618 by (asm_simp_tac (simpset() addsimps [restrict_apply1, funcset_mem]) 1);
       
   619 by (asm_full_simp_tac (simpset() addsimps [Inv_def, inj_on_def]) 1);
   610 by (asm_full_simp_tac (simpset() addsimps [Inv_def, inj_on_def]) 1);
   620 by (rtac someI2 1);
   611 by (rtac someI2 1);
   621 by Auto_tac;
   612 by Auto_tac;
   622 qed "Inv_f_f";
   613 qed "Inv_f_f";
   623 
   614 
       
   615 (*a strange theorem, but so is f_inv_f*)
   624 Goal "[| f: A funcset B;  f ` A = B;  x: B |] \
   616 Goal "[| f: A funcset B;  f ` A = B;  x: B |] \
   625 \     ==> f ((lam y: B. (Inv A f y)) x) = x";
   617 \     ==> f ((lam y: B. (Inv A f y)) x) = x";
   626 by (asm_simp_tac (simpset() addsimps [Inv_def, restrict_apply1]) 1);
   618 by (asm_simp_tac (simpset() addsimps [Inv_def]) 1);
   627 by (fast_tac (claset() addIs [someI2]) 1);
   619 by (fast_tac (claset() addIs [someI2]) 1);
   628 qed "f_Inv_f";
   620 qed "f_Inv_f";
   629 
   621 
   630 Goal "[| f: A funcset B;  inj_on f A;  f ` A = B |]\
   622 Goal "[| f: A funcset B;  inj_on f A;  f ` A = B |]\
   631 \     ==> compose A (lam y:B. (Inv A f) y) f = (lam x: A. x)";
   623 \     ==> compose A (lam y:B. (Inv A f) y) f = (lam x: A. x)";
   632 by (rtac Pi_extensionality 1);
   624 by (rtac Pi_extensionality 1);
   633 by (blast_tac (claset() addIs [funcset_compose, Inv_funcset]) 1);
   625 by (blast_tac (claset() addIs [funcset_compose, Inv_funcset]) 1);
   634 by (blast_tac (claset() addIs [restrict_in_funcset]) 1);
   626 by (blast_tac (claset() addIs [restrict_in_funcset]) 1);
   635 by (asm_simp_tac
   627 by (asm_simp_tac
   636     (simpset() addsimps [restrict_apply1, compose_def, Inv_f_f]) 1);
   628     (simpset() addsimps [compose_def, Inv_f_f]) 1);
       
   629 by Auto_tac;
   637 qed "compose_Inv_id";
   630 qed "compose_Inv_id";
   638 
   631 
   639 
   632 
   640 (*** Pi ***)
   633 (*** Pi ***)
   641 
   634