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