Quot/Nominal/Terms.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Tue, 23 Feb 2010 18:27:32 +0100
changeset 1230 a41c3a105104
parent 1227 ec2e0116779e
child 1246 845bf16eee18
permissions -rw-r--r--
rsp for bv; the only issue is that it requires an appropriate induction principle.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     1
theory Terms
1227
ec2e0116779e rsp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1225
diff changeset
     2
imports "Nominal2_Atoms" "Nominal2_Eqvt" "Nominal2_Supp" "Abs" "Perm" "Fv" "Rsp" "../../Attic/Prove"
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     3
begin
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     4
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     5
atom_decl name
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     7
text {* primrec seems to be genarally faster than fun *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     8
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     9
section {*** lets with binding patterns ***}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    10
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    11
datatype rtrm1 =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    12
  rVr1 "name"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    13
| rAp1 "rtrm1" "rtrm1"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    14
| rLm1 "name" "rtrm1"        --"name is bound in trm1"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    15
| rLt1 "bp" "rtrm1" "rtrm1"   --"all variables in bp are bound in the 2nd trm1"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
and bp =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    17
  BUnit
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    18
| BVr "name"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    19
| BPr "bp" "bp"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    20
1198
5523d5713a65 Experiments for the pseudo-injectivity tactic.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1197
diff changeset
    21
print_theorems
5523d5713a65 Experiments for the pseudo-injectivity tactic.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1197
diff changeset
    22
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    23
(* to be given by the user *)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    24
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    25
primrec 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    26
  bv1
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    27
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    28
  "bv1 (BUnit) = {}"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    29
| "bv1 (BVr x) = {atom x}"
1183
cb3da5b540f2 Fixed proofs in Terms2 and found a mistake in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1182
diff changeset
    30
| "bv1 (BPr bp1 bp2) = (bv1 bp1) \<union> (bv1 bp2)"
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    31
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    32
setup {* snd o define_raw_perms ["rtrm1", "bp"] ["Terms.rtrm1", "Terms.bp"] *}
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
    33
thm permute_rtrm1_permute_bp.simps
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    34
1225
28aaf6d01e10 Progress towards automatic rsp of constants and fv.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1222
diff changeset
    35
local_setup {*
1199
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
    36
  snd o define_fv_alpha "Terms.rtrm1"
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    37
  [[[[]], [[], []], [[(NONE, 0)], [(NONE, 0)]], [[(SOME @{term bv1}, 0)], [], [(SOME @{term bv1}, 0)]]],
1199
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
    38
  [[], [[]], [[], []]]] *}
1198
5523d5713a65 Experiments for the pseudo-injectivity tactic.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1197
diff changeset
    39
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    40
notation
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    41
  alpha_rtrm1 ("_ \<approx>1 _" [100, 100] 100) and
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    42
  alpha_bp ("_ \<approx>1b _" [100, 100] 100)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    43
thm alpha_rtrm1_alpha_bp.intros
1202
ab942ba2d243 Removed bindings 'in itself' where possible.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1201
diff changeset
    44
thm fv_rtrm1_fv_bp.simps
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    45
1199
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
    46
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)) *}
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
    47
thm alpha1_inj
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    48
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    49
lemma alpha_bp_refl: "alpha_bp a a"
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    50
apply induct
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    51
apply (simp_all  add: alpha1_inj)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    52
done
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    53
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    54
lemma alpha_bp_eq_eq: "alpha_bp a b = (a = b)"
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    55
apply rule
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    56
apply (induct a b rule: alpha_rtrm1_alpha_bp.inducts(2))
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    57
apply (simp_all add: alpha_bp_refl)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    58
done
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    59
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    60
lemma alpha_bp_eq: "alpha_bp = (op =)"
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    61
apply (rule ext)+
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    62
apply (rule alpha_bp_eq_eq)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    63
done
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    64
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    65
lemma bv1_eqvt[eqvt]:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    66
  shows "(pi \<bullet> bv1 x) = bv1 (pi \<bullet> x)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    67
  apply (induct x)
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
    68
  apply (simp_all add: atom_eqvt eqvts)
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
    69
  done
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    70
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    71
lemma fv_rtrm1_eqvt[eqvt]:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    72
    "(pi\<bullet>fv_rtrm1 t) = fv_rtrm1 (pi\<bullet>t)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    73
    "(pi\<bullet>fv_bp b) = fv_bp (pi\<bullet>b)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    74
  apply (induct t and b)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    75
  apply (simp_all add: insert_eqvt atom_eqvt empty_eqvt union_eqvt Diff_eqvt bv1_eqvt)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    76
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    77
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    78
lemma alpha1_eqvt:
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    79
  "t \<approx>1 s \<Longrightarrow> (pi \<bullet> t) \<approx>1 (pi \<bullet> s)"
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    80
  "alpha_bp a b \<Longrightarrow> alpha_bp (pi \<bullet> a) (pi \<bullet> b)"
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    81
  apply (induct t s and a b rule: alpha_rtrm1_alpha_bp.inducts)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    82
  apply (simp_all add:eqvts alpha1_inj)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    83
  apply (erule exE)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    84
  apply (rule_tac x="pi \<bullet> pia" in exI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    85
  apply (simp add: alpha_gen)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    86
  apply(erule conjE)+
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    87
  apply(rule conjI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    88
  apply(rule_tac ?p1="- pi" in permute_eq_iff[THEN iffD1])
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    89
  apply(simp add: atom_eqvt Diff_eqvt insert_eqvt empty_eqvt fv_rtrm1_eqvt)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    90
  apply(rule conjI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    91
  apply(rule_tac ?p1="- pi" in fresh_star_permute_iff[THEN iffD1])
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    92
  apply(simp add: atom_eqvt Diff_eqvt fv_rtrm1_eqvt insert_eqvt empty_eqvt)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    93
  apply(simp add: permute_eqvt[symmetric])
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    94
  apply (erule exE)
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    95
  apply (erule exE)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
    96
  apply (rule conjI)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    97
  apply (rule_tac x="pi \<bullet> pia" in exI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    98
  apply (simp add: alpha_gen)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    99
  apply(erule conjE)+
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   100
  apply(rule conjI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   101
  apply(rule_tac ?p1="- pi" in permute_eq_iff[THEN iffD1])
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   102
  apply(simp add: fv_rtrm1_eqvt Diff_eqvt bv1_eqvt)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   103
  apply(rule conjI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   104
  apply(rule_tac ?p1="- pi" in fresh_star_permute_iff[THEN iffD1])
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   105
  apply(simp add: atom_eqvt fv_rtrm1_eqvt Diff_eqvt bv1_eqvt)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   106
  apply(simp add: permute_eqvt[symmetric])
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   107
  apply (rule_tac x="pi \<bullet> piaa" in exI)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   108
  apply (simp add: alpha_gen)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   109
  apply(erule conjE)+
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   110
  apply(rule conjI)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   111
  apply(rule_tac ?p1="- pi" in permute_eq_iff[THEN iffD1])
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   112
  apply(simp add: fv_rtrm1_eqvt Diff_eqvt bv1_eqvt)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   113
  apply(rule conjI)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   114
  apply(rule_tac ?p1="- pi" in fresh_star_permute_iff[THEN iffD1])
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   115
  apply(simp add: atom_eqvt fv_rtrm1_eqvt Diff_eqvt bv1_eqvt)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   116
  apply(simp add: permute_eqvt[symmetric])
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   117
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   118
1215
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   119
local_setup {* (fn ctxt => snd (Local_Theory.note ((@{binding alpha1_equivp}, []),
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   120
  (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)) *}
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   121
thm alpha1_equivp
1211
05e5fcf9840b export the reflp and symp tacs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1210
diff changeset
   122
1227
ec2e0116779e rsp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1225
diff changeset
   123
local_setup  {* define_quotient_type [(([], @{binding trm1}, NoSyn), (@{typ rtrm1}, @{term alpha_rtrm1}))]
ec2e0116779e rsp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1225
diff changeset
   124
  (rtac @{thm alpha1_equivp(1)} 1) *}
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   125
1190
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   126
local_setup {*
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   127
(fn ctxt => ctxt
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   128
 |> snd o (Quotient_Def.quotient_lift_const ("Vr1", @{term rVr1}))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   129
 |> snd o (Quotient_Def.quotient_lift_const ("Ap1", @{term rAp1}))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   130
 |> snd o (Quotient_Def.quotient_lift_const ("Lm1", @{term rLm1}))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   131
 |> snd o (Quotient_Def.quotient_lift_const ("Lt1", @{term rLt1}))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   132
 |> snd o (Quotient_Def.quotient_lift_const ("fv_trm1", @{term fv_rtrm1})))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   133
*}
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   134
print_theorems
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   135
1230
a41c3a105104 rsp for bv; the only issue is that it requires an appropriate induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1227
diff changeset
   136
thm alpha_rtrm1_alpha_bp.induct
a41c3a105104 rsp for bv; the only issue is that it requires an appropriate induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1227
diff changeset
   137
local_setup {* prove_const_rsp @{binding fv_rtrm1_rsp} [@{term fv_rtrm1}]
a41c3a105104 rsp for bv; the only issue is that it requires an appropriate induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1227
diff changeset
   138
  (fn _ => fvbv_rsp_tac @{thm alpha_rtrm1_alpha_bp.inducts(1)} @{thms fv_rtrm1_fv_bp.simps} 1) *}
a41c3a105104 rsp for bv; the only issue is that it requires an appropriate induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1227
diff changeset
   139
local_setup {* prove_const_rsp @{binding rVr1_rsp} [@{term rVr1}]
1227
ec2e0116779e rsp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1225
diff changeset
   140
  (fn _ => constr_rsp_tac @{thms alpha1_inj} @{thms fv_rtrm1_rsp} @{thms alpha1_equivp} 1) *}
1230
a41c3a105104 rsp for bv; the only issue is that it requires an appropriate induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1227
diff changeset
   141
local_setup {* prove_const_rsp @{binding rAp1_rsp} [@{term rAp1}]
a41c3a105104 rsp for bv; the only issue is that it requires an appropriate induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1227
diff changeset
   142
  (fn _ => constr_rsp_tac @{thms alpha1_inj} @{thms fv_rtrm1_rsp} @{thms alpha1_equivp} 1) *}
a41c3a105104 rsp for bv; the only issue is that it requires an appropriate induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1227
diff changeset
   143
local_setup {* prove_const_rsp @{binding rLm1_rsp} [@{term rLm1}]
1227
ec2e0116779e rsp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1225
diff changeset
   144
  (fn _ => constr_rsp_tac @{thms alpha1_inj} @{thms fv_rtrm1_rsp} @{thms alpha1_equivp} 1) *}
1230
a41c3a105104 rsp for bv; the only issue is that it requires an appropriate induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1227
diff changeset
   145
local_setup {* prove_const_rsp @{binding rLt1_rsp} [@{term rLt1}]
1227
ec2e0116779e rsp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1225
diff changeset
   146
  (fn _ => constr_rsp_tac @{thms alpha1_inj} @{thms fv_rtrm1_rsp} @{thms alpha1_equivp} 1) *}
1230
a41c3a105104 rsp for bv; the only issue is that it requires an appropriate induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1227
diff changeset
   147
local_setup {* prove_const_rsp @{binding permute_rtrm1_rsp} [@{term "permute :: perm \<Rightarrow> rtrm1 \<Rightarrow> rtrm1"}]
1227
ec2e0116779e rsp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1225
diff changeset
   148
  (fn _ => asm_simp_tac (HOL_ss addsimps @{thms alpha1_eqvt}) 1) *}
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   149
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   150
lemmas trm1_bp_induct = rtrm1_bp.induct[quot_lifted]
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   151
lemmas trm1_bp_inducts = rtrm1_bp.inducts[quot_lifted]
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   152
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   153
instantiation trm1 and bp :: pt
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   154
begin
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   155
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   156
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   157
  "permute_trm1 :: perm \<Rightarrow> trm1 \<Rightarrow> trm1"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   158
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   159
  "permute :: perm \<Rightarrow> rtrm1 \<Rightarrow> rtrm1"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   160
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   161
lemmas permute_trm1[simp] = permute_rtrm1_permute_bp.simps[quot_lifted]
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   162
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   163
instance
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   164
apply default
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   165
apply(induct_tac [!] x rule: trm1_bp_inducts(1))
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   166
apply(simp_all)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   167
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   168
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   169
end
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   170
1227
ec2e0116779e rsp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1225
diff changeset
   171
lemmas
ec2e0116779e rsp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1225
diff changeset
   172
    fv_trm1 = fv_rtrm1_fv_bp.simps[quot_lifted]
ec2e0116779e rsp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1225
diff changeset
   173
and fv_trm1_eqvt = fv_rtrm1_eqvt[quot_lifted]
ec2e0116779e rsp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1225
diff changeset
   174
and alpha1_INJ = alpha1_inj[unfolded alpha_gen, quot_lifted, folded alpha_gen]
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   175
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   176
lemma lm1_supp_pre:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   177
  shows "(supp (atom x, t)) supports (Lm1 x t) "
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   178
apply(simp add: supports_def)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   179
apply(fold fresh_def)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   180
apply(simp add: fresh_Pair swap_fresh_fresh)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   181
apply(clarify)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   182
apply(subst swap_at_base_simps(3))
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   183
apply(simp_all add: fresh_atom)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   184
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   185
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   186
lemma lt1_supp_pre:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   187
  shows "(supp (x, t, s)) supports (Lt1 t x s) "
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   188
apply(simp add: supports_def)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   189
apply(fold fresh_def)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   190
apply(simp add: fresh_Pair swap_fresh_fresh)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   191
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   192
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   193
lemma bp_supp: "finite (supp (bp :: bp))"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   194
  apply (induct bp)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   195
  apply(simp_all add: supp_def)
1217
74e2b9b95add Fixes for auxiliary datatypes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1216
diff changeset
   196
  apply(simp add: supp_at_base supp_def[symmetric])
74e2b9b95add Fixes for auxiliary datatypes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1216
diff changeset
   197
  apply(simp add: Collect_imp_eq Collect_neg_eq[symmetric] supp_def)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   198
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   199
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   200
instance trm1 :: fs
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   201
apply default
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   202
apply(induct_tac x rule: trm1_bp_inducts(1))
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   203
apply(simp_all)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   204
apply(simp add: supp_def alpha1_INJ eqvts)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   205
apply(simp add: supp_def[symmetric] supp_at_base)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   206
apply(simp only: supp_def alpha1_INJ eqvts permute_trm1)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   207
apply(simp add: Collect_imp_eq Collect_neg_eq)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   208
apply(rule supports_finite)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   209
apply(rule lm1_supp_pre)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   210
apply(simp add: supp_Pair supp_atom)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   211
apply(rule supports_finite)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   212
apply(rule lt1_supp_pre)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   213
apply(simp add: supp_Pair supp_atom bp_supp)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   214
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   215
1183
cb3da5b540f2 Fixed proofs in Terms2 and found a mistake in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1182
diff changeset
   216
lemma fv_eq_bv: "fv_bp bp = bv1 bp"
cb3da5b540f2 Fixed proofs in Terms2 and found a mistake in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1182
diff changeset
   217
apply(induct bp rule: trm1_bp_inducts(2))
cb3da5b540f2 Fixed proofs in Terms2 and found a mistake in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1182
diff changeset
   218
apply(simp_all)
cb3da5b540f2 Fixed proofs in Terms2 and found a mistake in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1182
diff changeset
   219
done
cb3da5b540f2 Fixed proofs in Terms2 and found a mistake in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1182
diff changeset
   220
1209
7b1a3df239cd Some progress about transp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1208
diff changeset
   221
lemma helper2: "{b. \<forall>pi. pi \<bullet> (a \<rightleftharpoons> b) \<bullet> bp \<noteq> bp} = {}"
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   222
apply auto
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   223
apply (rule_tac x="(x \<rightleftharpoons> a)" in exI)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   224
apply auto
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   225
done
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   226
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   227
lemma supp_fv:
1202
ab942ba2d243 Removed bindings 'in itself' where possible.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1201
diff changeset
   228
  "supp t = fv_trm1 t"
ab942ba2d243 Removed bindings 'in itself' where possible.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1201
diff changeset
   229
  "supp b = fv_bp b"
ab942ba2d243 Removed bindings 'in itself' where possible.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1201
diff changeset
   230
apply(induct t and b rule: trm1_bp_inducts)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   231
apply(simp_all)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   232
apply(simp add: supp_def permute_trm1 alpha1_INJ fv_trm1)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   233
apply(simp only: supp_at_base[simplified supp_def])
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   234
apply(simp add: supp_def permute_trm1 alpha1_INJ fv_trm1)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   235
apply(simp add: Collect_imp_eq Collect_neg_eq)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   236
apply(subgoal_tac "supp (Lm1 name rtrm1) = supp (Abs {atom name} rtrm1)")
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   237
apply(simp add: supp_Abs fv_trm1)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   238
apply(simp (no_asm) add: supp_def permute_set_eq atom_eqvt)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   239
apply(simp add: alpha1_INJ)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   240
apply(simp add: Abs_eq_iff)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   241
apply(simp add: alpha_gen.simps)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   242
apply(simp add: supp_eqvt[symmetric] fv_trm1_eqvt[symmetric])
1183
cb3da5b540f2 Fixed proofs in Terms2 and found a mistake in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1182
diff changeset
   243
apply(subgoal_tac "supp (Lt1 bp rtrm11 rtrm12) = supp(rtrm11) \<union> supp (Abs (bv1 bp) rtrm12)")
cb3da5b540f2 Fixed proofs in Terms2 and found a mistake in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1182
diff changeset
   244
apply(simp add: supp_Abs fv_trm1 fv_eq_bv)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   245
apply(simp (no_asm) add: supp_def)
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   246
apply(simp add: alpha1_INJ alpha_bp_eq)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   247
apply(simp add: Abs_eq_iff)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   248
apply(simp add: alpha_gen)
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   249
apply(simp add: supp_eqvt[symmetric] fv_trm1_eqvt[symmetric] bv1_eqvt fv_eq_bv)
1209
7b1a3df239cd Some progress about transp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1208
diff changeset
   250
apply(simp add: Collect_imp_eq Collect_neg_eq fresh_star_def helper2)
1202
ab942ba2d243 Removed bindings 'in itself' where possible.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1201
diff changeset
   251
apply(simp (no_asm) add: supp_def permute_set_eq atom_eqvt)
ab942ba2d243 Removed bindings 'in itself' where possible.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1201
diff changeset
   252
apply(simp (no_asm) add: supp_def eqvts)
ab942ba2d243 Removed bindings 'in itself' where possible.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1201
diff changeset
   253
apply(fold supp_def)
ab942ba2d243 Removed bindings 'in itself' where possible.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1201
diff changeset
   254
apply(simp add: supp_at_base)
ab942ba2d243 Removed bindings 'in itself' where possible.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1201
diff changeset
   255
apply(simp (no_asm) add: supp_def Collect_imp_eq Collect_neg_eq)
ab942ba2d243 Removed bindings 'in itself' where possible.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1201
diff changeset
   256
apply(simp add: Collect_imp_eq[symmetric] Collect_neg_eq[symmetric] supp_def[symmetric])
1183
cb3da5b540f2 Fixed proofs in Terms2 and found a mistake in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1182
diff changeset
   257
done
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   258
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   259
lemma trm1_supp:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   260
  "supp (Vr1 x) = {atom x}"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   261
  "supp (Ap1 t1 t2) = supp t1 \<union> supp t2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   262
  "supp (Lm1 x t) = (supp t) - {atom x}"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   263
  "supp (Lt1 b t s) = supp t \<union> (supp s - bv1 b)"
1183
cb3da5b540f2 Fixed proofs in Terms2 and found a mistake in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1182
diff changeset
   264
by (simp_all add: supp_fv fv_trm1 fv_eq_bv)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   265
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   266
lemma trm1_induct_strong:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   267
  assumes "\<And>name b. P b (Vr1 name)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   268
  and     "\<And>rtrm11 rtrm12 b. \<lbrakk>\<And>c. P c rtrm11; \<And>c. P c rtrm12\<rbrakk> \<Longrightarrow> P b (Ap1 rtrm11 rtrm12)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   269
  and     "\<And>name rtrm1 b. \<lbrakk>\<And>c. P c rtrm1; (atom name) \<sharp> b\<rbrakk> \<Longrightarrow> P b (Lm1 name rtrm1)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   270
  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)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   271
  shows   "P a rtrma"
1183
cb3da5b540f2 Fixed proofs in Terms2 and found a mistake in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1182
diff changeset
   272
sorry
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   273
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   274
section {*** lets with single assignments ***}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   275
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   276
datatype rtrm2 =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   277
  rVr2 "name"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   278
| rAp2 "rtrm2" "rtrm2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   279
| rLm2 "name" "rtrm2" --"bind (name) in (rtrm2)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   280
| rLt2 "rassign" "rtrm2" --"bind (bv2 rassign) in (rtrm2)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   281
and rassign =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   282
  rAs "name" "rtrm2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   283
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   284
(* to be given by the user *)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   285
primrec 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   286
  rbv2
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   287
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   288
  "rbv2 (rAs x t) = {atom x}"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   289
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   290
setup {* snd o define_raw_perms ["rtrm2", "rassign"] ["Terms.rtrm2", "Terms.rassign"] *}
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   291
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   292
local_setup {* snd o define_fv_alpha "Terms.rtrm2"
1202
ab942ba2d243 Removed bindings 'in itself' where possible.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1201
diff changeset
   293
  [[[[]], [[], []], [[(NONE, 0)], [(NONE, 0)]], [[], [(SOME @{term rbv2}, 0)]]],
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   294
   [[[], []]]] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   295
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   296
notation
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   297
  alpha_rtrm2 ("_ \<approx>2 _" [100, 100] 100) and
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   298
  alpha_rassign ("_ \<approx>2b _" [100, 100] 100)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   299
thm alpha_rtrm2_alpha_rassign.intros
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   300
1199
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
   301
local_setup {* (fn ctxt => snd (Local_Theory.note ((@{binding alpha2_inj}, []), (build_alpha_inj @{thms alpha_rtrm2_alpha_rassign.intros} @{thms rtrm2.distinct rtrm2.inject rassign.distinct rassign.inject} @{thms alpha_rtrm2.cases alpha_rassign.cases} ctxt)) ctxt)) *}
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
   302
thm alpha2_inj
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
   303
1215
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   304
lemma alpha2_eqvt:
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   305
  "t \<approx>2 s \<Longrightarrow> (pi \<bullet> t) \<approx>2 (pi \<bullet> s)"
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   306
  "a \<approx>2b b \<Longrightarrow> (pi \<bullet> a) \<approx>2b (pi \<bullet> b)"
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   307
sorry
1199
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
   308
1215
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   309
local_setup {* (fn ctxt => snd (Local_Theory.note ((@{binding alpha2_equivp}, []),
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   310
  (build_equivps [@{term alpha_rtrm2}, @{term alpha_rassign}] @{thm rtrm2_rassign.induct} @{thm alpha_rtrm2_alpha_rassign.induct} @{thms rtrm2.inject rassign.inject} @{thms alpha2_inj} @{thms rtrm2.distinct rassign.distinct} @{thms alpha_rtrm2.cases alpha_rassign.cases} @{thms alpha2_eqvt} ctxt)) ctxt)) *}
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   311
thm alpha2_equivp
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   312
1227
ec2e0116779e rsp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1225
diff changeset
   313
local_setup  {* define_quotient_type 
ec2e0116779e rsp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1225
diff changeset
   314
  [(([], @{binding trm2}, NoSyn), (@{typ rtrm2}, @{term alpha_rtrm2})),
ec2e0116779e rsp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1225
diff changeset
   315
   (([], @{binding assign}, NoSyn), (@{typ rassign}, @{term alpha_rassign}))]
ec2e0116779e rsp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1225
diff changeset
   316
  ((rtac @{thm alpha2_equivp(1)} 1) THEN (rtac @{thm alpha2_equivp(2)}) 1) *}
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   317
1190
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   318
local_setup {*
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   319
(fn ctxt => ctxt
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   320
 |> snd o (Quotient_Def.quotient_lift_const ("Vr2", @{term rVr2}))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   321
 |> snd o (Quotient_Def.quotient_lift_const ("Ap2", @{term rAp2}))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   322
 |> snd o (Quotient_Def.quotient_lift_const ("Lm2", @{term rLm2}))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   323
 |> snd o (Quotient_Def.quotient_lift_const ("Lt2", @{term rLt2}))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   324
 |> snd o (Quotient_Def.quotient_lift_const ("As", @{term rAs}))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   325
 |> snd o (Quotient_Def.quotient_lift_const ("fv_trm2", @{term fv_rtrm2}))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   326
 |> snd o (Quotient_Def.quotient_lift_const ("bv2", @{term rbv2})))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   327
*}
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   328
print_theorems
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   329
1230
a41c3a105104 rsp for bv; the only issue is that it requires an appropriate induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1227
diff changeset
   330
local_setup {* prove_const_rsp @{binding fv_rtrm2_rsp} [@{term fv_rtrm2}, @{term fv_rassign}]
a41c3a105104 rsp for bv; the only issue is that it requires an appropriate induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1227
diff changeset
   331
  (fn _ => fvbv_rsp_tac @{thm alpha_rtrm2_alpha_rassign.induct} @{thms fv_rtrm2_fv_rassign.simps} 1) *}
a41c3a105104 rsp for bv; the only issue is that it requires an appropriate induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1227
diff changeset
   332
local_setup {* prove_const_rsp @{binding rbv2_rsp} [@{term rbv2}]
a41c3a105104 rsp for bv; the only issue is that it requires an appropriate induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1227
diff changeset
   333
  (fn _ => fvbv_rsp_tac @{thm alpha_rtrm2_alpha_rassign.inducts(2)} @{thms rbv2.simps} 1) *}
a41c3a105104 rsp for bv; the only issue is that it requires an appropriate induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1227
diff changeset
   334
local_setup {* prove_const_rsp @{binding rVr2_rsp} [@{term rVr2}]
1227
ec2e0116779e rsp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1225
diff changeset
   335
  (fn _ => constr_rsp_tac @{thms alpha2_inj} @{thms fv_rtrm2_rsp} @{thms alpha2_equivp} 1) *}
1230
a41c3a105104 rsp for bv; the only issue is that it requires an appropriate induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1227
diff changeset
   336
local_setup {* prove_const_rsp @{binding rAp2_rsp} [@{term rAp2}]
1227
ec2e0116779e rsp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1225
diff changeset
   337
  (fn _ => constr_rsp_tac @{thms alpha2_inj} @{thms fv_rtrm2_rsp} @{thms alpha2_equivp} 1) *}
1230
a41c3a105104 rsp for bv; the only issue is that it requires an appropriate induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1227
diff changeset
   338
local_setup {* prove_const_rsp @{binding rLm2_rsp} [@{term rLm2}]
1227
ec2e0116779e rsp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1225
diff changeset
   339
  (fn _ => constr_rsp_tac @{thms alpha2_inj} @{thms fv_rtrm2_rsp} @{thms alpha2_equivp} 1) *}
1230
a41c3a105104 rsp for bv; the only issue is that it requires an appropriate induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1227
diff changeset
   340
local_setup {* prove_const_rsp @{binding rLt2_rsp} [@{term rLt2}]
a41c3a105104 rsp for bv; the only issue is that it requires an appropriate induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1227
diff changeset
   341
  (fn _ => constr_rsp_tac @{thms alpha2_inj} @{thms fv_rtrm2_rsp rbv2_rsp} @{thms alpha2_equivp} 1) *}
a41c3a105104 rsp for bv; the only issue is that it requires an appropriate induction principle.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1227
diff changeset
   342
local_setup {* prove_const_rsp @{binding permute_rtrm2_rsp} [@{term "permute :: perm \<Rightarrow> rtrm2 \<Rightarrow> rtrm2"}]
1227
ec2e0116779e rsp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1225
diff changeset
   343
  (fn _ => asm_simp_tac (HOL_ss addsimps @{thms alpha2_eqvt}) 1) *}
ec2e0116779e rsp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1225
diff changeset
   344
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   345
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   346
section {*** lets with many assignments ***}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   347
1206
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   348
datatype rtrm3 =
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   349
  rVr3 "name"
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   350
| rAp3 "rtrm3" "rtrm3"
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   351
| rLm3 "name" "rtrm3" --"bind (name) in (trm3)"
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   352
| rLt3 "rassigns" "rtrm3" --"bind (bv3 assigns) in (trm3)"
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   353
and rassigns =
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   354
  rANil
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   355
| rACons "name" "rtrm3" "rassigns"
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   356
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   357
(* to be given by the user *)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   358
primrec 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   359
  bv3
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   360
where
1206
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   361
  "bv3 rANil = {}"
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   362
| "bv3 (rACons x t as) = {atom x} \<union> (bv3 as)"
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   363
1206
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   364
setup {* snd o define_raw_perms ["rtrm3", "rassigns"] ["Terms.rtrm3", "Terms.rassigns"] *}
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   365
1206
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   366
local_setup {* snd o define_fv_alpha "Terms.rtrm3"
1202
ab942ba2d243 Removed bindings 'in itself' where possible.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1201
diff changeset
   367
  [[[[]], [[], []], [[(NONE, 0)], [(NONE, 0)]], [[], [(SOME @{term bv3}, 0)]]],
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   368
   [[], [[], [], []]]] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   369
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   370
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   371
notation
1206
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   372
  alpha_rtrm3 ("_ \<approx>3 _" [100, 100] 100) and
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   373
  alpha_rassigns ("_ \<approx>3a _" [100, 100] 100)
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   374
thm alpha_rtrm3_alpha_rassigns.intros
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   375
1215
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   376
local_setup {* (fn ctxt => snd (Local_Theory.note ((@{binding alpha3_inj}, []), (build_alpha_inj @{thms alpha_rtrm3_alpha_rassigns.intros} @{thms rtrm3.distinct rtrm3.inject rassigns.distinct rassigns.inject} @{thms alpha_rtrm3.cases alpha_rassigns.cases} ctxt)) ctxt)) *}
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   377
thm alpha3_inj
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   378
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   379
lemma alpha3_eqvt:
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   380
  "t \<approx>3 s \<Longrightarrow> (pi \<bullet> t) \<approx>3 (pi \<bullet> s)"
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   381
  "a \<approx>3a b \<Longrightarrow> (pi \<bullet> a) \<approx>3a (pi \<bullet> b)"
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   382
sorry
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   383
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   384
local_setup {* (fn ctxt => snd (Local_Theory.note ((@{binding alpha3_equivp}, []),
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   385
  (build_equivps [@{term alpha_rtrm3}, @{term alpha_rassigns}] @{thm rtrm3_rassigns.induct} @{thm alpha_rtrm3_alpha_rassigns.induct} @{thms rtrm3.inject rassigns.inject} @{thms alpha3_inj} @{thms rtrm3.distinct rassigns.distinct} @{thms alpha_rtrm3.cases alpha_rassigns.cases} @{thms alpha3_eqvt} ctxt)) ctxt)) *}
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   386
thm alpha3_equivp
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   387
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   388
quotient_type
1206
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   389
  trm3 = rtrm3 / alpha_rtrm3
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   390
and
1206
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   391
  assigns = rassigns / alpha_rassigns
1215
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   392
  by (rule alpha3_equivp(1)) (rule alpha3_equivp(2))
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   393
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   394
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   395
section {*** lam with indirect list recursion ***}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   396
1206
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   397
datatype rtrm4 =
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   398
  rVr4 "name"
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   399
| rAp4 "rtrm4" "rtrm4 list"
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   400
| rLm4 "name" "rtrm4"  --"bind (name) in (trm)"
1215
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   401
print_theorems
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   402
1206
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   403
thm rtrm4.recs
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   404
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   405
(* there cannot be a clause for lists, as *)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   406
(* permutations are  already defined in Nominal (also functions, options, and so on) *)
1206
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   407
setup {* snd o define_raw_perms ["rtrm4"] ["Terms.rtrm4"] *}
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   408
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   409
(* "repairing" of the permute function *)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   410
lemma repaired:
1206
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   411
  fixes ts::"rtrm4 list"
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   412
  shows "permute_rtrm4_list p ts = p \<bullet> ts"
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   413
  apply(induct ts)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   414
  apply(simp_all)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   415
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   416
1206
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   417
thm permute_rtrm4_permute_rtrm4_list.simps
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   418
thm permute_rtrm4_permute_rtrm4_list.simps[simplified repaired]
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   419
1206
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   420
local_setup {* snd o define_fv_alpha "Terms.rtrm4" [
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   421
  [[[]], [[], []], [[(NONE, 0)], [(NONE, 0)]]], [[], [[], []]]  ] *}
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   422
print_theorems
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   423
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   424
notation
1206
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   425
  alpha_rtrm4 ("_ \<approx>4 _" [100, 100] 100) and
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   426
  alpha_rtrm4_list ("_ \<approx>4l _" [100, 100] 100)
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   427
thm alpha_rtrm4_alpha_rtrm4_list.intros
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   428
1216
06ace3a1eedd Fixed pseudo_injectivity for trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1215
diff changeset
   429
local_setup {* (fn ctxt => snd (Local_Theory.note ((@{binding alpha4_inj}, []), (build_alpha_inj @{thms alpha_rtrm4_alpha_rtrm4_list.intros} @{thms rtrm4.distinct rtrm4.inject list.distinct list.inject} @{thms alpha_rtrm4.cases alpha_rtrm4_list.cases} ctxt)) ctxt)) *}
06ace3a1eedd Fixed pseudo_injectivity for trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1215
diff changeset
   430
thm alpha4_inj
1215
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   431
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   432
lemma alpha4_eqvt:
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   433
  "t \<approx>4 s \<Longrightarrow> (pi \<bullet> t) \<approx>4 (pi \<bullet> s)"
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   434
  "a \<approx>4l b \<Longrightarrow> (pi \<bullet> a) \<approx>4l (pi \<bullet> b)"
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   435
sorry
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   436
1216
06ace3a1eedd Fixed pseudo_injectivity for trm4
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1215
diff changeset
   437
local_setup {* (fn ctxt => snd (Local_Theory.note ((@{binding alpha4_equivp}, []),
1217
74e2b9b95add Fixes for auxiliary datatypes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1216
diff changeset
   438
  (build_equivps [@{term alpha_rtrm4}, @{term alpha_rtrm4_list}] @{thm rtrm4.induct} @{thm alpha_rtrm4_alpha_rtrm4_list.induct} @{thms rtrm4.inject list.inject} @{thms alpha4_inj} @{thms rtrm4.distinct list.distinct} @{thms alpha_rtrm4_list.cases alpha_rtrm4.cases} @{thms alpha4_eqvt} ctxt)) ctxt)) *}
74e2b9b95add Fixes for auxiliary datatypes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1216
diff changeset
   439
thm alpha4_equivp
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   440
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   441
quotient_type 
1206
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   442
  qrtrm4 = rtrm4 / alpha_rtrm4 and
9c968284553c Renaming.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1205
diff changeset
   443
  qrtrm4list = "rtrm4 list" / alpha_rtrm4_list
1217
74e2b9b95add Fixes for auxiliary datatypes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1216
diff changeset
   444
  by (simp_all add: alpha4_equivp)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   445
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   446
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   447
datatype rtrm5 =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   448
  rVr5 "name"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   449
| rAp5 "rtrm5" "rtrm5"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   450
| rLt5 "rlts" "rtrm5" --"bind (bv5 lts) in (rtrm5)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   451
and rlts =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   452
  rLnil
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   453
| rLcons "name" "rtrm5" "rlts"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   454
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   455
primrec
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   456
  rbv5
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   457
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   458
  "rbv5 rLnil = {}"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   459
| "rbv5 (rLcons n t ltl) = {atom n} \<union> (rbv5 ltl)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   460
1186
166cc41091b9 The alternate version of trm5 with additional binding. All proofs work the same.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1185
diff changeset
   461
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   462
setup {* snd o define_raw_perms ["rtrm5", "rlts"] ["Terms.rtrm5", "Terms.rlts"] *}
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   463
print_theorems
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   464
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   465
local_setup {* snd o define_fv_alpha "Terms.rtrm5" [
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   466
  [[[]], [[], []], [[(SOME @{term rbv5}, 0)], [(SOME @{term rbv5}, 0)]]], [[], [[], [], []]]  ] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   467
print_theorems
1187
3b24f33aedad Changed back to original version of trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1186
diff changeset
   468
1186
166cc41091b9 The alternate version of trm5 with additional binding. All proofs work the same.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1185
diff changeset
   469
(* Alternate version with additional binding of name in rlts in rLcons *)
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   470
(*local_setup {* snd o define_fv_alpha "Terms.rtrm5" [
1186
166cc41091b9 The alternate version of trm5 with additional binding. All proofs work the same.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1185
diff changeset
   471
  [[[]], [[], []], [[(SOME @{term rbv5}, 0)], [(SOME @{term rbv5}, 0)]]], [[], [[(NONE,0)], [], [(NONE,0)]]]  ] *}
1187
3b24f33aedad Changed back to original version of trm5
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1186
diff changeset
   472
print_theorems*)
1186
166cc41091b9 The alternate version of trm5 with additional binding. All proofs work the same.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1185
diff changeset
   473
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   474
notation
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   475
  alpha_rtrm5 ("_ \<approx>5 _" [100, 100] 100) and
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   476
  alpha_rlts ("_ \<approx>l _" [100, 100] 100)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   477
thm alpha_rtrm5_alpha_rlts.intros
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   478
1199
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
   479
local_setup {* (fn ctxt => snd (Local_Theory.note ((@{binding alpha5_inj}, []), (build_alpha_inj @{thms alpha_rtrm5_alpha_rlts.intros} @{thms rtrm5.distinct rtrm5.inject rlts.distinct rlts.inject} @{thms alpha_rtrm5.cases alpha_rlts.cases} ctxt)) ctxt)) *}
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
   480
thm alpha5_inj
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   481
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   482
lemma rbv5_eqvt:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   483
  "pi \<bullet> (rbv5 x) = rbv5 (pi \<bullet> x)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   484
sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   485
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   486
lemma fv_rtrm5_eqvt:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   487
  "pi \<bullet> (fv_rtrm5 x) = fv_rtrm5 (pi \<bullet> x)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   488
sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   489
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   490
lemma fv_rlts_eqvt:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   491
  "pi \<bullet> (fv_rlts x) = fv_rlts (pi \<bullet> x)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   492
sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   493
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   494
lemma alpha5_eqvt:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   495
  "xa \<approx>5 y \<Longrightarrow> (x \<bullet> xa) \<approx>5 (x \<bullet> y)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   496
  "xb \<approx>l ya \<Longrightarrow> (x \<bullet> xb) \<approx>l (x \<bullet> ya)"
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   497
  apply(induct rule: alpha_rtrm5_alpha_rlts.inducts)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   498
  apply (simp_all add: alpha5_inj)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   499
  apply (erule exE)+
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   500
  apply(unfold alpha_gen)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   501
  apply (erule conjE)+
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   502
  apply (rule conjI)
1199
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
   503
  apply (rule_tac x="x \<bullet> pi" in exI)
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
   504
  apply (rule conjI)
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
   505
  apply(rule_tac ?p1="- x" in permute_eq_iff[THEN iffD1])
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
   506
  apply(simp add: atom_eqvt Diff_eqvt insert_eqvt set_eqvt empty_eqvt rbv5_eqvt fv_rlts_eqvt)
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
   507
  apply(rule conjI)
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
   508
  apply(rule_tac ?p1="- x" in fresh_star_permute_iff[THEN iffD1])
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
   509
  apply(simp add: atom_eqvt Diff_eqvt insert_eqvt set_eqvt empty_eqvt rbv5_eqvt fv_rlts_eqvt)
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
   510
  apply (subst permute_eqvt[symmetric])
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
   511
  apply (simp)
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   512
  apply (rule_tac x="x \<bullet> pia" in exI)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   513
  apply (rule conjI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   514
  apply(rule_tac ?p1="- x" in permute_eq_iff[THEN iffD1])
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   515
  apply(simp add: atom_eqvt Diff_eqvt insert_eqvt set_eqvt empty_eqvt rbv5_eqvt fv_rtrm5_eqvt)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   516
  apply(rule conjI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   517
  apply(rule_tac ?p1="- x" in fresh_star_permute_iff[THEN iffD1])
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   518
  apply(simp add: atom_eqvt Diff_eqvt insert_eqvt set_eqvt empty_eqvt rbv5_eqvt fv_rtrm5_eqvt)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   519
  apply (subst permute_eqvt[symmetric])
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   520
  apply (simp)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   521
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   522
1215
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   523
local_setup {* (fn ctxt => snd (Local_Theory.note ((@{binding alpha5_equivp}, []),
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   524
  (build_equivps [@{term alpha_rtrm5}, @{term alpha_rlts}] @{thm rtrm5_rlts.induct} @{thm alpha_rtrm5_alpha_rlts.induct} @{thms rtrm5.inject rlts.inject} @{thms alpha5_inj} @{thms rtrm5.distinct rlts.distinct} @{thms alpha_rtrm5.cases alpha_rlts.cases} @{thms alpha5_eqvt} ctxt)) ctxt)) *}
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   525
thm alpha5_equivp
1213
43bd70786f9f More equivp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1212
diff changeset
   526
43bd70786f9f More equivp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1212
diff changeset
   527
quotient_type
43bd70786f9f More equivp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1212
diff changeset
   528
  trm5 = rtrm5 / alpha_rtrm5
43bd70786f9f More equivp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1212
diff changeset
   529
and
43bd70786f9f More equivp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1212
diff changeset
   530
  lts = rlts / alpha_rlts
1215
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   531
  by (auto intro: alpha5_equivp)
1213
43bd70786f9f More equivp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1212
diff changeset
   532
43bd70786f9f More equivp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1212
diff changeset
   533
local_setup {*
43bd70786f9f More equivp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1212
diff changeset
   534
(fn ctxt => ctxt
43bd70786f9f More equivp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1212
diff changeset
   535
 |> snd o (Quotient_Def.quotient_lift_const ("Vr5", @{term rVr5}))
43bd70786f9f More equivp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1212
diff changeset
   536
 |> snd o (Quotient_Def.quotient_lift_const ("Ap5", @{term rAp5}))
43bd70786f9f More equivp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1212
diff changeset
   537
 |> snd o (Quotient_Def.quotient_lift_const ("Lt5", @{term rLt5}))
43bd70786f9f More equivp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1212
diff changeset
   538
 |> snd o (Quotient_Def.quotient_lift_const ("Lnil", @{term rLnil}))
43bd70786f9f More equivp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1212
diff changeset
   539
 |> snd o (Quotient_Def.quotient_lift_const ("Lcons", @{term rLcons}))
43bd70786f9f More equivp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1212
diff changeset
   540
 |> snd o (Quotient_Def.quotient_lift_const ("fv_trm5", @{term fv_rtrm5}))
43bd70786f9f More equivp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1212
diff changeset
   541
 |> snd o (Quotient_Def.quotient_lift_const ("fv_lts", @{term fv_rlts}))
43bd70786f9f More equivp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1212
diff changeset
   542
 |> snd o (Quotient_Def.quotient_lift_const ("bv5", @{term rbv5})))
43bd70786f9f More equivp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1212
diff changeset
   543
*}
43bd70786f9f More equivp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1212
diff changeset
   544
print_theorems
43bd70786f9f More equivp infrastructure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1212
diff changeset
   545
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   546
lemma alpha5_rfv:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   547
  "(t \<approx>5 s \<Longrightarrow> fv_rtrm5 t = fv_rtrm5 s)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   548
  "(l \<approx>l m \<Longrightarrow> fv_rlts l = fv_rlts m)"
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   549
  apply(induct rule: alpha_rtrm5_alpha_rlts.inducts)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   550
  apply(simp_all add: alpha_gen)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   551
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   552
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   553
lemma bv_list_rsp:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   554
  shows "x \<approx>l y \<Longrightarrow> rbv5 x = rbv5 y"
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   555
  apply(induct rule: alpha_rtrm5_alpha_rlts.inducts(2))
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   556
  apply(simp_all)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   557
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   558
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   559
lemma [quot_respect]:
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   560
  "(alpha_rlts ===> op =) fv_rlts fv_rlts"
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   561
  "(alpha_rtrm5 ===> op =) fv_rtrm5 fv_rtrm5"
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   562
  "(alpha_rlts ===> op =) rbv5 rbv5"
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   563
  "(op = ===> alpha_rtrm5) rVr5 rVr5"
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   564
  "(alpha_rtrm5 ===> alpha_rtrm5 ===> alpha_rtrm5) rAp5 rAp5"
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   565
  "(alpha_rlts ===> alpha_rtrm5 ===> alpha_rtrm5) rLt5 rLt5"
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   566
  "(op = ===> alpha_rtrm5 ===> alpha_rlts ===> alpha_rlts) rLcons rLcons"
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   567
  "(op = ===> alpha_rtrm5 ===> alpha_rtrm5) permute permute"
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   568
  "(op = ===> alpha_rlts ===> alpha_rlts) permute permute"
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   569
  apply (simp_all add: alpha5_inj alpha5_rfv alpha5_eqvt bv_list_rsp)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   570
  apply (clarify) apply (rule conjI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   571
  apply (rule_tac x="0" in exI) apply (simp add: fresh_star_def fresh_zero_perm alpha_gen alpha5_rfv)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   572
  apply (rule_tac x="0" in exI) apply (simp add: fresh_star_def fresh_zero_perm alpha_gen alpha5_rfv)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   573
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   574
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   575
lemma
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   576
  shows "(alpha_rlts ===> op =) rbv5 rbv5"
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   577
  by (simp add: bv_list_rsp)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   578
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   579
lemmas trm5_lts_inducts = rtrm5_rlts.inducts[quot_lifted]
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   580
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   581
instantiation trm5 and lts :: pt
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   582
begin
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   583
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   584
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   585
  "permute_trm5 :: perm \<Rightarrow> trm5 \<Rightarrow> trm5"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   586
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   587
  "permute :: perm \<Rightarrow> rtrm5 \<Rightarrow> rtrm5"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   588
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   589
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   590
  "permute_lts :: perm \<Rightarrow> lts \<Rightarrow> lts"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   591
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   592
  "permute :: perm \<Rightarrow> rlts \<Rightarrow> rlts"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   593
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   594
lemma trm5_lts_zero:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   595
  "0 \<bullet> (x\<Colon>trm5) = x"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   596
  "0 \<bullet> (y\<Colon>lts) = y"
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   597
  apply(induct x and y rule: trm5_lts_inducts)
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   598
  apply(simp_all add: permute_rtrm5_permute_rlts.simps[quot_lifted])
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   599
  done
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   600
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   601
lemma trm5_lts_plus:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   602
  "(p + q) \<bullet> (x\<Colon>trm5) = p \<bullet> q \<bullet> x"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   603
  "(p + q) \<bullet> (y\<Colon>lts) = p \<bullet> q \<bullet> y"
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   604
  apply(induct x and y rule: trm5_lts_inducts)
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   605
  apply(simp_all add: permute_rtrm5_permute_rlts.simps[quot_lifted])
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   606
  done
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   607
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   608
instance
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   609
  apply default
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   610
  apply (simp_all add: trm5_lts_zero trm5_lts_plus)
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   611
  done
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   612
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   613
end
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   614
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   615
lemmas 
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   616
  permute_trm5_lts = permute_rtrm5_permute_rlts.simps[quot_lifted]
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   617
and
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   618
  alpha5_INJ = alpha5_inj[unfolded alpha_gen, quot_lifted, folded alpha_gen]
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   619
and
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   620
  bv5[simp] = rbv5.simps[quot_lifted]
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   621
and
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   622
  fv_trm5_lts[simp] = fv_rtrm5_fv_rlts.simps[quot_lifted]
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   623
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   624
lemma lets_ok:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   625
  "(Lt5 (Lcons x (Vr5 x) Lnil) (Vr5 x)) = (Lt5 (Lcons y (Vr5 y) Lnil) (Vr5 y))"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   626
apply (subst alpha5_INJ)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   627
apply (rule conjI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   628
apply (rule_tac x="(x \<leftrightarrow> y)" in exI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   629
apply (simp only: alpha_gen)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   630
apply (simp add: permute_trm5_lts fresh_star_def)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   631
apply (rule_tac x="(x \<leftrightarrow> y)" in exI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   632
apply (simp only: alpha_gen)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   633
apply (simp add: permute_trm5_lts fresh_star_def)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   634
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   635
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   636
lemma lets_ok2:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   637
  "(Lt5 (Lcons x (Vr5 x) (Lcons y (Vr5 y) Lnil)) (Ap5 (Vr5 x) (Vr5 y))) =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   638
   (Lt5 (Lcons y (Vr5 y) (Lcons x (Vr5 x) Lnil)) (Ap5 (Vr5 x) (Vr5 y)))"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   639
apply (subst alpha5_INJ)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   640
apply (rule conjI)
1199
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
   641
apply (rule_tac x="(x \<leftrightarrow> y)" in exI)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   642
apply (simp only: alpha_gen)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   643
apply (simp add: permute_trm5_lts fresh_star_def)
1199
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
   644
apply (rule_tac x="0 :: perm" in exI)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   645
apply (simp only: alpha_gen)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   646
apply (simp add: permute_trm5_lts fresh_star_def)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   647
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   648
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   649
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   650
lemma lets_not_ok1:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   651
  "x \<noteq> y \<Longrightarrow> (Lt5 (Lcons x (Vr5 x) (Lcons y (Vr5 y) Lnil)) (Ap5 (Vr5 x) (Vr5 y))) \<noteq>
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   652
             (Lt5 (Lcons y (Vr5 x) (Lcons x (Vr5 y) Lnil)) (Ap5 (Vr5 x) (Vr5 y)))"
1200
a94c04c4a720 proof cleaning and standardizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1199
diff changeset
   653
apply (simp add: alpha5_INJ(3) alpha_gen)
a94c04c4a720 proof cleaning and standardizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1199
diff changeset
   654
apply (simp add: permute_trm5_lts fresh_star_def alpha5_INJ(5) alpha5_INJ(2) alpha5_INJ(1))
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   655
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   656
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   657
lemma distinct_helper:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   658
  shows "\<not>(rVr5 x \<approx>5 rAp5 y z)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   659
  apply auto
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   660
  apply (erule alpha_rtrm5.cases)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   661
  apply (simp_all only: rtrm5.distinct)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   662
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   663
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   664
lemma distinct_helper2:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   665
  shows "(Vr5 x) \<noteq> (Ap5 y z)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   666
  by (lifting distinct_helper)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   667
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   668
lemma lets_nok:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   669
  "x \<noteq> y \<Longrightarrow> x \<noteq> z \<Longrightarrow> z \<noteq> y \<Longrightarrow>
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   670
   (Lt5 (Lcons x (Ap5 (Vr5 z) (Vr5 z)) (Lcons y (Vr5 z) Lnil)) (Ap5 (Vr5 x) (Vr5 y))) \<noteq>
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   671
   (Lt5 (Lcons y (Vr5 z) (Lcons x (Ap5 (Vr5 z) (Vr5 z)) Lnil)) (Ap5 (Vr5 x) (Vr5 y)))"
1200
a94c04c4a720 proof cleaning and standardizing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1199
diff changeset
   672
apply (simp only: alpha5_INJ(3) alpha5_INJ(5) alpha_gen permute_trm5_lts fresh_star_def)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   673
apply (simp add: distinct_helper2)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   674
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   675
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   676
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   677
(* example with a bn function defined over the type itself *)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   678
datatype rtrm6 =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   679
  rVr6 "name"
1205
acbf50e8eac2 Added missing description.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1202
diff changeset
   680
| rLm6 "name" "rtrm6" --"bind name in rtrm6"
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   681
| rLt6 "rtrm6" "rtrm6" --"bind (bv6 left) in (right)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   682
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   683
primrec
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   684
  rbv6
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   685
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   686
  "rbv6 (rVr6 n) = {}"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   687
| "rbv6 (rLm6 n t) = {atom n} \<union> rbv6 t"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   688
| "rbv6 (rLt6 l r) = rbv6 l \<union> rbv6 r"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   689
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   690
setup {* snd o define_raw_perms ["rtrm6"] ["Terms.rtrm6"] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   691
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   692
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   693
local_setup {* snd o define_fv_alpha "Terms.rtrm6" [
1202
ab942ba2d243 Removed bindings 'in itself' where possible.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1201
diff changeset
   694
  [[[]], [[(NONE, 0)], [(NONE, 0)]], [[], [(SOME @{term rbv6}, 0)]]]] *}
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   695
notation alpha_rtrm6 ("_ \<approx>6 _" [100, 100] 100)
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   696
(* HERE THE RULES DIFFER *)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   697
thm alpha_rtrm6.intros
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   698
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   699
local_setup {* (fn ctxt => snd (Local_Theory.note ((@{binding alpha6_inj}, []), (build_alpha_inj @{thms alpha_rtrm6.intros} @{thms rtrm6.distinct rtrm6.inject} @{thms alpha_rtrm6.cases} ctxt)) ctxt)) *}
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   700
thm alpha6_inj
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   701
1215
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   702
lemma alpha6_eqvt:
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   703
  "xa \<approx>6 y \<Longrightarrow> (x \<bullet> xa) \<approx>6 (x \<bullet> y)"
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   704
sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   705
1215
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   706
local_setup {* (fn ctxt => snd (Local_Theory.note ((@{binding alpha6_equivp}, []),
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   707
  (build_equivps [@{term alpha_rtrm6}] @{thm rtrm6.induct} @{thm alpha_rtrm6.induct} @{thms rtrm6.inject} @{thms alpha6_inj} @{thms rtrm6.distinct} @{thms alpha_rtrm6.cases} @{thms alpha6_eqvt} ctxt)) ctxt)) *}
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   708
thm alpha6_equivp
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   709
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   710
quotient_type
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   711
  trm6 = rtrm6 / alpha_rtrm6
1215
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   712
  by (auto intro: alpha6_equivp)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   713
1190
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   714
local_setup {*
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   715
(fn ctxt => ctxt
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   716
 |> snd o (Quotient_Def.quotient_lift_const ("Vr6", @{term rVr6}))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   717
 |> snd o (Quotient_Def.quotient_lift_const ("Lm6", @{term rLm6}))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   718
 |> snd o (Quotient_Def.quotient_lift_const ("Lt6", @{term rLt6}))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   719
 |> snd o (Quotient_Def.quotient_lift_const ("fv_trm6", @{term fv_rtrm6}))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   720
 |> snd o (Quotient_Def.quotient_lift_const ("bv6", @{term rbv6})))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   721
*}
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   722
print_theorems
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   723
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   724
lemma [quot_respect]:
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   725
  "(op = ===> alpha_rtrm6 ===> alpha_rtrm6) permute permute"
1215
aec9576b3950 Testing auto equivp code.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1214
diff changeset
   726
by (auto simp add: alpha6_eqvt)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   727
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   728
(* Definitely not true , see lemma below *)
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   729
lemma [quot_respect]:"(alpha_rtrm6 ===> op =) rbv6 rbv6"
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   730
apply simp apply clarify
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   731
apply (erule alpha_rtrm6.induct)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   732
oops
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   733
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   734
lemma "(a :: name) \<noteq> b \<Longrightarrow> \<not> (alpha_rtrm6 ===> op =) rbv6 rbv6"
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   735
apply simp
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   736
apply (rule_tac x="rLm6 (a::name) (rVr6 (a :: name))" in  exI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   737
apply (rule_tac x="rLm6 (b::name) (rVr6 (b :: name))" in  exI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   738
apply simp
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   739
apply (simp add: alpha6_inj)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   740
apply (rule_tac x="(a \<leftrightarrow> b)" in  exI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   741
apply (simp add: alpha_gen fresh_star_def)
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   742
apply (simp add: alpha6_inj)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   743
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   744
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   745
lemma fv6_rsp: "x \<approx>6 y \<Longrightarrow> fv_rtrm6 x = fv_rtrm6 y"
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   746
apply (induct_tac x y rule: alpha_rtrm6.induct)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   747
apply simp_all
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   748
apply (erule exE)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   749
apply (simp_all add: alpha_gen)
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   750
done
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   751
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   752
lemma [quot_respect]:"(alpha_rtrm6 ===> op =) fv_rtrm6 fv_rtrm6"
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   753
by (simp add: fv6_rsp)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   754
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   755
lemma [quot_respect]:
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   756
 "(op = ===> alpha_rtrm6) rVr6 rVr6"
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   757
 "(op = ===> alpha_rtrm6 ===> alpha_rtrm6) rLm6 rLm6"
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   758
apply auto
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   759
apply (simp_all add: alpha6_inj)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   760
apply (rule_tac x="0::perm" in exI)
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   761
apply (simp add: alpha_gen fv6_rsp fresh_star_def fresh_zero_perm)
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   762
done
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   763
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   764
lemma [quot_respect]:
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   765
 "(alpha_rtrm6 ===> alpha_rtrm6 ===> alpha_rtrm6) rLt6 rLt6"
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   766
apply auto
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   767
apply (simp_all add: alpha6_inj)
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   768
apply (rule_tac [!] x="0::perm" in exI)
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   769
apply (simp_all add: alpha_gen fresh_star_def fresh_zero_perm)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   770
(* needs rbv6_rsp *)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   771
oops
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   772
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   773
instantiation trm6 :: pt begin
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   774
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   775
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   776
  "permute_trm6 :: perm \<Rightarrow> trm6 \<Rightarrow> trm6"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   777
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   778
  "permute :: perm \<Rightarrow> rtrm6 \<Rightarrow> rtrm6"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   779
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   780
instance
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   781
apply default
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   782
sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   783
end
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   784
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   785
lemma lifted_induct:
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   786
"\<lbrakk>x1 = x2; \<And>name namea. name = namea \<Longrightarrow> P (Vr6 name) (Vr6 namea);
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   787
 \<And>name rtrm6 namea rtrm6a.
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   788
    \<lbrakk>True;
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   789
     \<exists>pi. fv_trm6 rtrm6 - {atom name} = fv_trm6 rtrm6a - {atom namea} \<and>
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   790
          (fv_trm6 rtrm6 - {atom name}) \<sharp>* pi \<and> pi \<bullet> rtrm6 = rtrm6a \<and> P (pi \<bullet> rtrm6) rtrm6a\<rbrakk>
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   791
    \<Longrightarrow> P (Lm6 name rtrm6) (Lm6 namea rtrm6a);
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   792
 \<And>rtrm61 rtrm61a rtrm62 rtrm62a.
1202
ab942ba2d243 Removed bindings 'in itself' where possible.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1201
diff changeset
   793
    \<lbrakk>rtrm61 = rtrm61a; P rtrm61 rtrm61a;
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   794
     \<exists>pi. fv_trm6 rtrm62 - bv6 rtrm61 = fv_trm6 rtrm62a - bv6 rtrm61a \<and>
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   795
          (fv_trm6 rtrm62 - bv6 rtrm61) \<sharp>* pi \<and> pi \<bullet> rtrm62 = rtrm62a \<and> P (pi \<bullet> rtrm62) rtrm62a\<rbrakk>
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   796
    \<Longrightarrow> P (Lt6 rtrm61 rtrm62) (Lt6 rtrm61a rtrm62a)\<rbrakk>
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   797
\<Longrightarrow> P x1 x2"
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   798
apply (lifting alpha_rtrm6.induct[unfolded alpha_gen])
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   799
apply injection
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   800
(* notice unsolvable goals: (alpha_rtrm6 ===> op =) rbv6 rbv6 *)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   801
oops
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   802
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   803
lemma lifted_inject_a3:
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   804
"(Lt6 rtrm61 rtrm62 = Lt6 rtrm61a rtrm62a) =
1202
ab942ba2d243 Removed bindings 'in itself' where possible.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1201
diff changeset
   805
(rtrm61 = rtrm61a \<and>
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   806
 (\<exists>pi. fv_trm6 rtrm62 - bv6 rtrm61 = fv_trm6 rtrm62a - bv6 rtrm61a \<and>
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   807
       (fv_trm6 rtrm62 - bv6 rtrm61) \<sharp>* pi \<and> pi \<bullet> rtrm62 = rtrm62a))"
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   808
apply(lifting alpha6_inj(3)[unfolded alpha_gen])
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   809
apply injection
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   810
(* notice unsolvable goals: (alpha_rtrm6 ===> op =) rbv6 rbv6 *)
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   811
oops
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   812
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   813
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   814
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   815
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   816
(* example with a respectful bn function defined over the type itself *)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   817
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   818
datatype rtrm7 =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   819
  rVr7 "name"
1198
5523d5713a65 Experiments for the pseudo-injectivity tactic.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1197
diff changeset
   820
| rLm7 "name" "rtrm7" --"bind left in right"
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   821
| rLt7 "rtrm7" "rtrm7" --"bind (bv7 left) in (right)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   822
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   823
primrec
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   824
  rbv7
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   825
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   826
  "rbv7 (rVr7 n) = {atom n}"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   827
| "rbv7 (rLm7 n t) = rbv7 t - {atom n}"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   828
| "rbv7 (rLt7 l r) = rbv7 l \<union> rbv7 r"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   829
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   830
setup {* snd o define_raw_perms ["rtrm7"] ["Terms.rtrm7"] *}
1201
6d2200603585 Some adaptation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1200
diff changeset
   831
thm permute_rtrm7.simps
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   832
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   833
local_setup {* snd o define_fv_alpha "Terms.rtrm7" [
1202
ab942ba2d243 Removed bindings 'in itself' where possible.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1201
diff changeset
   834
  [[[]], [[(NONE, 0)], [(NONE, 0)]], [[], [(SOME @{term rbv7}, 0)]]]] *}
1198
5523d5713a65 Experiments for the pseudo-injectivity tactic.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1197
diff changeset
   835
print_theorems
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   836
notation
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   837
  alpha_rtrm7 ("_ \<approx>7a _" [100, 100] 100)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   838
(* HERE THE RULES DIFFER *)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   839
thm alpha_rtrm7.intros
1198
5523d5713a65 Experiments for the pseudo-injectivity tactic.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1197
diff changeset
   840
thm fv_rtrm7.simps
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   841
inductive
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   842
  alpha7 :: "rtrm7 \<Rightarrow> rtrm7 \<Rightarrow> bool" ("_ \<approx>7 _" [100, 100] 100)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   843
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   844
  a1: "a = b \<Longrightarrow> (rVr7 a) \<approx>7 (rVr7 b)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   845
| a2: "(\<exists>pi. (({atom a}, t) \<approx>gen alpha7 fv_rtrm7 pi ({atom b}, s))) \<Longrightarrow> rLm7 a t \<approx>7 rLm7 b s"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   846
| a3: "(\<exists>pi. (((rbv7 t1), s1) \<approx>gen alpha7 fv_rtrm7 pi ((rbv7 t2), s2))) \<Longrightarrow> rLt7 t1 s1 \<approx>7 rLt7 t2 s2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   847
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   848
lemma "(x::name) \<noteq> y \<Longrightarrow> \<not> (alpha7 ===> op =) rbv7 rbv7"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   849
  apply simp
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   850
  apply (rule_tac x="rLt7 (rVr7 x) (rVr7 x)" in exI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   851
  apply (rule_tac x="rLt7 (rVr7 y) (rVr7 y)" in exI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   852
  apply simp
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   853
  apply (rule a3)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   854
  apply (rule_tac x="(x \<leftrightarrow> y)" in exI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   855
  apply (simp_all add: alpha_gen fresh_star_def)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   856
  apply (rule a1)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   857
  apply (rule refl)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   858
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   859
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   860
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   861
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   862
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   863
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   864
datatype rfoo8 =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   865
  Foo0 "name"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   866
| Foo1 "rbar8" "rfoo8" --"bind bv(bar) in foo"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   867
and rbar8 =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   868
  Bar0 "name"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   869
| Bar1 "name" "name" "rbar8" --"bind second name in b"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   870
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   871
primrec
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   872
  rbv8
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   873
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   874
  "rbv8 (Bar0 x) = {}"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   875
| "rbv8 (Bar1 v x b) = {atom v}"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   876
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   877
setup {* snd o define_raw_perms ["rfoo8", "rbar8"] ["Terms.rfoo8", "Terms.rbar8"] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   878
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   879
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   880
local_setup {* snd o define_fv_alpha "Terms.rfoo8" [
1202
ab942ba2d243 Removed bindings 'in itself' where possible.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1201
diff changeset
   881
  [[[]], [[], [(SOME @{term rbv8}, 0)]]], [[[]], [[], [(NONE, 1)], [(NONE, 1)]]]] *}
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   882
notation
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   883
  alpha_rfoo8 ("_ \<approx>f' _" [100, 100] 100) and
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   884
  alpha_rbar8 ("_ \<approx>b' _" [100, 100] 100)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   885
(* HERE THE RULE DIFFERS *)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   886
thm alpha_rfoo8_alpha_rbar8.intros
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   887
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   888
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   889
inductive
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   890
  alpha8f :: "rfoo8 \<Rightarrow> rfoo8 \<Rightarrow> bool" ("_ \<approx>f _" [100, 100] 100)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   891
and
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   892
  alpha8b :: "rbar8 \<Rightarrow> rbar8 \<Rightarrow> bool" ("_ \<approx>b _" [100, 100] 100)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   893
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   894
  a1: "a = b \<Longrightarrow> (Foo0 a) \<approx>f (Foo0 b)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   895
| a2: "a = b \<Longrightarrow> (Bar0 a) \<approx>b (Bar0 b)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   896
| a3: "b1 \<approx>b b2 \<Longrightarrow> (\<exists>pi. (((rbv8 b1), t1) \<approx>gen alpha8f fv_rfoo8 pi ((rbv8 b2), t2))) \<Longrightarrow> Foo1 b1 t1 \<approx>f Foo1 b2 t2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   897
| a4: "v1 = v2 \<Longrightarrow> (\<exists>pi. (({atom x1}, t1) \<approx>gen alpha8b fv_rbar8 pi ({atom x2}, t2))) \<Longrightarrow> Bar1 v1 x1 t1 \<approx>b Bar1 v2 x2 t2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   898
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   899
lemma "(alpha8b ===> op =) rbv8 rbv8"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   900
  apply simp apply clarify
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   901
  apply (erule alpha8f_alpha8b.inducts(2))
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   902
  apply (simp_all)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   903
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   904
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   905
lemma fv_rbar8_rsp_hlp: "x \<approx>b y \<Longrightarrow> fv_rbar8 x = fv_rbar8 y"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   906
  apply (erule alpha8f_alpha8b.inducts(2))
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   907
  apply (simp_all add: alpha_gen)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   908
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   909
lemma "(alpha8b ===> op =) fv_rbar8 fv_rbar8"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   910
  apply simp apply clarify apply (simp add: fv_rbar8_rsp_hlp)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   911
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   912
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   913
lemma "(alpha8f ===> op =) fv_rfoo8 fv_rfoo8"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   914
  apply simp apply clarify
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   915
  apply (erule alpha8f_alpha8b.inducts(1))
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   916
  apply (simp_all add: alpha_gen fv_rbar8_rsp_hlp)
1183
cb3da5b540f2 Fixed proofs in Terms2 and found a mistake in Terms.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1182
diff changeset
   917
done
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   918
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   919
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   920
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   921
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   922
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   923
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   924
datatype rlam9 =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   925
  Var9 "name"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   926
| Lam9 "name" "rlam9" --"bind name in rlam"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   927
and rbla9 =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   928
  Bla9 "rlam9" "rlam9" --"bind bv(first) in second"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   929
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   930
primrec
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   931
  rbv9
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   932
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   933
  "rbv9 (Var9 x) = {}"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   934
| "rbv9 (Lam9 x b) = {atom x}"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   935
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   936
setup {* snd o define_raw_perms ["rlam9", "rbla9"] ["Terms.rlam9", "Terms.rbla9"] *}
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   937
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   938
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   939
local_setup {* snd o define_fv_alpha "Terms.rlam9" [
1202
ab942ba2d243 Removed bindings 'in itself' where possible.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1201
diff changeset
   940
  [[[]], [[(NONE, 0)], [(NONE, 0)]]], [[[], [(SOME @{term rbv9}, 0)]]]] *}
1193
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   941
notation
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   942
  alpha_rlam9 ("_ \<approx>9l' _" [100, 100] 100) and
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   943
  alpha_rbla9 ("_ \<approx>9b' _" [100, 100] 100)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   944
(* HERE THE RULES DIFFER *)
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   945
thm alpha_rlam9_alpha_rbla9.intros
a228acf2907e Full alpha equivalence + testing in terms. Some differ but it seems the generated version is more correct.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1190
diff changeset
   946
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   947
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   948
inductive
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   949
  alpha9l :: "rlam9 \<Rightarrow> rlam9 \<Rightarrow> bool" ("_ \<approx>9l _" [100, 100] 100)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   950
and
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   951
  alpha9b :: "rbla9 \<Rightarrow> rbla9 \<Rightarrow> bool" ("_ \<approx>9b _" [100, 100] 100)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   952
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   953
  a1: "a = b \<Longrightarrow> (Var9 a) \<approx>9l (Var9 b)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   954
| a4: "(\<exists>pi. (({atom x1}, t1) \<approx>gen alpha9l fv_rlam9 pi ({atom x2}, t2))) \<Longrightarrow> Lam9 x1 t1 \<approx>9l Lam9 x2 t2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   955
| a3: "b1 \<approx>9l b2 \<Longrightarrow> (\<exists>pi. (((rbv9 b1), t1) \<approx>gen alpha9l fv_rlam9 pi ((rbv9 b2), t2))) \<Longrightarrow> Bla9 b1 t1 \<approx>9b Bla9 b2 t2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   956
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   957
quotient_type
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   958
  lam9 = rlam9 / alpha9l and bla9 = rbla9 / alpha9b
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   959
sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   960
1190
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   961
local_setup {*
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   962
(fn ctxt => ctxt
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   963
 |> snd o (Quotient_Def.quotient_lift_const ("qVar9", @{term Var9}))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   964
 |> snd o (Quotient_Def.quotient_lift_const ("qLam9", @{term Lam9}))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   965
 |> snd o (Quotient_Def.quotient_lift_const ("qBla9", @{term Bla9}))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   966
 |> snd o (Quotient_Def.quotient_lift_const ("fv_lam9", @{term fv_rlam9}))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   967
 |> snd o (Quotient_Def.quotient_lift_const ("fv_bla9", @{term fv_rbla9}))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   968
 |> snd o (Quotient_Def.quotient_lift_const ("bv9", @{term rbv9})))
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   969
*}
d900d19931fa Testing auto constant lifting.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1187
diff changeset
   970
print_theorems
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   971
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   972
instantiation lam9 and bla9 :: pt
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   973
begin
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   974
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   975
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   976
  "permute_lam9 :: perm \<Rightarrow> lam9 \<Rightarrow> lam9"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   977
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   978
  "permute :: perm \<Rightarrow> rlam9 \<Rightarrow> rlam9"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   979
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   980
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   981
  "permute_bla9 :: perm \<Rightarrow> bla9 \<Rightarrow> bla9"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   982
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   983
  "permute :: perm \<Rightarrow> rbla9 \<Rightarrow> rbla9"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   984
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   985
instance
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   986
sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   987
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   988
end
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   989
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   990
lemma "\<lbrakk>b1 = b2; \<exists>pi. fv_lam9 t1 - bv9 b1 = fv_lam9 t2 - bv9 b2 \<and> (fv_lam9 t1 - bv9 b1) \<sharp>* pi \<and> pi \<bullet> t1 = t2\<rbrakk>
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   991
 \<Longrightarrow> qBla9 b1 t1 = qBla9 b2 t2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   992
apply (lifting a3[unfolded alpha_gen])
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   993
apply injection
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   994
sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   995
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   996
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   997
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   998
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   999
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1000
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1001
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1002
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1003
text {* type schemes *} 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1004
datatype ty = 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1005
  Var "name" 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1006
| Fun "ty" "ty"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1007
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1008
setup {* snd o define_raw_perms ["ty"] ["Terms.ty"] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1009
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1010
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1011
datatype tyS = 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1012
  All "name set" "ty" 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1013
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1014
setup {* snd o define_raw_perms ["tyS"] ["Terms.tyS"] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1015
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1016
1199
5770c73f2415 Automatic production and proving of pseudo-injectivity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1198
diff changeset
  1017
local_setup {* snd o define_fv_alpha "Terms.ty" [[[[]], [[], []]]] *}
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1018
print_theorems 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1019
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1020
(*
1185
7566b899ca6a Code for handling atom sets.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1184
diff changeset
  1021
Doesnot work yet since we do not refer to fv_ty
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1022
local_setup {* define_raw_fv "Terms.tyS" [[[[], []]]] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1023
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1024
*)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1025
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1026
primrec
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1027
  fv_tyS
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1028
where 
1185
7566b899ca6a Code for handling atom sets.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1184
diff changeset
  1029
  "fv_tyS (All xs T) = (fv_ty T - atom ` xs)"
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1030
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1031
inductive
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1032
  alpha_tyS :: "tyS \<Rightarrow> tyS \<Rightarrow> bool" ("_ \<approx>tyS _" [100, 100] 100)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1033
where
1185
7566b899ca6a Code for handling atom sets.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1184
diff changeset
  1034
  a1: "\<exists>pi. ((atom ` xs1, T1) \<approx>gen (op =) fv_ty pi (atom ` xs2, T2)) 
1182
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1035
        \<Longrightarrow> All xs1 T1 \<approx>tyS All xs2 T2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1036
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1037
lemma
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1038
  shows "All {a, b} (Fun (Var a) (Var b)) \<approx>tyS All {b, a} (Fun (Var a) (Var b))"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1039
  apply(rule a1)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1040
  apply(simp add: alpha_gen)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1041
  apply(rule_tac x="0::perm" in exI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1042
  apply(simp add: fresh_star_def)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1043
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1044
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1045
lemma
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1046
  shows "All {a, b} (Fun (Var a) (Var b)) \<approx>tyS All {a, b} (Fun (Var b) (Var a))"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1047
  apply(rule a1)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1048
  apply(simp add: alpha_gen)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1049
  apply(rule_tac x="(atom a \<rightleftharpoons> atom b)" in exI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1050
  apply(simp add: fresh_star_def)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1051
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1052
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1053
lemma
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1054
  shows "All {a, b, c} (Fun (Var a) (Var b)) \<approx>tyS All {a, b} (Fun (Var a) (Var b))"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1055
  apply(rule a1)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1056
  apply(simp add: alpha_gen)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1057
  apply(rule_tac x="0::perm" in exI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1058
  apply(simp add: fresh_star_def)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1059
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1060
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1061
lemma
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1062
  assumes a: "a \<noteq> b"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1063
  shows "\<not>(All {a, b} (Fun (Var a) (Var b)) \<approx>tyS All {c} (Fun (Var c) (Var c)))"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1064
  using a
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1065
  apply(clarify)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1066
  apply(erule alpha_tyS.cases)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1067
  apply(simp add: alpha_gen)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1068
  apply(erule conjE)+
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1069
  apply(erule exE)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1070
  apply(erule conjE)+
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1071
  apply(clarify)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1072
  apply(simp)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1073
  apply(simp add: fresh_star_def)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1074
  apply(auto)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1075
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1076
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1077
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1078
end