1 / 47

# Logic - PowerPoint PPT Presentation

Logic. Propositional Logic. Logic as a Knowledge Representation Language. A Logic is a formal language, with precisely defined syntax and semantics, which supports sound inference. Independent of domain of application.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### Propositional Logic

• A Logic is a formal language, with precisely defined syntax and semantics, which supports sound inference. Independent of domain of application.

• Different logics exist, which allow you to represent different kinds of things, and which allow more or less efficient inference.

• ..

• But representing some things in logic may not be very natural, and inferences may not be efficient. More specialised languages may be better

• Formal Languages logic, description logic..

Intelligent systems require that we have

Knowledge formally represented

New inferences/conclusions possible.

Formal languages have been developed to support knowledge representation.

One important one is the use of logic - very general purpose way to formally represent truths about the world, and draw sound conclusions from these.

Propositional logic logic, description logic..

• In general a logic is defined by

• syntax: what expressions are allowed in the language.

• Semantics: what they mean, in terms of a mapping to real world

• proof theory: how we can draw new conclusions from existing statements in the logic.

• Propositional logic is the simplest..

What is a proposition logic, description logic..

Proposition = Statement that may be either true or false.

John is in the classroom.

Mary is enrolled in 270A.

If A is true, and A implies B, then B is true.

If some A are B, and some B are C, then some A are C.

If some women are students, and some students are men, then ….

Propositional Logic: Syntax logic, description logic..

• Symbols (e.g., letters, words) are used to represent facts about the world, e.g.,

• “P” represents the fact “Andrew likes chocolate”

• “Q” represents the fact “Andrew has chocolate”

• These are called atomic propositions

• True and false are also atomic propositions

• Logical connectives logic, description logic.. are used to represent and: , or:  , if-then: , not: .

• Statements or sentences in the language are constructed from atomic propositions and logical connectives.

• P  Q “Andrew likes chocolate and he doesn’t have any.”

• P Q “If Andrew likes chocolate then Andrew has chocolate”

Propositional Logic: Semantics logic, description logic..

• What does it all mean?

• Sentences in propositional logic tell you about what is true or false.

• P  Q means that both P and Q are true.

• P  Q means that either P or Q is true (or both)

Concerns logic, description logic..

What does it mean to say a statement is true?

What are sound rules for reasoning

What can we represent in propositional logic?

What is the efficiency?

Can we guarantee to infer all true statements?

Propositional Logic: Semantics logic, description logic..

• P  Q means that if P is true, so is Q.

• This is all formally defined using truth tables.

• X Y X v Y

T T TT F T

F T TF F F

We now know exactly what is meant in terms of the truth of the elementary

propositions when we get a sentence in the language (e.g., P => Q v R).

Truth Tables logic, description logic..

• The truth tables for Propositional Calculus are as follows

Negation logic, description logic..

Conjunction logic, description logic..

Disjunction logic, description logic..

Implication logic, description logic..

Exclusive Or logic, description logic..

IFF Equivalence logic, description logic..

Proof Theory logic, description logic..

• How do we draw new conclusions from existing supplied facts?

• We can define inference rules, which are guaranteed to give true conclusions given true premises.

• For propositional logic useful one is modus ponens:

• If A is true and A=> B is true, then conclude B is true.

A, A B

—————————

B

Proof Theory and Inference logic, description logic..

• So, let P mean “It is raining”, Q mean “I carry my umbrella”.

• If we know that P is true, and P => Q is true..

• We can conclude that Q is true.

• Note that certain expressions are equivalent

• think about P => Q and  P v Q.

More complex rules of inference logic, description logic..

• Other rules of inference can be used, e.g.,:

• This is essentially the resolution rule of inference, used in Prolog.

A v B,  B v C

———————————————

A v C

Consider logic, description logic..

• What can we conclude?

sunny v raining

 raining v umbrella

Semantics logic, description logic..

• Model = possible world

• x+y = 4 is true in the world x=3, y=1.

• x+y = 4 is false in the world x=3, y = 1.

• Entailment S1,S2,..Sn |= S means in every world where S1…Sn are true, S is true.

• Careful: No mention of proof – just checTaoiseach all the worlds.

• Some cognitive scientists argue that this is the way people reason.

Reasoning or Inference Systems logic, description logic..

• Proof is a syntactic property.

• Rules for deriving new sentences from old ones.

• Sound: any derived sentence is true.

• Complete: any true sentence is derivable.

• NOTE: Logical Inference is monotonic. Can’t change your mind.

Translation into Propositional Logic logic, description logic..

• If it rains, then the game will be cancelled.

• If the game is cancelled, then we clean house.

• Can we conclude?

• If it rains, then we clean house.

• p = it rains, q = game cancelled r = we clean house.

• If p then q. not p or q

• If q then r. not q or r

• if p then r. not p or r (resolution)

What can’t we say? logic, description logic..

• Quantification: every student has a father.

• Relations: If X is married to Y, then Y is married to X.

• Probability: There is an 80% chance of rain.

• Combine Evidence: This car is better than that one because…

• Uncertainty: Maybe John is playing golf.

Advantages of propositional logic logic, description logic..

Propositional logic is declarative

Propositional logic allows partial/disjunctive/negated information

• (unlike most data structures and databases)

• Propositional logic is compositional:

• meaning of B1,1 P1,2 is derived from meaning of B1,1 and of P1,2

Meaning in propositional logic is context-independent

• (unlike natural language, where meaning depends on context)

Propositional logic has very limited expressive power

• (unlike natural language)

• E.g., cannot say "pits cause breezes in adjacent squares“

• except by writing one sentence for each square

First-order logic logic, description logic..

• Whereas propositional logic assumes the world contains facts,

• first-order logic (like natural language) assumes the world contains Objects: people, houses, numbers, colors, baseball games, wars, … Relations: red, round, prime, brother of, bigger than, part of, comes between, …

And logic, description logic..

• Functions: father of, best friend, one more than, plus, …

Syntax of FOL: Basic elements logic, description logic..

• Constants TaoiseachJohn, 2, DIT,...

• Predicates Brother, >,...

• Functions Sqrt, LeftLegOf,...

• Variables x, y, a, b,...

• Connectives , , , , 

• Equality =

• Quantifiers , 

Atomic sentences logic, description logic..

Atomic sentence = predicate (term1,...,termn) or term1 = term2

Term = function (term1,...,termn) or constant or variable

• E.g., Brother(TaoiseachJohn,RichardTheLionheart) > (Length(LeftLegOf(Richard)), Length(LeftLegOf(TaoiseachJohn)))

Complex sentences logic, description logic..

• Complex sentences are made from atomic sentences using connectives

S, S1 S2, S1  S2, S1 S2, S1S2,

E.g. Sibling(TaoiseachJohn,Richard)  Sibling(Richard,TaoiseachJohn)

>(1,2)  ≤ (1,2)

>(1,2)  >(1,2)

Truth in first-order logic logic, description logic..

• Sentences are true with respect to a model and an interpretation

• Model contains objects (domainelements) and relations among them

• Interpretation specifies referents for

constantsymbols→objects

predicatesymbols→relations

functionsymbols→ functional relations

• An atomic sentence predicate(term1,...,termn) is true

iff the objects referred to by term1,...,termn

are in the relation referred to by predicate

Universal quantification logic, description logic..

• <variables> <sentence>

Everyone at DIT is smart:

x At(x,DIT)  Smart(x)

• x P is true in a model m iff P is true with x being each possible object in the model

• Roughly speaTaoiseach, equivalent to the logic, description logic..conjunction of instantiations of P

At(TaoiseachJohn,DIT)  Smart(TaoiseachJohn)

 At(Richard,DIT)  Smart(Richard)

 At(DIT,DIT)  Smart(DIT)

 ...

A common mistake to avoid logic, description logic..

• Typically,  is the main connective with 

• Common mistake: using  as the main connective with :

x At(x,DIT)  Smart(x)

means “Everyone is at DIT and everyone is smart”

Existential quantification logic, description logic..

• <variables> <sentence>

• Someone at DIT is smart:

• x At(x,DIT)  Smart(x)\$

• xP is true in a model m iff P is true with x being some possible object in the model

• Roughly speaTaoiseach, equivalent to the logic, description logic..disjunction of instantiations of P

At(TaoiseachJohn,DIT)  Smart(TaoiseachJohn)

 At(Richard,DIT)  Smart(Richard)

 At(DIT,DIT)  Smart(DIT)

 ...

Another common mistake to avoid logic, description logic..

• Typically,  is the main connective with 

• Common mistake: using  as the main connective with :

x At(x,DIT)  Smart(x)

is true if there is anyone who is not at DIT!

Properties of quantifiers logic, description logic..

• x y is the same as yx

• x y is the same as yx

• x y is not the same as yx

• x y Loves(x,y)

• “There is a person who loves everyone in the world”

• yx Loves(x,y)

• “Everyone in the world is loved by at least one person”

• Quantifier duality: each can be expressed using the other

• x Likes(x,IceCream) x Likes(x,IceCream)

• x Likes(x,Broccoli) xLikes(x,Broccoli)

Equality logic, description logic..

• term1 = term2is true under a given interpretation if and only if term1and term2refer to the same object

• E.g., definition of Sibling in terms of Parent:

x,ySibling(x,y)  [(x = y)  m,f  (m = f)  Parent(m,x)  Parent(f,x)  Parent(m,y)  Parent(f,y)]

Using FOL logic, description logic..

The kinship domain:

• Brothers are siblings

x,y Brother(x,y) Sibling(x,y)

Knowledge engineering in FOL logic, description logic..

• Assemble the relevant knowledge

• Decide on a vocabulary of predicates, functions, and constants

• Encode general knowledge about the domain

• Encode a description of the specific problem instance

• Pose queries to the inference procedure and get answers

• Debug the knowledge base

Summary logic, description logic..

• First-order logic:

• objects and relations are semantic primitives

• syntax: constants, functions, predicates, equality, quantifiers