Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Class 6: SAT

David Evans
September 08, 2016

Class 6: SAT

cs2102: Discrete Mathematics
University of Virginia, Fall 2016

See course site for notes:
https://uvacs2102.github.io

David Evans

September 08, 2016
Tweet

More Decks by David Evans

Other Decks in Science

Transcript

  1. Converting to CNF ⟹ T T T T F F

    F T T F F T The result is T iff the inputs do not match any row where the output is F. The inputs do not match a row, if any one of them does not match the input on that row.
  2. Satisfiability Definition. A formula is in 3SAT if it is

    in 3CNF form and it is satisfiable.
  3. Satisfiability Definition. A formula is in 3SAT if it is

    in 3CNF form and it is satisfiable. Is this formula in 3SAT?
  4. Satisfiability Definition. A formula is in 3SAT if it is

    in 3CNF form and it is satisfiable. Is this formula in 3SAT?
  5. Magic 3SAT Box 3SAT Input Formula T if ∈ 3SAT,

    F otherwise Note: “magic box” ≈ “algorithm”
  6. Defining a Problem A problem is defined by: – A

    precise description of a set of inputs – A statement of the property the output must have A machine solves a problem if for every input it eventually produces a satisfactory output.
  7. Problems and Algorithms problem: set of possible inputs and desired

    property of output. procedure: precise description of an information process. algorithm: a procedure that solves a problem. To solve a problem, an algorithm must (eventually) produce the correct output for any problem input. program: description of a procedure that can be executed by a computer.
  8. 3SAT Decision Problem Input: logical formula in 3CNF form (in

    some representation) Output: True iff the formula has some satisfying assignment, otherwise False.
  9. SAT Assignment Problem Input: logical formula in 3CNF form (in

    some representation) Output: satisfying variable assignments that make the formula True if the formula has some satisfying assignment, otherwise “Not Satisfiable”.
  10. Finding the Satisfying Assignment 3SAT Input Formula T if ∈

    3SAT, F otherwise Can we use the 3SAT box to find a satisfying assignment?
  11. def solve(f): vars = variables in f if vars.empty(): done

    else: = vars.choose() # choose a variable in f if 3SAT( ∧ ): = True solve(f with all occurrences of replaced by T) else: = False solve(f with all occurrences of replaced by F)
  12. Charge • PS2 Due Friday (6:29pm) • Next week: –

    Building SAT Solvers – (Mathematical) Data Types • Sets, Functions – Read MCS Chapter 4