22.4.2008 Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.

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

Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
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.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Techniques for Proving the Completeness of a Proof System Hongseok Yang Seoul National University Cristiano Calcagno Imperial College.
Semantics Static semantics Dynamic semantics attribute grammars
Hoare’s Correctness Triplets Dijkstra’s Predicate Transformers
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
Logic Concepts Lecture Module 11.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Axiomatic Semantics.
ISBN Chapter 3 Describing Syntax and Semantics.
CS 355 – Programming Languages
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.
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.
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.
Knoweldge Representation & Reasoning
CS 4700: Foundations of Artificial Intelligence
Dr. Muhammed Al-Mulhem 1ICS ICS 535 Design and Implementation of Programming Languages Part 1 Fundamentals (Chapter 4) Axiomatic Semantics ICS 535.
Describing Syntax and Semantics
Intro to Discrete Structures
Binary Decision Diagrams (BDDs)
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.
1 Program Correctness CIS 375 Bruce R. Maxim UM-Dearborn.
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
1 Inference Rules and Proofs (Z); Program Specification and Verification Inference Rules and Proofs (Z); Program Specification and Verification.
Pattern-directed inference systems
Great Theoretical Ideas in Computer Science about AWESOME Some Generating Functions Probability Infinity MATH Some Formal Logic (which is really.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
CS 363 Comparative Programming Languages Semantics.
Propositional Logic Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma Guadalajara
0 What logic is or should be Propositions Boolean operations The language of classical propositional logic Interpretation and truth Validity (tautologicity)
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Chapter 3 Part II Describing Syntax and Semantics.
Semantics In Text: Chapter 3.
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
LECTURE LECTURE Propositional Logic Syntax 1 Source: MIT OpenCourseWare.
CS6133 Software Specification and Verification
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Deciding Combined Theories.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer.
1 Section 6.2 Propositional Calculus Propositional calculus is the language of propositions (statements that are true or false). We represent propositions.
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
Logics for Data and Knowledge Representation ClassL (part 1): syntax and semantics.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer.
March 3, 2016Introduction to Artificial Intelligence Lecture 12: Knowledge Representation & Reasoning I 1 Back to “Serious” Topics… Knowledge Representation.
Propositional Calculus: Boolean Functions and Expressions
SS 2017 Software Verification LTL monitoring
SS 2018 Software Verification LTL Satisfiability applied
Complexity 6-1 The Class P Complexity Andrei Bulatov.
SS 2017 Software Verification CTL model checking, BDDs
Software Verification 2 Automated Verification
SS 2018 Software Verification SAT & FOL
Logics for Data and Knowledge Representation
SS 2017 Software Verification Automated Verification
Software Verification 2 Automated Verification
Semantics In Text: Chapter 3.
Computer Security: Art and Science, 2nd Edition
Program correctness Model-checking CTL
Logical Agents Prof. Dr. Widodo Budiharto 2018
Presentation transcript:

Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für Rechnerarchitektur und Softwaretechnik

Slide 2 H. Schlingloff, Logical Specification A first example A new video camcorder (“DCR-PC330”)  owner's manual almost incomprehensible  can be found in the internet  typical for such devices off memorytapeplay dn up

Slide 3 H. Schlingloff, Logical Specification Such models can help in the development of complex systems ("model-driven design") The more concrete the formalism, the closer it is to an implementation  executable code may be generated from state diagrams  We might add additional information such as timing, communication, variables and such. Specification as opposed to modeling describes properties of the targeted system  not aiming at a complete description of the system  not aiming at the generation of executable code

Slide 4 H. Schlingloff, Logical Specification Screen menu The power-switch by itself is not a "complex system“ (Even I didn't need long to understand it). Let's look at the screen menu.

Slide 5 H. Schlingloff, Logical Specification Screen menu (contd.) greyed out invisible

Slide 6 H. Schlingloff, Logical Specification There are menus, items and settings  menus: Camera Set,...  items: Volume, LCD Brightness,...  settings: on/off, 0-100%,... Items may be nested in two levels Setting screen allows to choose the value of a particular variable  only the relevant variables may be accessed

Slide 7 H. Schlingloff, Logical Specification Modelling as a tree Menu-off MemorySet Pict.Appli.StandardSetCameraSet... VolumeLCD/VFSetRemoteCtrlLCDBrightLCD Color... Menu

Slide 8 H. Schlingloff, Logical Specification Modelling as a tree Menu-off MemorySet Pict.Appli.StandardSetCameraSet... VolumeLCD/VFSetRemoteCtrlLCDBrightLCD Color... Menu

Slide 9 H. Schlingloff, Logical Specification Menus are mode-dependent  As a consequence, the up- and down-relations in the graph are mode-dependent  Since the first line is not uniform, also the menu-relation is mode- dependent Formalization shows weakness in the design (usability)  what is hard to formalize is hard to understand and likely to contain or cause errors How to describe such a structure?  homework (consider cases that an item disappears and that it is greyed out) Camera /Tape Camera /Memory Play /Edit Camera Set Memory Set Pict.Appl Edit/Play Standard Set Time/Langu + + +

Slide 10 H. Schlingloff, Logical Specification Propositional Logic A formal specification method consists of three parts  syntax, i.e., what are well-formed specifications  semantics, i.e., what is the meaning of a specification  calculus, i.e., what are transformations or deductions of a specification Propositional logic: probably the first and most widely used specification method  dates back to Aristotle, Chrysippus, Boole, Frege, …  base of most modern logics  fundamental for computer science

Slide 11 H. Schlingloff, Logical Specification Syntax of Propositional Logic Let Ρ be a finite set {p 1,…,p n } of propositions and assume that ,  and (, ) are not in  Syntax PL ::= Ρ |  | (PL  PL)  every p  is a wff   is a wff („falsum“)  if  and  are wffs, then (  ) is a wff  nothing else is a wff

Slide 12 H. Schlingloff, Logical Specification Remarks Ρ may be empty  still a meaningful logic! Minimalistic approach  infix-operator  necessitates parentheses  other connectives can be defined as usual ¬  ≙ (    )(linear blowup!) Τ ≙ ¬  (  ) ≙ (¬  ) (  ) ≙ ¬(¬  ¬  ) ≙ ¬(  ¬  ) (  ) ≙ ((  )  (  )) (exponential blowup!)  operator precedence as usual  literal = a proposition or a negated proposition

Slide 13 H. Schlingloff, Logical Specification Semantics of Propositional Logic Propositional Model  Truth value universe U: {true, false}  Interpretation I: assignment Ρ ↦ U  Model M: (U,I) Validation relation ⊨ between model M and formula   M ⊨ p if I(p)=true  M ⊭   M ⊨ (  ) if M ⊨  implies M ⊨  M validates or satisfies  iff M ⊨    is valid ( ⊨  ) iff every model M validates    is satisfiable (SAT(  )) iff some model M satisfies 

Slide 14 H. Schlingloff, Logical Specification 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

Slide 15 H. Schlingloff, Logical Specification An Example Derivation Show ⊢ (p  p) (1) ⊢ (p  ((p  p)  p))  ((p  (p  p))  (p  p)) (dis) (2) ⊢ (p  ((p  p)  p)) (wea) (3) ⊢ ((p  (p  p))  (p  p)) (1,2,mp) (4) ⊢ (p  (p  p)) (wea) (5) ⊢ (p  p) (3,4,mp)

Slide 16 H. Schlingloff, Logical Specification Correctness and Completeness Correctness: ⊢   ⊨  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 ~ ⊢ ¬   ~ ⊨ ¬ 

Slide 17 H. Schlingloff, Logical Specification 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 ⊢ ¬Φ, acontradiction. 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)

Slide 18 H. Schlingloff, Logical Specification 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

Slide 19 H. Schlingloff, Logical Specification Example: Combinational Circuits Multiplexer  S selects whether I 0 or I 1 is output to Y  Y = if S then I 1 else I 0 end  (Y  ((S  I 1 )  (¬S  I 0 ))) Pictures taken from: I0I0 I1I1 SY

Slide 20 H. Schlingloff, Logical Specification 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, …

Slide 21 H. Schlingloff, Logical Specification Software Example Code generator 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

Slide 22 H. Schlingloff, Logical Specification Verification of Boolean Functions Latch-Up: can a certain line go up?  does (  ¬L 0 ) hold?  is (  L 0 ) 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)

Slide 23 H. Schlingloff, Logical Specification 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)