Nominal/Ex/Lambda.thy
author Christian Urban <urbanc@in.tum.de>
Fri, 09 Apr 2010 11:08:05 +0200
changeset 1797 fddb470720f1
parent 1773 Nominal/Ex/ExLam.thy@c0eac04ae3b4
child 1800 78fdc6b36a1c
permissions -rw-r--r--
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1797
fddb470720f1 renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
     1
theory Lambda
1773
c0eac04ae3b4 added README and moved examples into separate directory
Christian Urban <urbanc@in.tum.de>
parents: 1599
diff changeset
     2
imports "../Parser"
1594
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     3
begin
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     4
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     5
atom_decl name
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     7
nominal_datatype lm =
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     8
  Vr "name"
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     9
| Ap "lm" "lm"
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    10
| Lm x::"name" l::"lm"  bind x in l
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    11
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    12
lemmas supp_fn' = lm.fv[simplified lm.supp]
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    13
1797
fddb470720f1 renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    14
(* 
fddb470720f1 renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    15
  Old way of establishing strong induction
fddb470720f1 renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    16
  principles by chosing a fresh name.
fddb470720f1 renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    17
*)
1594
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    18
lemma
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    19
  fixes c::"'a::fs"
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    20
  assumes a1: "\<And>name c. P c (Vr name)"
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    21
  and     a2: "\<And>lm1 lm2 c. \<lbrakk>\<And>d. P d lm1; \<And>d. P d lm2\<rbrakk> \<Longrightarrow> P c (Ap lm1 lm2)"
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    22
  and     a3: "\<And>name lm c. \<lbrakk>atom name \<sharp> c; \<And>d. P d lm\<rbrakk> \<Longrightarrow> P c (Lm name lm)"
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    23
  shows "P c lm"
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    24
proof -
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    25
  have "\<And>p. P c (p \<bullet> lm)"
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    26
    apply(induct lm arbitrary: c rule: lm.induct)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    27
    apply(simp only: lm.perm)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    28
    apply(rule a1)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    29
    apply(simp only: lm.perm)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    30
    apply(rule a2)
1797
fddb470720f1 renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    31
    apply(assumption)
1594
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    32
    apply(assumption)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    33
    apply(subgoal_tac "\<exists>new::name. (atom new) \<sharp> (c, Lm (p \<bullet> name) (p \<bullet> lm))")
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    34
    defer
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    35
    apply(simp add: fresh_def)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    36
    apply(rule_tac X="supp (c, Lm (p \<bullet> name) (p \<bullet> lm))" in obtain_at_base)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    37
    apply(simp add: supp_Pair finite_supp)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    38
    apply(blast)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    39
    apply(erule exE)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    40
    apply(rule_tac t="p \<bullet> Lm name lm" and 
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    41
                   s="(((p \<bullet> name) \<leftrightarrow> new) + p) \<bullet> Lm name lm" in subst)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    42
    apply(simp del: lm.perm)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    43
    apply(subst lm.perm)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    44
    apply(subst (2) lm.perm)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    45
    apply(rule flip_fresh_fresh)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    46
    apply(simp add: fresh_def)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    47
    apply(simp only: supp_fn')
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    48
    apply(simp)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    49
    apply(simp add: fresh_Pair)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    50
    apply(simp)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    51
    apply(rule a3)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    52
    apply(simp add: fresh_Pair)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    53
    apply(drule_tac x="((p \<bullet> name) \<leftrightarrow> new) + p" in meta_spec)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    54
    apply(simp)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    55
    done
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    56
  then have "P c (0 \<bullet> lm)" by blast
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    57
  then show "P c lm" by simp
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    58
qed
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    59
1797
fddb470720f1 renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    60
(* 
fddb470720f1 renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    61
  New way of establishing strong induction
fddb470720f1 renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    62
  principles by using a appropriate permutation.
fddb470720f1 renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    63
*)
1594
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    64
lemma
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    65
  fixes c::"'a::fs"
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    66
  assumes a1: "\<And>name c. P c (Vr name)"
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    67
  and     a2: "\<And>lm1 lm2 c. \<lbrakk>\<And>d. P d lm1; \<And>d. P d lm2\<rbrakk> \<Longrightarrow> P c (Ap lm1 lm2)"
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    68
  and     a3: "\<And>name lm c. \<lbrakk>atom name \<sharp> c; \<And>d. P d lm\<rbrakk> \<Longrightarrow> P c (Lm name lm)"
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    69
  shows "P c lm"
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    70
proof -
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    71
  have "\<And>p. P c (p \<bullet> lm)"
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    72
    apply(induct lm arbitrary: c rule: lm.induct)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    73
    apply(simp only: lm.perm)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    74
    apply(rule a1)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    75
    apply(simp only: lm.perm)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    76
    apply(rule a2)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    77
    apply(assumption)
1797
fddb470720f1 renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    78
    apply(assumption)
1594
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    79
    apply(subgoal_tac "\<exists>q. (q \<bullet> {p \<bullet> atom name}) \<sharp>* c \<and> supp (p \<bullet> Lm name lm) \<sharp>* q")
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    80
    apply(erule exE)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    81
    apply(rule_tac t="p \<bullet> Lm name lm" and 
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    82
                   s="q \<bullet> p \<bullet> Lm name lm" in subst)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    83
    defer
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    84
    apply(simp add: lm.perm)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    85
    apply(rule a3)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    86
    apply(simp add: eqvts fresh_star_def)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    87
    apply(drule_tac x="q + p" in meta_spec)
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    88
    apply(simp)
1797
fddb470720f1 renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    89
    apply(rule at_set_avoiding2)
fddb470720f1 renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    90
    apply(simp add: finite_supp)
fddb470720f1 renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    91
    apply(simp add: finite_supp)
fddb470720f1 renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    92
    apply(simp add: finite_supp)
fddb470720f1 renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    93
    apply(simp only: lm.perm atom_eqvt)
fddb470720f1 renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    94
    apply(simp add: fresh_star_def fresh_def supp_fn')
fddb470720f1 renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    95
    apply(rule supp_perm_eq)
fddb470720f1 renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    96
    apply(simp)
fddb470720f1 renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    97
    done
1594
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    98
  then have "P c (0 \<bullet> lm)" by blast
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    99
  then show "P c lm" by simp
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   100
qed
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   101
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   102
end
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   103
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   104
892fcdb96c96 Move LamEx out of Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   105