Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Nondeterminism as first class citizen for Hidden Logic Daniel Gebler and J¨ org Endrullis VU University Amsterdam CMCS 2012, Tallinn 1 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Table of contents Introduction 1 Nondeterministic Hidden Logic 2 Nondeterministic Hidden Logic with Sharing 3 Conclusion 4 2 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Hidden Logic - Overview Objective Semantics to OO software engineering Verification & Refinement of Design, not Code Behavioral abstraction Proof automation (Circular Coinduction) Tool support (CIRC) Related Approaches Context induction [Hennicker, 1990] Observational Logic [Bidoit, Hennicker, Kurz, 2002] Observational proofs by rewriting [Bouhoula and Rusinowitch, 2002] Coherent Hidden Algebra [Diaconescu and Futatsugi, 2000] 3 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Hidden Logic - Specifications and Semantics Hidden specifications A hidden specification is a tuple (Σ , Γ , E ), where Σ a many-sorted signature with hidden and visible sorts, Γ a many-sorted subsignature of Σ, E is a set of equations. Behavioral semantics Experiments are Γ-terms of visible sort with one “place-holder” Behavioral equivalence is non-distinguishability under experiments Coalgebraic nature G Γ : Set H → Set H γ ∈ Γ hw , s X D w G Γ ( X ) h = � s HAlg (Γ) ≃ G Γ − Coalg 4 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Hidden Logic - Example Sorts Visible sort : N , Hidden sort : Stream head : Stream → N Operations tail : Stream → Stream add : Stream × Stream → Stream head ( add ( s , s ′ )) = head ( s ) + head ( s ′ ) . . . Equations tail ( add ( s , s ′ )) = add ( tail ( s ) , tail ( s ′ )) head ( • ), head ( tail n ( • )) Experiments cons( , ) tail( ) operations in Γ + zeros D add( , ) ⋆ V H head( ) 5 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Problem Motivation (intuitive) 1) Underspecification vs. Inherent nondeterminism vs. ? 2) Sharing choices between nondeterministic systems ⊕ � � � vs. 6 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Leading example Specification rand: → Stream dup: Stream → Stream rand = (0 ⊕ 1) : rand dup( σ ) = hd( σ ) : hd( σ ) : dup(tl( σ )) Example 1: Underspecification vs. Inherent nondeterminism ? add ( rand , rand ) = Example 2: Sharing choices between nondeterministic systems ? dup ( rand ) = hd ( rand ) : hd ( rand ) : dup ( tl ( rand )) 7 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Behavioral Specification Nondeterministic Hidden specification A nondeterminsitic hidden specification is a tuple (Σ fun , Σ rel , Γ , E ) Σ fun a many-sorted signature of deterministic functions Σ rel a many-sorted signature of nondeterministic functions Σ = Σ fun ∪ Σ rel ∪ {⊕ s | s ∈ S} E a set of equations = r (behavioral deterministic) ℓ · ℓ = r (behavioral nondeterministic) 8 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Algebraic and Behavioral Semantics Nondeterministic Hidden Algebra A nondeterminsitic hidden algebra is a Σ -multialgebra � A , � · � � with interpretation � f � : A s 1 × . . . × A s n → P + ( A s ) for f ∈ Σ s 1 ... s n , s � f � ( a 1 , . . . , a n ) singleton for f ∈ Σ fun Extension to � f � : P + ( A s 1 ) × . . . × P + ( A s n ) → P + ( A s ) via union Assignment: α : X → A Natural lifting to terms � · � α : Ter ( Σ, X ) → P + ( A ) � s ⊕ t � α = � s � α ∪ � t � α Behavioral equivalence a ≡ b iff � C [ ∗ : s ] � ∗�→ a = � C [ ∗ : s ] � ∗�→ b for every C ∈ Ter ( Σ, {∗} ) v 9 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Leading example (II) Specification zerosOrOnes = zeros ⊕ ones zeros = 0 : zeros push( σ ) = (0 ⊕ 1) : σ ones = 1 : ones cons( , ) tail( ) + zeros zerosOrOnes D ones blink push( ) V H head( ) Representation of nondeterministic operations: � f � : P + ( A s 1 ) × . . . × P + ( A s n ) → P + ( A s ) a 1 ∈ A 1 ,..., a n ∈ A n f ( { a 1 } , . . . , { a n } ) with requirement: � f � ( A 1 , . . . , A n ) = � 10 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Sharing of terms rand = (0 ⊕ 1) : rand zeros = 0 : zeros add( x : σ, y : τ ) = ( x + y ) : add( σ, τ ) fun( σ ) = add( σ, σ ) Adding two independent random streams gives a random stream: add(rand , rand) = rand But we have fun(rand) = zeros � = add(rand , rand) Idea: sharing to express that both rand’s refer to the same random choice: = = zeros = � = fun add add rand rand rand rand rand We introduce sharing during equational reasoning if variable is duplicated. 11 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Behavioral Reasoning rand = (0 ⊕ 1) : rand add( x : σ, y : τ ) · = ( x + y ) : add( σ, τ ) zeros · = 0 : zeros with { : , add , zeros , + } ⊆ Σ fun and { rand } ⊆ Σ rel . · add = zeros rand 12 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Behavioral Reasoning rand = (0 ⊕ 1) : rand add( x : σ, y : τ ) · = ( x + y ) : add( σ, τ ) zeros · = 0 : zeros with { : , add , zeros , + } ⊆ Σ fun and { rand } ⊆ Σ rel . · add = zeros rand equational reasoning 12 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Behavioral Reasoning rand = (0 ⊕ 1) : rand add( x : σ, y : τ ) · = ( x + y ) : add( σ, τ ) zeros · = 0 : zeros with { : , add , zeros , + } ⊆ Σ fun and { rand } ⊆ Σ rel . · add = zeros : ⊕ rand 0 1 12 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Behavioral Reasoning rand = (0 ⊕ 1) : rand add( x : σ, y : τ ) · = ( x + y ) : add( σ, τ ) zeros · = 0 : zeros with { : , add , zeros , + } ⊆ Σ fun and { rand } ⊆ Σ rel . · add = zeros : ⊕ rand 0 1 unsharing of Σ fun symbol (deterministic symbols can always be unshared) (hence usual reasoning if Σ rel = ∅ ) 12 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Behavioral Reasoning rand = (0 ⊕ 1) : rand add( x : σ, y : τ ) · = ( x + y ) : add( σ, τ ) zeros · = 0 : zeros with { : , add , zeros , + } ⊆ Σ fun and { rand } ⊆ Σ rel . · add = zeros : : ⊕ rand 0 1 12 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Behavioral Reasoning rand = (0 ⊕ 1) : rand add( x : σ, y : τ ) · = ( x + y ) : add( σ, τ ) zeros · = 0 : zeros with { : , add , zeros , + } ⊆ Σ fun and { rand } ⊆ Σ rel . · add = zeros : : ⊕ rand 0 1 equational reasoning (unsharing was needed) (no equational reasoning across symbols with multiple incoming edges) 12 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Behavioral Reasoning rand = (0 ⊕ 1) : rand add( x : σ, y : τ ) · = ( x + y ) : add( σ, τ ) zeros · = 0 : zeros with { : , add , zeros , + } ⊆ Σ fun and { rand } ⊆ Σ rel . · : = zeros + add ⊕ rand 0 1 12 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Behavioral Reasoning rand = (0 ⊕ 1) : rand add( x : σ, y : τ ) · = ( x + y ) : add( σ, τ ) zeros · = 0 : zeros with { : , add , zeros , + } ⊆ Σ fun and { rand } ⊆ Σ rel . · : = zeros + add ⊕ rand 0 1 case distinction for ⊕ 12 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Behavioral Reasoning rand = (0 ⊕ 1) : rand add( x : σ, y : τ ) · = ( x + y ) : add( σ, τ ) zeros · = 0 : zeros with { : , add , zeros , + } ⊆ Σ fun and { rand } ⊆ Σ rel . · · : : = zeros = zeros + + add add 0 rand 1 rand 12 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Behavioral Reasoning rand = (0 ⊕ 1) : rand add( x : σ, y : τ ) · = ( x + y ) : add( σ, τ ) zeros · = 0 : zeros with { : , add , zeros , + } ⊆ Σ fun and { rand } ⊆ Σ rel . · · : : = zeros = zeros + + add add 0 rand 1 rand unsharing of Σ fun symbol 12 / 14
Introduction Nondeterministic Hidden Logic Nondeterministic Hidden Logic with Sharing Conclusion Behavioral Reasoning rand = (0 ⊕ 1) : rand add( x : σ, y : τ ) · = ( x + y ) : add( σ, τ ) zeros · = 0 : zeros with { : , add , zeros , + } ⊆ Σ fun and { rand } ⊆ Σ rel . · · : : = zeros = zeros + + add add 0 0 rand 1 1 rand 12 / 14
Recommend
More recommend