1.1, 2.1, 3.1, and 4.1 due Friday, Feb 2 in class. The rest is due Tuesday, Feb 6 in class.
This is a paper and pencil assignment. Pencil. Not pen. Please write legibly!
Prove the following theorems:
P0, P1, ..., Pk |= Q iff P0 ⋀ P1 ⋀ ... ⋀ Pk |= Q
P0, P1, ..., Pk |= Q iff |= (P0 ⋀ P1 ⋀ ... ⋀ Pk) → Q
Recall your sum-list function from HW #1 Problem 4.
Formulate a structural induction principle for List[Number].
Prove that, for every pair of List[Number] xs and ys,
(sum-list (append xs ys)) = (+ (sum-list xs) (sum-list ys))Recall your data definition of a binary tree of numbers (BTN) from HW #1 Problem 4.
Formulate a structural induction principle for BTN.
On the same problem, you were asked to formulate test cases that demonstrate that the sum of a BTN is the same as the sum of the list of numbers obtained by flattening the tree. Prove that this test works for every BTN.
Hint: The result in exercise 2.2 will help.
Recall the data definition for propositions given in HW #2.
Write down a structural induction principle for propositions.
We defined the truth value of a proposition given an interpretation as follows:
;; Interpretation = (A -> {⊤, ⊥})
;; M : Proposition Interpretation -> {⊤, ⊥}
;; determine truth of a proposition under a particular interpretationM[P -> Q, a] = if M[P, a] then M[Q, a] else ⊤
M[P /\ Q, a] = min( M[P, a] , M[Q, a] )
M[P \/ Q, a] = max( M[P, a] , M[Q, a] )
M[~P, a] = flip( M[P, a] )
M[true, a] = ⊤
M[false, a] = ⊥
M[A, a] = a[A]
where
;; flip : {⊤, ⊥} -> {⊤, ⊥}flip(⊤) = ⊥
flip(⊥) = ⊤
;; min : {⊤, ⊥} {⊤, ⊥} -> {⊤, ⊥}min(⊤, ⊤) = ⊤
min(X, Y) = ⊥, when X and Y are not both ⊤.
;; max : {⊤, ⊥} {⊤, ⊥} -> {⊤, ⊥}max(⊥, ⊥) = ⊥
max(X, Y) = ⊤, when X and Y are not both ⊥.
Prove that M holds up its end of the contract. That is, prove:
For all propositions P and interpretations a, either M[P, a] = ⊤ or M[P, a] = ⊥.