19
Logical Foundations (A refresher) COMP34512 Sebastian Brandt [email protected] Slides by: Bijan Parsia [email protected] Tuesday, 25 February 2014

Logical Foundations (A refresher) COMP34512syllabus.cs.manchester.ac.uk/ugt/2017/COMP34512/slides/day9.pdf · Propositional Logic: Examples 8 The cat is on the mat. TheCatIsOnTheMat

Embed Size (px)

Citation preview

Logical Foundations(A refresher)COMP34512Sebastian Brandt

[email protected]

Slides by: Bijan [email protected]

Tuesday, 25 February 2014

Five Roles1. Surrogate

– That is, a representation2. Expression of ontological commitment

– of the world3. Theory of intelligent reasoning

– and our knowledge of it4. Medium of efficient computation

– that is accessible to programs5. Medium of human expression

– and usable

Representing

Computing

Interacting

2Tuesday, 25 February 2014

The Design TriangleExpressivity

(Representational Adequacy)

Usability(Weak Cognitive Adequacy

vs.Cognitive Complexity)

Computability(vs. Computational and

Implementational Complexity)

Each vertex has multiple positive and negativeinteractions with the others

3Tuesday, 25 February 2014

Some Hypotheses• If a KR is

– strongly cognitively adequate then it is weakly cognitively adequate• or “can be if we figure out how the brain does it”

– strongly cognitively adequate then it is weakly representationally adequate

• We can make a KR– more usable by making it more expressive– less usable by making it more expressive– more computable by making it more expressive– less usable by making it more computable– etc.

• Only hypotheses!

4

Expressivity(Representational Adequacy)

Usability(Weak Cognitive Adequacy

vs.Cognitive Complexity)

Computability(vs. Computational and

Implementational Complexity)

Tuesday, 25 February 2014

LOGIC!!!!• Canonically propositional or first order predicate logic

– Many other logics• for example modal, spatial, and temporal logics• logics far more outré

– We’ll meet some of these later on.

• Common presentation: syntax, semantics, and proof theory– The syntax defines the set of “well-formed formulae” (WFFs)– The semantics associates each WFF with a meaning

• Gives the flavour of representation– Proof theories are “ways of reasoning” with the formulae

• Typically in a “meaning respecting way”• Proof theories (or reasoning procedures) is where we find the algorithms

• First pass through

5Tuesday, 25 February 2014

6

We start here!

Tuesday, 25 February 2014

Propositional Logic: Syntax

• Very simple syntax!– Names for atomics– “Sentential”, “logical”, “truth-functional” “connectives” (or

“operators”– Arbitrary recursion in the grammar

• ¬(C ∨ (D ↔ F)) → C ∧¬E

• Many concrete syntaxes

7

atomicProposition (A) ::= [A-Z][a-zA-Z]* (in camel case)compoundProposition (C, D) :: = ¬C | C ∨ D | C ∧ D | C → D | C ↔ D

~C | C ∨ D | C & D | C ⊃ D | C ≡ D

not C | C or D | C and D | C only if D | C iff D

negation disjunction conjunction implication bi-implication

Tuesday, 25 February 2014

Propositional Logic: Examples

8

The cat is on the mat. TheCatIsOnTheMat

All cats are animals. Cat -> Animal

Roses are red. Roses -> Red

No cats are dogs. Cat -> not Dog

If the moon is green then it is made of cheese.

(Moon and Green) -> MoonIsMadeOfCheese

Either the moon is made of cheese or you’re a liar.

(MoonMadeOfGreenCheese and (not YouAreLiar)) or (YouAreALiar and (not MMGC))

Would you like soup or salad?

I’ll love you just in case you love me.Everyone loves someone if someone loves everyone.

Tuesday, 25 February 2014

Propositional Logic: Semantics• Semantics is given in terms of a function

– An “interpretation function” or “interpretation”– Maps WFFs to “meanings”

• All propositions map to truth values– True or False

• But 0 or 1 works– “Interpretations” standardly called truth assignments

• (in propositional logic)

• We start by assigning True or False– To each atomic formula

• The meaning of a compound formula is determined– by the base assignment, plus– the standard meaning of the operators

• it is a function of the base assignment9

Tuesday, 25 February 2014

Truth Table: Conjunction

• We define the connectives with a truth table– exhaustive specification of the value of the operator– i.e., for every possible assignment to the components

• we have a determined value for the compound

• We do this for all connectives!

10Tuesday, 25 February 2014

Truth tables: The set

11

P and Q can be compound!

Tuesday, 25 February 2014

Danger! Consider....

12

p q r p v q (p v q) ∧ r

T T T T T

T T F T F

T F T T T

T F F T F

F T T T T

F T F T F

F F T F F

F F F F F

How many rows do we need?

Tuesday, 25 February 2014

Computation!• We have an algorithm

– Construct the corresponding truth table

• We can evaluate the difficulty– I.e., the computational complexity!– Pretty hard with this algorithm!

• But it is decidable– We can get a yes or no answer in finite time

– How bad is it in the worst case?– How bad is it in the best case?

• Can we do any better?

• This is a preliminary analysis!

13Tuesday, 25 February 2014

Truth Tables qua Proof Theory• Truth tables determine whether a formula is

– consistent (or “satisfiable”)• at least one row evaluates to True

– contingent• at least one row evaluates to True and one to False

– inconsistent• all rows evaluate to False

– tautological (i.e., a “theorem”, or “valid”)• all rows evaluate to True

• We can easily extend this to sets of formulae– Implicit conjunction

• Use the truth table!

• We can extend it to entailment– Think about the conditional!

14

Buggy!

Boring!

Tuesday, 25 February 2014

How does it do?• Self-Standing (nouny terms)

– General• Animal

– Mammal» Cat = eats only Dog» Dog = eats only Cat» Cow SubClassOf eats only not Animal» Human SubClassOf eats

only (not Animal and Animal)

• Modifiers (adjectivally terms)– Domesticated

• Pet• Farmed

– Wild– Carnivorous = eats only Animal– Herbivorous = eats only not Animal– Omnivorous = Carnivorous and Herbivorous

• New TermseatsonlyandnotSubClassOf

Domain specific

“Logicy”

15Tuesday, 25 February 2014

Propositionalise?• Self-Standing (nouny terms)

– General• Animal

– Mammal» Cat ↔ eats only Dog» Dog ↔ eats only Cat» Cow → eats only not Animal» Human → eats

only (not Animal and Animal)

• Modifiers (adjectivally terms)– Domesticated

• Pet• Farmed

– Wild– Carnivorous ↔ eats only Animal– Herbivorous ↔ eats only not Animal– Omnivorous ↔ Carnivorous and Herbivorous

• New TermsEatsonly??∧¬→↔

16Tuesday, 25 February 2014

Propositionalise!!

17

English Propositional Logic Is it good?

Tuesday, 25 February 2014

Propositional Logic: Reasoning

18

Fundamental Conception DeductionValid arguments“If the premises are all true then the conclusion must be true”

Sanctioned Inferences (Formula) Satisfiability/Knowledge base consistencyEntailment“Sound and Complete” Inference

Recommended Inferences Depends on the application!“SAT” very common

Tuesday, 25 February 2014

Evaluating Prop Logic as KR

19

Role 1: Surrogacy

Role 2: Ontological Commitment

Role 3: Theory of Reasoning

Role 4: Efficient Computation

Role 5: Human Communication

Can we do better?What’s the obvious big problem?

Tuesday, 25 February 2014