Specification and Analysis of Contracts Lecture 1 Introduction



Similar documents
INF5140: Specification and Verification of Parallel Systems

Overview Motivating Examples Interleaving Model Semantics of Correctness Testing, Debugging, and Verification

Software testing. Objectives

Introducing Formal Methods. Software Engineering and Formal Methods

Introduction to Formal Methods. Các Phương Pháp Hình Thức Cho Phát Triển Phần Mềm

Kirsten Sinclair SyntheSys Systems Engineers

VDM vs. Programming Language Extensions or their Integration

A Framework for the Semantics of Behavioral Contracts

Model Checking: An Introduction

A Classification of Model Checking-based Verification Approaches for Software Models

Coverability for Parallel Programs

TECH. Requirements. Why are requirements important? The Requirements Process REQUIREMENTS ELICITATION AND ANALYSIS. Requirements vs.

Verifying Semantic of System Composition for an Aspect-Oriented Approach

Model Checking based Software Verification

(Refer Slide Time: 01:52)

The Model Checker SPIN

ONLINE EXERCISE SYSTEM A Web-Based Tool for Administration and Automatic Correction of Exercises

Model Checking of Software

Software Active Online Monitoring Under. Anticipatory Semantics

Software Engineering. How does software fail? Terminology CS / COE 1530

Unified Static and Runtime Verification of Object-Oriented Software

School of Computer Science

Rigorous Software Development CSCI-GA

Formal Verification of Software

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

Challenges and Opportunities for formal specifications in Service Oriented Architectures

Software Testing. Quality & Testing. Software Testing

Software Engineering using Formal Methods

Algorithmic Software Verification

The Course.

8.6 WORKING OUT CONTRACTING CONDITIONS

T Reactive Systems: Introduction and Finite State Automata

Simulation-Based Security with Inexhaustible Interactive Turing Machines

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

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

Module 10. Coding and Testing. Version 2 CSE IIT, Kharagpur

Chapter 8 Software Testing

Software Engineering. Software Testing. Based on Software Engineering, 7 th Edition by Ian Sommerville

Software Engineering Introduction & Background. Complaints. General Problems. Department of Computer Science Kent State University

Tilburg University. Publication date: Link to publication

Static Analysis of Dynamic Properties - Automatic Program Verification to Prove the Absence of Dynamic Runtime Errors

Development of global specification for dynamically adaptive software

Software Engineering Reference Framework

Model-Checking Verification for Reliable Web Service

Doctor of Philosophy in Computer Science

Structure of Presentation. Stages in Teaching Formal Methods. Motivation (1) Motivation (2) The Scope of Formal Methods (1)

Quotes from Object-Oriented Software Construction

Design by Contract beyond class modelling

Rigorous Software Development CSCI-GA

CSE4213 Lecture Notes

Software Verification: Infinite-State Model Checking and Static Program

How To Write A Program Verification And Programming Book

The CompCert verified C compiler

[Refer Slide Time: 05:10]

Runtime Verification - Monitor-oriented Programming - Monitor-based Runtime Reflection

How To Improve Software Quality

Quality Management. Lecture 12 Software quality management

Today s Agenda. Automata and Logic. Quiz 4 Temporal Logic. Introduction Buchi Automata Linear Time Logic Summary

Lecture 9 verifying temporal logic

Lecture 03 ( ) Quality of the Software Development Process

CS Master Level Courses and Areas COURSE DESCRIPTIONS. CSCI 521 Real-Time Systems. CSCI 522 High Performance Computing

Software Verification and Testing. Lecture Notes: Temporal Logics

Master of Science in Computer Science

Testing LTL Formula Translation into Büchi Automata

Principles of Software Engineering: Course Outline. Ethan Jackson And Wolfram Schulte, Research in Software Engineering (RiSE) Microsoft Research

Formal Verification by Model Checking

Using TechExcel s DevSuite to Achieve FDA Software Validation Compliance For Medical Software Device Development

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

Lecture 17: Requirements Specifications

INF5140: Specification and Verification of Parallel Systems

Properties of Stabilizing Computations

Secure Software Programming and Vulnerability Analysis

The Service Revolution software engineering without programming languages

Analyzing Service Contract with Model Checking

Process Modelling from Insurance Event Log

Prokrustes säng. och HMI-design

Logistics. Software Testing. Logistics. Logistics. Plan for this week. Before we begin. Project. Final exam. Questions?

Contracts between Software Agents

ADAPTIVE SOA INFRASTRUCTURE BASED ON VARIABILITY MANAGEMENT. Peter Graubmann, Mikhail Roshchin

Sofware Requirements Engineeing

A Classification of Model Checking-Based Verification Approaches for Software Models

CS52600: Information Security

Basic Testing Concepts and Terminology

Data Quality Mining: Employing Classifiers for Assuring consistent Datasets

Safety Verification of the Small Aircraft Transportation System Concept of Operations

Datavetenskapligt Program (kandidat) Computer Science Programme (master)

BIS 3106: Business Process Management. Lecture Two: Modelling the Control-flow Perspective

How To Write Software

introduction to program monitoring

A Propositional Dynamic Logic for CCS Programs

Software-platform-independent, Precise Action Specifications for UML. Stephen J. Mellor. Project Technology, Inc.

Decentralised diagnosis of discrete-event systems: application to telecommunication network

Testing & Verification of Digital Circuits ECE/CS 5745/6745. Hardware Verification using Symbolic Computation

Testing automation of projects in telecommunication domain

ACT. of 15 March 2002

Know or Go Practical Quest for Reliable Software

Adversary Modelling 1

Software Testing. Definition: Testing is a process of executing a program with data, with the sole intention of finding errors in the program.

Case studies: Outline. Requirement Engineering. Case Study: Automated Banking System. UML and Case Studies ITNP090 - Object Oriented Software Design

Fundamentals of Software Engineering

Transcription:

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. 7, 2008 Cape Town, South Africa Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 1 / 28

Plan 1 Formal Methods 2 Contracts and Informatics Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 2 / 28

Plan 1 Formal Methods 2 Contracts and Informatics Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 3 / 28

How to Guarantee Correctness? Is it possible at all? How to show a system is correct? It is not enough to show that it can meet its requirement We should show that a system cannot fail to meet its requirement By testing? Dijkstra wrote (1972): Program testing can be used to show the presence of bugs, but never to show their absence By other kind of proof? Dijkstra again (1965): One can never guarantee that a proof is correct, the best one can say is: I have not discovered any mistakes What about automatic proof? It is impossible to construct a general proof procedure for arbitrary programs 1 Any hope? 1 Undecidability of the halting problem, by Turing. university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 4 / 28

How to Guarantee Correctness? Is it possible at all? How to show a system is correct? It is not enough to show that it can meet its requirement We should show that a system cannot fail to meet its requirement By testing? Dijkstra wrote (1972): Program testing can be used to show the presence of bugs, but never to show their absence By other kind of proof? Dijkstra again (1965): One can never guarantee that a proof is correct, the best one can say is: I have not discovered any mistakes What about automatic proof? It is impossible to construct a general proof procedure for arbitrary programs 1 Any hope? 1 Undecidability of the halting problem, by Turing. university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 4 / 28

How to Guarantee Correctness? Is it possible at all? How to show a system is correct? It is not enough to show that it can meet its requirement We should show that a system cannot fail to meet its requirement By testing? Dijkstra wrote (1972): Program testing can be used to show the presence of bugs, but never to show their absence By other kind of proof? Dijkstra again (1965): One can never guarantee that a proof is correct, the best one can say is: I have not discovered any mistakes What about automatic proof? It is impossible to construct a general proof procedure for arbitrary programs 1 Any hope? In some cases it is possible to mechanically verify correctness; 1 Undecidability of the halting problem, by Turing. university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 4 / 28

How to Guarantee Correctness? Is it possible at all? How to show a system is correct? It is not enough to show that it can meet its requirement We should show that a system cannot fail to meet its requirement By testing? Dijkstra wrote (1972): Program testing can be used to show the presence of bugs, but never to show their absence By other kind of proof? Dijkstra again (1965): One can never guarantee that a proof is correct, the best one can say is: I have not discovered any mistakes What about automatic proof? It is impossible to construct a general proof procedure for arbitrary programs 1 Any hope? In some cases it is possible to mechanically verify correctness; in other cases... we try to do our best 1 Undecidability of the halting problem, by Turing. university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 4 / 28

System Correctness A system is correct if it meets its design requirements Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 5 / 28

System Correctness Example A system is correct if it meets its design requirements System: A telephone system Requirement: If user A want to call user B, then eventually (s)he will manage to establish a connection a Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 5 / 28

System Correctness Example A system is correct if it meets its design requirements System: A telephone system Requirement: If user A want to call user B, then eventually (s)he will manage to establish a connection System: An operating system Requirement: A deadly embrace a will never happen a A deadly embrace is entered when two processes obtain access to two mutually dependent shared resources and each decide to wait indefinitely for the other Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 5 / 28

System Correctness Example A system is correct if it meets its design requirements System: A telephone system Requirement: If user A want to call user B, then eventually (s)he will manage to establish a connection System: An operating system Requirement: A deadly embrace a will never happen System: A contract for Internet services Requirement: Signatory A will never be obliged to pay more than a certain amount of money a A deadly embrace is entered when two processes obtain access to two mutually dependent shared resources and each decide to wait indefinitely for the other Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 5 / 28

System Correctness Example A system is correct if it meets its design requirements System: A telephone system Requirement: If user A want to call user B, then eventually (s)he will manage to establish a connection System: An operating system Requirement: A deadly embrace a will never happen System: A contract for Internet services Requirement: Signatory A will never be obliged to pay more than a certain amount of money a A deadly embrace is entered when two processes obtain access to two mutually dependent shared resources and each decide to wait indefinitely for the other Saying a program is correct is only meaningful w.r.t. a given specification! university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 5 / 28

What is Validation? In general, validation is the process of checking if something satisfies a certain criterion Some authors differentiate validation and verification: Validation: "Are we building the right product?", i.e., does the product do what the user really requires Verification: "Are we building the product right?", i.e., does the product conform to the specifications Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 6 / 28

What is Validation? In general, validation is the process of checking if something satisfies a certain criterion Some authors differentiate validation and verification: Validation: "Are we building the right product?", i.e., does the product do what the user really requires Verification: "Are we building the product right?", i.e., does the product conform to the specifications Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 6 / 28

What is Validation? In general, validation is the process of checking if something satisfies a certain criterion Some authors differentiate validation and verification: Validation: "Are we building the right product?", i.e., does the product do what the user really requires Verification: "Are we building the product right?", i.e., does the product conform to the specifications Remark Some authors define verification as a validation technique, others talk about V & V Validation & Verification as being complementary techniques. In this tutorial I consider verification as a validation technique university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 6 / 28

Usual Approaches for Validation The following techniques are used in industry for validation: Testing Check the actual system rather than a model Focused on sampling executions according to some coverage criteria Not exhaustive It is usually informal, though there are some formal approaches Simulation A model of the system is written in a PL, which is run with different inputs Not exhaustive Verification Is the process of applying a manual or automatic technique for establishing whether a given system satisfies a given property or behaves in accordance to some abstract description (specification) of the system 2 2 From Peled s book Software reliability methods. university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 7 / 28

Usual Approaches for Validation The following techniques are used in industry for validation: Testing Check the actual system rather than a model Focused on sampling executions according to some coverage criteria Not exhaustive It is usually informal, though there are some formal approaches Simulation A model of the system is written in a PL, which is run with different inputs Not exhaustive Verification Is the process of applying a manual or automatic technique for establishing whether a given system satisfies a given property or behaves in accordance to some abstract description (specification) of the system 2 2 From Peled s book Software reliability methods. university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 7 / 28

Usual Approaches for Validation The following techniques are used in industry for validation: Testing Check the actual system rather than a model Focused on sampling executions according to some coverage criteria Not exhaustive It is usually informal, though there are some formal approaches Simulation A model of the system is written in a PL, which is run with different inputs Not exhaustive Verification Is the process of applying a manual or automatic technique for establishing whether a given system satisfies a given property or behaves in accordance to some abstract description (specification) of the system 2 2 From Peled s book Software reliability methods. university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 7 / 28

Usual Approaches for Validation The following techniques are used in industry for validation: Testing Check the actual system rather than a model Focused on sampling executions according to some coverage criteria Not exhaustive It is usually informal, though there are some formal approaches Simulation A model of the system is written in a PL, which is run with different inputs Not exhaustive Verification Is the process of applying a manual or automatic technique for establishing whether a given system satisfies a given property or behaves in accordance to some abstract description (specification) of the system 2 2 From Peled s book Software reliability methods. university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 7 / 28

What are Formal Methods? Formal methods are a collection of notations and techniques for describing and analyzing systems 3 Formal means the methods used are based on mathematical theories, such as logic, automata, graph or set theory Formal specification techniques are used to unambiguously describe the system itself or its properties Formal analysis/verification techniques serve to verify that a system satisfies its specification (or to help finding out why it is not the case) 3 From D.Peled s book Software Reliability Methods. university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 8 / 28

What are Formal Methods? Formal methods are a collection of notations and techniques for describing and analyzing systems 3 Formal means the methods used are based on mathematical theories, such as logic, automata, graph or set theory Formal specification techniques are used to unambiguously describe the system itself or its properties Formal analysis/verification techniques serve to verify that a system satisfies its specification (or to help finding out why it is not the case) 3 From D.Peled s book Software Reliability Methods. university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 8 / 28

What are Formal Methods? Formal methods are a collection of notations and techniques for describing and analyzing systems 3 Formal means the methods used are based on mathematical theories, such as logic, automata, graph or set theory Formal specification techniques are used to unambiguously describe the system itself or its properties Formal analysis/verification techniques serve to verify that a system satisfies its specification (or to help finding out why it is not the case) 3 From D.Peled s book Software Reliability Methods. university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 8 / 28

Limitations Software verification methods do not guarantee, in general, the correctness of the code itself but rather of an abstract model of it It cannot identify fabrication faults (e.g. in digital circuits) If the specification is incomplete or wrong, the verification result will also be wrong The implementation of verification tools may be faulty The bigger the system (number of possible states) more difficult is to analyze it (state explosion problem) Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 9 / 28

Any advantage? Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 10 / 28

Any advantage? OF COURSE!! Formal methods are not intended to guarantee absolute reliability but to increase the confidence on system reliability. They help minimizing the number of errors and in many cases allow to find errors impossible to find manually Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 10 / 28

Using Formal Methods Formal methods are used in different stages of the development process, giving a classification of formal methods 1 We describe the system giving a formal specification 2 We can then prove some properties about the specification (formal verification) 3 We can proceed by: Deriving a program from its specification (formal synthesis) Verifying the specification w.r.t. implementation (formal verification) Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 11 / 28

Formal Specification A specification formalism must be unambiguous: it should have a precise syntax and semantics (e.g., natural languages are not suitable) A trade-off must be found between expressiveness and analysis feasibility More expressive the specification formalism more difficult its analysis (if possible at all) Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 12 / 28

Proving Properties about the Specification To gain confidence about the correctness of a specification it is useful to: Prove some properties of the specification to check that it really means what it is supposed to Prove the equivalence of different specifications Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 13 / 28

Proving Properties about the Specification To gain confidence about the correctness of a specification it is useful to: Prove some properties of the specification to check that it really means what it is supposed to Example Prove the equivalence of different specifications a should be true for the first two points of time, and then oscillates First attempt: a(0) a(1) t a(t + 1) = a(t) Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 13 / 28

Proving Properties about the Specification To gain confidence about the correctness of a specification it is useful to: Prove some properties of the specification to check that it really means what it is supposed to Example Prove the equivalence of different specifications a should be true for the first two points of time, and then oscillates First attempt: a(0) a(1) t a(t + 1) = a(t) INCORRECT! - The error may be found when trying to prove some properties Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 13 / 28

Proving Properties about the Specification To gain confidence about the correctness of a specification it is useful to: Prove some properties of the specification to check that it really means what it is supposed to Example Prove the equivalence of different specifications a should be true for the first two points of time, and then oscillates First attempt: a(0) a(1) t a(t + 1) = a(t) INCORRECT! - The error may be found when trying to prove some properties Correct specification: a(0) a(1) t 0 a(t + 2) = a(t + 1) Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 13 / 28

Formal synthesis It would be helpful to automatically obtain an implementation from the specification of a system Difficult since most specifications are declarative and not constructive They usually describe what the system should do; not how it can be achieved Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 14 / 28

Formal synthesis It would be helpful to automatically obtain an implementation from the specification of a system Difficult since most specifications are declarative and not constructive They usually describe what the system should do; not how it can be achieved Example 1 Specify the operational semantics of a programming language in a constructive logic (Calculus of Constructions) 2 Prove the correctness of a given property w.r.t. the operational semantics in Coq 3 Extract an OCAML code from the correctness proof (using Coq s extraction mechanism) Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 14 / 28

Verifying Specifications w.r.t. Implementations There are mainly two approaches: Deductive approach (automated theorem proving) Describe the specification Φ spec in a formal model (logic) Describe the system s model Φ imp in the same formal model Prove that Φ imp = Φ spec Algorithmic approach Describe the specification Φ spec as a formula of a logic Describe the system as an interpretation M imp of the given logic (e.g. as a finite automaton) Prove that M imp is a model (in the logical sense) of Φ spec Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 15 / 28

Verifying Specifications w.r.t. Implementations There are mainly two approaches: Deductive approach (automated theorem proving) Describe the specification Φ spec in a formal model (logic) Describe the system s model Φ imp in the same formal model Prove that Φ imp = Φ spec Algorithmic approach Describe the specification Φ spec as a formula of a logic Describe the system as an interpretation M imp of the given logic (e.g. as a finite automaton) Prove that M imp is a model (in the logical sense) of Φ spec Remark The same technique may be used to prove properties about the specification university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 15 / 28

When and Which Formal Method to Use? It depends on the problem, the underlying system and the property we want to prove Examples: Digital circuits... (BDDs, model checking) Communication protocol with unbounded number of processes... (verification of infinite-state systems) Overflow in programs (static analysis and abstract interpretation)... Open distributed concurrent systems with unbounded number of processes interacting through shared variables and with real-time constraints => VERY DIFFICULT!! Need the combination of different techniques Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 16 / 28

When and Which Formal Method to Use? It depends on the problem, the underlying system and the property we want to prove Examples: Digital circuits... (BDDs, model checking) Communication protocol with unbounded number of processes... (verification of infinite-state systems) Overflow in programs (static analysis and abstract interpretation)... Open distributed concurrent systems with unbounded number of processes interacting through shared variables and with real-time constraints => VERY DIFFICULT!! Need the combination of different techniques Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 16 / 28

When and Which Formal Method to Use? It depends on the problem, the underlying system and the property we want to prove Examples: Digital circuits... (BDDs, model checking) Communication protocol with unbounded number of processes... (verification of infinite-state systems) Overflow in programs (static analysis and abstract interpretation)... Open distributed concurrent systems with unbounded number of processes interacting through shared variables and with real-time constraints => VERY DIFFICULT!! Need the combination of different techniques Remark In this tutorial: Specification and verification of contracts using logics and model checking techniques university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 16 / 28

Plan 1 Formal Methods 2 Contracts and Informatics Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 17 / 28

Contracts A contract is a binding agreement between two or more persons that is enforceable by law. [Webster on-line] Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 18 / 28

Contracts A contract is a binding agreement between two or more persons that is enforceable by law. [Webster on-line] This deed of Agreement is made between: 1. [name], from now on referred to as Provider and 2. the Client. INTRODUCTION 3. The Provider is obliged to provide the Internet Services as stipulated in this Agreement. 4. DEFINITIONS a) Internet traffic may be measured by both Client and Provider by means of Equipment and may take the two values high and normal. OPERATIVE PART 1. The Client shall not supply false information to the Client Relations Department of the Provider. 2. Whenever the Internet Traffic is high then the Client must pay [price] immediately, or the Client must notify the Provider by sending an e-mail specifying that he will pay later. 3. If the Client delays the payment as stipulated in 2, after notification he must immediately lower the Internet traffic to the normal level, and pay later twice (2 [price]). 4. If the Client does not lower the Internet traffic immediately, then the Client will have to pay 3 [price]. 5. The Client shall, as soon as the Internet Service becomes operative, submit within seven (7) university-log days the Personal Data Form from his account on the Provider s web page to the Client Relations Department of the Provider. Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 18 / 28

Contracts and Informatics 1 Conventional contracts Traditional commercial and judicial domain Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 19 / 28

Contracts and Informatics 1 Conventional contracts Traditional commercial and judicial domain 2 Programming by contract or Design by contract (e.g., Eiffel) Relation between pre- and post-conditions of routines, method calls, invariants, temporal dependencies, etc Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 19 / 28

Contracts and Informatics 1 Conventional contracts Traditional commercial and judicial domain 2 Programming by contract or Design by contract (e.g., Eiffel) Relation between pre- and post-conditions of routines, method calls, invariants, temporal dependencies, etc 3 In the context of web services (SOA) Service-Level Agreement, usually written in an XML-like language (e.g. WSLA) Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 19 / 28

Contracts and Informatics 1 Conventional contracts Traditional commercial and judicial domain 2 Programming by contract or Design by contract (e.g., Eiffel) Relation between pre- and post-conditions of routines, method calls, invariants, temporal dependencies, etc 3 In the context of web services (SOA) Service-Level Agreement, usually written in an XML-like language (e.g. WSLA) 4 Behavioral interfaces Specify the sequence of interactions between different participants. The allowed interactions are captured by legal (sets of) traces Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 19 / 28

Contracts and Informatics 1 Conventional contracts Traditional commercial and judicial domain 2 Programming by contract or Design by contract (e.g., Eiffel) Relation between pre- and post-conditions of routines, method calls, invariants, temporal dependencies, etc 3 In the context of web services (SOA) Service-Level Agreement, usually written in an XML-like language (e.g. WSLA) 4 Behavioral interfaces Specify the sequence of interactions between different participants. The allowed interactions are captured by legal (sets of) traces 5 Contractual protocols To specify the interaction between communicating entities Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 19 / 28

Contracts and Informatics 1 Conventional contracts Traditional commercial and judicial domain 2 Programming by contract or Design by contract (e.g., Eiffel) Relation between pre- and post-conditions of routines, method calls, invariants, temporal dependencies, etc 3 In the context of web services (SOA) Service-Level Agreement, usually written in an XML-like language (e.g. WSLA) 4 Behavioral interfaces Specify the sequence of interactions between different participants. The allowed interactions are captured by legal (sets of) traces 5 Contractual protocols To specify the interaction between communicating entities 6 Social contracts : Multi-agent systems Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 19 / 28

Contracts and Informatics 1 Conventional contracts Traditional commercial and judicial domain 2 Programming by contract or Design by contract (e.g., Eiffel) Relation between pre- and post-conditions of routines, method calls, invariants, temporal dependencies, etc 3 In the context of web services (SOA) Service-Level Agreement, usually written in an XML-like language (e.g. WSLA) 4 Behavioral interfaces Specify the sequence of interactions between different participants. The allowed interactions are captured by legal (sets of) traces 5 Contractual protocols To specify the interaction between communicating entities 6 Social contracts : Multi-agent systems 7 Deontic e-contracts : representing Obligations, Permissions, Prohibitions, Power, etc university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 19 / 28

Conventional contracts Traditional commercial and judicial domain Research on Law and Informatics Interesting questions: Is it possible translate conventional contracts into formal languages/logics? Which properties are preserved? How to analyze traditional contracts? Detect superfluous clauses, cross references, inconsistencies, etc? Tools A nice successful story Jean-Marc Eber and Simon Peyton-Jones paper How to write a financial contract Eber s startup: Lexifi Technologies Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 20 / 28

Conventional contracts Traditional commercial and judicial domain Research on Law and Informatics Interesting questions: Is it possible translate conventional contracts into formal languages/logics? Which properties are preserved? How to analyze traditional contracts? Detect superfluous clauses, cross references, inconsistencies, etc? Tools A nice successful story Jean-Marc Eber and Simon Peyton-Jones paper How to write a financial contract Eber s startup: Lexifi Technologies Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 20 / 28

Conventional contracts Traditional commercial and judicial domain Research on Law and Informatics Interesting questions: Is it possible translate conventional contracts into formal languages/logics? Which properties are preserved? How to analyze traditional contracts? Detect superfluous clauses, cross references, inconsistencies, etc? Tools A nice successful story Jean-Marc Eber and Simon Peyton-Jones paper How to write a financial contract Eber s startup: Lexifi Technologies Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 20 / 28

Programming by contract The term originated with the language Eiffel ( Programming by contract or Design by contract ) Used in the context of Object-Oriented Programming Software designers should define precise verifiable interface specifications for software components Based on the theory of abstract data types Inspired by business contracts Impose an obligation to be guaranteed when calling a module: the routine s precondition An obligation for the client, and a benefit for the supplier (of the routine) Guarantee a property on exit: the routine s postcondition An obligation for the supplier, and a benefit for the client Maintain a property, assumed on entry and guaranteed on exit: the class invariant university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 21 / 28

Programming by contract The term originated with the language Eiffel ( Programming by contract or Design by contract ) Used in the context of Object-Oriented Programming Software designers should define precise verifiable interface specifications for software components Based on the theory of abstract data types Inspired by business contracts Impose an obligation to be guaranteed when calling a module: the routine s precondition An obligation for the client, and a benefit for the supplier (of the routine) Guarantee a property on exit: the routine s postcondition An obligation for the supplier, and a benefit for the client Maintain a property, assumed on entry and guaranteed on exit: the class invariant university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 21 / 28

Programming by contract The term originated with the language Eiffel ( Programming by contract or Design by contract ) Used in the context of Object-Oriented Programming Software designers should define precise verifiable interface specifications for software components Based on the theory of abstract data types Inspired by business contracts Impose an obligation to be guaranteed when calling a module: the routine s precondition An obligation for the client, and a benefit for the supplier (of the routine) Guarantee a property on exit: the routine s postcondition An obligation for the supplier, and a benefit for the client Maintain a property, assumed on entry and guaranteed on exit: the class invariant university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 21 / 28

Contracts in the Context of SOA Several SOA standards provide a way to describe contractual aspects Usually written in an XML-like language (e.g. WSLA) These service contracts act at different levels, specific to different aspects Between service provider and consumer Orchestration of services Functional aspects Describe collaboration between business partners Service-Level Agreement It describes different levels of service Availability, serviceability, performance, operation, other attributes like billing and even penalties in the case of violation Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 22 / 28

Contracts in the Context of SOA Several SOA standards provide a way to describe contractual aspects Usually written in an XML-like language (e.g. WSLA) These service contracts act at different levels, specific to different aspects Between service provider and consumer Orchestration of services Functional aspects Describe collaboration between business partners Service-Level Agreement It describes different levels of service Availability, serviceability, performance, operation, other attributes like billing and even penalties in the case of violation Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 22 / 28

Contracts in the Context of SOA Several SOA standards provide a way to describe contractual aspects Usually written in an XML-like language (e.g. WSLA) These service contracts act at different levels, specific to different aspects Between service provider and consumer Orchestration of services Functional aspects Describe collaboration between business partners Service-Level Agreement It describes different levels of service Availability, serviceability, performance, operation, other attributes like billing and even penalties in the case of violation Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 22 / 28

Contracts in the Context of SOA Several SOA standards provide a way to describe contractual aspects Usually written in an XML-like language (e.g. WSLA) These service contracts act at different levels, specific to different aspects Between service provider and consumer Orchestration of services Functional aspects Describe collaboration between business partners Service-Level Agreement It describes different levels of service Availability, serviceability, performance, operation, other attributes like billing and even penalties in the case of violation Note We will expand on a taxonomy of SOA contract specification languages in next lecture university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 22 / 28

Behavioral interfaces Specify the sequence of interactions between different participants Such interface represents a contract between the participants The allowed interactions are captured by legal (sets of) traces The behavior of objects and components can be completely defined in terms of their reaction to incoming message sequences Advantages: Different objects and component implementations can be compared based on their behavior It helps analyzing compositionality of components It is possible to analyze component implementations without knowing the context Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 23 / 28

Behavioral interfaces Specify the sequence of interactions between different participants Such interface represents a contract between the participants The allowed interactions are captured by legal (sets of) traces The behavior of objects and components can be completely defined in terms of their reaction to incoming message sequences Advantages: Different objects and component implementations can be compared based on their behavior It helps analyzing compositionality of components It is possible to analyze component implementations without knowing the context Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 23 / 28

Contractual protocols Protocols may be seen as contracts regulating the parties ideal mode of interaction Other names for the same kind of contracts Trade procedures Business protocols Specifications This definition of a contract could be mostly seen as a specification Usually one specify the point of view of each party as a Finite State Machine or Petri net Sometimes the contract is not explicit, but implicit in the interaction of the parties Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 24 / 28

Contractual protocols Protocols may be seen as contracts regulating the parties ideal mode of interaction Other names for the same kind of contracts Trade procedures Business protocols Specifications This definition of a contract could be mostly seen as a specification Usually one specify the point of view of each party as a Finite State Machine or Petri net Sometimes the contract is not explicit, but implicit in the interaction of the parties Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 24 / 28

Social contracts Based on different modal logics In the context of multi-agent systems Aim at simulate/specify social behavior Interaction between agents who can decide based on knowledge and trust on other agents Agents act according to certain normative rules prescribing: Proper and acceptable behavior (moral) Acceptable behavior (legal) Very expressive: It considers various types of norms What ought to be Expectation on what will be Particular reactions to behavior Sanctions to be applied, or how to induce a particular kind of conduct Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 25 / 28

Social contracts Based on different modal logics In the context of multi-agent systems Aim at simulate/specify social behavior Interaction between agents who can decide based on knowledge and trust on other agents Agents act according to certain normative rules prescribing: Proper and acceptable behavior (moral) Acceptable behavior (legal) Very expressive: It considers various types of norms What ought to be Expectation on what will be Particular reactions to behavior Sanctions to be applied, or how to induce a particular kind of conduct Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 25 / 28

Social contracts Based on different modal logics In the context of multi-agent systems Aim at simulate/specify social behavior Interaction between agents who can decide based on knowledge and trust on other agents Agents act according to certain normative rules prescribing: Proper and acceptable behavior (moral) Acceptable behavior (legal) Very expressive: It considers various types of norms What ought to be Expectation on what will be Particular reactions to behavior Sanctions to be applied, or how to induce a particular kind of conduct Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 25 / 28

Electronic deontic contracts Based on deontic logic and combined with other modal logics It contains constructs to specify at least Obligations, Permissions, and Prohibitions A contract can be obtained From a conventional contract Written directly in a formal specification language It allows formal reasoning Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 26 / 28

Contracts In this tutorial We will see deontic e-contracts Two scenarios: 1 Obtain an e-contract from a conventional contract Context: legal (e.g. financial) contracts 2 Write the e-contract directly in a formal language Context: web services, components, OO, etc Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 27 / 28

Contracts In this tutorial We will see deontic e-contracts Two scenarios: 1 Obtain an e-contract from a conventional contract Context: legal (e.g. financial) contracts 2 Write the e-contract directly in a formal language Context: web services, components, OO, etc Definition A contract is a document which engages several parties in a transaction and stipulates their (conditional) obligations, rights, and prohibitions, as well as penalties in case of contract violations. university-log Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 27 / 28

Links and Papers Introduction to Formal Methods: See first lecture of the course Specification and verification of parallel systems (INF5140) and references therein: http://www.uio.no/studier/emner/matnat/ifi/ INF5140/v07/undervisningsmateriale/1-formal-methods.pdf Gerardo Schneider (UiO) Specification and Analysis of e-contracts SEFM, 3-7 Nov 2008 28 / 28