SE 504 Spring 2024
HW #1 Sample solutions (selected)

1. P: x>0 ∧ y>x−1   vs.   Q: x≥4 ∧ y≥x

Solution: P is strictly weaker than Q. That ¬[P ⇒ Q] is shown by considering any state in which x = 1 and y = 1. In any such state, P is true but Q is false. Here are two different proofs of [Q ⇒ P]. The one on the left employs the "Assume the Antecedant" approach. The one on the right transforms the antecedant into the antecedant, with the relationship between each expression and the one following it being either ≡ or ⇒. Recall that the informal way to express Gries & Schneider Theorem (4.3) is "Weakening a conjunct weakens the conjunction as a whole".

Assume Q (the antecedant) (i.e., x≥4 and y≥x)
   P

=    < defn. of P >

   x>0 ∧ y>x-1

=    < assumption x≥4 guarantees x>0 >

   true ∧ y>x-1

=    < assumption y≥x guarantees y>x-1 >

   true ∧ true

=    < (3.39) >

   true
   Q

=    < defn of Q >

   x≥4 ∧ y≥x

⇒    < (4.3), relying upon [x≥4 ⇒ x>0] >

   x>0 ∧ y≥x

⇒    < (4.3), relying upon [y≥x ⇒ y>x-1] >

   x>0 ∧ y>x-1

=   < defn of P >

   P


2. P: x>0 ∧ y>x−1   vs.   Q: x≥4 ∨ y>x

Solution: Neither P nor Q is stronger than the other.

Proof: Consider any state in which x = 1 and y = 0. In any such state, P is true but Q is false. Hence, ¬[P ⇒ Q].

Consider any state in which x = −5 and y = 0. In any such state, Q is true but P is false. Hence, ¬[Q ⇒ P].


3. Solution: Omitted.


4. Solution: Omitted.


5. Solution: Omitted.


6. P: x≥0 ⇒ y>z   vs.   Q: x=1 ⇒ y≥z

Solution: P is strictly stronger than Q. Consider any state in which x = y = z = 0. In any such state, P is false but Q is true. (which makes Q⇒P false in that state). Hence, ¬[Q ⇒ P] holds.

It remains to show [P ⇒ Q].

   P

=    < defn of P >

   x≥0 ⇒ y>z 

⇒   < weakening the consequent weakens an
      implication, relying upon [y>z ⇒ y≥z]  >

   x≥0 ⇒ y≥z 

⇒   < strengthening the antecedant weakens an
      implication, relying upon [x=1 ⇒ x≥0]   >

   x=1 ⇒ y≥z

=    < defn of Q >

   Q


7. P: f.k = 5   vs.   Q: (∃i |: f.i = 5)

Solution: Consider a state in which k = 37 and f.37 = 19 but f.12 = 5. In any such state, P is false but Q is true. Hence, it is not the case that [Q ⇒ P].

As for [P ⇒ Q], here is a proof:

   P

=     < defn of P >

   f.k = 5

=     < textual substitution >

   (f.i = 5)[i := k]

⇒     < (9.28)[P,x,E := f.i=5, i, k]  >

   (∃i |: f.i = 5) 

=     < defn of Q >

   Q


8. The given "equation" is

Y: [P ∧ Y ⟹ P ∧ Q]

The strongest solution is Y: false. That false is a solution is proved by doing a proof of p ∧ false ⟹ p ∧ q, which is easy.

That no stronger solution exists follows from the fact that no predicate is stronger than false.

The weakest solution is Y: ¬P ∨ Q (or, equivalently, ¬(P ∧ ¬Q)). Here is a proof that this is a solution:

   P ∧ (¬P ∨ Q)

=    < (3.46) (∧ distributes over ∨) >

   (P ∧ ¬P) ∨ (P ∧ Q)

=    < (3.42) (contradiction) >

   false ∨ (P ∧ Q)

=    < (3.30) (false is the identity of ∨) >

   P ∧ Q

To argue that our choice of Y is the weakest solution, consider any predicate Z whose satisfying set includes a state x that is not in the satisfying set of our Y. That is, x is a state that truthifies the negation of our Y. That negation is P ∧ ¬Q. Hence, P(x) ∧ ¬Q(x) is true, as is Z(x). Evaluating the implication in that state yields

   P(x) ∧ Z(x) ⟹ P(x) ∧ Q(x)

=     < x truthifies both P and Z but falsifies Q >

   true ∧ true  ⟹ true ∧ false

=     < (3.39), (3.40) >

   true ⟹ false

=     < (3.73) >

   false

It follows that any predicate Z that is weaker than our choice of Y is not a solution.


9. The given "equation" is

Y: [P ∨ Q ⟹ P ∨ Y]

The weakest solution is Y: true. That true is a solution is proved by doing a proof of p ∨ q ⟹ p ∨ true, which is easy.

That no weaker solution exists follows from the fact that no predicate is weaker than true.

The strongest solution is Y: ¬P ∧ Q (or, equivalently, ¬(P ∨ ¬Q)). Here is a proof that this is a solution:

   P ∨ (¬P ∧ Q)

=    < (3.45) (∨ distributes over ∧) >

   (P ∨ ¬P) ∧ (P ∨ Q)

=    < (3.28), (3.4), (3.7) >

   true ∧ (P ∨ Q)

=    < (3.39) >

   P ∨ Q

To argue that our choice of Y is the strongest solution, consider any predicate Z whose satisfying set fails to include some state x that is in the satisfying set of our Y. That is, x is a state such that ¬P(x) ∨ Q(x) is true but Z(x) is false. Evaluating the implication in that state yields

   P(x) ∨ Q(x) ⟹ P(x) ∨ Z(x)

=     < x falsifies P and Z but truthifies Q >

   false ∨ true  ⟹ false ∨ false

=     < (3.30) twice >

   true ⟹ false

=     < (3.73) >

   false

It follows that any predicate Z that is stronger than our choice of Y is not a solution.