src/HOL/Nominal/Examples/VC_Condition.thy
author wenzelm
Fri, 18 Aug 2017 20:47:47 +0200
changeset 66453 cc19f7ca2ed6
parent 63167 0909deb8059b
permissions -rw-r--r--
session-qualified theory imports: isabelle imports -U -i -d '~~/src/Benchmarks' -a;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25727
e43d91f31118 adapted theory name;
wenzelm
parents: 25722
diff changeset
     1
theory VC_Condition
66453
cc19f7ca2ed6 session-qualified theory imports: isabelle imports -U -i -d '~~/src/Benchmarks' -a;
wenzelm
parents: 63167
diff changeset
     2
imports "HOL-Nominal.Nominal" 
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
     3
begin
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
     4
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
     5
text \<open>
26262
urbanc
parents: 26095
diff changeset
     6
  We give here two examples showing that if we use the variable  
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
     7
  convention carelessly in rule inductions, we might end 
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
     8
  up with faulty lemmas. The point is that the examples
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
     9
  are not variable-convention compatible and therefore in the 
25751
a4e69ce247e0 tuned proofs and comments
urbanc
parents: 25727
diff changeset
    10
  nominal data package one is protected from such bogus reasoning.
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
    11
\<close>
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    12
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
    13
text \<open>We define alpha-equated lambda-terms as usual.\<close>
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    14
atom_decl name 
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    15
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    16
nominal_datatype lam = 
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    17
    Var "name"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    18
  | App "lam" "lam"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    19
  | Lam "\<guillemotleft>name\<guillemotright>lam" ("Lam [_]._" [100,100] 100)
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    20
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
    21
text \<open>
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    22
  The inductive relation 'unbind' unbinds the top-most  
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    23
  binders of a lambda-term; this relation is obviously  
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    24
  not a function, since it does not respect alpha-      
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    25
  equivalence. However as a relation 'unbind' is ok and     
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    26
  a similar relation has been used in our formalisation 
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
    27
  of the algorithm W.\<close>
26055
a7a537e0413a tuned proofs and comments
urbanc
parents: 25867
diff changeset
    28
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    29
inductive
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    30
  unbind :: "lam \<Rightarrow> name list \<Rightarrow> lam \<Rightarrow> bool" ("_ \<mapsto> _,_" [60,60,60] 60)
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    31
where
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    32
  u_var: "(Var a) \<mapsto> [],(Var a)"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    33
| u_app: "(App t1 t2) \<mapsto> [],(App t1 t2)"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    34
| u_lam: "t\<mapsto>xs,t' \<Longrightarrow> (Lam [x].t) \<mapsto> (x#xs),t'"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    35
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
    36
text \<open>
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    37
  We can show that Lam [x].Lam [x].Var x unbinds to [x,x],Var x 
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    38
  and also to [z,y],Var y (though the proof for the second is a 
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
    39
  bit clumsy).\<close> 
26055
a7a537e0413a tuned proofs and comments
urbanc
parents: 25867
diff changeset
    40
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    41
lemma unbind_lambda_lambda1: 
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    42
  shows "Lam [x].Lam [x].(Var x)\<mapsto>[x,x],(Var x)"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    43
by (auto intro: unbind.intros)
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    44
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    45
lemma unbind_lambda_lambda2: 
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    46
  shows "Lam [x].Lam [x].(Var x)\<mapsto>[y,z],(Var z)"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    47
proof -
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    48
  have "Lam [x].Lam [x].(Var x) = Lam [y].Lam [z].(Var z)" 
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    49
    by (auto simp add: lam.inject alpha calc_atm abs_fresh fresh_atm)
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    50
  moreover
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    51
  have "Lam [y].Lam [z].(Var z) \<mapsto> [y,z],(Var z)"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    52
    by (auto intro: unbind.intros)
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    53
  ultimately 
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    54
  show "Lam [x].Lam [x].(Var x)\<mapsto>[y,z],(Var z)" by simp
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    55
qed
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    56
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
    57
text \<open>Unbind is equivariant ...\<close>
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    58
equivariance unbind
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    59
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
    60
text \<open>
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    61
  ... but it is not variable-convention compatible (see Urban, 
25751
a4e69ce247e0 tuned proofs and comments
urbanc
parents: 25727
diff changeset
    62
  Berghofer, Norrish [2007]). This condition requires for rule u_lam to 
a4e69ce247e0 tuned proofs and comments
urbanc
parents: 25727
diff changeset
    63
  have the binder x not being a free variable in this rule's conclusion. 
a4e69ce247e0 tuned proofs and comments
urbanc
parents: 25727
diff changeset
    64
  Because this condition is not satisfied, Isabelle will not derive a 
a4e69ce247e0 tuned proofs and comments
urbanc
parents: 25727
diff changeset
    65
  strong induction principle for 'unbind' - that means Isabelle does not 
a4e69ce247e0 tuned proofs and comments
urbanc
parents: 25727
diff changeset
    66
  allow us to use the variable convention in induction proofs over 'unbind'. 
a4e69ce247e0 tuned proofs and comments
urbanc
parents: 25727
diff changeset
    67
  We can, however, force Isabelle to derive the strengthening induction 
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
    68
  principle and see what happens.\<close>
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    69
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    70
nominal_inductive unbind
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    71
  sorry
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    72
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
    73
text \<open>
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    74
  To obtain a faulty lemma, we introduce the function 'bind'
25751
a4e69ce247e0 tuned proofs and comments
urbanc
parents: 25727
diff changeset
    75
  which takes a list of names and abstracts them away in 
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
    76
  a given lambda-term.\<close>
26055
a7a537e0413a tuned proofs and comments
urbanc
parents: 25867
diff changeset
    77
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    78
fun 
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    79
  bind :: "name list \<Rightarrow> lam \<Rightarrow> lam"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    80
where
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    81
  "bind [] t = t"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    82
| "bind (x#xs) t = Lam [x].(bind xs t)"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    83
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
    84
text \<open>
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    85
  Although not necessary for our main argument below, we can 
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
    86
  easily prove that bind undoes the unbinding.\<close>
26055
a7a537e0413a tuned proofs and comments
urbanc
parents: 25867
diff changeset
    87
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    88
lemma bind_unbind:
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    89
  assumes a: "t \<mapsto> xs,t'"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    90
  shows "t = bind xs t'"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    91
using a by (induct) (auto)
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    92
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
    93
text \<open>
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    94
  The next lemma shows by induction on xs that if x is a free 
25867
c24395ea4e71 tuned proofs
urbanc
parents: 25751
diff changeset
    95
  variable in t, and x does not occur in xs, then x is a free 
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    96
  variable in bind xs t. In the nominal tradition we formulate    
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
    97
  'is a free variable in' as 'is not fresh for'.\<close>
26055
a7a537e0413a tuned proofs and comments
urbanc
parents: 25867
diff changeset
    98
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
    99
lemma free_variable:
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   100
  fixes x::"name"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   101
  assumes a: "\<not>(x\<sharp>t)" and b: "x\<sharp>xs"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   102
  shows "\<not>(x\<sharp>bind xs t)"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   103
using a b
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   104
by (induct xs)
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   105
   (auto simp add: fresh_list_cons abs_fresh fresh_atm)
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   106
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
   107
text \<open>
25751
a4e69ce247e0 tuned proofs and comments
urbanc
parents: 25727
diff changeset
   108
  Now comes the first faulty lemma. It is derived using the     
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   109
  variable convention (i.e. our strong induction principle). 
26262
urbanc
parents: 26095
diff changeset
   110
  This faulty lemma states that if t unbinds to x#xs and t', 
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   111
  and x is a free variable in t', then it is also a free 
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   112
  variable in bind xs t'. We show this lemma by assuming that 
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
   113
  the binder x is fresh w.r.t. to the xs unbound previously.\<close>   
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   114
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   115
lemma faulty1:
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   116
  assumes a: "t\<mapsto>(x#xs),t'"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   117
  shows "\<not>(x\<sharp>t') \<Longrightarrow> \<not>(x\<sharp>bind xs t')"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   118
using a
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   119
by (nominal_induct t xs'\<equiv>"x#xs" t' avoiding: xs rule: unbind.strong_induct)
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   120
   (simp_all add: free_variable)
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   121
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
   122
text \<open>
25751
a4e69ce247e0 tuned proofs and comments
urbanc
parents: 25727
diff changeset
   123
  Obviously this lemma is bogus. For example, in 
a4e69ce247e0 tuned proofs and comments
urbanc
parents: 25727
diff changeset
   124
  case Lam [x].Lam [x].(Var x) \<mapsto> [x,x],(Var x). 
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
   125
  As a result, we can prove False.\<close>
26055
a7a537e0413a tuned proofs and comments
urbanc
parents: 25867
diff changeset
   126
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   127
lemma false1:
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   128
  shows "False"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   129
proof -
26932
c398a3866082 avoid undeclared variables within proofs;
wenzelm
parents: 26262
diff changeset
   130
  fix x
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   131
  have "Lam [x].Lam [x].(Var x)\<mapsto>[x,x],(Var x)" 
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   132
  and  "\<not>(x\<sharp>Var x)" by (simp_all add: unbind_lambda_lambda1 fresh_atm)
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   133
  then have "\<not>(x\<sharp>(bind [x] (Var x)))" by (rule faulty1)
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   134
  moreover 
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   135
  have "x\<sharp>(bind [x] (Var x))" by (simp add: abs_fresh)
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   136
  ultimately
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   137
  show "False" by simp
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   138
qed
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   139
   
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
   140
text \<open>
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   141
  The next example is slightly simpler, but looks more
25751
a4e69ce247e0 tuned proofs and comments
urbanc
parents: 25727
diff changeset
   142
  contrived than 'unbind'. This example, called 'strip' just 
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
   143
  strips off the top-most binders from lambdas.\<close>
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   144
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   145
inductive
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   146
  strip :: "lam \<Rightarrow> lam \<Rightarrow> bool" ("_ \<rightarrow> _" [60,60] 60)
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   147
where
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   148
  s_var: "(Var a) \<rightarrow> (Var a)"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   149
| s_app: "(App t1 t2) \<rightarrow> (App t1 t2)"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   150
| s_lam: "t \<rightarrow> t' \<Longrightarrow> (Lam [x].t) \<rightarrow> t'"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   151
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
   152
text \<open>
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   153
  The relation is equivariant but we have to use again 
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
   154
  sorry to derive a strong induction principle.\<close>
26055
a7a537e0413a tuned proofs and comments
urbanc
parents: 25867
diff changeset
   155
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   156
equivariance strip
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   157
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   158
nominal_inductive strip
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   159
  sorry
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   160
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
   161
text \<open>
25751
a4e69ce247e0 tuned proofs and comments
urbanc
parents: 25727
diff changeset
   162
  The second faulty lemma shows that a variable being fresh
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
   163
  for a term is also fresh for this term after striping.\<close>
26055
a7a537e0413a tuned proofs and comments
urbanc
parents: 25867
diff changeset
   164
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   165
lemma faulty2:
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   166
  fixes x::"name"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   167
  assumes a: "t \<rightarrow> t'"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   168
  shows "x\<sharp>t \<Longrightarrow> x\<sharp>t'"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   169
using a
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   170
by (nominal_induct t t'\<equiv>t' avoiding: t' rule: strip.strong_induct)
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   171
   (auto simp add: abs_fresh)
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   172
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
   173
text \<open>Obviously Lam [x].Var x is a counter example to this lemma.\<close>
26055
a7a537e0413a tuned proofs and comments
urbanc
parents: 25867
diff changeset
   174
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   175
lemma false2:
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   176
  shows "False"
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   177
proof -
26932
c398a3866082 avoid undeclared variables within proofs;
wenzelm
parents: 26262
diff changeset
   178
  fix x
25722
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   179
  have "Lam [x].(Var x) \<rightarrow> (Var x)" by (auto intro: strip.intros)
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   180
  moreover
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   181
  have "x\<sharp>Lam [x].(Var x)" by (simp add: abs_fresh)
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   182
  ultimately have "x\<sharp>(Var x)" by (simp only: faulty2)
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   183
  then show "False" by (simp add: fresh_atm)
0a104ddb72d9 polishing of some proofs
urbanc
parents:
diff changeset
   184
qed 
26055
a7a537e0413a tuned proofs and comments
urbanc
parents: 25867
diff changeset
   185
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
   186
text \<open>A similar effect can be achieved by using naive inversion 
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
   187
  on rules.\<close>
26095
04ee0a14a9f6 slightly tuned
urbanc
parents: 26094
diff changeset
   188
04ee0a14a9f6 slightly tuned
urbanc
parents: 26094
diff changeset
   189
lemma false3: 
04ee0a14a9f6 slightly tuned
urbanc
parents: 26094
diff changeset
   190
  shows "False"
04ee0a14a9f6 slightly tuned
urbanc
parents: 26094
diff changeset
   191
proof -
26932
c398a3866082 avoid undeclared variables within proofs;
wenzelm
parents: 26262
diff changeset
   192
  fix x
26095
04ee0a14a9f6 slightly tuned
urbanc
parents: 26094
diff changeset
   193
  have "Lam [x].(Var x) \<rightarrow> (Var x)" by (auto intro: strip.intros)
26262
urbanc
parents: 26095
diff changeset
   194
  moreover obtain y::"name" where fc: "y\<sharp>x" by (rule exists_fresh) (rule fin_supp)
26095
04ee0a14a9f6 slightly tuned
urbanc
parents: 26094
diff changeset
   195
  then have "Lam [x].(Var x) = Lam [y].(Var y)"
04ee0a14a9f6 slightly tuned
urbanc
parents: 26094
diff changeset
   196
    by (simp add: lam.inject alpha calc_atm fresh_atm)
04ee0a14a9f6 slightly tuned
urbanc
parents: 26094
diff changeset
   197
  ultimately have "Lam [y].(Var y) \<rightarrow> (Var x)" by simp
26262
urbanc
parents: 26095
diff changeset
   198
  then have "Var y \<rightarrow> Var x" using fc
urbanc
parents: 26095
diff changeset
   199
    by (cases rule: strip.strong_cases[where x=y])
26095
04ee0a14a9f6 slightly tuned
urbanc
parents: 26094
diff changeset
   200
       (simp_all add: lam.inject alpha abs_fresh)
26262
urbanc
parents: 26095
diff changeset
   201
  then show "False" using fc
26095
04ee0a14a9f6 slightly tuned
urbanc
parents: 26094
diff changeset
   202
    by (cases) (simp_all add: lam.inject fresh_atm)
04ee0a14a9f6 slightly tuned
urbanc
parents: 26094
diff changeset
   203
qed
04ee0a14a9f6 slightly tuned
urbanc
parents: 26094
diff changeset
   204
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
   205
text \<open>
26262
urbanc
parents: 26095
diff changeset
   206
  Moral: Who would have thought that the variable convention 
urbanc
parents: 26095
diff changeset
   207
  is in general an unsound reasoning principle.
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62390
diff changeset
   208
\<close>
26262
urbanc
parents: 26095
diff changeset
   209
62390
842917225d56 more canonical names
nipkow
parents: 41589
diff changeset
   210
end