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