CS 512, Spring 2017: Take-Home End-of-Term Examination

Similar documents
Where Can We Draw The Line?

Linear Time Unit Propagation, Horn-SAT and 2-SAT

8.1 Polynomial-Time Reductions

1. Suppose you are given a magic black box that somehow answers the following decision problem in polynomial time:

8 NP-complete problem Hard problems: demo

Introduction to Sets and Logic (MATH 1190)

NP-Hardness. We start by defining types of problem, and then move on to defining the polynomial-time reductions.

The Satisfiability Problem [HMU06,Chp.10b] Satisfiability (SAT) Problem Cook s Theorem: An NP-Complete Problem Restricted SAT: CSAT, k-sat, 3SAT

NP-Completeness of 3SAT, 1-IN-3SAT and MAX 2SAT

NP and computational intractability. Kleinberg and Tardos, chapter 8

Reductions and Satisfiability

ALGORITHMS EXAMINATION Department of Computer Science New York University December 17, 2007

PCP and Hardness of Approximation

CSC 501 Semantics of Programming Languages

The Resolution Algorithm

Greedy Algorithms 1. For large values of d, brute force search is not feasible because there are 2 d

CSC Discrete Math I, Spring Sets

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

Exam in Algorithms & Data Structures 3 (1DL481)

8 Matroid Intersection

Chapter 10 Part 1: Reduction

CSE 20 DISCRETE MATH. Fall

Reductions. Linear Time Reductions. Desiderata. Reduction. Desiderata. Classify problems according to their computational requirements.

Discrete Mathematics Lecture 4. Harper Langston New York University

LECTURE 8: SETS. Software Engineering Mike Wooldridge

Chapter 8. NP and Computational Intractability. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Online Appendix: A Stackelberg Game Model for Botnet Data Exfiltration

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18

Exercises Computational Complexity

CS 3512, Spring Instructor: Doug Dunham. Textbook: James L. Hein, Discrete Structures, Logic, and Computability, 3rd Ed. Jones and Barlett, 2010

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/18/14

Computability Theory

SAT-CNF Is N P-complete

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

(QiuXin Hui) 7.2 Given the following, can you prove that the unicorn is mythical? How about magical? Horned? Decide what you think the right answer

Greedy Algorithms 1 {K(S) K(S) C} For large values of d, brute force search is not feasible because there are 2 d {1,..., d}.

! Greed. O(n log n) interval scheduling. ! Divide-and-conquer. O(n log n) FFT. ! Dynamic programming. O(n 2 ) edit distance.

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution

Complexity of Disjoint Π-Vertex Deletion for Disconnected Forbidden Subgraphs

Example of a Demonstration that a Problem is NP-Complete by reduction from CNF-SAT

(a) (4 pts) Prove that if a and b are rational, then ab is rational. Since a and b are rational they can be written as the ratio of integers a 1

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Algorithms For Inference Fall 2014

Ch9: Exact Inference: Variable Elimination. Shimi Salant, Barak Sternberg

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter p. 1/27

Treewidth and graph minors

Propositional Logic. Part I

CS264: Homework #4. Due by midnight on Wednesday, October 22, 2014

Integrity Constraints (Chapter 7.3) Overview. Bottom-Up. Top-Down. Integrity Constraint. Disjunctive & Negative Knowledge. Proof by Refutation

NP-Complete Reductions 2

Complexity of unique list colorability

NP-Completeness. Algorithms

Safe Stratified Datalog With Integer Order Does not Have Syntax

9.1 Cook-Levin Theorem

Propositional Logic Formal Syntax and Semantics. Computability and Logic

! Greed. O(n log n) interval scheduling. ! Divide-and-conquer. O(n log n) FFT. ! Dynamic programming. O(n 2 ) edit distance.

Discrete Optimization. Lecture Notes 2

CSE 20 DISCRETE MATH. Winter

arxiv: v2 [cs.cc] 29 Mar 2010

Solutions for the Exam 6 January 2014

1 Elementary number theory

Real Analysis, 2nd Edition, G.B.Folland

A Simplied NP-complete MAXSAT Problem. Abstract. It is shown that the MAX2SAT problem is NP-complete even if every variable

This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS

Overview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic.

CHENNAI MATHEMATICAL INSTITUTE M.Sc. / Ph.D. Programme in Computer Science

Computational problems. Lecture 2: Combinatorial search and optimisation problems. Computational problems. Examples. Example

Propositional Logic. Andreas Klappenecker

Computer Science Technical Report

CMPSCI611: The SUBSET-SUM Problem Lecture 18

Efficient Enumeration Algorithms for Constraint Satisfaction Problems

Chapter 8. NP-complete problems

Review Material: First Order Logic (FOL)

Minimal-Change Integrity Maintenance Using Tuple Deletions

CS446: Machine Learning Fall Problem Set 4. Handed Out: October 17, 2013 Due: October 31 th, w T x i w

Module 11. Directed Graphs. Contents

W4231: Analysis of Algorithms

Theorem 2.9: nearest addition algorithm

8.1 Polynomial-Time Reductions

Towards a Logical Reconstruction of Relational Database Theory

SOFTWARE ENGINEERING DESIGN I

Chapter 3. Set Theory. 3.1 What is a Set?

LOGIC AND DISCRETE MATHEMATICS

Lecture 19 Thursday, March 29. Examples of isomorphic, and non-isomorphic graphs will be given in class.

LTCS Report. Concept Descriptions with Set Constraints and Cardinality Constraints. Franz Baader. LTCS-Report 17-02

DM841 DISCRETE OPTIMIZATION. Part 2 Heuristics. Satisfiability. Marco Chiarandini

The Inverse of a Schema Mapping

CS 125 Section #10 Midterm 2 Review 11/5/14

Chapter 3. Describing Syntax and Semantics

[Ch 6] Set Theory. 1. Basic Concepts and Definitions. 400 lecture note #4. 1) Basics

1 The Traveling Salesperson Problem (TSP)

Cardinality of Sets. Washington University Math Circle 10/30/2016

Propositional Calculus: Boolean Algebra and Simplification. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

Typed Lambda Calculus

PROPOSITIONAL LOGIC (2)

Horn Formulae. CS124 Course Notes 8 Spring 2018

Propositional Theories are Strongly Equivalent to Logic Programs

SAT Solver. CS 680 Formal Methods Jeremy Johnson

Name: CS 341 Practice Final Exam. 1 a 20 b 20 c 20 d 20 e 20 f 20 g Total 207

15-819M: Data, Code, Decisions

Chapter 1. Preliminaries

Transcription:

CS 512, Spring 2017: Take-Home End-of-Term Examination Out: Tuesday, 9 May 2017, 12:00 noon Due: Wednesday, 10 May 2017, by 11:59 am Turn in your solutions electronically, as a single PDF file, by placing it in the subfolder End-of-Term Exam of the Dropbox folder CS512-Assignments-2017. The solution scribe and grader for the End-of-Term Exam is: Assaf Kfoury (kfoury@bu.edu). The parts shaded in light blue are the questions you have to solve. Problem 1 In this problem, every WFF ϕ is a propositional WFF in CNF: ϕ C 1 C n where n 1 and every clause C i is a disjunction of finitely many literals. All literals are propositional variables or negated propositional variables in the set X {x 1,..., x p } for some p 1. We assume that every clause C i contains at least one literal. Relative to a propositional WFF ϕ as defined above, two optimization versions of the SAT problem are: 1 MaxSAT: Determine a truth assignment σ that maximizes the size of a subset C {C 1,..., C n } such that σ simultaneously satisfies C and falsifies {C 1,..., C n } C. MinSAT: Determine a truth assignment σ that minimizes the size of a subset C {C 1,..., C n } such that σ simultaneously satisfies C and falsifies {C 1,..., C n } C. These two problems are often restricted by the size k 1 of the clauses in ϕ: The restrictions k-maxsat and k-minsat result from requiring that each clause C i has at most k literals. Example. The following α is a propositional WFF in CNF, over the variables {x 1, x 2, x 3 }, with 5 clauses: α ( x 1 ) ( x }{{} 1 x 2 ) ( x }{{} 2 ) (x }{{} 3 ) (x }{{} 1 ) }{{} C 1 C 2 C 3 C 4 Because the clauses in α have each at most 2 literals, α can be an input instance for 2-MaxSAT and 2-MinSAT. Below is a list of all possible solutions for the two problems: Only one possible solution for 2-MaxSAT: false if x = x 1, σ 1 (x) false if x = x 2, true if x = x 3, which simultaneously satisfies the clauses {C 1, C 2, C 3, C 4 } and falsifies {C 5 }. It is not possible to simultaneously satisfy all of the 5 clauses. 1 We give here the simplest formulations of these two problems. In the literature, you will find formulations that are more involved, which qualify these problems as partial and/or weighted. C 5 1

Three possible solutions for 2-MinSAT: true if x = x 1, σ 2,1 (x) false if x = x 2, false if x = x 3, false if x = x 1, σ 2,2 (x) true if x = x 2, false if x = x 3. true if x = x 1, σ 2,3 (x) true if x = x 2, false if x = x 3. σ 2,1 simultaneously satisfies {C 3, C 5 } and falsifies {C 1, C 2, C 4 }; σ 2,2 simultaneously satisfies {C 1, C 2 } and falsifies {C 3, C 4, C 5 }; and σ 2,3 simultaneously satisfies {C 2, C 5 } and falsifies {C 1, C 3, C 4 }. There is no truth assignment σ which satisfies less than two clauses in {C 1, C 2, C 3, C 4, C 5 } and falsifies the remaining clauses. For another example, try on your own α C 1 C 2 C 3 C 4 C 5 where C 5 = x 1 (i.e., C 5 is the same as C 1 ). For α, you should find that it is possible to simultaneously satisfy all the clauses in {C 1, C 2, C 3, C 4, C 5 } and falsify none, for a solution of 2-MaxSAT; and you should find that it is possible to simultaneously satisfy exactly one clause in {C 1, C 2, C 3, C 4, C 5 } and falsify the remaining four, for a solution of 2-MinSAT In all parts below you can assume that, together with a propositional WFF ϕ, the input includes two numbers: n (the number of clauses in ϕ) and p (the number of variables in ϕ). Keep in mind that SAT is a decision problem, whereas MaxSAT and MinSAT are optimization problems. In parts (a) and (b), the requested algorithms must be efficient in the sense that they produce an optimal solution by scanning an input ϕ only once (from left to right). (a) Define precisely (in plain English) the steps of an efficient algorithm for 1-MaxSAT. Hint: Compare the number of occurrencs of the literal x i and the number of occurrences of the literal x i in ϕ. (b) Define precisely (in plain English) the steps of an efficient algorithm for 1-MinSAT. Hint: Do part (a) before part (b). (c) Suppose you are given an efficient algorithm A MaxSAT for the MaxSAT problem. Define precisely (in plain English) the steps of an efficient algorithm for SAT that uses A MaxSAT. 2 For part (d) we need a few preliminary notions. Every truth assignment σ : X {true, false} induces a two-block partition of the clauses {C 1,..., C n } of a propositional WFF ϕ C 1 C n in CNF: the block of true clauses w.r.t. σ, which is defined by block(ϕ, σ, true) { C i σ(c i ) = true }, the block of false clauses w.r.t. σ, which is defined by block(ϕ, σ, false) { C j σ(c j ) = false }. 2 If you took a course on algorithms or computational complexity, part (c) asserts that: SAT is reducible to MaxSAT. 2

We write block(ϕ, σ, true) and block(ϕ, σ, false) to denote the number of clauses in block(ϕ, σ, true) and block(ϕ, σ, false), respectively. The two-block partition of {C 1,..., C n } w.r.t. σ is defined by: partition(ϕ, σ) ( block(ϕ, σ, true), block(ϕ, σ, false) ) and its index is a pair of natural numbers defined by: ( index partition(ϕ, σ) ) ( ) block(ϕ, σ, true), block(ϕ, σ, false) We allow one of the two blocks in partition(ϕ, σ) to be the empty set. Given two pairs of natural numbers (a 1, b 1 ) and (a 2, b 2 ), we write (a 1, b 1 ) (a 2, b 2 ) iff: a 1 < a 2 or (a 1 = a 2 and b 1 b 2 ) which is the usual lexicographic ordering of pairs of numbers. Below we define an algorithm call it A 2-MinSAT to solve 2-MinSAT when the input ϕ C 1 C n satisfies three restrictions: (i) Every variable in X {x 1,..., x p } appears in ϕ. (ii) There are no pure literals in ϕ, i.e., for every variable x j X, it must be that both the literal x j and the literal x j appear in ϕ. (iii) If a clause C i is a disjunction of two literals, say C i (l i l i ), then there is no x j X such that {l i, l i } = {x j, x j }. In the example above, α satisfies (i) and (iii) but not (ii), because variable x 3 appears as a pure literal in α. Algorithm A 2-MinSAT is defined as follows: A 2-MinSAT 1. input: ϕ C 1 C n over variables X {x 1,..., x p } satisfying {(i), (ii), (iii)}. 2. Enumerate all the truth assignments σ : X {true, false} in some fixed order. There are 2 p such assignments, which we denote σ 1,..., σ 2 p. 3. Compute (q, r) := min { index ( partition(ϕ, σ i ) ) 1 i 2 p }. 4. σ := the first assignment σ i in the list σ 1,..., σ 2 p such that index ( partition(ϕ, σ i ) ) = (q, r). 5. output: σ. (d) Assume that A 2-MinSAT is correct (you are not asked to prove its correctness, though it is useful that you understand why A 2-MinSAT is correct before you answer this question). (e) 1. If the input ϕ does not satisfy (ii) or (iii) or both, does A 2-MinSAT still return a correct output? If yes, give a reason. If no, give a counter-example. 2. Propose adjustments in A 2-MinSAT so that the resulting algorithm A 2-MinSAT is more efficient. Hint: Your proposed adjustments need not be more than two or three new instructions in A 2-MinSAT. 3 Identify two real-world applications of formal modeling, one for MaxSAT and one for MinSAT. Hint: You can identify your own real-world applications, if you want, but it is much easier to search the Web and give a good answer for part (e) in at most 3-5 lines. You need to give the URL of an appropriate website and/or a reference to an appropriate article for each of your two applications. 3 As now written, A 2-MinSAT runs in time exponential in the size of the input ϕ in the worst case. 2-MinSAT is known to be an NP-hard problem. Hence, there is not much hope in reducing this time complexity of A 2-MinSAT down to polynomial time. Nevertheless, there are adjustments that will make it more efficient. 3

Problem 2 This is a problem about first-order modeling. Let ϕ be an arbitrary first-order sentence over some signature Σ. If M is a Σ-structure with a single domain/universe M, then we write M to denote the cardinality of M. The spectrum(ϕ) is the set of cardinalities of finite Σ-structures satisfying ϕ: spectrum(ϕ) { n N n = M for some Σ-structure M s.t. M = ϕ } Important note: spectrum(ϕ) excludes the cardinalities of infinite Σ-structures satisfying ϕ. (a) (b) Write a first-order sentence ϕ even such that spectrum(ϕ even ) is the set of all even positive integers. Hint: You can choose the signature of ϕ even in any way that will simplify your task. Write a first-order sentence ϕ odd such that spectrum(ϕ odd ) is the set of all odd positive integers. Hint: You will find it easier to start with part (a) before attempting this part (b). In the rest of this problem, we assume the signature Σ contains only binary relation symbols. You can use. an additional binary relation symbol =, which is implicitly in Σ and always interpreted as equality. If Σ contains only one binary relation symbol R, then Σ is the signature of structures that are graphs G = (V, E). In such a graph G, V is the domain (its vertices) and E V V is the binary predicate describing its edges. (c) Let ϕ be a first-order sentence over signature Σ = {R}, the signature of graphs. Is there an algorithm to decide whether an arbitrary n N is in spectrum(ϕ)? If yes, define precisely (in plain English) the steps of the requested algorithm. If no, define precisely (in plain English) a counter-example showing that there cannot be any such algorithm. (d) Let ϕ 1 and ϕ 2 be two first-order sentences over signature Σ = {R}, and let S 1 = spectrum(ϕ 1 ) and S 2 = spectrum(ϕ 2 ). If A, B N, we define A + B as the set { m + n m A and n B }. 1. Show there is a first-order sentence ψ 1 such that S 1 S 2 = spectrum(ψ 1 ). 2. Show there is a first-order sentence ψ 2 such that S 1 S 2 = spectrum(ψ 2 ). 3. Show there is a first-order sentence ψ 3 such that S 1 + S 2 = spectrum(ψ 3 ). Hint: The signature of the sentences ψ i may contain other binary relation symbols besides R (and, implicitly,. =). If G = (V, E) is an undirected graph, then (a, b) E iff (b, a) E for all distinct vertices a and b, and, by convention, (a, a) E (there are no self-loops). (e) Look up the definition of bipartite undirected graph from the Web (or any textbook on graphs). Write an infinite set Γ bipartite of first-order sentences such that, for every undirected graph G, it holds that G = Γ bipartite iff G is bipartite. Hint: G is bipartite iff every cycle in G (possibly with repeated vertices) has even length. 4

Problem 3 This problem is based on Handout 34 entitled, Program Schemes and First-Order Logic. Both the program P (on page 4 of Handout 34) and the corresponding program scheme S (on page 5) mention a precondition. In P, the precondition is x > 0 and y > 0 (not in the syntax of first-order logic, although precisely stated) which becomes, in S, the precondition R (x, c ) R (y, c ) (in the syntax of first-order logic). (a) What is missing from the specification of P and S are postconditions. An appropriate postcondition for program P is: n is the greatest common divisor of x and y. Write the corresponding postcondition for program scheme S over signature Σ = {R, lo, hi, f, c } with n, x, and y as free variables. The postcondition for S is a first-order WFF, possibly involving quantifiers, which is interpreted in the Σ-structure (N, <, min, max, mod, 0) with <, min, max, mod, and 0, being the interpretations of R, lo, hi, f, and c, respectively. Although. = is not explicitly mentioned in Σ, you can include it as a binary predicate symbol (in infix position) always interpreted as equality. (b) Do the exercise on page 18 of Handout 34. Hint: Read and understand pages 12-18 in the handout before attempting this exercise. The following is a variation on the definition of what it means for a set Φ of first-order WFF s to enforce totality of a program scheme (page 15 in Handout 34). Let S be a program scheme over the signature Σ and whose input variables are X = {x 1,..., x m }. Let C be a class of Σ-structures. Let Φ {ϕ 1, ϕ 2,...} be a set (possibly infinite) of first-order WFF s over signature Σ with FV(ϕ i ) {x 1,..., x m } for every i 1. We say that Φ enforces quasi-totality of program scheme S in the class C iff: there is finite set of k 1 execution paths {π 1,..., π k } in S such that, for every M C and every m-tuple a (a 1,..., a m ) from the domains of M, if (M, a) = Φ and S M ( a) converges, then execution of S M ( a) follows a path in {π 1,..., π k }. Intuitively, even though Paths(S) is an infinite set (if S is not trivial and therefore contains loops), all inputs (M, a) satisfying the conditions expressed by Φ will use only a finite number k of execution paths. What it means for a program scheme S to unwind in the class C is defined in Handout 34 (page 19). (c) Let S and Φ as in the preceding paragraph, and let C { M M = Φ }. Prove the assertion: Φ enforces quasi-totality of S in the class C iff S unwinds in the class C. Hint 1: This assertion is a double implication, which is therefore a stronger assertion than the single implication in Theorem 3 in Handout 34. Hint 2: Please do not fudge! Skip this part if you do not see your way through clearly. You can earn enough points from all other parts in this exam to do well. 5