Nominal/Perm.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Wed, 21 Apr 2010 10:13:17 +0200
changeset 1914 c50601bc617e
parent 1903 950fd9b8f05e
child 1910 57891245370d
permissions -rw-r--r--
Remove the part already in FSet and leave the experiments
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
1774
c34347ec7ab3 separated general nominal theory into separate folder
Christian Urban <urbanc@in.tum.de>
parents: 1683
diff changeset
     2
imports "../Nominal-General/Nominal2_Atoms"
1159
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
1903
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
     5
1683
f78c820f67c3 Automatically lift theorems and constants only using the new quotient types. Requires new Isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1503
diff changeset
     6
f78c820f67c3 Automatically lift theorems and constants only using the new quotient types. Requires new Isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1503
diff changeset
     7
ML {*
1902
c68a154adca4 renamed "_empty" and "_append" to "_zero" and "_plus"
Christian Urban <urbanc@in.tum.de>
parents: 1901
diff changeset
     8
fun prove_perm_zero lthy induct perm_def perm_frees =
1247
a728e199851d Factor-out 'prove_perm_empty'; I plan to use it in defining permutations on the lifted type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1189
diff changeset
     9
let
1248
705afaaf6fb4 More refactoring and removed references to the global simpset in Perm.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1247
diff changeset
    10
  val perm_types = map fastype_of perm_frees;
705afaaf6fb4 More refactoring and removed references to the global simpset in Perm.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1247
diff changeset
    11
  val perm_indnames = Datatype_Prop.make_tnames (map body_type perm_types);
1256
6c938f84880c Restructuring the code in Perm
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1253
diff changeset
    12
  fun glc ((perm, T), x) =
1896
996d4411e95e tuned; fleshed out some library functions about permutations; closed Datatype_Aux structure (increases readability)
Christian Urban <urbanc@in.tum.de>
parents: 1871
diff changeset
    13
    HOLogic.mk_eq (perm $ @{term "0::perm"} $ Free (x, T), Free (x, T))
1247
a728e199851d Factor-out 'prove_perm_empty'; I plan to use it in defining permutations on the lifted type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1189
diff changeset
    14
  val gl =
a728e199851d Factor-out 'prove_perm_empty'; I plan to use it in defining permutations on the lifted type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1189
diff changeset
    15
    HOLogic.mk_Trueprop (foldr1 HOLogic.mk_conj
1256
6c938f84880c Restructuring the code in Perm
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1253
diff changeset
    16
      (map glc (perm_frees ~~ map body_type perm_types ~~ perm_indnames)));
1247
a728e199851d Factor-out 'prove_perm_empty'; I plan to use it in defining permutations on the lifted type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1189
diff changeset
    17
  fun tac _ =
a728e199851d Factor-out 'prove_perm_empty'; I plan to use it in defining permutations on the lifted type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1189
diff changeset
    18
    EVERY [
1896
996d4411e95e tuned; fleshed out some library functions about permutations; closed Datatype_Aux structure (increases readability)
Christian Urban <urbanc@in.tum.de>
parents: 1871
diff changeset
    19
      Datatype_Aux.indtac induct perm_indnames 1,
1247
a728e199851d Factor-out 'prove_perm_empty'; I plan to use it in defining permutations on the lifted type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1189
diff changeset
    20
      ALLGOALS (asm_full_simp_tac (HOL_ss addsimps (@{thm permute_zero} :: perm_def)))
a728e199851d Factor-out 'prove_perm_empty'; I plan to use it in defining permutations on the lifted type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1189
diff changeset
    21
    ];
a728e199851d Factor-out 'prove_perm_empty'; I plan to use it in defining permutations on the lifted type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1189
diff changeset
    22
in
1896
996d4411e95e tuned; fleshed out some library functions about permutations; closed Datatype_Aux structure (increases readability)
Christian Urban <urbanc@in.tum.de>
parents: 1871
diff changeset
    23
  Datatype_Aux.split_conj_thm (Goal.prove lthy perm_indnames [] gl tac)
1247
a728e199851d Factor-out 'prove_perm_empty'; I plan to use it in defining permutations on the lifted type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1189
diff changeset
    24
end;
a728e199851d Factor-out 'prove_perm_empty'; I plan to use it in defining permutations on the lifted type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1189
diff changeset
    25
*}
a728e199851d Factor-out 'prove_perm_empty'; I plan to use it in defining permutations on the lifted type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1189
diff changeset
    26
1248
705afaaf6fb4 More refactoring and removed references to the global simpset in Perm.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1247
diff changeset
    27
ML {*
1902
c68a154adca4 renamed "_empty" and "_append" to "_zero" and "_plus"
Christian Urban <urbanc@in.tum.de>
parents: 1901
diff changeset
    28
fun prove_perm_plus lthy induct perm_def perm_frees =
1248
705afaaf6fb4 More refactoring and removed references to the global simpset in Perm.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1247
diff changeset
    29
let
705afaaf6fb4 More refactoring and removed references to the global simpset in Perm.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1247
diff changeset
    30
  val pi1 = Free ("pi1", @{typ perm});
705afaaf6fb4 More refactoring and removed references to the global simpset in Perm.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1247
diff changeset
    31
  val pi2 = Free ("pi2", @{typ perm});
705afaaf6fb4 More refactoring and removed references to the global simpset in Perm.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1247
diff changeset
    32
  val perm_types = map fastype_of perm_frees
705afaaf6fb4 More refactoring and removed references to the global simpset in Perm.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1247
diff changeset
    33
  val perm_indnames = Datatype_Prop.make_tnames (map body_type perm_types);
1256
6c938f84880c Restructuring the code in Perm
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1253
diff changeset
    34
  fun glc ((perm, T), x) =
6c938f84880c Restructuring the code in Perm
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1253
diff changeset
    35
    HOLogic.mk_eq (
1896
996d4411e95e tuned; fleshed out some library functions about permutations; closed Datatype_Aux structure (increases readability)
Christian Urban <urbanc@in.tum.de>
parents: 1871
diff changeset
    36
      perm $ (mk_plus pi1 pi2) $ Free (x, T),
1256
6c938f84880c Restructuring the code in Perm
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1253
diff changeset
    37
      perm $ pi1 $ (perm $ pi2 $ Free (x, T)))
1896
996d4411e95e tuned; fleshed out some library functions about permutations; closed Datatype_Aux structure (increases readability)
Christian Urban <urbanc@in.tum.de>
parents: 1871
diff changeset
    38
  val goal =
1248
705afaaf6fb4 More refactoring and removed references to the global simpset in Perm.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1247
diff changeset
    39
    (HOLogic.mk_Trueprop (foldr1 HOLogic.mk_conj
1256
6c938f84880c Restructuring the code in Perm
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1253
diff changeset
    40
      (map glc (perm_frees ~~ map body_type perm_types ~~ perm_indnames))))
1248
705afaaf6fb4 More refactoring and removed references to the global simpset in Perm.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1247
diff changeset
    41
  fun tac _ =
705afaaf6fb4 More refactoring and removed references to the global simpset in Perm.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1247
diff changeset
    42
    EVERY [
1896
996d4411e95e tuned; fleshed out some library functions about permutations; closed Datatype_Aux structure (increases readability)
Christian Urban <urbanc@in.tum.de>
parents: 1871
diff changeset
    43
      Datatype_Aux.indtac induct perm_indnames 1,
1248
705afaaf6fb4 More refactoring and removed references to the global simpset in Perm.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1247
diff changeset
    44
      ALLGOALS (asm_full_simp_tac (HOL_ss addsimps (@{thm permute_plus} :: perm_def)))
705afaaf6fb4 More refactoring and removed references to the global simpset in Perm.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1247
diff changeset
    45
    ]
705afaaf6fb4 More refactoring and removed references to the global simpset in Perm.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1247
diff changeset
    46
in
1896
996d4411e95e tuned; fleshed out some library functions about permutations; closed Datatype_Aux structure (increases readability)
Christian Urban <urbanc@in.tum.de>
parents: 1871
diff changeset
    47
  Datatype_Aux.split_conj_thm (Goal.prove lthy ("pi1" :: "pi2" :: perm_indnames) [] goal tac)
1248
705afaaf6fb4 More refactoring and removed references to the global simpset in Perm.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1247
diff changeset
    48
end;
705afaaf6fb4 More refactoring and removed references to the global simpset in Perm.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1247
diff changeset
    49
*}
1247
a728e199851d Factor-out 'prove_perm_empty'; I plan to use it in defining permutations on the lifted type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1189
diff changeset
    50
1899
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    51
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    52
(* definitions of the permute function for a raw nominal datatype *)
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    53
1247
a728e199851d Factor-out 'prove_perm_empty'; I plan to use it in defining permutations on the lifted type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1189
diff changeset
    54
ML {*
1899
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    55
fun nth_dtyp dt_descr sorts i = 
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    56
  Datatype_Aux.typ_of_dtyp dt_descr sorts (Datatype_Aux.DtRec i);
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    57
*}
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    58
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    59
ML {*
1900
57db4ff0893b added comment about abstraction in raw permuations
Christian Urban <urbanc@in.tum.de>
parents: 1899
diff changeset
    60
(* permutation function for one argument 
57db4ff0893b added comment about abstraction in raw permuations
Christian Urban <urbanc@in.tum.de>
parents: 1899
diff changeset
    61
   
1901
93dfd5a10e92 removed dead code (nominal cannot deal with argument types of constructors that are functions)
Christian Urban <urbanc@in.tum.de>
parents: 1900
diff changeset
    62
    - in case the argument is recursive it returns 
93dfd5a10e92 removed dead code (nominal cannot deal with argument types of constructors that are functions)
Christian Urban <urbanc@in.tum.de>
parents: 1900
diff changeset
    63
93dfd5a10e92 removed dead code (nominal cannot deal with argument types of constructors that are functions)
Christian Urban <urbanc@in.tum.de>
parents: 1900
diff changeset
    64
         permute_fn p arg
93dfd5a10e92 removed dead code (nominal cannot deal with argument types of constructors that are functions)
Christian Urban <urbanc@in.tum.de>
parents: 1900
diff changeset
    65
93dfd5a10e92 removed dead code (nominal cannot deal with argument types of constructors that are functions)
Christian Urban <urbanc@in.tum.de>
parents: 1900
diff changeset
    66
    - in case the argument is non-recursive it will build
1900
57db4ff0893b added comment about abstraction in raw permuations
Christian Urban <urbanc@in.tum.de>
parents: 1899
diff changeset
    67
57db4ff0893b added comment about abstraction in raw permuations
Christian Urban <urbanc@in.tum.de>
parents: 1899
diff changeset
    68
         p o arg
57db4ff0893b added comment about abstraction in raw permuations
Christian Urban <urbanc@in.tum.de>
parents: 1899
diff changeset
    69
57db4ff0893b added comment about abstraction in raw permuations
Christian Urban <urbanc@in.tum.de>
parents: 1899
diff changeset
    70
*)
1899
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    71
fun perm_arg permute_fns pi (arg_dty, arg) =
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    72
  if Datatype_Aux.is_rec_type arg_dty 
1901
93dfd5a10e92 removed dead code (nominal cannot deal with argument types of constructors that are functions)
Christian Urban <urbanc@in.tum.de>
parents: 1900
diff changeset
    73
  then Free (nth permute_fns (Datatype_Aux.body_index arg_dty)) $ pi $ arg
1900
57db4ff0893b added comment about abstraction in raw permuations
Christian Urban <urbanc@in.tum.de>
parents: 1899
diff changeset
    74
  else mk_perm pi arg
1899
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    75
*}
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    76
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    77
ML {*
1902
c68a154adca4 renamed "_empty" and "_append" to "_zero" and "_plus"
Christian Urban <urbanc@in.tum.de>
parents: 1901
diff changeset
    78
(* equation for permutation function for one constructor;
c68a154adca4 renamed "_empty" and "_append" to "_zero" and "_plus"
Christian Urban <urbanc@in.tum.de>
parents: 1901
diff changeset
    79
   i is the index of the correspodning datatype *)
c68a154adca4 renamed "_empty" and "_append" to "_zero" and "_plus"
Christian Urban <urbanc@in.tum.de>
parents: 1901
diff changeset
    80
fun perm_eq_constr dt_descr sorts permute_fns i (cnstr_name, dts) =
1899
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    81
let
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    82
  val pi = Free ("p", @{typ perm})
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    83
  val arg_tys = map (Datatype_Aux.typ_of_dtyp dt_descr sorts) dts
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    84
  val arg_names = Name.variant_list ["p"] (Datatype_Prop.make_tnames arg_tys)
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    85
  val args = map Free (arg_names ~~ arg_tys)
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    86
  val cnstr = Const (cnstr_name, arg_tys ---> (nth_dtyp dt_descr sorts i))
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    87
  val lhs = Free (nth permute_fns i) $ pi $ list_comb (cnstr, args)
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    88
  val rhs = list_comb (cnstr, map (perm_arg permute_fns pi) (dts ~~ args))
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    89
  val eq = HOLogic.mk_Trueprop (HOLogic.mk_eq (lhs, rhs))
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    90
in
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    91
  (Attrib.empty_binding, eq)
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    92
end
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    93
*}
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    94
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    95
ML {*
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    96
(* defines the permutation functions for raw datatypes and
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    97
   proves that they are instances of pt
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    98
*)
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
    99
fun define_raw_perms (dt_info : Datatype_Aux.info) dt_nos thy =
1170
a7b4160ef463 Wrapped the permutation code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1164
diff changeset
   100
let
1899
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   101
  val {descr as dt_descr, induct, sorts, ...} = dt_info;
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   102
  val all_full_tnames = map (fn (_, (n, _, _)) => n) dt_descr;
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   103
  val full_tnames = List.take (all_full_tnames, dt_nos);
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   104
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   105
  val perm_fn_names = Datatype_Prop.indexify_names (map (fn (i, _) =>
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   106
    "permute_" ^ Datatype_Aux.name_of_typ (nth_dtyp dt_descr sorts i)) dt_descr);
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   107
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   108
  val perm_types = map (fn (i, _) => perm_ty (nth_dtyp dt_descr sorts i)) dt_descr
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   109
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   110
  val permute_fns = perm_fn_names ~~ perm_types
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   111
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   112
  fun perm_eq (i, (_, _, constrs)) = 
1902
c68a154adca4 renamed "_empty" and "_append" to "_zero" and "_plus"
Christian Urban <urbanc@in.tum.de>
parents: 1901
diff changeset
   113
    map (perm_eq_constr dt_descr sorts permute_fns i) constrs;
1899
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   114
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   115
  val perm_eqs = maps perm_eq dt_descr;
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   116
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   117
  val lthy =
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   118
    Theory_Target.instantiation (full_tnames, [], @{sort pt}) thy;
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   119
   
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   120
  val ((perm_frees, perm_ldef), lthy') =
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   121
    Primrec.add_primrec
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   122
      (map (fn s => (Binding.name s, NONE, NoSyn)) perm_fn_names) perm_eqs lthy;
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   123
    
1903
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   124
  val perm_zero_thms = prove_perm_zero lthy' induct perm_ldef perm_frees
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   125
  val perm_plus_thms = prove_perm_plus lthy' induct perm_ldef perm_frees
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   126
  val perm_zero_thms' = List.take (perm_zero_thms, dt_nos);
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   127
  val perm_plus_thms' = List.take (perm_plus_thms, dt_nos)
1899
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   128
  val perms_name = space_implode "_" perm_fn_names
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   129
  val perms_zero_bind = Binding.name (perms_name ^ "_zero")
1902
c68a154adca4 renamed "_empty" and "_append" to "_zero" and "_plus"
Christian Urban <urbanc@in.tum.de>
parents: 1901
diff changeset
   130
  val perms_plus_bind = Binding.name (perms_name ^ "_plus")
1903
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   131
  
1899
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   132
  fun tac _ (_, simps, _) =
1903
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   133
    (Class.intro_classes_tac []) THEN ALLGOALS (resolve_tac simps);
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   134
  
1899
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   135
  fun morphism phi (dfs, simps, fvs) =
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   136
    (map (Morphism.thm phi) dfs, map (Morphism.thm phi) simps, map (Morphism.term phi) fvs);
1170
a7b4160ef463 Wrapped the permutation code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1164
diff changeset
   137
  in
1899
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   138
    lthy'
1903
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   139
    |> snd o (Local_Theory.note ((perms_zero_bind, []), perm_zero_thms'))
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   140
    |> snd o (Local_Theory.note ((perms_plus_bind, []), perm_plus_thms'))
1899
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   141
    |> Class_Target.prove_instantiation_exit_result morphism tac 
1903
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   142
         (perm_ldef, perm_zero_thms' @ perm_plus_thms', perm_frees)
1170
a7b4160ef463 Wrapped the permutation code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1164
diff changeset
   143
  end
1899
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   144
*}
1159
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   145
1899
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   146
(* Test *)
1900
57db4ff0893b added comment about abstraction in raw permuations
Christian Urban <urbanc@in.tum.de>
parents: 1899
diff changeset
   147
(*atom_decl name
1899
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   148
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   149
datatype trm =
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   150
  Var "name"
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   151
| App "trm" "trm list"
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   152
| Lam "name" "trm"
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   153
| Let "bp" "trm" "trm"
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   154
and bp =
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   155
  BUnit
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   156
| BVar "name"
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   157
| BPair "bp" "bp"
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   158
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   159
setup {* fn thy =>
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   160
let 
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   161
  val info = Datatype.the_info thy "Perm.trm"
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   162
in
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   163
  define_raw_perms info 2 thy |> snd
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   164
end
1159
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   165
*}
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   166
1899
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   167
print_theorems
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   168
*)
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   169
1253
cff8a67691d2 Define lifted perms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1249
diff changeset
   170
ML {*
1903
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   171
fun quotient_lift_consts_export qtys spec ctxt =
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   172
let
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   173
  val (result, ctxt') = fold_map (Quotient_Def.quotient_lift_const qtys) spec ctxt;
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   174
  val (ts_loc, defs_loc) = split_list result;
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   175
  val morphism = ProofContext.export_morphism ctxt' ctxt;
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   176
  val ts = map (Morphism.term morphism) ts_loc
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   177
  val defs = Morphism.fact morphism defs_loc
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   178
in
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   179
  (ts, defs, ctxt')
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   180
end
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   181
*}
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   182
950fd9b8f05e reordered code
Christian Urban <urbanc@in.tum.de>
parents: 1902
diff changeset
   183
ML {*
1683
f78c820f67c3 Automatically lift theorems and constants only using the new quotient types. Requires new Isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1503
diff changeset
   184
fun define_lifted_perms qtys full_tnames name_term_pairs thms thy =
1253
cff8a67691d2 Define lifted perms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1249
diff changeset
   185
let
cff8a67691d2 Define lifted perms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1249
diff changeset
   186
  val lthy =
cff8a67691d2 Define lifted perms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1249
diff changeset
   187
    Theory_Target.instantiation (full_tnames, [], @{sort pt}) thy;
1683
f78c820f67c3 Automatically lift theorems and constants only using the new quotient types. Requires new Isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1503
diff changeset
   188
  val (_, _, lthy') = quotient_lift_consts_export qtys name_term_pairs lthy;
f78c820f67c3 Automatically lift theorems and constants only using the new quotient types. Requires new Isabelle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1503
diff changeset
   189
  val lifted_thms = map (Quotient_Tacs.lifted qtys lthy') thms;
1253
cff8a67691d2 Define lifted perms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1249
diff changeset
   190
  fun tac _ =
cff8a67691d2 Define lifted perms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1249
diff changeset
   191
    Class.intro_classes_tac [] THEN
cff8a67691d2 Define lifted perms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1249
diff changeset
   192
    (ALLGOALS (resolve_tac lifted_thms))
cff8a67691d2 Define lifted perms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1249
diff changeset
   193
  val lthy'' = Class.prove_instantiation_instance tac lthy'
cff8a67691d2 Define lifted perms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1249
diff changeset
   194
in
cff8a67691d2 Define lifted perms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1249
diff changeset
   195
  Local_Theory.exit_global lthy''
cff8a67691d2 Define lifted perms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1249
diff changeset
   196
end
cff8a67691d2 Define lifted perms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1249
diff changeset
   197
*}
cff8a67691d2 Define lifted perms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1249
diff changeset
   198
1342
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   199
ML {*
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   200
fun neq_to_rel r neq =
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   201
let
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   202
  val neq = HOLogic.dest_Trueprop (prop_of neq)
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   203
  val eq = HOLogic.dest_not neq
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   204
  val (lhs, rhs) = HOLogic.dest_eq eq
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   205
  val rel = r $ lhs $ rhs
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   206
  val nrel = HOLogic.mk_not rel
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   207
in
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   208
  HOLogic.mk_Trueprop nrel
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   209
end
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   210
*}
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   211
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   212
ML {*
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   213
fun neq_to_rel_tac cases distinct =
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   214
  rtac notI THEN' eresolve_tac cases THEN_ALL_NEW asm_full_simp_tac (HOL_ss addsimps distinct)
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   215
*}
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   216
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   217
ML {*
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   218
fun distinct_rel ctxt cases (dists, rel) =
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   219
let
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   220
  val ((_, thms), ctxt') = Variable.import false dists ctxt
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   221
  val terms = map (neq_to_rel rel) thms
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   222
  val nrels = map (fn t => Goal.prove ctxt' [] [] t (fn _ => neq_to_rel_tac cases dists 1)) terms
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   223
in
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   224
  Variable.export ctxt' ctxt nrels
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   225
end
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   226
*}
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   227
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   228
2b98012307f7 Lift distinct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   229
1899
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   230
(* Test *)
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   231
(*atom_decl name
1159
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   232
1896
996d4411e95e tuned; fleshed out some library functions about permutations; closed Datatype_Aux structure (increases readability)
Christian Urban <urbanc@in.tum.de>
parents: 1871
diff changeset
   233
datatype trm =
996d4411e95e tuned; fleshed out some library functions about permutations; closed Datatype_Aux structure (increases readability)
Christian Urban <urbanc@in.tum.de>
parents: 1871
diff changeset
   234
  Var "name"
996d4411e95e tuned; fleshed out some library functions about permutations; closed Datatype_Aux structure (increases readability)
Christian Urban <urbanc@in.tum.de>
parents: 1871
diff changeset
   235
| App "trm" "trm list"
996d4411e95e tuned; fleshed out some library functions about permutations; closed Datatype_Aux structure (increases readability)
Christian Urban <urbanc@in.tum.de>
parents: 1871
diff changeset
   236
| Lam "name" "trm"
996d4411e95e tuned; fleshed out some library functions about permutations; closed Datatype_Aux structure (increases readability)
Christian Urban <urbanc@in.tum.de>
parents: 1871
diff changeset
   237
| Let "bp" "trm" "trm"
1170
a7b4160ef463 Wrapped the permutation code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1164
diff changeset
   238
and bp =
a7b4160ef463 Wrapped the permutation code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1164
diff changeset
   239
  BUnit
1896
996d4411e95e tuned; fleshed out some library functions about permutations; closed Datatype_Aux structure (increases readability)
Christian Urban <urbanc@in.tum.de>
parents: 1871
diff changeset
   240
| BVar "name"
996d4411e95e tuned; fleshed out some library functions about permutations; closed Datatype_Aux structure (increases readability)
Christian Urban <urbanc@in.tum.de>
parents: 1871
diff changeset
   241
| BPair "bp" "bp"
1159
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   242
1899
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   243
setup {* fn thy =>
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   244
let 
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   245
  val inf = Datatype.the_info thy "Perm.trm"
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   246
in
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   247
  define_raw_perms inf 2 thy |> snd
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   248
end
8e0bfb14f6bf optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents: 1896
diff changeset
   249
*}
1170
a7b4160ef463 Wrapped the permutation code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1164
diff changeset
   250
a7b4160ef463 Wrapped the permutation code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1164
diff changeset
   251
print_theorems
a7b4160ef463 Wrapped the permutation code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1164
diff changeset
   252
*)
a7b4160ef463 Wrapped the permutation code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1164
diff changeset
   253
1159
3c6bee89d826 Ported Stefan's permutation code, still needs some localizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   254
end