SlideShare uma empresa Scribd logo
1 de 25
Baixar para ler offline
Contract Automata
Towards an Algebra of Contracts
Gordon J. Pace
Department of Computer Science
University of Malta
Malta
March 2016
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
What’s so Interesting about Contracts?
Normative notions — ideal vs actual behaviour.
Enabling representation of concepts such as obligations,
prohibitions permissions, and exceptional behaviour.
Ought-to-do or ought-to-be?
Plagued by paradoxes unless one is very careful and restricts
the language.
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Paradox of Blame
Paradox of Blame
The law says: You are obliged to hand in Form A on Monday and
Form B on Tuesday, unless officials stop you from doing so.
But it’s sunny outside: On Monday, John spent a day on the
beach, thus not handing in Form A. On Tuesday at 00:00 he was
arrested, and taken to court on Wednesday.
Prosecuting lawyer: To satisfy his obligation the defendant had
to hand in Form A on Monday, which he did not. Hence he should
be found guilty.
Defendant’s lawyer: But to satisfy the obligation the defendant
had to hand in Form B on Tuesday, which he was stopped from
doing by officials. He is hence innocent.
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Contracts vs. Specifications
What are contracts, and are they different from properties or
specifications?
Obligation to perform x related to the property ‘action taken
must include x’
Prohibition from performing x related to the property ‘action
taken may not include x’
But what are permission to perform x? Actions may include
x? What are violations?
And what about liability?
Or exceptional (non-ideal) behaviour?
Contracts are by definition an agreement between two or more
interacting parties but most formal studies regulate a party at
a time.
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Contract clause #1
“John is permitted to withdraw cash.”
John may choose to perform an action ‘withdraw cash’,
which the bank is bound to engage with.
John may also choose not to perform the action.
but if he does and the bank does not allow the bank has
violated the contract.
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Contract clause #2
“John is obliged to pay an annual fee.”
John should perform an action ‘pay annual fee’,
If John chooses not to perform the action, he has violated the
contract.
But the bank is bound to engage with John’s action to allow
him to satisfy the contract.
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Interacting Systems
Interaction has a long history in computer science providing
tools such as communication and synchronisation which allow
the modelling of directed modalities in a two-party contract
setting.
We formalise two-party contracts modelling interaction using
synchronous composition with multiset-actions.
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Synchronous Composition over Multisets of Actions
The synchronous composition of two automata
Si = Qi , q0i , →i synchronising over alphabet G, is written
S1 G S2, is defined to be Q1 × Q2, (q01, q02), → .
q1
A
−→1 q1
(q1, q2)
A
−→ (q1, q2)
A ∩ G = ∅
q2
A
−→2 q2
(q1, q2)
A
−→ (q1, q2)
A ∩ G = ∅
q1
A
−→1 q1 q2
B
−→2 q2
(q1, q2)
A∪B
−−−→ (q1, q2)
A ∩ G = B ∩ G = ∅
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
But What About the Contract?
Contracts are also encoded as automata with states tagged
with the contract clauses that will be in force at that point.
Contract
“Initially, the user (party u) is forbidden from using the service but
permitted to pay after which the provider (party p) is obliged to
provide the service.”
Pu(pay), Fu(service) Op(service)
∅
{service}
{pay}
{pay, service}
anything
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Contract Automata
A contract clause is one of the following:
Clause ::= Op(a) | Op(!a) | Pp(a) | Pp(!a)
A contract automaton is a normal automaton with an
additional function Q → 2Clause.
The transition relation of contract automata is always total to
ensure no deadlock, even after a violation occurs.
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Contract Automata
A contract clause is one of the following:
Clause ::= Op(a) | Op(!a) | Pp(a) | Pp(!a)
A contract automaton is a normal automaton with an
additional function Q → 2Clause.
The transition relation of contract automata is always total to
ensure no deadlock, even after a violation occurs.
Prohibition
Prohibition Fp(a) is just Op(!a).
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Contract Automata
A contract clause is one of the following:
Clause ::= Op(a) | Op(!a) | Pp(a) | Pp(!a)
A contract automaton is a normal automaton with an
additional function Q → 2Clause.
The transition relation of contract automata is always total to
ensure no deadlock, even after a violation occurs.
Negative clauses
!Op(x) = Pp(!x)
!Pp(a) = Op(!a)
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Regulated Two-Party Systems
A regulated two-party system synchronising over the set of
actions G consists of three parts: (i) the interacting systems
S1 and S2 and (ii) the contract A.
By composing the contract automaton A with the parties’
behaviour we can then identify what clauses are in force and
when, hence allowing analysis for contract violation:
(S1 G S2) ΣA.
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Contract Violation
Given a regulated two-party system, we can now analyse the
system automata with respect to the contract clauses and tag
violations and the responsible party.
Violations can occur on:
Transitions: e.g. a transition which contains an action which
is prohibited at that point.
States: e.g. a state in which a party does not permit (allow)
the other party to perform an action which should be
permitted.
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Obligations
Obligation Op(a) brings in constraints on both parties:
1. party p must include the action in any outgoing transition in
the composed system; and
2. the other party p must provide a viable action set which allows
p to perform all its obligation.
The former marks transitions as violations, whereas the latter
marks states.
viablep(qA, A)
df
= Op(qA) ⊆ A ∧ Fp(qA) ∩ A = ∅
satO
p ((q1, q2)qA
A
−→ (q1, q2)qA
)
df
= viablep(qA, A)
satO
p ((q1, q2)qA )
df
= ∃A ∈ acts(qp), A ⊆ Gc · viablep(qA, A ∪ A )
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Permissions
If party p is permitted to perform shared action a, then the
other party p must provide p with at least one viable outgoing
transition which contains a but does not include any forbidden
actions.
Violations of a permission occur when no appropriate action is
possible, and is thus a property of a state not a transition.
We use a semantics that tags as a violation a state in which
one party is permitted to perform an action, while the other
provides no way of actually doing so.
(q1, q2)qA p Pp(a)
df
= true
(q1, q2)qA p Pp(a)
df
=
a ∈ G =⇒ ∃A ∈ acts(qp), A ⊆ Gc
· a ∈ A ∧ viablep(qA, A ∪ A )
satP
p ((q1, q2)qA
)
df
= ∀Pp(x) ∈ qA · (q1, q2)qA p Pp(x)
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Breach-incapability
A regulated system gives an automaton of all potential
behaviours when composed.
It is breach-incapable if no violating states and/or transitions
are reachable from the initial state.
This is stronger than being compliant for one specific run.
correct(p, R)
df
=
(∀q ∈ reachableS (R) · satp(q)) ∧ (∀t ∈ reachableT (R) · satp(t))
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Ordering of contracts based on leniency
A contract A is more lenient than another contract A for a
particular party p (A p A ) if any system behaviour of p
which may violate A may also violate A .
This definition allows us to characterise the notion of contract
equivalence for a particular party or even for all parties.
A p A
df
= ∀S1, S2 · correct(p, S1, S2 A ) =⇒ correct(p, S1, S2 A)
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Pp(c)
Op(a)
{a} or {b} or ∅
{a, b}
anything
p
Pp(c) Op(a)
Op(a), Pp(b)
{a} or ∅
{a, b}
{b}
{a} or {b} or ∅
{a, b}
anything
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Conflicts in Contracts
Axiom 1: Opposite permissions conflict: Pp(x) !Pp(x).
Axiom 2: Obligation to perform mutually exclusive actions is a
conflict: a b Op(a) Op(b).
Axiom 3: Conflicts are closed under symmetry: C C C C.
Axiom 4: Conflicts are closed under increased strictness:
C C ∧ C C C C .
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
John and his Bank
The contract says that (i) whenever he is logged into his Internet
banking account, he is to be permitted to make money transfers;
and (ii) if a malicious attempt to log in to his account is identified,
logging in and making transfers will be prohibited until the
situation is cleared.
Fj (transfer) Pj (transfer) Pj (login) Fj (login), Fj (transfer)
login
logout
malicious
cleared
Note what happens after {login, malicious} in the composition of
these contracts.
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Adding Reparations
Some reparations can be ‘handled’ by contract automata.
e.g. “The passenger is obliged to show a means of
identification when presenting the ticket, and would otherwise
be prohibited from boarding.”
Op(proveIdentity)start
Fp(boardPlane)
{showTicket, proveIdentity}
{showTicket}
But with such an encoding, we have no notion of which
transitions are violating ones.
And even worse, we cannot express a reparation of a
permission in this manner.
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Reparations
Pp(boardPlane)
Pp(handLuggage)
Pp(coat)
Pp(report)
Oc (inCargo)
Pp(report)
Oc (inCargo)
Op(switchOffDevices)
Vc (Pp(coat)) {boardPlane} ok {boardPlane}
Vc (Pp(handLuggage)) {boardPlane} Vc (Pp(coat)) ∧ Vc (Pp(handLuggage)) {boardPlane}
By tagging each transition with which clauses would have to
be violated to take that transition, we can model reparations.
In addition, we can talk about hypothetical reparations.
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Discussion
By keeping the contract as a separate automaton:
We share the same formalism and theory as for systems;
We are able to reason about contracts independently of the
system — e.g. compose contracts using synchronous
composition
Although we can reduce a regulated system to a single
automaton, by keeping the original systems and contract as
automaton we keep the system behaviours separate and
intact. Permission can only be deduced with this
unadulterated behaviour.
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
Conclusions
The main contributions of this work are:
A formalisation of the meaning of directed deontic operators in
a two-party setting;
The use of standard techniques from computer science, namely
communication and synchronisation, to analyse contracts
regulating two parties.
Practically all the work done on directed obligations and
permissions introduces new modalities such as intention,
causality, etc.
We are now looking into how much further such an
automaton based approach supports contract analysis, and
extending it to deal with multi-party (n > 2) systems.
Gordon J. Pace Contract AutomataTowards an Algebra of Contracts

Mais conteúdo relacionado

Mais procurados

Free consent
Free consentFree consent
Free consentGurjit
 
Contract act----by sumit mukherjee
Contract act----by sumit  mukherjeeContract act----by sumit  mukherjee
Contract act----by sumit mukherjeesumit mukherjee
 
Law (free consent)
Law (free consent)Law (free consent)
Law (free consent)Iqra Nawaz
 
PRC Contract Law Principles and Risk Management in Contract Drafting
PRC Contract Law Principles and Risk Management in Contract DraftingPRC Contract Law Principles and Risk Management in Contract Drafting
PRC Contract Law Principles and Risk Management in Contract DraftingRHKLegal
 
Free consent
Free  consentFree  consent
Free consentArun SP
 
Free consent By RAZI ANWAR
Free consent By RAZI ANWARFree consent By RAZI ANWAR
Free consent By RAZI ANWARRaj HeartHacker
 
Consent & mistake in Contracts
Consent & mistake in ContractsConsent & mistake in Contracts
Consent & mistake in ContractsShivani Sharma
 
Misrepresentation and fraud
Misrepresentation and fraudMisrepresentation and fraud
Misrepresentation and fraudnishna sathyan
 

Mais procurados (11)

Free consent
Free consentFree consent
Free consent
 
Contract act----by sumit mukherjee
Contract act----by sumit  mukherjeeContract act----by sumit  mukherjee
Contract act----by sumit mukherjee
 
Law (free consent)
Law (free consent)Law (free consent)
Law (free consent)
 
Free consent
Free consentFree consent
Free consent
 
PRC Contract Law Principles and Risk Management in Contract Drafting
PRC Contract Law Principles and Risk Management in Contract DraftingPRC Contract Law Principles and Risk Management in Contract Drafting
PRC Contract Law Principles and Risk Management in Contract Drafting
 
free Consent
free Consentfree Consent
free Consent
 
free consent
free consentfree consent
free consent
 
Free consent
Free  consentFree  consent
Free consent
 
Free consent By RAZI ANWAR
Free consent By RAZI ANWARFree consent By RAZI ANWAR
Free consent By RAZI ANWAR
 
Consent & mistake in Contracts
Consent & mistake in ContractsConsent & mistake in Contracts
Consent & mistake in Contracts
 
Misrepresentation and fraud
Misrepresentation and fraudMisrepresentation and fraud
Misrepresentation and fraud
 

Destaque

Domain Modeling with Functions - an algebraic approach
Domain Modeling with Functions - an algebraic approachDomain Modeling with Functions - an algebraic approach
Domain Modeling with Functions - an algebraic approachDebasish Ghosh
 
An Algebraic Approach to Functional Domain Modeling
An Algebraic Approach to Functional Domain ModelingAn Algebraic Approach to Functional Domain Modeling
An Algebraic Approach to Functional Domain ModelingDebasish Ghosh
 
Basic Algebra (for beginners)
Basic Algebra (for beginners)Basic Algebra (for beginners)
Basic Algebra (for beginners)JaydenBadBoii
 
Application of algebra
Application of algebraApplication of algebra
Application of algebraAbhinav Somani
 
presentation on matrix
 presentation on matrix presentation on matrix
presentation on matrixNikhi Jain
 
Applications of linear algebra
Applications of linear algebraApplications of linear algebra
Applications of linear algebraPrerak Trivedi
 

Destaque (7)

Domain Modeling with Functions - an algebraic approach
Domain Modeling with Functions - an algebraic approachDomain Modeling with Functions - an algebraic approach
Domain Modeling with Functions - an algebraic approach
 
An Algebraic Approach to Functional Domain Modeling
An Algebraic Approach to Functional Domain ModelingAn Algebraic Approach to Functional Domain Modeling
An Algebraic Approach to Functional Domain Modeling
 
Basic Algebra (for beginners)
Basic Algebra (for beginners)Basic Algebra (for beginners)
Basic Algebra (for beginners)
 
BOOLEAN ALGEBRA & LOGIC GATE
BOOLEAN ALGEBRA & LOGIC GATEBOOLEAN ALGEBRA & LOGIC GATE
BOOLEAN ALGEBRA & LOGIC GATE
 
Application of algebra
Application of algebraApplication of algebra
Application of algebra
 
presentation on matrix
 presentation on matrix presentation on matrix
presentation on matrix
 
Applications of linear algebra
Applications of linear algebraApplications of linear algebra
Applications of linear algebra
 

Mais de Facultad de Informática UCM

¿Por qué debemos seguir trabajando en álgebra lineal?
¿Por qué debemos seguir trabajando en álgebra lineal?¿Por qué debemos seguir trabajando en álgebra lineal?
¿Por qué debemos seguir trabajando en álgebra lineal?Facultad de Informática UCM
 
TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...
TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...
TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...Facultad de Informática UCM
 
DRAC: Designing RISC-V-based Accelerators for next generation Computers
DRAC: Designing RISC-V-based Accelerators for next generation ComputersDRAC: Designing RISC-V-based Accelerators for next generation Computers
DRAC: Designing RISC-V-based Accelerators for next generation ComputersFacultad de Informática UCM
 
Tendencias en el diseño de procesadores con arquitectura Arm
Tendencias en el diseño de procesadores con arquitectura ArmTendencias en el diseño de procesadores con arquitectura Arm
Tendencias en el diseño de procesadores con arquitectura ArmFacultad de Informática UCM
 
Introduction to Quantum Computing and Quantum Service Oriented Computing
Introduction to Quantum Computing and Quantum Service Oriented ComputingIntroduction to Quantum Computing and Quantum Service Oriented Computing
Introduction to Quantum Computing and Quantum Service Oriented ComputingFacultad de Informática UCM
 
Inteligencia Artificial en la atención sanitaria del futuro
Inteligencia Artificial en la atención sanitaria del futuroInteligencia Artificial en la atención sanitaria del futuro
Inteligencia Artificial en la atención sanitaria del futuroFacultad de Informática UCM
 
Design Automation Approaches for Real-Time Edge Computing for Science Applic...
 Design Automation Approaches for Real-Time Edge Computing for Science Applic... Design Automation Approaches for Real-Time Edge Computing for Science Applic...
Design Automation Approaches for Real-Time Edge Computing for Science Applic...Facultad de Informática UCM
 
Estrategias de navegación para robótica móvil de campo: caso de estudio proye...
Estrategias de navegación para robótica móvil de campo: caso de estudio proye...Estrategias de navegación para robótica móvil de campo: caso de estudio proye...
Estrategias de navegación para robótica móvil de campo: caso de estudio proye...Facultad de Informática UCM
 
Fault-tolerance Quantum computation and Quantum Error Correction
Fault-tolerance Quantum computation and Quantum Error CorrectionFault-tolerance Quantum computation and Quantum Error Correction
Fault-tolerance Quantum computation and Quantum Error CorrectionFacultad de Informática UCM
 
Cómo construir un chatbot inteligente sin morir en el intento
Cómo construir un chatbot inteligente sin morir en el intentoCómo construir un chatbot inteligente sin morir en el intento
Cómo construir un chatbot inteligente sin morir en el intentoFacultad de Informática UCM
 
Automatic generation of hardware memory architectures for HPC
Automatic generation of hardware memory architectures for HPCAutomatic generation of hardware memory architectures for HPC
Automatic generation of hardware memory architectures for HPCFacultad de Informática UCM
 
Hardware/software security contracts: Principled foundations for building sec...
Hardware/software security contracts: Principled foundations for building sec...Hardware/software security contracts: Principled foundations for building sec...
Hardware/software security contracts: Principled foundations for building sec...Facultad de Informática UCM
 
Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...
Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...
Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...Facultad de Informática UCM
 
Redes neuronales y reinforcement learning. Aplicación en energía eólica.
Redes neuronales y reinforcement learning. Aplicación en energía eólica.Redes neuronales y reinforcement learning. Aplicación en energía eólica.
Redes neuronales y reinforcement learning. Aplicación en energía eólica.Facultad de Informática UCM
 
Challenges and Opportunities for AI and Data analytics in Offshore wind
Challenges and Opportunities for AI and Data analytics in Offshore windChallenges and Opportunities for AI and Data analytics in Offshore wind
Challenges and Opportunities for AI and Data analytics in Offshore windFacultad de Informática UCM
 

Mais de Facultad de Informática UCM (20)

¿Por qué debemos seguir trabajando en álgebra lineal?
¿Por qué debemos seguir trabajando en álgebra lineal?¿Por qué debemos seguir trabajando en álgebra lineal?
¿Por qué debemos seguir trabajando en álgebra lineal?
 
TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...
TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...
TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...
 
DRAC: Designing RISC-V-based Accelerators for next generation Computers
DRAC: Designing RISC-V-based Accelerators for next generation ComputersDRAC: Designing RISC-V-based Accelerators for next generation Computers
DRAC: Designing RISC-V-based Accelerators for next generation Computers
 
uElectronics ongoing activities at ESA
uElectronics ongoing activities at ESAuElectronics ongoing activities at ESA
uElectronics ongoing activities at ESA
 
Tendencias en el diseño de procesadores con arquitectura Arm
Tendencias en el diseño de procesadores con arquitectura ArmTendencias en el diseño de procesadores con arquitectura Arm
Tendencias en el diseño de procesadores con arquitectura Arm
 
Formalizing Mathematics in Lean
Formalizing Mathematics in LeanFormalizing Mathematics in Lean
Formalizing Mathematics in Lean
 
Introduction to Quantum Computing and Quantum Service Oriented Computing
Introduction to Quantum Computing and Quantum Service Oriented ComputingIntroduction to Quantum Computing and Quantum Service Oriented Computing
Introduction to Quantum Computing and Quantum Service Oriented Computing
 
Computer Design Concepts for Machine Learning
Computer Design Concepts for Machine LearningComputer Design Concepts for Machine Learning
Computer Design Concepts for Machine Learning
 
Inteligencia Artificial en la atención sanitaria del futuro
Inteligencia Artificial en la atención sanitaria del futuroInteligencia Artificial en la atención sanitaria del futuro
Inteligencia Artificial en la atención sanitaria del futuro
 
Design Automation Approaches for Real-Time Edge Computing for Science Applic...
 Design Automation Approaches for Real-Time Edge Computing for Science Applic... Design Automation Approaches for Real-Time Edge Computing for Science Applic...
Design Automation Approaches for Real-Time Edge Computing for Science Applic...
 
Estrategias de navegación para robótica móvil de campo: caso de estudio proye...
Estrategias de navegación para robótica móvil de campo: caso de estudio proye...Estrategias de navegación para robótica móvil de campo: caso de estudio proye...
Estrategias de navegación para robótica móvil de campo: caso de estudio proye...
 
Fault-tolerance Quantum computation and Quantum Error Correction
Fault-tolerance Quantum computation and Quantum Error CorrectionFault-tolerance Quantum computation and Quantum Error Correction
Fault-tolerance Quantum computation and Quantum Error Correction
 
Cómo construir un chatbot inteligente sin morir en el intento
Cómo construir un chatbot inteligente sin morir en el intentoCómo construir un chatbot inteligente sin morir en el intento
Cómo construir un chatbot inteligente sin morir en el intento
 
Automatic generation of hardware memory architectures for HPC
Automatic generation of hardware memory architectures for HPCAutomatic generation of hardware memory architectures for HPC
Automatic generation of hardware memory architectures for HPC
 
Type and proof structures for concurrency
Type and proof structures for concurrencyType and proof structures for concurrency
Type and proof structures for concurrency
 
Hardware/software security contracts: Principled foundations for building sec...
Hardware/software security contracts: Principled foundations for building sec...Hardware/software security contracts: Principled foundations for building sec...
Hardware/software security contracts: Principled foundations for building sec...
 
Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...
Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...
Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...
 
Do you trust your artificial intelligence system?
Do you trust your artificial intelligence system?Do you trust your artificial intelligence system?
Do you trust your artificial intelligence system?
 
Redes neuronales y reinforcement learning. Aplicación en energía eólica.
Redes neuronales y reinforcement learning. Aplicación en energía eólica.Redes neuronales y reinforcement learning. Aplicación en energía eólica.
Redes neuronales y reinforcement learning. Aplicación en energía eólica.
 
Challenges and Opportunities for AI and Data analytics in Offshore wind
Challenges and Opportunities for AI and Data analytics in Offshore windChallenges and Opportunities for AI and Data analytics in Offshore wind
Challenges and Opportunities for AI and Data analytics in Offshore wind
 

Último

Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...tanu pandey
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 

Último (20)

Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 

Contract Automata: Towards an Algebra of Contracts - Dr. Gordon J. Pace

  • 1. Contract Automata Towards an Algebra of Contracts Gordon J. Pace Department of Computer Science University of Malta Malta March 2016 Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 2. What’s so Interesting about Contracts? Normative notions — ideal vs actual behaviour. Enabling representation of concepts such as obligations, prohibitions permissions, and exceptional behaviour. Ought-to-do or ought-to-be? Plagued by paradoxes unless one is very careful and restricts the language. Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 3. Paradox of Blame Paradox of Blame The law says: You are obliged to hand in Form A on Monday and Form B on Tuesday, unless officials stop you from doing so. But it’s sunny outside: On Monday, John spent a day on the beach, thus not handing in Form A. On Tuesday at 00:00 he was arrested, and taken to court on Wednesday. Prosecuting lawyer: To satisfy his obligation the defendant had to hand in Form A on Monday, which he did not. Hence he should be found guilty. Defendant’s lawyer: But to satisfy the obligation the defendant had to hand in Form B on Tuesday, which he was stopped from doing by officials. He is hence innocent. Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 4. Contracts vs. Specifications What are contracts, and are they different from properties or specifications? Obligation to perform x related to the property ‘action taken must include x’ Prohibition from performing x related to the property ‘action taken may not include x’ But what are permission to perform x? Actions may include x? What are violations? And what about liability? Or exceptional (non-ideal) behaviour? Contracts are by definition an agreement between two or more interacting parties but most formal studies regulate a party at a time. Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 5. Contract clause #1 “John is permitted to withdraw cash.” John may choose to perform an action ‘withdraw cash’, which the bank is bound to engage with. John may also choose not to perform the action. but if he does and the bank does not allow the bank has violated the contract. Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 6. Contract clause #2 “John is obliged to pay an annual fee.” John should perform an action ‘pay annual fee’, If John chooses not to perform the action, he has violated the contract. But the bank is bound to engage with John’s action to allow him to satisfy the contract. Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 7. Interacting Systems Interaction has a long history in computer science providing tools such as communication and synchronisation which allow the modelling of directed modalities in a two-party contract setting. We formalise two-party contracts modelling interaction using synchronous composition with multiset-actions. Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 8. Synchronous Composition over Multisets of Actions The synchronous composition of two automata Si = Qi , q0i , →i synchronising over alphabet G, is written S1 G S2, is defined to be Q1 × Q2, (q01, q02), → . q1 A −→1 q1 (q1, q2) A −→ (q1, q2) A ∩ G = ∅ q2 A −→2 q2 (q1, q2) A −→ (q1, q2) A ∩ G = ∅ q1 A −→1 q1 q2 B −→2 q2 (q1, q2) A∪B −−−→ (q1, q2) A ∩ G = B ∩ G = ∅ Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 9. But What About the Contract? Contracts are also encoded as automata with states tagged with the contract clauses that will be in force at that point. Contract “Initially, the user (party u) is forbidden from using the service but permitted to pay after which the provider (party p) is obliged to provide the service.” Pu(pay), Fu(service) Op(service) ∅ {service} {pay} {pay, service} anything Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 10. Contract Automata A contract clause is one of the following: Clause ::= Op(a) | Op(!a) | Pp(a) | Pp(!a) A contract automaton is a normal automaton with an additional function Q → 2Clause. The transition relation of contract automata is always total to ensure no deadlock, even after a violation occurs. Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 11. Contract Automata A contract clause is one of the following: Clause ::= Op(a) | Op(!a) | Pp(a) | Pp(!a) A contract automaton is a normal automaton with an additional function Q → 2Clause. The transition relation of contract automata is always total to ensure no deadlock, even after a violation occurs. Prohibition Prohibition Fp(a) is just Op(!a). Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 12. Contract Automata A contract clause is one of the following: Clause ::= Op(a) | Op(!a) | Pp(a) | Pp(!a) A contract automaton is a normal automaton with an additional function Q → 2Clause. The transition relation of contract automata is always total to ensure no deadlock, even after a violation occurs. Negative clauses !Op(x) = Pp(!x) !Pp(a) = Op(!a) Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 13. Regulated Two-Party Systems A regulated two-party system synchronising over the set of actions G consists of three parts: (i) the interacting systems S1 and S2 and (ii) the contract A. By composing the contract automaton A with the parties’ behaviour we can then identify what clauses are in force and when, hence allowing analysis for contract violation: (S1 G S2) ΣA. Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 14. Contract Violation Given a regulated two-party system, we can now analyse the system automata with respect to the contract clauses and tag violations and the responsible party. Violations can occur on: Transitions: e.g. a transition which contains an action which is prohibited at that point. States: e.g. a state in which a party does not permit (allow) the other party to perform an action which should be permitted. Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 15. Obligations Obligation Op(a) brings in constraints on both parties: 1. party p must include the action in any outgoing transition in the composed system; and 2. the other party p must provide a viable action set which allows p to perform all its obligation. The former marks transitions as violations, whereas the latter marks states. viablep(qA, A) df = Op(qA) ⊆ A ∧ Fp(qA) ∩ A = ∅ satO p ((q1, q2)qA A −→ (q1, q2)qA ) df = viablep(qA, A) satO p ((q1, q2)qA ) df = ∃A ∈ acts(qp), A ⊆ Gc · viablep(qA, A ∪ A ) Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 16. Permissions If party p is permitted to perform shared action a, then the other party p must provide p with at least one viable outgoing transition which contains a but does not include any forbidden actions. Violations of a permission occur when no appropriate action is possible, and is thus a property of a state not a transition. We use a semantics that tags as a violation a state in which one party is permitted to perform an action, while the other provides no way of actually doing so. (q1, q2)qA p Pp(a) df = true (q1, q2)qA p Pp(a) df = a ∈ G =⇒ ∃A ∈ acts(qp), A ⊆ Gc · a ∈ A ∧ viablep(qA, A ∪ A ) satP p ((q1, q2)qA ) df = ∀Pp(x) ∈ qA · (q1, q2)qA p Pp(x) Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 17. Breach-incapability A regulated system gives an automaton of all potential behaviours when composed. It is breach-incapable if no violating states and/or transitions are reachable from the initial state. This is stronger than being compliant for one specific run. correct(p, R) df = (∀q ∈ reachableS (R) · satp(q)) ∧ (∀t ∈ reachableT (R) · satp(t)) Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 18. Ordering of contracts based on leniency A contract A is more lenient than another contract A for a particular party p (A p A ) if any system behaviour of p which may violate A may also violate A . This definition allows us to characterise the notion of contract equivalence for a particular party or even for all parties. A p A df = ∀S1, S2 · correct(p, S1, S2 A ) =⇒ correct(p, S1, S2 A) Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 19. Pp(c) Op(a) {a} or {b} or ∅ {a, b} anything p Pp(c) Op(a) Op(a), Pp(b) {a} or ∅ {a, b} {b} {a} or {b} or ∅ {a, b} anything Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 20. Conflicts in Contracts Axiom 1: Opposite permissions conflict: Pp(x) !Pp(x). Axiom 2: Obligation to perform mutually exclusive actions is a conflict: a b Op(a) Op(b). Axiom 3: Conflicts are closed under symmetry: C C C C. Axiom 4: Conflicts are closed under increased strictness: C C ∧ C C C C . Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 21. John and his Bank The contract says that (i) whenever he is logged into his Internet banking account, he is to be permitted to make money transfers; and (ii) if a malicious attempt to log in to his account is identified, logging in and making transfers will be prohibited until the situation is cleared. Fj (transfer) Pj (transfer) Pj (login) Fj (login), Fj (transfer) login logout malicious cleared Note what happens after {login, malicious} in the composition of these contracts. Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 22. Adding Reparations Some reparations can be ‘handled’ by contract automata. e.g. “The passenger is obliged to show a means of identification when presenting the ticket, and would otherwise be prohibited from boarding.” Op(proveIdentity)start Fp(boardPlane) {showTicket, proveIdentity} {showTicket} But with such an encoding, we have no notion of which transitions are violating ones. And even worse, we cannot express a reparation of a permission in this manner. Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 23. Reparations Pp(boardPlane) Pp(handLuggage) Pp(coat) Pp(report) Oc (inCargo) Pp(report) Oc (inCargo) Op(switchOffDevices) Vc (Pp(coat)) {boardPlane} ok {boardPlane} Vc (Pp(handLuggage)) {boardPlane} Vc (Pp(coat)) ∧ Vc (Pp(handLuggage)) {boardPlane} By tagging each transition with which clauses would have to be violated to take that transition, we can model reparations. In addition, we can talk about hypothetical reparations. Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 24. Discussion By keeping the contract as a separate automaton: We share the same formalism and theory as for systems; We are able to reason about contracts independently of the system — e.g. compose contracts using synchronous composition Although we can reduce a regulated system to a single automaton, by keeping the original systems and contract as automaton we keep the system behaviours separate and intact. Permission can only be deduced with this unadulterated behaviour. Gordon J. Pace Contract AutomataTowards an Algebra of Contracts
  • 25. Conclusions The main contributions of this work are: A formalisation of the meaning of directed deontic operators in a two-party setting; The use of standard techniques from computer science, namely communication and synchronisation, to analyse contracts regulating two parties. Practically all the work done on directed obligations and permissions introduces new modalities such as intention, causality, etc. We are now looking into how much further such an automaton based approach supports contract analysis, and extending it to deal with multi-party (n > 2) systems. Gordon J. Pace Contract AutomataTowards an Algebra of Contracts