# Rigorous Software Development CSCI-GA

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2013 Lecture 11

2 Semantics of Programming Languages Denotational Semantics Meaning of a program is defined as the mathematical object it computes (e.g., partial functions). Example: Abstract Interpretation Axiomatic Semantics Meaning of a program is defined in terms of its effect on the truth of logical assertions. Example: Hoare Logic (Structural) Operational Semantics Meaning of a program is defined by formalizing the individual computation steps of the program. Example: Labeled Transition Systems

3 IMP: A Simple Imperative Language An IMP program: p := 0; x := 0; while x < n do x := x + 1; p := p + m;

4 Syntax of IMP Commands Commands (Com) c ::= skip x := e c 1 ; c 2 if b then c 1 else c 2 while b do c Notes: The typing rules have been embedded in the syntax definition. Other parts are not context-free and need to be checked separately (e.g., all variables are declared). Commands contain all the side-effects in the language. Missing: references, function calls,

5 Labeled Transition Systems A labeled transition system (LTS) is a structure LTS = (Q, Act,!) where Q is a set of states, Act is a set of actions,! µ Q Act Q is a transition relation. a We write q! q for (q, a, q ) 2!.

6 Operational Semantics of IMP q skip q <e, q> n x := e q q ++ {x n} c q 1 c q q 2 q c q 1 ; c 2 q c <b, q> true q 1 c q <b, q> false q 2 q if b then c q 1 else c 2 if b then c q q 1 else c 2 q q <b, q> false while b do c q c <b, q> true q q q while b do c q while b do c q q

7 Axiomatic Semantics An axiomatic semantics consists of: a language for stating assertions about programs; rules for establishing the truth of assertions. Some typical kinds of assertions: This program terminates. If this program terminates, the variables x and y have the same value throughout the execution of the program. The array accesses are within the array bounds. Some typical languages of assertions First-order logic Other logics (temporal, linear) Special-purpose specification languages (Z, Larch, JML)

8 Assertions for IMP The assertions we make about IMP programs are of the form: {A} c {B} with the meaning that: c If A holds in state q and q! q then B holds in q A is the precondition and B is the postcondition For example: { y x } z := x; z := z + 1 { y < z } is a valid assertion These are called Hoare triples or Hoare assertions

9 Assertions for IMP {A} c {B} is a partial correctness assertion. It does not imply termination of c. [A] c [B] is a total correctness assertion meaning that If A holds in state q then there exists q such that q! q and B holds in state q Now let s be more formal Formalize the language of assertions, A and B Say when an assertion holds in a state Give rules for deriving valid Hoare triples c

10 The Assertion Language We use first-order predicate logic with IMP expressions A :: = true false e 1 = e 2 e 1 e 2 A 1 Æ A 2 A 1 Ç A 2 A 1 ) A 2 x.a x.a Note that we are somewhat sloppy and mix the logical variables and the program variables. Implicitly, all IMP variables range over integers. All IMP Boolean expressions are also assertions.

11 Semantics of Assertions We introduced a language of assertions, we need to assign meanings to assertions. Notation q ² A says that assertion A holds in a given state q. This is well-defined when q is defined on all variables occurring in A. The ² judgment is defined inductively on the structure of assertions. It relies on the semantics of arithmetic expressions from IMP.

12 Semantics of Assertions q ² true q ² e 1 = e 2 q ² e 1 e 2 always iff <e 1,q> = <e 2,q> iff <e 1,q> <e 2,q> q ² A 1 Æ A 2 iff q ² A 1 and q ² A 2 q ² A 1 Ç A 2 iff q ² A 1 or q ² A 2 q ² A 1 ) A 2 iff q ² A 1 implies q ² A 2 q ² x.a q ² x.a iff 8n2Z. q[x:=n] ² A iff 9n2Z. q[x:=n] ² A

13 Semantics of Hoare Triples Now we can define formally the meaning of a partial correctness assertion: ² {A} c {B} iff 8q2Q. 8q 2Q. q ² A Æ q! q ) q ² B and the meaning of a total correctness assertion: ² [A] c [B] iff 8q2Q. q ² A ) 9q Q. q! q Æ q ² B or even better: 8q2Q. 8q Q. q ² A Æ q! q ) q ² B Æ 8q2Q. q ² A ) 9q 2Q. q! c q Æ q ² B c c c

14 Inferring Validity of Assertions Now we have the formal mechanism to decide when {A} c {B} But it is not satisfactory, because ² {A} c {B} is defined in terms of the operational semantics. We practically have to run the program to verify an assertion. Also it is impossible to effectively verify the truth of a x. A assertion (by using the definition of validity) So we define a symbolic technique for deriving valid assertions from others that are known to be valid We start with validity of first-order formulas

15 Inference Rules We write ` A when A can be inferred from basic axioms. The inference rules for ` A are the usual ones from firstorder logic with arithmetic. Natural deduction style rules: ` A ` B ` A Æ B ` A ` A Ç B ` A[e/x] ` 9 x. A ` B ` A Ç B ` A[a/x] ` 8 x. A ` 9 x. A ` B ` A[a/x]... ` B where a is fresh where a is fresh ` 8 x. A ` A[e/x] ` A ) B ` A ` B ` A... ` B ` A ) B

16 Inference Rules for Hoare Triples Similarly we write ` {A} c {B} when we can derive the triple using inference rules There is one inference rule for each command in the language. Plus, the rule of consequence ` A ) A ` {A} c {B} ` B ) B ` {A } c {B }

17 Inference Rules for Hoare Logic One rule for each syntactic construct: ` {A} skip {A} ` {A[e/x]} x:=e {A} ` {A} c 1 {B} ` {B} c 2 {C} ` {A} c 1 ; c 2 {C} ` {A Æ b} c 1 {B} ` {A Æ :b} c 2 {B} ` {A} if b then c 1 else c 2 {B} ` {I Æ b} c {I} ` {I} while b do c {I Æ :b}

18 Exercise: Hoare Rules Is the following alternative rule for assignment still correct? ` {true} x:=e {x = e}

19 Hoare Rules For some constructs, multiple rules are possible alternative forward axiom for assignment: ` {A} x:=e {9x 0. x = e[x 0 /x] Æ A[x 0 /x]} alternative rule for while loops: ` I Æ b ) C ` {C} c {I} ` I Æ :b ) B ` {I} while b do c {B} These alternative rules are derivable from the previous rules, plus the rule of consequence.

20 Example: Conditional D1 :: ` {true Æ y 0} x := 1 {x > 0} D2 :: ` {true Æ y > 0} x := y {x > 0} ` {true} if y 0 then x := 1 else x := y {x > 0} D1 is obtained by consequence and assignment ` {1 > 0} x := 1 {x > 0} ` true Æ y 0 ) 1 > 0 ` {true Æ y 0} x := 1 {x 0} D2 is also obtained by consequence and assignment ` {y > 0} x := y {x > 0} ` true Æ y > 0 ) y > 0 ` {true Æ y > 0} x := y {x > 0}

21 Example: a simple loop We want to infer that ` {x 0} while x 5 do x := x + 1 {x = 6} Use the rule for while with invariant I x 6 ` x 6 Æ x 5 ) x ` {x + 1 6} x := x + 1 {x 6} ` {x 6 Æ x 5} x := x + 1 {x 6} ` {x 6} while x 5 do x := x + 1 { x 6 Æ x > 5} Then finish-off with the rule of consequence ` x 0 ) x 6 ` x 6 Æ x > 5 ) x = 6 ` {x 6} while... {x 6 Æ x > 5} ` {x 6} while... { x 6 Æ x > 5}

22 Example: a more interesting program We want to derive that {n 0} p := 0; x := 0; while x < n do x := x + 1; p := p + m {p = n * m}

23 Example: a more interesting program Only applicable rule (except for rule of consequence): ` {A} c 1 {C} ` {C} c 2 {B} ` {A} c 1 ; c 2 {B} ` {n 0} p:=0; x:=0 {C} `{C} while x < n do (x:=x+1; p:=p+m) {p = n * m} ` {n 0} p:=0; x:=0; while x < n do (x:=x+1; p:=p+m) {p = n * m} A c 1 c 2 B

24 Example: a more interesting program What is C? Look at the next possible matching rules for c 2! Only applicable rule (except for rule of consequence): ` {I Æ b} c {I} ` {I} while b do c {I Æ :b} We can match {I} with {C} but we cannot match {I Æ :b} and {p = n * m} directly. Need to apply the rule of consequence first! ` {n 0} p:=0; x:=0 {C} `{C} while x < n do (x:=x+1; p:=p+m) {p = n * m} ` {n 0} p:=0; x:=0; while x < n do (x:=x+1; p:=p+m) {p = n * m} A c 1 c 2 B

25 Example: a more interesting program What is C? Look at the next possible matching rules for c 2! Only applicable rule (except for rule of consequence): ` {I} while b do c {I Æ :b} A I = A = A = C ` {I Æ b} c {I} c ` {n 0} p:=0; x:=0 {C} A B Rule of consequence: ` A ) A ` {A} c {B} ` B ) B ` {A } c {B } `{C} while x < n do (x:=x+1; p:=p+m) {p = n * m} ` {n 0} p:=0; x:=0; while x < n do (x:=x+1; p:=p+m) {p = n * m} c B

26 Example: a more interesting program What is I? Let s keep it as a placeholder for now! Next applicable rule: ` {A} c 1 {C} ` {C} c 2 {B} ` {A} c 1 ; c 2 {B} A c 1 c 2 B ` {n 0} p:=0; x:=0 {I} `{I Æ x<n} x := x+1; p:=p+m {I} `{I} while x < n do (x:=x+1; p:=p+m) {I Æ x n} ` I Æ x n ) p = n * m `{I} while x < n do (x:=x+1; p:=p+m) {p = n * m} ` {n 0} p:=0; x:=0; while x < n do (x:=x+1; p:=p+m) {p = n * m}

27 Example: a more interesting program What is C? Look at the next possible matching rules for c 2! Only applicable rule (except for rule of consequence): ` {A[e/x]} x:=e {A} A c 1 c 2 B ` {n 0} p:=0; x:=0 {I} `{I Æ x<n} x := x+1 {C} `{I Æ x<n} x := x+1; p:=p+m {I} `{C} p:=p+m {I} `{I} while x < n do (x:=x+1; p:=p+m) {I Æ x n} ` I Æ x n ) p = n * m `{I} while x < n do (x:=x+1; p:=p+m) {p = n * m} ` {n 0} p:=0; x:=0; while x < n do (x:=x+1; p:=p+m) {p = n * m}

28 Example: a more interesting program What is C? Look at the next possible matching rules for c 2! Only applicable rule (except for rule of consequence): ` {A[e/x]} x:=e {A} ` {n 0} p:=0; x:=0 {I} `{I Æ x<n} x:=x+1 {I[p+m/p]} `{I[p+m/p} p:=p+m {I} `{I Æ x<n} x:=x+1; p:=p+m {I} `{I} while x < n do (x:=x+1; p:=p+m) {I Æ x n} ` I Æ x n ) p = n * m `{I} while x < n do (x:=x+1; p:=p+m) {p = n * m} ` {n 0} p:=0; x:=0; while x < n do (x:=x+1; p:=p+m) {p = n * m}

29 Example: a more interesting program Only applicable rule (except for rule of consequence): ` {A[e/x]} x:=e {A} Need rule of consequence to match {I Æ x<n} and {I[x+1/x, p+m/p]} ` {n 0} p:=0; x:=0 {I} `{I Æ x<n} x:=x+1 {I[p+m/p]} `{I[p+m/p} p:=p+m {I} `{I Æ x<n} x:=x+1; p:=p+m {I} `{I} while x < n do (x:=x+1; p:=p+m) {I Æ x n} ` I Æ x n ) p = n * m `{I} while x < n do (x:=x+1; p:=p+m) {p = n * m} ` {n 0} p:=0; x:=0; while x < n do (x:=x+1; p:=p+m) {p = n * m}

30 Example: a more interesting program Let s just remember the open proof obligations! ` {n 0} p:=0; x:=0 {I} `{I[x+1/x, p+m/p]} x:=x+1 {I[p+m/p]} ` I Æ x < n ) I[x+1/x, p+m/p] `{I Æ x<n} x:=x+1 {I[p+m/p]} `{I[p+m/p} p:=p+m {I} `{I Æ x<n} x:=x+1; p:=p+m {I} `{I} while x < n do (x:=x+1; p:=p+m) {I Æ x n} ` I Æ x n ) p = n * m... `{I} while x < n do (x:=x+1; p:=p+m) {p = n * m} ` {n 0} p:=0; x:=0; while x < n do (x:=x+1; p:=p+m) {p = n * m}

31 Example: a more interesting program Let s just remember the open proof obligations! ` I Æ x < n ) I[x+1/x, p+m/p] ` {n 0} p:=0; x:=0 {I} ` I Æ x n ) p = n * m Continue with the remaining part of the proof tree, as before. ` n 0 ) I[0/p, 0/x] ` {I[0/p, 0/x]} p:=0 {I[0/x]} ` {n 0} p:=0 {I[0/x]} ` {I[0/x]} x:=0 {I} Now we only need to solve the remaining constraints!... `{I} while x < n do (x:=x+1; p:=p+m) {p = n * m} ` {n 0} p:=0; x:=0; while x < n do (x:=x+1; p:=p+m) {p = n * m}

32 Example: a more interesting program Find I such that all constraints are simultaneously valid: ` n 0 ) I[0/p, 0/x] ` I Æ x < n ) I[x+1/x, p+m/p] ` I Æ x n ) p = n * m I p = x * m Æ x n ` n 0 ) 0 = 0 * m Æ 0 n ` p = x * m Æ x n Æ x < n ) p+m = (x+1) * m Æ x+1 n ` p = x * n Æ x n Æ x n ) p = n * m All constraints are valid!

### Rigorous. Development. Software. Program Verification. & Springer. An Introduction to. Jorge Sousa Pinto. Jose Bacelar Almeida Maria Joao Frade

Jose Bacelar Almeida Maria Joao Frade Jorge Sousa Pinto Simao Melo de Sousa Rigorous Software Development An Introduction to Program Verification & Springer Contents 1 Introduction 1 1.1 A Formal Approach

### PROPERTECHNIQUEOFSOFTWARE INSPECTIONUSING GUARDED COMMANDLANGUAGE

International Journal of Computer ScienceandCommunication Vol. 2, No. 1, January-June2011, pp. 153-157 PROPERTECHNIQUEOFSOFTWARE INSPECTIONUSING GUARDED COMMANDLANGUAGE Neeraj Kumar Singhania University,

### Rigorous Software Engineering Hoare Logic and Design by Contracts

Rigorous Software Engineering Hoare Logic and Design by Contracts Simão Melo de Sousa RELEASE (UBI), LIACC (Porto) Computer Science Department University of Beira Interior, Portugal 2010-2011 S. Melo de

### CSE 459/598: Logic for Computer Scientists (Spring 2012)

CSE 459/598: Logic for Computer Scientists (Spring 2012) Time and Place: T Th 10:30-11:45 a.m., M1-09 Instructor: Joohyung Lee (joolee@asu.edu) Instructor s Office Hours: T Th 4:30-5:30 p.m. and by appointment

### CHAPTER 7 GENERAL PROOF SYSTEMS

CHAPTER 7 GENERAL PROOF SYSTEMS 1 Introduction Proof systems are built to prove statements. They can be thought as an inference machine with special statements, called provable statements, or sometimes

### Formal Verification of Software

Formal Verification of Software Sabine Broda Department of Computer Science/FCUP 12 de Novembro de 2014 Sabine Broda (DCC-FCUP) Formal Verification of Software 12 de Novembro de 2014 1 / 26 Formal Verification

### Java+ITP: A Verification Tool Based on Hoare Logic and Algebraic Semantics

: A Verification Tool Based on Hoare Logic and Algebraic Semantics Department of Computer Science University of Illinois at Urbana-Champaign 6th International Workshop on Rewriting Logic and its Applications,

### Introducing Formal Methods. Software Engineering and Formal Methods

Introducing Formal Methods Formal Methods for Software Specification and Analysis: An Overview 1 Software Engineering and Formal Methods Every Software engineering methodology is based on a recommended

### Satisfiability Checking

Satisfiability Checking First-Order Logic Prof. Dr. Erika Ábrahám RWTH Aachen University Informatik 2 LuFG Theory of Hybrid Systems WS 14/15 Satisfiability Checking Prof. Dr. Erika Ábrahám (RWTH Aachen

### 4 Domain Relational Calculus

4 Domain Relational Calculus We now present two relational calculi that we will compare to RA. First, what is the difference between an algebra and a calculus? The usual story is that the algebra RA is

### Constructing Contracts: Making Discrete Mathematics Relevant to Beginning Programmers

Constructing Contracts: Making Discrete Mathematics Relevant to Beginning Programmers TIMOTHY S. GEGG-HARRISON Winona State University Although computer scientists understand the importance of discrete

### Rigorous Software Development CSCI-GA 3033-009

Rigorous Software Development CSCI-GA 3033-009 Instructor: Thomas Wies Spring 2013 Lecture 5 Disclaimer. These notes are derived from notes originally developed by Joseph Kiniry, Gary Leavens, Erik Poll,

### AI Principles, Semester 2, Week 2, Lecture 4 Introduction to Logic Thinking, reasoning and deductive logic Validity of arguments, Soundness of

AI Principles, Semester 2, Week 2, Lecture 4 Introduction to Logic Thinking, reasoning and deductive logic Validity of arguments, Soundness of arguments Formal systems Axioms, Inference, and Proof Propositional

### [Refer Slide Time: 05:10]

Principles of Programming Languages Prof: S. Arun Kumar Department of Computer Science and Engineering Indian Institute of Technology Delhi Lecture no 7 Lecture Title: Syntactic Classes Welcome to lecture

### Encoding Mathematics in First-Order Logic

Applied Logic Lecture 19 CS 486 Spring 2005 Thursday, April 14, 2005 Encoding Mathematics in First-Order Logic Over the past few lectures, we have seen the syntax and the semantics of first-order logic,

### Automated Theorem Proving - summary of lecture 1

Automated Theorem Proving - summary of lecture 1 1 Introduction Automated Theorem Proving (ATP) deals with the development of computer programs that show that some statement is a logical consequence of

### Lecture Notes on Linear Search

Lecture Notes on Linear Search 15-122: Principles of Imperative Computation Frank Pfenning Lecture 5 January 29, 2013 1 Introduction One of the fundamental and recurring problems in computer science is

### Introduction to formal semantics -

Introduction to formal semantics - Introduction to formal semantics 1 / 25 structure Motivation - Philosophy paradox antinomy division in object und Meta language Semiotics syntax semantics Pragmatics

### Handout #1: Mathematical Reasoning

Math 101 Rumbos Spring 2010 1 Handout #1: Mathematical Reasoning 1 Propositional Logic A proposition is a mathematical statement that it is either true or false; that is, a statement whose certainty or

### Fundamentals of Mathematics Lecture 6: Propositional Logic

Fundamentals of Mathematics Lecture 6: Propositional Logic Guan-Shieng Huang National Chi Nan University, Taiwan Spring, 2008 1 / 39 Connectives Propositional Connectives I 1 Negation: (not A) A A T F

### WUCT121. Discrete Mathematics. Logic

WUCT121 Discrete Mathematics Logic 1. Logic 2. Predicate Logic 3. Proofs 4. Set Theory 5. Relations and Functions WUCT121 Logic 1 Section 1. Logic 1.1. Introduction. In developing a mathematical theory,

### MAP-I Programa Doutoral em Informática. Rigorous Software Development

MAP-I Programa Doutoral em Informática Rigorous Software Development Unidade Curricular em Teoria e Fundamentos Theory and Foundations (UCTF) DI-UM, DCC-FCUP May, 2012 Abstract This text presents a UCTF

### CS510 Software Engineering

CS510 Software Engineering Propositional Logic Asst. Prof. Mathias Payer Department of Computer Science Purdue University TA: Scott A. Carr Slides inspired by Xiangyu Zhang http://nebelwelt.net/teaching/15-cs510-se

### Discrete Mathematics

Slides for Part IA CST 2014/15 Discrete Mathematics Prof Marcelo Fiore Marcelo.Fiore@cl.cam.ac.uk What are we up to? Learn to read and write, and also work with, mathematical

### Lecture 4 -- Sets, Relations, Functions 1

Lecture 4 Sets, Relations, Functions Pat Place Carnegie Mellon University Models of Software Systems 17-651 Fall 1999 Lecture 4 -- Sets, Relations, Functions 1 The Story So Far Formal Systems > Syntax»

### Extended Static Checking for Java

Lukas TU München - Seminar Verification 14. Juli 2011 Outline 1 Motivation 2 ESC/Java example 3 ESC/JAVA architecture VC generator Simplify 4 JML + ESC/Java annotation language JML What ESC/Java checks

### Software Verification and Testing. Lecture Notes: Z I

Software Verification and Testing Lecture Notes: Z I Motivation so far: we have seen that properties of software systems can be specified using first-order logic, set theory and the relational calculus

### Deductive Systems. Marco Piastra. Artificial Intelligence. Artificial Intelligence - A.A Deductive Systems [1]

Artificial Intelligence Deductive Systems Marco Piastra Artificial Intelligence - A.A. 2012- Deductive Systems 1] Symbolic calculus? A wff is entailed by a set of wff iff every model of is also model of

### Predicate Logic. PHI 201 Introductory Logic Spring 2011

Predicate Logic PHI 201 Introductory Logic Spring 2011 This is a summary of definitions in Predicate Logic from the text The Logic Book by Bergmann et al. 1 The Language PLE Vocabulary The vocabulary of

### Predicates and Quantifiers. Niloufar Shafiei

Predicates and Quantifiers Niloufar Shafiei Review Proposition: 1. It is a sentence that declares a fact. 2. It is either true or false, but not both. Examples: 2 + 1 = 3. True Proposition Toronto is the

### 8.7 Mathematical Induction

8.7. MATHEMATICAL INDUCTION 8-135 8.7 Mathematical Induction Objective Prove a statement by mathematical induction Many mathematical facts are established by first observing a pattern, then making a conjecture

### References. Logic (Mathematics 1BA1) Introduction to Logic. Introduction to Logic. Expressions. State and Evaluation.

References Logic (Mathematics 1BA1) Rozenn Dahyot Room 128 Lloyd Institute School of Computer Science and Statistics Trinity College Dublin, IRELAND https://www.cs.tcd.ie/rozenn.dahyot/ Rozenn.Dahyot@cs.tcd.ie

### Software Verification and Testing. Lecture Notes: Temporal Logics

Software Verification and Testing Lecture Notes: Temporal Logics Motivation traditional programs (whether terminating or non-terminating) can be modelled as relations are analysed wrt their input/output

### Praspel: A Specification Language for Contract-Driven Testing in PHP

Praspel: A Specification Language for Contract-Driven Testing in PHP Ivan Enderlin Frédéric Dadeau Alain Giorgetti Abdallah Ben Othman October 27th, 2011 Meetings: LTP MTVV Ivan Enderlin, Frédéric Dadeau,

### Mathematical Reasoning in Software Engineering Education. Peter B. Henderson Butler University

Mathematical Reasoning in Software Engineering Education Peter B. Henderson Butler University Introduction Engineering is a bridge between science and mathematics, and the technological needs of mankind.

### Formally speaking: How to apply OCL

Page 1 of 6 Copyright IBM Corporation 2004 http://www-106.ibm.com/developerworks/rational/library/5390.html Search for: within All of dw Use + - ( ) " " Search help IBM home Products & services Support

### 2. The Language of First-order Logic

2. The Language of First-order Logic KR & R Brachman & Levesque 2005 17 Declarative language Before building system before there can be learning, reasoning, planning, explanation... need to be able to

### Automatic Assessment of Programming assignment

Automatic Assessment of Programming assignment Surendra Gupta 1 and Shiv Kumar Dubey 2 Department of Computer Engineering Shri G. S. Institute of Technology & Science 23, Park Road Indore 452003 (MP) India

### WESTMORELAND COUNTY PUBLIC SCHOOLS 2011 2012 Integrated Instructional Pacing Guide and Checklist Computer Math

Textbook Correlation WESTMORELAND COUNTY PUBLIC SCHOOLS 2011 2012 Integrated Instructional Pacing Guide and Checklist Computer Math Following Directions Unit FIRST QUARTER AND SECOND QUARTER Logic Unit

### Verification of Imperative Programs in Theorema

Verification of Imperative Programs in Theorema Laura Ildikó Kovács, Nikolaj Popov, Tudor Jebelean 1 Research Institute for Symbolic Computation, Johannes Kepler University, A-4040 Linz, Austria Institute

### Lecture 5: Specifying Java Programs

Lecture 5: Specifying Java Programs This lecture aims to:! Introduce the basic ingredients of a program specification.! Show how to map Object-Z specifications into program specifications! Define reasoning

### Chapter 6 Finite sets and infinite sets. Copyright 2013, 2005, 2001 Pearson Education, Inc. Section 3.1, Slide 1

Chapter 6 Finite sets and infinite sets Copyright 013, 005, 001 Pearson Education, Inc. Section 3.1, Slide 1 Section 6. PROPERTIES OF THE NATURE NUMBERS 013 Pearson Education, Inc.1 Slide Recall that denotes

### Software Engineering

Software Engineering Lecture 04: The B Specification Method Peter Thiemann University of Freiburg, Germany SS 2013 Peter Thiemann (Univ. Freiburg) Software Engineering SWT 1 / 50 The B specification method

### A Framework for the Semantics of Behavioral Contracts

A Framework for the Semantics of Behavioral Contracts Ashley McNeile Metamaxim Ltd, 48 Brunswick Gardens, London W8 4AN, UK ashley.mcneile@metamaxim.com Abstract. Contracts have proved a powerful concept

### Functional Programming. Functional Programming Languages. Chapter 14. Introduction

Functional Programming Languages Chapter 14 Introduction Functional programming paradigm History Features and concepts Examples: Lisp ML 1 2 Functional Programming Functional Programming Languages The

### StaRVOOrS: A Tool for Combined Static and Runtime Verification of Java

StaRVOOrS: A Tool for Combined Static and Runtime Verification of Java Jesús Mauricio Chimento 1, Wolfgang Ahrendt 1, Gordon J. Pace 2, and Gerardo Schneider 3 1 Chalmers University of Technology, Sweden.

### The Predicate Calculus in AI

Last time, we: The Predicate Calculus in AI Motivated the use of Logic as a representational language for AI (Can derive new facts syntactically - simply by pushing symbols around) Described propositional

### Predicate Logic. Lucia Moura. Winter Predicates and Quantifiers Nested Quantifiers Using Predicate Calculus

Predicate Logic Winter 2010 Predicates A Predicate is a declarative sentence whose true/false value depends on one or more variables. The statement x is greater than 3 has two parts: the subject: x is

### Satisfiability Checking

Satisfiability Checking SAT-Solving Prof. Dr. Erika Ábrahám Theory of Hybrid Systems Informatik 2 WS 10/11 Prof. Dr. Erika Ábrahám - Satisfiability Checking 1 / 40 A basic SAT algorithm Assume the CNF

### What's Wrong With Formal Programming Methods? Eric C.R. Hehner

What's Wrong With Formal Programming Methods? Eric C.R. Hehner Department of Computer Science, University of Toronto, Toronto M5S 1A4 Canada The January 1991 issue of Computing Research News includes the

### Rigorous Software Development CSCI-GA 3033-009

Rigorous Software Development CSCI-GA 3033-009 Instructor: Thomas Wies Spring 2013 Lecture 1 Important Facts Office Hours: Thu 3-4pm, or by appointment Office: CIWW 407 Course web site: http://cs.nyu.edu/wies/teaching/rsd-13

### Specification and Analysis of Contracts Lecture 1 Introduction

Specification and Analysis of Contracts Lecture 1 Introduction Gerardo Schneider gerardo@ifi.uio.no http://folk.uio.no/gerardo/ Department of Informatics, University of Oslo SEFM School, Oct. 27 - Nov.

### SQL INJECTION ATTACKS By Zelinski Radu, Technical University of Moldova

SQL INJECTION ATTACKS By Zelinski Radu, Technical University of Moldova Where someone is building a Web application, often he need to use databases to store information, or to manage user accounts. And

### Consistency, completeness of undecidable preposition of Principia Mathematica. Tanmay Jaipurkar

Consistency, completeness of undecidable preposition of Principia Mathematica Tanmay Jaipurkar October 21, 2013 Abstract The fallowing paper discusses the inconsistency and undecidable preposition of Principia

### Chair of Software Engineering. Software Verification. Assertion Inference. Carlo A. Furia

Chair of Software Engineering Software Verification Assertion Inference Carlo A. Furia Proving Programs Automatically The Program Verification problem: Given: a program P and a specification S = [Pre,

### Formalization of the CRM: Initial Thoughts

Formalization of the CRM: Initial Thoughts Carlo Meghini Istituto di Scienza e Tecnologie della Informazione Consiglio Nazionale delle Ricerche Pisa CRM SIG Meeting Iraklio, October 1st, 2014 Outline Overture:

### Introduction to mathematical arguments

Introduction to mathematical arguments (background handout for courses requiring proofs) by Michael Hutchings A mathematical proof is an argument which convinces other people that something is true. Math

### Formal Engineering for Industrial Software Development

Shaoying Liu Formal Engineering for Industrial Software Development Using the SOFL Method With 90 Figures and 30 Tables Springer Contents Introduction 1 1.1 Software Life Cycle... 2 1.2 The Problem 4 1.3

### Semantics and Verification of Software

Semantics and Verification of Software Lecture 21: Nondeterminism and Parallelism IV (Equivalence of CCS Processes & Wrap-Up) Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification)

### Problem Set 1: Program Verification

Problem Set 1: Program Verification CS 173 Honors Section Assigned: September 7, 2011 Due on: September 14, 2011 One of the applications of logic in computer science is its use in proving programs to be

### Predicate Logic Review

Predicate Logic Review UC Berkeley, Philosophy 142, Spring 2016 John MacFarlane 1 Grammar A term is an individual constant or a variable. An individual constant is a lowercase letter from the beginning

### CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 18: Intermediate Code 29 Feb 08

CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 18: Intermediate Code 29 Feb 08 CS 412/413 Spring 2008 Introduction to Compilers 1 Summary: Semantic Analysis Check errors not detected by lexical

### A Static Analyzer for Large Safety-Critical Software. Considered Programs and Semantics. Automatic Program Verification by Abstract Interpretation

PLDI 03 A Static Analyzer for Large Safety-Critical Software B. Blanchet, P. Cousot, R. Cousot, J. Feret L. Mauborgne, A. Miné, D. Monniaux,. Rival CNRS École normale supérieure École polytechnique Paris

### 2. Methods of Proof Types of Proofs. Suppose we wish to prove an implication p q. Here are some strategies we have available to try.

2. METHODS OF PROOF 69 2. Methods of Proof 2.1. Types of Proofs. Suppose we wish to prove an implication p q. Here are some strategies we have available to try. Trivial Proof: If we know q is true then

### CSE373: Data Structures and Algorithms Lecture 2: Proof by Induction. Linda Shapiro Winter 2015

CSE373: Data Structures and Algorithms Lecture 2: Proof by Induction Linda Shapiro Winter 2015 Background on Induction Type of mathematical proof Typically used to establish a given statement for all natural

### First-Order Logics and Truth Degrees

First-Order Logics and Truth Degrees George Metcalfe Mathematics Institute University of Bern LATD 2014, Vienna Summer of Logic, 15-19 July 2014 George Metcalfe (University of Bern) First-Order Logics

Test Case Generation for Ultimately Periodic Paths Joint work with Saddek Bensalem Hongyang Qu Stavros Tripakis Lenore Zuck Accepted to HVC 2007 How to find the condition to execute a path? (weakest precondition

### Quiz 1. Ashish Carole Christos Eric George Jack Nick Tina

Massachusetts Institute of Technology 6.042J/18.062J, Spring 02: Mathematics for Computer Science March 1 Professor Albert Meyer and Dr. Radhika Nagpal revised April 28, 2002, 858 minutes Quiz 1 Circle

### Summary Last Lecture. Automated Reasoning. Outline of the Lecture. Definition sequent calculus. Theorem (Normalisation and Strong Normalisation)

Summary Summary Last Lecture sequent calculus Automated Reasoning Georg Moser Institute of Computer Science @ UIBK Winter 013 (Normalisation and Strong Normalisation) let Π be a proof in minimal logic

### Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science updated 03/08/2012 Unit 1: JKarel 8 weeks http://www.fcps.edu/is/pos/documents/hs/compsci.htm

### Sequences and Mathematical Induction. CSE 215, Foundations of Computer Science Stony Brook University

Sequences and Mathematical Induction CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook.edu/~cse215 Sequences A sequence is a function whose domain is all the integers

### Peter V. Homeier and David F. Martin. homeier@cs.ucla.edu and dmartin@cs.ucla.edu

A Mechanically Veried Verication Condition Generator Peter V. Homeier and David F. Martin Computer Science Department, University of California, Los Angeles 90024 USA homeier@cs.ucla.edu and dmartin@cs.ucla.edu

### Static Program Transformations for Efficient Software Model Checking

Static Program Transformations for Efficient Software Model Checking Shobha Vasudevan Jacob Abraham The University of Texas at Austin Dependable Systems Large and complex systems Software faults are major

### Predicate Calculus. There are certain arguments that seem to be perfectly logical, yet they cannot be expressed by using propositional calculus.

Predicate Calculus (Alternative names: predicate logic, first order logic, elementary logic, restricted predicate calculus, restricted functional calculus, relational calculus, theory of quantification,

### Predicate logic Proofs Artificial intelligence. Predicate logic. SET07106 Mathematics for Software Engineering

Predicate logic SET07106 Mathematics for Software Engineering School of Computing Edinburgh Napier University Module Leader: Uta Priss 2010 Copyright Edinburgh Napier University Predicate logic Slide 1/24

### Module 7. Software Engineering Issues. Version 2 EE IIT, Kharagpur 1

Module 7 Software Engineering Issues Version 2 EE IIT, Kharagpur 1 Lesson 34 Requirements Analysis and Specification Version 2 EE IIT, Kharagpur 2 Specific Instructional Objectives At the end of this lesson,

### ML for the Working Programmer

ML for the Working Programmer 2nd edition Lawrence C. Paulson University of Cambridge CAMBRIDGE UNIVERSITY PRESS CONTENTS Preface to the Second Edition Preface xiii xv 1 Standard ML 1 Functional Programming

Mathematics 0N1 Solutions 1 1. Write the following sets in list form. 1(i) The set of letters in the word banana. {a, b, n}. 1(ii) {x : x 2 + 3x 10 = 0}. 3(iv) C A. True 3(v) B = {e, e, f, c}. True 3(vi)

### 1 Proposition, Logical connectives and compound statements

Discrete Mathematics: Lecture 4 Introduction to Logic Instructor: Arijit Bishnu Date: July 27, 2009 1 Proposition, Logical connectives and compound statements Logic is the discipline that deals with the

### Model Checking: An Introduction

Announcements Model Checking: An Introduction Meeting 2 Office hours M 1:30pm-2:30pm W 5:30pm-6:30pm (after class) and by appointment ECOT 621 Moodle problems? Fundamentals of Programming Languages CSCI

### 1 Operational Semantics for While

Models of Computation, 2010 1 1 Operational Semantics for While The language While of simple while programs has a grammar consisting of three syntactic categories: numeric expressions, which represent

### Runtime Verification of Computer Programs and its Application in Programming Education

Runtime Verification of Computer Programs its Application in Programming Education Magdalina V. Todorova, Petar R. Armyanov Abstract The paper presents a technique for runtime program verification its

### Formal Verification and Linear-time Model Checking

Formal Verification and Linear-time Model Checking Paul Jackson University of Edinburgh Automated Reasoning 21st and 24th October 2013 Why Automated Reasoning? Intellectually stimulating and challenging

### Discrete Mathematics, Chapter : Predicate Logic

Discrete Mathematics, Chapter 1.4-1.5: Predicate Logic Richard Mayr University of Edinburgh, UK Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapter 1.4-1.5 1 / 23 Outline 1 Predicates

### MAT-71506 Program Verication: Exercises

MAT-71506 Program Verication: Exercises Antero Kangas Tampere University of Technology Department of Mathematics September 11, 2014 Accomplishment Exercises are obligatory and probably the grades will

### A Systematic Approach. to Parallel Program Verication. Tadao TAKAOKA. Department of Computer Science. Ibaraki University. Hitachi, Ibaraki 316, JAPAN

A Systematic Approach to Parallel Program Verication Tadao TAKAOKA Department of Computer Science Ibaraki University Hitachi, Ibaraki 316, JAPAN E-mail: takaoka@cis.ibaraki.ac.jp Phone: +81 94 38 5130

### Midlands Graduate School in the Foundations of Computer Science

Midlands Graduate chool in the Foundations of omputer cience Operational emantics, Abstract Machines, and orrectness Roy L. role University of Leicester, 8th to 12th April 2006 University of Nottingham,

### Software Engineering using Formal Methods

Software Engineering using Formal Methods Model Checking with Temporal Logic Wolfgang Ahrendt 24th September 2013 SEFM: Model Checking with Temporal Logic /GU 130924 1 / 33 Model Checking with Spin model

7 Quadratic Expressions A quadratic expression (Latin quadratus squared ) is an expression involving a squared term, e.g., x + 1, or a product term, e.g., xy x + 1. (A linear expression such as x + 1 is

### Testing LTL Formula Translation into Büchi Automata

Testing LTL Formula Translation into Büchi Automata Heikki Tauriainen and Keijo Heljanko Helsinki University of Technology, Laboratory for Theoretical Computer Science, P. O. Box 5400, FIN-02015 HUT, Finland

### Software Model Checking. Equivalence Hierarchy

Software Equivalence Hierarchy Moonzoo Kim CS Dept. KAIST CS750B Software Korea Advanced Institute of Science and Technology Equivalence semantics and SW design Preliminary Hierarchy Diagram Trace-based

### We would like to state the following system of natural deduction rules preserving falsity:

A Natural Deduction System Preserving Falsity 1 Wagner de Campos Sanz Dept. of Philosophy/UFG/Brazil sanz@fchf.ufg.br Abstract This paper presents a natural deduction system preserving falsity. This new

### Semantic Analysis: Types and Type Checking

Semantic Analysis Semantic Analysis: Types and Type Checking CS 471 October 10, 2007 Source code Lexical Analysis tokens Syntactic Analysis AST Semantic Analysis AST Intermediate Code Gen lexical errors

### Algorithmic Software Verification

Algorithmic Software Verification (LTL Model Checking) Azadeh Farzan What is Verification Anyway? Proving (in a formal way) that program satisfies a specification written in a logical language. Formal

### CS532, Winter 2010 Lecture Notes: First-Order Logic: Syntax and Semantics

CS532, Winter 2010 Lecture Notes: First-Order Logic: Syntax and Semantics Dr Alan Fern, afern@csorstedu January 8, 2010 1 Limits of Propositional Logic Propositional logic assumes that the world or system

### Predicate logic. Logic in computer science. Logic in Computer Science (lecture) PART II. first order logic

PART II. Predicate logic first order logic Logic in computer science Seminar: INGK401-K5; INHK401; INJK401-K4 University of Debrecen, Faculty of Informatics kadek.tamas@inf.unideb.hu 1 / 19 Alphabets Logical

### Formal Verification Coverage: Computing the Coverage Gap between Temporal Specifications

Formal Verification Coverage: Computing the Coverage Gap between Temporal Specifications Sayantan Das Prasenjit Basu Ansuman Banerjee Pallab Dasgupta P.P. Chakrabarti Department of Computer Science & Engineering

### Simple Loop Patterns and Rich Loop Invariants

Simple Loop Patterns and Rich Loop Invariants Marc Sango AdaCore CNAM 05-10-2011 Marc Sango (AdaCore CNAM) Simple Loop Patterns and Rich Loop Invariants 05-10-2011 1 / 17 Contents 1 Motivation 2 Principle