rec13 - Logic for Formal Verification Propositional logic...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Logic for Formal Verification Propositional logic Predicate logic Propositional Logic Introduction Propositions Semantics of propositions Tautologies Inference rules Natural deduction An example proof derivation Introduction Can we prove that a program works for all possible inputs. In principle, yes. In practice, this approach is too time-consuming to be applied to large programs. However, it is useful to look at how proofs of correctness can be constructed: For short code that absolutely has to work, proofs of correctness are very useful. Automatic theorem provers continue to improve, and proving correctness is becoming increasingly cost-effective. Understanding what it means to prove a program correct helps make you a better programmer. What is a proof? A completely convincing argument that something is true. For an argument to be completely convincing, it should be made up of small steps, each of which is obviously true. In fact, each step should be so simple and obvious that we could build a computer program to check the proof. Two ingredients are required: 1. A language for clearly expressing what we want to prove. 2. Rules for building up an argument in steps that are obviously correct. A logic accomplishes these two goals. The strategy for proving programs correct will be to convert programs and their specifications into a purely logical statement that is either true or false. If the statement is true, then the program is correct. But for our proofs to be truly convincing, we need a clear understanding of what a proof is. Curiously, mathematicians did not really study the proofs that they were constructing until the 20th century. Once they did, they discovered that logic itself was a deep topic with many implications for the rest of mathematics.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Propositions We start with propositional logic , which is a logic built up from simple symbols representing propositions about some world. For our example, we will use the letters A, B, C, . .. as propositional symbols. For example, these symbols might stand for various propositions: A = "got 90% on the final" B = "attended class every time" C = "got an A in the class" D = "x + 1 ≤ y" E = "e s" It is not the job of propositional logic to assign meanings to these symbols. However, we use statements to the meanings of D and E to talk about the correctness of programs. Syntax of Propositions We define a grammar for propositions built up from these symbols. We use the letters P, Q, R to represent propositions (or formulas ): P,Q,R ::= (* true *) | (* false *) | A, B, C (* propositional symbols *) | ¬P (* sugar for P *) ⇒⊥ | P Q (* "P and Q" (conjunction) *) | P Q (* "P or Q" (disjunction) *) | P Q (* "P implies Q" (implication) *) Note: On some browsers, on some operating systems, in some fonts, the symbol for conjunction (and) is rendered incorrectly as a small circle. It should look like an upside-down V. In this document, it will appear
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/25/2009 for the course PHYS 2214 at Cornell.

Page1 / 12

rec13 - Logic for Formal Verification Propositional logic...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online