Nominal/Manual/LamEx2.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Tue, 23 Mar 2010 08:20:13 +0100
changeset 1593 20221ec06cba
parent 1544 Nominal/LamEx2.thy@c6849a634582
child 2361 d73d4d151cce
permissions -rw-r--r--
Move lambda examples to manual
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     1
theory LamEx
1129
9a86f0ef6503 Notation available locally
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1128
diff changeset
     2
imports "Nominal2_Atoms" "Nominal2_Eqvt" "Nominal2_Supp" "Abs"
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     3
begin
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     4
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     5
atom_decl name
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     7
datatype rlam =
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     8
  rVar "name"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     9
| rApp "rlam" "rlam"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    10
| rLam "name" "rlam"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    11
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    12
fun
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    13
  rfv :: "rlam \<Rightarrow> atom set"
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    14
where
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    15
  rfv_var: "rfv (rVar a) = {atom a}"
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
| rfv_app: "rfv (rApp t1 t2) = (rfv t1) \<union> (rfv t2)"
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    17
| rfv_lam: "rfv (rLam a t) = (rfv t) - {atom a}"
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    18
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    19
instantiation rlam :: pt
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    20
begin
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    21
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    22
primrec
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    23
  permute_rlam
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    24
where
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    25
  "permute_rlam pi (rVar a) = rVar (pi \<bullet> a)"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    26
| "permute_rlam pi (rApp t1 t2) = rApp (permute_rlam pi t1) (permute_rlam pi t2)"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    27
| "permute_rlam pi (rLam a t) = rLam (pi \<bullet> a) (permute_rlam pi t)"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    28
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    29
instance
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    30
apply default
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    31
apply(induct_tac [!] x)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    32
apply(simp_all)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    33
done
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    34
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    35
end
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    36
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    37
instantiation rlam :: fs
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    38
begin
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    39
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    40
lemma neg_conj:
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    41
  "\<not>(P \<and> Q) \<longleftrightarrow> (\<not>P) \<or> (\<not>Q)"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    42
  by simp
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    43
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    44
instance
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    45
apply default
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    46
apply(induct_tac x)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    47
(* var case *)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    48
apply(simp add: supp_def)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    49
apply(fold supp_def)[1]
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    50
apply(simp add: supp_at_base)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    51
(* app case *)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    52
apply(simp only: supp_def)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    53
apply(simp only: permute_rlam.simps) 
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    54
apply(simp only: rlam.inject) 
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    55
apply(simp only: neg_conj)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    56
apply(simp only: Collect_disj_eq)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    57
apply(simp only: infinite_Un)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    58
apply(simp only: Collect_disj_eq)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    59
apply(simp)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    60
(* lam case *)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    61
apply(simp only: supp_def)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    62
apply(simp only: permute_rlam.simps) 
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    63
apply(simp only: rlam.inject) 
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    64
apply(simp only: neg_conj)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    65
apply(simp only: Collect_disj_eq)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    66
apply(simp only: infinite_Un)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    67
apply(simp only: Collect_disj_eq)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    68
apply(simp)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    69
apply(fold supp_def)[1]
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    70
apply(simp add: supp_at_base)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    71
done
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    72
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    73
end
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    74
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    75
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    76
(* for the eqvt proof of the alpha-equivalence *)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    77
declare permute_rlam.simps[eqvt]
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    78
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    79
lemma rfv_eqvt[eqvt]:
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    80
  shows "(pi\<bullet>rfv t) = rfv (pi\<bullet>t)"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    81
apply(induct t)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    82
apply(simp_all)
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    83
apply(simp add: permute_set_eq atom_eqvt)
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    84
apply(simp add: union_eqvt)
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    85
apply(simp add: Diff_eqvt)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    86
apply(simp add: permute_set_eq atom_eqvt)
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    87
done
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    88
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    89
inductive
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    90
    alpha :: "rlam \<Rightarrow> rlam \<Rightarrow> bool" ("_ \<approx> _" [100, 100] 100)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    91
where
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    92
  a1: "a = b \<Longrightarrow> (rVar a) \<approx> (rVar b)"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    93
| a2: "\<lbrakk>t1 \<approx> t2; s1 \<approx> s2\<rbrakk> \<Longrightarrow> rApp t1 s1 \<approx> rApp t2 s2"
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    94
| a3: "\<exists>pi. (({atom a}, t) \<approx>gen alpha rfv pi ({atom b}, s)) \<Longrightarrow> rLam a t \<approx> rLam b s"
1025
559419060d99 Minor uncommited changes from LamEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1024
diff changeset
    95
print_theorems
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    96
thm alpha.induct
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    97
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    98
lemma a3_inverse:
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
    99
  assumes "rLam a t \<approx> rLam b s"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   100
  shows "\<exists>pi. (({atom a}, t) \<approx>gen alpha rfv pi ({atom b}, s))"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   101
using assms
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   102
apply(erule_tac alpha.cases)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   103
apply(auto)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   104
done
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   105
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   106
text {* should be automatic with new version of eqvt-machinery *}
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   107
lemma alpha_eqvt:
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   108
  shows "t \<approx> s \<Longrightarrow> (pi \<bullet> t) \<approx> (pi \<bullet> s)"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   109
apply(induct rule: alpha.induct)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   110
apply(simp add: a1)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   111
apply(simp add: a2)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   112
apply(simp)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   113
apply(rule a3)
1025
559419060d99 Minor uncommited changes from LamEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1024
diff changeset
   114
apply(rule alpha_gen_atom_eqvt)
1023
7c12f5476d1b Generalized the eqvt proof for single binders.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1021
diff changeset
   115
apply(rule rfv_eqvt)
7c12f5476d1b Generalized the eqvt proof for single binders.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1021
diff changeset
   116
apply assumption
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   117
done
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   118
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   119
lemma alpha_refl:
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   120
  shows "t \<approx> t"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   121
apply(induct t rule: rlam.induct)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   122
apply(simp add: a1)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   123
apply(simp add: a2)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   124
apply(rule a3)
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   125
apply(rule_tac x="0" in exI)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   126
apply(rule alpha_gen_refl)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   127
apply(assumption)
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   128
done
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   129
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   130
lemma alpha_sym:
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   131
  shows "t \<approx> s \<Longrightarrow> s \<approx> t"
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   132
  apply(induct rule: alpha.induct)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   133
  apply(simp add: a1)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   134
  apply(simp add: a2)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   135
  apply(rule a3)
1210
10a0e3578507 Generalize atom_trans and atom_sym.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1139
diff changeset
   136
  apply(erule alpha_gen_compose_sym)
10a0e3578507 Generalize atom_trans and atom_sym.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1139
diff changeset
   137
  apply(erule alpha_eqvt)
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   138
  done
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   139
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   140
lemma alpha_trans:
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   141
  shows "t1 \<approx> t2 \<Longrightarrow> t2 \<approx> t3 \<Longrightarrow> t1 \<approx> t3"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   142
apply(induct arbitrary: t3 rule: alpha.induct)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   143
apply(simp add: a1)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   144
apply(rotate_tac 4)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   145
apply(erule alpha.cases)
1025
559419060d99 Minor uncommited changes from LamEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1024
diff changeset
   146
apply(simp_all add: a2)
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   147
apply(erule alpha.cases)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   148
apply(simp_all)
1020
89ccda903f4a With unfolding Rep/Abs_eqvt no longer needed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1019
diff changeset
   149
apply(rule a3)
1210
10a0e3578507 Generalize atom_trans and atom_sym.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1139
diff changeset
   150
apply(erule alpha_gen_compose_trans)
10a0e3578507 Generalize atom_trans and atom_sym.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1139
diff changeset
   151
apply(assumption)
10a0e3578507 Generalize atom_trans and atom_sym.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1139
diff changeset
   152
apply(erule alpha_eqvt)
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   153
done
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   154
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   155
lemma alpha_equivp:
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   156
  shows "equivp alpha"
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   157
  apply(rule equivpI)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   158
  unfolding reflp_def symp_def transp_def
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   159
  apply(auto intro: alpha_refl alpha_sym alpha_trans)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   160
  done
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   161
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   162
lemma alpha_rfv:
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   163
  shows "t \<approx> s \<Longrightarrow> rfv t = rfv s"
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   164
  apply(induct rule: alpha.induct)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   165
  apply(simp_all add: alpha_gen.simps)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   166
  done
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   167
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   168
quotient_type lam = rlam / alpha
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   169
  by (rule alpha_equivp)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   170
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   171
quotient_definition
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   172
  "Var :: name \<Rightarrow> lam"
1139
c4001cda9da3 renamed 'as' to 'is' everywhere.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
   173
is
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   174
  "rVar"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   175
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   176
quotient_definition
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   177
   "App :: lam \<Rightarrow> lam \<Rightarrow> lam"
1139
c4001cda9da3 renamed 'as' to 'is' everywhere.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
   178
is
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   179
  "rApp"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   180
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   181
quotient_definition
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   182
  "Lam :: name \<Rightarrow> lam \<Rightarrow> lam"
1139
c4001cda9da3 renamed 'as' to 'is' everywhere.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
   183
is
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   184
  "rLam"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   185
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   186
quotient_definition
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   187
  "fv :: lam \<Rightarrow> atom set"
1139
c4001cda9da3 renamed 'as' to 'is' everywhere.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
   188
is
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   189
  "rfv"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   190
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   191
lemma perm_rsp[quot_respect]:
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   192
  "(op = ===> alpha ===> alpha) permute permute"
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   193
  apply(auto)
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   194
  apply(rule alpha_eqvt)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   195
  apply(simp)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   196
  done
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   197
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   198
lemma rVar_rsp[quot_respect]:
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   199
  "(op = ===> alpha) rVar rVar"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   200
  by (auto intro: a1)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   201
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   202
lemma rApp_rsp[quot_respect]: 
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   203
  "(alpha ===> alpha ===> alpha) rApp rApp"
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   204
  by (auto intro: a2)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   205
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   206
lemma rLam_rsp[quot_respect]: 
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   207
  "(op = ===> alpha ===> alpha) rLam rLam"
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   208
  apply(auto)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   209
  apply(rule a3)
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   210
  apply(rule_tac x="0" in exI)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   211
  unfolding fresh_star_def 
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   212
  apply(simp add: fresh_star_def fresh_zero_perm alpha_gen.simps)
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   213
  apply(simp add: alpha_rfv)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   214
  done
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   215
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   216
lemma rfv_rsp[quot_respect]: 
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   217
  "(alpha ===> op =) rfv rfv"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   218
apply(simp add: alpha_rfv)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   219
done
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   220
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   221
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   222
section {* lifted theorems *}
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   223
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   224
lemma lam_induct:
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   225
  "\<lbrakk>\<And>name. P (Var name);
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   226
    \<And>lam1 lam2. \<lbrakk>P lam1; P lam2\<rbrakk> \<Longrightarrow> P (App lam1 lam2);
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   227
    \<And>name lam. P lam \<Longrightarrow> P (Lam name lam)\<rbrakk> 
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   228
    \<Longrightarrow> P lam"
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   229
  apply (lifting rlam.induct)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   230
  done
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   231
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   232
instantiation lam :: pt
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   233
begin
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   234
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   235
quotient_definition
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   236
  "permute_lam :: perm \<Rightarrow> lam \<Rightarrow> lam"
1139
c4001cda9da3 renamed 'as' to 'is' everywhere.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1129
diff changeset
   237
is
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   238
  "permute :: perm \<Rightarrow> rlam \<Rightarrow> rlam"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   239
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   240
lemma permute_lam [simp]:
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   241
  shows "pi \<bullet> Var a = Var (pi \<bullet> a)"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   242
  and   "pi \<bullet> App t1 t2 = App (pi \<bullet> t1) (pi \<bullet> t2)"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   243
  and   "pi \<bullet> Lam a t = Lam (pi \<bullet> a) (pi \<bullet> t)"
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   244
apply(lifting permute_rlam.simps)
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   245
done
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   246
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   247
instance
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   248
apply default
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   249
apply(induct_tac [!] x rule: lam_induct)
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   250
apply(simp_all)
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   251
done
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   252
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   253
end
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   254
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   255
lemma fv_lam [simp]: 
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   256
  shows "fv (Var a) = {atom a}"
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   257
  and   "fv (App t1 t2) = fv t1 \<union> fv t2"
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   258
  and   "fv (Lam a t) = fv t - {atom a}"
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   259
apply(lifting rfv_var rfv_app rfv_lam)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   260
done
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   261
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   262
lemma fv_eqvt:
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   263
  shows "(p \<bullet> fv t) = fv (p \<bullet> t)"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   264
apply(lifting rfv_eqvt)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   265
done
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   266
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   267
lemma a1: 
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   268
  "a = b \<Longrightarrow> Var a = Var b"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   269
  by  (lifting a1)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   270
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   271
lemma a2: 
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   272
  "\<lbrakk>x = xa; xb = xc\<rbrakk> \<Longrightarrow> App x xb = App xa xc"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   273
  by  (lifting a2)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   274
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   275
lemma alpha_gen_rsp_pre:
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   276
  assumes a5: "\<And>t s. R t s \<Longrightarrow> R (pi \<bullet> t) (pi \<bullet> s)"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   277
  and     a1: "R s1 t1"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   278
  and     a2: "R s2 t2"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   279
  and     a3: "\<And>a b c d. R a b \<Longrightarrow> R c d \<Longrightarrow> R1 a c = R2 b d"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   280
  and     a4: "\<And>x y. R x y \<Longrightarrow> fv1 x = fv2 y"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   281
  shows   "(a, s1) \<approx>gen R1 fv1 pi (b, s2) = (a, t1) \<approx>gen R2 fv2 pi (b, t2)"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   282
apply (simp add: alpha_gen.simps)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   283
apply (simp only: a4[symmetric, OF a1] a4[symmetric, OF a2])
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   284
apply auto
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   285
apply (subst a3[symmetric])
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   286
apply (rule a5)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   287
apply (rule a1)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   288
apply (rule a2)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   289
apply (assumption)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   290
apply (subst a3)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   291
apply (rule a5)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   292
apply (rule a1)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   293
apply (rule a2)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   294
apply (assumption)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   295
done
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   296
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   297
lemma [quot_respect]: "(prod_rel op = alpha ===>
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   298
           (alpha ===> alpha ===> op =) ===> (alpha ===> op =) ===> op = ===> prod_rel op = alpha ===> op =)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   299
           alpha_gen alpha_gen"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   300
apply simp
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   301
apply clarify
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   302
apply (rule alpha_gen_rsp_pre[of "alpha",OF alpha_eqvt])
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   303
apply auto
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   304
done
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   305
1019
d7b8c4243cd6 Lam2 finished apart from Rep_eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1017
diff changeset
   306
(* pi_abs would be also sufficient to prove the next lemma *)
d7b8c4243cd6 Lam2 finished apart from Rep_eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1017
diff changeset
   307
lemma replam_eqvt: "pi \<bullet> (rep_lam x) = rep_lam (pi \<bullet> x)"
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   308
apply (unfold rep_lam_def)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   309
sorry
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   310
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   311
lemma [quot_preserve]: "(prod_fun id rep_lam --->
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   312
           (abs_lam ---> abs_lam ---> id) ---> (abs_lam ---> id) ---> id ---> (prod_fun id rep_lam) ---> id)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   313
           alpha_gen = alpha_gen"
1020
89ccda903f4a With unfolding Rep/Abs_eqvt no longer needed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1019
diff changeset
   314
apply (simp add: expand_fun_eq alpha_gen.simps Quotient_abs_rep[OF Quotient_lam])
1019
d7b8c4243cd6 Lam2 finished apart from Rep_eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1017
diff changeset
   315
apply (simp add: replam_eqvt)
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   316
apply (simp only: Quotient_abs_rep[OF Quotient_lam])
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   317
apply auto
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   318
done
1087
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1028
diff changeset
   319
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   320
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   321
lemma alpha_prs [quot_preserve]: "(rep_lam ---> rep_lam ---> id) alpha = (op =)"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   322
apply (simp add: expand_fun_eq)
1019
d7b8c4243cd6 Lam2 finished apart from Rep_eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1017
diff changeset
   323
apply (simp add: Quotient_rel_rep[OF Quotient_lam])
d7b8c4243cd6 Lam2 finished apart from Rep_eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1017
diff changeset
   324
done
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   325
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   326
lemma a3:
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   327
  "\<exists>pi. ({atom a}, t) \<approx>gen (op =) fv pi ({atom b}, s) \<Longrightarrow> Lam a t = Lam b s"
1020
89ccda903f4a With unfolding Rep/Abs_eqvt no longer needed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1019
diff changeset
   328
  apply (unfold alpha_gen)
89ccda903f4a With unfolding Rep/Abs_eqvt no longer needed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1019
diff changeset
   329
  apply (lifting a3[unfolded alpha_gen])
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   330
  done
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   331
1019
d7b8c4243cd6 Lam2 finished apart from Rep_eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1017
diff changeset
   332
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   333
lemma a3_inv:
1019
d7b8c4243cd6 Lam2 finished apart from Rep_eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1017
diff changeset
   334
  "Lam a t = Lam b s \<Longrightarrow> \<exists>pi. ({atom a}, t) \<approx>gen (op =) fv pi ({atom b}, s)"
1020
89ccda903f4a With unfolding Rep/Abs_eqvt no longer needed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1019
diff changeset
   335
  apply (unfold alpha_gen)
89ccda903f4a With unfolding Rep/Abs_eqvt no longer needed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1019
diff changeset
   336
  apply (lifting a3_inverse[unfolded alpha_gen])
89ccda903f4a With unfolding Rep/Abs_eqvt no longer needed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1019
diff changeset
   337
  done
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   338
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   339
lemma alpha_cases: 
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   340
  "\<lbrakk>a1 = a2; \<And>a b. \<lbrakk>a1 = Var a; a2 = Var b; a = b\<rbrakk> \<Longrightarrow> P;
1020
89ccda903f4a With unfolding Rep/Abs_eqvt no longer needed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1019
diff changeset
   341
    \<And>t1 t2 s1 s2. \<lbrakk>a1 = App t1 s1; a2 = App t2 s2; t1 = t2; s1 = s2\<rbrakk> \<Longrightarrow> P;
1019
d7b8c4243cd6 Lam2 finished apart from Rep_eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1017
diff changeset
   342
    \<And>a t b s. \<lbrakk>a1 = Lam a t; a2 = Lam b s; \<exists>pi. ({atom a}, t) \<approx>gen (op =) fv pi ({atom b}, s)\<rbrakk>
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   343
   \<Longrightarrow> P\<rbrakk>
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   344
    \<Longrightarrow> P"
1020
89ccda903f4a With unfolding Rep/Abs_eqvt no longer needed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1019
diff changeset
   345
unfolding alpha_gen
89ccda903f4a With unfolding Rep/Abs_eqvt no longer needed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1019
diff changeset
   346
apply (lifting alpha.cases[unfolded alpha_gen])
89ccda903f4a With unfolding Rep/Abs_eqvt no longer needed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1019
diff changeset
   347
done
1019
d7b8c4243cd6 Lam2 finished apart from Rep_eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1017
diff changeset
   348
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   349
(* not sure whether needed *)
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   350
lemma alpha_induct: 
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   351
  "\<lbrakk>qx = qxa; \<And>a b. a = b \<Longrightarrow> qxb (Var a) (Var b);
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   352
    \<And>x xa xb xc. \<lbrakk>x = xa; qxb x xa; xb = xc; qxb xb xc\<rbrakk> \<Longrightarrow> qxb (App x xb) (App xa xc);
1026
278253330b6a Disambiguating the syntax.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1025
diff changeset
   353
 \<And>a t b s. \<exists>pi. ({atom a}, t) \<approx>gen (\<lambda>x1 x2. x1 = x2 \<and> qxb x1 x2) fv pi ({atom b}, s) \<Longrightarrow> qxb (Lam a t) (Lam b s)\<rbrakk>
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   354
    \<Longrightarrow> qxb qx qxa"
1020
89ccda903f4a With unfolding Rep/Abs_eqvt no longer needed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1019
diff changeset
   355
unfolding alpha_gen by (lifting alpha.induct[unfolded alpha_gen])
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   356
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   357
(* should they lift automatically *)
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   358
lemma lam_inject [simp]: 
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   359
  shows "(Var a = Var b) = (a = b)"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   360
  and   "(App t1 t2 = App s1 s2) = (t1 = s1 \<and> t2 = s2)"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   361
apply(lifting rlam.inject(1) rlam.inject(2))
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   362
apply(regularize)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   363
prefer 2
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   364
apply(regularize)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   365
prefer 2
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   366
apply(auto)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   367
apply(drule alpha.cases)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   368
apply(simp_all)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   369
apply(simp add: alpha.a1)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   370
apply(drule alpha.cases)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   371
apply(simp_all)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   372
apply(drule alpha.cases)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   373
apply(simp_all)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   374
apply(rule alpha.a2)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   375
apply(simp_all)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   376
done
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   377
1019
d7b8c4243cd6 Lam2 finished apart from Rep_eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1017
diff changeset
   378
thm a3_inv
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   379
lemma Lam_pseudo_inject:
1019
d7b8c4243cd6 Lam2 finished apart from Rep_eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1017
diff changeset
   380
  shows "(Lam a t = Lam b s) = (\<exists>pi. ({atom a}, t) \<approx>gen (op =) fv pi ({atom b}, s))"
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   381
apply(rule iffI)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   382
apply(rule a3_inv)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   383
apply(assumption)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   384
apply(rule a3)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   385
apply(assumption)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   386
done
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   387
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   388
lemma rlam_distinct:
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   389
  shows "\<not>(rVar nam \<approx> rApp rlam1' rlam2')"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   390
  and   "\<not>(rApp rlam1' rlam2' \<approx> rVar nam)"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   391
  and   "\<not>(rVar nam \<approx> rLam nam' rlam')"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   392
  and   "\<not>(rLam nam' rlam' \<approx> rVar nam)"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   393
  and   "\<not>(rApp rlam1 rlam2 \<approx> rLam nam' rlam')"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   394
  and   "\<not>(rLam nam' rlam' \<approx> rApp rlam1 rlam2)"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   395
apply auto
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   396
apply (erule alpha.cases)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   397
apply (simp_all only: rlam.distinct)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   398
apply (erule alpha.cases)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   399
apply (simp_all only: rlam.distinct)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   400
apply (erule alpha.cases)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   401
apply (simp_all only: rlam.distinct)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   402
apply (erule alpha.cases)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   403
apply (simp_all only: rlam.distinct)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   404
apply (erule alpha.cases)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   405
apply (simp_all only: rlam.distinct)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   406
apply (erule alpha.cases)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   407
apply (simp_all only: rlam.distinct)
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   408
done
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   409
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   410
lemma lam_distinct[simp]:
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   411
  shows "Var nam \<noteq> App lam1' lam2'"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   412
  and   "App lam1' lam2' \<noteq> Var nam"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   413
  and   "Var nam \<noteq> Lam nam' lam'"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   414
  and   "Lam nam' lam' \<noteq> Var nam"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   415
  and   "App lam1 lam2 \<noteq> Lam nam' lam'"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   416
  and   "Lam nam' lam' \<noteq> App lam1 lam2"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   417
apply(lifting rlam_distinct(1) rlam_distinct(2) rlam_distinct(3) rlam_distinct(4) rlam_distinct(5) rlam_distinct(6))
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   418
done
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   419
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   420
lemma var_supp1:
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   421
  shows "(supp (Var a)) = (supp a)"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   422
  apply (simp add: supp_def)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   423
  done
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   424
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   425
lemma var_supp:
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   426
  shows "(supp (Var a)) = {a:::name}"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   427
  using var_supp1 by (simp add: supp_at_base)
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   428
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   429
lemma app_supp:
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   430
  shows "supp (App t1 t2) = (supp t1) \<union> (supp t2)"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   431
apply(simp only: supp_def lam_inject)
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   432
apply(simp add: Collect_imp_eq Collect_neg_eq)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   433
done
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   434
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   435
(* supp for lam *)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   436
lemma lam_supp1:
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   437
  shows "(supp (atom x, t)) supports (Lam x t) "
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   438
apply(simp add: supports_def)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   439
apply(fold fresh_def)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   440
apply(simp add: fresh_Pair swap_fresh_fresh)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   441
apply(clarify)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   442
apply(subst swap_at_base_simps(3))
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   443
apply(simp_all add: fresh_atom)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   444
done
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   445
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   446
lemma lam_fsupp1:
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   447
  assumes a: "finite (supp t)"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   448
  shows "finite (supp (Lam x t))"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   449
apply(rule supports_finite)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   450
apply(rule lam_supp1)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   451
apply(simp add: a supp_Pair supp_atom)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   452
done
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   453
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   454
instance lam :: fs
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   455
apply(default)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   456
apply(induct_tac x rule: lam_induct)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   457
apply(simp add: var_supp)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   458
apply(simp add: app_supp)
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   459
apply(simp add: lam_fsupp1)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   460
done
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   461
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   462
lemma supp_fv:
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   463
  shows "supp t = fv t"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   464
apply(induct t rule: lam_induct)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   465
apply(simp add: var_supp)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   466
apply(simp add: app_supp)
1019
d7b8c4243cd6 Lam2 finished apart from Rep_eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1017
diff changeset
   467
apply(subgoal_tac "supp (Lam name lam) = supp (Abs {atom name} lam)")
d7b8c4243cd6 Lam2 finished apart from Rep_eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1017
diff changeset
   468
apply(simp add: supp_Abs)
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   469
apply(simp (no_asm) add: supp_def permute_set_eq atom_eqvt)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   470
apply(simp add: Lam_pseudo_inject)
1019
d7b8c4243cd6 Lam2 finished apart from Rep_eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1017
diff changeset
   471
apply(simp add: Abs_eq_iff)
d7b8c4243cd6 Lam2 finished apart from Rep_eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1017
diff changeset
   472
apply(simp add: alpha_gen.simps)
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   473
apply(simp add: supp_eqvt[symmetric] fv_eqvt[symmetric])
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   474
done
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   475
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   476
lemma lam_supp2:
1019
d7b8c4243cd6 Lam2 finished apart from Rep_eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1017
diff changeset
   477
  shows "supp (Lam x t) = supp (Abs {atom x} t)"
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   478
apply(simp add: supp_def permute_set_eq atom_eqvt)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   479
apply(simp add: Lam_pseudo_inject)
1019
d7b8c4243cd6 Lam2 finished apart from Rep_eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1017
diff changeset
   480
apply(simp add: Abs_eq_iff)
d7b8c4243cd6 Lam2 finished apart from Rep_eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1017
diff changeset
   481
apply(simp add: alpha_gen  supp_fv)
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   482
done
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   483
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   484
lemma lam_supp:
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   485
  shows "supp (Lam x t) = ((supp t) - {atom x})"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   486
apply(simp add: lam_supp2)
1019
d7b8c4243cd6 Lam2 finished apart from Rep_eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1017
diff changeset
   487
apply(simp add: supp_Abs)
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   488
done
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   489
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   490
lemma fresh_lam:
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   491
  "(atom a \<sharp> Lam b t) \<longleftrightarrow> (a = b) \<or> (a \<noteq> b \<and> atom a \<sharp> t)"
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   492
apply(simp add: fresh_def)
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   493
apply(simp add: lam_supp)
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   494
apply(auto)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   495
done
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   496
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   497
lemma lam_induct_strong:
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   498
  fixes a::"'a::fs"
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   499
  assumes a1: "\<And>name b. P b (Var name)"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   500
  and     a2: "\<And>lam1 lam2 b. \<lbrakk>\<And>c. P c lam1; \<And>c. P c lam2\<rbrakk> \<Longrightarrow> P b (App lam1 lam2)"
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   501
  and     a3: "\<And>name lam b. \<lbrakk>\<And>c. P c lam; (atom name) \<sharp> b\<rbrakk> \<Longrightarrow> P b (Lam name lam)"
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   502
  shows "P a lam"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   503
proof -
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   504
  have "\<And>pi a. P a (pi \<bullet> lam)" 
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   505
  proof (induct lam rule: lam_induct)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   506
    case (1 name pi)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   507
    show "P a (pi \<bullet> Var name)"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   508
      apply (simp)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   509
      apply (rule a1)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   510
      done
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   511
  next
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   512
    case (2 lam1 lam2 pi)
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   513
    have b1: "\<And>pi a. P a (pi \<bullet> lam1)" by fact
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   514
    have b2: "\<And>pi a. P a (pi \<bullet> lam2)" by fact
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   515
    show "P a (pi \<bullet> App lam1 lam2)"
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   516
      apply (simp)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   517
      apply (rule a2)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   518
      apply (rule b1)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   519
      apply (rule b2)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   520
      done
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   521
  next
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   522
    case (3 name lam pi a)
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   523
    have b: "\<And>pi a. P a (pi \<bullet> lam)" by fact
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   524
    obtain c::name where fr: "atom c\<sharp>(a, pi\<bullet>name, pi\<bullet>lam)"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   525
      apply(rule obtain_atom)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   526
      apply(auto)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   527
      sorry
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   528
    from b fr have p: "P a (Lam c (((c \<leftrightarrow> (pi \<bullet> name)) + pi)\<bullet>lam))" 
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   529
      apply -
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   530
      apply(rule a3)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   531
      apply(blast)
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   532
      apply(simp add: fresh_Pair)
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   533
      done
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   534
    have eq: "(atom c \<rightleftharpoons> atom (pi\<bullet>name)) \<bullet> Lam (pi \<bullet> name) (pi \<bullet> lam) = Lam (pi \<bullet> name) (pi \<bullet> lam)"
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   535
      apply(rule swap_fresh_fresh)
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   536
      using fr
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   537
      apply(simp add: fresh_lam fresh_Pair)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   538
      apply(simp add: fresh_lam fresh_Pair)
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   539
      done
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   540
    show "P a (pi \<bullet> Lam name lam)" 
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   541
      apply (simp)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   542
      apply(subst eq[symmetric])
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   543
      using p
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   544
      apply(simp only: permute_lam)
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   545
      apply(simp add: flip_def)
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   546
      done
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   547
  qed
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   548
  then have "P a (0 \<bullet> lam)" by blast
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   549
  then show "P a lam" by simp 
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   550
qed
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   551
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   552
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   553
lemma var_fresh:
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   554
  fixes a::"name"
1017
4239a0784e5f All should be ok now.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1011
diff changeset
   555
  shows "(atom a \<sharp> (Var b)) = (atom a \<sharp> b)"
1011
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   556
  apply(simp add: fresh_def)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   557
  apply(simp add: var_supp1)
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   558
  done
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   559
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   560
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   561
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   562
end
1dd314a00b0c Fixed wrong rename.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   563