5250

1 
(* Title: HOL/ex/PiSets.thy


2 
ID: $Id$


3 
Author: Florian Kammueller, University of Cambridge


4 


5 
Pi sets and their application.


6 
*)


7 

5845

8 
(*** Bijection between Pi in terms of => and Pi in terms of Sigma ***)


9 
Goal "f: Pi A B ==> PiBij A B f <= Sigma A B";


10 
by (auto_tac (claset(),


11 
simpset() addsimps [PiBij_def,Pi_def,restrict_apply1]));


12 
qed "PiBij_subset_Sigma";

5250

13 

5845

14 
Goal "f: Pi A B ==> (! x: A. (?! y. (x, y): (PiBij A B f)))";


15 
by (auto_tac (claset(),


16 
simpset() addsimps [PiBij_def,restrict_apply1]));


17 
qed "PiBij_unique";

5250

18 

5845

19 
Goal "f: Pi A B ==> PiBij A B f : Graph A B";


20 
by (asm_simp_tac (simpset() addsimps [Graph_def,PiBij_unique,


21 
PiBij_subset_Sigma]) 1);


22 
qed "PiBij_in_Graph";

5250

23 

5845

24 
Goalw [PiBij_def, Graph_def] "PiBij A B: Pi A B > Graph A B";

5318

25 
by (rtac restrictI 1);

5845

26 
by (auto_tac (claset(), simpset() addsimps [Pi_def]));


27 
qed "PiBij_func";

5250

28 

5845

29 
Goal "inj_on (PiBij A B) (Pi A B)";

5318

30 
by (rtac inj_onI 1);


31 
by (rtac Pi_extensionality 1);


32 
by (assume_tac 1);


33 
by (assume_tac 1);

5845

34 
by (rotate_tac 1 1);


35 
by (asm_full_simp_tac (simpset() addsimps [PiBij_def,restrict_apply1]) 1);


36 
by (blast_tac (claset() addEs [equalityE]) 1);


37 
qed "inj_PiBij";

5250

38 

5845

39 

5250

40 

5845

41 
Goal "PiBij A B `` (Pi A B) = Graph A B";

5318

42 
by (rtac equalityI 1);

5521

43 
by (force_tac (claset(), simpset() addsimps [image_def,PiBij_in_Graph]) 1);

5318

44 
by (rtac subsetI 1);

5845

45 
by (asm_full_simp_tac (simpset() addsimps [image_def]) 1);

5250

46 
by (res_inst_tac [("x","lam a: A. @ y. (a, y): x")] bexI 1);

5845

47 
by (rtac restrictI 2);


48 
by (res_inst_tac [("P", "%xa. (a, xa) : x")] ex1E 2);


49 
by (force_tac (claset(), simpset() addsimps [Graph_def]) 2);


50 
by (full_simp_tac (simpset() addsimps [Graph_def]) 2);


51 
by (stac select_equality 2);

5521

52 
by (assume_tac 2);


53 
by (Blast_tac 2);


54 
by (Blast_tac 2);

5250

55 
(* x = PiBij A B (lam a:A. @ y. (a, y) : x) *)

5845

56 
by (full_simp_tac (simpset() addsimps [PiBij_def,Graph_def]) 1);


57 
by (stac restrict_apply1 1);


58 
by (rtac restrictI 1);


59 
by (blast_tac (claset() addSDs [[select_eq_Ex, ex1_implies_ex] MRS iffD2]) 1);


60 
(** LEVEL 17 **)

5318

61 
by (rtac equalityI 1);


62 
by (rtac subsetI 1);

5845

63 
by (split_all_tac 1);


64 
by (subgoal_tac "a: A" 1);


65 
by (Blast_tac 2);


66 
by (asm_full_simp_tac (simpset() addsimps [restrict_apply1]) 1);


67 
(*Blast_tac: PROOF FAILED for depth 5*)


68 
by (fast_tac (claset() addSIs [select1_equality RS sym]) 1);

5250

69 
(* {(xa,y). xa : A & y = (lam a:A. @ y. (a, y) : x) xa} <= x *)

5845

70 
by (Clarify_tac 1);


71 
by (asm_full_simp_tac (simpset() addsimps [restrict_apply1]) 1);


72 
by (fast_tac (claset() addIs [selectI2]) 1);


73 
qed "surj_PiBij";

5250

74 

5845

75 
Goal "f: Pi A B ==> \


76 
\ (lam y: Graph A B. (Inv (Pi A B)(PiBij A B)) y)(PiBij A B f) = f";


77 
by (asm_simp_tac


78 
(simpset() addsimps [Inv_f_f, PiBij_func, inj_PiBij, surj_PiBij]) 1);


79 
qed "PiBij_bij1";

5250

80 

5845

81 
Goal "[ f: Graph A B ] ==> \

5250

82 
\ (PiBij A B) ((lam y: (Graph A B). (Inv (Pi A B)(PiBij A B)) y) f) = f";

5845

83 
by (rtac (PiBij_func RS f_Inv_f) 1);


84 
by (asm_full_simp_tac (simpset() addsimps [surj_PiBij]) 1);

5318

85 
by (assume_tac 1);

5845

86 
qed "PiBij_bij2";

5250

87 

5845

88 
Goal "Pi {} B = {f. !x. f x = (@ y. True)}";


89 
by (asm_full_simp_tac (simpset() addsimps [Pi_def]) 1);


90 
qed "empty_Pi";

5250

91 

5845

92 
Goal "(% x. (@ y. True)) : Pi {} B";


93 
by (simp_tac (simpset() addsimps [empty_Pi]) 1);


94 
qed "empty_Pi_func";

5250

95 

5845

96 
val [major] = Goalw [Pi_def] "(!!x. x: A ==> B x <= C x) ==> Pi A B <= Pi A C";


97 
by (auto_tac (claset(),


98 
simpset() addsimps [impOfSubs major]));


99 
qed "Pi_mono";
