src/FOLP/ex/Classical.thy
changeset 58957 c9e744ea8a38
parent 58860 fee7cfa69c50
child 60375 b35b08a143b2
     1.1 --- a/src/FOLP/ex/Classical.thy	Sun Nov 09 14:08:00 2014 +0100
     1.2 +++ b/src/FOLP/ex/Classical.thy	Sun Nov 09 17:04:14 2014 +0100
     1.3 @@ -10,14 +10,14 @@
     1.4  begin
     1.5  
     1.6  schematic_lemma "?p : (P --> Q | R) --> (P-->Q) | (P-->R)"
     1.7 -  by (tactic "fast_tac FOLP_cs 1")
     1.8 +  by (tactic "fast_tac @{context} FOLP_cs 1")
     1.9  
    1.10  (*If and only if*)
    1.11  schematic_lemma "?p : (P<->Q) <-> (Q<->P)"
    1.12 -  by (tactic "fast_tac FOLP_cs 1")
    1.13 +  by (tactic "fast_tac @{context} FOLP_cs 1")
    1.14  
    1.15  schematic_lemma "?p : ~ (P <-> ~P)"
    1.16 -  by (tactic "fast_tac FOLP_cs 1")
    1.17 +  by (tactic "fast_tac @{context} FOLP_cs 1")
    1.18  
    1.19  
    1.20  (*Sample problems from 
    1.21 @@ -33,134 +33,134 @@
    1.22  text "Pelletier's examples"
    1.23  (*1*)
    1.24  schematic_lemma "?p : (P-->Q)  <->  (~Q --> ~P)"
    1.25 -  by (tactic "fast_tac FOLP_cs 1")
    1.26 +  by (tactic "fast_tac @{context} FOLP_cs 1")
    1.27  
    1.28  (*2*)
    1.29  schematic_lemma "?p : ~ ~ P  <->  P"
    1.30 -  by (tactic "fast_tac FOLP_cs 1")
    1.31 +  by (tactic "fast_tac @{context} FOLP_cs 1")
    1.32  
    1.33  (*3*)
    1.34  schematic_lemma "?p : ~(P-->Q) --> (Q-->P)"
    1.35 -  by (tactic "fast_tac FOLP_cs 1")
    1.36 +  by (tactic "fast_tac @{context} FOLP_cs 1")
    1.37  
    1.38  (*4*)
    1.39  schematic_lemma "?p : (~P-->Q)  <->  (~Q --> P)"
    1.40 -  by (tactic "fast_tac FOLP_cs 1")
    1.41 +  by (tactic "fast_tac @{context} FOLP_cs 1")
    1.42  
    1.43  (*5*)
    1.44  schematic_lemma "?p : ((P|Q)-->(P|R)) --> (P|(Q-->R))"
    1.45 -  by (tactic "fast_tac FOLP_cs 1")
    1.46 +  by (tactic "fast_tac @{context} FOLP_cs 1")
    1.47  
    1.48  (*6*)
    1.49  schematic_lemma "?p : P | ~ P"
    1.50 -  by (tactic "fast_tac FOLP_cs 1")
    1.51 +  by (tactic "fast_tac @{context} FOLP_cs 1")
    1.52  
    1.53  (*7*)
    1.54  schematic_lemma "?p : P | ~ ~ ~ P"
    1.55 -  by (tactic "fast_tac FOLP_cs 1")
    1.56 +  by (tactic "fast_tac @{context} FOLP_cs 1")
    1.57  
    1.58  (*8.  Peirce's law*)
    1.59  schematic_lemma "?p : ((P-->Q) --> P)  -->  P"
    1.60 -  by (tactic "fast_tac FOLP_cs 1")
    1.61 +  by (tactic "fast_tac @{context} FOLP_cs 1")
    1.62  
    1.63  (*9*)
    1.64  schematic_lemma "?p : ((P|Q) & (~P|Q) & (P| ~Q)) --> ~ (~P | ~Q)"
    1.65 -  by (tactic "fast_tac FOLP_cs 1")
    1.66 +  by (tactic "fast_tac @{context} FOLP_cs 1")
    1.67  
    1.68  (*10*)
    1.69  schematic_lemma "?p : (Q-->R) & (R-->P&Q) & (P-->Q|R) --> (P<->Q)"
    1.70 -  by (tactic "fast_tac FOLP_cs 1")
    1.71 +  by (tactic "fast_tac @{context} FOLP_cs 1")
    1.72  
    1.73  (*11.  Proved in each direction (incorrectly, says Pelletier!!)  *)
    1.74  schematic_lemma "?p : P<->P"
    1.75 -  by (tactic "fast_tac FOLP_cs 1")
    1.76 +  by (tactic "fast_tac @{context} FOLP_cs 1")
    1.77  
    1.78  (*12.  "Dijkstra's law"*)
    1.79  schematic_lemma "?p : ((P <-> Q) <-> R)  <->  (P <-> (Q <-> R))"
    1.80 -  by (tactic "fast_tac FOLP_cs 1")
    1.81 +  by (tactic "fast_tac @{context} FOLP_cs 1")
    1.82  
    1.83  (*13.  Distributive law*)
    1.84  schematic_lemma "?p : P | (Q & R)  <-> (P | Q) & (P | R)"
    1.85 -  by (tactic "fast_tac FOLP_cs 1")
    1.86 +  by (tactic "fast_tac @{context} FOLP_cs 1")
    1.87  
    1.88  (*14*)
    1.89  schematic_lemma "?p : (P <-> Q) <-> ((Q | ~P) & (~Q|P))"
    1.90 -  by (tactic "fast_tac FOLP_cs 1")
    1.91 +  by (tactic "fast_tac @{context} FOLP_cs 1")
    1.92  
    1.93  (*15*)
    1.94  schematic_lemma "?p : (P --> Q) <-> (~P | Q)"
    1.95 -  by (tactic "fast_tac FOLP_cs 1")
    1.96 +  by (tactic "fast_tac @{context} FOLP_cs 1")
    1.97  
    1.98  (*16*)
    1.99  schematic_lemma "?p : (P-->Q) | (Q-->P)"
   1.100 -  by (tactic "fast_tac FOLP_cs 1")
   1.101 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.102  
   1.103  (*17*)
   1.104  schematic_lemma "?p : ((P & (Q-->R))-->S) <-> ((~P | Q | S) & (~P | ~R | S))"
   1.105 -  by (tactic "fast_tac FOLP_cs 1")
   1.106 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.107  
   1.108  
   1.109  text "Classical Logic: examples with quantifiers"
   1.110  
   1.111  schematic_lemma "?p : (ALL x. P(x) & Q(x)) <-> (ALL x. P(x))  &  (ALL x. Q(x))"
   1.112 -  by (tactic "fast_tac FOLP_cs 1")
   1.113 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.114  
   1.115  schematic_lemma "?p : (EX x. P-->Q(x))  <->  (P --> (EX x. Q(x)))"
   1.116 -  by (tactic "fast_tac FOLP_cs 1")
   1.117 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.118  
   1.119  schematic_lemma "?p : (EX x. P(x)-->Q)  <->  (ALL x. P(x)) --> Q"
   1.120 -  by (tactic "fast_tac FOLP_cs 1")
   1.121 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.122  
   1.123  schematic_lemma "?p : (ALL x. P(x)) | Q  <->  (ALL x. P(x) | Q)"
   1.124 -  by (tactic "fast_tac FOLP_cs 1")
   1.125 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.126  
   1.127  
   1.128  text "Problems requiring quantifier duplication"
   1.129  
   1.130  (*Needs multiple instantiation of ALL.*)
   1.131  schematic_lemma "?p : (ALL x. P(x)-->P(f(x)))  &  P(d)-->P(f(f(f(d))))"
   1.132 -  by (tactic "best_tac FOLP_dup_cs 1")
   1.133 +  by (tactic "best_tac @{context} FOLP_dup_cs 1")
   1.134  
   1.135  (*Needs double instantiation of the quantifier*)
   1.136  schematic_lemma "?p : EX x. P(x) --> P(a) & P(b)"
   1.137 -  by (tactic "best_tac FOLP_dup_cs 1")
   1.138 +  by (tactic "best_tac @{context} FOLP_dup_cs 1")
   1.139  
   1.140  schematic_lemma "?p : EX z. P(z) --> (ALL x. P(x))"
   1.141 -  by (tactic "best_tac FOLP_dup_cs 1")
   1.142 +  by (tactic "best_tac @{context} FOLP_dup_cs 1")
   1.143  
   1.144  
   1.145  text "Hard examples with quantifiers"
   1.146  
   1.147  text "Problem 18"
   1.148  schematic_lemma "?p : EX y. ALL x. P(y)-->P(x)"
   1.149 -  by (tactic "best_tac FOLP_dup_cs 1")
   1.150 +  by (tactic "best_tac @{context} FOLP_dup_cs 1")
   1.151  
   1.152  text "Problem 19"
   1.153  schematic_lemma "?p : EX x. ALL y z. (P(y)-->Q(z)) --> (P(x)-->Q(x))"
   1.154 -  by (tactic "best_tac FOLP_dup_cs 1")
   1.155 +  by (tactic "best_tac @{context} FOLP_dup_cs 1")
   1.156  
   1.157  text "Problem 20"
   1.158  schematic_lemma "?p : (ALL x y. EX z. ALL w. (P(x)&Q(y)-->R(z)&S(w)))      
   1.159      --> (EX x y. P(x) & Q(y)) --> (EX z. R(z))"
   1.160 -  by (tactic "fast_tac FOLP_cs 1")
   1.161 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.162  
   1.163  text "Problem 21"
   1.164  schematic_lemma "?p : (EX x. P-->Q(x)) & (EX x. Q(x)-->P) --> (EX x. P<->Q(x))"
   1.165 -  by (tactic "best_tac FOLP_dup_cs 1")
   1.166 +  by (tactic "best_tac @{context} FOLP_dup_cs 1")
   1.167  
   1.168  text "Problem 22"
   1.169  schematic_lemma "?p : (ALL x. P <-> Q(x))  -->  (P <-> (ALL x. Q(x)))"
   1.170 -  by (tactic "fast_tac FOLP_cs 1")
   1.171 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.172  
   1.173  text "Problem 23"
   1.174  schematic_lemma "?p : (ALL x. P | Q(x))  <->  (P | (ALL x. Q(x)))"
   1.175 -  by (tactic "best_tac FOLP_dup_cs 1")
   1.176 +  by (tactic "best_tac @{context} FOLP_dup_cs 1")
   1.177  
   1.178  text "Problem 24"
   1.179  schematic_lemma "?p : ~(EX x. S(x)&Q(x)) & (ALL x. P(x) --> Q(x)|R(x)) &   
   1.180       (~(EX x. P(x)) --> (EX x. Q(x))) & (ALL x. Q(x)|R(x) --> S(x))   
   1.181      --> (EX x. P(x)&R(x))"
   1.182 -  by (tactic "fast_tac FOLP_cs 1")
   1.183 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.184  
   1.185  text "Problem 25"
   1.186  schematic_lemma "?p : (EX x. P(x)) &  
   1.187 @@ -174,7 +174,7 @@
   1.188  schematic_lemma "?u : ((EX x. p(x)) <-> (EX x. q(x))) &   
   1.189       (ALL x. ALL y. p(x) & q(y) --> (r(x) <-> s(y)))   
   1.190    --> ((ALL x. p(x)-->r(x)) <-> (ALL x. q(x)-->s(x)))"
   1.191 -  by (tactic "fast_tac FOLP_cs 1")
   1.192 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.193  
   1.194  text "Problem 27"
   1.195  schematic_lemma "?p : (EX x. P(x) & ~Q(x)) &    
   1.196 @@ -182,49 +182,49 @@
   1.197                (ALL x. M(x) & L(x) --> P(x)) &    
   1.198                ((EX x. R(x) & ~ Q(x)) --> (ALL x. L(x) --> ~ R(x)))   
   1.199            --> (ALL x. M(x) --> ~L(x))"
   1.200 -  by (tactic "fast_tac FOLP_cs 1")
   1.201 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.202  
   1.203  text "Problem 28.  AMENDED"
   1.204  schematic_lemma "?p : (ALL x. P(x) --> (ALL x. Q(x))) &    
   1.205          ((ALL x. Q(x)|R(x)) --> (EX x. Q(x)&S(x))) &   
   1.206          ((EX x. S(x)) --> (ALL x. L(x) --> M(x)))   
   1.207      --> (ALL x. P(x) & L(x) --> M(x))"
   1.208 -  by (tactic "fast_tac FOLP_cs 1")
   1.209 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.210  
   1.211  text "Problem 29.  Essentially the same as Principia Mathematica *11.71"
   1.212  schematic_lemma "?p : (EX x. P(x)) & (EX y. Q(y))   
   1.213      --> ((ALL x. P(x)-->R(x)) & (ALL y. Q(y)-->S(y))   <->      
   1.214           (ALL x y. P(x) & Q(y) --> R(x) & S(y)))"
   1.215 -  by (tactic "fast_tac FOLP_cs 1")
   1.216 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.217  
   1.218  text "Problem 30"
   1.219  schematic_lemma "?p : (ALL x. P(x) | Q(x) --> ~ R(x)) &  
   1.220          (ALL x. (Q(x) --> ~ S(x)) --> P(x) & R(x))   
   1.221      --> (ALL x. S(x))"
   1.222 -  by (tactic "fast_tac FOLP_cs 1")
   1.223 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.224  
   1.225  text "Problem 31"
   1.226  schematic_lemma "?p : ~(EX x. P(x) & (Q(x) | R(x))) &  
   1.227          (EX x. L(x) & P(x)) &  
   1.228          (ALL x. ~ R(x) --> M(x))   
   1.229      --> (EX x. L(x) & M(x))"
   1.230 -  by (tactic "fast_tac FOLP_cs 1")
   1.231 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.232  
   1.233  text "Problem 32"
   1.234  schematic_lemma "?p : (ALL x. P(x) & (Q(x)|R(x))-->S(x)) &  
   1.235          (ALL x. S(x) & R(x) --> L(x)) &  
   1.236          (ALL x. M(x) --> R(x))   
   1.237      --> (ALL x. P(x) & M(x) --> L(x))"
   1.238 -  by (tactic "best_tac FOLP_dup_cs 1")
   1.239 +  by (tactic "best_tac @{context} FOLP_dup_cs 1")
   1.240  
   1.241  text "Problem 33"
   1.242  schematic_lemma "?p : (ALL x. P(a) & (P(x)-->P(b))-->P(c))  <->     
   1.243       (ALL x. (~P(a) | P(x) | P(c)) & (~P(a) | ~P(b) | P(c)))"
   1.244 -  by (tactic "best_tac FOLP_dup_cs 1")
   1.245 +  by (tactic "best_tac @{context} FOLP_dup_cs 1")
   1.246  
   1.247  text "Problem 35"
   1.248  schematic_lemma "?p : EX x y. P(x,y) -->  (ALL u v. P(u,v))"
   1.249 -  by (tactic "best_tac FOLP_dup_cs 1")
   1.250 +  by (tactic "best_tac @{context} FOLP_dup_cs 1")
   1.251  
   1.252  text "Problem 36"
   1.253  schematic_lemma
   1.254 @@ -232,7 +232,7 @@
   1.255        (ALL x. EX y. G(x,y)) &  
   1.256        (ALL x y. J(x,y) | G(x,y) --> (ALL z. J(y,z) | G(y,z) --> H(x,z)))    
   1.257    --> (ALL x. EX y. H(x,y))"
   1.258 -  by (tactic "fast_tac FOLP_cs 1")
   1.259 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.260  
   1.261  text "Problem 37"
   1.262  schematic_lemma "?p : (ALL z. EX w. ALL x. EX y.  
   1.263 @@ -240,63 +240,63 @@
   1.264          (ALL x z. ~P(x,z) --> (EX y. Q(y,z))) &  
   1.265          ((EX x y. Q(x,y)) --> (ALL x. R(x,x)))   
   1.266      --> (ALL x. EX y. R(x,y))"
   1.267 -  by (tactic "fast_tac FOLP_cs 1")
   1.268 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.269  
   1.270  text "Problem 39"
   1.271  schematic_lemma "?p : ~ (EX x. ALL y. F(y,x) <-> ~F(y,y))"
   1.272 -  by (tactic "fast_tac FOLP_cs 1")
   1.273 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.274  
   1.275  text "Problem 40.  AMENDED"
   1.276  schematic_lemma "?p : (EX y. ALL x. F(x,y) <-> F(x,x)) -->   
   1.277                ~(ALL x. EX y. ALL z. F(z,y) <-> ~ F(z,x))"
   1.278 -  by (tactic "fast_tac FOLP_cs 1")
   1.279 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.280  
   1.281  text "Problem 41"
   1.282  schematic_lemma "?p : (ALL z. EX y. ALL x. f(x,y) <-> f(x,z) & ~ f(x,x))   
   1.283            --> ~ (EX z. ALL x. f(x,z))"
   1.284 -  by (tactic "best_tac FOLP_dup_cs 1")
   1.285 +  by (tactic "best_tac @{context} FOLP_dup_cs 1")
   1.286  
   1.287  text "Problem 44"
   1.288  schematic_lemma "?p : (ALL x. f(x) -->                                     
   1.289                (EX y. g(y) & h(x,y) & (EX y. g(y) & ~ h(x,y))))  &        
   1.290                (EX x. j(x) & (ALL y. g(y) --> h(x,y)))                    
   1.291                --> (EX x. j(x) & ~f(x))"
   1.292 -  by (tactic "fast_tac FOLP_cs 1")
   1.293 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.294  
   1.295  text "Problems (mainly) involving equality or functions"
   1.296  
   1.297  text "Problem 48"
   1.298  schematic_lemma "?p : (a=b | c=d) & (a=c | b=d) --> a=d | b=c"
   1.299 -  by (tactic "fast_tac FOLP_cs 1")
   1.300 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.301  
   1.302  text "Problem 50"
   1.303  (*What has this to do with equality?*)
   1.304  schematic_lemma "?p : (ALL x. P(a,x) | (ALL y. P(x,y))) --> (EX x. ALL y. P(x,y))"
   1.305 -  by (tactic "best_tac FOLP_dup_cs 1")
   1.306 +  by (tactic "best_tac @{context} FOLP_dup_cs 1")
   1.307  
   1.308  text "Problem 56"
   1.309  schematic_lemma
   1.310   "?p : (ALL x. (EX y. P(y) & x=f(y)) --> P(x)) <-> (ALL x. P(x) --> P(f(x)))"
   1.311 -  by (tactic "fast_tac FOLP_cs 1")
   1.312 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.313  
   1.314  text "Problem 57"
   1.315  schematic_lemma
   1.316  "?p : P(f(a,b), f(b,c)) & P(f(b,c), f(a,c)) &  
   1.317        (ALL x y z. P(x,y) & P(y,z) --> P(x,z))    -->   P(f(a,b), f(a,c))"
   1.318 -  by (tactic "fast_tac FOLP_cs 1")
   1.319 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.320  
   1.321  text "Problem 58  NOT PROVED AUTOMATICALLY"
   1.322  schematic_lemma
   1.323    notes f_cong = subst_context [where t = f]
   1.324    shows "?p : (ALL x y. f(x)=g(y)) --> (ALL x y. f(f(x))=f(g(y)))"
   1.325 -  by (tactic {* fast_tac (FOLP_cs addSIs [@{thm f_cong}]) 1 *})
   1.326 +  by (tactic {* fast_tac @{context} (FOLP_cs addSIs [@{thm f_cong}]) 1 *})
   1.327  
   1.328  text "Problem 59"
   1.329  schematic_lemma "?p : (ALL x. P(x) <-> ~P(f(x))) --> (EX x. P(x) & ~P(f(x)))"
   1.330 -  by (tactic "best_tac FOLP_dup_cs 1")
   1.331 +  by (tactic "best_tac @{context} FOLP_dup_cs 1")
   1.332  
   1.333  text "Problem 60"
   1.334  schematic_lemma "?p : ALL x. P(x,f(x)) <-> (EX y. (ALL z. P(z,y) --> P(z,f(x))) & P(x,y))"
   1.335 -  by (tactic "fast_tac FOLP_cs 1")
   1.336 +  by (tactic "fast_tac @{context} FOLP_cs 1")
   1.337  
   1.338  end