0% found this document useful (0 votes)
30 views5 pages

CS 228 Tut3 Sol

Uploaded by

Vistas Flamingo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views5 pages

CS 228 Tut3 Sol

Uploaded by

Vistas Flamingo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Logic in CS Autumn 2024

Problem Sheet 3
S. Krishna

1. For each of the following conditions, give an example of an unsatisfiable set of formulae, Γ
that meets the condition.
(a) Each member of the set is—by itself—satisfiable.
(b) For any two members γ1 and γ2 of Γ, the set {γ1 , γ2 } is satisfiable.
(c) For any three members γ1 , γ2 , and γ3 of Γ, the set {γ1 , γ2 , γ3 } is satisfiable.

Solution
(a) Γ = {p, ¬p}

(b) Γ = {p1 , p2 , ¬p1 ∨ ¬p2 }

(c) Γ = {p1 , p2 , p3 , ¬p1 ∨ ¬p2 ∨ ¬p3 }

2. Let α be a wff whose only connective symbols are ∧, ∨, and ¬. Let α∗ be the result of
interchanging ∧ and ∨ and replacing each propositional variable by its negation. Show that
α∗ is tautologically equivalent to ¬α. Observe that this result is a generalization and a stronger
form of De Morgan’s laws, which deal with the negation of conjunctions and disjunctions.

Solution
We will prove this via structural induction.
Base Case:
Consider the simplest wff, where α is a sentence symbol p. Then, α∗ = ¬p, and hence,
α∗ ≡ ¬α.

Inductive Step:
Say ϕ, ψ are formulae which such that ϕ∗ ≡ ¬ϕ and ψ∗ ≡ ¬ψ. Consider the following
cases:

• α = ¬ϕ: Then, α∗ = ¬ϕ∗ and by the inductive hypothesis, ϕ∗ ≡ ¬ϕ.Therefore,


α∗ = ¬(¬ϕ) = ϕ, and thus α∗ ≡ ¬α.

• α = ϕ ∧ ψ: Then, by interchanging ∨ and ∧, α∗ = ϕ∗ ∨ ψ ∗ , and by the inductive


hypothesis, ϕ∗ ≡ ¬ϕ and ψ ∗ ≡ ¬ψ. Thus, α∗ = ¬ϕ ∨ ¬ψ and by De Morgan’s
law, α∗ ≡ ¬α.

• α = ϕ ∨ ψ: Then, by interchanging ∨ and ∧, α∗ = ϕ∗ ∧ ψ ∗ , and by the inductive


hypothesis, ϕ∗ ≡ ¬ϕ and ψ ∗ ≡ ¬ψ. Thus, α∗ = ¬ϕ ∧ ¬ψ and by De Morgan’s

1
law, α∗ ≡ ¬α.

3. Let F and G be two sets of formulae. We say F ≡ G iff for any assignment α, α |= F iff
α |= G (α |= F iff α |= Fi for every Fi ∈ F). Prove or disprove: For any F and G, F ≡ G iff

(a) For each G ∈ G, there exists F ∈ F such that G |= F , and


(b) For each F ∈ F, there exists G ∈ G such that F |= G,

Solution
Consider F = {p} and G = {p, ⊤}, where p is an atomic proposition. Observe that
F ≡ G. (Why?) Now, we shall show that (a) is false, hence giving a counterexample.

Take G = ⊤. Clearly, ⊤ ⊭ p and hence there does not exist a F ∈ F such that G |= F

4. A set of sentences F is said to be closed under conjunction if for any F and G in F, F ∧ G


is also in F. Suppose F is closed under conjunction and is inconsistent (F ⊢ ⊥). Prove that
for any G ∈ F, there exists F ∈ F such that {F } ⊢ ¬G.

Solution
We are given that F is inconsistent (F ⊢ ⊥). Let F ′ ⊆ F be the finite set of formulae
in F used in a proof deducing ⊥. Thus, F ′ is a finite subset of F such that F ′ ⊢ ⊥.

Consider the formula F = F ′ ∈F ′ F ′ . Since F ′ is a finite subset of F, F is also an


V
element of F since F is closed under conjunction. We shall show that {F } ⊢ ⊥.

F ′ ⊢ ⊥ =⇒ F ′ |= ⊥ [ Soundness of Formal Proof System ]


=⇒ ∄ α such that (∀F ′ ∈ F ′ , α |= F ′ )
^
=⇒ ∄ α such that α |= F [∵ F = F′ ]
F ′ ∈F ′
=⇒ {F } |= ⊥ =⇒ {F } ⊢ ⊥ [ Completeness of Formal Proof System ]

Hence, we showed that there exists a formula F ∈ F such that {F } ⊢ ⊥ and hence for
any formula G ∈ F, {F } ⊢ ¬G since ⊥ ⊢ ¬G.

5. Suppose |= (F → G) and F is satisfiable and G is not valid. Show that there exists a formula
H such that the atomic propositions in H are in both F and G and |= F → H and |= H → G.

2
Solution
We denote the list of propositional variables that occur only in F as p⃗, the list of
variables common to F and G as ⃗q, and those only in G as ⃗r. Let np , nq , nr be the
number of variables in p⃗, ⃗q, ⃗r, respectively.
Define H as follows: _
H= F [ p⃗ = α
⃗ ].
⃗ ∈{⊥,⊤}np
α

where, F [ p⃗ = α
⃗ ] denotes the formula obtained by replacing all occurrences of pi by
αi , and then simplifying the resultant formula. By simplification, we mean the obvious
ones like α ∧ ⊤ = α, α ∨ ⊤ = ⊤, α ∧ ¬⊤ = ⊥, α ∨ ¬⊤ = α for all sub-formulas α of F .
Similarly for ⊥.

Notice that H contains variables only in ⃗q.


Now we need to show that (a) |= F → H and (b) |= H → G. In the following
discussion, αp (resp. αq and αr ) denote an assignment of variables in p⃗ (resp. ⃗q and
⃗r). For this we will state the following lemma first.

Lemma. (−, αq , −) |= H ⇐⇒ ∃ αp such that (αp , αq , −) |= F .


Here, (−, αq , −) represents an assignment of all variables such that the variables in ⃗q
are assigned αq , while variables in p⃗ and ⃗r can take any truth values. Thus, the lemma
follows from the definition of H and the fact that [[H]] does not depend on assignment
of variables in p⃗.

(a) |= F → H:

(αp , αq , −) |= F =⇒ ∃ αp such that (αp , αq , −) |= F


=⇒ (−, αq , −) |= H [ By ( ⇐= ) of Lemma ]

(b) |= H → G:

(−, αq , −) |= H =⇒ ∃ αp such that (αp , αq , −) |= F [ By ( =⇒ ) of Lemma ]



=⇒ ∃ αp ∀ αr , (αp , αq , αr ) |= F [ [[F ]] does not depend on αr ]

=⇒ ∃ αp ∀ αr , (αp , αq , αr ) |= G [ Since |= F → G ]
=⇒ ∀αr , (−, αq , αr ) |= G [ [[G]] does not depend on αp ]

This result is popularly known as Craig’s Interpolation Theorem, as applied to propo-


sitional logic. The formula H is known as an interpolant of F and G.

6. Consider the parity function, PARITY : {0, 1}n → {0, 1}, where PARITY evaluates to 1 iff an
odd number of inputs is 1. In all of the CNFs below, we assume that each clause contains
any variable at most once, i.e. no clause contains expressions of the form p ∧ ¬p or p ∨ ¬p.
Furthermore, all clauses are assumed to be distinct.

3
(a) Prove that any CNF representation of PARITY must have n literals (from distinct vari-
ables) in every clause.
(b) Prove that any CNF representation of PARITY must have at least 2n−1 clauses.

Solution
Let PARITY := m
V Wni
i=1 j=1 ℓij be the CNF representation of PARITY, where ni is the
number of literals in the i−th clause, and m is the number of clauses. We want to
prove that ni = n for every i, and m ≥ 2n − 1.

(a) Suppose ni < n for some i. Negate the entire formula to convert the CNF into a
DNF. Now, choose an assignment of literals in the i−th cube (of the DNF) such
that the cube, and hence the whole DNF formula, evaluates to 1. Now, consider
a variable v, which doesn’t appear in the i−th cube, and flip its value. The LHS
then becomes 0. However, the i−th clause stays 1, leading to a contradiction.

(b) Once again, consider the DNF. Note that a conjunction of n literals is satisfied
by a unique assignment of variables, and thus, the clauses in the DNF actually
encode the assignments that satisfy the formula. Since PARITY is satisfied by
2n−1 clauses, we’re done.

7. Using resolution, or otherwise, show that there is a polynomial-time algorithm to decide


satisfiability of those CNF formulas F in which each propositional variable occurs at most
twice. Justify your answer. Note that this question is not the same as 2-SAT.

Solution
If a variable occurs only positively or only negatively in F , then we can delete the
clauses containing that variable without affecting the satisfiability of F . Thus, we
can assume that all variables have one negative occurrence and one positive occurrence.

Suppose F has clauses C1 , C2 such that p ∈ C1 and ¬p ∈ C2 . Let


R = (C1 \{p}) ∪ (C2 \{¬p}) be a resolvent of C1 , C2 . We claim that F and
F ′ = (F \{C1 , C2 }) ∪ {R} are equisatisfiable. It follows immediately from resolution
that a valuation that satisfies F also satisfies F ′ . Thus, it suffices to show that an
assignment α that satisfies F ′ can be extended to an assignment that satisfies F . Since
such an assignment satisfies R, it satisfies either C1 \{p} or C2 \{¬p}. In the first case,
the assignment α[p ← 0] satisfies F , and in the second case, the assignment α[p ← 1]
satisfies F .

In summary, we can eliminate each variable from F without affecting satisfiability and
without increasing the size of the overall formula. It follows that satisfiability can be
decided in polynomial time.

4
8. Say that a set Σ1 of wffs is equivalent to a set Σ2 of wffs iff for any wff α, we have Σ1 |= α
iff Σ2 |= α. A set Σ is independent iff no member of Σ is tautologically implied by the
remaining members in Σ. Show that a finite set of wffs has an independent equivalent subset
by describing an algorithm to compute this independent equivalent subset. Prove that your
algorithm returns a subset that is independent and equivalent.

Algorithm 1 Algorithm to compute an independent equivalent subset


1: Σ′ ← Σ
2: while there exists σ ∈ Σ′ such that Σ′ \ {σ} |= σ do
3: Σ′ ← Σ′ \ {σ}
4: end while
5: return Σ′

Solution
The key idea is to keep removing the formulae in Σ, which are tautologically implied
by others, till there aren’t any. This is given in Algorithm 1.

Notice that since Σ is finite, the algorithm terminates after finite number of iterations.
Also, the algorithms terminates only when there does not exist a σ ∈ Σ′ such that
Σ \ {σ} |= σ, i.e, the set Σ′ returned at the end will be independent. Clearly Σ′ ⊆ Σ.
We are only left to show that Σ′ is equivalent to Σ.

Let the algorithm terminate after n iterations. Let Σ0 , Σ1 , . . . , Σn be the sets


representing Σ′ at the end of each iteration. Clearly, Σ0 = Σ, and Σn will be returned
at the end. We will inductively show that at each iteration, i, Σi is equivalent to Σ.

Base case. i = 0. Σi = Σ0 is clearly equivalent to Σ.


Induction Step. Assume that Σi−1 is equivalent to Σ. We will now show that Σi is
also equivalent to Σ. In our algorithm, we should have removed an element from Σi−1
to obtain Σi . Let this element be σi . We have removed σi from Σi−1 because, Σi |= σi .
Now, let α be any wff. If Σi |= α, then since Σi ⊆ Σ, Σ |= α (Why? ).
Now, observe that since, Σi−1 |= σi , the set of all assignments which make all formulae
in Σi−1 true is same as that which make all formulae in Σi = Σi−1 \ {σi } true. Hence,
since Σ is equivalent to Σi−1 it follows that Σ |= α =⇒ Σi−1 |= α =⇒ Σi |= α.
Thus, Σi is equivalent to Σ. Thus by induction Σn is equivalent to Σ, as we needed,
and thus our algorithm returns an independent equivalent subset of Σ.

Follow-up Question. Is the output from our algorithm unique?

You might also like