proportional logic and first order logic

Upload: raghavendra-sukumaran

Post on 21-Feb-2018

233 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/24/2019 Proportional Logic and first order Logic

    1/41

    Unit-I Proposional Logic & First Order Logic

    October 25, 2015

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    2/41

    Satisability, Validity and Consequence

    DenitionLet A F .

    A is satisable iff vI (A) = T for some interpretation I . A

    satisfying interpretation is a model for A.A is valid, denoted |= A, iff vI = T for all interpretations I . Avalid propositional formula is also called a tautology.A is unsatisable iff it is not satisable, that is, if vI (A) = Tfor all interpretations I .A is falsiable, denoted A, iff it is not valid, that is, if vI (A)= F for some interpretation v.

    Unit-I Proposional Logic & First Order Logic

    http://find/http://goback/
  • 7/24/2019 Proportional Logic and first order Logic

    3/41

    Satisability and Validity of Formulas

    Figure: Satisability and validity of formulas

    Unit-I Proposional Logic & First Order Logic

    http://find/http://goback/
  • 7/24/2019 Proportional Logic and first order Logic

    4/41

    Satisability and Validity of Formulas

    TheoremLet A F . A is valid if and only if A is unsatisable. A is satisable if and only if A is falsiable

    Unit-I Proposional Logic & First Order Logic

    http://find/http://goback/
  • 7/24/2019 Proportional Logic and first order Logic

    5/41

    Proof.Let I be an arbitrary interpretation. vI (A) = T if and only if vI( A) = F by the denition of the truth value of a negation.Since I was arbitrary, A is true in all interpretations if and only if

    A is false in all interpretations, that is, iff A is unsatisable.If A is satisable then for some interpretation I , vI (A) = T.By denition of the truth value of a negation, vI ( A) = F so that

    A is falsiable.Conversely, if vI ( A) = F then vI (A) = T.

    Unit-I Proposional Logic & First Order Logic

    http://find/http://goback/
  • 7/24/2019 Proportional Logic and first order Logic

    6/41

    Decision Procedures in Propositional Logic

    Denition (Decision Procedure)

    Let U F be a set of formulas. An algorithm is a decisionprocedure for U if given an arbitrary formula A F , it terminatesand returns the answer yes if A U and the answer no if A U .If U is the set of satisable formulas, a decision procedure for U iscalled a decision procedure for satisability, and similarly for

    validity.

    Unit-I Proposional Logic & First Order Logic

    http://find/http://goback/
  • 7/24/2019 Proportional Logic and first order Logic

    7/41

    Note

    1 To decide if A is valid, apply the decision procedure forsatisability to A

    2 If it reports that A is satisable, then A is not valid; if itreports that A is not satisable, then A is valid. Such andecision procedure is called a refutation procedure, becausewe prove the validity of a formula by refuting its negation

    3 Refutation procedures can be efficient algorithms for decidingvalidity, because instead of checking that the formula is always

    true, we need only search for a falsifying counterexample4 The existence of a decision procedure for satisability in

    propositional logic is trivial, because we can build a truthtable for any formula

    Unit-I Proposional Logic & First Order Logic

    http://find/http://goback/
  • 7/24/2019 Proportional Logic and first order Logic

    8/41

    Example for Satisability

    Truth table for the formula p q

    p q pq

    T T TT F FF T TF F T

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    9/41

    Example for Validity and Unsatisable

    Validity of (p q)( q p)Proof Refer BBProve that (p q) p q is unsatisable.Proof Refer BB

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    10/41

    Satisability of Set of Formulas

    DenitionA set of formulas U={A1,...}s (simultaneously) satisable iff thereexists an interpretation I such that vI (Ai ) = T for all i. The

    satisfying interpretation is a model of U . U is unsatisable iff forevery interpretation I , there exists an i such that vI (Ai ) = F

    Example:The set U1 = {p, p q, q r} is simultaneously satisable by

    the interpretation which assigns T to each atom, while the setU2 = {p, p q, p} is unsatisable. Each formula in U2 issatisable by itself, but the set is not simultaneously satisable

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    11/41

    Logical Consequence

    Denition (Logical Consequence)

    Let U be a set of formulas and A a formula. A is a logicalconsequence of U , denoted U A, iff every model of U is a model

    of A

    Example:Let A = (pr) ( q r). Then A is a logical consequenceof {p, q}, denoted {p, q} A, since A is true in all

    interpretations I such that I (p) = T and I (q) = F . However,A is not valid, since it is not true in the interpretation I whereI (p) = F , I (q)=T , I (r) = T

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    12/41

    Theorem

    TheoremU A if and only if

    i A

    i A.

    Example:{p, q} (p r) ( q r), so by Theorem, (p q) (p r) ( q r)

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    13/41

    Semantic Tableaux

    The method of semantic tableaux is an efficient decisionprocedure for satisability (and by duality validity) inpropositional logic

    The principle behind semantic tableaux is very simple: searchfor a model (satisfying interpretation) by decomposing theformula into sets of atoms and negations of atomsIt is easy to check if there is an interpretation for each set: aset of atoms and negations of atoms is satisable iff the setdoes not contain an atom p and its negation pThe formula is satisable iff one of these sets is satisable

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    14/41

    Decomposing Formulas into Sets of Literals

    Denition (Literals)

    A literal is an atom or the negation of an atom. An atom is a

    positive literal and the negation of an atom is a negative literal.For any atom p, {p, p} is a complementary pair of literals

    For any formula A, {A, A} is a complementary pair of formulas. A is the complement of A and A is thecomplement of A

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    15/41

    Problems

    1 Analyze satisability of the formula:A = p ( q p).Solution Refer BB

    2 Prove that B = (p q) ( p q)is unsatisable

    TheoremA set of literals is satisable if and only if it does not contain a

    complementary pair of literals - Proof: Refer BB

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    16/41

    SAT Solvers

    Denition (SAT Solver)A computer program that searches for a model for a propositionalformula is called a SAT Solver

    Properties of Clausal FormDenitionLet S, S be sets of clauses. S S denotes that S is satisable if and only if S is satisable

    It is important to understand that S S (S is satisable if and only if S is satisable) does not imply that S S (S islogically equivalent to S)

    Unit-I Proposional Logic & First Order Logic

    http://goforward/http://find/http://goback/
  • 7/24/2019 Proportional Logic and first order Logic

    17/41

    Pure Literals and Renaming

    Denition (Pure Literals)

    Let S be a set of clauses. A Pure literal in S is a literal l thatappears in atleast one clause of S, but its complement lc does notappear in any clause of S

    Denition (Renaming)

    Let S be a set of clauses and U a set of atomic propositions RU (S)

    the renaming of S by U is obtained from S by replacing each literall on an atomic proposition in U by lc

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    18/41

    Example

    If S={pqr, p q, q r ,r}, nd Rp ,q (S)

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    19/41

    Example

    If S={pqr, p q, q r ,r}, nd Rp ,q (S)Solution: Rp ,q (S)= {p q ,pq ,qr ,r},

    Unit-I Proposional Logic & First Order Logic

    http://find/http://goback/
  • 7/24/2019 Proportional Logic and first order Logic

    20/41

    Davis Putnam Algorithm

    Input : A formula A in Clausal FormOutput : Report A is Satisable or UnsatisablePerform the following rules repeatedly but the third rule is usedonly if the rst two do not apply.

    1 Unit Literal rule: If there is a unit clause (l), delete all clausescontaining l and delete all occurrences of lc from other clauses

    2 Pure Literal rule:If there is a pure literal l, delete all clausescontaing l

    3 Eliminate a variable by resolution:Choose an atom p and

    perform all possible resolutions on clauses that clash on p andp . Add these resolvents to the set of clauses and then deleteall clauses containing p or p

    Algorithm 1: Davis Putnam Algorithm

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    21/41

    Termination condition for the Algorithm

    1 If empty clause is produced, report the formula isunsatisable

    2 If no more rules are applicable, report that formula issatisable

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    22/41

    Example

    Consider the set of clauses {p, p q,q r, r st}. Apply DPalgorithm.

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    23/41

    Example

    Consider the set of clauses {p, p q,q r, r st}. Apply DPalgorithm.Step(i) According to step(i) of D.P algorithm, p is a unitliteral. Hence it must be deleted in all clauses containing p

    and delete all occurrences of pc

    from other clauses. thegiven set becomes {q,q r, r st}

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    24/41

    Example

    Consider the set of clauses {p, p q,q r, r st}. Apply DPalgorithm.Step(i) According to step(i) of D.P algorithm, p is a unitliteral. Hence it must be deleted in all clauses containing p

    and delete all occurrences of pc

    from other clauses. thegiven set becomes {q,q r, r st}Step(ii) Like the previous step, remove q and qc . the setbecomes {r, r st}

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    25/41

    Example

    Consider the set of clauses {p, p q,q r, r st}. Apply DPalgorithm.Step(i) According to step(i) of D.P algorithm, p is a unitliteral. Hence it must be deleted in all clauses containing p

    and delete all occurrences of pc

    from other clauses. thegiven set becomes {q,q r, r st}Step(ii) Like the previous step, remove q and qc . the setbecomes {r, r st}

    Step(iii) Like the previous step, remove r and its complement. the set becomes {st}

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    26/41

    Example

    Consider the set of clauses {p, p q,q r, r st}. Apply DPalgorithm.Step(i) According to step(i) of D.P algorithm, p is a unitliteral. Hence it must be deleted in all clauses containing p

    and delete all occurrences of pc

    from other clauses. thegiven set becomes {q,q r, r st}Step(ii) Like the previous step, remove q and qc . the setbecomes {r, r st}

    Step(iii) Like the previous step, remove r and its complement. the set becomes {st}No more rules are applicable for the set {st}, the set of clauses is satisable

    Unit-I Proposional Logic & First Order Logic

    http://find/http://goback/
  • 7/24/2019 Proportional Logic and first order Logic

    27/41

    Hilbert System (H)

    Gentzen System vs Hilbert SystemGentzen Hilbert

    One Axiom Several AxiomsMany Inference Rules Only one rule of inferenceNotations used

    A,B,C denote arbitrary formulas in propositional logicAA means AA can be proved

    Unit-I Proposional Logic & First Order Logic

    http://find/http://goback/
  • 7/24/2019 Proportional Logic and first order Logic

    28/41

    Hilbert System(H)

    Denition (Axioms of H & Rules of Inference)

    1 (A(BA))2 (A(BC))((AB)(AC))

    3 (B A)(AB)4 Rule of Inference: (Modus Ponens)(MP) A, AB B

    Theorem

    A A

    Proof.Refer BB

    Unit-I Proposional Logic & First Order Logic

    http://find/http://goback/
  • 7/24/2019 Proportional Logic and first order Logic

    29/41

    Assignment Due Date:27.10.15

    1 Prove (AB)(B A)2 Prove (A A) A in H

    Unit-I Proposional Logic & First Order Logic

    http://find/http://goback/
  • 7/24/2019 Proportional Logic and first order Logic

    30/41

    First Order Logic: Deductive Systems

    Denition (First Order Logic)

    An extension of propositional logic that includes predicatesinterpreted as relations on domains

    Notations usedP,A,V denotes the countable sets of predicate symbols,constant symbols and variablespn P n-ary predicate

    n=1 or 2 unary or binary Universal Quantier Existential Quantier

    Unit-I Proposional Logic & First Order Logic

    http://find/http://goback/
  • 7/24/2019 Proportional Logic and first order Logic

    31/41

    Example

    x

    y

    p(x,y)

    y

    p(y,x)

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    32/41

    First Order Logic:Deductive System

    Gentzen System:Deductive SystemOne Axiom4 rules of Inference

    Two Special rules: and (a)xA(x) A(a) xA(x) A(a)

    (a)xA(x) A(a) xA(x) A(a)

    U {, (a )}U { }U {(a )}

    U {}

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    33/41

    Hilbert System

    Denition (Axioms of H for the First Order Logic)1 Apart from the three axioms of H for Propositional Logic we

    have:1 xA(x)A(a)2 x(AB(x))(A xB(x))

    Rules of Inference(Modus Ponens and Generalization)A B , A

    B A(a )

    xA (x )

    C-Rule:(i) U xA(x) (Existential Quantier)(i+1) U A(a) (C rule)

    Deduction Rule:U { A} B U A B

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    34/41

    Theorems

    TheoremA(a) xA(x)

    Proof.Refer BB

    Theorem x A(x) x A(x)

    Proof.Refer BB

    Unit-I Proposional Logic & First Order Logic

    http://find/http://goback/
  • 7/24/2019 Proportional Logic and first order Logic

    35/41

    Skolems Algorithm

    An algorithm to transform a formula A into a formula Ainclausal form x(p(x) q(x)) (xp(x) xq(x))

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    36/41

    Skolems Algorithm I

    Input : A closed formula A of rst-order logicOutput : A formula Ain clausal form such that A A

    1 Rename bound variables so that no variable appears in twoquantiers

    x(p(x) q(x)) (yp(y) zq(z))2 Eliminate all binary Boolean operators other than and

    x( p(x) q(x)) yp(y) zq(z)3 Push negation operators inward, collapsing double negation,

    until they apply to atomic formulas only. Use the equivalences: xA(x) x A(x), xA(x) x A(x)

    Unit-I Proposional Logic & First Order Logic

    http://find/http://goback/
  • 7/24/2019 Proportional Logic and first order Logic

    37/41

    Skolems Algorithm Contd..

    4 The given formula is transformed to:x(p(x) q(x)) y p(y) zq(z)

    5 Extract quantiers from the matrix. Choose an outermostquantier, that is, a quantier in the matrix that is not withinthe scope of another quantier still in the matrix. Extract thequantier using the following equivalences, where Q is aquantier and op is either or:A op QxB(x) Qx(A op B(x)), QxA(x) op B Qx(A(x) opB)

    Repeat until all quantiers appear in the prex and the matrixis quantier-free. The equivalences are applicable becausesince no variable appears in two quantiers.

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    38/41

    Skolems Algorithm Contd..6 In the example, no quantier appears within the scope of

    another, so we can extract them in any order, for example, x,y, z: xyz((p(x) q(x)) p(y) q(z))

    7 Use the distributive laws to transform the matrix into CNF.The formula is now in PCNF

    xyz((p(x) p(y) q(z)) ( q(x) p(y) q(z)))8 For every existential quantier x in A, let y1 , . . . , yn be

    the universally quantied variables preceding x and let f be anew n-ary function symbol. Delete x and replace everyoccurrence of x by f(y1 , . . . , yn ). If there are no universalquantiers preceding x, replace x by a new constant (0-aryfunction). These new function symbols are Skolem functionsand the process of replacing existential quantiers byfunctions is Skolemization

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    39/41

    Skolem Algorithm Contd..

    9 For Example, z((p(a) p(b) q(z)) ( q(a) p(b) q(z))), where a and b are the Skolem functions (constants)corresponding to the existentially quantied variables x and y,respectively

    10 The formula can be written in clausal form by dropping the(universal) quantiers and writing the matrix as sets of clauses:{{p(a), p(b), q(z) }, { q(a), p(b), q(z) }}

    Algorithm 2: Skolems Algorithm

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    40/41

    Skolems Algorithm Example

    Step TransformationOriginal formula xyp(x,y) yxp(x,y)Rename bound variables xyp(x,y) wzp(z,w)

    Eliminate Boolean operators xyp(x,y) wzp(z,w)Push negation inwards xy p(x,y) wzp(z, w)Extract quantiers xywz( p(x,y) p(z,w))Distribute matrix (no change)Replace existential quantiers xw( p(x,f(x)) p(g(x,w), w))Write in clausal form {{ p(x,f(x)), p(g(x,w), w) }}

    Unit-I Proposional Logic & First Order Logic

    http://find/
  • 7/24/2019 Proportional Logic and first order Logic

    41/41

    Skolems Theorem

    TheoremLet A be a closed formula. Then there exists a formula A inclausal form such that A A

    Unit-I Proposional Logic & First Order Logic

    http://find/