Presentation is loading. Please wait.

Presentation is loading. Please wait.

LDK R Logics for Data and Knowledge Representation Propositional Logic Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia,

Similar presentations


Presentation on theme: "LDK R Logics for Data and Knowledge Representation Propositional Logic Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia,"— Presentation transcript:

1 LDK R Logics for Data and Knowledge Representation Propositional Logic Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese

2 2 Outline  Introduction  Syntax  Semantics  Truth valuation  Satisfiability  Validity  Entailment  Logical implication  Reasoning Services  Normal Forms 2

3 Introduction: propositions  All knowledge representation languages deal with sentences  Sentences denote propositions (by definition), namely they express something true or false (the mental image of what you mean when you write the sentence)  Logic languages deal with propositions  Propositional logic is the simplest logic that does this (no individuals, no quantifiers) 3 “All men are mortals”“Obama is the president of the USA” ¬ Mortal ∨ ManPresident INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

4 Introduction: example 4 World SEMANTIC GAP Monkey Mental Model Language L PROPOSITION SENTENCE INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

5 Introduction: the famous triangle 5 CONCEPT (what we have in mind) SYMBOL (what we write) REFERENT (the real object) Monkey stands for refers to symbolizes INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

6 Language (Syntax)  Alphabet of symbols: The first step in setting up a formal language is to list the symbols of the alphabet  Propositional Logic (PL) is a symbolic language  Σ 0 : the alphabet of a PL language 6 Σ0Σ0 Descriptive Logical , , , … Constants one proposition only A, B, C … Variables they can be substituted by any proposition or formula P, Q, ψ … NOTE: not only characters but also words (composed by several characters) like “monkey” are descriptive symbols INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

7 Additional Symbols  Auxiliary symbols  Parentheses: ( )  Defined symbols  Logical defined constants are, for all propositions P: ⊥ (falsehood symbol, false, bottom) ⊥ = df P ∧ ¬P T (truth symbol, true, top)T = df ¬ ⊥  Defined symbols are not strictly necessary  However, they increase the usability by reducing the syntactic complexity of propositions 7 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

8 Formation Rules (FR): well formed formulas  Well formed formulas (wff) in PL can be described by the following BNF (*) grammar (codifying the rules): ::= A | B |... | P | Q |... | ⊥ | ⊤ ::= | ¬ | ∧ | ∨  Atomic formulas are also called atomic propositions  Wff are propositional formulas (or just propositions)  A formula is correct if and only if it is a wff  Σ 0 + FR define a propositional language (*) BNF = Backus–Naur form (formal grammar)Backus–Naur form 8 PARSER ψ, PL Yes, ψ is correct! No INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

9 Example: the Monkey-Banana problem  Significant data: monkey, bananas, box  Significant knowledge: Low, High, Climb, GetBanana  All other data and knowledge are irrelevant!  Both data and knowledge are codified as (atomic or more complex) formulas in the language  Language (any language you want to define): MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana “There is a monkey in a laboratory with some bananas hanging out of reach from the ceiling. A box is available that will enable the monkey to reach the bananas if he climbs on it. The monkey and box have height Low, but if the monkey climbs onto the box he will have height High, the same as the bananas. At this point the monkey can get a banana [...]” 9 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

10 Examples of formulas 10 FormulaCorrect inLab-Monkey inlab-monkey in-lab-monkey inLab(Monkey) (Monkey ∧ GetBanana) ∨ ¬ High Yes (wff) inLab(Monkey) ∧ P ¬ ∧ Q No NOTE: In PL we do not have individuals (it is not so expressive). Parentheses in inLab(Monkey) are not the auxiliary symbols like in e.g. (Monkey ∧ GetBanana) ∨ ¬ High (problem of ambiguity) INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

11 Propositional Theory  Propositional (or sentential) theory  A set of propositions  It is a (propositional) knowledge base (containing true facts)  It corresponds to a TBox (terminology) only, where no meaning is specified yet: it is a syntactic notion  Recall that:  knowledge is a set of facts, i.e. statements  we assumed statements are propositions 11 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

12 Propositional Theories and Databases  A propositional theory is not a database!  Propositions don’t show data explicitly (no individuals)  In PL the form P(a) must be interpreted as P-a (so the use of form P(a) is ambiguous).  Example: In the sentence ‘inLab(Monkey)’, the string ‘Monkey’ does not refer to an individual from some data domain 12 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

13 Example: the Monkey-Banana problem 13 L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana, , ,  } T = {  (MonkeyLow  BananaHigh  MonkeyGetBanana)  (MonkeyLow  MonkeyClimbBox)  (  MonkeyLow   BananaHigh  MonkeyGetBanana)} NOTE: We still need to assign semantics to the symbols in the language. “There is a monkey in a laboratory with some bananas hanging out of reach from the ceiling. A box is available that will enable the monkey to reach the bananas if he climbs on it. The monkey and box have height Low, but if the monkey climbs onto the box he will have height High, the same as the bananas. At this point the monkey can get a banana [...]” INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

14 Semantics means providing an interpretation  So far the elements of our propositional language are simply strings of symbols without formal meaning  The meanings which are intended to be attached to the symbols and propositions form the intended interpretation ν (nu) of the language 14 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

15 Semantics: formal model  Intensional interpretation We must make sure to assign the formal meanings out of our intended interpretation to the (symbols of the) language, so that formulas (propositions) really express what we intended.  The mental model: What we have in mind? In our mind (mental model) we have a set of properties that we associate to propositions. We need to make explicit (as much as possible) what we mean.  The formal model This is done by defining a formal model M. Technically: we have to define a pair (M, ⊨ ) for our propositional language  Truth-values In PL a sentence A is true (false) iff A denotes a formal object which satisfies (does not satisfy) the properties of the object in the real world. 15 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

16 Example: Banana (I)  Bananas may differ in many ways, but when using the proposition Banana we have in mind some specific properties: e.g. a given shape, a given color...  These specific properties determine the intension of the proposition Banana  The intentional interpretation of the proposition Banana determines its truth-value (true or false). 16 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

17 Example: Banana (II) 17 World SEMANTIC GAP Banana Mental Model Language L PROPOSITION What we have in mind? 1) There is at least a banana 2) The banana is yellow 3) The banana has curve shape 4) No matter if opened SENTENCE  Banana  (Yellow  Curve) Language L’ SENTENCE OUR MENTAL MODEL MATCHES WITH THE REAL WORLD, SO THE SENTENCES ARE TRUE INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

18 Example: Banana (III) 18 World SEMANTIC GAP Banana Mental Model Language L PROPOSITION What we have in mind? 1) There is at least a banana 2) The banana is yellow 3) The banana has curve shape 4) No matter if opened SENTENCE  Banana  (Yellow  Curve) Language L’ SENTENCE OUR MENTAL MODEL DOES NOT MATCH WITH THE REAL WORLD, SO THE SENTENCES ARE FALSE INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

19 Example: Banana (IV) 19 I mean banana as something yellow and curve, no matter if partially opened I mean banana as something yellow or red, which can be one or many together, no matter how big they are, and whether they are opened or not FORMAL MODEL M1 FORMAL MODEL M2 TFTF MENTAL MODEL THE WORLD INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

20 Truth-values  Definition: a truth valuation on a propositional language L is a mapping ν assigning to each formula A of L a truth value ν (A), namely in the domain D = {T, F}  ν (A) = T or F according to the modeler, with A atomic  ν (¬A) = T iff ν (A) = F  ν (A ∧ B) = T iff ν (A) = T and ν (B) = T  ν (A ∨ B) = T iff ν (A) = T or ν (B) = T  ν ( ⊥ ) = F (since ⊥ = df P ∧ ¬P)  ν ( ⊤ ) = T (since ⊤ = df ¬ ⊥ ) 20 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

21 Example of truth valuation ν 21 L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana, , ,  } T = {  (MonkeyLow  BananaHigh  MonkeyGetBanana)  (MonkeyLow  MonkeyClimbBox)  (  MonkeyLow   BananaHigh  MonkeyGetBanana)} Informal Semantics: “If the monkey is low and the banana is high in position, then the monkey cannot get the banana. “ Formal Semantics: ν (MonkeyLow) = T ν (BananaHigh) = T ν (MonkeyClimbBox) = F ν (MonkeyGetBanana) = F MODEL INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

22 Truth Tables  To compute (in polynomial time) truth valuations, the method of truth tables was introduced (Wittgenstein, 1921).  Truth tables are well-known: Truth-table (TT) for the logical constants ¬, ∧, ∨ 22 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

23 Truth Relation (Satisfaction Relation)  Let ν be a truth valuation on language L, we define the truth- relation (or satisfaction-relation) ⊨ and write ν ⊨ A (read: ν satisfies A) iff ν (A) = True  Given a set of propositions Γ, we define ν ⊨ Γν ⊨ Γ iff if ν ⊨ θ for all formulas θ ∈ Γ 23 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

24 Model and Satisfiability  Let ν be a truth valuation on language L. ν is a model of a proposition P (set of propositions Γ ) iff ν satisfies P ( Γ ).  P ( Γ ) is satisfiable if there is some (at least one) truth valuation ν such that ν ⊨ P ( ν ⊨ Γ ). 24 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

25 Truth and Validity  Let ν be a truth valuation on language L.  P is true under ν if ν ⊨ P  P is valid if ν ⊨ P for all ν (notation: ⊨ P)  P is called a tautology 25 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

26 Example 26 L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana, , ,  } Informal Semantics: “If the monkey is low and the banana is high in position, then the monkey cannot get the banana. “ Formal Semantics: ν (MonkeyLow) = T ν (BananaHigh) = T ν (MonkeyClimbBox) = F ν (MonkeyGetBanana) = F MODEL  ν ⊨ MonkeyLow and ν ⊨ BananaHigh [SATISFIABLE]  ν ⊨  MonkeyClimbBox and ν ⊨  MonkeyGetBanana [SATISFIABLE]  MonkeyLow   MonkeyLow is a tautology [VALID] INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

27 Entailment  Propositional entailment  ⊨ ψ where  = { θ 1,..., θ n } is a finite set of propositions ν ⊨ θ i for all θ i in  implies ν ⊨ ψ 27 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

28 Example 28 L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana, , ,  } Informal Semantics: “If the monkey is low and the banana is high in position, then the monkey cannot get the banana. “ Formal Semantics: ν (MonkeyLow) = T ν (BananaHigh) = T ν (MonkeyClimbBox) = F ν (MonkeyGetBanana) = F MODEL   = {MonkeyLow, BananaHigh} ν ⊨ MonkeyLow and ν ⊨ BananaHigh implies ν ⊨  MonkeyGetBanana therefore  ⊨  MonkeyGetBanana [ENTAILMENT] INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

29 Entailment  Difference in notation ⊨  ψ iff  ⊨ ψ Left side means we have already filtered out all the models that do not satisfy  Right side means that we start from all models. In any case the final result is the same. 29 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

30 Implication: Premise (I)  Propositional entailment in the finite, i.e.  ⊨ ψ where  = { θ 1,..., θ n } is a finite set of propositions  How to embed such a notion directly in the language? As we will see, this would allow us to use truth tables and directly reformulate entailment in terms of the other reasoning services 30 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

31 Implication: Premise (II)  Entailment can be viewed as the logical implication ( θ 1 ∧ θ 2 ∧... ∧ θ n ) → ψ to be read θ 1 ∧ θ 2 ∧... ∧ θ n logically implies ψ  → is a new symbol that we add to the language 31 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

32  We extend our alphabet of symbols with the following defined logical constants: → (implication) ↔ (double implication or equivalence) ::= A | B |... | P | Q |... | ⊥ | ⊤ ::= | ¬ | ∧ | ∨ | → | ↔ (new rules)  The operator precedence is (from higher to lower): ¬, ∧, ∨, →, ↔  Let propositions ψ, θ, and finite set { θ 1,..., θ n } of propositions be given. We define:  ⊨ θ → ψ iff θ ⊨ ψ  ⊨ ( θ 1 ∧... ∧ θ n ) → ψ iff { θ 1,..., θ n } ⊨ ψ  ⊨ θ ↔ ψ iff θ → ψ and ψ → θ Implication and equivalence 32 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

33 Truth Table of →  By defining the semantics of → in terms of ⊨ we have the following truth-table for the logical implication P → Q: REMEMBER: Given ν, P ⊨ Q iff ν ⊨ P then ν ⊨ Q. 33 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

34 Three Properties of Logical Implication  Property 1: For all ψ and θ : ψ → θ iff ¬ ψ ∨ θ  Property 2: For all ψ : ¬ ψ iff ψ → ⊥  Property 3: For all ψ : ⊥ ⊨ ψ (inconsistent theories imply any proposition) 34 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

35 Examples (tautologies)  Laws for ∧, ¬ and → : (A ∧ ¬B) → ¬(A → B) ¬(A → B) → (A ∧ ¬B)  Pierce’s law: ((A → B) → A) → A  De Morgan’s laws: ¬(A ∨ B) → (¬A ∧ ¬B) (¬A ∧ ¬B) → ¬(A ∨ B) ¬(A ∧ B) → (¬A ∨ ¬B) (¬A ∨ ¬B) → ¬(A ∧ B) 35 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

36 Exercise (tautologies)  Prove the following double implications (i.e., logical equivalences) by using truth tables. 36 (α ∧ β) ↔ (β ∧ α) Commutativity of ∧ (α ∨ β) ↔ (β ∨ α) Commutativity of ∨ ((α ∧ β) ∧ γ) ↔ (α ∧ (β ∧ γ)) Associativity of ∧ ((α ∨ β) ∨ γ) ↔ (α ∨ (β ∨ γ)): Associativity of ∨ ¬(¬α) ↔ α Double-negation elimination (α →β) ↔ (¬β →¬α) Contraposition INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

37 Exercise (tautologies)  Prove the following double implications (i.e., logical equivalences) by using truth tables. 37 (α → β) ↔ (¬α ∨ β) → -elimination (α ↔ β) ↔ ((α → β) ∧ (β → α)) ↔ -elimination ¬(α ∧ β) ↔ (¬α ∨ ¬β) DeMorgan Law for ∧ ¬(α ∨ β) ↔ (¬α ∧ ¬β) DeMorgan Law for ∨ (α ∧ (β ∨ γ)) ↔ ((α ∧ β) ∨ (α ∧ γ)) Distributivity of ∧ over ∨ (α ∨ (β ∧ γ)) ↔ ((α ∨ β) ∧ (α ∨ γ)) Distributivity of ∨ over ∧ INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

38 Reasoning Services  The basic reasoning tasks (or “services”) we can represent (and compute) using ⊨ are:  Model Checking (EVAL)  Satisfiability (SAT)  Unsatisfiability (UnSAT)  Validity (VAL)  Entailment (ENT) 38 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

39 Reasoning Services: EVAL Model Checking (EVAL) Is a proposition P true under a truth-valuation ν ? Check ν ⊨ P EVAL P, ν Yes No Does ν ⊨  MonkeyLow  MonkeyGetBanana ? INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 39

40 Reasoning Services: SAT Satisfiability (SAT) Is there a truth-valuation ν where P is true? find ν such that ν ⊨ P SAT P ν No Find a ν that ν ⊨ MonkeyLow  GetBanana For instance, the truth-valuation ν where both are true INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 40

41 Reasoning Services (unSAT)  Unsatisfiability is the impossibility to find a truth-valuation ν 41 Monkey is satisfiable. Monkey ∨ ¬ Monkey is satisfiable. Monkey ∧ ¬ Monkey is unsatisfiable (inconsistent). In fact, for every truth-valuation ν, either ν (A) = T, so ν (¬A) = F, hence ν (P) = F; or ν (A) = F, so ν (¬A) = T, hence ν (P) = T. INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

42 Reasoning Services: VAL Validity (VAL) Is P true according to all possible truth-valuation ν ? Check whether for all ν, ν ⊨ P VAL P Yes No Is P = MonkeyLow ∨  MonkeyLow valid? Yes! INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 42

43 Reasoning Services (Entailment)  A set Γ (eventually empty) of propositions θ entails a proposition ψ, written: Γ ⊨ ψ if ν ⊨ θ for all θ ∈ Γ, then ν ⊨ ψ (for a given ν or for all ν)  If Γ ⊨ ψ, then we say that ψ is a logical consequence of Γ, and that Γ logically implies ψ. NOTE: ⊨ P is the same as {} ⊨ P 43 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

44 Reasoning Services: ENT Entailment (ENT) All θ ∈ Γ true in ν (in all ν ) implies ψ true in ν (in all ν ) check Γ ⊨ ψ in ν (in all ν ) by checking that: given that ν ⊨ θ for all θ ∈ Γ implies ν ⊨ ψ ENT Γ, ψ, ν Yes No Does  MonkeyLow ⊨ MonkeyGetBanana ? No! Does MonkeyLow  BananaHigh ⊨  MonkeyGetBanana? Yes! INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 44

45 Reasoning Services (Entailment) Exercises:  Demonstrate that {today} ⊨ today ∨ tomorrow  Demonstrate that {today} ⊭ tomorrow  Suppose P = today ∨ tomorrow. Then:  Define Γ such that Γ ⊨ P  Define Γ such that Γ ⊭ P 45 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

46 Reasoning Services: properties (I)  EVAL is the easiest task. We just test one assignment.  SAT is NP complete. We need to test in the worst case all the assignments. We stop when we find one which is true.  UnSAT is CO-NP. We need to test in the worst case all the assignments. We stop when we find one which is true.  VAL is CO-NP. We need to test all the assignments and verify that they are all true. We stop when we find one which is false.  ENT is CO-NP. It can be computed using VAL (see next slide) 46 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

47 Reasoning Services: properties (II)  VAL( ψ ) iff UnSAT(  ψ )  SAT( ψ )   VAL( ψ ) iff SAT(  ψ )   VAL(  ψ )   ⊨ ψ, where = { θ 1, …, θ n } iff VAL( θ 1  …  θ n  ψ ) 47 ψ = (A   A) is valid, while (  A  A) is unsatisfiable ψ = A is satisfiable in all models where ν(A) = T. Informally, the left side says that there is at least an assignment which makes A true and there is at least an assignment which makes A false; the right side says that there is at least an assignment which makes  A true (in other words it makes A false) and there is at least an assignment which makes  A false (in other words it makes A true). This means that not all assignments make A true (false). Take A ⊨ A  B. the formula (A  A  B) is valid. INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

48 Reasoning Services: properties (III)  EVAL is easy.  ENT can be computed using VAL  VAL can be computed using UnSAT  UnSAT is the opposite of SAT  All reasoning tasks can be reduced to SAT!!! SAT is the most important reasoning service. 48 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

49 Normal Forms: Literals  A literal is either an atomic proposition or the negation of an atomic proposition, i.e., for all propositional variables P P and ¬P are literals. P is a positive literal ¬P is a negative literal 49 Monkey HighBanana ¬GetBanana ¬ClimbBox INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

50 Normal Forms: Clauses  A (disjunctive) clause is a disjunction of literals α 1  …  α n  A unit clause is a clause that contains only a single literal  An empty clause does not contain literals 50 B ∨ ¬C ∨ ¬DMonkey ∨ ¬Monkey B and ¬C are unit clausesB ∨ ¬C is not INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

51 Conjunctive Normal Form (CNF)  A proposition is in conjunctive normal form (CNF) if it is a (finite) conjunction of (disjunctive) clauses 51 Examples of formulas in CNF: ¬A ∧ B (A ∨ ¬B) ∧ (B ∨ ¬C ∨ ¬D) A ∧ (B ∨ C ∨ ¬D) A  B  (¬ A  C)  (B  ¬ D  E) Examples of formulas NOT in CNF: ¬(A ∧ B)¬ is the outmost operator A ∧ (B ∨ C ∧ ¬D) ∧ is nested within ∨ INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

52 Conversion of a formula to CNF  Theorem (e.g. Mendelson, 1987 [Prop. 1.4, Ex. 1.41(a)]) Every formula P has an equivalent CNF, namely P can be converted (in polynomial time) into a proposition Q such that:  Q is in CNF  P and Q are equivalent (i.e., have the same truth table)  A conversion to a CNF that operates as in the theorem above is said to be complete  The algorithm implementing the conversion to a CNF is based on the tautologies about logical equivalence (or double implication):  Double-negation law (i.e. elimination of ¬¬)  De Morgan’s laws  Distributive laws  Elimination of → and  52 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

53 Conversion to CNF: Basic Tautologies 53 ( α → β ) ↔ (¬ α ∨ β )c → -elimination ( α ↔ β ) ↔ (( α → β ) ∧ ( β → α )) ↔ -elimination ¬( α ∧ β ) ↔ (¬ α ∨ ¬ β ) DeMorgan Law for ∧ ¬( α ∨ β ) ↔ (¬ α ∧ ¬ β ) DeMorgan Law for ∨ ( α ∧ ( β ∨ γ )) ↔ (( α ∧ β ) ∨ ( α ∧ γ )) Distributivity of ∧ over ∨ ( α ∨ ( β ∧ γ )) ↔ (( α ∨ β ) ∧ ( α ∨ γ )) Distributivity of ∨ over ∧ ¬(¬ α ) ↔ α Double-negation elimination INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

54 Example: Conversion to CNF of A ↔ (B ∨ C) 1. Eliminate ↔ : (A → (B ∨ C)) ∧ ((B ∨ C) → A) 2. Eliminate → : (¬A ∨ B ∨ C) ∧ (¬(B ∨ C) ∨ A) 3. Move ¬ inwards using de Morgan’s laws: (¬A ∨ B ∨ C) ∧ ((¬B ∧ ¬C) ∨ A) 4. Apply distributivity of ∨ over ∧ and flatten: (¬A ∨ B ∨ C) ∧ (¬B ∨ A) ∧ (¬C ∨ A) (*) (*) in CNF and equivalent to ‘A ↔ (B ∨ C)’. 54 INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

55 Normal Forms: Conjunctive clauses  A conjunctive clause is a conjunction of literals α 1  …  α n  NOTE: a conjunctive clause IS NOT a clause! 55 B  ¬C  ¬DMonkey  ¬Monkey INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

56 Disjunctive Normal Form (DNF)  A proposition is in disjunctive normal form (DNF) if it is a (finite) disjunction of conjunctive clauses 56 Examples of formulas in DNF: ¬A ∨ B (A ∧ ¬B) ∨ (B ∧ ¬C ∧ ¬D) A ∨ (B ∧ C ∧ ¬D) A ∨ B ∨ (¬ A ∧ C) ∨ (B ∧ ¬ D ∧ E) Examples of formulas NOT in DNF: ¬(A ∨ B)¬ is the outmost operator A ∨ (B ∨ C ∧ ¬D) ∧ is nested within ∨ INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS

57 Horn clauses  A Horn clause is a (disjunctive) clause with at most one positive literal. NOTE: ¬ A  ¬ B  D is equivalent to A  B  D 57 ¬ A A  ¬ B  ¬ D ¬ A  B  ¬ D INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS


Download ppt "LDK R Logics for Data and Knowledge Representation Propositional Logic Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia,"

Similar presentations


Ads by Google