a practical introduction to active automata learning · 2011-11-15 · a practical introduction to...

48
Maik Merten, learning technology 1 A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Upload: others

Post on 22-May-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Maik Merten, learning technology 1

A practical introduction to active

automata learning

SFM2011

Bernhard Steffen, Falk Howar, Maik Merten

TU Dortmund

Page 2: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Overview

Motivation

Introduction to active automata learning

Practical aspects in active automata

learning

Conclusions

Page 3: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Mealy machines

Mealy machine M=(S,, ,,) S finite set of states

finite input-alphabet

finite output-alphabet

: (S x ) → S transition-function

: (S x ) → output-function

• Words * for (sS, a, w*)

:(S x *) → S, (s,)=s, (s,aw) =((s,a),w)

: (S x *) → *, (s,)=, (s,aw) = (s,a).((s,a),w)

Page 4: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Active automata learning

Learner

MQ-Oracle

EQ-Oracle

Σ={a,b}

a L?

no

?

no, bb L!

a

a

a

a

b b b b

a

a,b b

Page 5: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Angluin's alg. for Mealy machines

a b

ε

S

a

b

Initialize

Distinguishing Set

D with alphabet of

inputs

state cover set

one transition

extensions SA

distingushing set

D

Page 6: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

a b

ε

a

b

Unknown system:

0 0

1 1

1 1

Angluin's alg. for Mealy machines

Page 7: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

a b

ε 0 0

a 1 1

b 1 1

Unclosure:

Rows in lower part that

are not in upper part

Angluin's alg. for Mealy machines

Page 8: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

a b

ε 0 0

a 1 1

b 1 1

aa 1 1

ab 1 1

Unclosure:

Rows in lower part that

are not in upper part

Angluin's alg. for Mealy machines

Page 9: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

a b

ε 0 0

a 1 1

b 1 1

aa 1 1

ab 1 1

Conjecture:

Unique rows in S become

states

Rows in S and SA become transitions

Angluin's alg. for Mealy machines

Page 10: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Counterexample: bbb / 010

a b

ε 0 0

a 1 1

b 1 1

aa 1 1

ab 1 1

Angluin's alg. for Mealy machines

Page 11: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

a b

ε 0 0

a 1 1

b 1 1

bb 0 0

aa 1 1

ab 1 1

ba 0 0

… … …

bbb 0 0

Angluin's alg. for Mealy machines

Counterexample: bbb / 010

Insert all prefixes of the counterexample to upper part

Extend SA accordingly

Page 12: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

a b

ε 0 0

a 1 1

b 1 1

bb 0 0

aa 1 1

ab 1 1

ba 0 0

… … …

bbb 0 0

Inconsistency:

Equal rows in upper

part have ‚different

extensions‘

00

Angluin's alg. for Mealy machines

Page 13: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

a b

ε 0 0

a 1 1

b 1 1

bb 0 0

aa 1 1

ab 1 1

ba 0 0

… … …

bbb 0 0

Inconsistency:

Equal rows in upper

part have ‚different

extensions‘

00 00

Angluin's alg. for Mealy machines

Page 14: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

a b

ε 0 0

a 1 1

b 1 1

bb 0 0

aa 1 1

ab 1 1

ba 0 0

… … …

bbb 0 0

Inconsistency:

Equal rows in upper

part have ‚different

extensions‘

b and bbb differ, e.g.,

for suffix b

=> ε and bb will differ for

suffix bb

Angluin's alg. for Mealy machines

Page 15: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Inconsistencies lead

to new columns

Angluin's alg. for Mealy machines

a b bb

ε 0 0 1

a 1 1 1

b 1 1 0

bb 0 0 0

aa 1 1

1

ab 1 1

1

ba 0 0

1

… … …

1

bbb 0 0

New Conjecture

Page 16: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Target System Learned System

Angluin's alg. for Mealy machines

Page 17: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Summarized Observations (1)

Systematic completition of the observation table

New states arise as targets of transitions or from

counter examples of the equivalence queries.

Technically: prefixes are added to S

Closure procedure extends SA

Consistency is enforced by enlarging the

Distinguishing Set D

Page 18: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Summarized Observations (2)

Invariance Lemma:

All hypothesis models are

totally defined: each input is considered at each state,

input deterministic: there is only one transition per input at

each state,

transition covered: each transition lies on a path of the original

system,

state minimal: two different states in a hypothesis model

always have a separating future – á la Nerode).

Page 19: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Myhill–Nerode

Nerode relation:

For language L define relation RL (for u,u‘ Σ*)

u RL u‘ ↔ for all v Σ*: (uv L ↔ uv L)

Myhill-Nerode Theorem:

Minimal number of states of an accepting

deterministic automaton equals the number of

equivalence classes of RL

Page 20: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Summarized Observations (4)

This (Nerode‘s theorem) directly yields:

Corollary: Hypothesis automata have at most as

many states as the smallest deterministic

equivalent automaton.

We will denote the number of states by n.

Page 21: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Lemma: The number of states of the hypothesis

model increases in response to a

counterexample.

Theorem: Angluin´s algorithm terminates after at

most n equivalence queries with the smallest

deterministic system representing the behaviour

of the system to be learned.

Summarized Observations (4)

Page 22: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

22

Further Developments

Page 23: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Practical challenges

Behavioral models

Test-driver

<presence type=… />

<iq type= “result“ />

Available

OK

reset

interfacing real systems:

- alphabet generation

- abstraction

- data

equivalence queries

membership queries

Interface description

etc.

Page 24: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Bern

hard

Steff

LearnLib

TestDriver

<presence type=… />

<iq type= “result“ />

Available

OK

Static Alphabet Abstraction

Learning setup in Practice

Page 25: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

A cegar teacher

LearnLib TestDriver

Cegar teacher

<presence type=… />

<iq type= “result“ />

Available(type=avail…)

OK

Available Available(type=avail…) Non-det. during EQ Test

Available‘ Available(type=unavail…)

Learning relative to a given

Representation System

Page 26: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Bern

hard

Steff

Counter Examples and Witnesses

c1 c2 c3 c4 c5 c6

γ(α(c1)) γ(α(c2)) γ(α(c3)) γ(α(c4)) γ(α(c5)) γ(α(c6))

Page 27: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Bern

hard

Steff

Counter Examples and Witnesses

c5 c6

c4

γ(α(c1)) γ(α(c2)) γ(α(c3))

γ(α(c4)) c5 c6

Page 28: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Bern

hard

Steff

Counter Examples and Witnesses

c5 c6

c4

γ(α(c1)) γ(α(c2)) γ(α(c3))

γ(α(c4)) c5 c6

p

d

Separating Pattern p c4 d state representation future

Page 29: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Bernhard Steffen | VMCAI 2011 @ Austin,

Texas

Alphabet Abstraction Refinement

ΣC \ αold(c)

γold(αold(c))

c

γ(α(p)) x d F γ(α(p)) c d F

αold(c)

ΣC

Page 30: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Bern

hard

Steff

Case Study

Biometric Passport

[Aarts et. al, 2010]

262 Concrete symbols, 256 x readFile(i).

‚read file(i)‘ aggregated according to the required Authentication

- 1 initial abstract symbols - 8 alphabet refinements, to split readFile - 9 final abstract symbols

Page 31: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

31

Further Developments

Learning Side-Effects

Page 32: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Register automata (RA)

action with formal parameters

parallel assignment

guard

+ -

-

Register (X): x1. username x2. password

Page 33: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Experimental results

Page 34: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Overview

Motivation

Introduction to active automata learning

Practical aspects in active automata

learning

Conclusions

Page 35: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Learning non-functional properties

Latency Reliability • Bundling of queries allows application of performance testing methods

Performance

• New test-driver architecture

• Allows learning of non-functional properties

Page 36: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Non-functional properties:

First results

Page 37: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Profiling example: creating

conferences

Page 38: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

38

Practical results I

Learning the OCS

Page 39: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

User model: paper workflow

Page 40: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund
Page 41: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Hierarchy

Page 42: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Event Condition Action

Submit Report

Page 43: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Semantics of "phase expires"-

edges (2)

Page 44: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Many participants

Page 45: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

DB

Putting it all together

Jboss

ocs Tomcat JEE JMS

ECA Work-flows

Page 46: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Regular extrapolation

Page 47: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Optimized learning setup

Page 48: A practical introduction to active automata learning · 2011-11-15 · A practical introduction to active automata learning SFM2011 Bernhard Steffen, Falk Howar, Maik Merten TU Dortmund

Conclusions

Active Automata Learning in practice:

has many facets:

• Abstraction

• Instrumentation

• Reuse/Optimization

It establishes a new system perspective

Systems as evolving ‚beasts‘:

• to be observed continuously

• difficult to control with

• Functional and Non-Function Properties

Behavioural perspective to control system evolution