negation normal form
play

Negation Normal Form a formula is in negation normal form (NNF) if - PowerPoint PPT Presentation

Tableau Calculus A Tableau Prover Term Unification Connection Calculus A Connection Prover Summary Tableau Calculus A Tableau Prover Term Unification Connection Calculus A Connection Prover Summary Negation Normal Form a formula is


  1. Tableau Calculus A Tableau Prover Term Unification Connection Calculus A Connection Prover Summary Tableau Calculus A Tableau Prover Term Unification Connection Calculus A Connection Prover Summary Negation Normal Form ◮ a formula is in negation normal form (NNF) if it only contains ∧ , Build Your Own First-Order Prover ∨ , ∀ , ∃ , and ¬ only occurs (directly) in front of atomic formulae Part 3a: A Tableau Prover ◮ every formula F can be translated into a (classically) equivalent (model-preserving) formula F ′ that is in negation normal form Jens Otten ◮ translation of a formula into negation normal form: University of Oslo 1. Eliminate all logical operators except ¬ , ∧ , ∨ : A ↔ B ≡ ( A → B ) ∧ ( B → A ) , A → B ≡ ¬ A ∨ B 2. Push negations inward using De Morgan’s laws: ¬ ( A ∧ B ) ≡ ( ¬ A ∨ ¬ B ) , ¬ ( A ∨ B ) ≡ ( ¬ A ∧ ¬ B ) , ¬ ∀ x A ≡ ∃ x ¬ A , ¬ ∃ x A ≡ ∀ x ¬ A 3. Eliminate double negation: ¬¬ A ≡ A Jens Otten (UiO) Build Your Own First-Order Prover — Part 3 CADE Tutorial, August ’19 1 / 28 Jens Otten (UiO) Build Your Own First-Order Prover — Part 3 CADE Tutorial, August ’19 2 / 28 Tableau Calculus A Tableau Prover Term Unification Connection Calculus A Connection Prover Summary Tableau Calculus A Tableau Prover Term Unification Connection Calculus A Connection Prover Summary Skolemization for NNF Block Tableau Calculus for NNF with Free Variables The tableau calculus for formulae in negation normal form (NNF) ◮ a formula is in skolemized negation normal form, if all its consists of one axiom and an α -rule, a β -rule, and a γ -rule. Eigenvariables have been replaced by Skolem terms. ◮ axiom ◮ let F be a formula in NNF, ∀ xG be a subformula in F , and (with P / P ′ unifiable, i.e., σ ( P ) = σ ( P ′ )) axiom P , ¬ P ′ , ∆ ∃ y 1 , . . . , ∃ y n be the existential quantifiers ”in front” of G ◮ α -rule β -rule γ -rule ◮ then F is valid iff F [ x \ f ∗ ( y 1 , . . . , y n )] is valid, where the A , B , ∆ A , ∆ B , ∆ ∧ A [ x \ x ∗ ] , ∃ x A , ∆ ∃ (new x ∗ ) Eigenvariable x (in G ) is replaced by the skolem term ∨ f ∗ ( y 1 , . . . , y n ) for a new function symbol f ∗ A ∨ B , ∆ A ∧ B , ∆ ∃ x A , ∆ ◮ similar to one-sided sequent calculus with skolemized NNF Example: ∀ x ∃ y p ( x , y ) → ∃ y ∀ x p ( x , y ) ◮ all rules are now invertible; P , P ′ are atomic formulae ◮ formula in NNF: ∃ x ∀ y ¬ p ( x , y ) ∨ ∃ y ∀ x p ( x , y ) ◮ all literals in axioms have to unify under a single substitution σ ◮ skolemized NNF: ∃ x ¬ p ( x , f 1 ( x )) ∨ ∃ y p ( f 2 ( y ) , y ) F is valid iff there is a proof for F in the block tableau calculus. Jens Otten (UiO) Build Your Own First-Order Prover — Part 3 CADE Tutorial, August ’19 3 / 28 Jens Otten (UiO) Build Your Own First-Order Prover — Part 3 CADE Tutorial, August ’19 4 / 28

  2. Tableau Calculus A Tableau Prover Term Unification Connection Calculus A Connection Prover Summary Tableau Calculus A Tableau Prover Term Unification Connection Calculus A Connection Prover Summary Block Tableau Calculus with Ordered Sets Implementing the Block Tableau Calculus ◮ if an ordered set ∆ is considered, the rule applications can be The main predicate is prove(Fml,UnExp,Lits,FreeV,VarLim) . restricted to its first element; this simplifies the proof search ◮ the words of the calculus are of the form F , ∆ , Lits where Lits is ◮ Fml is the formula on the (current) branch that will be considered next a set of literals (i.e. negated or non-negated atomic formulae) ◮ axiom ◮ UnExp is a list of formulae on the (current) branch not expanded so far (with P / P unifiable, i.e., σ ( P ) = σ ( P )) P , ∆ , { P }∪ Lits ◮ Lits is a list of literals on the (current) branch ◮ α -, β -, and γ -rules ◮ FreeV is a list of free variables on the (current) branch A , { B }∪ ∆ , Lits A , ∆ , Lits B , ∆ , Lits A [ x \ x ∗ ] , ∆ ∪{∃ x A } , Lits ◮ VarLim specifies the maximum number of free variables on the branch A ∨ B , ∆ , Lits A ∧ B , ∆ , Lits ∃ x A , ∆ , Lits (used for iterative deepening on the number of free variables on branch) ◮ next -rule additionally necessary A , ∆ , { P }∪ Lits The translation into skolemized negation normal form is done by the P , { A }∪ ∆ , Lits predicate nnf(F,F1) in the Prolog module nnf pure.pl . ◮ all rules are still invertible; P and its complement P are literals Jens Otten (UiO) Build Your Own First-Order Prover — Part 3 CADE Tutorial, August ’19 5 / 28 Jens Otten (UiO) Build Your Own First-Order Prover — Part 3 CADE Tutorial, August ’19 6 / 28 Tableau Calculus A Tableau Prover Term Unification Connection Calculus A Connection Prover Summary Tableau Calculus A Tableau Prover Term Unification Connection Calculus A Connection Prover Summary Implementing α -, β - and γ -rule Implementing Axiom and Next-rule ◮ α -, β -, and γ -rules ◮ axiom A , { B }∪ ∆ , Lits A , ∆ , Lits B , ∆ , Lits A [ x \ x 1 ] , ∆ ∪{∃ x A } , Lits (with P / P unifiable, i.e., σ ( P ) = σ ( P )) P , ∆ , { P }∪ Lits A ∧ B , ∆ , Lits A ∨ B , ∆ , Lits ∃ x A , ∆ , Lits ◮ leantap pure.pl : ◮ leantap pure.pl : prove(Lit,_,Lits,_,_) :- prove((A|B),UnExp,Lits,FreeV,VarLim) :- !, (Lit = -Neg; -Lit = Neg) -> prove(A,[B|UnExp],Lits,FreeV,VarLim). member(L,Lits), unify1(Neg,L). prove((A&B),UnExp,Lits,FreeV,VarLim) :- !, ◮ next -rule prove(A,UnExp,Lits,FreeV,VarLim), prove(B,UnExp,Lits,FreeV,VarLim). A , ∆ , { P }∪ Lits P , { A }∪ ∆ , Lits prove((?[X]:Fml),UnExp,Lits,FreeV,VarLim) :- !, \+ length(FreeV,VarLim), ◮ leantap pure.pl : copy_term((X,Fml,FreeV),(X1,Fml1,FreeV)), prove(Lit,[Next|UnExp],Lits,FreeV,VarLim) :- append(UnExp,[(?[X]:Fml)],UnExp1), prove(Next,UnExp,[Lit|Lits],FreeV,VarLim). prove(Fml1,UnExp1,Lits,[X1|FreeV],VarLim). Jens Otten (UiO) Build Your Own First-Order Prover — Part 3 CADE Tutorial, August ’19 7 / 28 Jens Otten (UiO) Build Your Own First-Order Prover — Part 3 CADE Tutorial, August ’19 8 / 28

  3. Tableau Calculus A Tableau Prover Term Unification Connection Calculus A Connection Prover Summary Tableau Calculus A Tableau Prover Term Unification Connection Calculus A Connection Prover Summary leanTAP – A Minimal Tableau Prover Term Unification prove((E,F),A,B,C,D) :- !,prove(E,[F|A],B,C,D). ◮ algorithm for term unification according to [Robinson 1965] prove((E;F),A,B,C,D) :- !,prove(E,A,B,C,D),prove(F,A,B,C,D). prove(all(I,J),A,B,C,D) :- !, ◮ unify ( s , t ) – unification of the terms s and t \+length(C,D),copy_term((I,J,C),(G,F,C)), σ – represents most general unifier append(A,[all(I,J)],E),prove(F,E,B,[G|C],D). ◮ unify ( t , t ) → σ remains unchanged prove(A,_,[C|D],_,_) :- unify ( x , t ) → σ ( x ) = t if x does not occur in t ((A= -(B);-(A)=B) -> (unify(B,C);prove(A,[],D,_,_))). prove(A,[E|F],B,C,D) :- prove(E,F,[A|B],C,D). unify ( t , x ) → σ ( x ) = t if x does not occur in t unify ( f ( s 1 , ..., s n ) , f ( t 1 , ..., t n )) → unify ( s 1 , t 1 ) , . . . , unify ( s n , t n ) ◮ first popular lean prover [Beckert/Posegga 1995] unify ( f ( s 1 , . . . , s n ) , g ( t 1 , . . . , t n )) → fail ◮ based on block tableau calculus for NNF with free variables ◮ this algorithm has an exponential worst-case time complexity ◮ source code size of minimal version only 360 bytes ◮ there exist algorithms with polynomial time complexity ◮ performance good on rather easy problems Jens Otten (UiO) Build Your Own First-Order Prover — Part 3 CADE Tutorial, August ’19 9 / 28 Jens Otten (UiO) Build Your Own First-Order Prover — Part 3 CADE Tutorial, August ’19 10 / 28 Tableau Calculus A Tableau Prover Term Unification Connection Calculus A Connection Prover Summary Tableau Calculus A Tableau Prover Term Unification Connection Calculus A Connection Prover Summary Implementing Term Unification Hands-On: Run the Tableau Prover ◮ $> swipl % start SWI-Prolog ◮ unify1(A,B) :- unify([A],[B]). succeeds iff A and B are unifiable ◮ [leanseq v5]. % load the sequent prover ◮ if lists are empty ◮ [ex quant]. % load the quant formula unify([],[]). % and try to prove it fof(quant, ,F), prove(F). ◮ if A and B are identical terms (e.g. identical variables) % load the f12 formula [ex f12]. % and try to prove it fof(f12, ,F), prove(F). unify([A|A1],[B|B1]) :- A==B, !, unify(A1,B1). ◮ [leantap pure]. % load the tableau prover ◮ if A / B is a variable and A / B does not occur in B / A : assign B / A to A / B ◮ [ex barber]. % load the barber puzzle unify([A|A1],[B|B1]) :- var(A), !, not_in(A,B), A=B, unify(A1,B1). % solve puzzle unify([A|A1],[B|B1]) :- var(B), !, not_in(B,A), A=B, unify(A1,B1). fof(barber, ,F), prove(F). [ not_in(A,B) :- term_variables(B,L), \+ (member(X,L), X==A). ] ◮ [ex quant]. % load the quant formula ◮ otherwise, if A = f ( s 1 , ..., s n ) and B = f ( t 1 , ..., t n ), unify s i and t i for 1 ≤ i ≤ n % and try to prove it fof(quant, ,F), prove(F). unify([A|A1],[B|B1]) :- A=..[F|ArgA], B=..[F|ArgB], % load the f12 formula [ex f12]. length(ArgA,N), length(ArgB,N), unify(ArgA,ArgB), unify(A1,B1). % and try to prove it fof(f12, ,F), prove(F). % load the f20 formula [ex f20]. There is also a Prolog built-in predicate: unify_with_occurs_check(A,B) . % and try to prove it fof(f20, ,F), prove(F). Jens Otten (UiO) Build Your Own First-Order Prover — Part 3 CADE Tutorial, August ’19 11 / 28 Jens Otten (UiO) Build Your Own First-Order Prover — Part 3 CADE Tutorial, August ’19 12 / 28

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend