Quot/Nominal/Perm.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Wed, 17 Feb 2010 09:26:10 +0100
changeset 1164 fe0a31cf30a0
parent 1161 37d9cc4b8abf
child 1170 a7b4160ef463
permissions -rw-r--r--
Simplifying perm_eq
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1159
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     1
theory Perm
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     2
imports "Nominal2_Atoms" "Nominal2_Eqvt" "Nominal2_Supp" "Abs"
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     3
begin
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     4
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     5
atom_decl name
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     7
datatype rtrm1 =
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     8
  rVr1 "name"
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     9
| rAp1 "rtrm1" "rtrm1 list"
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    10
| rLm1 "name" "rtrm1"
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    11
| rLt1 "bp" "rtrm1" "rtrm1"
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    12
and bp =
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    13
  BUnit
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    14
| BVr "name"
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    15
| BPr "bp" "bp"
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    17
ML {*
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    18
  open Datatype_Aux (* typ_of_dtyp, DtRec, ... *)
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    19
*}
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    20
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    21
instantiation rtrm1 and bp :: pt
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    22
begin
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    23
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    24
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    25
ML {*
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    26
  val {descr, induct, ...} = Datatype.the_info @{theory} "Perm.rtrm1";
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    27
  val new_type_names = ["rtrm1", "bp"];
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    28
  (* TODO: [] should be the sorts that we'll take from the specification *)
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    29
  val sorts = [];
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    30
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    31
  fun nth_dtyp i = typ_of_dtyp descr sorts (DtRec i);
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    32
  val perm_names' = Datatype_Prop.indexify_names (map (fn (i, _) =>
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    33
    "permute_" ^ name_of_typ (nth_dtyp i)) descr);
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    34
  val perm_names = replicate (length new_type_names) @{const_name permute} @
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    35
    map (Sign.full_bname @{theory}) (List.drop (perm_names', length new_type_names));
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    36
  val perm_types = map (fn (i, _) =>
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    37
    let val T = nth_dtyp i
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    38
    in @{typ perm} --> T --> T end) descr;
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    39
  val perm_indnames = Datatype_Prop.make_tnames (map body_type perm_types);
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    40
  (* TODO: Next line only needed after instantiation *)
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    41
  val perm_names_types = perm_names ~~ perm_types;
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    42
  val perm_names_types' = perm_names' ~~ perm_types;
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    43
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    44
  val pi = Free ("pi", @{typ perm});
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    45
  fun permute ty = Const (@{const_name permute}, @{typ perm} --> ty --> ty);
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    46
  val minus_perm = Const (@{const_name minus}, @{typ perm} --> @{typ perm});
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    47
*}
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    48
ML {*
1164
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    49
  fun perm_eq_constr i (cname, dts) =
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    50
    let
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    51
      val Ts = map (typ_of_dtyp descr sorts) dts;
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    52
      val names = Name.variant_list ["pi"] (Datatype_Prop.make_tnames Ts);
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    53
      val args = map Free (names ~~ Ts);
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    54
      val c = Const (cname, Ts ---> (nth_dtyp i));
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    55
      fun perm_arg (dt, x) =
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    56
        let val T = type_of x
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    57
        in
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    58
          if is_rec_type dt then
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    59
            let val (Us, _) = strip_type T
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    60
            in list_abs (map (pair "x") Us,
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    61
              Free (nth perm_names_types' (body_index dt)) $ pi $
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    62
                list_comb (x, map (fn (i, U) =>
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    63
                  (permute U) $ (minus_perm $ pi) $ Bound i)
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    64
                  ((length Us - 1 downto 0) ~~ Us)))
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    65
            end
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    66
          else (permute T) $ pi $ x
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    67
        end;
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    68
    in
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    69
      (Attrib.empty_binding, HOLogic.mk_Trueprop (HOLogic.mk_eq
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    70
        (Free (nth perm_names_types' i) $
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    71
           Free ("pi", @{typ perm}) $ list_comb (c, args),
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    72
         list_comb (c, map perm_arg (dts ~~ args)))))
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    73
    end;
fe0a31cf30a0 Simplifying perm_eq
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1161
diff changeset
    74
  fun perm_eq (i, (_, _, constrs)) = map (perm_eq_constr i) constrs;
1161
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1159
diff changeset
    75
  val perm_eqs = maps perm_eq descr;
1159
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    76
*}
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    77
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    78
local_setup {*
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    79
snd o (Primrec.add_primrec
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    80
  (map (fn s => (Binding.name s, NONE, NoSyn)) perm_names') perm_eqs)
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    81
*}
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    82
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    83
print_theorems
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    84
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    85
ML {*
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    86
   val perm_empty_thms =
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    87
     let
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    88
       val gl =
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    89
         HOLogic.mk_Trueprop (foldr1 HOLogic.mk_conj
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    90
           (map (fn ((s, T), x) => HOLogic.mk_eq
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    91
               (Const (s, @{typ perm} --> T --> T) $
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    92
                  @{term "0 :: perm"} $ Free (x, T),
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    93
                Free (x, T)))
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    94
            (perm_names ~~
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    95
             map body_type perm_types ~~ perm_indnames)));
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    96
       fun tac _ =
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    97
         EVERY [indtac induct perm_indnames 1,
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    98
           ALLGOALS (asm_full_simp_tac @{simpset})];
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    99
     in
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   100
       map Drule.export_without_context (List.take (split_conj_thm
1161
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1159
diff changeset
   101
         (Goal.prove @{context} [] [] gl tac),
1159
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   102
       length new_type_names))
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   103
     end
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   104
*}
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   105
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   106
ML {*
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   107
   val add_perm = @{term "op + :: (perm \<Rightarrow> perm \<Rightarrow> perm)"}
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   108
   val pi1 = Free ("pi1", @{typ perm});
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   109
   val pi2 = Free ("pi2", @{typ perm});
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   110
   val perm_append_thms =
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   111
      List.take (map Drule.export_without_context (split_conj_thm
1161
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1159
diff changeset
   112
        (Goal.prove @{context} [] []
1159
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   113
           (HOLogic.mk_Trueprop (foldr1 HOLogic.mk_conj
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   114
              (map (fn ((s, T), x) =>
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   115
                  let
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   116
                    val perm = Const (s, @{typ perm} --> T --> T);
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   117
                    val lhs = perm $ (add_perm $ pi1 $ pi2) $ Free (x, T)
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   118
                    val rhs = perm $ pi1 $ (perm $ pi2 $ Free (x, T))
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   119
                  in HOLogic.mk_eq (lhs, rhs)
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   120
                  end)
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   121
                (perm_names ~~
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   122
                 map body_type perm_types ~~ perm_indnames))))
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   123
           (fn _ => EVERY [indtac induct perm_indnames 1,
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   124
              ALLGOALS (asm_full_simp_tac @{simpset})]))),
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   125
         length new_type_names)
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   126
*}
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   127
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   128
instance
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   129
apply(tactic {*
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   130
 (Class.intro_classes_tac []) THEN
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   131
 (ALLGOALS (simp_tac (@{simpset} addsimps (perm_empty_thms @ perm_append_thms)))) *})
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   132
done
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   133
end