Software Correctness Interacting programs SWEN T2.

Slides:



Advertisements
Similar presentations
Essentials for Design JavaScript Level One Michael Brooks
Advertisements

Introduction to C Programming
 2000 Prentice Hall, Inc. All rights reserved. Chapter 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line.
An Introduction to Input/Output Automata Qihua Wang.
Spring semester 2006 ESE601: Hybrid Systems Review material on discrete event systems I.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Objects Real and Java COMP.
Use Cases 2 ENGR ♯10 Peter Andreae
Computer Science Victoria University of Wellington Copyright: david streader, Victoria University of Wellington Simple Design COMP
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington GUI and the UI API COMP.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington While loops and the UI API.
Interaction Modeling. Overview The class model describes the objects in a system and their relationships, the state model describes the life cycles of.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Java Arrays and ArrayLists.
Advanced Topics in SE Spring Process Algebra Hossein Hojjat Formal Methods Lab University of Tehran.
1 A Balanced Introduction to Computer Science, 2/E David Reed, Creighton University ©2008 Pearson Prentice Hall ISBN Chapter 11 Conditional.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 2 Chapter 2 - Introduction to C Programming.
Introduction to C Programming Angela Chih-Wei Tang ( 唐 之 瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan 2010 Fall.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae david streader, VUW Networking and Concurrency COMP.
Chapter 10 Defining Classes. The Internal Structure of Classes and Objects Object – collection of data and operations, in which the data can be accessed.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Debugging COMP T1.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 2 - Introduction to C Programming Outline.
Today’s Agenda  Quiz 4  Temporal Logic Formal Methods in Software Engineering1.
Computer Science Victoria University of Wellington Copyright: david streader, Victoria University of Wellington Simple Design COMP
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae david streader, VUW Echo Networking COMP
Department of Software & Media Technology
Basic concepts of C++ Presented by Prof. Satyajit De
Exception Handling and Event Handling
Testing Verification and the Joy of Breaking Code
COMPUTATIONAL CONSTRUCTS
Learning to Program D is for Digital.
Software Correctness Indexed Processes SWEN T2.
LECTURE 33: STATISTICAL SIGNIFICANCE AND CONFIDENCE (CONT.)
Reasoning About Exceptions Using Model Checking
Building Java Programs
Chapter 2 - Introduction to C Programming
Introducing Java Generics and Collections
Welcome to Computer Science!
Software Reliability Definition: The probability of failure-free operation of the software for a specified period of time in a specified environment.
The Selection Structure
Engineering Problem Solving with C++, Etter/Ingber
Learn To Fix Errors On Dell PC. We are a third-party service provider for Dell users in Nederland. Call us on Website:
Chapter 2 - Introduction to C Programming
Algorithm and Ambiguity
Beginning C Lecture 4 Lecturer: Dr. Zhao Qinpei
Building Java Programs Chapter 2
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
Building Java Programs
Chapter 2 - Introduction to C Programming
Algorithm and Ambiguity
Building Java Programs Chapter 2
October 6, 2011 Dr. Itamar Arel College of Engineering
Review material on discrete event systems I
Chapter 3: Selection Structures: Making Decisions
What if you could build a trinary computer?
Building Java Programs
Chapter 2 - Introduction to C Programming
CSE 153 Design of Operating Systems Winter 19
Chapter 3: Selection Structures: Making Decisions
Chapter 11 Conditional Execution
Building Java Programs Chapter 2
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
Introduction to C Programming
Electrical and Computer Engineering
Statistical Test A test of significance is a formal procedure for comparing observed data with a claim (also called a hypothesis) whose truth we want to.
Computers and Scientific Thinking David Reed, Creighton University
Truth tables.
Unions.
Presentation transcript:

Software Correctness Interacting programs SWEN224 2016-T2. David Streader Engineering & Computer Science Victoria University of Wellington

Learning objectives Truth may be absolute but often appears relative Transactional programs can be specified by functions from State to State or by Post Conditions. Interacting programs preform events that can be observed before the program terminates There are many types of real event. Interacting programs can be specified by automata

Lies we like to tell small children! 1+1 = 2 Why is 1+1 ≠ 2 ? We are computer scientists we know that 1+1 takes longer to compute that 2. And, takes more memory to compute. Consequently we know 1+1 is NOT equal to 2. So what do we mean when we say 1+1 = 2? We are telling people we are not considering – observing the time it takes to compute nor the steps used in the computation. All we observe is the value computed. So 1+1=2 is true or false depending upon what you observe!

Specifying transactional programs A function from initial states to final states can be viewed as a specificaion for transactional programs Programs progOne and progTwo both satisfy the same functional specification are functionaly equivalent What about programs that interact? How do you specify simple interacting programs? When are two interacting programs equivalent? progOne(x ; int) x := x + 1; x := 2 * x; return x; progTwo(x ; int) x := 2 * x; x := x + 2; return x;

Σ= {Act,STOP,ERROR, _->_, _|_} Event based processes Event based programs and their specifications are often called processes. The processes we will consider use: Act, atomic events, first letter lower case, and processes, first letter upper case The simplest processes are STOP and ERROR Additional processes are built by composing an event e and a process P or two processes P and Q event prefixing e->P Choice P|Q Its called an algebra – or a simple programming language Σ= {Act,STOP,ERROR, _->_, _|_}

Action prefixing event -> Process The Process STOP does nothing New process = event -> old process Initially process Sp can only perform a coffeeBtn event it can not perform the coffee event. automata { Simp = coffee -> STOP. } automata { Sp = coffeeBtn->coffee -> STOP. }

Choice | Processes can offer two events and allow a user to select which event they want. Choice = a -> STOP | b->STOP. VM = coin ->(coffeeBtn->coffee->STOP | teaBtn->tea->STOP).

Determinism The Vmx process can initially perform the coin event but what happens next?

Process equality If all we can see of a process is the language they accept then VM and VMx are equal as they both accept: coin,coffeeBtn,coffee coin,teaBtn,tea Alternatively if you repeatedly try to get a coffee from each machine you can observer their difference. Which processes you can distinguish depends upon how you interact with, or observe, them. We will return to this in more detail later.

What is an event? In the real informal world vending machines do not respond to a button being pushed until after a coin is inserted. By not putting a coin in a vending machine you may block it from performing any event. Receiving an email is an event but not reading the email will not block some one from sending it. Events in our formal model behave like button pushing events Later we will formalise the ability to block an event when we define how events from different processes synchronise!

Learning objectives Truth may be absolute but often appears relative what you observe controls weather 1+1=2 or not. Transactional programs can be specified by functions from State to State or by Post Conditions. Interacting programs preform events that can be observed before the program terminates There are many types of real event. Interacting programs can be specified by automata