COS3751 Assignment 3
66796504
Question 1
a. Emily is either a surgeon or a lawyer (but not both):
(Surgeon(Emily) ∧ ¬Lawyer(Emily)) ∨ (Lawyer(Emily) ∧ ¬Surgeon(Emily))
b. All surgeons are doctors:
∀p (Surgeon(p) → Doctor(p))
c. Joe does not have a lawyer:
¬∃p (Lawyer(p) ∧ Customer(Joe, p))
d. There exists a lawyer all of whose customers are doctors:
∃p (Lawyer(p) ∧ ∀q (Customer(q, p) → Doctor(q)))
e. Every surgeon has a lawyer:
∀p (Surgeon(p) → ∃q (Lawyer(q) ∧ Customer(p, q)))
, Question 2
a. Let the 3x3 grid be represented as:
[A1, A2, A3],
[B1, B2, B3],
[C1, C2, C3]
Variables:
• Each cell is a variable: A1..C3
Domains:
• Each variable’s domain is the set of letters in the intersecting horizontal and vertical
words.
Constraints:
• Words must be valid across and down:
o A1A2A3 ∈ {DIE, DRY, OAK}
o B1B2B3 ∈ {DIE, DRY, OAK} - previously unused horizontal
o C1C2C3 ∈ {DIE, DRY, OAK} - previously unused horizontal
o A1B1C1 ∈ {AIR, KEY, ODD}
o A2B2C2 ∈ {AIR, KEY, ODD} - previously unused vertical
o A3B3C3 ∈ {AIR, KEY, ODD} - previously unused vertical
Start State:
All variables unassigned; domain consists of the six given words.
b. Solving Algorithm
Pseudocode: Backtracking with Constraint Propagation
66796504
Question 1
a. Emily is either a surgeon or a lawyer (but not both):
(Surgeon(Emily) ∧ ¬Lawyer(Emily)) ∨ (Lawyer(Emily) ∧ ¬Surgeon(Emily))
b. All surgeons are doctors:
∀p (Surgeon(p) → Doctor(p))
c. Joe does not have a lawyer:
¬∃p (Lawyer(p) ∧ Customer(Joe, p))
d. There exists a lawyer all of whose customers are doctors:
∃p (Lawyer(p) ∧ ∀q (Customer(q, p) → Doctor(q)))
e. Every surgeon has a lawyer:
∀p (Surgeon(p) → ∃q (Lawyer(q) ∧ Customer(p, q)))
, Question 2
a. Let the 3x3 grid be represented as:
[A1, A2, A3],
[B1, B2, B3],
[C1, C2, C3]
Variables:
• Each cell is a variable: A1..C3
Domains:
• Each variable’s domain is the set of letters in the intersecting horizontal and vertical
words.
Constraints:
• Words must be valid across and down:
o A1A2A3 ∈ {DIE, DRY, OAK}
o B1B2B3 ∈ {DIE, DRY, OAK} - previously unused horizontal
o C1C2C3 ∈ {DIE, DRY, OAK} - previously unused horizontal
o A1B1C1 ∈ {AIR, KEY, ODD}
o A2B2C2 ∈ {AIR, KEY, ODD} - previously unused vertical
o A3B3C3 ∈ {AIR, KEY, ODD} - previously unused vertical
Start State:
All variables unassigned; domain consists of the six given words.
b. Solving Algorithm
Pseudocode: Backtracking with Constraint Propagation