Suppose that Prolog facts are used to define the predicates mother and father which represent that M is the mother of Y and F is the father of X, respectively. Give a Prolog rule to define the predicate grandfather , which represents that X is the grandfather of Y. [Hint: You can write a disjunction in Prolog either by using a semicolon to separate predicates or by putting these predicates on separate lines.]
grandfather : - mother , father ; father , father
Prolog facts are used to define the predicates mother and father which represent that M is a mother of Y and F is the father of X respectively.
grandfather : - mother , father ; father ,father
Where, :- means define and , represents a conjunction and ; represent a disjunction.
Write each of these statements in the form “if p, then q” in English. [Hint: Refer to the list of common ways to express conditional statements provided in this section.]
a) I will remember to send you the address only if you send me an e-mail message. b) To be a citizen of this country, it is sufficient that you were born in the United States. c) If you keep your textbook, it will be a useful reference in your future courses. d) The Red Wings will win the Stanley Cup if their goalie plays well. e) That you get the job implies that you had the best credentials. f ) The beach erodes whenever there is a storm. g) It is necessary to have a valid password to log on to the server. h) You will reach the summit unless you begin your climb too late.
Let p and q be the propositions p : It is below freezing. q : It is snowing. Write these propositions using p and q and logical connectives (including negations).
a) It is below freezing and snowing. b) It is below freezing but not snowing. c) It is not below freezing and it is not snowing. d) It is either snowing or below freezing (or both). e) If it is below freezing, it is also snowing. f )Either it is below freezing or it is snowing, but it is not snowing if it is below freezing. g) That it is below freezing is necessary and sufficient for it to be snowing.
A says “We are both knaves” and B says nothing. Exercises 24–31 relate to inhabitants of an island on which there are three kinds of people: knights who always tell the truth, knaves who always lie, and spies (called normals by Sullying [Sm78]) who can either lie or tell the truth. You encounter three people, A, B, and C. You know one of these people is a knight, one is a knave, and one is a spy. Each of the three people knows the type of person each of other two is. For each of these situations, if possible, determine whether there is a unique solution and determine who the knave, knight, and spy are. When there is no unique solution, list all possible solutions or state that there are no solutions
A says “I am not the spy,” B says “I am not the spy,” and C says “A is the spy.”
94% of StudySmarter users get better grades.Sign up for free