SlideShare a Scribd company logo
1 of 26
Download to read offline
AKKA <~~> LTS
[?)
Ruslan Shevchenko <ruslan@Shevchenko.Kiev.UA>
http://garuda.ai
// BASIC QUESTIONS //
BEHAVIOR DESCRIPTION
• What is a behavior ?
• How we can specify behavior ? (math / akka)
• Qustions with answer:
• Can we bring to programming/verification well-known
techniques from mathematics ?
• Questions without answer:
• Limit of applicability. When this can be useful ?
// WHAT IS A BEHAVIOR(?)//
.
Delta = End
STATE (S)
ACTION (A) (EVENTS)
B = E × S → S
// WHAT IS A BEHAVIOR(?)//
BEHAVIOR DESCRIPTION
Delta = End
STATE
ACTION (EVENTS)
BLTS = A × S → S
LTS = Labelled Transition System
s ∈ S
a ∈ A
→a ⊆ S × A × S
// WHAT IS A BEHAVIOR(?: AKKA)//
BEHAVIOR DESCRIPTION
STATE
ACTION (EVENTS)
Delta = End
BS
Akka ≈ A × BS
Akka → BS
Akka
val behavior(state) = Behaviors.onMessage {
case message => behavior(change(state))
}
Global Context
// WHAT IS A BEHAVIOR(?: AKKA)//
BEHAVIOR DESCRIPTION
STATE
ACTION (EVENTS)
Delta = End
BS
Akka ≈ A × BS
Akka → BS
Akka
BS
Akka ≈ BLTS × S
BLTS ≈ A × S → S
Classical OOP / FP difference
MAKE BIGGER BEHAVIOR BY COMPOSING RECURSIVE
EQUATIONS
BEHAVIOUR OPERATIONS
0
-1
B =
- 2
1
2
3
Left . (_ + 1) × B +
Right . (_ − 1) × B
Left . (_ + 1)
Right . (_ − 1)
SEQUENTIAL COMPOSITION
BEHAVIOUR OPERATIONS
0
-1
B =
- 2
1
2
3
Left . (_ + 1) × B +
Right . (_ − 1) × B
Left . (_ + 1)
Right . (_ − 1)
sequential composition (and then)
CHOICE COMPOSITION
BEHAVIOUR OPERATIONS
0
-1
B =
- 2
1
2
3
Left . (_ + 1) × B +
Right . (_ − 1) × B
Left . (_ + 1)
Right . (_ − 1)
sequential composition (and then)
choice composition (or )
RECURSIVE EQUATION
BEHAVIOUR OPERATIONS
0
-1
B =
- 2
1
2
3
Left . (_ + 1) × B +
Right . (_ − 1) × B
Left . (_ + 1)
Right . (_ − 1)
sequential composition (and then)
choice composition (or )
SCALA (?) — SURE !
BEHAVIOUR OPERATIONS
0
-1
- 2
1
2
3
lazy val behavior: LTSBehavior[Direction,Int] =
Once[Direction,Int](Left)( _ + 1) * behavior +
Once[Direction,Int](Right)(_ - 1) * behavior
val actor = ActorSystem(behavior.toPlainBehaviour(0)
,"counter")
actor ! Left
SCALA (?) — SURE !
BEHAVIOUR OPERATIONS
0
-1
- 2
1
2
3
lazy val behavior: LTSBehavior[Direction,Int] =
Once[Direction,Int](Left)( _ + 1) * behavior +
Once[Direction,Int](Right)(_ - 1) * behavior
val actor = ActorSystem(behavior.toPlainBehaviour(0)
,"counter")
actor ! Left
COFFE MACHINE - MVP ITERATION
EXAMPLE
s0=Init
s2=Coin
no button
s3 = Output coffe
s1=Button,
no coins
τ
Button
Press Button
Coin
Coin
COFFE MACHINE - MVP ITERATION
EXAMPLE
s0=Init
s2=Coin
no button
s3 = Output coffe
s1=Button,
no coins
τ
Button
Press Button
Coin
Coin
B = Button × Coin × Output × B +
Coin × Button × Output × B
case class State(coin:Boolean,
button: Boolean,
makeCoffe: ()=>() )
lazy val behavior: LTSBehavior[In,State] =
Once[In,State](Coin)(_.copy(coin=true))*
Once[In,State](Button)(_.copy(button=true))*
StateFun[In,State]{ s => s.makeCoffe(); s.copy(coin = false, button = false)}*
behavior +
Once[In,State](Coin)(_.copy(coin=true))*
Once[In,State](Button)(_.copy(button=true))*
StateFun[In,State]{ s => s.makeCoffe(); s.copy(coin = false, button = false)}*
behavior
COFFE MACHINE - ADD ON/OFF
EXAMPLE
s0=Disabled
s2=Coin
no button
s3 = Output coffe
s1=Button,
no coins
τ
Button
Press Button
Coin
Coin
Ben = Button × Coin × Output × Ben +
Coin × Button × Output × Ben +
OnOff
Off × Bdis
Bdis = On × Ben
COFFE MACHINE - ADD ON/OFF
EXAMPLE
s0=Disabled
s2=Coin
no button
s3 = Output coffe
s1=Button,
no coins
τ
Button
Press Button
Coin
Coin
Ben = Button × Coin × Output × Ben +
Coin × Button × Output × Ben +
OnOff
Off × Bdis
Bdis = On × Ben
lazy val disabled: LTSBehavior[In,State] = On * enabled
lazy val enabled: LTSBehavior[In,State] = ….
+ Off * disabled
COFFE MACHINE - ADD ACCUMULATING
EXAMPLE
s0=Disabled
s2=Coin
no button
s3 = Output coffe
s1=Button,
sum < consτ
Button
Press Button
Coin(x)
COIN(X), SUM+X >= COST
Ben = Button × Acc(Output × Ben) +
Acc(Button × Output × Ben) +
OnOff
Off × Bdis
Bdis = On × Ben
COIN(X), SUM+X < COST
Acc(Next) = Coin(x) . s + x < Cost →
Action(s = s + x) × Acc(Next) ⋄ Next
COFFE MACHINE - SCALA
EXAMPLE
s0=Di
s2=
s3 =
s1=Bτ
But
Press
Coi
COIN(X),
OO
COIN(X),
lazy val disabled: LTSBehavior[In,State] = On * enabled
lazy val enabled: LTSBehavior[In,State] =
Acc(
ConstantInput[In,State](Button)(_.copy(button=true))*
StateFun[In,State]{ s => s.makeCoffe();
s.copy(coins = s.coins - Const, button = false)}*
enabled
) +
ConstantInput[In,State](Button)(_.copy(button=true))*
Acc(
StateFun[In,State]{ s => s.makeCoffe();
s.copy(coins = s.coins - Const, button = false)}*
enabled
) +
Off * disabled
def Acc(next:LTSBehavior[In,State]):LTSBehavior[In,State] =
Condition[Coin,State]((c,s) => s.coins + c.value < Cost)*Acc(next).upcast[In] +
Condition[Coin,State]((c,s) => s.coins + c.value >= Cost)*next
BEHAVIOUR SPECIFICATIONS
One Actor:
Set of Actors:
A||B
parallel composition of A,B (start to work in ||)
A × B
A + Ba . f
φ → A ⋄ B
BEHAVIOUR LOGIC
[μ]P
Henessy-Milner modal logic with recursion =
P will necessary hold after event
first-order logic +
< μ > P P is possible after event
Words to google: μ − calculus
Behavior Algebra Insertion Modelling
http://garuda.ai
BEHAVIOUR LOGIC
[μ]P
Henessy-Milner modal logic with recursion =
first-order logic + < μ > P
http://garuda.ai (demo)
+
We can automatically check feasibility of properties
Non-technical problems:
- verification != business value
- it is possible to kill the project with verification
BEHAVIOUR LOGIC
Non-technical problems:
verification !=
business value
carelessly verification
can kill the project
ping me, if anybody
still interested ;)
BEHAVIOR ALGEBRA: CONCLUSION
Consider using Behavior Algebra interpreter
onTop/instead
- Actors,
- State-Machines
- Streams
when state graph is not trivial
-
It is possible to analyze properties of you system
completeness, liveness, safety ..
in automated way
// this will be mainstream during next 10-100 years
Questions (?)
twitter: @rssh1
e-mail: ruslan@shevchenko.kiev.ua
http://garuda.ai
DONEC QUIS NUNC
COFFE MACHINE
EXAMPLE

More Related Content

Similar to Akka / Lts behavior

Introduction to Neural Networks and Deep Learning from Scratch
Introduction to Neural Networks and Deep Learning from ScratchIntroduction to Neural Networks and Deep Learning from Scratch
Introduction to Neural Networks and Deep Learning from ScratchAhmed BESBES
 
The Essence of the Iterator Pattern
The Essence of the Iterator PatternThe Essence of the Iterator Pattern
The Essence of the Iterator PatternEric Torreborre
 
Tech Talk - Immutable Data Structure
Tech Talk - Immutable Data StructureTech Talk - Immutable Data Structure
Tech Talk - Immutable Data StructureDi Fan
 
Go Beast Mode with Realtime Reactive Interfaces in Angular 2 and Firebase
Go Beast Mode with Realtime Reactive Interfaces in Angular 2 and FirebaseGo Beast Mode with Realtime Reactive Interfaces in Angular 2 and Firebase
Go Beast Mode with Realtime Reactive Interfaces in Angular 2 and FirebaseLukas Ruebbelke
 
Hitchhiker's Guide to Functional Programming
Hitchhiker's Guide to Functional ProgrammingHitchhiker's Guide to Functional Programming
Hitchhiker's Guide to Functional ProgrammingSergey Shishkin
 
The Essence of the Iterator Pattern (pdf)
The Essence of the Iterator Pattern (pdf)The Essence of the Iterator Pattern (pdf)
The Essence of the Iterator Pattern (pdf)Eric Torreborre
 
Stacks,queues,linked-list
Stacks,queues,linked-listStacks,queues,linked-list
Stacks,queues,linked-listpinakspatel
 
1. Regression_V1.pdf
1. Regression_V1.pdf1. Regression_V1.pdf
1. Regression_V1.pdfssuser4c50a9
 
Functions, Types, Programs and Effects
Functions, Types, Programs and EffectsFunctions, Types, Programs and Effects
Functions, Types, Programs and EffectsRaymond Roestenburg
 
Kotlin collections
Kotlin collectionsKotlin collections
Kotlin collectionsMyeongin Woo
 
ZIO actors by Mateusz Sokół Scalac
ZIO actors by Mateusz Sokół ScalacZIO actors by Mateusz Sokół Scalac
ZIO actors by Mateusz Sokół ScalacScalac
 
Gentle Introduction to Functional Programming
Gentle Introduction to Functional ProgrammingGentle Introduction to Functional Programming
Gentle Introduction to Functional ProgrammingSaurabh Singh
 
Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Super TypeScript II Turbo - FP Remix (NG Conf 2017)Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Super TypeScript II Turbo - FP Remix (NG Conf 2017)Sean May
 
Christian Gill ''Functional programming for the people''
Christian Gill ''Functional programming for the people''Christian Gill ''Functional programming for the people''
Christian Gill ''Functional programming for the people''OdessaJS Conf
 
Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019
Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019
Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019Codemotion
 

Similar to Akka / Lts behavior (20)

Introduction to Neural Networks and Deep Learning from Scratch
Introduction to Neural Networks and Deep Learning from ScratchIntroduction to Neural Networks and Deep Learning from Scratch
Introduction to Neural Networks and Deep Learning from Scratch
 
Functional programming in scala
Functional programming in scalaFunctional programming in scala
Functional programming in scala
 
The Essence of the Iterator Pattern
The Essence of the Iterator PatternThe Essence of the Iterator Pattern
The Essence of the Iterator Pattern
 
Tech Talk - Immutable Data Structure
Tech Talk - Immutable Data StructureTech Talk - Immutable Data Structure
Tech Talk - Immutable Data Structure
 
Go Beast Mode with Realtime Reactive Interfaces in Angular 2 and Firebase
Go Beast Mode with Realtime Reactive Interfaces in Angular 2 and FirebaseGo Beast Mode with Realtime Reactive Interfaces in Angular 2 and Firebase
Go Beast Mode with Realtime Reactive Interfaces in Angular 2 and Firebase
 
Hitchhiker's Guide to Functional Programming
Hitchhiker's Guide to Functional ProgrammingHitchhiker's Guide to Functional Programming
Hitchhiker's Guide to Functional Programming
 
The Essence of the Iterator Pattern (pdf)
The Essence of the Iterator Pattern (pdf)The Essence of the Iterator Pattern (pdf)
The Essence of the Iterator Pattern (pdf)
 
Stacks,queues,linked-list
Stacks,queues,linked-listStacks,queues,linked-list
Stacks,queues,linked-list
 
1. Regression_V1.pdf
1. Regression_V1.pdf1. Regression_V1.pdf
1. Regression_V1.pdf
 
Functions, Types, Programs and Effects
Functions, Types, Programs and EffectsFunctions, Types, Programs and Effects
Functions, Types, Programs and Effects
 
OTLN2012
OTLN2012OTLN2012
OTLN2012
 
Kotlin collections
Kotlin collectionsKotlin collections
Kotlin collections
 
Java - Operators
Java - OperatorsJava - Operators
Java - Operators
 
Java 2
Java 2Java 2
Java 2
 
ZIO actors by Mateusz Sokół Scalac
ZIO actors by Mateusz Sokół ScalacZIO actors by Mateusz Sokół Scalac
ZIO actors by Mateusz Sokół Scalac
 
Gentle Introduction to Functional Programming
Gentle Introduction to Functional ProgrammingGentle Introduction to Functional Programming
Gentle Introduction to Functional Programming
 
Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Super TypeScript II Turbo - FP Remix (NG Conf 2017)Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Super TypeScript II Turbo - FP Remix (NG Conf 2017)
 
Christian Gill ''Functional programming for the people''
Christian Gill ''Functional programming for the people''Christian Gill ''Functional programming for the people''
Christian Gill ''Functional programming for the people''
 
Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019
Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019
Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019
 
04-Sets-Relations-A.pdf
04-Sets-Relations-A.pdf04-Sets-Relations-A.pdf
04-Sets-Relations-A.pdf
 

More from Ruslan Shevchenko

Embedding Generic Monadic Transformer into Scala. [Tfp2022]
Embedding Generic Monadic Transformer into Scala. [Tfp2022]Embedding Generic Monadic Transformer into Scala. [Tfp2022]
Embedding Generic Monadic Transformer into Scala. [Tfp2022]Ruslan Shevchenko
 
Papers We Love / Kyiv : PAXOS (and little about other consensuses )
Papers We Love / Kyiv :  PAXOS (and little about other consensuses )Papers We Love / Kyiv :  PAXOS (and little about other consensuses )
Papers We Love / Kyiv : PAXOS (and little about other consensuses )Ruslan Shevchenko
 
Scala / Technology evolution
Scala  / Technology evolutionScala  / Technology evolution
Scala / Technology evolutionRuslan Shevchenko
 
{co/contr} variance from LSP
{co/contr} variance  from LSP{co/contr} variance  from LSP
{co/contr} variance from LSPRuslan Shevchenko
 
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.Ruslan Shevchenko
 
SE 20016 - programming languages landscape.
SE 20016 - programming languages landscape.SE 20016 - programming languages landscape.
SE 20016 - programming languages landscape.Ruslan Shevchenko
 
Few simple-type-tricks in scala
Few simple-type-tricks in scalaFew simple-type-tricks in scala
Few simple-type-tricks in scalaRuslan Shevchenko
 
Why scala is not my ideal language and what I can do with this
Why scala is not my ideal language and what I can do with thisWhy scala is not my ideal language and what I can do with this
Why scala is not my ideal language and what I can do with thisRuslan Shevchenko
 
Java & low latency applications
Java & low latency applicationsJava & low latency applications
Java & low latency applicationsRuslan Shevchenko
 
Jslab rssh: JS as language platform
Jslab rssh:  JS as language platformJslab rssh:  JS as language platform
Jslab rssh: JS as language platformRuslan Shevchenko
 
Behind OOD: domain modelling in post-OO world.
Behind OOD:  domain modelling in post-OO world.Behind OOD:  domain modelling in post-OO world.
Behind OOD: domain modelling in post-OO world.Ruslan Shevchenko
 
scala-gopher: async implementation of CSP for scala
scala-gopher:  async implementation of CSP  for  scalascala-gopher:  async implementation of CSP  for  scala
scala-gopher: async implementation of CSP for scalaRuslan Shevchenko
 
Programming Languages: some news for the last N years
Programming Languages: some news for the last N yearsProgramming Languages: some news for the last N years
Programming Languages: some news for the last N yearsRuslan Shevchenko
 
JDays Lviv 2014: Java8 vs Scala: Difference points & innovation stream
JDays Lviv 2014:  Java8 vs Scala:  Difference points & innovation streamJDays Lviv 2014:  Java8 vs Scala:  Difference points & innovation stream
JDays Lviv 2014: Java8 vs Scala: Difference points & innovation streamRuslan Shevchenko
 

More from Ruslan Shevchenko (20)

Embedding Generic Monadic Transformer into Scala. [Tfp2022]
Embedding Generic Monadic Transformer into Scala. [Tfp2022]Embedding Generic Monadic Transformer into Scala. [Tfp2022]
Embedding Generic Monadic Transformer into Scala. [Tfp2022]
 
Svitla talks 2021_03_25
Svitla talks 2021_03_25Svitla talks 2021_03_25
Svitla talks 2021_03_25
 
Papers We Love / Kyiv : PAXOS (and little about other consensuses )
Papers We Love / Kyiv :  PAXOS (and little about other consensuses )Papers We Love / Kyiv :  PAXOS (and little about other consensuses )
Papers We Love / Kyiv : PAXOS (and little about other consensuses )
 
Scala / Technology evolution
Scala  / Technology evolutionScala  / Technology evolution
Scala / Technology evolution
 
{co/contr} variance from LSP
{co/contr} variance  from LSP{co/contr} variance  from LSP
{co/contr} variance from LSP
 
N flavors of streaming
N flavors of streamingN flavors of streaming
N flavors of streaming
 
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
 
SE 20016 - programming languages landscape.
SE 20016 - programming languages landscape.SE 20016 - programming languages landscape.
SE 20016 - programming languages landscape.
 
Few simple-type-tricks in scala
Few simple-type-tricks in scalaFew simple-type-tricks in scala
Few simple-type-tricks in scala
 
Why scala is not my ideal language and what I can do with this
Why scala is not my ideal language and what I can do with thisWhy scala is not my ideal language and what I can do with this
Why scala is not my ideal language and what I can do with this
 
Scala jargon cheatsheet
Scala jargon cheatsheetScala jargon cheatsheet
Scala jargon cheatsheet
 
Java & low latency applications
Java & low latency applicationsJava & low latency applications
Java & low latency applications
 
Csp scala wixmeetup2016
Csp scala wixmeetup2016Csp scala wixmeetup2016
Csp scala wixmeetup2016
 
IDLs
IDLsIDLs
IDLs
 
R ext world/ useR! Kiev
R ext world/ useR!  KievR ext world/ useR!  Kiev
R ext world/ useR! Kiev
 
Jslab rssh: JS as language platform
Jslab rssh:  JS as language platformJslab rssh:  JS as language platform
Jslab rssh: JS as language platform
 
Behind OOD: domain modelling in post-OO world.
Behind OOD:  domain modelling in post-OO world.Behind OOD:  domain modelling in post-OO world.
Behind OOD: domain modelling in post-OO world.
 
scala-gopher: async implementation of CSP for scala
scala-gopher:  async implementation of CSP  for  scalascala-gopher:  async implementation of CSP  for  scala
scala-gopher: async implementation of CSP for scala
 
Programming Languages: some news for the last N years
Programming Languages: some news for the last N yearsProgramming Languages: some news for the last N years
Programming Languages: some news for the last N years
 
JDays Lviv 2014: Java8 vs Scala: Difference points & innovation stream
JDays Lviv 2014:  Java8 vs Scala:  Difference points & innovation streamJDays Lviv 2014:  Java8 vs Scala:  Difference points & innovation stream
JDays Lviv 2014: Java8 vs Scala: Difference points & innovation stream
 

Recently uploaded

How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfIdiosysTechnologies1
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 

Recently uploaded (20)

How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdf
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 

Akka / Lts behavior

  • 1. AKKA <~~> LTS [?) Ruslan Shevchenko <ruslan@Shevchenko.Kiev.UA> http://garuda.ai
  • 2. // BASIC QUESTIONS // BEHAVIOR DESCRIPTION • What is a behavior ? • How we can specify behavior ? (math / akka) • Qustions with answer: • Can we bring to programming/verification well-known techniques from mathematics ? • Questions without answer: • Limit of applicability. When this can be useful ?
  • 3. // WHAT IS A BEHAVIOR(?)// . Delta = End STATE (S) ACTION (A) (EVENTS) B = E × S → S
  • 4. // WHAT IS A BEHAVIOR(?)// BEHAVIOR DESCRIPTION Delta = End STATE ACTION (EVENTS) BLTS = A × S → S LTS = Labelled Transition System s ∈ S a ∈ A →a ⊆ S × A × S
  • 5. // WHAT IS A BEHAVIOR(?: AKKA)// BEHAVIOR DESCRIPTION STATE ACTION (EVENTS) Delta = End BS Akka ≈ A × BS Akka → BS Akka val behavior(state) = Behaviors.onMessage { case message => behavior(change(state)) } Global Context
  • 6. // WHAT IS A BEHAVIOR(?: AKKA)// BEHAVIOR DESCRIPTION STATE ACTION (EVENTS) Delta = End BS Akka ≈ A × BS Akka → BS Akka BS Akka ≈ BLTS × S BLTS ≈ A × S → S Classical OOP / FP difference
  • 7. MAKE BIGGER BEHAVIOR BY COMPOSING RECURSIVE EQUATIONS BEHAVIOUR OPERATIONS 0 -1 B = - 2 1 2 3 Left . (_ + 1) × B + Right . (_ − 1) × B Left . (_ + 1) Right . (_ − 1)
  • 8. SEQUENTIAL COMPOSITION BEHAVIOUR OPERATIONS 0 -1 B = - 2 1 2 3 Left . (_ + 1) × B + Right . (_ − 1) × B Left . (_ + 1) Right . (_ − 1) sequential composition (and then)
  • 9. CHOICE COMPOSITION BEHAVIOUR OPERATIONS 0 -1 B = - 2 1 2 3 Left . (_ + 1) × B + Right . (_ − 1) × B Left . (_ + 1) Right . (_ − 1) sequential composition (and then) choice composition (or )
  • 10. RECURSIVE EQUATION BEHAVIOUR OPERATIONS 0 -1 B = - 2 1 2 3 Left . (_ + 1) × B + Right . (_ − 1) × B Left . (_ + 1) Right . (_ − 1) sequential composition (and then) choice composition (or )
  • 11. SCALA (?) — SURE ! BEHAVIOUR OPERATIONS 0 -1 - 2 1 2 3 lazy val behavior: LTSBehavior[Direction,Int] = Once[Direction,Int](Left)( _ + 1) * behavior + Once[Direction,Int](Right)(_ - 1) * behavior val actor = ActorSystem(behavior.toPlainBehaviour(0) ,"counter") actor ! Left
  • 12. SCALA (?) — SURE ! BEHAVIOUR OPERATIONS 0 -1 - 2 1 2 3 lazy val behavior: LTSBehavior[Direction,Int] = Once[Direction,Int](Left)( _ + 1) * behavior + Once[Direction,Int](Right)(_ - 1) * behavior val actor = ActorSystem(behavior.toPlainBehaviour(0) ,"counter") actor ! Left
  • 13. COFFE MACHINE - MVP ITERATION EXAMPLE s0=Init s2=Coin no button s3 = Output coffe s1=Button, no coins τ Button Press Button Coin Coin
  • 14. COFFE MACHINE - MVP ITERATION EXAMPLE s0=Init s2=Coin no button s3 = Output coffe s1=Button, no coins τ Button Press Button Coin Coin B = Button × Coin × Output × B + Coin × Button × Output × B case class State(coin:Boolean, button: Boolean, makeCoffe: ()=>() ) lazy val behavior: LTSBehavior[In,State] = Once[In,State](Coin)(_.copy(coin=true))* Once[In,State](Button)(_.copy(button=true))* StateFun[In,State]{ s => s.makeCoffe(); s.copy(coin = false, button = false)}* behavior + Once[In,State](Coin)(_.copy(coin=true))* Once[In,State](Button)(_.copy(button=true))* StateFun[In,State]{ s => s.makeCoffe(); s.copy(coin = false, button = false)}* behavior
  • 15. COFFE MACHINE - ADD ON/OFF EXAMPLE s0=Disabled s2=Coin no button s3 = Output coffe s1=Button, no coins τ Button Press Button Coin Coin Ben = Button × Coin × Output × Ben + Coin × Button × Output × Ben + OnOff Off × Bdis Bdis = On × Ben
  • 16. COFFE MACHINE - ADD ON/OFF EXAMPLE s0=Disabled s2=Coin no button s3 = Output coffe s1=Button, no coins τ Button Press Button Coin Coin Ben = Button × Coin × Output × Ben + Coin × Button × Output × Ben + OnOff Off × Bdis Bdis = On × Ben lazy val disabled: LTSBehavior[In,State] = On * enabled lazy val enabled: LTSBehavior[In,State] = …. + Off * disabled
  • 17. COFFE MACHINE - ADD ACCUMULATING EXAMPLE s0=Disabled s2=Coin no button s3 = Output coffe s1=Button, sum < consτ Button Press Button Coin(x) COIN(X), SUM+X >= COST Ben = Button × Acc(Output × Ben) + Acc(Button × Output × Ben) + OnOff Off × Bdis Bdis = On × Ben COIN(X), SUM+X < COST Acc(Next) = Coin(x) . s + x < Cost → Action(s = s + x) × Acc(Next) ⋄ Next
  • 18. COFFE MACHINE - SCALA EXAMPLE s0=Di s2= s3 = s1=Bτ But Press Coi COIN(X), OO COIN(X), lazy val disabled: LTSBehavior[In,State] = On * enabled lazy val enabled: LTSBehavior[In,State] = Acc( ConstantInput[In,State](Button)(_.copy(button=true))* StateFun[In,State]{ s => s.makeCoffe(); s.copy(coins = s.coins - Const, button = false)}* enabled ) + ConstantInput[In,State](Button)(_.copy(button=true))* Acc( StateFun[In,State]{ s => s.makeCoffe(); s.copy(coins = s.coins - Const, button = false)}* enabled ) + Off * disabled def Acc(next:LTSBehavior[In,State]):LTSBehavior[In,State] = Condition[Coin,State]((c,s) => s.coins + c.value < Cost)*Acc(next).upcast[In] + Condition[Coin,State]((c,s) => s.coins + c.value >= Cost)*next
  • 19. BEHAVIOUR SPECIFICATIONS One Actor: Set of Actors: A||B parallel composition of A,B (start to work in ||) A × B A + Ba . f φ → A ⋄ B
  • 20. BEHAVIOUR LOGIC [μ]P Henessy-Milner modal logic with recursion = P will necessary hold after event first-order logic + < μ > P P is possible after event Words to google: μ − calculus Behavior Algebra Insertion Modelling http://garuda.ai
  • 21. BEHAVIOUR LOGIC [μ]P Henessy-Milner modal logic with recursion = first-order logic + < μ > P http://garuda.ai (demo) + We can automatically check feasibility of properties Non-technical problems: - verification != business value - it is possible to kill the project with verification
  • 22. BEHAVIOUR LOGIC Non-technical problems: verification != business value carelessly verification can kill the project ping me, if anybody still interested ;)
  • 23. BEHAVIOR ALGEBRA: CONCLUSION Consider using Behavior Algebra interpreter onTop/instead - Actors, - State-Machines - Streams when state graph is not trivial - It is possible to analyze properties of you system completeness, liveness, safety .. in automated way // this will be mainstream during next 10-100 years
  • 24. Questions (?) twitter: @rssh1 e-mail: ruslan@shevchenko.kiev.ua http://garuda.ai