Search for question
Question

16

Exercise 27 (Queens Problem). The n-Queens Problem is the problem of placing n queens on

an nxn chessboard so that no two queens can attack each other. A solution of the problem

when n-6 is shown on the left of Figure 1.2. In this exercise we specify the requirements of a

solution for the n-Queens Problem as a propositional wif , with one such wff for every n 4.

(There are no solutions for n-2 and 3.) For convenience, we use a set of doubly-indexed

propositional variables, instead of P, where the indices range over the positive integers:

Q={LJE(L2}}-

The desired wif, in this exercise is in WFF(Q). We set the variable to truth value trae

(resp. false) if there is (resp. there is not) a queen placed in position (i, j) of the board, where we

take the first index i (resp. the second index j) to range over the vertical axis downward (resp.

CHAPTER 1. PROPOSITIONAL LOGIC

the horizontal axis rightward); that is, i is a row number and j is a column mmber. There are

four parts in this exercise:

1. Write the wife and justify how it accomplishes its task.

Hint: Write as a conjunction

(a)

(b)

(e)

(d)

Aqide Age, where

is satisfied if there is exactly one queen in each row,

is satisfied if there is exactly one queen in each column,

is satisfied if there is at most one queen in each diagonal,

is satisfied if there is at most one queen in each antidiagonal.

Further Hist: Given any two distinct positions (is, ji) and (ia, ja) along a diagonal, it is

always the case that is −j 12-ja. And if the two positions are along an antidiagonal,

then it is always the case that i, +₁=₂+/

2. Imagine now an infinite chessboard, which occupies the entire south-east quadrant of the

Cartesian plane. The coordinates along the vertical and horizontal axes are, respectively, i

(increasing downward) and j (increasing rightward), both ranging over the positive integers

(1,2,...). In an attempt to repeat the argument in Example 20 and Exercise 21, someone

once defined the set of wis {n>4), and wrote the following (in outline here):

The set I is finitely satisfiable and, therefore, satisfiable by Compactness. Hence,

there exists a solution of the Infinite Queens Problem, which satisfies conditions

{(a), (b), (c), (d)) for all

4.

3. Your task is to define an infinite set

that:

What is wrong with the preceding argument? The answer is subtle and you need to be

careful.

(₁|k> 1} of distinct propositional weff's such

(a) For every > 1 there is n1 such that satisfaction of wff 8, implies satisfaction of

wif, defined in part 1 of this exercise, ie, satisfaction of 6, defines a solution of the

x-Queens Problem.

(b) For all >k> 1, if satisfaction of welf's By and define solutions of the n'-Queens

Problem and Queens Problem, respectively, then n²>n.

(e) Every finite subset ofis satisfiable.

Hint: For part (a), make 8 define a particular n-Queens Problem, ie, is satisfied by

exactly one truth assigment of the variables occurring in 6. For (b) and (c), read and

understand the subsection entitled "A second solution of the infinite Queens Problem" in

Appendix G.

4. Let be the infinite set of weff's defined in the preceding part. Use Compactness for PL to

give a rigorous argument that the Infinite Queens Problem has indeed a solution.

0

Fig: 1


Most Viewed Questions Of Formal Language Automata

5. Convert the below BNF into EBNF. (program) → begin (stmt_list) end (stmt_list)→→ (stmt) |(stmt); (stmt_list) (stmt) → (var) = (expression) (var) → A|B|C (expression) → (var) + (var) | (var) - (var) | (var)


8- In database ER diagram, how do we uniquely identify relationships? A. Primary key of participating entities B. Primary key of the relation itself C. By its attributes D. Relationships cannot be uniquely identified


1. (40 pt., 10 pt. each) Construct a Turing machine in JFLAP (version 7.1) that decides each of the following languages. For each language, you must submit one JFLAP file clearly labeled (e.g., 1a.jff). Make sure that you test your Turing machines in JFLAP before submitting. Note: there is no explicit reject state for Turing machines in JFLAP. You should assume that there is a transition to the reject state whenever a state is missing a transition for a particular symbol. a. A = {we {a,b}* | w contains at least one a and at most one b} b. B = {w € {a,b}" | w contains more a's than b's} c. C = {a¹b/c+/|ij≥0} d. D= {0¹1 |n, m≥ 0 and n is divisible by m} For example, 000011 € D (because 4 is divisible by 2) and 00011 # D (because 3 is not divisible by 2).


10- Given a K-map with one 1 circled and the equation is ABCD (ANDed), what is it? (third circle in the first row) A. Minterm B. Maxterm C. Prime implicant D. Essential prime implicant


6- what is changing one requirement, while taking into account competing requirements A. Software Feasibility B. Software Consistency C. Software Maintainability D. Software Stability


Problem 2 (13 pts.) Consider the following claim. Claim. For any sets S and T, (SxT)n (Tx S)-(Sx S) = 0. (a) (11 pts.) Use a proof by contradiction to prove the claim. To get full points you must use a mixture of formal notation and word explanations (e.g. the "column" format). Each step of your proof should have an explanation as to how/why you could make that logical step. When in doubt, more detail is better than less. Grading Notes. While a detailed rubric cannot be provided in advance as it gives away solution details, the following is a general idea of how points are distributed for this problem. We give partial credit where we can. (9) Correctness. If your proof is not correct, this is where you'll get docked. (5) Regardless of how you formulate your proof, somewhere you'll need certain facts without which the proof wouldn't work. E.g. if it weren't true that the sum of two integers is integer, would your proof fail? If so, then that is a fact I need to see stated somewhere. (1) The order of these facts must make sense, so that you're not inferring something before you have all the facts to infer it. E.g. you cannot use the fact that the sum of two integers is integer if you don't already know that you have two integers to begin with. (3) You also must use a proof by contradiction, which clearly states it is a proof by contradiction, states what the contradictory assumption is, finds a contradiction, and clearly states what and where that contradiction is. (2) Communication. We need to see a mix of notation and intuition, preferably in the "column" format with the notation on the left, and the reasons on the right. If you skip too many steps at once, or we cannot follow your proof, or if your solution is overly wordy or confusing, this is where you'll get docked. (b) (2 pts.) Is it possible to prove this claim by contrapositive? If so, what would the statement of the claim be (that you could then apply the contrapositive to)? If not, give a brief explanation why it cannot be done. Grading Notes. This problem is meant for you to think about whether you can modify your proof to be of a different form, and explaining your answer.


4- When the developers make the program in an architecture such that it can be used by other customers in the future A. Customer-specific program B. Program files C. Program generator


Problem 1 (23 pts.) Consider the following claim: Claim. {21n: n € Z} U {14n: n € Z} c{7n:n €Z}. (a) (3 pts.) Write the claim as an (equivalent) if-then statement. Grading Notes. While a detailed rubric cannot be provided in advance as it gives away solution details, the following is a general idea of how points are distributed for this problem. We give partial credit where we can. (3) Correctness. Regardless of how you formulate your proof, you will need to have an if-then statement that is equivalent to the original. (b) (11 pts.) Give a direct proof by cases that the claim is true. As a hint, you might want to prove the if-then statement you constructed in (a). To get full points you must use a mixture of formal notation and word explanations (e.g. the "column" format). Each step of your proof should have an explanation as to how/why you could make that logical step. When in doubt, more detail is better than less. Grading Notes. While a detailed rubric cannot be provided in advance as it gives away solution details, the following is a general idea of how points are distributed for this problem. If you can at least get part-way, we give partial credit where we can. (9) Correctness. If your proof is not correct, this is where you'll get docked. (2) Regardless of how you formulate your proof, you will need clearly labeled exhaustive cases. (6) Regardless of how you formulate your proof, somewhere you'll need certain facts without which the proof wouldn't work. E.g. if it weren't true that the sum of two integers is integer, would your proof fail? If so, then that is a fact I need to see stated somewhere. (1) The order of these facts makes sense, so that you're not inferring something before you have all the facts to infer it. E.g. you cannot use the fact that the sum of two integers is integer if you don't already know that you have two integers to begin with. The order of how you use these does not have to exactly match those in the sample solutions, but there are orders that will not work and you will lose points if, for example, you use "the difference of ints is int" before you use "the product of ints is int". If you combine some steps (such as "the difference and product of ints is int" or "the product of two non-zero ints is a non-zero int") that is fine. Just don't combine all (see below). (2) Communication. We need to see a mix of notation and intuition, preferably in the "column" format with the notation on the left, and the reasons on the right. If you skip too many steps at once, or we cannot follow your proof, or if your solution is overly wordy or confusing, this is where you'll get docked. (c) (3 pts.) State (but do not prove) the contrapositive of your statement from part (a). Grading Notes. While a detailed rubric cannot be provided in advance as it gives away solution details, the following is a general idea of how points are distributed for this problem. We give partial credit where we can. (3) Correctness. You have to have the contrapositive statement of whatever if-then state- ment you wrote in part (a). (d) (3 pts.) State (but do not prove) the converse of your statement from part (a). Grading Notes. While a detailed rubric cannot be provided in advance as it gives away solution details, the following is a general idea of how points are distributed for this problem. We give partial credit where we can. (3) Correctness. Regardless of how you formulate your proof, you will need to have an if-then statement that is the contrapositive of the original. (e) (3 pts.) Give a disproof by counter-example of the converse from part (d). (That is, show that the converse is not true by providing an example that demonstrates it is not true.) Remember that any disproof by counter-example not only provides the counter-example, but also an explanation as to why it is a counter-example. Grading Notes. Note that this problem gives you practice disproving a statement by counter-example, which requires clearly stating a counter-example, and then showing why it is a counter-example.


4. (a) Write a grammar for the following language consisting of strings that have n copies of the letter 'a' followed by one more number of copies of the letter 'b', where n > 0. Examples of such strings are abb, aabbb, etc, but a, ab, ba, and aaabb are not. (b) Draw parse trees for the sentences abb and aabbb in Problem 4.


2. (40 pt., 10 pt. each) Give an implementation-level description of a Turing machine that decides each of the languages in Problem 1. a. A = {w = {a,b}* | w contains at least one a and at most one b} b. B = {w = {a,b}" | w contains more a's than b's} c. C = {a¹b/citii,j ≥ 0} d. D= {01m|n, m≥ 0 and n is divisible by m} For example, 000011 € D (because 4 is divisible by 2) and 00011 # D (because 3 is not divisible by 2).