5.1.2012 Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.

Slides:



Advertisements
Similar presentations
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
Advertisements

Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Equivalence, Order, and Inductive Proof
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
Basic Properties of Relations
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt.
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.
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.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.
Discrete Structures Chapter 5 Relations Nurul Amelina Nasharuddin Multimedia Department.
Information Security of Embedded Systems : Public Key Cryptosystems, Communication Prof. Dr. Holger Schlingloff Institut für Informatik und Fraunhofer.
Software Verification Bertrand Meyer Chair of Software Engineering Lecture 2: Axiomatic semantics.
Reflexive -- First sentence of proof is: (1) Let x  Z (2) Let (x,x)  R. (3) Let (x,x)  I (4) Let x  R.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Relations Chapter 9.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
CSE 311: Foundations of Computing Fall 2013 Lecture 8: More Proofs.
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
Chapter 9. Chapter Summary Relations and Their Properties Representing Relations Equivalence Relations Partial Orderings.
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
CSE 311 Foundations of Computing I Lecture 8 Proofs and Set Theory Spring
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Discrete Math for CS Binary Relation: A binary relation between sets A and B is a subset of the Cartesian Product A x B. If A = B we say that the relation.
Methods of Proof Lecture 3: Sep 9. This Lecture Now we have learnt the basics in logic. We are going to apply the logical rules in proving mathematical.
Formal Semantics of Programming Languages 虞慧群 Topic 3: Principles of Induction.
Chapter 9. Section 9.1 Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Mathematical Induction
Reading and Writing Mathematical Proofs Spring 2015 Lecture 4: Beyond Basic Induction.
Recursive Algorithms &
Relations, Functions, and Countability
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Sets 2/10/121. What is a Set? Informally, a collection of objects, determined by its members, treated as a single mathematical object Not a real definition:
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
1 Section 4.3 Order Relations A binary relation is an partial order if it transitive and antisymmetric. If R is a partial order over the set S, we also.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer.
CSE 311: Foundations of Computing Fall 2013 Lecture 8: Proofs and Set theory.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Chap. 7 Relations: The Second Time Around
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
CSE 311 Foundations of Computing I Lecture 8 Proofs Autumn 2011 CSE 3111.
CSE 311 Foundations of Computing I Lecture 8 Proofs Autumn 2012 CSE
1 Formal Proofs. 2 Deductive Proofs From the given statement(s) to a conclusion statement (what we want to prove) Logical progression by direct implications.
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer.
1 CMSC 250 Discrete Structures CMSC 250 Lecture 41 May 7, 2008.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Section 9.1. Section Summary Relations and Functions Properties of Relations Reflexive Relations Symmetric and Antisymmetric Relations Transitive Relations.
Lecture 7: Relations Dr Andrew Purkiss-Trew Cancer Research UK Mathematics for Computing.
Relations Chapter 9 Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill.
CSE15 Discrete Mathematics 04/12/17
Relations Chapter 9.
Software Verification 2 Automated Verification
SS 2017 Software Verification Software Model Checking 2 - Parallelism
Formal Methods in Software Engineering 1
SS 2018 Software Verification LTL Satisfiability applied
Software Verification 2 Automated Verification
Software Verification 2 Automated Verification
Presentation transcript:

Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut für Rechnerarchitektur und Softwaretechnik

Folie 2 H. Schlingloff, Software Verification I Where are we? Einführung Aussagenlogik Prädikatenlogik einfache Funktionskontrakte Schleifeninvarianten und Terminierung Prädikate und logische Funktionen Spezifikation von Datentypen Parallele Programme, Deadlocks, Livelocks Objektorientierte Programme

Folie 3 H. Schlingloff, Software Verification I Termination Hoare-Tripel: {  }  {  } if  holds before the execution of , then  holds afterwards (1) ⊢ {Τ} skip {Τ}(skip) (2) ⊢ {Τ  Τ} skip {Τ}(1, imp1) (3) ⊢ {Τ} while (Τ) skip {Τ   }(2,whi) (4) ⊢ {Τ} while (Τ) skip {  }(3, imp2) I.e., if T holds before the execution of while (Τ) skip, then  holds afterwards I.e., after the execution of while (Τ) skip anything holds

Folie 4 H. Schlingloff, Software Verification I {T}  {  }: if  terminates, then  holds afterwards Hoare logic incapable of formulating statements about termination Total correctness of  with respect to  :  {T}  {  }   terminates Notation    Clearly, if  contains no loops, then {  }  {  } implies    How to prove termination of loops?

Folie 5 H. Schlingloff, Software Verification I Well-founded orders A binary relation < is called a strict partial order iff it is  irreflexive: ¬ x<x  transitive: x<y  y<z  x<z  asymmetric: x<y  ¬ y<x A partial order is called total order iff it is  total:  xy (x<y  y<x) A strict partial order is called well-founded iff  there is no infinite descending chain, i.e., no infinite set {x 0, x 1, x 2, x 3,...} such that x 0 >x 1 >x 2 >x 3...  equivalently, if every non-empty set S has a minimal element (i.e.,  S   x  S  y  x (x<y)) A well-founded total order is called a well-order

Folie 6 H. Schlingloff, Software Verification I Well-orderings natural numbers, < integers - x<y iff |x|<|y| or |x|=|y| and x<y pairs - ? strings - ? binary trees - ? rational numbers - ? real matrices - ? Counterexamples?

Folie 7 H. Schlingloff, Software Verification I Transfinite induction Let  (n) be any statement, where n  M and < is a well-founded partial order on M If for all x  M it holds that if  (y) for all y<x, then  (x) then  (n) for all n  M  x ((  y<x   ( y ) )   ( x ) )   n  ( n )

Folie 8 H. Schlingloff, Software Verification I Proof  x ((  y<x   ( y ) )   ( x ) )   n  ( n ) Assume for contradiction that  x ((  y<x   ( y ) )   ( x ) ), i.e.,  x (¬  ( x )  (  y<x  ¬  ( y ) )) and that  x 0 ¬  (x 0 ). Then  x 1 <x 0  ¬  ( x 1 ) ) Therefore  x 2 <x 1  ¬  ( x 2 ) ) etc. Continuing, we get an infinite descending chain of elements, contradicting well-foundedness

Folie 9 H. Schlingloff, Software Verification I Special Cases natural induction:  (0)   x (  ( x ) )   ( x+1 ) )   n  ( n ) mathematical induction: Let M be finitely generated, i.e., there are constructor-functions f 1,...,f n and M 0  M such that all x  M can be written as x=f(f(...(x 0 )..), where each f is a constructor function and x 0  M 0  if  (x 0 ) for all x 0  M 0 and  (  ( x )   ( f ( x )) ) for all x  M and all constructor functions f  then  ( x ) for all x  M

Folie 10 H. Schlingloff, Software Verification I Termination proofs Let (M,<) be a well-founded order and  (z) be a formula involving z  M if ⊢    (z 0 ) for some z 0  M and ⊢  (z)  b    (z’)   ¬b  for some z’<z, then ⊢  while (b)   ¬b   (z) is called variant of the loop

Folie 11 H. Schlingloff, Software Verification I Special case (Termination only) if ⊢    (z) for some z  M, and ⊢  (z)  b    (z’)  for some z’<z, and ⊢ (  (z)  ¬b   ), then ⊢  while (b)   if ⊢  (z) for some z  M and ⊢  (z)    (z’)  ¬b  for some z’<z then ⊢  T  while (b)   T 

Folie 12 H. Schlingloff, Software Verification I Example proof Show ⊢  a>=0  while (a>0) a--  T  well-founded ordering: natural numbers (N 0,<);  (z) = (a==z)  (z)=(floor(a)==z) (i)a>=0  (a==z) for some z  N 0 a>=0  (floor(a)==z) for some z  N 0 (ii) ⊢  a==z  a--  a==z-1  ⊢  floor(a)==z  a--  floor(a)==z-1  Would this proof hold for float a?

Folie 13 H. Schlingloff, Software Verification I Termination of gcd {a==m>0  b==n>0} while (a!=b) if (a>b) a=a-b else b=b-a {a==b==gcd(m,n)} We want to show that ⊢  a==m>0  b==n>0    T  Variant  (z) = (z==a+b); wfo: N 0 Show: ⊢  (z)  if...  (z’)  for some z’<z Proof: let z’=z-min(a,b)

Folie 14 H. Schlingloff, Software Verification I A more intricate example  = {b=1; while (a<=100 || b!=1) if (a<=100) {a+=11; b++;} else {a-=10; b--;} a-=10; } Show: ⊢  0<a<=100    a==91 