586 (perm_indnames ~~ descr); |
586 (perm_indnames ~~ descr); |
587 |
587 |
588 fun mk_perm_closed name = map (fn th => Drule.standard (th RS mp)) |
588 fun mk_perm_closed name = map (fn th => Drule.standard (th RS mp)) |
589 (List.take (split_conj_thm (Goal.prove_global thy4 [] [] |
589 (List.take (split_conj_thm (Goal.prove_global thy4 [] [] |
590 (augment_sort thy4 |
590 (augment_sort thy4 |
591 (pt_class_of thy4 name :: map (cp_class_of thy4 name) (dt_atoms \ name)) |
591 (pt_class_of thy4 name :: map (cp_class_of thy4 name) (remove (op =) name dt_atoms)) |
592 (HOLogic.mk_Trueprop (foldr1 HOLogic.mk_conj (map |
592 (HOLogic.mk_Trueprop (foldr1 HOLogic.mk_conj (map |
593 (fn ((s, T), x) => |
593 (fn ((s, T), x) => |
594 let |
594 let |
595 val S = Const (s, T --> HOLogic.boolT); |
595 val S = Const (s, T --> HOLogic.boolT); |
596 val permT = mk_permT (Type (name, [])) |
596 val permT = mk_permT (Type (name, [])) |
652 fold (fn ((((((Abs_inverse, Rep_inverse), Rep), |
652 fold (fn ((((((Abs_inverse, Rep_inverse), Rep), |
653 perm_def), name), tvs), perm_closed) => fn thy => |
653 perm_def), name), tvs), perm_closed) => fn thy => |
654 let |
654 let |
655 val pt_class = pt_class_of thy atom; |
655 val pt_class = pt_class_of thy atom; |
656 val sort = Sign.certify_sort thy |
656 val sort = Sign.certify_sort thy |
657 (pt_class :: map (cp_class_of thy atom) (dt_atoms \ atom)) |
657 (pt_class :: map (cp_class_of thy atom) (remove (op =) atom dt_atoms)) |
658 in AxClass.prove_arity |
658 in AxClass.prove_arity |
659 (Sign.intern_type thy name, |
659 (Sign.intern_type thy name, |
660 map (inter_sort thy sort o snd) tvs, [pt_class]) |
660 map (inter_sort thy sort o snd) tvs, [pt_class]) |
661 (EVERY [Class.intro_classes_tac [], |
661 (EVERY [Class.intro_classes_tac [], |
662 rewrite_goals_tac [perm_def], |
662 rewrite_goals_tac [perm_def], |
676 |
676 |
677 fun cp_instance (atom1, perm_closed_thms1) (atom2, perm_closed_thms2) thy = |
677 fun cp_instance (atom1, perm_closed_thms1) (atom2, perm_closed_thms2) thy = |
678 let |
678 let |
679 val cp_class = cp_class_of thy atom1 atom2; |
679 val cp_class = cp_class_of thy atom1 atom2; |
680 val sort = Sign.certify_sort thy |
680 val sort = Sign.certify_sort thy |
681 (pt_class_of thy atom1 :: map (cp_class_of thy atom1) (dt_atoms \ atom1) @ |
681 (pt_class_of thy atom1 :: map (cp_class_of thy atom1) (remove (op =) atom1 dt_atoms) @ |
682 (if atom1 = atom2 then [cp_class_of thy atom1 atom1] else |
682 (if atom1 = atom2 then [cp_class_of thy atom1 atom1] else |
683 pt_class_of thy atom2 :: map (cp_class_of thy atom2) (dt_atoms \ atom2))); |
683 pt_class_of thy atom2 :: map (cp_class_of thy atom2) (remove (op =) atom2 dt_atoms))); |
684 val cp1' = cp_inst_of thy atom1 atom2 RS cp1 |
684 val cp1' = cp_inst_of thy atom1 atom2 RS cp1 |
685 in fold (fn ((((((Abs_inverse, Rep), |
685 in fold (fn ((((((Abs_inverse, Rep), |
686 perm_def), name), tvs), perm_closed1), perm_closed2) => fn thy => |
686 perm_def), name), tvs), perm_closed1), perm_closed2) => fn thy => |
687 AxClass.prove_arity |
687 AxClass.prove_arity |
688 (Sign.intern_type thy name, |
688 (Sign.intern_type thy name, |
850 val permT = mk_permT (Type (atom, [])); |
850 val permT = mk_permT (Type (atom, [])); |
851 val pi = Free ("pi", permT); |
851 val pi = Free ("pi", permT); |
852 in |
852 in |
853 Goal.prove_global thy8 [] [] |
853 Goal.prove_global thy8 [] [] |
854 (augment_sort thy8 |
854 (augment_sort thy8 |
855 (pt_class_of thy8 atom :: map (cp_class_of thy8 atom) (dt_atoms \ atom)) |
855 (pt_class_of thy8 atom :: map (cp_class_of thy8 atom) (remove (op =) atom dt_atoms)) |
856 (HOLogic.mk_Trueprop (HOLogic.mk_eq |
856 (HOLogic.mk_Trueprop (HOLogic.mk_eq |
857 (Const ("Nominal.perm", permT --> U --> U) $ pi $ (Rep $ x), |
857 (Const ("Nominal.perm", permT --> U --> U) $ pi $ (Rep $ x), |
858 Rep $ (Const ("Nominal.perm", permT --> T --> T) $ pi $ x))))) |
858 Rep $ (Const ("Nominal.perm", permT --> T --> T) $ pi $ x))))) |
859 (fn _ => simp_tac (HOL_basic_ss addsimps (perm_defs @ Abs_inverse_thms @ |
859 (fn _ => simp_tac (HOL_basic_ss addsimps (perm_defs @ Abs_inverse_thms @ |
860 perm_closed_thms @ Rep_thms)) 1) |
860 perm_closed_thms @ Rep_thms)) 1) |
912 val (_, l_args, r_args) = List.foldr constr_arg (1, [], []) dts; |
912 val (_, l_args, r_args) = List.foldr constr_arg (1, [], []) dts; |
913 val c = Const (cname, map fastype_of l_args ---> T) |
913 val c = Const (cname, map fastype_of l_args ---> T) |
914 in |
914 in |
915 Goal.prove_global thy8 [] [] |
915 Goal.prove_global thy8 [] [] |
916 (augment_sort thy8 |
916 (augment_sort thy8 |
917 (pt_class_of thy8 atom :: map (cp_class_of thy8 atom) (dt_atoms \ atom)) |
917 (pt_class_of thy8 atom :: map (cp_class_of thy8 atom) (remove (op =) atom dt_atoms)) |
918 (HOLogic.mk_Trueprop (HOLogic.mk_eq |
918 (HOLogic.mk_Trueprop (HOLogic.mk_eq |
919 (perm (list_comb (c, l_args)), list_comb (c, r_args))))) |
919 (perm (list_comb (c, l_args)), list_comb (c, r_args))))) |
920 (fn _ => EVERY |
920 (fn _ => EVERY |
921 [simp_tac (global_simpset_of thy8 addsimps (constr_rep_thm :: perm_defs)) 1, |
921 [simp_tac (global_simpset_of thy8 addsimps (constr_rep_thm :: perm_defs)) 1, |
922 simp_tac (HOL_basic_ss addsimps (Rep_thms @ Abs_inverse_thms @ |
922 simp_tac (HOL_basic_ss addsimps (Rep_thms @ Abs_inverse_thms @ |
935 val alpha = PureThy.get_thms thy8 "alpha"; |
935 val alpha = PureThy.get_thms thy8 "alpha"; |
936 val abs_fresh = PureThy.get_thms thy8 "abs_fresh"; |
936 val abs_fresh = PureThy.get_thms thy8 "abs_fresh"; |
937 |
937 |
938 val pt_cp_sort = |
938 val pt_cp_sort = |
939 map (pt_class_of thy8) dt_atoms @ |
939 map (pt_class_of thy8) dt_atoms @ |
940 maps (fn s => map (cp_class_of thy8 s) (dt_atoms \ s)) dt_atoms; |
940 maps (fn s => map (cp_class_of thy8 s) (remove (op =) s dt_atoms)) dt_atoms; |
941 |
941 |
942 val inject_thms = map (fn (((i, (_, _, constrs)), tname), constr_rep_thms) => |
942 val inject_thms = map (fn (((i, (_, _, constrs)), tname), constr_rep_thms) => |
943 let val T = nth_dtyp' i |
943 let val T = nth_dtyp' i |
944 in map_filter (fn ((cname, dts), constr_rep_thm) => |
944 in map_filter (fn ((cname, dts), constr_rep_thm) => |
945 if null dts then NONE else SOME |
945 if null dts then NONE else SOME |
1274 [SOME (cterm_of thy a), NONE, SOME (cterm_of thy b)] th |
1274 [SOME (cterm_of thy a), NONE, SOME (cterm_of thy b)] th |
1275 end; |
1275 end; |
1276 |
1276 |
1277 val fs_cp_sort = |
1277 val fs_cp_sort = |
1278 map (fs_class_of thy9) dt_atoms @ |
1278 map (fs_class_of thy9) dt_atoms @ |
1279 maps (fn s => map (cp_class_of thy9 s) (dt_atoms \ s)) dt_atoms; |
1279 maps (fn s => map (cp_class_of thy9 s) (remove (op =) s dt_atoms)) dt_atoms; |
1280 |
1280 |
1281 (********************************************************************** |
1281 (********************************************************************** |
1282 The subgoals occurring in the proof of induct_aux have the |
1282 The subgoals occurring in the proof of induct_aux have the |
1283 following parameters: |
1283 following parameters: |
1284 |
1284 |