Nominal/Term1.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Mon, 01 Mar 2010 21:50:24 +0100
changeset 1291 24889782da92
parent 1283 6a133abb7633
child 1300 22a084c9316b
permissions -rw-r--r--
Trying to prove equivariance.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     1
theory Term1
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     2
imports "Nominal2_Atoms" "Nominal2_Eqvt" "Nominal2_Supp" "Abs" "Perm" "Fv" "Rsp" "../Attic/Prove"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     3
begin
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     4
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     5
atom_decl name
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     7
section {*** lets with binding patterns ***}
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     8
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     9
datatype rtrm1 =
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    10
  rVr1 "name"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    11
| rAp1 "rtrm1" "rtrm1"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    12
| rLm1 "name" "rtrm1"        --"name is bound in trm1"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    13
| rLt1 "bp" "rtrm1" "rtrm1"   --"all variables in bp are bound in the 2nd trm1"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    14
and bp =
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    15
  BUnit
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
| BVr "name"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    17
| BPr "bp" "bp"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    18
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    19
print_theorems
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    20
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    21
(* to be given by the user *)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    22
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    23
primrec 
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    24
  bv1
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    25
where
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    26
  "bv1 (BUnit) = {}"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    27
| "bv1 (BVr x) = {atom x}"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    28
| "bv1 (BPr bp1 bp2) = (bv1 bp1) \<union> (bv1 bp2)"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    29
1277
6eacf60ce41d Permutation and FV_Alpha interface change.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1274
diff changeset
    30
setup {* snd o define_raw_perms (Datatype.the_info @{theory} "Term1.rtrm1") 2 *}
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    31
thm permute_rtrm1_permute_bp.simps
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    32
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    33
local_setup {*
1277
6eacf60ce41d Permutation and FV_Alpha interface change.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1274
diff changeset
    34
  snd o define_fv_alpha (Datatype.the_info @{theory} "Term1.rtrm1")
1291
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    35
  [[[], [], [(NONE, 0, 1)], [(SOME @{term bv1}, 0, 2)]],
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    36
  [[], [], []]] *}
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    37
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    38
notation
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    39
  alpha_rtrm1 ("_ \<approx>1 _" [100, 100] 100) and
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    40
  alpha_bp ("_ \<approx>1b _" [100, 100] 100)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    41
thm alpha_rtrm1_alpha_bp.intros
1283
6a133abb7633 generated the "binding list" from the input; at the moment it is only printed out as tracing; does not yet include the "bind itself binders"
Christian Urban <urbanc@in.tum.de>
parents: 1278
diff changeset
    42
thm fv_rtrm1_fv_bp.simps[no_vars]
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    43
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    44
local_setup {* (fn ctxt => snd (Local_Theory.note ((@{binding alpha1_inj}, []), (build_alpha_inj @{thms alpha_rtrm1_alpha_bp.intros} @{thms rtrm1.distinct rtrm1.inject bp.distinct bp.inject} @{thms alpha_rtrm1.cases alpha_bp.cases} ctxt)) ctxt)) *}
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    45
thm alpha1_inj
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    46
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    47
local_setup {*
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    48
snd o (build_eqvts @{binding bv1_eqvt} [@{term bv1}] [@{term "permute :: perm \<Rightarrow> bp \<Rightarrow> bp"}] (@{thms bv1.simps permute_rtrm1_permute_bp.simps}) @{thm rtrm1_bp.inducts(2)})
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    49
*}
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    50
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    51
local_setup {*
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    52
snd o build_eqvts @{binding fv_rtrm1_fv_bp_eqvt} [@{term fv_rtrm1}, @{term fv_bp}] [@{term "permute :: perm \<Rightarrow> rtrm1 \<Rightarrow> rtrm1"},@{term "permute :: perm \<Rightarrow> bp \<Rightarrow> bp"}] (@{thms fv_rtrm1_fv_bp.simps permute_rtrm1_permute_bp.simps}) @{thm rtrm1_bp.induct}
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    53
*}
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    54
1291
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    55
ML {*
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    56
fun build_alpha_eqvts funs perms simps induct ctxt =
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    57
let
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    58
  val pi = Free ("p", @{typ perm});
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    59
  val types = map (domain_type o fastype_of) funs;
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    60
  val indnames = Name.variant_list ["p"] (Datatype_Prop.make_tnames (map body_type types));
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    61
  val indnames2 = Name.variant_list ("p" :: indnames) (Datatype_Prop.make_tnames (map body_type types));
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    62
  val args = map Free (indnames ~~ types);
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    63
  val args2 = map Free (indnames2 ~~ types);
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    64
  fun eqvtc ((alpha, perm), (arg, arg2)) =
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    65
    HOLogic.mk_imp (alpha $ arg $ arg2,
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    66
      (alpha $ (perm $ pi $ arg) $ (perm $ pi $ arg2)))
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    67
  val gl = HOLogic.mk_Trueprop (foldr1 HOLogic.mk_conj (map eqvtc ((funs ~~ perms) ~~ (args ~~ args2))))
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    68
  fun tac _ = (((rtac impI THEN' etac induct) ORELSE' rtac induct) THEN_ALL_NEW
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    69
    (asm_full_simp_tac (HOL_ss addsimps 
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    70
      (@{thm atom_eqvt} :: (Nominal_ThmDecls.get_eqvts_thms ctxt) @ simps)))
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    71
    THEN_ALL_NEW (TRY o REPEAT_ALL_NEW (CHANGED o rtac conjI) THEN_ALL_NEW
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    72
      (etac @{thm alpha_gen_compose_eqvt})) THEN_ALL_NEW
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    73
    (asm_full_simp_tac (HOL_ss addsimps 
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    74
      (@{thm atom_eqvt} :: (Nominal_ThmDecls.get_eqvts_thms ctxt) @ simps)))
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    75
) 1
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    76
  
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    77
in
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    78
  gl
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    79
end
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    80
*}ye
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    81
1291
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    82
lemma alpha_gen_compose_eqvt:
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    83
  assumes b: "(g d, t) \<approx>gen (\<lambda>x1 x2. R x1 x2 \<and> R (pi \<bullet> x1) (pi \<bullet> x2)) f pia (g e, s)"
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    84
  and     c: "\<And>y. pi \<bullet> (g y) = g (pi \<bullet> y)"
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    85
  and     a: "\<And>x. pi \<bullet> (f x) = f (pi \<bullet> x)"
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    86
  shows  "\<exists>pia. (g (pi \<bullet> d), pi \<bullet> t) \<approx>gen R f pia (g (pi \<bullet> e), pi \<bullet> s) \<and> P g pi d e t s R f pia"
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    87
  using b
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    88
  apply -
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    89
sorry
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    90
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    91
lemma exi: "\<exists>(pi :: perm). P pi \<Longrightarrow> (\<And>(p :: perm). P p \<Longrightarrow> Q (p \<bullet> pi)) \<Longrightarrow> \<exists>pi. Q pi"
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    92
apply (erule exE)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    93
apply (rule_tac x="pia \<bullet> pi" in exI)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    94
by auto
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    95
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    96
prove {*
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    97
  build_alpha_eqvts [@{term alpha_rtrm1}, @{term alpha_bp}] [@{term "permute :: perm \<Rightarrow> rtrm1 \<Rightarrow> rtrm1"},@{term "permute :: perm \<Rightarrow> bp \<Rightarrow> bp"}] @{thms permute_rtrm1_permute_bp.simps alpha1_inj} @{thm alpha_rtrm1_alpha_bp.induct} @{context}
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    98
*}
1291
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
    99
apply(rule alpha_rtrm1_alpha_bp.induct)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   100
apply(simp_all add: atom_eqvt alpha1_inj)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   101
apply(erule exi)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   102
apply(simp add: alpha_gen.simps)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   103
apply(erule conjE)+
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   104
apply(rule conjI)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   105
apply(simp add: atom_eqvt[symmetric] Diff_eqvt[symmetric] insert_eqvt[symmetric] set_eqvt[symmetric] empty_eqvt[symmetric] eqvts[symmetric])
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   106
apply(subst empty_eqvt[symmetric])
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   107
apply(subst insert_eqvt[symmetric])
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   108
apply(simp add: atom_eqvt[symmetric] Diff_eqvt[symmetric] insert_eqvt[symmetric] set_eqvt[symmetric] empty_eqvt[symmetric] eqvts[symmetric])
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   109
apply(subst eqvts)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   110
apply(subst eqvts)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   111
apply(subst eqvts)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   112
apply(subst eqvts)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   113
apply(subst eqvts)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   114
apply simp
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   115
apply(rule conjI)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   116
apply(simp add: atom_eqvt Diff_eqvt insert_eqvt set_eqvt empty_eqvt)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   117
apply(rule_tac ?p1="- p" in fresh_star_permute_iff[THEN iffD1])
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   118
thm eqvts
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   119
apply(simp add:eqvts)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   120
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   121
thm insert_eqvt
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   122
apply(simp add: atom_eqvt[symmetric] Diff_eqvt[symmetric] insert_eqvt[symmetric])
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   123
1291
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   124
apply(rule conjI)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   125
thm atom_eqvt
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   126
apply(rule_tac ?p1="- p" in fresh_star_permute_iff[THEN iffD1])
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   127
apply simp
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   128
apply(rule conjI)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   129
apply(subst permute_eqvt[symmetric])
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   130
apply simp
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   131
apply(rule conjI)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   132
apply(rule_tac ?p1="- p" in fresh_star_permute_iff[THEN iffD1])
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   133
apply simp
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   134
apply(subst permute_eqvt[symmetric])
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   135
apply simp
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   136
apply(rule_tac ?p1="- p" in permute_eq_iff[THEN iffD1])
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   137
apply(simp)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   138
thm permute_eq_iff[THEN iffD1]
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   139
apply(clarify)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   140
apply(rule conjI)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   141
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   142
apply(erule alpha_gen_compose_eqvt)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   143
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   144
prefer 2
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   145
apply(erule conj_forward)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   146
apply (simp add: eqvts)
24889782da92 Trying to prove equivariance.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1283
diff changeset
   147
apply(erule alpha_gen_compose_eqvt)
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   148
lemma alpha1_eqvt_proper[eqvt]:
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   149
  "pi \<bullet> (t \<approx>1 s) = ((pi \<bullet> t) \<approx>1 (pi \<bullet> s))"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   150
  "pi \<bullet> (alpha_bp a b) = (alpha_bp (pi \<bullet> a) (pi \<bullet> b))"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   151
  apply (simp_all only: eqvts)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   152
  apply rule
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   153
  apply (simp_all add: alpha1_eqvt)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   154
  apply (subst permute_minus_cancel(2)[symmetric,of "t" "pi"])
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   155
  apply (subst permute_minus_cancel(2)[symmetric,of "s" "pi"])
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   156
  apply (simp_all only: alpha1_eqvt)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   157
  apply rule
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   158
  apply (simp_all add: alpha1_eqvt)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   159
  apply (subst permute_minus_cancel(2)[symmetric,of "a" "pi"])
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   160
  apply (subst permute_minus_cancel(2)[symmetric,of "b" "pi"])
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   161
  apply (simp_all only: alpha1_eqvt)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   162
done
1274
d867021d8ac1 Preparing the generalized lifting procedure
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1270
diff changeset
   163
thm eqvts_raw(1)
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   164
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   165
local_setup {* (fn ctxt => snd (Local_Theory.note ((@{binding alpha1_equivp}, []),
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   166
  (build_equivps [@{term alpha_rtrm1}, @{term alpha_bp}] @{thm rtrm1_bp.induct} @{thm alpha_rtrm1_alpha_bp.induct} @{thms rtrm1.inject bp.inject} @{thms alpha1_inj} @{thms rtrm1.distinct bp.distinct} @{thms alpha_rtrm1.cases alpha_bp.cases} @{thms alpha1_eqvt} ctxt)) ctxt)) *}
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   167
thm alpha1_equivp
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   168
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   169
local_setup  {* define_quotient_type [(([], @{binding trm1}, NoSyn), (@{typ rtrm1}, @{term alpha_rtrm1}))]
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   170
  (rtac @{thm alpha1_equivp(1)} 1) *}
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   171
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   172
local_setup {*
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   173
(fn ctxt => ctxt
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   174
 |> snd o (Quotient_Def.quotient_lift_const ("Vr1", @{term rVr1}))
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   175
 |> snd o (Quotient_Def.quotient_lift_const ("Ap1", @{term rAp1}))
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   176
 |> snd o (Quotient_Def.quotient_lift_const ("Lm1", @{term rLm1}))
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   177
 |> snd o (Quotient_Def.quotient_lift_const ("Lt1", @{term rLt1}))
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   178
 |> snd o (Quotient_Def.quotient_lift_const ("fv_trm1", @{term fv_rtrm1})))
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   179
*}
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   180
print_theorems
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   181
1278
8814494fe4da Change in signature of prove_const_rsp for general lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   182
local_setup {* snd o prove_const_rsp @{binding fv_rtrm1_rsp} [@{term fv_rtrm1}]
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   183
  (fn _ => fvbv_rsp_tac @{thm alpha_rtrm1_alpha_bp.inducts(1)} @{thms fv_rtrm1_fv_bp.simps} 1) *}
1278
8814494fe4da Change in signature of prove_const_rsp for general lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   184
local_setup {* snd o prove_const_rsp @{binding rVr1_rsp} [@{term rVr1}]
8814494fe4da Change in signature of prove_const_rsp for general lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   185
  (fn _ => constr_rsp_tac @{thms alpha1_inj} @{thms fv_rtrm1_rsp} @{thms alpha1_equivp} 1) *}
8814494fe4da Change in signature of prove_const_rsp for general lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   186
local_setup {* snd o prove_const_rsp @{binding rAp1_rsp} [@{term rAp1}]
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   187
  (fn _ => constr_rsp_tac @{thms alpha1_inj} @{thms fv_rtrm1_rsp} @{thms alpha1_equivp} 1) *}
1278
8814494fe4da Change in signature of prove_const_rsp for general lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   188
local_setup {* snd o prove_const_rsp @{binding rLm1_rsp} [@{term rLm1}]
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   189
  (fn _ => constr_rsp_tac @{thms alpha1_inj} @{thms fv_rtrm1_rsp} @{thms alpha1_equivp} 1) *}
1278
8814494fe4da Change in signature of prove_const_rsp for general lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   190
local_setup {* snd o prove_const_rsp @{binding rLt1_rsp} [@{term rLt1}]
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   191
  (fn _ => constr_rsp_tac @{thms alpha1_inj} @{thms fv_rtrm1_rsp} @{thms alpha1_equivp} 1) *}
1278
8814494fe4da Change in signature of prove_const_rsp for general lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1277
diff changeset
   192
local_setup {* snd o prove_const_rsp @{binding permute_rtrm1_rsp} [@{term "permute :: perm \<Rightarrow> rtrm1 \<Rightarrow> rtrm1"}]
1270
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   193
  (fn _ => asm_simp_tac (HOL_ss addsimps @{thms alpha1_eqvt}) 1) *}
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   194
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   195
lemmas trm1_bp_induct = rtrm1_bp.induct[quot_lifted]
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   196
lemmas trm1_bp_inducts = rtrm1_bp.inducts[quot_lifted]
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   197
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   198
setup {* define_lifted_perms ["Term1.trm1"] [("permute_trm1", @{term "permute :: perm \<Rightarrow> rtrm1 \<Rightarrow> rtrm1"})]
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   199
  @{thms permute_rtrm1_permute_bp_zero permute_rtrm1_permute_bp_append} *}
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   200
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   201
lemmas
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   202
    permute_trm1 = permute_rtrm1_permute_bp.simps[quot_lifted]
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   203
and fv_trm1 = fv_rtrm1_fv_bp.simps[quot_lifted]
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   204
and fv_trm1_eqvt = fv_rtrm1_fv_bp_eqvt(1)[quot_lifted]
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   205
and alpha1_INJ = alpha1_inj[unfolded alpha_gen, quot_lifted, folded alpha_gen]
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   206
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   207
lemma supports:
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   208
  "(supp (atom x)) supports (Vr1 x)"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   209
  "(supp t \<union> supp s) supports (Ap1 t s)"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   210
  "(supp (atom x) \<union> supp t) supports (Lm1 x t)"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   211
  "(supp b \<union> supp t \<union> supp s) supports (Lt1 b t s)"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   212
  "{} supports BUnit"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   213
  "(supp (atom x)) supports (BVr x)"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   214
  "(supp a \<union> supp b) supports (BPr a b)"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   215
apply(simp_all add: supports_def fresh_def[symmetric] swap_fresh_fresh permute_trm1)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   216
apply(rule_tac [!] allI)+
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   217
apply(rule_tac [!] impI)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   218
apply(tactic {* ALLGOALS (REPEAT o etac conjE) *})
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   219
apply(simp_all add: fresh_atom)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   220
done
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   221
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   222
lemma rtrm1_bp_fs:
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   223
  "finite (supp (x :: trm1))"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   224
  "finite (supp (b :: bp))"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   225
  apply (induct x and b rule: trm1_bp_inducts)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   226
  apply(tactic {* ALLGOALS (rtac @{thm supports_finite} THEN' resolve_tac @{thms supports}) *})
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   227
  apply(simp_all add: supp_atom)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   228
  done
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   229
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   230
instance trm1 :: fs
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   231
apply default
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   232
apply (rule rtrm1_bp_fs(1))
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   233
done
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   234
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   235
lemma fv_eq_bv: "fv_bp bp = bv1 bp"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   236
apply(induct bp rule: trm1_bp_inducts(2))
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   237
apply(simp_all)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   238
done
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   239
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   240
lemma helper2: "{b. \<forall>pi. pi \<bullet> (a \<rightleftharpoons> b) \<bullet> bp \<noteq> bp} = {}"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   241
apply auto
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   242
apply (rule_tac x="(x \<rightleftharpoons> a)" in exI)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   243
apply auto
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   244
done
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   245
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   246
lemma alpha_bp_eq_eq: "alpha_bp a b = (a = b)"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   247
apply rule
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   248
apply (induct a b rule: alpha_rtrm1_alpha_bp.inducts(2))
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   249
apply (simp_all add: equivp_reflp[OF alpha1_equivp(2)])
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   250
done
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   251
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   252
lemma alpha_bp_eq: "alpha_bp = (op =)"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   253
apply (rule ext)+
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   254
apply (rule alpha_bp_eq_eq)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   255
done
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   256
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   257
lemma supp_fv:
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   258
  "supp t = fv_trm1 t"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   259
  "supp b = fv_bp b"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   260
apply(induct t and b rule: trm1_bp_inducts)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   261
apply(simp_all)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   262
apply(simp add: supp_def permute_trm1 alpha1_INJ fv_trm1)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   263
apply(simp only: supp_at_base[simplified supp_def])
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   264
apply(simp add: supp_def permute_trm1 alpha1_INJ fv_trm1)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   265
apply(simp add: Collect_imp_eq Collect_neg_eq)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   266
apply(subgoal_tac "supp (Lm1 name rtrm1) = supp (Abs {atom name} rtrm1)")
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   267
apply(simp add: supp_Abs fv_trm1)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   268
apply(simp (no_asm) add: supp_def permute_set_eq atom_eqvt permute_trm1)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   269
apply(simp add: alpha1_INJ)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   270
apply(simp add: Abs_eq_iff)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   271
apply(simp add: alpha_gen.simps)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   272
apply(simp add: supp_eqvt[symmetric] fv_trm1_eqvt[symmetric])
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   273
apply(subgoal_tac "supp (Lt1 bp rtrm11 rtrm12) = supp(rtrm11) \<union> supp (Abs (bv1 bp) rtrm12)")
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   274
apply(simp add: supp_Abs fv_trm1 fv_eq_bv)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   275
apply(simp (no_asm) add: supp_def permute_trm1)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   276
apply(simp add: alpha1_INJ alpha_bp_eq)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   277
apply(simp add: Abs_eq_iff)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   278
apply(simp add: alpha_gen)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   279
apply(simp add: supp_eqvt[symmetric] fv_trm1_eqvt[symmetric] bv1_eqvt fv_eq_bv)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   280
apply(simp add: Collect_imp_eq Collect_neg_eq fresh_star_def helper2)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   281
apply(simp (no_asm) add: supp_def permute_set_eq atom_eqvt)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   282
apply(simp (no_asm) add: supp_def eqvts)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   283
apply(fold supp_def)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   284
apply(simp add: supp_at_base)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   285
apply(simp (no_asm) add: supp_def Collect_imp_eq Collect_neg_eq)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   286
apply(simp add: Collect_imp_eq[symmetric] Collect_neg_eq[symmetric] supp_def[symmetric])
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   287
done
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   288
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   289
lemma trm1_supp:
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   290
  "supp (Vr1 x) = {atom x}"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   291
  "supp (Ap1 t1 t2) = supp t1 \<union> supp t2"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   292
  "supp (Lm1 x t) = (supp t) - {atom x}"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   293
  "supp (Lt1 b t s) = supp t \<union> (supp s - bv1 b)"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   294
by (simp_all add: supp_fv fv_trm1 fv_eq_bv)
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   295
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   296
lemma trm1_induct_strong:
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   297
  assumes "\<And>name b. P b (Vr1 name)"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   298
  and     "\<And>rtrm11 rtrm12 b. \<lbrakk>\<And>c. P c rtrm11; \<And>c. P c rtrm12\<rbrakk> \<Longrightarrow> P b (Ap1 rtrm11 rtrm12)"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   299
  and     "\<And>name rtrm1 b. \<lbrakk>\<And>c. P c rtrm1; (atom name) \<sharp> b\<rbrakk> \<Longrightarrow> P b (Lm1 name rtrm1)"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   300
  and     "\<And>bp rtrm11 rtrm12 b. \<lbrakk>\<And>c. P c rtrm11; \<And>c. P c rtrm12; bv1 bp \<sharp>* b\<rbrakk> \<Longrightarrow> P b (Lt1 bp rtrm11 rtrm12)"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   301
  shows   "P a rtrma"
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   302
sorry
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   303
8c3cf9f4f5f2 Split Terms into separate files and add them to tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   304
end