Model Learning Overview - GitHub Pages...Inference of Finite Automata Using Homing Sequences Kearns...
Transcript of Model Learning Overview - GitHub Pages...Inference of Finite Automata Using Homing Sequences Kearns...
Model Learning Overview
Outline1. Introduction2. Target Automata Type3. Approach4. Tools5. Application6. Challenge And Discussion
1. Introduction
ร What โs model learning ?
ร Why learning model ?
ร How to learn model ๏ผ
q!
q" q#
S
q$
Model Learning (Automata Learning)
ร Model learning aims to construct black-box state diagram models of software and hardware systems by providing inputs and observing outputs.
power off
standby
Why learning model ?
ร To understand the behavior of a component without having access to the code.
ร Generate regression testsร Complementary to model checking ร etc.
๏ผWe focus on state diagrams๏ผ๏ผWe focus on black-box technique๏ผ
Model Checkingร Model Checker: given a mathematical model M and
specification ฯ, automatically checks whether such specification holds for that model: M โ ฯ
Combining Model Learning
ร Goal: to check a system satisfies a set of properties ฯ!, โฆ ,ฯ!
ร Learn M using model learningร Check whether M satisfies all ฯ"
Angluin-Style Exact Learning Framework
Learner Teacher
System Under Learn(SUL)Membership queries
Equivalence queries
Make the conjecture
Yes
No +
Yes / No
Model Learning Overview
Outline1. Introduction2. Target Automata Type3. Approach4. Tools5. Application6. Challenge And Discussion
2. Target Automata Type
l Deterministic Finite Automata (DFAs)l Nondeterministic Finite Automata (NFAs)l Mealy/Moore Machinel Register Automata (RAs)l Bรผchi Automata (BAs)l Nominal Automatal Timed Automatal Weighted Automatal โฆ
Examples of Different Automata Type
DFAs NFAs
Mealy machine
Model Learning Overview
Outline1. Introduction2. Target Automata Type3. Approach4. Tools5. Application6. Challenge And Discussion
Goal: Given an unknown regular language L over an alphabet โ, generating a DFA M that accepts L by queries.
DFA M is a tuple (๐; โ; ๐ผ; ฮด; ๐น) whereโข Q is a finite set of statesโข โ is the set of alphabetโข I ร Q is the set of initial statesโข ฮด: Q ร โ โ ๐ธ is the transition relationโข Fร Q is the set of accepting states
Learning DFA
For a DFA M, we define ๐ฅ~#๐ฆ iff ฮด(๐$,๐ฅ) = ฮด(๐$,๐ฆ)โข The relation ~# is an equivalence relation.โข Some states are irrelevant for the accepted language.โข L(M) is the union of
For a language L, we define a relation ๐ฅ~%๐ฆ such that for each ๐ฃ โ โโ, ๐ฅ๐ฃ โ ๐ฟ โ ๐ฆ๐ฃ โ ๐ฟโข The relation ~% is an equivalence relation.โข Some equivalence classes are irrelevant for L.โข L is the union of
Right Congruence for DFA
Right Congruence for RE
The following statements are equivalent:โข L is a regular language on โโข there exists a right congruence relation over โโ such
that it has finitely many equivalent class, and L can be expressed as a union of some of the equivalencesโข ~% has finitely many equivalent classesMore over, for regular language, โโ/~% equals the number of states of the smallest DFA recognizing L.
Example ร the language consisting of binary representations of
numbers that can be divided by 3 is regular.
Myhill-Nerode Theorem
For a given target (minimal) DFA M, we have :โข Access string: M[x] := ฮด(๐$,๐ฅ)โข we use the access string x to access the state M[x]โข in general, many access strings access the same stateโข Distinguishing string: if xv โ L and yvโL or vice versaโข two access strings x, y access different states if such v
exists
Access String
โข We maintain an observation table: ๐: ๐ โช ๐โ โ {๊, ๊}'where S is prefix closedโข ๐ is closed and consistentโข closed: for ๐๐ฃ๐๐๐ฆ ๐ค โ ๐โ, ๐กโ๐๐๐ ๐๐ฅ๐๐ ๐ก ๐ค( โ ๐,๐๐๐ค ๐ค = ๐๐๐ค(๐ค().
โข consistent: if ๐ค!, ๐ค) โ ๐, ๐๐๐ค ๐ค! = ๐๐๐ค ๐ค) ,๐กโ๐๐ก ๐๐๐ค ๐ค! ยท โโ = ๐๐๐ค(๐ค) ยท โโ).
Approximation by Observation Table
๐ถ๐ป๐ ๐บ๐บ ๊
0 ๊
1 ๊
Access string
Distinguishing string
๐โ
๐ธ
๐ ๊: s ยท e โ L๊ : s ยท e โ L
Angluin โs L* Algorithm
Suppose the unknown regular set U is set of all strings over {0,1} with an even number of 0โs and an even number of 1โs.
Example
๐ถ๐ป๐ ๐บ๐บ ๊
0 ๊
1 ๊
๐ถ๐ป" ๐บ๐บ ๊
0 ๊
1 ๊
00 ๊
01 ๊
Initial observation table, S = E = {๐บ}
Augmented observation table,S = {๐บ, 0}E = {๐บ}
The observation table is consistent, but not closed, since row(0) is distinct from row(๐บ)
Suppose the unknown regular set U is set of all strings over {0,1} with an even number of 0โs and an even number of 1โs.
Example
๐ถ๐ป" ๐บ๐บ ๊
0 ๊
1 ๊
00 ๊
01 ๊
Augmented observation table,S = {๐บ, 0}E = {๐บ}
The observation table is consistent and closed, so L* make a conjecture of the acceptor ๐!
ฮด 0 1
๐0 ๐1 ๐1๐1 ๐0 ๐1
๐!, the first conjecture of L*
๐0 ๐1
0, 1
0
1
Teacher said: NoCounterexample๏ผ11(it is in U but rejected by ๐ด๐)
Example
๐ถ๐ป# ๐บ๐บ ๊
0 ๊
1 ๊
11 ๊
00 ๊
01 ๊
10 ๊
110 ๊
111 ๊
Observation table, S = {๐บ, 0, 1, 11}E = {๐บ}
Augmented observation table,S = {๐บ, 0, 1, 11}E = {๐บ, 0}
The observation table is closed, but not consistent, since row(0) = row(1) but row(00) โ row(10)
๐ถ๐ป& ๐บ 0
๐บ ๊ ๊
0 ๊ ๊
1 ๊ ๊
11 ๊ ๊
00 ๊ ๊
01 ๊ ๊
10 ๊ ๊
110 ๊ ๊
111 ๊ ๊
Example
Observation table,S = {๐บ, 0, 1, 11}E = {๐บ, 0}
๐ถ๐ป& ๐บ 0
๐บ ๊ ๊
0 ๊ ๊
1 ๊ ๊
11 ๊ ๊
00 ๊ ๊
01 ๊ ๊
10 ๊ ๊
110 ๊ ๊
111 ๊ ๊
The observation table is consistent and closed, so L* make a conjecture of the acceptor ๐"
ฮด 0 1
๐0 ๐1 ๐2
๐1 ๐0 ๐2
๐2 ๐2 ๐0
๐", the second conjecture of L*
๐0 ๐1
0
0
Teacher said: NoCounterexample๏ผ011(it is not in U but accepted by ๐ด๐)
๐2
11
1
0
Example
S = {๐บ, 0, 1, 11, 01, 011}, E = {๐บ, 0}
The observation table is closed, but not consistent, since row(1) = row(01) but row(11) โ row(011)
๐ถ๐ป( ๐บ 0
๐บ ๊ ๊
0 ๊ ๊
1 ๊ ๊
11 ๊ ๊
01 ๊ ๊
011 ๊ ๊
00 ๊ ๊
10 ๊ ๊
110 ๊ ๊
111 ๊ ๊
010 ๊ ๊
0110 ๊ ๊
0111 ๊ ๊
๐ถ๐ป) ๐บ 0 1
๐บ ๊ ๊ ๊
0 ๊ ๊ ๊
1 ๊ ๊ ๊
11 ๊ ๊ ๊
01 ๊ ๊ ๊
011 ๊ ๊ ๊
00 ๊ ๊ ๊
10 ๊ ๊ ๊
110 ๊ ๊ ๊
111 ๊ ๊ ๊
010 ๊ ๊ ๊
0110 ๊ ๊ ๊
0111 ๊ ๊ ๊
S = {๐บ, 0, 1, 11, 01, 011}, E = {๐บ , 0, 1}
Example๐ถ๐ป) ๐บ 0 1
๐บ ๊ ๊ ๊
0 ๊ ๊ ๊
1 ๊ ๊ ๊
11 ๊ ๊ ๊
01 ๊ ๊ ๊
011 ๊ ๊ ๊
00 ๊ ๊ ๊
10 ๊ ๊ ๊
110 ๊ ๊ ๊
111 ๊ ๊ ๊
010 ๊ ๊ ๊
0110 ๊ ๊ ๊
0111 ๊ ๊ ๊
S = {๐บ, 0, 1, 11, 01, 011}, E = {๐บ , 0, 1}
The observation table is consistent and closed, so L* make a conjecture of the acceptor ๐#
ฮด 0 1
๐0 ๐1 ๐2
๐1 ๐0 ๐3
๐2 ๐3 ๐0๐3 ๐2 ๐1
๐#, the second conjecture of L*Teacher said: Yes
๐0
๐1
1
๐21
1
0
๐3
0
1
0 0
Algorithm Publication
Angluins et al. 1987
Angluin's L* Learning regular sets from queries and counterexamples
Rivest and Schapire1993
R & S 's Algorithm
Inference of Finite Automata Using Homing Sequences
Kearns and Vazirani1994
K & V 's Algorithm
An introduction to computational learning theory
Parekh et al. 1997 ID and IID A polynomial time incremental algorithm for regular
grammar inferenceDenis et al. 2001
DeLeTe2 Learning regular languages using RFSAs
Bongard et al. 2005
Estimation-Exploration
Active Coevolutionary Learning of Deterministic Finite Automata
Isberner et al. 2014
The TTT Algorithm
The TTT Algorithm: A Redundancy-Free Approach to Active Automata Learning
Volpato et al.2015
LearnLTS Approximate Active Learning of Nondeterministic Input Output Transition Systems
Deterministic Finite Automata (DFAs)
Algorithm Publication
Georgios et al. 2016
MooreMIalgorithm
Learning Moore Machines from Input-Output Traces
Moerman et al. 2017
Product L* Algorithm
Learning Product Automata
Moore Machine
Mealy Machine
Algorithm Publication
Shahbaz et al.2009
LM* and LM+ Algorithm
Inferring Mealy Machines
Aarts et al.2010
IOA Algorithm Learning I/O Automata
Steffen et al. 2011
DHC and LM* Algorithm
Introduction to Active Automata Learning from a Practical Perspective
Algorithm Publication
Oncina et al.1992
RPNIAlgorithm
Inferring Regular Languages in Polynomial Updated Time
Dupont et al.1996
RPNI2 Algorithm
Incremental regular inference
Nondeterministic Finite Automata (NFA)
Register Automata (RA)
Algorithm Publication
Howar et al.2012
RAL Algorithm Inferring Canonical Register Automata
Cassel et al.2014
SL* Algorithm Active learning for extended finite state machines
Aarts et al.2015
A Mapper-Based Algorithm
Learning Register Automata with Fresh Value Generation
Algorithm Publication
Maler and Pnueli1995
Lฯ Algorithm On the learnability of infinitary regular sets
Farzan et al.2008
L* based for Bรผchiautomaton
Extending Automated Compositional Verification to the Full Class of Omega-Regular Languages
Angluin et al.2014
FDFAs-based Algorithm
Learning Regular Omega Languages
Li et al.2017
A Tree-based Algorithm for Bรผchi automaton
A Novel Learning Algorithm for Bรผchi Automata Based on Family of DFAs and Classification Trees
Bรผchi Automata
Other Automata Learning apporach
ร Event-Recording Automataโข Grinchtein et al. 2008. Learning of Event-Recording Automata.
ร deterministic finite cover automaton ( DFCA)โข Ipate et al. 2012. Learning finite cover automata from queries.
ร Timed Automataโข Maier et al. 2014. Online passive learning of timed automata for cyber-physical
production systems.
ร Weighted Automataโข Balle et al. 2015. Learning Weighted Automata.
ร Hybrid Automataโข Medhat et al. 2015. A framework for mining hybrid automata from input/output traces.
ร Visibly Pushdown Automataโข Isberner et al. 2015. Foundations of Active Automata Learning: An Algorithmic
Perspective.
ร Symbolic Automataโข Drews et al. 2017. Learning Symbolic Automata.
ร Nominal Automataโข Moerman et al. 2017. Learning nominal automata.
Model Learning Overview
Outline1. Introduction2. Target Automata Type3. Approach4. Tools5. Application6. Challenge And Discussion
4. ToolsOpen Source
l LearnLib https://learnlib.de/l Libalf http://libalf.informatik.rwth-aachen.de/l Tomte http://tomte.cs.ru.nl/l ROLL http://iscasmc.ios.ac.cn/roll/doku.phpl Symbolicautomata https://github.com/lorisdanto/symbolicautomata
Not foundl Next Generation LearnLib (NGLL)l RALTl RALib
LearnLib
ร LearnLib is a free and open source Java framework for automata learning.
Algorithm Target modelActive learning algorithmsADT MealyDHC MealyDiscrimination Tree DFAใMealyใVPDAKearns & Vazirani DFAใMealyL* DFAใMealyNL* NFATTT DFAใMealyใVPDAPassive learning algorithmsRPNI DFAใMealyRPNI โ EDSM DFARPNI โ MDL DFA
Libalf
Algorithm Passive Active Target modelAngluin's L* โ DFA
L* (adding counter-examples to columns) โ DFA
Kearns / Vazirani โ DFA
Rivest / Schapire โ DFANL* โ NFA
Regular positive negative inference (RPNI) โ DFA
DeLeTe2 โ NFA
Biermann & Feldman's algorithm โ NFA
Biermann & Feldman's algorithm (using SAT-solving) โ DFA
Tomteร This tool can only learn a restricted class of extended finite state
machines (EFSM), i.e. Register Automata.
รA Library of learning algorithms for ฯ-regular languages. ร It consists of two kinds of ฯ-regular learning algorithms:
the learning algorithm for FDFAsthe learning algorithm for Bรผchi automata
รA symbolic automata libraryรThis efficient automata library allows you to represent large (or infinite)
alphabets succinctly.
ROLL
Symbolicautomata
Model Learning Overview
Outline1. Introduction2. Target Automata Type3. Approach4. Tools5. Application6. Challenge And Discussion
Related work Approach Tool Application
Chalupar et al. 2014 L* for Mealy LearnLib SmartCard
Fiter et al. 2014 L* for Mealy Tomte TCP Network Protocol
Tijssen et al. 2014 L* for Mealy LearnLib SSH implementations
Shahbaz et al. 2014 LM+ RALT testing black-box system
Xiao et al. 2014 L* (Lazy Alphabet) TzuYu Learn Stateful Typestates
Ruiter et al. 2015 L* LearnLib TLS Protocol state fuzzing
Smeenk et al. 2015 Lee & Yannakakis' LearnLib Embedded Control Software
Ipate et al. 2015 Ll Testing
Meller et al. 2015 L* Model Checking of UML Systems
He et al. 2015 L* based (MTBDD) Verification of XXX
Fiter et al. 2016 L* for Mealy LearnLib TCP Implementations
Schuts et al. 2016 L* , TTT LearnLib Legacy Software
Chen et al. 2017 various L* libalf PAC verification & model synthesis
Weiss et al. 2017 L* RNN
Aichernig et al. 2017 improved L* Mealy LearnLib Mutation Testing
Tappler et al. 2017 TTT LearnLib Testing IoT Communication
Model checking & Conformance testing
Learner Teacher
Membership queriesMake the conjecture M
Yes / No
Conformance testing
Model checkerM โ ฯ ?
Counterexample
Counterexample
Yes
NoCannot be reproduced on the SUL
Can be reproduced on the SUL
We have demonstrated a bug in SUL and we stop learning
Approach to compare Legacy component and refactored implementation.
Legacy Software
Gail et al. use Angluinโs L* algorithm to elicit an automaton from any type of recurrent neural network, using the network as the teacher.
Extracting Automata from RNN
Termination problem: we require that a terminating tool returns answers that are correct, but we donot necessarily require an answer.l Trivial to build a tool: returns unknown simplyl Goal: keeping the unknown answers as low as possiblel Turing49: classical approach for proving terminationโข Termination argument searchโข Termination argument checking (easy)
Program Termination
Bรผchi automaton with rank Certificate (PLDIโ18)
Model Learning Overview
Outline1. Introduction2. Target Automata Type3. Approach4. Tools5. Application6. Challenge And Discussion
Challenge And Discussion
ร Equivalence queryร Beyond DFAs/Mealy machinesร Quality of modelsร Predicates and operations on dataร Opening the box