src/HOL/Quot/HQUOT.ML
changeset 3842 b55686a7b22c
parent 3457 a8ab7c64817c
child 4477 b3e5857d8d99
equal deleted inserted replaced
3841:22bbc1676768 3842:b55686a7b22c
     5 
     5 
     6 *)
     6 *)
     7 open HQUOT;
     7 open HQUOT;
     8 
     8 
     9 (* first prove some helpful lemmas *)
     9 (* first prove some helpful lemmas *)
    10 goalw thy [quot_def] "{y.y===x}:quot";
    10 goalw thy [quot_def] "{y. y===x}:quot";
    11 by (Asm_simp_tac 1);
    11 by (Asm_simp_tac 1);
    12 by (fast_tac (set_cs addIs [per_sym]) 1);
    12 by (fast_tac (set_cs addIs [per_sym]) 1);
    13 qed "per_class_rep_quot";
    13 qed "per_class_rep_quot";
    14 
    14 
    15 val prems = goal thy "Rep_quot a = Rep_quot b ==> a=b";
    15 val prems = goal thy "Rep_quot a = Rep_quot b ==> a=b";
    18 by (res_inst_tac [("t","a")] (Rep_quot_inverse RS subst) 1);
    18 by (res_inst_tac [("t","a")] (Rep_quot_inverse RS subst) 1);
    19 by (Asm_simp_tac 1);
    19 by (Asm_simp_tac 1);
    20 qed "quot_eq";
    20 qed "quot_eq";
    21 
    21 
    22 (* prepare induction and exhaustiveness *)
    22 (* prepare induction and exhaustiveness *)
    23 val prems = goal thy "!s.s:quot --> P (Abs_quot s) ==> P x";
    23 val prems = goal thy "!s. s:quot --> P (Abs_quot s) ==> P x";
    24 by (cut_facts_tac prems 1);
    24 by (cut_facts_tac prems 1);
    25 by (rtac (Abs_quot_inverse RS subst) 1);
    25 by (rtac (Abs_quot_inverse RS subst) 1);
    26 by (rtac Rep_quot 1);
    26 by (rtac Rep_quot 1);
    27 by (dres_inst_tac [("x","Rep_quot x")] spec 1);
    27 by (dres_inst_tac [("x","Rep_quot x")] spec 1);
    28 by (asm_full_simp_tac (HOL_ss addsimps [Rep_quot,Rep_quot_inverse]) 1);
    28 by (asm_full_simp_tac (HOL_ss addsimps [Rep_quot,Rep_quot_inverse]) 1);
    29 qed "all_q";
    29 qed "all_q";
    30 
    30 
    31 goal thy "? s.s:quot & x=Abs_quot s";
    31 goal thy "? s. s:quot & x=Abs_quot s";
    32 by (res_inst_tac [("x","Rep_quot x")] exI 1);
    32 by (res_inst_tac [("x","Rep_quot x")] exI 1);
    33 by (asm_full_simp_tac (HOL_ss addsimps [Rep_quot,Rep_quot_inverse]) 1);
    33 by (asm_full_simp_tac (HOL_ss addsimps [Rep_quot,Rep_quot_inverse]) 1);
    34 qed "exh_q";
    34 qed "exh_q";
    35 
    35 
    36 (* some lemmas for the equivalence classes *)
    36 (* some lemmas for the equivalence classes *)
   111 by (etac per_class_neqE 1);
   111 by (etac per_class_neqE 1);
   112 by (etac er_class_neqI 1);
   112 by (etac er_class_neqI 1);
   113 qed "er_class_not";
   113 qed "er_class_not";
   114 
   114 
   115 (* exhaustiveness and induction *)
   115 (* exhaustiveness and induction *)
   116 goalw thy [peclass_def] "? s.x=<[s]>";
   116 goalw thy [peclass_def] "? s. x=<[s]>";
   117 by (rtac all_q 1);
   117 by (rtac all_q 1);
   118 by (strip_tac 1);
   118 by (strip_tac 1);
   119 by (asm_full_simp_tac (HOL_ss addsimps [mem_Collect_eq,quot_def]) 1);
   119 by (asm_full_simp_tac (HOL_ss addsimps [mem_Collect_eq,quot_def]) 1);
   120 by (etac exE 1);
   120 by (etac exE 1);
   121 by (res_inst_tac [("x","r")] exI 1);
   121 by (res_inst_tac [("x","r")] exI 1);
   126 by (fast_tac set_cs 1);
   126 by (fast_tac set_cs 1);
   127 by (asm_full_simp_tac (HOL_ss addsimps [mem_Collect_eq,quot_def]) 1);
   127 by (asm_full_simp_tac (HOL_ss addsimps [mem_Collect_eq,quot_def]) 1);
   128 by (fast_tac set_cs 1);
   128 by (fast_tac set_cs 1);
   129 qed "per_class_exh";
   129 qed "per_class_exh";
   130 
   130 
   131 val prems = goal thy "!x.P<[x]> ==> P s";
   131 val prems = goal thy "!x. P<[x]> ==> P s";
   132 by (cut_facts_tac (prems@[
   132 by (cut_facts_tac (prems@[
   133 	read_instantiate[("x","s::'a::per quot")] per_class_exh]) 1);
   133 	read_instantiate[("x","s::'a::per quot")] per_class_exh]) 1);
   134 by (fast_tac set_cs 1);
   134 by (fast_tac set_cs 1);
   135 qed "per_class_all";
   135 qed "per_class_all";
   136 
   136 
   158 fr allI;
   158 fr allI;
   159 fr (er_any_in_class RS per_class_eqI);
   159 fr (er_any_in_class RS per_class_eqI);
   160 qed "er_class_any_in";
   160 qed "er_class_any_in";
   161 
   161 
   162 (* equivalent theorem for per would need !x.x:D *)
   162 (* equivalent theorem for per would need !x.x:D *)
   163 val prems = goal thy "!x::'a::per.x:D==><[any_in (q::'a::per quot)]> = q";
   163 val prems = goal thy "!x::'a::per. x:D==><[any_in (q::'a::per quot)]> = q";
   164 by (cut_facts_tac prems 1);
   164 by (cut_facts_tac prems 1);
   165 fr per_class_all;
   165 fr per_class_all;
   166 fr allI;
   166 fr allI;
   167 fr (per_any_in_class RS per_class_eqI);
   167 fr (per_any_in_class RS per_class_eqI);
   168 fe spec;
   168 fe spec;