# Final Exam

#### 18 December 2007

The scale was A = 112, C = 70.

```  Q1: 45 points
Q2: 15 points
Q3: 25 points
Q4: 40+5 points
Total: 125+5 points
```

• Question 1 (45): This problem deals with the following recursively defined sequence of compound proposiations P0, P1, P2,..., which use the atomic propositions a1, a2, a3,...:
• P0 is the proposition "0", meaning "false".
• For all positive natural numbers i, Pi is defined to be "ai → Pi-1".

Thus P1 is "a1 → 0", P2 is "a2 → (a1 → 0)", P3 is "a3 → (a2 → (a1 → 0))", and so forth. Don't forget that for any propositions x and y, "x → y" is defined to be true unless both x is true and y is false.

Here are your problems:

• (a,15) Prove that for any positive natural i, (¬a1) → Pi. (Hint: Use ordinary induction starting with i=1.) (Also, not that it's "a1", not "ai".
• (b,10) Suppose that we choose a truth value for each atomic proposition ai independently, with each ai equally likely to be true or false. Calculate the probability that P1 is true, the probability that P2 is true, and the probability that P3 is true. (These are three separate questions.)
• (c,20) Under the assumption of part (b), find a formula that gives the probability that Pi is true as a function of the natural number i. Prove that your formula is correct, using (ordinary) induction and the laws of probability.

• Question 2 (15): Let R be a binary relation on a set X. You are given that R is an equivalence relation.
• (a,5) Write down the three properties of an equivalence relation as quantified statements involving R.
• (b,10) Prove the following quantified statement using the quantifier proof rules and the statements from part (a). All variables represent elements of X:

∀a:∀b: R(a,b) → [∀c:∀d: (R(c,a) ∧ R(d,b)) → R(c,d)]

• Question 3 (25): This question deals with the following labeled undirected graph. The vertex set is {A,B,C,D,E,F,G}. There are edges (B,E), (D,F), and (E,F) of length 1, edges (A,B), (C,G), and (F,G) of length 2, edges (A,C) and (C,D) of length 3, and an edge (B,D) of length 4.
• (a,5) Write down the single-step distance matrix for this graph, suitable as input for Floyd's Algorithm. Breifly describe how you would use this algorithm to find the shortest-path distance matrix, but do not do the calculation!
• (b,10) Ignoring the weights of the edges for this part only, conduct a breadth-first search and a depth-first search of this graph, each time starting from node A. Assume that you are able to recognize previously seen nodes, as is usual for such searches of graphs. Draw the two search trees, indicating the tree edges and non-tree edges.
• (c,10) Carry out a uniform-cost search on the weighted graph to find the shortest path from node A to node D. Indicate what entries go on and off the priority queue before the final answer is found.

• Question 4 (40+5): This question deals with a preschool class of eight students: four girls named Abigail, Beatrice, Caroline, and Daisy, and four boys named Edward, Frank, George, and Henry.

Here are your questions:

• (a,5) When the eight students line up to go to recess, each possible order of the students is equally likely. How many such orders are there?
• (b,10) When the students line up, what is the probability that they alternate between boys and girls, with the first student a boy?
• (c,5) When the students line up, what is the probability that Abigail is somewhere after Edward and somewhere before Frank, possibly with other students in between?
• (d,5XC) When the students line up, what is the probability that Edward, Abigail, and Frank, in that order, are three consecutive students in the line? (That is, Edward is immediately in front of Abigail, who is immediately in front of Frank.)
• (e,5) Let Y be the set consisting of the first three students in the line. When the students line up, what is the probability that Y is the set {Abigail, Edward, Frank}?
• (f,10) During the day, the teacher awards three gold stars for good behavior. It is possible, though not required, that more than one star goes to the same student. How many possibilities are there for the way the stars are awarded (for example, one way is "two to Abigail, one to George")?
• (g,5) If the teacher awards each of the three gold stars randomly and independently, with each student equally likely to get each star, what is the probability that three different students get stars?