Quot/Nominal/Terms2.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Wed, 17 Feb 2010 17:51:35 +0100
changeset 1182 3c32f91fa771
child 1183 cb3da5b540f2
permissions -rw-r--r--
Terms2 with bindings for binders synchronized with bindings they are used in.
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
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     2
imports "Nominal2_Atoms" "Nominal2_Eqvt" "Nominal2_Supp" "Abs" "Perm" "Fv"
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
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    21
(* 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
    22
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    23
primrec 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    24
  bv1
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    25
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    26
  "bv1 (BUnit) = {}"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    27
| "bv1 (BVr 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
    28
| "bv1 (BPr bp1 bp2) = (bv1 bp1) \<union> (bv1 bp1)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    29
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    30
local_setup {* define_raw_fv "Terms.rtrm1"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    31
  [[[[]], [[], []], [[(NONE, 0)], [(NONE, 0)]], [[(SOME @{term bv1}, 0)], [], [(SOME @{term bv1}, 0)]]],
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    32
   [[], [[]], [[], []]]] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    33
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    34
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    35
setup {* snd o define_raw_perms ["rtrm1", "bp"] ["Terms.rtrm1", "Terms.bp"] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    36
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    37
inductive
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    38
  alpha1 :: "rtrm1 \<Rightarrow> rtrm1 \<Rightarrow> bool" ("_ \<approx>1 _" [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
    39
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    40
  a1: "a = b \<Longrightarrow> (rVr1 a) \<approx>1 (rVr1 b)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    41
| a2: "\<lbrakk>t1 \<approx>1 t2; s1 \<approx>1 s2\<rbrakk> \<Longrightarrow> rAp1 t1 s1 \<approx>1 rAp1 t2 s2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    42
| a3: "(\<exists>pi. (({atom aa}, t) \<approx>gen alpha1 fv_rtrm1 pi ({atom ab}, s))) \<Longrightarrow> rLm1 aa t \<approx>1 rLm1 ab s"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    43
| a4: "t1 \<approx>1 t2 \<Longrightarrow> (\<exists>pi. (((bv1 b1), s1) \<approx>gen alpha1 fv_rtrm1 pi ((bv1 b2), s2))) \<Longrightarrow> rLt1 b1 t1 s1 \<approx>1 rLt1 b2 t2 s2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    44
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    45
lemma alpha1_inj:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    46
"(rVr1 a \<approx>1 rVr1 b) = (a = b)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    47
"(rAp1 t1 s1 \<approx>1 rAp1 t2 s2) = (t1 \<approx>1 t2 \<and> s1 \<approx>1 s2)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    48
"(rLm1 aa t \<approx>1 rLm1 ab s) = (\<exists>pi. (({atom aa}, t) \<approx>gen alpha1 fv_rtrm1 pi ({atom ab}, s)))"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    49
"(rLt1 b1 t1 s1 \<approx>1 rLt1 b2 t2 s2) = (t1 \<approx>1 t2 \<and> (\<exists>pi. (((bv1 b1), s1) \<approx>gen alpha1 fv_rtrm1 pi ((bv1 b2), s2))))"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    50
apply -
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    51
apply rule apply (erule alpha1.cases) apply (simp_all add: alpha1.intros)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    52
apply rule apply (erule alpha1.cases) apply (simp_all add: alpha1.intros)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    53
apply rule apply (erule alpha1.cases) apply (simp_all add: alpha1.intros)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    54
apply rule apply (erule alpha1.cases) apply (simp_all add: alpha1.intros)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    55
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    56
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    57
(* Shouyld we derive it? But bv is 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
    58
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
    59
  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
    60
  apply (induct x)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    61
apply (simp_all add: empty_eqvt insert_eqvt atom_eqvt)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    62
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    63
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    64
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
    65
    "(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
    66
    "(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
    67
  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
    68
  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
    69
  done
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
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    72
lemma alpha1_eqvt:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    73
  shows "t \<approx>1 s \<Longrightarrow> (pi \<bullet> t) \<approx>1 (pi \<bullet> s)"
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 s rule: alpha1.inducts)
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: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
    76
  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
    77
  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
    78
  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
    79
  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
    80
  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
    81
  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
    82
  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
    83
  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
    84
  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
    85
  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
    86
  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
    87
  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
    88
  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
    89
  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
    90
  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
    91
  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
    92
  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
    93
  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
    94
  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
    95
  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
    96
  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
    97
  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
    98
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    99
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   100
lemma alpha1_equivp: "equivp alpha1" 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   101
  sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   102
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   103
quotient_type trm1 = rtrm1 / alpha1
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   104
  by (rule alpha1_equivp)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   105
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   106
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   107
  "Vr1 :: name \<Rightarrow> trm1"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   108
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   109
  "rVr1"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   110
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   111
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   112
  "Ap1 :: trm1 \<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
   113
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   114
  "rAp1"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   115
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   116
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   117
  "Lm1 :: name \<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
   118
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   119
  "rLm1"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   120
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   121
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   122
  "Lt1 :: bp \<Rightarrow> trm1 \<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
   123
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   124
  "rLt1"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   125
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   126
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   127
  "fv_trm1 :: trm1 \<Rightarrow> atom set"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   128
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   129
  "fv_rtrm1"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   130
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   131
lemma alpha_rfv1:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   132
  shows "t \<approx>1 s \<Longrightarrow> fv_rtrm1 t = fv_rtrm1 s"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   133
  apply(induct rule: alpha1.induct)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   134
  apply(simp_all 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
   135
  sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   136
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   137
lemma [quot_respect]:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   138
 "(op = ===> alpha1) rVr1 rVr1"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   139
 "(alpha1 ===> alpha1 ===> alpha1) rAp1 rAp1"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   140
 "(op = ===> alpha1 ===> alpha1) rLm1 rLm1"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   141
 "(op = ===> alpha1 ===> alpha1 ===> alpha1) rLt1 rLt1"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   142
apply (auto 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
   143
apply (rule_tac x="0" in exI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   144
apply (simp add: fresh_star_def fresh_zero_perm alpha_rfv1 alpha_gen)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   145
apply (rule_tac x="0" in exI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   146
apply (simp add: alpha_gen fresh_star_def fresh_zero_perm alpha_rfv1)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   147
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   148
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   149
lemma [quot_respect]:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   150
  "(op = ===> alpha1 ===> alpha1) permute permute"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   151
  by (simp add: alpha1_eqvt)
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
lemma [quot_respect]:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   154
  "(alpha1 ===> op =) fv_rtrm1 fv_rtrm1"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   155
  by (simp add: alpha_rfv1)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   156
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   157
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
   158
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
   159
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   160
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
   161
begin
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
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   164
  "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
   165
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   166
  "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
   167
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   168
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
   169
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   170
instance
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   171
apply default
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   172
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
   173
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
   174
done
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
end
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   177
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   178
lemmas fv_trm1 = fv_rtrm1_fv_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
   179
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   180
lemmas fv_trm1_eqvt = fv_rtrm1_eqvt[quot_lifted]
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   181
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   182
lemmas alpha1_INJ = alpha1_inj[unfolded alpha_gen, quot_lifted, folded alpha_gen]
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   183
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   184
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
   185
  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
   186
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
   187
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
   188
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
   189
apply(clarify)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   190
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
   191
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
   192
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   193
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   194
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
   195
  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
   196
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
   197
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
   198
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
   199
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   200
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   201
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
   202
  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
   203
  apply(simp_all add: supp_def)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   204
  apply (fold supp_def)
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_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 add: Collect_imp_eq)
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_neg_eq[symmetric])
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   208
  apply (fold supp_def)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   209
  apply (simp)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   210
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   211
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   212
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
   213
apply default
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   214
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
   215
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
   216
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
   217
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
   218
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
   219
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
   220
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
   221
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
   222
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
   223
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
   224
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
   225
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
   226
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   227
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   228
lemma supp_fv:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   229
  shows "supp t = fv_trm1 t"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   230
apply(induct t 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
   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])
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   243
(*apply(subgoal_tac "supp (Lt1 bp rtrm11 rtrm12) = supp(rtrm11) \<union> supp (Abs (bv1 bp) rtrm12)")
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   244
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
   245
apply(simp (no_asm) add: supp_def)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   246
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
   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)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   249
apply(simp add: supp_eqvt[symmetric] fv_trm1_eqvt[symmetric] bv1_eqvt)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   250
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
   251
done*)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   252
sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   253
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   254
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
   255
  "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
   256
  "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
   257
  "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
   258
  "supp (Lt1 b t s) = supp t \<union> (supp s - bv1 b)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   259
sorry (*  by (simp_all only: supp_fv fv_trm1)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   260
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   261
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
   262
  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
   263
  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
   264
  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
   265
  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
   266
  shows   "P a rtrma"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   267
sorry *)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   268
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   269
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
   270
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   271
datatype rtrm2 =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   272
  rVr2 "name"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   273
| 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
   274
| 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
   275
| 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
   276
and rassign =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   277
  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
   278
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   279
(* 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
   280
primrec 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   281
  rbv2
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   282
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   283
  "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
   284
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   285
local_setup {* define_raw_fv "Terms.rtrm2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   286
  [[[[]], [[], []], [[(NONE, 0)], [(NONE, 0)]], [[(SOME @{term rbv2}, 0)], [(SOME @{term rbv2}, 0)]]],
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   287
   [[[], []]]] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   288
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   289
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   290
setup {* snd o define_raw_perms ["rtrm2", "rassign"] ["Terms.rtrm2", "Terms.rassign"] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   291
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   292
inductive
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   293
  alpha2 :: "rtrm2 \<Rightarrow> rtrm2 \<Rightarrow> bool" ("_ \<approx>2 _" [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
   294
and
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   295
  alpha2a :: "rassign \<Rightarrow> rassign \<Rightarrow> bool" ("_ \<approx>2a _" [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
   296
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   297
  a1: "a = b \<Longrightarrow> (rVr2 a) \<approx>2 (rVr2 b)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   298
| a2: "\<lbrakk>t1 \<approx>2 t2; s1 \<approx>2 s2\<rbrakk> \<Longrightarrow> rAp2 t1 s1 \<approx>2 rAp2 t2 s2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   299
| a3: "(\<exists>pi. (({atom a}, t) \<approx>gen alpha2 fv_rtrm2 pi ({atom b}, s))) \<Longrightarrow> rLm2 a t \<approx>2 rLm2 b s"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   300
| a4: "\<lbrakk>\<exists>pi. ((rbv2 bt, t) \<approx>gen alpha2 fv_rtrm2 pi ((rbv2 bs), s));
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   301
        \<exists>pi. ((rbv2 bt, bt) \<approx>gen alpha2a fv_rassign pi (rbv2 bs, bs))\<rbrakk>
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   302
        \<Longrightarrow> rLt2 bt t \<approx>2 rLt2 bs s"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   303
| a5: "\<lbrakk>a = b; t \<approx>2 s\<rbrakk> \<Longrightarrow> rAs a t \<approx>2a rAs b s" (* This way rbv2 can be lifted *)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   304
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   305
lemma alpha2_equivp:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   306
  "equivp alpha2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   307
  "equivp alpha2a"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   308
  sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   309
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   310
quotient_type
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   311
  trm2 = rtrm2 / alpha2
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   312
and
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   313
  assign = rassign / alpha2a
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   314
  by (auto intro: alpha2_equivp)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   315
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   316
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   317
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   318
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
   319
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   320
datatype trm3 =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   321
  Vr3 "name"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   322
| Ap3 "trm3" "trm3"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   323
| Lm3 "name" "trm3" --"bind (name) in (trm3)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   324
| Lt3 "assigns" "trm3" --"bind (bv3 assigns) in (trm3)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   325
and assigns =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   326
  ANil
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   327
| ACons "name" "trm3" "assigns"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   328
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   329
(* 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
   330
primrec 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   331
  bv3
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   332
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   333
  "bv3 ANil = {}"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   334
| "bv3 (ACons x t as) = {atom x} \<union> (bv3 as)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   335
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   336
local_setup {* define_raw_fv "Terms.trm3"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   337
  [[[[]], [[], []], [[(NONE, 0)], [(NONE, 0)]], [[(SOME @{term bv3}, 0)], [(SOME @{term bv3}, 0)]]],
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   338
   [[], [[], [], []]]] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   339
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   340
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   341
setup {* snd o define_raw_perms ["rtrm3", "assigns"] ["Terms.trm3", "Terms.assigns"] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   342
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   343
inductive
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   344
  alpha3 :: "trm3 \<Rightarrow> trm3 \<Rightarrow> bool" ("_ \<approx>3 _" [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
   345
and
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   346
  alpha3a :: "assigns \<Rightarrow> assigns \<Rightarrow> bool" ("_ \<approx>3a _" [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
   347
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   348
  a1: "a = b \<Longrightarrow> (Vr3 a) \<approx>3 (Vr3 b)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   349
| a2: "\<lbrakk>t1 \<approx>3 t2; s1 \<approx>3 s2\<rbrakk> \<Longrightarrow> Ap3 t1 s1 \<approx>3 Ap3 t2 s2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   350
| a3: "(\<exists>pi. (({atom a}, t) \<approx>gen alpha3 fv_rtrm3 pi ({atom b}, s))) \<Longrightarrow> Lm3 a t \<approx>3 Lm3 b s"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   351
| a4: "\<lbrakk>\<exists>pi. ((bv3 bt, t) \<approx>gen alpha3 fv_trm3 pi ((bv3 bs), s));
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   352
        \<exists>pi. ((bv3 bt, bt) \<approx>gen alpha3a fv_assign pi (bv3 bs, bs))\<rbrakk>
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   353
        \<Longrightarrow> Lt3 bt t \<approx>3 Lt3 bs s"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   354
| a5: "ANil \<approx>3a ANil"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   355
| a6: "\<lbrakk>a = b; t \<approx>3 s; tt \<approx>3a st\<rbrakk> \<Longrightarrow> ACons a t tt \<approx>3a ACons b s st"
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
lemma alpha3_equivp:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   358
  "equivp alpha3"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   359
  "equivp alpha3a"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   360
  sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   361
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   362
quotient_type
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   363
  qtrm3 = trm3 / alpha3
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   364
and
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   365
  qassigns = assigns / alpha3a
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   366
  by (auto intro: alpha3_equivp)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   367
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
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
   370
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   371
datatype trm4 =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   372
  Vr4 "name"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   373
| Ap4 "trm4" "trm4 list"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   374
| Lm4 "name" "trm4"  --"bind (name) in (trm)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   375
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   376
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   377
thm trm4.recs
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   378
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   379
local_setup {* define_raw_fv "Terms.trm4" [
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   380
  [[[]], [[], []], [[(NONE, 0)], [(NONE, 0)]]], [[], [[], []]]  ] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   381
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   382
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   383
(* 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
   384
(* permutations are  already defined in Nominal (also functions, options, and so on) *)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   385
setup {* snd o define_raw_perms ["trm4"] ["Terms.trm4"] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   386
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   387
(* "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
   388
lemma repaired:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   389
  fixes ts::"trm4 list"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   390
  shows "permute_trm4_list p ts = p \<bullet> ts"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   391
  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
   392
  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
   393
  done
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
thm permute_trm4_permute_trm4_list.simps
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   396
thm permute_trm4_permute_trm4_list.simps[simplified repaired]
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   397
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   398
inductive
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   399
    alpha4 :: "trm4 \<Rightarrow> trm4 \<Rightarrow> bool" ("_ \<approx>4 _" [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
   400
and alpha4list :: "trm4 list \<Rightarrow> trm4 list \<Rightarrow> bool" ("_ \<approx>4list _" [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
   401
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   402
  a1: "a = b \<Longrightarrow> (Vr4 a) \<approx>4 (Vr4 b)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   403
| a2: "\<lbrakk>t1 \<approx>4 t2; s1 \<approx>4list s2\<rbrakk> \<Longrightarrow> Ap4 t1 s1 \<approx>4 Ap4 t2 s2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   404
| a3: "(\<exists>pi. (({atom a}, t) \<approx>gen alpha4 fv_rtrm4 pi ({atom b}, s))) \<Longrightarrow> Lm4 a t \<approx>4 Lm4 b s"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   405
| a5: "[] \<approx>4list []"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   406
| a6: "\<lbrakk>t \<approx>4 s; ts \<approx>4list ss\<rbrakk> \<Longrightarrow> (t#ts) \<approx>4list (s#ss)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   407
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   408
lemma alpha4_equivp: "equivp alpha4" sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   409
lemma alpha4list_equivp: "equivp alpha4list" sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   410
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   411
quotient_type 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   412
  qtrm4 = trm4 / alpha4 and
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   413
  qtrm4list = "trm4 list" / alpha4list
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   414
  by (simp_all add: alpha4_equivp alpha4list_equivp)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   415
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   416
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   417
datatype rtrm5 =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   418
  rVr5 "name"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   419
| 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
   420
| 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
   421
and rlts =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   422
  rLnil
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   423
| 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
   424
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   425
primrec
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   426
  rbv5
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   427
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   428
  "rbv5 rLnil = {}"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   429
| "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
   430
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   431
local_setup {* define_raw_fv "Terms.rtrm5" [
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   432
  [[[]], [[], []], [[(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
   433
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   434
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   435
setup {* snd o define_raw_perms ["rtrm5", "rlts"] ["Terms.rtrm5", "Terms.rlts"] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   436
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   437
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   438
inductive
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   439
  alpha5 :: "rtrm5 \<Rightarrow> rtrm5 \<Rightarrow> bool" ("_ \<approx>5 _" [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
   440
and
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   441
  alphalts :: "rlts \<Rightarrow> rlts \<Rightarrow> bool" ("_ \<approx>l _" [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
   442
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   443
  a1: "a = b \<Longrightarrow> (rVr5 a) \<approx>5 (rVr5 b)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   444
| a2: "\<lbrakk>t1 \<approx>5 t2; s1 \<approx>5 s2\<rbrakk> \<Longrightarrow> rAp5 t1 s1 \<approx>5 rAp5 t2 s2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   445
| a3: "\<lbrakk>\<exists>pi. ((rbv5 l1, t1) \<approx>gen alpha5 fv_rtrm5 pi (rbv5 l2, t2)); 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   446
        \<exists>pi. ((rbv5 l1, l1) \<approx>gen alphalts fv_rlts pi (rbv5 l2, l2))\<rbrakk>
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   447
        \<Longrightarrow> rLt5 l1 t1 \<approx>5 rLt5 l2 t2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   448
| a4: "rLnil \<approx>l rLnil"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   449
| a5: "ls1 \<approx>l ls2 \<Longrightarrow> t1 \<approx>5 t2 \<Longrightarrow> n1 = n2 \<Longrightarrow> rLcons n1 t1 ls1 \<approx>l rLcons n2 t2 ls2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   450
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   451
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   452
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   453
lemma alpha5_inj:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   454
  "((rVr5 a) \<approx>5 (rVr5 b)) = (a = b)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   455
  "(rAp5 t1 s1 \<approx>5 rAp5 t2 s2) = (t1 \<approx>5 t2 \<and> s1 \<approx>5 s2)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   456
  "(rLt5 l1 t1 \<approx>5 rLt5 l2 t2) = ((\<exists>pi. ((rbv5 l1, t1) \<approx>gen alpha5 fv_rtrm5 pi (rbv5 l2, t2))) \<and>
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   457
         (\<exists>pi. ((rbv5 l1, l1) \<approx>gen alphalts fv_rlts pi (rbv5 l2, l2))))"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   458
  "rLnil \<approx>l rLnil"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   459
  "(rLcons n1 t1 ls1 \<approx>l rLcons n2 t2 ls2) = (n1 = n2 \<and> ls1 \<approx>l ls2 \<and> t1 \<approx>5 t2)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   460
apply -
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   461
apply (simp_all add: alpha5_alphalts.intros)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   462
apply rule
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   463
apply (erule alpha5.cases)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   464
apply (simp_all add: alpha5_alphalts.intros)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   465
apply rule
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   466
apply (erule alpha5.cases)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   467
apply (simp_all add: alpha5_alphalts.intros)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   468
apply rule
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   469
apply (erule alpha5.cases)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   470
apply (simp_all add: alpha5_alphalts.intros)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   471
apply rule
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   472
apply (erule alphalts.cases)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   473
apply (simp_all add: alpha5_alphalts.intros)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   474
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   475
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   476
lemma alpha5_equivps:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   477
  shows "equivp alpha5"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   478
  and   "equivp alphalts"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   479
sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   480
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   481
quotient_type
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   482
  trm5 = rtrm5 / alpha5
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   483
and
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   484
  lts = rlts / alphalts
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   485
  by (auto intro: alpha5_equivps)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   486
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   487
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   488
  "Vr5 :: name \<Rightarrow> trm5"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   489
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   490
  "rVr5"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   491
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   492
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   493
  "Ap5 :: trm5 \<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
   494
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   495
  "rAp5"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   496
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   497
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   498
  "Lt5 :: lts \<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
   499
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   500
  "rLt5"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   501
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   502
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   503
  "Lnil :: lts"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   504
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   505
  "rLnil"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   506
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   507
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   508
  "Lcons :: name \<Rightarrow> trm5 \<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
   509
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   510
  "rLcons"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   511
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   512
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   513
   "fv_trm5 :: trm5 \<Rightarrow> atom set"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   514
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   515
  "fv_rtrm5"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   516
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   517
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   518
   "fv_lts :: lts \<Rightarrow> atom set"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   519
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   520
  "fv_rlts"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   521
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   522
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   523
   "bv5 :: lts \<Rightarrow> atom set"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   524
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   525
  "rbv5"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   526
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   527
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
   528
  "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
   529
sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   530
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   531
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
   532
  "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
   533
sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   534
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   535
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
   536
  "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
   537
sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   538
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   539
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
   540
  "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
   541
  "xb \<approx>l ya \<Longrightarrow> (x \<bullet> xb) \<approx>l (x \<bullet> ya)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   542
  apply(induct rule: alpha5_alphalts.inducts)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   543
  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
   544
  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
   545
  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
   546
  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
   547
  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
   548
  apply (rule_tac x="x \<bullet> pi" in exI)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   549
  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
   550
  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
   551
  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
   552
  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
   553
  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
   554
  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
   555
  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
   556
  apply (simp)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   557
  apply (rule_tac x="x \<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
   558
  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
   559
  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
   560
  apply(simp add: atom_eqvt Diff_eqvt insert_eqvt set_eqvt empty_eqvt rbv5_eqvt 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
   561
  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
   562
  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
   563
  apply(simp add: atom_eqvt Diff_eqvt insert_eqvt set_eqvt empty_eqvt rbv5_eqvt 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
   564
  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
   565
  apply (simp)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   566
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   567
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   568
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
   569
  "(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
   570
  "(l \<approx>l m \<Longrightarrow> fv_rlts l = fv_rlts m)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   571
  apply(induct rule: alpha5_alphalts.inducts)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   572
  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
   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 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
   576
  shows "x \<approx>l y \<Longrightarrow> rbv5 x = rbv5 y"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   577
  apply(induct rule: alpha5_alphalts.inducts(2))
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   578
  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
   579
  done
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
lemma [quot_respect]:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   582
  "(alphalts ===> op =) fv_rlts fv_rlts"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   583
  "(alpha5 ===> op =) fv_rtrm5 fv_rtrm5"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   584
  "(alphalts ===> op =) rbv5 rbv5"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   585
  "(op = ===> alpha5) rVr5 rVr5"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   586
  "(alpha5 ===> alpha5 ===> alpha5) rAp5 rAp5"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   587
  "(alphalts ===> alpha5 ===> alpha5) rLt5 rLt5"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   588
  "(alphalts ===> alpha5 ===> alpha5) rLt5 rLt5"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   589
  "(op = ===> alpha5 ===> alphalts ===> alphalts) rLcons rLcons"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   590
  "(op = ===> alpha5 ===> alpha5) permute permute"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   591
  "(op = ===> alphalts ===> alphalts) permute permute"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   592
  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
   593
  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
   594
  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
   595
  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
   596
  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
   597
  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
   598
  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
   599
  done
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
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   602
  shows "(alphalts ===> op =) rbv5 rbv5"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   603
  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
   604
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   605
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
   606
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   607
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
   608
begin
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   609
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   610
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   611
  "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
   612
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   613
  "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
   614
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   615
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   616
  "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
   617
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   618
  "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
   619
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   620
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
   621
  "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
   622
  "0 \<bullet> (y\<Colon>lts) = y"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   623
apply(induct x and y rule: trm5_lts_inducts)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   624
apply(simp_all add: permute_rtrm5_permute_rlts.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
   625
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   626
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   627
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
   628
  "(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
   629
  "(p + q) \<bullet> (y\<Colon>lts) = p \<bullet> q \<bullet> y"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   630
apply(induct x and y rule: trm5_lts_inducts)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   631
apply(simp_all add: permute_rtrm5_permute_rlts.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
   632
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   633
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   634
instance
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   635
apply default
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   636
apply (simp_all add: trm5_lts_zero 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
   637
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   638
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   639
end
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   640
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   641
lemmas permute_trm5_lts = permute_rtrm5_permute_rlts.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
   642
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   643
lemmas alpha5_INJ = alpha5_inj[unfolded alpha_gen, quot_lifted, folded alpha_gen]
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   644
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   645
lemmas bv5[simp] = rbv5.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
   646
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   647
lemmas fv_trm5_lts[simp] = fv_rtrm5_fv_rlts.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
   648
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   649
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
   650
  "(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
   651
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
   652
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
   653
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
   654
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
   655
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
   656
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
   657
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
   658
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
   659
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   660
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   661
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
   662
  "(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
   663
   (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
   664
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
   665
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
   666
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
   667
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
   668
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
   669
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
   670
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
   671
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
   672
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   673
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   674
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   675
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
   676
  "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
   677
             (Lt5 (Lcons y (Vr5 x) (Lcons x (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
   678
apply (subst alpha5_INJ(3))
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   679
apply(clarify)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   680
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
   681
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
   682
apply (simp add: alpha5_INJ(5))
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   683
apply(clarify)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   684
apply (simp add: alpha5_INJ(2))
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   685
apply (simp only: alpha5_INJ(1))
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   686
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   687
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   688
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
   689
  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
   690
  apply auto
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   691
  apply (erule alpha5.cases)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   692
  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
   693
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   694
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   695
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
   696
  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
   697
  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
   698
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   699
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
   700
  "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
   701
   (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
   702
   (Lt5 (Lcons y (Vr5 z) (Lcons x (Ap5 (Vr5 z) (Vr5 z)) 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
   703
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
   704
apply (simp only: alpha_gen 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
   705
apply (subst alpha5_INJ(5))
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   706
apply (subst alpha5_INJ(5))
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   707
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
   708
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   709
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   710
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   711
(* 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
   712
datatype rtrm6 =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   713
  rVr6 "name"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   714
| rLm6 "name" "rtrm6"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   715
| 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
   716
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   717
primrec
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   718
  rbv6
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   719
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   720
  "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
   721
| "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
   722
| "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
   723
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   724
local_setup {* define_raw_fv "Terms.rtrm6" [
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   725
  [[[]], [[(NONE, 0)], [(NONE, 0)]], [[(SOME @{term rbv6}, 0)], [(SOME @{term rbv6}, 0)]]]] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   726
print_theorems 
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
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
   729
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   730
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   731
inductive
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   732
  alpha6 :: "rtrm6 \<Rightarrow> rtrm6 \<Rightarrow> bool" ("_ \<approx>6 _" [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
   733
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   734
  a1: "a = b \<Longrightarrow> (rVr6 a) \<approx>6 (rVr6 b)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   735
| a2: "(\<exists>pi. (({atom a}, t) \<approx>gen alpha6 fv_rtrm6 pi ({atom b}, s))) \<Longrightarrow> rLm6 a t \<approx>6 rLm6 b s"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   736
| a3: "(\<exists>pi. (((rbv6 t1), s1) \<approx>gen alpha6 fv_rtrm6 pi ((rbv6 t2), s2))) \<Longrightarrow> rLt6 t1 s1 \<approx>6 rLt6 t2 s2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   737
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   738
lemma alpha6_equivps:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   739
  shows "equivp alpha6"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   740
sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   741
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   742
quotient_type
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   743
  trm6 = rtrm6 / alpha6
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   744
  by (auto intro: alpha6_equivps)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   745
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   746
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   747
  "Vr6 :: name \<Rightarrow> trm6"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   748
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   749
  "rVr6"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   750
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   751
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   752
  "Lm6 :: name \<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
   753
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   754
  "rLm6"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   755
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   756
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   757
  "Lt6 :: trm6 \<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
   758
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   759
  "rLt6"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   760
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   761
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   762
   "fv_trm6 :: trm6 \<Rightarrow> atom set"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   763
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   764
  "fv_rtrm6"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   765
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   766
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   767
   "bv6 :: trm6 \<Rightarrow> atom set"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   768
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   769
  "rbv6"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   770
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   771
lemma [quot_respect]:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   772
  "(op = ===> alpha6 ===> alpha6) permute permute"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   773
apply auto (* will work with eqvt *)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   774
sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   775
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   776
(* Definitely not true , see lemma below *)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   777
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   778
lemma [quot_respect]:"(alpha6 ===> op =) rbv6 rbv6"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   779
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
   780
apply (erule alpha6.induct)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   781
oops
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   782
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   783
lemma "(a :: name) \<noteq> b \<Longrightarrow> \<not> (alpha6 ===> op =) rbv6 rbv6"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   784
apply simp
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   785
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
   786
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
   787
apply simp
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   788
apply (rule a2)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   789
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
   790
apply (simp 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
   791
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
   792
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
   793
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   794
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   795
lemma [quot_respect]:"(alpha6 ===> op =) fv_rtrm6 fv_rtrm6"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   796
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
   797
apply (induct_tac x y rule: alpha6.induct)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   798
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
   799
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
   800
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
   801
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
   802
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
   803
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
   804
apply (simp)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   805
oops
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   806
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   807
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   808
lemma [quot_respect]: "(op = ===> alpha6) rVr6 rVr6"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   809
by (simp_all add: a1)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   810
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   811
lemma [quot_respect]:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   812
 "(op = ===> alpha6 ===> alpha6) rLm6 rLm6"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   813
 "(alpha6 ===> alpha6 ===> alpha6) rLt6 rLt6"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   814
apply simp_all apply (clarify)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   815
apply (rule a2)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   816
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
   817
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
   818
(* needs rfv6_rsp *) defer
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   819
apply clarify
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   820
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
   821
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
   822
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
   823
(* 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
   824
oops
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   825
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   826
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
   827
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   828
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   829
  "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
   830
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   831
  "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
   832
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   833
instance
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   834
apply default
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   835
sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   836
end
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   837
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   838
lemma lifted_induct:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   839
"\<lbrakk>x1 = x2; \<And>a b. a = b \<Longrightarrow> P (Vr6 a) (Vr6 b);
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   840
 \<And>a t b s.
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   841
   \<exists>pi. fv_trm6 t - {atom a} = fv_trm6 s - {atom b} \<and>
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   842
        (fv_trm6 t - {atom a}) \<sharp>* pi \<and> pi \<bullet> t = s \<and> P (pi \<bullet> t) s \<Longrightarrow>
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   843
   P (Lm6 a t) (Lm6 b s);
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   844
 \<And>t1 s1 t2 s2.
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   845
   \<exists>pi. fv_trm6 s1 - bv6 t1 = fv_trm6 s2 - bv6 t2 \<and>
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   846
        (fv_trm6 s1 - bv6 t1) \<sharp>* pi \<and> pi \<bullet> s1 = s2 \<and> P (pi \<bullet> s1) s2 \<Longrightarrow>
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   847
   P (Lt6 t1 s1) (Lt6 t2 s2)\<rbrakk>
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   848
 \<Longrightarrow> P x1 x2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   849
unfolding alpha_gen
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   850
apply (lifting alpha6.induct[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
   851
apply injection
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   852
(* notice unsolvable goals: (alpha6 ===> op =) rbv6 rbv6 *)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   853
oops
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   854
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   855
lemma lifted_inject_a3:
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   856
 "\<exists>pi. fv_trm6 s1 - bv6 t1 = fv_trm6 s2 - bv6 t2 \<and>
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   857
    (fv_trm6 s1 - bv6 t1) \<sharp>* pi \<and> pi \<bullet> s1 = s2 \<Longrightarrow> Lt6 t1 s1 = Lt6 t2 s2"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   858
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
   859
apply injection
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   860
(* notice unsolvable goals: (alpha6 ===> op =) rbv6 rbv6 *)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   861
oops
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
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   865
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   866
(* 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
   867
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   868
datatype rtrm7 =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   869
  rVr7 "name"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   870
| rLm7 "name" "rtrm7"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   871
| 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
   872
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   873
primrec
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   874
  rbv7
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   875
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   876
  "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
   877
| "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
   878
| "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
   879
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   880
local_setup {* define_raw_fv "Terms.rtrm7" [
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   881
  [[[]], [[(NONE, 0)], [(NONE, 0)]], [[(SOME @{term rbv7}, 0)], [(SOME @{term rbv7}, 0)]]]] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   882
print_theorems 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   883
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   884
setup {* snd o define_raw_perms ["rtrm7"] ["Terms.rtrm7"] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   885
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   886
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   887
inductive
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   888
  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
   889
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   890
  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
   891
| 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
   892
| 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
   893
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   894
lemma bvfv7: "rbv7 x = fv_rtrm7 x"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   895
  apply induct
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   896
  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
   897
sorry (*done*)
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 "(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
   900
  apply simp
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   901
  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
   902
  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
   903
  apply simp
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   904
  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
   905
  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
   906
  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
   907
  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
   908
  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
   909
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   910
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   911
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
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   914
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   915
datatype rfoo8 =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   916
  Foo0 "name"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   917
| 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
   918
and rbar8 =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   919
  Bar0 "name"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   920
| 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
   921
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   922
primrec
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   923
  rbv8
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   924
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   925
  "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
   926
| "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
   927
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   928
local_setup {* define_raw_fv "Terms.rfoo8" [
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   929
  [[[]], [[(SOME @{term rbv8}, 0)], [(SOME @{term rbv8}, 0)]]], [[[]], [[], [(NONE, 1)], [(NONE, 1)]]]] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   930
print_theorems 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   931
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   932
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
   933
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   934
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   935
inductive
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   936
  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
   937
and
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   938
  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
   939
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   940
  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
   941
| 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
   942
| 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
   943
| 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
   944
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   945
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
   946
  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
   947
  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
   948
  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
   949
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   950
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   951
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
   952
  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
   953
  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
   954
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   955
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
   956
  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
   957
done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   958
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   959
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
   960
  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
   961
  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
   962
  apply (simp_all add: alpha_gen 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
   963
sorry (*done*)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   964
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   965
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   966
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   967
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   968
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   969
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   970
datatype rlam9 =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   971
  Var9 "name"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   972
| 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
   973
and rbla9 =
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   974
  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
   975
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   976
primrec
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   977
  rbv9
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   978
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   979
  "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
   980
| "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
   981
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   982
local_setup {* define_raw_fv "Terms.rlam9" [
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   983
  [[[]], [[(NONE, 0)], [(NONE, 0)]]], [[[(SOME @{term rbv9}, 0)], [(SOME @{term rbv9}, 0)]]]] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   984
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   985
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   986
setup {* snd o define_raw_perms ["rlam9", "rbla9"] ["Terms.rlam9", "Terms.rbla9"] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   987
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   988
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   989
inductive
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   990
  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
   991
and
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   992
  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
   993
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   994
  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
   995
| 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
   996
| 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
   997
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   998
quotient_type
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   999
  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
  1000
sorry
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
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1003
  "qVar9 :: name \<Rightarrow> lam9"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1004
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1005
  "Var9"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1006
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1007
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1008
  "qLam :: name \<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
  1009
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1010
  "Lam9"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1011
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1012
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1013
  "qBla9 :: lam9 \<Rightarrow> lam9 \<Rightarrow> bla9"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1014
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1015
  "Bla9"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1016
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1017
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1018
  "fv_lam9 :: lam9 \<Rightarrow> atom set"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1019
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1020
  "fv_rlam9"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1021
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1022
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1023
  "fv_bla9 :: bla9 \<Rightarrow> atom set"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1024
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1025
  "fv_rbla9"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1026
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1027
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1028
  "bv9 :: lam9 \<Rightarrow> atom set"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1029
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1030
  "rbv9"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1031
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1032
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
  1033
begin
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1034
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1035
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1036
  "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
  1037
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1038
  "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
  1039
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1040
quotient_definition
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1041
  "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
  1042
is
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1043
  "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
  1044
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1045
instance
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1046
sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1047
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1048
end
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1049
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1050
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
  1051
 \<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
  1052
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
  1053
apply injection
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1054
sorry
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1055
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1056
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1057
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1058
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1059
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
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1062
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1063
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
  1064
datatype ty = 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1065
  Var "name" 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1066
| 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
  1067
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1068
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
  1069
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1070
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1071
datatype tyS = 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1072
  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
  1073
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1074
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
  1075
print_theorems
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
abbreviation
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1078
  "atoms xs \<equiv> {atom x| x. x \<in> xs}"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1079
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1080
local_setup {* define_raw_fv "Terms.ty" [[[[]], [[], []]]] *}
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1081
print_theorems 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1082
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1083
(*
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1084
doesn't work yet
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1085
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
  1086
print_theorems
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1087
*)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1088
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1089
primrec
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1090
  fv_tyS
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1091
where 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1092
  "fv_tyS (All xs T) = (fv_ty T - atoms xs)"
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1093
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1094
inductive
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1095
  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
  1096
where
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1097
  a1: "\<exists>pi. ((atoms xs1, T1) \<approx>gen (op =) fv_ty pi (atoms xs2, T2)) 
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1098
        \<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
  1099
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1100
lemma
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1101
  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
  1102
  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
  1103
  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
  1104
  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
  1105
  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
  1106
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1107
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1108
lemma
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1109
  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
  1110
  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
  1111
  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
  1112
  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
  1113
  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
  1114
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1115
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1116
lemma
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1117
  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
  1118
  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
  1119
  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
  1120
  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
  1121
  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
  1122
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1123
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1124
lemma
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1125
  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
  1126
  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
  1127
  using a
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1128
  apply(clarify)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1129
  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
  1130
  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
  1131
  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
  1132
  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
  1133
  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
  1134
  apply(clarify)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1135
  apply(simp)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1136
  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
  1137
  apply(auto)
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1138
  done
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1139
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1140
3c32f91fa771 Terms2 with bindings for binders synchronized with bindings they are used in.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1141
end