CSE 3341.03 Winter 2008 Introduction to Program Verification January 31 proofs through simplification.

Slides:



Advertisements
Similar presentations
Introduction to Proofs
Advertisements

PROOF BY CONTRADICTION
Prof. Shachar Lovett Clicker frequency: CA CSE 20 Discrete math Prof. Shachar Lovett
February 26, 2015Applied Discrete Mathematics Week 5: Mathematical Reasoning 1 Addition of Integers Example: Add a = (1110) 2 and b = (1011) 2. a 0 + b.
Types of Logic Circuits
Chapter 2 Logic Circuits.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
Logic Use mathematical deduction to derive new knowledge.
CSE Winter 2008 Introduction to Program Verification January 24 tautology checking, take 2.
Lecture 2 Dr Richard Reilly Dept. of Electronic & Electrical Engineering Room 153, Engineering Building To insert your company logo on this slide From.
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
From Chapter 4 Formal Specification using Z David Lightfoot
Knoweldge Representation & Reasoning
Let remember from the previous lesson what is Knowledge representation
Proofs, Recursion and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2.1 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProofs,
Proof by Deduction. Deductions and Formal Proofs A deduction is a sequence of logic statements, each of which is known or assumed to be true A formal.
No new reading for Monday or Wednesday Exam #2 is next Friday, and we’ll review and work on proofs on Monday and Wed.
Mathematical Induction Assume that we are given an infinite supply of stamps of two different denominations, 3 cents and and 5 cents. Prove using mathematical.
First Order Logic. This Lecture Last time we talked about propositional logic, a logic on simple statements. This time we will talk about first order.
Propositional Logic Reasoning correctly computationally Chapter 7 or 8.
February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 1 Addition of Integers How do we (humans) add two integers? Example: 7583.
Inference is a process of building a proof of a sentence, or put it differently inference is an implementation of the entailment relation between sentences.
© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.
Introduction to Proofs
CSE 311: Foundations of Computing Fall 2013 Lecture 8: More Proofs.
DECIDABILITY OF PRESBURGER ARITHMETIC USING FINITE AUTOMATA Presented by : Shubha Jain Reference : Paper by Alexandre Boudet and Hubert Comon.
Review I Rosen , 3.1 Know your definitions!
CSE Winter 2008 Introduction to Program Verification January 29 how wang works.
1 Inference Rules and Proofs (Z); Program Specification and Verification Inference Rules and Proofs (Z); Program Specification and Verification.
Pattern-directed inference systems
Propositional Logic Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma Guadalajara
Mathematical Induction I Lecture 4: Sep 16. This Lecture Last time we have discussed different proof techniques. This time we will focus on probably the.
1 Lecture 6 BOOLEAN ALGEBRA and GATES Building a 32 bit processor PH 3: B.1-B.5.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Activity 1-19: The Propositional Calculus
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
1 Introduction to Abstract Mathematics Chapter 2: The Logic of Quantified Statements. Predicate Calculus Instructor: Hayk Melikya 2.3.
Great Theoretical Ideas in Computer Science.
CS6133 Software Specification and Verification
CSE Winter 2008 Introduction to Program Verification January 15 tautology checking.
Artificial Intelligence 7. Making Deductive Inferences Course V231 Department of Computing Imperial College, London Jeremy Gow.
First Order Logic Lecture 3: Sep 13 (chapter 2 of the book)
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Top-down Parsing. 2 Parsing Techniques Top-down parsers (LL(1), recursive descent) Start at the root of the parse tree and grow toward leaves Pick a production.
11 Artificial Intelligence CS 165A Thursday, October 25, 2007  Knowledge and reasoning (Ch 7) Propositional logic 1.
CSE Winter 2008 Introduction to Program Verification January 8 Boolean operators.
Static Techniques for V&V. Hierarchy of V&V techniques Static Analysis V&V Dynamic Techniques Model Checking Simulation Symbolic Execution Testing Informal.
CSE Winter 2008 Introduction to Program Verification for-loops; review.
CS104:Discrete Structures Chapter 2: Proof Techniques.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 2 Context-Free Languages Some slides are in courtesy.
1 Introduction to Abstract Mathematics Proof Methods , , ~, ,  Instructor: Hayk Melikya Purpose of Section:Most theorems in mathematics.
CSE Winter 2008 Introduction to Program Verification February 5 calculating with simplify.
Foundations of Discrete Mathematics Chapter 1 By Dr. Dalia M. Gil, Ph.D.
Metalogic Soundness and Completeness. Two Notions of Logical Consequence Validity: If the premises are true, then the conclusion must be true. Provability:
COMP 412, FALL Type Systems C OMP 412 Rice University Houston, Texas Fall 2000 Copyright 2000, Robert Cartwright, all rights reserved. Students.
Artificial Intelligence Logical Agents Chapter 7.
Certifying and Synthesizing Membership Equational Proofs Patrick Lincoln (SRI) joint work with Steven Eker (SRI), Jose Meseguer (Urbana) and Grigore Rosu.
Fundamentals of Logic Design, 7 th editionRoth/Kinney © 2014 Cengage Learning Engineering. All Rights Reserved. 1 Boolean Algebra (continued) UNIT 3.
tautology checking continued
CHAPTER 2 Boolean Algebra
Mathematics for Computing
Great Theoretical Ideas in Computer Science
Elementary Metamathematics
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
Computer Security: Art and Science, 2nd Edition
Dr. Clincy Professor of CS
This Lecture Substitution model
Foundations of Discrete Mathematics
Concepts of Computation
Presentation transcript:

CSE Winter 2008 Introduction to Program Verification January 31 proofs through simplification

propositions and proofs they’re different animals "P implies Q" is not the same thing as "from P infer/deduce Q" rules of inference are different from tautologies, but in prop. logic, they’re closely related tautologies always have proofs. Why? example: truth-table = proof from a list of 2 n cases. messy from human point of view but perfectly effective as a logic tool

3.7 The "Deduction Theorem" if P implies Q is a tautology, then Q can be proved from the assumption that P is true. (To prove this rigorously, we would need to formalize concept of proof.) Idea: look at all rows of the truth table for which P is true. Informally, saying that Q can be proved from P just means that Q can be shown (calculated) to be true in all these rows.

the converse if Q has a (valid) proof, given P, then if P is true, Q can't be false, so P implies Q is a tautology. (this follows from the definition of valid proof)

getting a proof from wang? implement a trace feature: sequence of logically equivalent sequents, terminating in an overlap = true, or not = false. use the fact that the rewrite rules are logical equivalences but if wang is working correctly, a derivation is not very useful: like intermediate steps in a multiplication. We don't need to check them if we trust the algorithm.

preprocess wang input use simplification to prepare input for Wang's algorithm, in the hope that what we want proved becomes a tautology example from SVT: x > 0 implies a+a = 2*a. simplification uses mathematical theory of + to simplify a+a to 2*a, and logic to simplify 2*a = 2*a to true up to us to find an appropriate theory

simplification adds semantics to logic simplification = mechanism for taking meanings of terms into account simplification rules are used to represent mathematical knowledge ("truths") mathematical truths are relative to a system of axioms and inference rules

axioms and inference rules determine what the symbols mean (in that system) typically, mathematical and logical truths are representable by equations: a+a = 2*a, where a is an integer (P implies true ) = true where P is a proposition.

truths as equations in general: mathematical truth is an equation you learned in school, or a mathematical 'fact' from a book something you or someone else has proved something assumed to be true (0-length proof) = axiom to use these ‘facts’, axioms, etc., we put them into the form of equations, and give them an orientation. cf. 4.1: what makes a valid rule

given the “theory” X - X = 0 X + 0 = X X = X is true then a + (a - a) = a simplifies to true. note how the theory implicitly specifies the meaning of the functors

simplification shortens expressions eliminate redundancy from mathematical expressions x + 0 = x 1 + x + 1 = x + 2 use it also to eliminate redundancies from logical descriptions A and A = A

"x < 0 and x <= 0" doesn't say any more than "x < 0" what lets us simplify this to x < 0? the general logical equation A and (A or B) = A i. e., A and (A or B) iff A is a tautology together with a mathematical "truth" (here a definition): ? (notice that definition rules don't simplify (shorten))

theory files theory files = collection of rules = "programs" for the simplify "interpreter" available in /cs/course/3341 example: equality.simp max(A,C) = C ->> A > C > X > X > X > true. X = Y and X > X = Y.

variables Note the difference between rule (pattern) variables and mathematical variables we use lower case for mathematical variables upper case for pattern or rule variables these match arbitrary terms in the input suppose we had a rule X/X ->> 1. 2+(x > 3 ??

why individual theory files? theory files in /cs/course/3341 arithmetic.simp, equality.simp, logic.simp why not have one huge theory file covering everything? same advantage as modules in constructing a program e. g., the theory of ‘+’ is independent of the theory of stacks

implementing simplification simplification means finding a simplification rule whose left-side matches the structure of some sub-term and then rewriting (replace match with right-side of rule) then repeat this until no rule applies. usually, simplification makes an expression shorter, but for definitions, we want expansion A > A < B and B < C.

the algorithm simplify(Expr) = Result if path_arg(Path, Expr) = Lhs, % (there is a path in Expr to the sub-expression LHS) and Lhs ->> Rhs, and Modified = change_path_arg(Path, Expr, Rhs), and Result = simplify(Modified) otherwise simplify(Expr) = Expr.

entering rules How do we get the ->> rules into this algorithm? enter from the terminal or from a file. simplify supplements rewrite rules with special code for arithmetic expressions

arithmetic problems some operators are commutative : X + Y = Y + X (but not X**Y = Y**X) simplify to canonical form to detect identity: let x + y ->> y + x then given Y + X - X ->> Y, x + y - x ->> y

canonical form suppose you had to handle date calculation in a variety of formats: February 1, 2007, Feb 1 07, 1/2/2007 (Can.) 2/1/2007 (US) etc. use canonical form for date calculation example: seconds after Jan 1, canonical form allows us to recognize equivalences between terms with the same commutative functors

associativity difference between syntactic associativity and semantic associativity semantic: X op (Y op Z) = (X op Y) op Z syntactic: (left) X op Y op Z = (X op Y) op Z (right) X op Y op Z = X op (Y op Z) simplification algorithm chooses left associativity as a canonical form (if term is not parenthesized)

simplifying with canonical forms if A op ( B op C) = (A op B) op C) pick one as a canonical form create an additional rule for the other case. canonical forms for relations and their converses what’s the converse of a relation? what's the converse of >= ? simplify x >= y ->> y <=x. x > y ->> y < x.

cancellation cancellation: rewrite rules don't do this easily current version of simplify: a + b + c a ->>.. c+b and a - b - c + b ->> a - c but a - b - c - a ->> a - b - c - a a - b - a - c ->> a - b - a- c