0% found this document useful (0 votes)
67 views11 pages

Assignment On PL FOL

The document consists of a series of assignments focused on propositional logic and first-order logic, covering topics such as implications, validity, satisfiability, and logical representations. It includes various questions that require proving statements, converting sentences to clausal form, and analyzing logical relationships. Additionally, it involves practical applications of logic in scenarios such as car braking systems and social security numbers.

Uploaded by

nnuthi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views11 pages

Assignment On PL FOL

The document consists of a series of assignments focused on propositional logic and first-order logic, covering topics such as implications, validity, satisfiability, and logical representations. It includes various questions that require proving statements, converting sentences to clausal form, and analyzing logical relationships. Additionally, it involves practical applications of logic in scenarios such as car braking systems and social security numbers.

Uploaded by

nnuthi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Assignment on Propositional Logic.

Q1. If a Unicorn is Mythical, then it is immortal, but if it is not mythical, then it is a mortal mammal. If
the unicorn is either immortal or a mammal, then it is horned. The unicorn is magical if it is horned.

Can you prove that the unicorn is mythical? Magical?, horned?

Q2. According to some political pundits, a person who is radical (R) is electable (E) if he/she is
conservative (C), but otherwise is not electable.

a. Which of the following are correct representations of this assertion?

(i) (R ∧ E) ⇐⇒ C

(ii) R ⇒ (E ⇐⇒ C)

(iii) R ⇒ ((C ⇒ E) ∨¬E)

b. Which of the sentences in (a) can be expressed in Horn form?

Q3. Consider the following sentence:

[(Food ⇒ Party) ∨ (Drinks ⇒ Party)] ⇒ [(Food ∧ Drinks) ⇒ Party] .

a. Determine, using enumeration, whether this sentence is valid, satisfiable (but not valid), or
unsatisfiable.

b. Convert the left-hand and right-hand sides of the main implication into CNF, showing each step,
and explain how the results confirm your answer to (a).

c. Prove your answer to (a) using resolution.

Q4.

Knowledge-base describing when the car should brake?

( PersonInFrontOfCar ⇒ Brake )

∧ ((( YellowLight ∧ Policeman ) ∧ ( ¬Slippery )) ⇒ Brake )

∧ ( Policecar ⇒ Policeman )

∧ ( Snow ⇒ Slippery )

∧ ( Slippery ⇒ ¬Dry )

∧ ( RedLight ⇒ Brake )

∧ ( Winter ⇒ Snow )

Observation from sensors:

YellowLight ∧ ¬RedLight ∧ ¬Snow ∧ Dry ∧ Policecar ∧ ¬PersonInFrontOfCar

What can we infer?

Given the observations should the car apply brakes?


Q5. Which of the following are correct?

a. False |= True.

b. True |= False.

c. (A ∧ B) |= (A ⇔ B).

d. A ⇔ B |= A ∨ B.

e. A ⇔ B |= ¬A ∨ B.

f. (A ∧ B) ⇒ C |= (A ⇒ C) ∨ (B ⇒ C).

g. (C ∨ (¬A ∧ ¬B)) ≡ ((A ⇒ C) ∧ (B ⇒ C)).

h. (A ∨ B) ∧ (¬C ∨¬D ∨ E) |= (A ∨ B).

i. (A ∨ B) ∧ (¬C ∨¬D ∨ E) |= (A ∨ B) ∧ (¬D ∨ E).

j. (A ∨ B)∧ ¬(A ⇒ B) is satisfiable.

k. (A ⇔ B) ∧ (¬A ∨ B) is satisfiable.

l. (A ⇔ B) ⇔ C has the same number of models as (A ⇔ B) for any fixed set of

proposition symbols that includes A, B, C.

Q6. Consider a vocabulary with only four propositions, A, B, C, and D. How many models

are there for the following sentences?

a. B ∨ C.

b. ¬A∨¬B ∨¬C ∨ ¬D.

c. (A ⇒ B) ∧ A∧ ¬B ∧ C ∧ D.

Q7. Decide whether each of the following sentences is valid, unsatisfiable, or neither. Verify

your decisions using truth tables or the equivalence rules of Figure 7.11 (page 249).

a. Smoke ⇒ Smoke

b. Smoke ⇒ Fire

c. (Smoke ⇒ Fire) ⇒ (¬Smoke ⇒ ¬Fire)

d. Smoke ∨ Fire ∨ ¬Fire

e. ((Smoke ∧ Heat ) ⇒ Fire) ⇔ ((Smoke ⇒ Fire) ∨ (Heat ⇒ Fire))

f. (Smoke ⇒ Fire) ⇒ ((Smoke ∧ Heat ) ⇒ Fire)

g. Big ∨ Dumb ∨ (Big ⇒ Dumb)

Q8. Convert the following set of sentences to clausal form.

S1: A ⇔ (B ∨ E).

S2: E ⇒ D.
S3: C ∧ F ⇒ ¬B.

S4: E ⇒ B.

S5: B ⇒ F.

S6: B ⇒ C
Assignment – FOL: try a minimum of 5 and 8.9 from the problems below.

knowledge base entail ∀x P(x)? Explain your answer in terms of models.


8.2 Consider a knowledge base containing just two sentences: P(a) and P(b). Does this

8.3 Is the sentence ∃ x, y x=y valid? Explain.

8.4 Write down a logical sentence such that every world in which it is true contains
exactly one object.

8.5 Consider a symbol vocabulary that contains c constant symbols, pk predicate


symbols of each arity k, and fk function symbols of each arity k, where 1 ≤ k ≤ A. Let the
domain size be fixed at D. For any given model, each predicate or function symbol is
mapped onto a relation or function, respectively, of the same arity. You may assume that
the functions in the model allow some input tuples to have no value for the function (i.e.,
the value is the invisible object). Derive a formula for the number of possible models for
a domain with D elements. Don’t worry about eliminating redundant combinations.

8.6 Which of the following are valid (necessarily true) sentences?


a. (∃x x=x) ⇒ (∀ y ∃z y =z).
b. ∀x P(x) ∨¬P(x).
c. ∀ x Smart(x) ∨ (x=x).
8.8 Does the fact ¬ Spouse(George, Laura) follow from the facts Jim _= George
and Spouse(Jim, Laura)? If so, give a proof; if not, supply additional axioms as
needed. What happens if we use Spouse as a unary function symbol instead of a
binary predicate?

8.9 This exercise uses the function MapColor and predicates In(x, y), Borders(x,
y), and Country(x), whose arguments are geographical regions, along with
constant symbols for various regions. In each of the following we give an English
sentence and a number of candidate logical expressions. For each of the logical
expressions, state whether it (1) correctly expresses the English sentence; (2) is
syntactically invalid and therefore meaningless; or (3) is syntactically valid but
does not express the meaning of the English sentence.

a. Paris and Marseilles are both in France.


(i) In(Paris ∧ Marseilles, France ).
(ii) In(Paris, France ) ∧ In(Marseilles, France ).
(iii) In(Paris, France ) ∨ In(Marseilles, France ).

b. There is a country that borders both Iraq and Pakistan.


(i) ∃ c Country(c) ∧ Border (c, Iraq) ∧ Border (c, Pakistan).
(ii) ∃ c Country(c) ⇒ [Border (c, Iraq) ∧ Border (c, Pakistan)].
(iii) [∃ c Country(c)] ⇒ [Border (c, Iraq) ∧ Border (c, Pakistan)].
(iv) ∃ c Border (Country(c), Iraq ∧ Pakistan).

c. All countries that border Ecuador are in South America.


(i) ∀c Country(c) ∧ Border (c,Ecuador ) ⇒ In(c, SouthAmerica).
(ii) ∀ c Country(c) ⇒ [Border (c,Ecuador ) ⇒ In(c, SouthAmerica)].
(iii) ∀ c [Country(c) ⇒ Border (c,Ecuador )] ⇒ In(c, SouthAmerica).
(iv) ∀c Country(c) ∧ Border (c,Ecuador ) ∧ In(c, SouthAmerica).

d. No region in South America borders any region in Europe.


(i) ¬[∃ c, d In(c, SouthAmerica) ∧ In(d, Europe) ∧ Borders(c, d)].
(ii) ∀ c, d [In(c, SouthAmerica) ∧ In(d, Europe)] ⇒ ¬Borders(c, d)].
(iii) ¬∀ c In(c, SouthAmerica) ⇒ ∃d In(d, Europe)∧ ¬Borders(c, d).
(iv) ∀ c In(c, SouthAmerica) ⇒ ∀d In(d, Europe) ⇒ ¬Borders(c, d).
e. No two adjacent countries have the same map color.
(i) ∀ x, y ¬Country(x) ∨ ¬Country(y)∨ ¬Borders(x, y) ∨
¬(MapColor (x) = MapColor (y)).
(ii) ∀ x, y (Country(x) ∧ Country(y) ∧ Borders(x, y) ∧ ¬(x = y)) ⇒
¬(MapColor (x) = MapColor (y)).
(iii) ∀ x, y Country(x) ∧ Country(y) ∧ Borders(x, y) ∧
¬(MapColor (x) = MapColor (y)).
(iv) ∀ x, y (Country(x) ∧ Country(y) ∧ Borders(x, y)) ⇒ MapColor (x _= y).
8.10 Consider a vocabulary with the following symbols:
Occupation(p, o): Predicate. Person p has occupation o.
Customer (p1, p2): Predicate. Person p1 is a customer of person p2.
Boss(p1, p2): Predicate. Person p1 is a boss of person p2.
Doctor , Surgeon, Lawyer , Actor : Constants denoting occupations.
Emily, Joe: Constants denoting people.
Use these symbols to write the following assertions in first-order logic:
a. Emily is either a surgeon or a lawyer.
b. Joe is an actor, but he also holds another job.
c. All surgeons are doctors.
d. Joe does not have a lawyer (i.e., is not a customer of any lawyer).
e. Emily has a boss who is a lawyer.
f. There exists a lawyer all of whose customers are doctors.
g. Every surgeon has a lawyer.

8.11 Complete the following exercises about logical senntences:


a. Translate into good, natural English (no xs or ys!):
∀ x, y, l SpeaksLanguage(x, l) ∧ SpeaksLanguage(y, l)
⇒ Understands (x, y) ∧ Understands(y, x).
b. Explain why this sentence is entailed by the sentence
∀ x, y, l SpeaksLanguage(x, l) ∧ SpeaksLanguage(y, l)
⇒ Understands (x, y).
c. Translate into first-order logic the following sentences:
(i) Understanding leads to friendship.
(ii) Friendship is transitive.
Remember to define all predicates, functions, and constants you use.
8.13 Equation ∀s Breezy(s) ⇔ ∃r Adjacent (r, s) ∧ Pit(r) defines the conditions
under which a square is breezy. Here we consider two other ways to describe
this aspect of the wumpus world.

a. We can write diagnostic rules leading DIAGNOSTIC RULE from observed effects to
hidden causes. For finding pits, the obvious diagnostic rules say that if a square
is breezy, some adjacent square must contain a pit; and if a square is not breezy,
then no adjacent square contains a pit. Write these two rules in first-order logic
and show that their conjunction is logically equivalent to the given Equation

b. We can write causal rules leading from cause to effect. One obvious causal
rule is that a pit causes all adjacent squares to be breezy. Write this rule in first-
order logic, explain why it is incomplete compared to the given Equation, and
supply the missing axiom.

8.14 Write axioms describing the predicates Grandchild , Greatgrandparent ,


Ancestor , Brother , Sister , Daughter , Son, FirstCousin, BrotherInLaw,
SisterInLaw, Aunt, and Uncle. Find out the proper definition of mth cousin n times
removed, and write the definition in first-order logic. Now write down the basic
facts depicted in the family tree in Figure below. Using a suitable logical
reasoning system, TELL it all the sentences you have written down, and A SK it who
are Elizabeth’s grandchildren, Diana’s brothers-in-law, Zara’s great-
grandparents, and Eugenie’s ancestors.

A typical family tree. The symbol “ ” connects spouses and arrows point to
children.

8.17 Explain what is wrong with the following proposed definition of adjacent
squares in the wumpus world:
∀ x, y Adjacent ([x, y], [x + 1, y]) ∧ Adjacent ([x, y], [x, y + 1]) .

8.18 Write out the axioms required for reasoning about the wumpus’s location,
using a constant symbol Wumpus and a binary predicate At(Wumpus, Location).
Remember that there is only one wumpus.

8.19 Assuming predicates Parent(p, q) and Female(p) and constants Joan and
Kevin, with the obvious meanings, express each of the following sentences in
first-order logic. (You may use the abbreviation ∃1 to mean “there exists exactly
one.”)
a. Joan has a daughter (possibly more than one, and possibly sons as well).
b. Joan has exactly one daughter (but may have sons as well).
c. Joan has exactly one child, a daughter.
d. Joan and Kevin have exactly one child together.
e. Joan has at least one child with Kevin, and no children with anyone else.

8.23 For each of the following sentences in English, decide if the accompanying
first-order logic sentence is a good translation. If not, explain why not and correct
it. (Some sentences may have more than one error!)
a. No two people have the same social security number.
¬∃ x, y, n Person(x) ∧ Person(y) ⇒ [HasSS#(x, n) ∧ HasSS#(y, n)].
b. John’s social security number is the same as Mary’s.
∃ n HasSS#(John, n) ∧ HasSS#(Mary, n).
c. Everyone’s social security number has nine digits.
∀ x, n Person(x) ⇒ [HasSS#(x, n) ∧ Digits(n, 9)].
d. Rewrite each of the above (uncorrected) sentences using a function symbol
SS#instead
of the predicate HasSS#.

8.24 Represent the following sentences in first-order logic, using a consistent


vocabulary(which you must define):
a. Some students took French in spring 2001.
b. Every student who takes French passes it.
c. Only one student took Greek in spring 2001.
d. The best score in Greek is always higher than the best score in French.
e. Every person who buys a policy is smart.
f. No person buys an expensive policy.
g. There is an agent who sells policies only to people who are not insured.
h. There is a barber who shaves all men in town who do not shave themselves.
i. A person born in the UK, each of whose parents is a UK citizen or a UK resident,
is a
UK citizen by birth.
j. A person born outside the UK, one of whose parents is a UK citizen by birth, is
a UK
citizen by descent.
k. Politicians can fool some of the people all of the time, and they can fool all of
the people
some of the time, but they can’t fool all of the people all of the time.
l. All Greeks speak the same language. (Use Speaks(x, l) to mean that person x
speaks
language l.)

8.25 Write a general set of facts and axioms to represent the assertion
“Wellington heard about Napoleon’s death” and to correctly answer the question
“Did Napoleon hear about Wellington’s death?”

8.27 Obtain a passport application for your country, identify the rules
determining eligibility
for a passport, and translate them into first-order logic,

8.28 Consider a first-order logical knowledge base that describes worlds


containing people,
songs, albums (e.g., “Meet the Beatles”) and disks (i.e., particular physical
instances of CDs).
The vocabulary contains the following symbols:
CopyOf (d, a): Predicate. Disk d is a copy of album a.
Owns(p, d): Predicate. Person p owns disk d.
Sings(p, s, a): Albuma includes a recording of song s sung by person p.
Wrote(p, s): Person p wrote song s.
McCartney, Gershwin, BHoliday, Joe, EleanorRigby, TheManILove, Revolver :
Constants with the obvious meanings.

Express the following statements in first-order logic:


a. Gershwin wrote “The Man I Love.”
b. Gershwin did not write “Eleanor Rigby.”
c. Either Gershwin or McCartney wrote “The Man I Love.”
d. Joe has written at least one song.
e. Joe owns a copy of Revolver.
f. Every song that McCartney sings on Revolver was written by McCartney.
g. Gershwin did not write any of the songs on Revolver.
h. Every song that Gershwin wrote has been recorded on some album. (Possibly
different
songs are recorded on different albums.)
i. There is a single album that contains every song that Joe has written.
j. Joe owns a copy of an album that has Billie Holiday singing “The Man I Love.”
k. Joe owns a copy of every album that has a song sung by McCartney. (Of
course, each
different album is instantiated in a different physical CD.)
l. Joe owns a copy of every album on which all the songs are sung by Billie
Holiday.
Assignment on Logical Inference in FOL. Try any 5 of the problems below

9.3 Suppose a knowledge base contains just one sentence, ∃ x AsHighAs(x,


Everest ). Which of the following are legitimate results of applying Existential
Instantiation?
a. AsHighAs(Everest, Everest ).
b. AsHighAs(Kilimanjaro, Everest).
c. AsHighAs(Kilimanjaro, Everest) ∧ AsHighAs(BenNevis, Everest)
(after two applications).

9.4 For each pair of atomic sentences, give the most general unifier if it exists:
a. P(A,B,B), P(x, y, z).
b. Q(y,G(A,B)), Q(G(x, x), y).
c. Older(Father (y), y), Older (Father (x), John).
d. Knows(Father (y), y), Knows(x, x).

9.6 Write down logical representations for the following sentences, suitable for
use with Generalized Modus Ponens:
a. Horses, cows, and pigs are mammals.
b. An offspring of a horse is a horse.
c. Bluebeard is a horse.
d. Bluebeard is Charlie’s parent.
e. Offspring and parent are inverse relations.
f. Every mammal has a parent.

9.10 A popular children’s riddle is “Brothers and sisters have I none, but that
man’s father is my father’s son.” Use the rules of the family domain (Section
8.3.2 on page 301) to show who that man is. You may apply any of the inference
methods described in this chapter. Why do you think that this riddle is difficult?

9.13 In this exercise, use the sentences you wrote in Exercise 9.6 to answer a
question by
using a backward-chaining algorithm.
a. Draw the proof tree generated by an exhaustive backward-chaining algorithm
for the
query ∃ h Horse(h), where clauses are matched in the order given.
b. What do you notice about this domain?
c. How many solutions for h actually follow from your sentences?
d. Can you think of a way to find all of them? (Hint: See Smith et al. (1986).)

9.14 Trace the execution of the backward-chaining algorithm in below when


it is applied to solve the crime problem given below. Show the sequence of
values taken on by
the goals variable, and arrange them into a tree.
---------------------------------------------------------------------------
function FOL-BC-ASK(KB, query) returns a generator of substitutions
return FOL-BC-OR(KB, query,{ })

generator FOL-BC-OR(KB, goal , θ) yields a substitution


for each rule (lhs ⇒ rhs) in FETCH-RULES-FOR-GOAL(KB, goal ) do
(lhs, rhs)←STANDARDIZE-VARIABLES((lhs, rhs))

for each θ’ in FOL-BC-AND(KB, lhs, UNIFY(rhs, goal , θ)) do


yield θ’
--------------------------------------------------
generator FOL-BC-AND(KB, goals, θ) yields a substitution
if θ = failure then return
else if LENGTH(goals) = 0 then yield θ
else do
first,rest ←FIRST(goals), REST(goals)
for each θ’ in FOL-BC-OR(KB, SUBST(θ, first), θ) do
for each θ’’ in FOL-BC-AND(KB, rest , θ’ ) do
yield θ’’
----------------------------------------------------------------
A simple backward-chaining algorithm for first-order knowledge bases.

Problem:
problem:
The law says that it is a crime for an American to sell weapons to hostile nations. The
country Nono, an enemy of America, has some missiles, and all of its missiles were sold
to it by Colonel West, who is American. prove that West is a criminal.

9.19 Suppose a knowledge base contains just the following first-order Horn
clauses:
Ancestor(Mother(x), x)
Ancestor(x, y) ∧ Ancestor(y, z) ⇒ Ancestor(x, z)
Consider a forward chaining algorithm that, on the jth iteration, terminates if the
KB contains a sentence that unifies with the query, else adds to the KB every
atomic sentence that can be inferred from the sentences already in the KB after
iteration j − 1.

a. For each of the following queries, say whether the algorithm will (1) give an
answer (if so, write down that answer); or (2) terminate with no answer; or (3)
never terminate.
(i) Ancestor(Mother(y), John)
(ii) Ancestor(Mother(Mother(y)), John)
(iii) Ancestor(Mother(Mother(Mother(y))),Mother(y))
(iv) Ancestor(Mother(John),Mother(Mother(John)))
b. Can a resolution algorithm prove the sentence ¬Ancestor(John,John) from the
original knowledge base? Explain how, or why not.
c. Suppose we add the assertion that ¬(Mother(x)=x) and augment the resolution
algorithm with inference rules for equality. Now what is the answer to (b)?

9.20 Let L be the first-order language with a single predicate S(p, q), meaning “p
shaves q.” Assume a domain of people.

a. Consider the sentence “There exists a person P who shaves every one who
does not shave themselves, and only people that do not shave themselves.”
Express this in L.
b. Convert the sentence in (a) to clausal form.
c. Construct a resolution proof to show that the clauses in (b) are inherently
inconsistent.
(Note: you do not need any additional axioms.)

9.21 How can resolution be used to show that a sentence is valid? Unsatisfiable?

9.23 From “Horses are animals,” it follows that “The head of a horse is the head
of an
animal.” Demonstrate that this inference is valid by carrying out the following
steps:

a. Translate the premise and the conclusion into the language of first-order logic.
Use three predicates: HeadOf (h, x) (meaning “h is the head of x”), Horse(x), and
Animal (x).
b. Negate the conclusion, and convert the premise and the negated conclusion
into conjunctive normal form.
c. Use resolution to show that the conclusion follows from the premise.

9.24 Here are two sentences in the language of first-order logic:


(A) ∀ x ∃ y (x ≥ y)
(B) ∃ y ∀ x (x ≥ y)
a. Assume that the variables range over all the natural numbers 0, 1,
2, . . . ,∞and that the “≥” predicate means “is greater than or equal to.” Under
this interpretation, translate (A) and (B) into English.
b. Is (A) true under this interpretation?
c. Is (B) true under this interpretation?
d. Does (A) logically entail (B)?
e. Does (B) logically entail (A)?
f. Using resolution, try to prove that (A) follows from (B). Do this even if you think
that (B) does not logically entail (A); continue until the proof breaks down and
you cannot proceed (if it does break down). Show the unifying substitution for
each resolution step. If the proof fails, explain exactly where, how, and why it
breaks down.
g. Now try to prove that (B) follows from (A).

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy