Presentation is loading. Please wait.

Presentation is loading. Please wait.

Logics for Data and Knowledge Representation

Similar presentations


Presentation on theme: "Logics for Data and Knowledge Representation"— Presentation transcript:

1 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 Outline Introduction Syntax Semantics Logical implication
Truth valuation Satisfiability Validity Entailment Logical implication Reasoning Services Normal Forms Changed 2

3 Propositions INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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) “All men are mortals” “Obama is the president of the USA” Mortal  Man ObamaPresident

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

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

6 they can be substituted by any proposition or formula
Language (Syntax) INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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 Σ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

7 Additional Symbols Auxiliary symbols Parentheses: ( ) Defined symbols
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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

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

9 Example: the Monkey-Banana problem
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS “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 [...]” 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): L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana}

10 Examples of formulas INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS Formula Correct 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)

11 Propositional Theory Propositional (or sentential) theory Recall that:
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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, i.e. it is a syntactic notion Recall that: knowledge is a set of facts, i.e. statements we assumed statements are propositions

12 Propositional Theories and Databases
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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

13 The Monkey-Banana problem
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS “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 [...]” 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.

14 Semantics means providing an interpretation
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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

15 The Monkey-Banana problem (II)
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS “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 [...]” L = {A, B, C, D, , , } T = { (A  B  D)  (A  C)  ( A   B  D)} NOTE: Symbols are without meaning. What each symbol mean?

16 Semantics: formal model
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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 (in terms of true/false) 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. CHANGED

17 The Monkey-Banana problem (III)
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS L = {A, C} T = {  (A  C) } Language L Theory T I(A) = T I(C) = F Intensional Interpretation Entailment World Mental Model M ⊨ T Domain D Model M SEMANTIC GAP Formal model M(A) = T M(C) = F D = {T, F} Truth values 17

18 Example: Banana (I) INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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). CHANGED

19 Example: Banana (II) World Banana Banana  (Yellow  Curve) SEMANTIC
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS World Mental Model Language L Language L’ Banana Banana  (Yellow  Curve) CHANGED 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 SENTENCE SEMANTIC GAP OUR MENTAL MODEL MATCHES WITH THE REAL WORLD, SO THE SENTENCES ARE TRUE 19

20 Example: Banana (III) World Banana Banana  (Yellow  Curve) SEMANTIC
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS World Mental Model Language L Language L’ Banana Banana  (Yellow  Curve) CHANGED 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 SENTENCE SEMANTIC GAP OUR MENTAL MODEL DOES NOT MATCH WITH THE REAL WORLD, SO THE SENTENCES ARE FALSE 20

21 Example: Banana (IV) T F T F
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS THE WORLD CHANGED MENTAL MODEL MENTAL MODEL 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 T F T F FORMAL MODEL M1 FORMAL MODEL M2 21

22 Truth-values INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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 ¬⊥) ν(A  B) = T iff ν(A) = F or ν(B) = T

23 Example of truth valuation ν
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana, , , } T = { (MonkeyLow  BananaHigh  MonkeyGetBanana)  (MonkeyLow  MonkeyClimbBox)  ( MonkeyLow   BananaHigh  MonkeyGetBanana)} MODEL 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 23

24 Truth-table (TT) for the logical constants ¬ , ∧, ∨
Truth Tables INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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 ¬ , ∧, ∨

25 Truth Relation (Satisfaction Relation)
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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 θ ∈ Γ

26 Model and Satisfiability
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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 (ν ⊨ Γ).

27 Truth and Validity Let ν be a truth valuation on language L.
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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

28 Example INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana, , , } MODEL 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 CHANGED ν ⊨ MonkeyLow and ν ⊨ BananaHigh [SATISFIABLE] ν ⊨  MonkeyClimbBox and ν ⊨  MonkeyGetBanana [SATISFIABLE] MonkeyLow   MonkeyLow is a tautology [VALID] 28

29 Entailment ν ⊨ θi for all θi in  implies ν ⊨ ψ
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS Propositional entailment  ⊨ ψ where  = {θ1, ..., θn} is a finite set of propositions ν ⊨ θi for all θi in  implies ν ⊨ ψ We call entailment in a model v if it holds for one model NEW!!! 29

30 Example INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana, , , } MODEL 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 NEW!!!  = {MonkeyLow, BananaHigh} ν ⊨ MonkeyLow and ν ⊨ BananaHigh implies ν ⊨ MonkeyLow  BananaHigh therefore  ⊨ MonkeyLow  BananaHigh [ENTAILMENT] 30

31 Entailment Difference in notation ⊨ ψ iff  ⊨ ψ
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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. NEW!!! 31

32 Implication: Premise (I)
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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 UPDATED 32

33 Implication: Premise (II)
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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 33

34 Implication and equivalence
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS We extend our alphabet of symbols with the following defined logical constants: → (implication) ↔ (double implication or equivalence) <Atomic Formula> ::= A | B | ... | P | Q | ... | ⊥ | ⊤ <wff> ::= <Atomic Formula> | ¬<wff> | <wff>∧ <wff> | <wff>∨ <wff> | <wff> → <wff> | <wff> ↔ <wff> (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 ψ → θ Remark: ⊥ and ⊤ are syntactically defined symbols: ⊥ =df P∧¬P, ⊤=df ¬⊥, →,↔ are semantically defined symbols! 34 34

35 Truth Table of → INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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. 35

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

37 Examples (tautologies)
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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) 37

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

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

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

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

42 Reasoning Services: SAT
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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 42 42

43 Reasoning Services (unSAT)
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS Unsatisfiability is the impossibility to find a truth-valuation ν 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. 43

44 Reasoning Services: VAL
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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! 44 44

45 Reasoning Services: ENT
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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! 45 45

46 Reasoning Services (Entailment)
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS Exercises: Demonstrate that {today} ⊨ today ∨ tomorrow Demonstrate that {today} ⊭ tomorrow Suppose P = today ∨ tomorrow. Then: Define Γ such that Γ ⊨ P Define Γ such that Γ ⊭ P Remark: The entailment is a relationship between wff’s that is based on semantics

47 Reasoning Services: properties (I)
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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) NEW 47 47

48 Reasoning Services: properties (II)
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS VAL(ψ) iff UnSAT( ψ) SAT(ψ)   VAL(ψ) iff SAT( ψ)   VAL( ψ)  ⊨ ψ, where  = {θ1, …, θn} iff VAL(θ1  …  θn  ψ) ψ = (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). NEW Take A ⊨ A  B. the formula (A  A  B) is valid. 48 48

49 Reasoning Services: properties (III)
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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. NEW 49 49

50 Normal Forms: Literals
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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 Monkey HighBanana ¬GetBanana ¬ClimbBox 50

51 Normal Forms: Clauses INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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 B ∨ ¬C ∨ ¬D Monkey ∨ ¬Monkey B and ¬C are unit clauses B ∨ ¬C is not 51

52 Conjunctive Normal Form (CNF)
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS A proposition is in conjunctive normal form (CNF) if it is a (finite) conjunction of (disjunctive) clauses 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 ∨ 52

53 Conversion of a formula to CNF
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS 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  53

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

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

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

57 Disjunctive Normal Form (DNF)
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS A proposition is in disjunctive normal form (DNF) if it is a (finite) disjunction of conjunctive clauses 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 ∨ 57

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


Download ppt "Logics for Data and Knowledge Representation"

Similar presentations


Ads by Google