SS 2017 Software Verification Automated Verification

Slides:



Advertisements
Similar presentations
Predicate Logic Colin Campbell. A Formal Language Predicate Logic provides a way to formalize natural language so that ambiguity is removed. Mathematical.
Advertisements

Completeness and Expressiveness
Brief Introduction to Logic. Outline Historical View Propositional Logic : Syntax Propositional Logic : Semantics Satisfiability Natural Deduction : Proofs.
Some important properties Lectures of Prof. Doron Peled, Bar Ilan University.
Hoare’s Correctness Triplets Dijkstra’s Predicate Transformers
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt.
Computability and Complexity 9-1 Computability and Complexity Andrei Bulatov Logic Reminder (Cnt’d)
Brief Introduction to Logic. Outline Historical View Propositional Logic : Syntax Propositional Logic : Semantics Satisfiability Natural Deduction : Proofs.
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.
1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is  satisfiable ? Example:  Let x 1,x 2 be propositional.
Deciding a Combination of Theories - Decision Procedure - Changki pswlab Combination of Theories Daniel Kroening, Ofer Strichman Presented by Changki.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Proof Systems KB |- Q iff there is a sequence of wffs D1,..., Dn such that Dn is Q and for each Di in the sequence: a) either Di is in KB or b) Di can.
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
1st-order Predicate Logic (FOL)
Pattern-directed inference systems
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
First Order Predicate Logic
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
Propositional Logic Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma Guadalajara
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Bertram Ludäscher Department of Computer Science & Engineering University of California, San Diego CSE-291: Ontologies in Data Integration.
CS6133 Software Specification and Verification
1/5/2016Hilbertův kalkul1 Lecture 12 Hilbert-like calculus.
1 First order theories (Chapter 1, Sections 1.4 – 1.5) From the slides for the book “Decision procedures” by D.Kroening and O.Strichman.
1 Reasoning with Infinite stable models Piero A. Bonatti presented by Axel Polleres (IJCAI 2001,
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer.
First-Order Logic Semantics Reading: Chapter 8, , FOL Syntax and Semantics read: FOL Knowledge Engineering read: FOL.
Lecture 041 Predicate Calculus Learning outcomes Students are able to: 1. Evaluate predicate 2. Translate predicate into human language and vice versa.
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
1 Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer.
COMP 412, FALL Type Systems C OMP 412 Rice University Houston, Texas Fall 2000 Copyright 2000, Robert Cartwright, all rights reserved. Students.
Chapter 7. Propositional and Predicate Logic
Introduction to Logic for Artificial Intelligence Lecture 2
SS 2017 Software Verification Bounded Model Checking, Outlook
CSE15 Discrete Mathematics 01/23/17
Knowledge Representation and Reasoning
Prof. Dr. Holger Schlingloff 1,2 Dr. Esteban Pavese 1
SS 2017 Software Verification LTL monitoring
The Propositional Calculus
SS 2017 Software Verification Software Model Checking 2 - Parallelism
SS 2018 Software Verification FOL to ML
Logics for Data and Knowledge Representation
Elementary Metamathematics
CS201: Data Structures and Discrete Mathematics I
SS 2018 Software Verification LTL Satisfiability applied
SS 2017 Software Verification CTL model checking, BDDs
SS 2018 Software Verification SAT & FOL
CSE 311 Foundations of Computing I
Logics for Data and Knowledge Representation
CSE 311: Foundations of Computing
Semantics In Text: Chapter 3.
1st-order Predicate Logic (FOL)
Back to “Serious” Topics…
MA/CSSE 474 More Math Review Theory of Computation
Logics for Data and Knowledge Representation
Automated Reasoning in Propositional Logic
Chapter 7. Propositional and Predicate Logic
Search techniques.
Chapter 1: Propositional and First-Order Logic
This Lecture Substitution model
CS201: Data Structures and Discrete Mathematics I
CS589 Principles of DB Systems Fall 2008 Lecture 4e: Logic (Model-theoretic view of a DB) Lois Delcambre
1st-order Predicate Logic (FOL)
Presentation transcript:

SS 2017 Software Verification Automated Verification Prof. Dr. Holger Schlingloff 1,2 Dr. Esteban Pavese 1 (1) Institut für Informatik der Humboldt Universität (2) Fraunhofer Institut für offene Kommunikationssysteme FOKUS

Some Questions for Recap What is a formal method? Can you give the syntax of propositional logic? Give a wff of PL of length at least 5! Translate the following into PL: ((pq)(pq)) What are the literals in the above formula? Can you describe the semantics of PL? What is the complexity of boolean satisfiability?

Propositional Calculus Various calculi have been proposed boolean satisfiability (SAT) algorithms tableau systems, natural deduction, enumeration of valid formulæ Hilbert-style axiom system ⊢ (()) (weakening) ⊢ ((()) (()())) (distribution) ⊢ (¬¬) (excluded middle) , () ⊢  (modus ponens) Derivability All substitution instances of axioms are derivable If all antecedents of a rule are derivable, so is the consequent

An Example Derivation Show ⊢ (pp) ⊢(p((pp)p))((p(pp))(pp)) (dis) ⊢(p((pp)p)) (wea) ⊢((p(pp))(pp)) (1,2,mp) ⊢(p(pp)) (wea) ⊢(pp) (3,4,mp)

Correctness and Completeness Only valid formulæ can be derived Induction on the length of the derivation Show that all axiom instances are valid, and that the consequent of (mp) is valid if both antecedents are Completeness: ⊨  ⊢ All valid formulæ can be derived Show that consistent formulæ are satisfiable ~⊢¬  ~⊨¬

Consistency and Satisfiability A finite set Φ of formulæ is consistent, if ~⊢¬ΛΦ Extension lemma: If Φ is a finite consistent set of formulæ and  is any formula, then Φ{} or Φ{¬} is consistent Assume ⊢¬(Φ) and ⊢¬(Φ¬). Then ⊢(Φ¬) and ⊢(Φ¬¬). Therefore ⊢¬Φ, a contradiction. Let SF() be the set of all subformulæ of  For any consistent , let # be a maximal consistent extension of  (i.e., # and for every SF(), either #or ¬#. (Existence guaranteed by extension lemma)

Canonical models For a maximal consistent set #, the canonical model CM(#) is defined by I(p)=true iff p#. Truth lemma: For any SF(), I()=true iff  # Case =p: by construction Case =: Φ{} cannot be consistent Case =(12): by induction hypothesis and derivation Therefore, if  is consistent, then for any maximal consistent set #, CM(#)⊨ any consistent formula is satisfiable any unsatisfiable formula is inconsistent any valid formula is derivable

Example: Combinational Circuits Pictures taken from: http://www.scs.ryerson.ca/~aabhari/cps213Chapter4.ppt Multiplexer S selects whether I0 or I1 is output to Y Y = if S then I1 else I0 end (Y((SI1)(¬SI0))) I0 I1 S Y 1

Boolean Specifications Evaluator (output is 1 if input matches a certain binary value) Encoder (output i is set if binary number i is on input lines) Majority function (output is 1 if half or more of the inputs are 1) Comparator (output is 1 if input0 > input1) Half-Adder, Full-Adder, …

Software Example Code generator optimization Loop optimization if (p and q) then if (r) then x else y else if (q or r) then y else if (p and not r) then x else y Loop optimization

Verification of Boolean Functions Latch-Up: can a certain line go up? does (¬L0) hold? is (L0) satisfiable? Given , ; does () hold? usually reduced to SAT: is ((¬)(¬)) satisfiable? efficient SAT-solver exist (annual competition) partitioning techniques any output depends only on some inputs find which ones generate test patterns (BIST: built-in-self-test)

Propositional Resolution A clause is a disjunction of literals Resolution rule: Given two clauses C1=(x1  ...  xn  p) (or (¬p  x1  ...  xn)) C2=(y1  ...  ym  ¬p) (or (p  y1  ...  yn)) infer C3=(x1  ...  xn  y1  ...  ym) If the empty clause is derivable, the set of clauses is unsatifiable ((x) = (x  ))

SAT Solving DPLL solvers backtracking-based resolution: let R be a set of clauses, p a proposition R = ((R  p)  (R  ¬p)) unit propagation: no backtracking necessary pure literal elimination: p only positive or only negative from wikipedia

Optimizing Boolean Functions Given ; find  such that () holds and  is „optimal“ much harder question optimal wrt. speed / size / power /… translation to normal form (e.g., OBDD)

Break!

Predicate Logic used to formalize mathematical reasoning dates back to Frege (1879) „Begriffsschrift“ „Eine der arithmetischen nachgebildete Formelsprache des reinen Denkens“ individuals, predicates (sets of individuals), relations (sets of pairs), ... quantification of statements (quantum = how much) all, none, at least one, at most one, some, most, many, ... need for variables to denote “arbitrary” objects In contrast to propositional logic, first-order logic adds structure to basic propositions quantification on (infinite) domains

FOL: Syntax New syntactic elements R is a set of relation symbols, where each pR has an arity nN0 V is a denumerable set of (first-order or individual) variables An atomic formula is p(x1,…,xn), where pR is n-ary and (x1,…,xn)Vn. Syntax of first-order logic FOL ::= R (Vn) |  | (FOL  FOL) | V FOL

FOL: Syntax Abbreviations and parenthesis as in PL Of course, x = ¬x ¬ Propositions = 0-ary relations Predicates = 1-ary relations if all predicates are propositions, then FOL = PL Examples xxx (p()  x(q()  p())) xxy ¬p(x) xy (p(x,y)  p(y,x)) (xy p(x,y)  yx p(x,y))

Typed FOL Often, types/sorts are used to differentiate domains Signature =(D, F, R), where D is a (finite) set of domain names F is a set of function symbols, where each fF has an arity nN0 and a type DDn+1 0-ary functions are called constants R is a set of relation symbols, where each pR has an arity nN0 and a type DDn unary relations are called predicates propositions can be seen as 0-ary relations Remark: domains and types are for ease of use only (can be simulated in an untyped setting by additional predicates)

Terms and Formulas Let again V be a (denumerable) set of (first-order) variables, where each variable has a type DD (written as x:D) (for any type, there is an unlimited supply of variables of that type) The notions Term and Atomic Formula AtF are defined recursively: each variable of type D is a term of type D if f is an n-ary function symbol of type (D1,…Dn,Dn+1) and t1, …, tn are terms of type D1, …, Dn, then f(t1,…,tn) is a term of type Dn+1 if p is an n-ary relation symbol of type (D1,…Dn) and t1, …, tn are terms of type D1, …, Dn, then p(t1,…,tn) is an atomic formula Revised syntax of first-order logic FOL ::= AtF |  | (FOL  FOL) | V:D FOL

Examples x:Boy y:Girl loves(x,y) x:Human y:Human (needs(x,y)  loves(y,x)) x,y:Int equals(plus(x,y), plus(y,x)) x:Int ¬equals(zero(), succ(x)) …

FOL: Models (We give the typed semantics only) First-Order Model Let a universe U be some nonempty set, and let DU  U for every DD be the domain of D Interpretation I: assignment F ↦ Un+1 R ↦ Un Valuation V: assignment V ↦ U interpretations and valuations must respect typing Model M: (U,I,V)

FOL: Semantics Given a model M: (U,I,V), the value tM of term t (of type D) can be defined inductively if t=xV, then tM=V(x) if t=f(t1,…,tn) , then tM=I(f)(t1M,…,tnM) Likewise, the validation relation ⊨ between model M and formula  M ⊨ p(t1,…,tn) if (t1M,…,tnM)I(p) M ⊭ ; M ⊨ () if M ⊨  implies M ⊨  M ⊨x if M‘ ⊨ for some M‘ which differs at most in V(x) from M Validity and satisfiability is defined as in the propositional case

Examples ⊨ x  x  ⊨ x   x   x (  ) ⊨ x y   y x  ⊨ x   (x:=t) If ⊨ , then ⊨ x 

FOL: Calculus A sound and complete axiom system for FOL: all substitution instances of axioms of PL modus ponens: , () ⊢  ⊢((x:=t)x) instantiation () ⊢(x) if x doesn‘t occur in  particularization Relaxation: particularization may be applied if there is no free occurrence of x in ; i.e., x may occur in  inside the scope of a quantification

FOL: Completeness As in the propositional case, correctness is easy (⊢  ⊨, “every derivable formula is valid”) Completeness (⊨  ⊢, “every valid formula is derivable”) follows with a similar proof as previously: given a consistent formula, construct a model satisfying it ~⊢¬  ~⊨¬ Extension lemma: If Φ is a finite consistent set of formulæ and  is any formula, then Φ{} or Φ{¬} is consistent Needs additionally: If Φ is any consistent set of formulæ and x is a formula in Φ, then Φ{(t)} is consistent for any term t From this, a canonical model can be constructed as before

Example Consider the formula xyz ((p(x, y) ∧ p(y, z)) → p(x, z)) ∧ x ¬p(x, x) ∧ x p(x, f(x) ) This formula is satifiable only in infinite models