Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 3341.03 Winter 2008 Introduction to Program Verification January 29 how wang works.

Similar presentations


Presentation on theme: "CSE 3341.03 Winter 2008 Introduction to Program Verification January 29 how wang works."— Presentation transcript:

1 CSE 3341.03 Winter 2008 Introduction to Program Verification January 29 how wang works

2 Wang's algorithm: overview wang program checks proposition containing non-logical terms by checking and transforming the sequent constructed from the input input: true, false, arbitrary terms, logical operators no semantic (upper-case)variables; syntactic variables: terms with arity 0 e. g. x, a23, etc.

3 Wang's algorithm strictly syntactic tautology used a semantic approach bound truth-values to variables wang uses equivalence-preserving rewrite rules to transform sequents If S1 transforms to S2 then (S1 iff S2). so if S2 is a tautology, S1 is also

4 algorithm has the typical structure of a rules-based algorithm flow-of-control is implicit determined by the input data iterates until no rule applies notice that unlike tautology, wang is biased toward truth rather falsity shortcuts if tautology criterion is met tautology shortcuts if falsifiabilty criterion is met Why is "bias toward truth" better?

5 example rewrite rule for sequents Replace a sequent with a conjunction on the right-hand side by two copies in which the conjunction is replaced by each of its conjuncts: {.. } >> {P and Q,.. } is rewritten as {.. } >> {P,.. } and {.. } >> {Q,.. }. The propositional form of this rule is: (R implies (P and Q) or S) iff ((R implies P or S) and (R implies Q or S))

6 correctness of the algorithm why is termination guaranteed? why is the algorithm correct ? I. e., why does computing a valid/invalid sequent guarantee that the input proposition is valid or invalid?

7 how to make a counter-example? suppose input is not a tautology: how can we construct a counter-example? examples: |: p and q and r implies not p or w. Counterexample: each of [r, q, p] is true and w is false. * Not valid. |: p implies p implies q. ?

8 verifying wang's rules We can use tautology to prove the rules are right (assuming tautology is correctly programmed) just need to know how to recode the rules into propositional formulae. Exercises 3.5, 3.7

9 worst-case running time? tautologies are the worst case for the tautology program: 2 n steps for n variables what's the worst case for wang? A implies P 1 and... P m we get m sequents of the form {A} >> {P i } each of which can split into more so we could get exponential growth in sequents as m increases ("Sorcerer's Apprentice")

10 bi-conditionals long bi-conditional propositions are stressful for both wang and tautology tautology: large number of variables time is exponential in # of variables wang: large number of sequent splits all sequents must be tested, and # of sequents is exponential but there is a simple linear algorithm! p. 33

11 How hard is it to check tautologies? measure difficulty of a problem in terms of time complexity (generalize over all algorithms that solve the problem) complexity = time or space function which ultimately bounds running time or space used, for all inputs take time-complexity to be some function of length of input

12 complexity categories: easy: polynomial time hard: polynomial time on unbounded # of parallel processors intractable: worse than polynomial time even with unbounded parallelism

13 is tautology checking intractable, hard, or easy? the two algorithms we’ve looked at suggest that tautology checking, using those algorithms, is not easy worst-case is exponential on a deterministic processor but still could be tractable we don’t know the complexity of tautology-checking

14 Is satisfiability easy? easy = there is a method with polynomial time on a single processor. Perhaps not: tautology checking might have complexity O(2 N) on a single processor as suggested by truth-table method. But does Wang's method ever require O(2 N) ? (not always — but we can't show that it never does.) No one knows. Famous result (Steve Cook, U of T, 1970): Satisfiability is tractable

15 satisifiability is "NP-complete" Cook's famous theorem: all tractable yes- no problems can be expressed as satisfiability questions! so if satisfiability is easy, all tractable problems are easy! key unsolved problem: is class of P(easy) problems =class of NP(tractable problems)?


Download ppt "CSE 3341.03 Winter 2008 Introduction to Program Verification January 29 how wang works."

Similar presentations


Ads by Google