src/FOL/ex/Quantifiers_Cla.thy
 author wenzelm Sun Nov 02 18:21:45 2014 +0100 (2014-11-02) changeset 58889 5b7a9633cfa8 parent 41777 1f7cbe39d425 child 60770 240563fbf41d permissions -rw-r--r--
```     1 (*  Title:      FOL/ex/Quantifiers_Cla.thy
```
```     2     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
```
```     3     Copyright   1991  University of Cambridge
```
```     4 *)
```
```     5
```
```     6 section {* First-Order Logic: quantifier examples (classical version) *}
```
```     7
```
```     8 theory Quantifiers_Cla
```
```     9 imports FOL
```
```    10 begin
```
```    11
```
```    12 lemma "(ALL x y. P(x,y))  -->  (ALL y x. P(x,y))"
```
```    13   by fast
```
```    14
```
```    15 lemma "(EX x y. P(x,y)) --> (EX y x. P(x,y))"
```
```    16   by fast
```
```    17
```
```    18
```
```    19 -- {* Converse is false *}
```
```    20 lemma "(ALL x. P(x)) | (ALL x. Q(x)) --> (ALL x. P(x) | Q(x))"
```
```    21   by fast
```
```    22
```
```    23 lemma "(ALL x. P-->Q(x))  <->  (P--> (ALL x. Q(x)))"
```
```    24   by fast
```
```    25
```
```    26
```
```    27 lemma "(ALL x. P(x)-->Q)  <->  ((EX x. P(x)) --> Q)"
```
```    28   by fast
```
```    29
```
```    30
```
```    31 text {* Some harder ones *}
```
```    32
```
```    33 lemma "(EX x. P(x) | Q(x)) <-> (EX x. P(x)) | (EX x. Q(x))"
```
```    34   by fast
```
```    35
```
```    36 -- {* Converse is false *}
```
```    37 lemma "(EX x. P(x)&Q(x)) --> (EX x. P(x))  &  (EX x. Q(x))"
```
```    38   by fast
```
```    39
```
```    40
```
```    41 text {* Basic test of quantifier reasoning *}
```
```    42
```
```    43 -- {* TRUE *}
```
```    44 lemma "(EX y. ALL x. Q(x,y)) -->  (ALL x. EX y. Q(x,y))"
```
```    45   by fast
```
```    46
```
```    47 lemma "(ALL x. Q(x))  -->  (EX x. Q(x))"
```
```    48   by fast
```
```    49
```
```    50
```
```    51 text {* The following should fail, as they are false! *}
```
```    52
```
```    53 lemma "(ALL x. EX y. Q(x,y))  -->  (EX y. ALL x. Q(x,y))"
```
```    54   apply fast?
```
```    55   oops
```
```    56
```
```    57 lemma "(EX x. Q(x))  -->  (ALL x. Q(x))"
```
```    58   apply fast?
```
```    59   oops
```
```    60
```
```    61 schematic_lemma "P(?a) --> (ALL x. P(x))"
```
```    62   apply fast?
```
```    63   oops
```
```    64
```
```    65 schematic_lemma "(P(?a) --> (ALL x. Q(x))) --> (ALL x. P(x) --> Q(x))"
```
```    66   apply fast?
```
```    67   oops
```
```    68
```
```    69
```
```    70 text {* Back to things that are provable \dots *}
```
```    71
```
```    72 lemma "(ALL x. P(x)-->Q(x)) & (EX x. P(x)) --> (EX x. Q(x))"
```
```    73   by fast
```
```    74
```
```    75 -- {* An example of why exI should be delayed as long as possible *}
```
```    76 lemma "(P --> (EX x. Q(x))) & P --> (EX x. Q(x))"
```
```    77   by fast
```
```    78
```
```    79 schematic_lemma "(ALL x. P(x)-->Q(f(x))) & (ALL x. Q(x)-->R(g(x))) & P(d) --> R(?a)"
```
```    80   by fast
```
```    81
```
```    82 lemma "(ALL x. Q(x))  -->  (EX x. Q(x))"
```
```    83   by fast
```
```    84
```
```    85
```
```    86 text {* Some slow ones *}
```
```    87
```
```    88 -- {* Principia Mathematica *11.53 *}
```
```    89 lemma "(ALL x y. P(x) --> Q(y)) <-> ((EX x. P(x)) --> (ALL y. Q(y)))"
```
```    90   by fast
```
```    91
```
```    92 (*Principia Mathematica *11.55  *)
```
```    93 lemma "(EX x y. P(x) & Q(x,y)) <-> (EX x. P(x) & (EX y. Q(x,y)))"
```
```    94   by fast
```
```    95
```
```    96 (*Principia Mathematica *11.61  *)
```
```    97 lemma "(EX y. ALL x. P(x) --> Q(x,y)) --> (ALL x. P(x) --> (EX y. Q(x,y)))"
```
```    98   by fast
```
```    99
```
```   100 end
```