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