contract theories

Contract Theories Albert Benveniste B. Caillaud D. Nickovic R. - PowerPoint PPT Presentation

Contract Theories Albert Benveniste B. Caillaud D. Nickovic R. Passerone J-B. Raclet W. Damm T. Henzinger K. Larsen A. Sangiovanni-Vincentelli INRIA Rennes April 17, 2015 Contracts in embedded systems design: why? Formalizing


  1. Contract Theories Albert Benveniste B. Caillaud D. Nickovic R. Passerone J-B. Raclet W. Damm T. Henzinger K. Larsen A. Sangiovanni-Vincentelli INRIA Rennes April 17, 2015

  2. Contracts in embedded systems design: why? ◮ Formalizing OEM/supplier relations: “contracts for contracts” Complement Legal Contracts with Technical Contracts ◮ Structuring requirements or specifications Requirements are structured into chapters/viewpoints/aspects (function, safety, performance & timing, QoS. . . ) ◮ Concurrent development at the system designer Different viewpoints are developed by different teams Weaving viewpoints must be sound and correct ◮ Independent development by the suppliers Suppliers must be able to develop their sub-systems having all the info they need; system integration must be correct

  3. Structuring requirements or specifications Concurrent development behavioral timing safety viewpoint viewpoint viewpoint C B C B C S C S C T 1 2 1 2 every contract C B 1 ∧ C B 2 ∧ C T ∧ C S 1 ∧ C S is a conjunction 2 C = � i C i

  4. Structuring requirements or specifications Concurrent development behavioral timing safety viewpoint viewpoint viewpoint C B C B C S C S C T 1 2 1 2 every contract is itself C B 1 ∧ C B 2 ∧ C T ∧ C S 1 ∧ C S a conjunction 2 of requirements C = � i C i Requirements are combined by using “contract conjunction” Viewpoints are fused by using “contract conjunction”

  5. Structuring requirements or specifications Independent development C 1 refined by the OEM C 11 ⊗ C 12 ⊗ C 13 C 11 C 13 C 12 delegated for delegated for implementation implementation by a supplier by a supplier C 11 ⊗ ( C 121 ⊗ C 122 ) ⊗ ( C 131 ⊗ C 132 ) C 11 C 121 ⊗ C 122 C 131 ⊗ C 132 C 121 C 122 C 131 C 132

  6. Structuring requirements or specifications Independent development C 1 refined by the OEM C 11 ⊗ C 12 ⊗ C 13 C 11 C 13 C 12 delegated for delegated for implementation implementation by a supplier by a supplier C 11 ⊗ ( C 121 ⊗ C 122 ) ⊗ ( C 131 ⊗ C 132 ) C 11 C 121 ⊗ C 122 C 131 ⊗ C 132 C 121 C 122 C 131 C 132

  7. Structuring requirements or specifications Independent development C 1 refined by the OEM C 11 ⊗ C 12 ⊗ C 13 C 11 C 13 C 12 delegated for delegated for implementation implementation by a supplier by a supplier C 11 ⊗ ( C 121 ⊗ C 122 ) ⊗ ( C 131 ⊗ C 132 ) C 11 C 121 ⊗ C 122 C 131 ⊗ C 132 C 121 C 122 C 131 C 132 “refined”, “implementation”, ⊗ : new concepts

  8. A meta-theory of contracts Details Meta-theory �→ Assume/Guarantee contracts Details Meta-theory �→ Interface Automata Details Meta-theory �→ Modal Interfaces Details Contract Based Requirement Engineering Details Concluding Remarks

  9. Motivations for a meta-theory A wide and diverse bibliography: ◮ Systems from components: OO-programming in the 80’s [B. Meyer. . . ] ◮ Refinement ◮ by simulation: in the 80’s [Milner], OK for closed systems ◮ by alternating simulation for open systems: early 90’s [Abadi, Lamport, Wolper] late 90’s [de Alfaro, Kupferman, Henzinger] ◮ Composition and compatibility: [Abadi, Lamport93] [de Alfaro-Henzinger 2000] ◮ Conjunction and consistency: [Passerone, Raclet, Caillaud, Benveniste... 2008] ◮ Product lines (not discussed here): [Larsen, Nyman, Wasowski 2008]

  10. Motivations for a meta-theory Fact: ◮ Different frameworks have been proposed to address similar issues: ◮ specification theories ◮ interface theories ◮ contract theories the meta-theory Goal: ◮ Capture the essence of the above frameworks ◮ Highlight their very nature ◮ Develop new generic tools and techniques ◮ Instantiate to known frameworks, hoping for new results

  11. The meta-theory: Components and Contracts ◮ Components: actual pieces of SW/HW/devices, open system ◮ Environment: context of use (a component), often unkown at design time ◮ Components cannot constrain their environment Contracts are intentionally abstract Pinpoint responsibilities of component vs. environment         C E C M C   = ,     � �� � � �� �    set of set of  environments components

  12. The meta-theory: Components and Contracts ◮ Components: actual pieces of SW/HW/devices, open system ◮ Environment: context of use (a component), often unkown at design time ◮ Components cannot constrain their environment ◮ Contracts are intentionally abstract ◮ Pinpoint responsibilities of component vs. environment         semantics ( C ) E C M C   = ,     � �� � � �� �    set of set of  environments components

  13. The meta-theory ◮ We assume some primitive concepts: Component M Composition × is partially defined, commutative and associative M 1 × M 2 being well-defined is a typing relation Composability is an environment for M iff E × M is well-defined Environment E ◮ On top of these primitive concepts we define ◮ generic concepts and operators ◮ satisfying generic properties ◮ How concepts, operators, and properties, are made effective ◮ depends on the specific framework

  14. The meta-theory ◮ Generic Relations and Operators: Contract sem ( C ) = ( E C , M C ) where C ∈ C : underlying class of contracts M C � = ∅ say that ( C 1 , C 2 ) is consistent iff C 1 ∧ C 2 is consistent Consistency E C � = ∅ say that ( C 1 , C 2 ) is compatible iff C 1 ⊗ C 2 is compatible Compatibility = M C iff M ∈ M C ; = E C iff E ∈ E C Implementation M | E | C ′ � C iff E C′ ⊇ E C ❛♥❞ M C′ ⊆ M C Refinement C 1 ∧C 2 = GLB for � within C Conjunction C 1 ∨C 2 = LUB for � within C  � = M C 1 = M C 1      ∀ M 1 | M 1 × M 2 | �   � = M C 2 = E C 1  ⇒ Composition C 1 ⊗C 2 = min  C ∀ M 2 | E × M 2 | �    � = E C = E C 2  ∀ E | E × M 1 | � Quotient C 1 / C 2 = max { C ∈ C | C ⊗ C 2 � C 1 }

  15. The meta-theory ◮ Generic Relations and Operators: Contract sem ( C ) = ( E C , M C ) where C ∈ C : underlying class of contracts M C � = ∅ say that ( C 1 , C 2 ) is consistent iff C 1 ∧ C 2 is consistent Consistency E C � = ∅ say that ( C 1 , C 2 ) is compatible iff C 1 ⊗ C 2 is compatible Compatibility = M C iff M ∈ M C ; = E C iff E ∈ E C Implementation M | E | C ′ � C iff E C′ ⊇ E C ❛♥❞ M C′ ⊆ M C Refinement C 1 ∧C 2 = GLB for � within C Conjunction C 1 ∨C 2 = LUB for � within C  � = M C 1 = M C 1      ∀ M 1 | M 1 × M 2 | �   � = M C 2 = E C 1  ⇒ Composition C 1 ⊗C 2 = min  C ∀ M 2 | E × M 2 | �    � = E C = E C 2  ∀ E | E × M 1 | � Quotient C 1 / C 2 = max { C ∈ C | C ⊗ C 2 � C 1 }

  16. The meta-theory ◮ Generic Relations and Operators: Contract sem ( C ) = ( E C , M C ) where C ∈ C : underlying class of contracts M C � = ∅ say that ( C 1 , C 2 ) is consistent iff C 1 ∧ C 2 is consistent Consistency E C � = ∅ say that ( C 1 , C 2 ) is compatible iff C 1 ⊗ C 2 is compatible Compatibility = M C iff M ∈ M C ; = E C iff E ∈ E C Implementation M | E | C ′ � C iff E C′ ⊇ E C ❛♥❞ M C′ ⊆ M C Refinement C 1 ∧C 2 = GLB for � within C Conjunction C 1 ∨C 2 = LUB for � within C  � = M C 1 = M C 1      ∀ M 1 | M 1 × M 2 | �   � = M C 2 = E C 1  ⇒ Composition C 1 ⊗C 2 = min  C ∀ M 2 | E × M 2 | �    � = E C = E C 2  ∀ E | E × M 1 | � Quotient C 1 / C 2 = max { C ∈ C | C ⊗ C 2 � C 1 }

  17. The meta-theory Generic Properties: substituability ր of sets of environments Refinement substituability ց of sets of implementations � ( C ′ � 1 , C ′ ( C 1 , C 2 ) compatible 2 ) compatible ⇒ C ′ C ′ 1 ⊗ C ′ i � C i 2 � C 1 ⊗ C 2 independent implementability ( C 1 ⊗ C 2 ) ⊗ C 3 = C 1 ⊗ ( C 2 ⊗ C 3 ) Composition associativity [( C 11 ∧ C 21 ) ⊗ ( C 12 ∧ C 22 )] � [( C 11 ⊗ C 12 ) ∧ ( C 21 ⊗ C 22 )] sub-distributivity: sets the freedom in design processes, fusing viewpoints before/after composing sub-systems C � C 1 / C 2 ⇔ C ⊗ C 2 � C 1 Quotient

  18. Abstracting and testing ◮ Restrictions must hold for relations and operators on contracts to be analyzable ◮ Such restrictions may not hold for system models in practice ◮ Typical obstacles are infinite data types and functions operating on them

  19. Abstracting and testing ◮ Restrictions must hold for relations and operators on contracts to be analyzable ◮ Such restrictions may not hold for system models in practice ◮ Typical obstacles are infinite data types and functions operating on them ◮ Two complementary ways of overcoming this consist in ◮ performing abstractions ◮ performing testing ◮ The meta-theory offers generic means: ◮ abstraction on top of abstract interpretation for components ◮ observers for contract-compliant testing

Recommend


More recommend