src/HOL/Hilbert_Choice.thy
changeset 39943 0ef551d47783
parent 39900 549c00e0e89b
child 39950 f3c4849868b8
equal deleted inserted replaced
39942:1ae333bfef14 39943:0ef551d47783
     5 
     5 
     6 header {* Hilbert's Epsilon-Operator and the Axiom of Choice *}
     6 header {* Hilbert's Epsilon-Operator and the Axiom of Choice *}
     7 
     7 
     8 theory Hilbert_Choice
     8 theory Hilbert_Choice
     9 imports Nat Wellfounded Plain
     9 imports Nat Wellfounded Plain
    10 uses ("Tools/meson.ML")
    10 uses ("Tools/choice_specification.ML")
    11      ("Tools/choice_specification.ML")
       
    12 begin
    11 begin
    13 
    12 
    14 subsection {* Hilbert's epsilon *}
    13 subsection {* Hilbert's epsilon *}
    15 
    14 
    16 axiomatization Eps :: "('a => bool) => 'a" where
    15 axiomatization Eps :: "('a => bool) => 'a" where
    78 apply (erule sym)
    77 apply (erule sym)
    79 done
    78 done
    80 
    79 
    81 
    80 
    82 subsection{*Axiom of Choice, Proved Using the Description Operator*}
    81 subsection{*Axiom of Choice, Proved Using the Description Operator*}
    83 
       
    84 ML {*
       
    85 structure Meson_Choices = Named_Thms
       
    86 (
       
    87   val name = "meson_choice"
       
    88   val description = "choice axioms for MESON's (and Metis's) skolemizer"
       
    89 )
       
    90 *}
       
    91 
       
    92 setup Meson_Choices.setup
       
    93 
    82 
    94 lemma choice [meson_choice]: "\<forall>x. \<exists>y. Q x y ==> \<exists>f. \<forall>x. Q x (f x)"
    83 lemma choice [meson_choice]: "\<forall>x. \<exists>y. Q x y ==> \<exists>f. \<forall>x. Q x (f x)"
    95 by (fast elim: someI)
    84 by (fast elim: someI)
    96 
    85 
    97 lemma bchoice: "\<forall>x\<in>S. \<exists>y. Q x y ==> \<exists>f. \<forall>x\<in>S. Q x (f x)"
    86 lemma bchoice: "\<forall>x\<in>S. \<exists>y. Q x y ==> \<exists>f. \<forall>x\<in>S. Q x (f x)"
   449   apply (simp add: Greatest_def)
   438   apply (simp add: Greatest_def)
   450   apply (rule GreatestM_nat_le, auto)
   439   apply (rule GreatestM_nat_le, auto)
   451   done
   440   done
   452 
   441 
   453 
   442 
   454 subsection {* The Meson proof procedure *}
       
   455 
       
   456 subsubsection {* Negation Normal Form *}
       
   457 
       
   458 text {* de Morgan laws *}
       
   459 
       
   460 lemma meson_not_conjD: "~(P&Q) ==> ~P | ~Q"
       
   461   and meson_not_disjD: "~(P|Q) ==> ~P & ~Q"
       
   462   and meson_not_notD: "~~P ==> P"
       
   463   and meson_not_allD: "!!P. ~(\<forall>x. P(x)) ==> \<exists>x. ~P(x)"
       
   464   and meson_not_exD: "!!P. ~(\<exists>x. P(x)) ==> \<forall>x. ~P(x)"
       
   465   by fast+
       
   466 
       
   467 text {* Removal of @{text "-->"} and @{text "<->"} (positive and
       
   468 negative occurrences) *}
       
   469 
       
   470 lemma meson_imp_to_disjD: "P-->Q ==> ~P | Q"
       
   471   and meson_not_impD: "~(P-->Q) ==> P & ~Q"
       
   472   and meson_iff_to_disjD: "P=Q ==> (~P | Q) & (~Q | P)"
       
   473   and meson_not_iffD: "~(P=Q) ==> (P | Q) & (~P | ~Q)"
       
   474     -- {* Much more efficient than @{prop "(P & ~Q) | (Q & ~P)"} for computing CNF *}
       
   475   and meson_not_refl_disj_D: "x ~= x | P ==> P"
       
   476   by fast+
       
   477 
       
   478 
       
   479 subsubsection {* Pulling out the existential quantifiers *}
       
   480 
       
   481 text {* Conjunction *}
       
   482 
       
   483 lemma meson_conj_exD1: "!!P Q. (\<exists>x. P(x)) & Q ==> \<exists>x. P(x) & Q"
       
   484   and meson_conj_exD2: "!!P Q. P & (\<exists>x. Q(x)) ==> \<exists>x. P & Q(x)"
       
   485   by fast+
       
   486 
       
   487 
       
   488 text {* Disjunction *}
       
   489 
       
   490 lemma meson_disj_exD: "!!P Q. (\<exists>x. P(x)) | (\<exists>x. Q(x)) ==> \<exists>x. P(x) | Q(x)"
       
   491   -- {* DO NOT USE with forall-Skolemization: makes fewer schematic variables!! *}
       
   492   -- {* With ex-Skolemization, makes fewer Skolem constants *}
       
   493   and meson_disj_exD1: "!!P Q. (\<exists>x. P(x)) | Q ==> \<exists>x. P(x) | Q"
       
   494   and meson_disj_exD2: "!!P Q. P | (\<exists>x. Q(x)) ==> \<exists>x. P | Q(x)"
       
   495   by fast+
       
   496 
       
   497 
       
   498 subsubsection {* Generating clauses for the Meson Proof Procedure *}
       
   499 
       
   500 text {* Disjunctions *}
       
   501 
       
   502 lemma meson_disj_assoc: "(P|Q)|R ==> P|(Q|R)"
       
   503   and meson_disj_comm: "P|Q ==> Q|P"
       
   504   and meson_disj_FalseD1: "False|P ==> P"
       
   505   and meson_disj_FalseD2: "P|False ==> P"
       
   506   by fast+
       
   507 
       
   508 
       
   509 subsection{*Lemmas for Meson, the Model Elimination Procedure*}
       
   510 
       
   511 text{* Generation of contrapositives *}
       
   512 
       
   513 text{*Inserts negated disjunct after removing the negation; P is a literal.
       
   514   Model elimination requires assuming the negation of every attempted subgoal,
       
   515   hence the negated disjuncts.*}
       
   516 lemma make_neg_rule: "~P|Q ==> ((~P==>P) ==> Q)"
       
   517 by blast
       
   518 
       
   519 text{*Version for Plaisted's "Postive refinement" of the Meson procedure*}
       
   520 lemma make_refined_neg_rule: "~P|Q ==> (P ==> Q)"
       
   521 by blast
       
   522 
       
   523 text{*@{term P} should be a literal*}
       
   524 lemma make_pos_rule: "P|Q ==> ((P==>~P) ==> Q)"
       
   525 by blast
       
   526 
       
   527 text{*Versions of @{text make_neg_rule} and @{text make_pos_rule} that don't
       
   528 insert new assumptions, for ordinary resolution.*}
       
   529 
       
   530 lemmas make_neg_rule' = make_refined_neg_rule
       
   531 
       
   532 lemma make_pos_rule': "[|P|Q; ~P|] ==> Q"
       
   533 by blast
       
   534 
       
   535 text{* Generation of a goal clause -- put away the final literal *}
       
   536 
       
   537 lemma make_neg_goal: "~P ==> ((~P==>P) ==> False)"
       
   538 by blast
       
   539 
       
   540 lemma make_pos_goal: "P ==> ((P==>~P) ==> False)"
       
   541 by blast
       
   542 
       
   543 
       
   544 subsubsection{* Lemmas for Forward Proof*}
       
   545 
       
   546 text{*There is a similarity to congruence rules*}
       
   547 
       
   548 (*NOTE: could handle conjunctions (faster?) by
       
   549     nf(th RS conjunct2) RS (nf(th RS conjunct1) RS conjI) *)
       
   550 lemma conj_forward: "[| P'&Q';  P' ==> P;  Q' ==> Q |] ==> P&Q"
       
   551 by blast
       
   552 
       
   553 lemma disj_forward: "[| P'|Q';  P' ==> P;  Q' ==> Q |] ==> P|Q"
       
   554 by blast
       
   555 
       
   556 (*Version of @{text disj_forward} for removal of duplicate literals*)
       
   557 lemma disj_forward2:
       
   558     "[| P'|Q';  P' ==> P;  [| Q'; P==>False |] ==> Q |] ==> P|Q"
       
   559 apply blast 
       
   560 done
       
   561 
       
   562 lemma all_forward: "[| \<forall>x. P'(x);  !!x. P'(x) ==> P(x) |] ==> \<forall>x. P(x)"
       
   563 by blast
       
   564 
       
   565 lemma ex_forward: "[| \<exists>x. P'(x);  !!x. P'(x) ==> P(x) |] ==> \<exists>x. P(x)"
       
   566 by blast
       
   567 
       
   568 
       
   569 subsection {* Meson package *}
       
   570 
       
   571 use "Tools/meson.ML"
       
   572 
       
   573 setup Meson.setup
       
   574 
       
   575 
       
   576 subsection {* Specification package -- Hilbertized version *}
   443 subsection {* Specification package -- Hilbertized version *}
   577 
   444 
   578 lemma exE_some: "[| Ex P ; c == Eps P |] ==> P c"
   445 lemma exE_some: "[| Ex P ; c == Eps P |] ==> P c"
   579   by (simp only: someI_ex)
   446   by (simp only: someI_ex)
   580 
   447 
   581 use "Tools/choice_specification.ML"
   448 use "Tools/choice_specification.ML"
   582 
   449 
   583 
       
   584 end
   450 end