您的当前位置:首页正文

自然语言处理语义分析练习

2021-09-09 来源:钮旅网


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).

Answer :Paris and Marseilles are in France.

-Correctly expresses

(ii) In(Paris,France) ∧ In(Marseilles,France).

Answer :Paris is in France and Marseilles is in France

-Correctly expresses

(iii) In(Paris,France) ∨ In(Marseilles,France).

Answer : Paris is in France or Marseilles is in France

Syntactically valid

-Does not express the same meaning.

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

(i) ∃c Country(c) ∧ Border(c,Iraq) ∧ Border(c,Pakistan).

Answer : There is a country and the country borders Iraq and the country borders Pakistan.

-Correctly expresses

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

Answer : There is a country may meets the condition that borders Irap and borders Packistan.

-Syntactically valid

-Does not express the same meaning.

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

Answer : There probably is a country may meets the condition that borders Irap and borders Packistan.

-Syntactically valid

-Does not express the same meaning.

(iv) ∃c Border(Country(c),Iraq ∧ Pakistan).

Answer : Borders there is a country and both Iraq and Pakistan.

-Syntactically invalid

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

(i) ∀c Country (c) ∧ Border(c,Ecuador) ⇒ In(c,SouthAmerica).

Answer : All countries and countries border Ecuador are in South America

-Syntactically invalid

(ii) ∀c Country(c) ⇒ [Border(c,Ecuador) ⇒ In(c,SouthAmerica)].

Answer : Countries in South America are border Ecuador that could be all

countries.

-Syntactically invalid

(iii) ∀c [Country(c) ⇒ Border(c,Ecuador)] ⇒ In(c,SouthAmerica).

Answer : All countries border Ecuador could in South America.

-Syntactically valid

-Does not express the same meaning.

(iv) ∀c Country (c) ∧ Border(c,Ecuador) ∧ In(c,SouthAmerica).

Answer : All countries and border Ecuador and in South America

-Syntactically invalid

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

(i) ¬[∃c,d In(c,SouthAmerica) ∧ In(d,Europe) ∧ Borders(c,d)].

Answer : A region in South America and a region in Europe, they borders each other is not true.

-Correctly expresses

(ii) ∀c,d [In(c,SouthAmerica) ∧ In(d,Europe)] ⇒¬Borders(c,d)].

Answer : (Syntax error)

-Syntactically invalid , the sentence have two ‘]’ but only one ‘[’, incorrect syntax.

(iii) ¬∀c In(c,SouthAmerica) ⇒∃ d In(d,Europe) ∧¬Borders(c,d).

Answer :When a country is in Europe, not all other countries are in South America, they borders each other.

-Syntactically valid

-Does not express the same meaning.

(iv) ∀c In(c,SouthAmerica) ⇒∀ d In(d,Europe) ⇒¬Borders(c,d).

Answer :When two counties not borders, one must in Europe and another must in South America.

-Syntactically valid

-Does not express the same meaning.

Problem 8.10:

Consider a vocabulary with the following symbols:

Occupation(p,o): A predicate that means that Person p has occupation o.

Customer(p1,p2): A predicate that means that Person p1 is a customer of Person p2.

Boss(p1,p2): A predicate that means that Person p1 is a boss of Person p2.

Doctor, Surgeon, Teacher, Lawyer, Actor: Constants that denote occupations.

Emily, Joe: Constants that denote Persons.

Use these symbols to write the assertions in parts a through g in first order logic. Here are a few examples:

Occupation(Paul,Teacher) means \"Paul is a Teacher.\"

Boss(Dino,Paul) means \"Dino is a boss of Paul.\"

Occupation(Bob,Lawyer) ∧ Occupation(Bob,Teacher) means \"Bob is a Lawyer and a Teacher.\"

∀x Occupation(x,Teacher) ⇒ Occupation(x,Actor) means \"Every teacher is an actor.\"

Now the homework:

a. Emily is either a surgeon or a lawyer.

Answer : ¬ (Occupation(Emily, Surgeon) ⇔ Occupation (Emily, Lawyer))

b. Joe is an actor, but he also holds another job.

Answer : ∃x Occupation(Joe, Actor) ∧ Occupation (Joe, x)

c. All surgeons are doctors.

Answer : ∀x Occupation(x, Surgeon) ⇒ Occupation(x, Docors)

d. Joe does not have a lawyer (meaning that he is not a customer of any lawyer.)

Answer : ∀x ¬Lawer(x, Joe)

e. Emily has a boss who is a lawyer.

Answer : ∃x Boss(x, Emily) ∧Occupation (x, Lawyer)

f. There exists a lawyer all of whose customers are doctors.

Answer :∃x ∀y Occupation (x, Lawyer) ∧Lawyer (x, y) ∧Occupation (y, Doctors)

g. Every surgeon has a lawyer.

Answer : ∀x ∃y Occupation(x, Surgeon) ⇒ Lawyer(y, x)

因篇幅问题不能全部显示,请点此查看更多更全内容