# Theory Quantifiers

theory Quantifiers
imports LK
`(*  Title:      Sequents/LK/Quantifiers.thy    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory    Copyright   1992  University of CambridgeClassical sequent calculus: examples with quantifiers.*)theory Quantifiersimports LKbeginlemma "|- (ALL x. P)  <->  P"  by fastlemma "|- (ALL x y. P(x,y))  <->  (ALL y x. P(x,y))"  by fastlemma "ALL u. P(u), ALL v. Q(v) |- ALL u v. P(u) & Q(v)"  by fasttext "Permutation of existential quantifier."lemma "|- (EX x y. P(x,y)) <-> (EX y x. P(x,y))"  by fastlemma "|- (ALL x. P(x) & Q(x)) <-> (ALL x. P(x)) & (ALL x. Q(x))"  by fast(*Converse is invalid*)lemma "|- (ALL x. P(x)) | (ALL x. Q(x)) --> (ALL x. P(x)|Q(x))"  by fasttext "Pushing ALL into an implication."lemma "|- (ALL x. P --> Q(x))  <->  (P --> (ALL x. Q(x)))"  by fastlemma "|- (ALL x. P(x)-->Q)  <->  ((EX x. P(x)) --> Q)"  by fastlemma "|- (EX x. P)  <->  P"  by fasttext "Distribution of EX over disjunction."lemma "|- (EX x. P(x) | Q(x)) <-> (EX x. P(x))  |  (EX x. Q(x))"  by fast(*Converse is invalid*)lemma "|- (EX x. P(x) & Q(x))  -->  (EX x. P(x))  &  (EX x. Q(x))"  by fasttext "Harder examples: classical theorems."lemma "|- (EX x. P-->Q(x))  <->  (P --> (EX x. Q(x)))"  by fastlemma "|- (EX x. P(x)-->Q)  <->  (ALL x. P(x)) --> Q"  by fastlemma "|- (ALL x. P(x)) | Q  <->  (ALL x. P(x) | Q)"  by fasttext "Basic test of quantifier reasoning"lemma "|- (EX y. ALL x. Q(x,y)) --> (ALL x. EX y. Q(x,y))"  by fastlemma "|- (ALL x. Q(x))  -->  (EX x. Q(x))"  by fasttext "The following are invalid!"(*INVALID*)lemma "|- (ALL x. EX y. Q(x,y))  -->  (EX y. ALL x. Q(x,y))"  apply fast?  apply (rule _)  oops(*INVALID*)lemma "|- (EX x. Q(x))  -->  (ALL x. Q(x))"  apply fast?  apply (rule _)  oops(*INVALID*)schematic_lemma "|- P(?a) --> (ALL x. P(x))"  apply fast?  apply (rule _)  oops(*INVALID*)schematic_lemma "|- (P(?a) --> (ALL x. Q(x))) --> (ALL x. P(x) --> Q(x))"  apply fast?  apply (rule _)  oopstext "Back to things that are provable..."lemma "|- (ALL x. P(x)-->Q(x)) & (EX x. P(x)) --> (EX x. Q(x))"  by fast(*An example of why exR should be delayed as long as possible*)lemma "|- (P--> (EX x. Q(x))) & P--> (EX x. Q(x))"  by fasttext "Solving for a Var"schematic_lemma "|- (ALL x. P(x)-->Q(f(x))) & (ALL x. Q(x)-->R(g(x))) & P(d) --> R(?a)"  by fasttext "Principia Mathematica *11.53"lemma "|- (ALL x y. P(x) --> Q(y)) <-> ((EX x. P(x)) --> (ALL y. Q(y)))"  by fasttext "Principia Mathematica *11.55"lemma "|- (EX x y. P(x) & Q(x,y)) <-> (EX x. P(x) & (EX y. Q(x,y)))"  by fasttext "Principia Mathematica *11.61"lemma "|- (EX y. ALL x. P(x) --> Q(x,y)) --> (ALL x. P(x) --> (EX y. Q(x,y)))"  by fast(*21 August 88: loaded in 45.7 secs*)(*18 September 2005: loaded in 0.114 secs*)end`