SlideShare a Scribd company logo
M.-A. Plourde, S. Hallé
Marc-Antoine Plourde and Sylvain Hallé
Université du Québec à Chicoutimi
CANADA
A Generic And Flexible Data
Structure Generator
CRSNG
NSERC
synthia
synthia
M.-A. Plourde, S. Hallé
A software sytem
I
M.-A. Plourde, S. Hallé
A software sytem
I
♠ ♣
* #
♦
?
M.-A. Plourde, S. Hallé
A software sytem
I
M.-A. Plourde, S. Hallé
A software sytem
I
2
3
4
π
M.-A. Plourde, S. Hallé
A software sytem
I
abc
M.-A. Plourde, S. Hallé
A software sytem
I
M.-A. Plourde, S. Hallé
A software sytem
I
,
M.-A. Plourde, S. Hallé
A software sytem
I
, +
⊇?
,
M.-A. Plourde, S. Hallé
A software sytem
I
, +
⊇?
, OK
+ abc
foo
,
M.-A. Plourde, S. Hallé
A software sytem
I
, +
⊇?
, OK
+ abc
foo
,
M.-A. Plourde, S. Hallé
A software sytem
I
M.-A. Plourde, S. Hallé
A software sytem
I
Size 10 20 30 40 50 60 70 80 90 . . .
. . .
M.-A. Plourde, S. Hallé
Generating "synthetic" inputs
M.-A. Plourde, S. Hallé
Generating "synthetic" inputs
script
M.-A. Plourde, S. Hallé
Generating "synthetic" inputs
script
M.-A. Plourde, S. Hallé
Generating "synthetic" inputs
script
M.-A. Plourde, S. Hallé
Generating "synthetic" inputs
M.-A. Plourde, S. Hallé
synthia
synthia
Enter Synthia
A Java library to facilitate the generation of
synthetic objects of various kinds
Intended to be reusable from one scenario to the
next
Provides high-level abstractions of common
functionalities
M.-A. Plourde, S. Hallé
Pickers
The library is centered on the concept of Picker; it
is an interface defining a method called pick.
P
picker
interface Picker<T> {
public T pick();
}
pick? t
M.-A. Plourde, S. Hallé
Some built-in Pickers
Random integer in interval [m,n]
[m,n]
42
42
42
¼
42
p
λ
42
3
Uniform float in interval [0,1]
Integer in Poisson distribution of parameter λ
Integer in Gaussian distribution N(0,1)
Biased coin flip with probability p
M.-A. Plourde, S. Hallé
Some built-in Pickers
Random integer in interval [m,n]
[m,n]
42
42
42
¼
42
p
λ
42
3
Uniform float in interval [0,1]
Integer in Poisson distribution of parameter λ
Integer in Gaussian distribution N(0,1)
Biased coin flip with probability p
seed
M.-A. Plourde, S. Hallé
Seedable Pickers
[m,n]
Pseudo-random pickers implement an interface
called Seedable, whose method setSeed can be
used to set the starting seed of the algorithm.
setSeed(42)
Each Seedable picker guarantees to generate the
same objects in the same order for a given starting
seed.
M.-A. Plourde, S. Hallé
Other built-in Pickers
[a,b,c,d]
Playback outputs objects by iterating on a
predefined list, optionally looping around.
Constant is a special Playback producing a single
value.
c
list of objects
loop
value
M.-A. Plourde, S. Hallé
Resettable and Duplicable Pickers
Pickers implement two other interfaces, each
defining a single additional method.
Duplicable: method duplicate creates a copy of
the current picker and places the new copy in
current internal state of the original
Resettable: method reset puts a picker back into
the state it was at construction
This is also true of Seedable (i.e. pseudo-random)
pickers!
M.-A. Plourde, S. Hallé
P
A picker can be instantiated by giving
references to other picker instances.
The picker calls these other pickers to
decide how to generate its own
objects.
Graphically, this results in a "wiring diagram" of
interconnected pickers.
Wiring diagram
M.-A. Plourde, S. Hallé
Tick
s δ
For example: the Tick picker is parameterized by
two pickers producing numbers.
M.-A. Plourde, S. Hallé
Tick
s δ
For example: the Tick picker is parameterized by
two pickers producing numbers.
start value increment
M.-A. Plourde, S. Hallé
0 1
0, 1, 2, 3, 4, 5, ...
Tick
s δ
For example: the Tick picker is parameterized by
two pickers producing numbers.
M.-A. Plourde, S. Hallé
42 1
7, 8, 9, 10, 11, 12, ...
[0,10]
Tick
s δ
For example: the Tick picker is parameterized by
two pickers producing numbers.
M.-A. Plourde, S. Hallé
0 [1,2]
0, 1, 3, 4, 6, 7, ...
Tick
s δ
For example: the Tick picker is parameterized by
two pickers producing numbers.
M.-A. Plourde, S. Hallé
http://www.retrolinear.com/services/analog-synth-restoration.aspx
"Pickers parameterized by other pickers": powerful
concept making Synthia very flexible to generate
objects following various patterns.
Wiring diagram
Similar in nature
to synthesizers of
the 1970s, with
modules connected
by patch cables!
M.-A. Plourde, S. Hallé
Create list/set/array of given size with
objects from upstream picker
Other built-in Pickers
Freeze first value of upstream picker
Scramble ordering of objects from upstream
picker
Enumerate tuples with all combinations of
elements from upstream pickers
Pick element from list with probabilities
{ a,b,c,d }
[a,b,c,d]
M.-A. Plourde, S. Hallé
Geometric Pickers
2D point in Cartesian coordinates (x,y)
2D point in polar coordinates (r,θ)
Sides of a triangle of unit perimeter
Polyomino of given size
r θ
x y
b 1
m 2
Affine transform mx+b
M.-A. Plourde, S. Hallé
Behavioral pickers
Some pickers produce objects following a complex
sequence, useful to simulate the "behavior" of some
component. The possible sequences can be defined
using...
Markov
chain
Behavior
tree
Formal
grammar
M.-A. Plourde, S. Hallé
P p m Knit interleaves objects produced by
multiple instances of a picker P to form
a single sequence of objects
Behavioral pickers
P P P
a
b
c
d
e
f
g
h
i a h d e i b f g
c
p m
42 42
1 2 3
M.-A. Plourde, S. Hallé
A Java code example
r θ
HyperspherePicker h = new HyperspherePicker(r, a);
M.-A. Plourde, S. Hallé
r θ
[1,2]
42
RandomInteger r = new RandomInteger(1, 2);
HyperspherePicker h = new HyperspherePicker(r, a);
A Java code example
M.-A. Plourde, S. Hallé
r θ
b 0
m 2π
[1,2]
42
RandomInteger r = new RandomInteger(1, 2);
AffineTransformFloat a =
new AffineTransformFloat(f, 2*PI, 0);
HyperspherePicker h = new HyperspherePicker(r, a);
A Java code example
M.-A. Plourde, S. Hallé
r θ
b 0
m 2π
42
[1,2]
42
RandomInteger r = new RandomInteger(1, 2);
RandomFloat f = new RandomFloat().setSeed(42);
AffineTransformFloat a =
new AffineTransformFloat(f, 2*PI, 0);
HyperspherePicker h = new HyperspherePicker(r, a);
A Java code example
M.-A. Plourde, S. Hallé
r θ
b 0
m 2π
42
[1,2]
42
RandomInteger r = new RandomInteger(1, 2);
RandomFloat f = new RandomFloat().setSeed(42);
AffineTransformFloat a =
new AffineTransformFloat(f, 2*PI, 0);
HyperspherePicker h = new HyperspherePicker(r, a);
for (int i = 0; i < 100; i++) {
Utilities.print(System.out, h.pick());
}
A Java code example
M.-A. Plourde, S. Hallé
r θ
b 0
m 2π
42
[1,2]
42
RandomInteger r = new RandomInteger(1, 2);
RandomFloat f = new RandomFloat().setSeed(42);
AffineTransformFloat a =
new AffineTransformFloat(f, 2*PI, 0);
HyperspherePicker h = new HyperspherePicker(r, a);
for (int i = 0; i < 100; i++) {
Utilities.print(System.out, h.pick());
}
A Java code example
M.-A. Plourde, S. Hallé
RandomInteger r = new RandomInteger(1, 2);
RandomFloat f = new RandomFloat().setSeed(42);
AffineTransformFloat a =
new AffineTransformFloat(f, 2*PI, 0);
HyperspherePicker h = new HyperspherePicker(r, a);
for (int i = 0; i < 100; i++) {
Utilities.print(System.out, h.pick());
}
r θ
b 0
m 2π
42
[1,2]
42
A Java code example
M.-A. Plourde, S. Hallé
r θ
π/6
s δ
42
[0, ,π, ]
π/2
π/2
3
s δ
/6
1
[0,1]
42
RandomFloat f1 = new RandomFloat().setSeed(42);
RandomFloat f2 = new RandomFloat().setSeed(40);
AffineTransformFloat af =
new AffineTransformFloat(f1, 2, 1);
Freeze<Float> r = new Freeze<Float>(af);
Choice<Double> a = new Choice<Double>(f2)
.add(0d, 0.25).add(PI / 2, 0.25)
.add(PI, 0.25).add(3*PI / 2, 0.25);
HyperspherePicker hp =
new HyperspherePicker(radius, angle);
A Java code example
M.-A. Plourde, S. Hallé
Other examples
s δ
-1 10-4
x y
1000
s δ
0 .1
s δ
0 k
1
0
0
M.-A. Plourde, S. Hallé
Other examples
11.205.232.45 - - [26-Oct-1985 01:21:00 EDT 0] "GET J0.html HTTP/2" 200 1000
11.130.222.207 - - [26-Oct-1985 01:21:04 EDT 0] "GET Xv.html HTTP/2" 200 1000
11.130.222.207 - - [26-Oct-1985 01:21:09 EDT 0] "GET 9y.html HTTP/2" 200 1000
11.16.2.198 - - [26-Oct-1985 01:21:17 EDT 0] "GET Xv.html HTTP/2" 200 1000
11.130.222.207 - - [26-Oct-1985 01:21:27 EDT 0] "GET t0.html HTTP/2" 200 1000
45.86.208.44 - - [26-Oct-1985 01:21:29 EDT 0] "GET b7.html HTTP/2" 200 1000
10.112.251.183 - - [26-Oct-1985 01:21:34 EDT 0] "GET b7.html HTTP/2" 200 1000
11.130.222.207 - - [26-Oct-1985 01:21:40 EDT 0] "GET 9y.html HTTP/2" 200 1000
11.16.2.198 - - [26-Oct-1985 01:21:41 EDT 0] "GET 9y.html HTTP/2" 200 1000
45.86.208.44 - - [26-Oct-1985 01:21:45 EDT 0] "GET 9y.html HTTP/2" 200 1000
M.-A. Plourde, S. Hallé
Other features
Since Synthia can generate inputs for a system, it is
natural to use it in a software testing context. The
library offers a few features for this purpose:
Test input shrinking: generate inputs that violate a
condition, and automatically find "smaller" inputs
that also violate it
Object mutation: special pickers receive objects
and apply a "modification" to them
Monkey testing: generate sequences of actions
sent to a reactive system
Provenance tracking: explain the origins of a value
generated by a wiring diagram
M.-A. Plourde, S. Hallé
Explainability
We point to a part of a result produced by a picker,
and Synthia can provide an explanation for it.
M.-A. Plourde, S. Hallé
Explainability
We point to a part of a result produced by a picker,
and Synthia can provide an explanation for it.
[1,2]
42
s δ [0,1,-1]
x y
4
x ≠ y
0
M.-A. Plourde, S. Hallé
Explainability
[1,2]
42
s δ [0,1,-1]
x y
4
x ≠ y
0
[(2,-1),(3,0),(4,1),(5,-1)]
We point to a part of a result produced by a picker,
and Synthia can provide an explanation for it.
M.-A. Plourde, S. Hallé
[1,2]
42
s δ [0,1,-1]
x y
4
x ≠ y
0
[(2,-1),(3,0),(4,1),(5,-1)]
Explainability
We point to a part of a result produced by a picker,
and Synthia can provide an explanation for it.
M.-A. Plourde, S. Hallé
1∘1
1
3
3
3
1
[0,1,-1] 3
1
1
0
2 2
1
1
-1
[1,2]
42
s δ [0,1,-1]
x y
4
x ≠ y
0
[(2,-1),(3,0),(4,1),(5,-1)]
Explainability
We point to a part of a result produced by a picker,
and Synthia can provide an explanation for it.
M.-A. Plourde, S. Hallé
Automatic shrinking
Pickers implementing the Shrinkable interface can
produce a picker returning "smaller" objects.
interface Shrinkable<T> extends Picker<T> {
public Shrinkable<T> shrink(T t);
}
P
t
shrink( )
t P'
t'
t' t
M.-A. Plourde, S. Hallé
Automatic shrinking
Pickers implementing the Shrinkable interface can
produce a picker returning "smaller" objects.
P
1
shrink( )
t1
t1
P
2
shrink( )
t2
t2
...
shrink( )
tn-1
P
n
tn
M.-A. Plourde, S. Hallé
Automatic shrinking
Pickers implementing the Shrinkable interface can
produce a picker returning "smaller" objects.
P
1
shrink( )
t1
t1
P
2
shrink( )
t2
t2
...
shrink( )
tn-1
P
n
tn
M.-A. Plourde, S. Hallé
Automatic shrinking
Pickers implementing the Shrinkable interface can
produce a picker returning "smaller" objects.
P
1
shrink( )
t1
t1
P
2
shrink( )
t2
t2
...
shrink( )
tn-1
P
n
tn
M.-A. Plourde, S. Hallé
Grammar-based shrinking
Synthia can interact with a reactive component by
producing sequences of actions following a
grammar (or Markov chain, behavior tree).
<S> := <number> <op> <number> <inop> ;
<inop> := <op> <number> <inop> | = ;
<number> := <integer> <digit> <rest> | <integer> ;
<integer> := <nzdigit> <rest> ;
<rest> := <digit> <rest> | ε ;
<digit> := 0 | <nzdigit> ;
<nzdigit> := 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 ;
<op> := + | − | × | ÷ ;
A sequence leading to a failure can be
automatically shrunk and still follow the grammar.
M.-A. Plourde, S. Hallé
Eat your own dog food
Public disclosure: the authors of Synthia use
Synthia themselves!
Examples:
Test Suite Generation for Boolean Conditions with
Equivalence Class Partitioning, FormaliSE 2022
Boolean formulas
A Modular Runtime Enforcement Model using Multi-
Traces, FPS 2021
Behavioral sequences of events
Automated Repair of Layout Bugs in Web Pages with
Linear Programming, ICWE 2021
Web pages with injected layout faults
M.-A. Plourde, S. Hallé
Code examples
Synthia comes with many detailed code examples
highlighting its features.
https://liflab.github.io/synthia/javadoc
M.-A. Plourde, S. Hallé
Conclusion
Many other features left uncovered: picker
duplication, object mutation, value enumeration,
etc.
Many other data types not showcased: graphs,
complex Java objects, etc.
Simple and "clean" set of abstract interfaces allow
a modular and versatile design.
Used in computer experiments in multiple scientific
publications
https://github.com/liflab/synthia

More Related Content

What's hot (20)

PPTX
PHYSICAL SCIENCE BIOLOGICAL MACROMOLECULES.pptx
Juvy41
 
PPTX
DNA structure and chromosome organization
nadeem akhter
 
PPT
Dating Geologic Time Scale-Geomorphology chapter
Kaium Chowdhury
 
PPT
Earth's Geosphere
I Wonder Why Science
 
PPT
08 an introduction to metabolism
kindarspirit
 
PPTX
HEAT-GRADE 8 final.pptx
PauloAngeles4
 
PPTX
Cytoplasmic membrane systems (chap8)
Geonyzl Alviola
 
PPT
Central Dogma of Life
Jasper Falalimpa
 
PPTX
Comparing Photosynthesis & Cellular Respiration
Lorraine Stratton
 
PPTX
Prokaryotes and eukaryotes AND plant and animal cell
Simple ABbieC
 
PPT
Cell structure and functions
Anushka Ninama
 
PDF
Short Story Writing Sample
Michelle Lugauskas
 
PPTX
Dna and protein synthesis
Paula Mills
 
PDF
Baal e-jibreel by allama iqbal (pdfbookshub.blogspot.com)
akhtar_Salik
 
PPT
Chapter 2.3 carbon based molecules
Anisa Farah
 
PDF
Nat reviewer in hekasi#1
Janette Diego
 
PPT
DNA structure replication transcription translation
Aman Ullah
 
PPT
Parts of periodic table
mae2388
 
PPT
Cell Division Mitosis and Meiosis
Catherine Patterson
 
PPTX
Metals, nonmetals and metalloids
Simple ABbieC
 
PHYSICAL SCIENCE BIOLOGICAL MACROMOLECULES.pptx
Juvy41
 
DNA structure and chromosome organization
nadeem akhter
 
Dating Geologic Time Scale-Geomorphology chapter
Kaium Chowdhury
 
Earth's Geosphere
I Wonder Why Science
 
08 an introduction to metabolism
kindarspirit
 
HEAT-GRADE 8 final.pptx
PauloAngeles4
 
Cytoplasmic membrane systems (chap8)
Geonyzl Alviola
 
Central Dogma of Life
Jasper Falalimpa
 
Comparing Photosynthesis & Cellular Respiration
Lorraine Stratton
 
Prokaryotes and eukaryotes AND plant and animal cell
Simple ABbieC
 
Cell structure and functions
Anushka Ninama
 
Short Story Writing Sample
Michelle Lugauskas
 
Dna and protein synthesis
Paula Mills
 
Baal e-jibreel by allama iqbal (pdfbookshub.blogspot.com)
akhtar_Salik
 
Chapter 2.3 carbon based molecules
Anisa Farah
 
Nat reviewer in hekasi#1
Janette Diego
 
DNA structure replication transcription translation
Aman Ullah
 
Parts of periodic table
mae2388
 
Cell Division Mitosis and Meiosis
Catherine Patterson
 
Metals, nonmetals and metalloids
Simple ABbieC
 

Similar to Synthia: a Generic and Flexible Data Structure Generator (Long Version) (20)

PDF
Bolt C++ Standard Template Libary for HSA by Ben Sanders, AMD
HSA Foundation
 
PDF
Property-based Testing and Generators (Lua)
Sumant Tambe
 
PDF
Java image processing ieee projects 2012 @ Seabirds ( Chennai, Bangalore, Hyd...
SBGC
 
PDF
Abstracting Vector Architectures in Library Generators: Case Study Convolutio...
ETH Zurich
 
PDF
Talk: Pharo at JM2L 2009
Marcus Denker
 
PDF
Introduction To Computing And Programming In Python A Multimedia Approach Pap...
kelanteplype
 
PDF
NoiseGen at Arlington Ruby 2012
awwaiid
 
PDF
Data Mining-based Tools to Support Library Update. PhD Defence of Oleksandr Z...
Oleksandr Zaitsev
 
PDF
turecko-150426_pse_01
Peter Fabo
 
PDF
Digital Imaging with Free Software - Talk at Sheffield Astronomical Society J...
Jan Wedekind
 
PDF
PT-4054, "OpenCL™ Accelerated Compute Libraries" by John Melonakos
AMD Developer Central
 
PDF
Ik2515011504
IJERA Editor
 
PPTX
Timelapse: interactive record/replay for the web
brrian
 
PDF
Machine Learning-based Tools to Support Library Update
Oleksandr Zaitsev
 
PPTX
Analysis of vibration signals to identify cracks in a gear unit
sushanthsjce
 
PPT
Knoxville aug02-full
douglaslyon
 
PDF
Producing simulation sequences by use of a Java-based Framework
Daniele Gianni
 
PDF
Modelling of Walking Humanoid Robot With Capability of Floor Detection and Dy...
ijfcstjournal
 
PDF
Modelling of walking humanoid robot with capability of floor detection and dy...
ijfcstjournal
 
PPTX
Iris an architecture for cognitive radio networking testbeds
Patricia Oniga
 
Bolt C++ Standard Template Libary for HSA by Ben Sanders, AMD
HSA Foundation
 
Property-based Testing and Generators (Lua)
Sumant Tambe
 
Java image processing ieee projects 2012 @ Seabirds ( Chennai, Bangalore, Hyd...
SBGC
 
Abstracting Vector Architectures in Library Generators: Case Study Convolutio...
ETH Zurich
 
Talk: Pharo at JM2L 2009
Marcus Denker
 
Introduction To Computing And Programming In Python A Multimedia Approach Pap...
kelanteplype
 
NoiseGen at Arlington Ruby 2012
awwaiid
 
Data Mining-based Tools to Support Library Update. PhD Defence of Oleksandr Z...
Oleksandr Zaitsev
 
turecko-150426_pse_01
Peter Fabo
 
Digital Imaging with Free Software - Talk at Sheffield Astronomical Society J...
Jan Wedekind
 
PT-4054, "OpenCL™ Accelerated Compute Libraries" by John Melonakos
AMD Developer Central
 
Ik2515011504
IJERA Editor
 
Timelapse: interactive record/replay for the web
brrian
 
Machine Learning-based Tools to Support Library Update
Oleksandr Zaitsev
 
Analysis of vibration signals to identify cracks in a gear unit
sushanthsjce
 
Knoxville aug02-full
douglaslyon
 
Producing simulation sequences by use of a Java-based Framework
Daniele Gianni
 
Modelling of Walking Humanoid Robot With Capability of Floor Detection and Dy...
ijfcstjournal
 
Modelling of walking humanoid robot with capability of floor detection and dy...
ijfcstjournal
 
Iris an architecture for cognitive radio networking testbeds
Patricia Oniga
 
Ad

More from Sylvain Hallé (20)

PDF
A Tree-Based Definition of Business Process Conformance (Talk @ EDOC 2024)
Sylvain Hallé
 
PDF
Monitoring Business Process Compliance Across Multiple Executions with Stream...
Sylvain Hallé
 
PDF
A Stream-Based Approach to Intrusion Detection
Sylvain Hallé
 
PDF
Event Stream Processing with BeepBeep 3
Sylvain Hallé
 
PDF
Smart Contracts-Enabled Simulation for Hyperconnected Logistics
Sylvain Hallé
 
PDF
Test Suite Generation for Boolean Conditions with Equivalence Class Partitioning
Sylvain Hallé
 
PDF
Test Sequence Generation with Cayley Graphs (Talk @ A-MOST 2021)
Sylvain Hallé
 
PDF
Efficient Offline Monitoring of LTL with Bit Vectors (Talk at SAC 2021)
Sylvain Hallé
 
PDF
A Generic Explainability Framework for Function Circuits
Sylvain Hallé
 
PDF
Detecting Responsive Web Design Bugs with Declarative Specifications
Sylvain Hallé
 
PDF
Streamlining the Inclusion of Computer Experiments in Research Papers
Sylvain Hallé
 
PDF
Writing Domain-Specific Languages for BeepBeep
Sylvain Hallé
 
PDF
Real-Time Data Mining for Event Streams
Sylvain Hallé
 
PDF
Technologies intelligentes d'aide au développement d'applications web (WAQ 2018)
Sylvain Hallé
 
PDF
Mining event streams with BeepBeep 3
Sylvain Hallé
 
PDF
LabPal: Repeatable Computer Experiments Made Easy (ACM Workshop Talk)
Sylvain Hallé
 
PDF
A "Do-It-Yourself" Specification Language with BeepBeep 3 (Talk @ Dagstuhl 2017)
Sylvain Hallé
 
PDF
Event Stream Processing with Multiple Threads
Sylvain Hallé
 
PDF
A Few Things We Heard About RV Tools (Position Paper)
Sylvain Hallé
 
PDF
Solving Equations on Words with Morphisms and Antimorphisms
Sylvain Hallé
 
A Tree-Based Definition of Business Process Conformance (Talk @ EDOC 2024)
Sylvain Hallé
 
Monitoring Business Process Compliance Across Multiple Executions with Stream...
Sylvain Hallé
 
A Stream-Based Approach to Intrusion Detection
Sylvain Hallé
 
Event Stream Processing with BeepBeep 3
Sylvain Hallé
 
Smart Contracts-Enabled Simulation for Hyperconnected Logistics
Sylvain Hallé
 
Test Suite Generation for Boolean Conditions with Equivalence Class Partitioning
Sylvain Hallé
 
Test Sequence Generation with Cayley Graphs (Talk @ A-MOST 2021)
Sylvain Hallé
 
Efficient Offline Monitoring of LTL with Bit Vectors (Talk at SAC 2021)
Sylvain Hallé
 
A Generic Explainability Framework for Function Circuits
Sylvain Hallé
 
Detecting Responsive Web Design Bugs with Declarative Specifications
Sylvain Hallé
 
Streamlining the Inclusion of Computer Experiments in Research Papers
Sylvain Hallé
 
Writing Domain-Specific Languages for BeepBeep
Sylvain Hallé
 
Real-Time Data Mining for Event Streams
Sylvain Hallé
 
Technologies intelligentes d'aide au développement d'applications web (WAQ 2018)
Sylvain Hallé
 
Mining event streams with BeepBeep 3
Sylvain Hallé
 
LabPal: Repeatable Computer Experiments Made Easy (ACM Workshop Talk)
Sylvain Hallé
 
A "Do-It-Yourself" Specification Language with BeepBeep 3 (Talk @ Dagstuhl 2017)
Sylvain Hallé
 
Event Stream Processing with Multiple Threads
Sylvain Hallé
 
A Few Things We Heard About RV Tools (Position Paper)
Sylvain Hallé
 
Solving Equations on Words with Morphisms and Antimorphisms
Sylvain Hallé
 
Ad

Recently uploaded (20)

PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
July Patch Tuesday
Ivanti
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
July Patch Tuesday
Ivanti
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 

Synthia: a Generic and Flexible Data Structure Generator (Long Version)

  • 1. M.-A. Plourde, S. Hallé Marc-Antoine Plourde and Sylvain Hallé Université du Québec à Chicoutimi CANADA A Generic And Flexible Data Structure Generator CRSNG NSERC synthia synthia
  • 2. M.-A. Plourde, S. Hallé A software sytem I
  • 3. M.-A. Plourde, S. Hallé A software sytem I ♠ ♣ * # ♦ ?
  • 4. M.-A. Plourde, S. Hallé A software sytem I
  • 5. M.-A. Plourde, S. Hallé A software sytem I 2 3 4 π
  • 6. M.-A. Plourde, S. Hallé A software sytem I abc
  • 7. M.-A. Plourde, S. Hallé A software sytem I
  • 8. M.-A. Plourde, S. Hallé A software sytem I ,
  • 9. M.-A. Plourde, S. Hallé A software sytem I , + ⊇? ,
  • 10. M.-A. Plourde, S. Hallé A software sytem I , + ⊇? , OK + abc foo ,
  • 11. M.-A. Plourde, S. Hallé A software sytem I , + ⊇? , OK + abc foo ,
  • 12. M.-A. Plourde, S. Hallé A software sytem I
  • 13. M.-A. Plourde, S. Hallé A software sytem I Size 10 20 30 40 50 60 70 80 90 . . . . . .
  • 14. M.-A. Plourde, S. Hallé Generating "synthetic" inputs
  • 15. M.-A. Plourde, S. Hallé Generating "synthetic" inputs script
  • 16. M.-A. Plourde, S. Hallé Generating "synthetic" inputs script
  • 17. M.-A. Plourde, S. Hallé Generating "synthetic" inputs script
  • 18. M.-A. Plourde, S. Hallé Generating "synthetic" inputs
  • 19. M.-A. Plourde, S. Hallé synthia synthia Enter Synthia A Java library to facilitate the generation of synthetic objects of various kinds Intended to be reusable from one scenario to the next Provides high-level abstractions of common functionalities
  • 20. M.-A. Plourde, S. Hallé Pickers The library is centered on the concept of Picker; it is an interface defining a method called pick. P picker interface Picker<T> { public T pick(); } pick? t
  • 21. M.-A. Plourde, S. Hallé Some built-in Pickers Random integer in interval [m,n] [m,n] 42 42 42 ¼ 42 p λ 42 3 Uniform float in interval [0,1] Integer in Poisson distribution of parameter λ Integer in Gaussian distribution N(0,1) Biased coin flip with probability p
  • 22. M.-A. Plourde, S. Hallé Some built-in Pickers Random integer in interval [m,n] [m,n] 42 42 42 ¼ 42 p λ 42 3 Uniform float in interval [0,1] Integer in Poisson distribution of parameter λ Integer in Gaussian distribution N(0,1) Biased coin flip with probability p seed
  • 23. M.-A. Plourde, S. Hallé Seedable Pickers [m,n] Pseudo-random pickers implement an interface called Seedable, whose method setSeed can be used to set the starting seed of the algorithm. setSeed(42) Each Seedable picker guarantees to generate the same objects in the same order for a given starting seed.
  • 24. M.-A. Plourde, S. Hallé Other built-in Pickers [a,b,c,d] Playback outputs objects by iterating on a predefined list, optionally looping around. Constant is a special Playback producing a single value. c list of objects loop value
  • 25. M.-A. Plourde, S. Hallé Resettable and Duplicable Pickers Pickers implement two other interfaces, each defining a single additional method. Duplicable: method duplicate creates a copy of the current picker and places the new copy in current internal state of the original Resettable: method reset puts a picker back into the state it was at construction This is also true of Seedable (i.e. pseudo-random) pickers!
  • 26. M.-A. Plourde, S. Hallé P A picker can be instantiated by giving references to other picker instances. The picker calls these other pickers to decide how to generate its own objects. Graphically, this results in a "wiring diagram" of interconnected pickers. Wiring diagram
  • 27. M.-A. Plourde, S. Hallé Tick s δ For example: the Tick picker is parameterized by two pickers producing numbers.
  • 28. M.-A. Plourde, S. Hallé Tick s δ For example: the Tick picker is parameterized by two pickers producing numbers. start value increment
  • 29. M.-A. Plourde, S. Hallé 0 1 0, 1, 2, 3, 4, 5, ... Tick s δ For example: the Tick picker is parameterized by two pickers producing numbers.
  • 30. M.-A. Plourde, S. Hallé 42 1 7, 8, 9, 10, 11, 12, ... [0,10] Tick s δ For example: the Tick picker is parameterized by two pickers producing numbers.
  • 31. M.-A. Plourde, S. Hallé 0 [1,2] 0, 1, 3, 4, 6, 7, ... Tick s δ For example: the Tick picker is parameterized by two pickers producing numbers.
  • 32. M.-A. Plourde, S. Hallé http://www.retrolinear.com/services/analog-synth-restoration.aspx "Pickers parameterized by other pickers": powerful concept making Synthia very flexible to generate objects following various patterns. Wiring diagram Similar in nature to synthesizers of the 1970s, with modules connected by patch cables!
  • 33. M.-A. Plourde, S. Hallé Create list/set/array of given size with objects from upstream picker Other built-in Pickers Freeze first value of upstream picker Scramble ordering of objects from upstream picker Enumerate tuples with all combinations of elements from upstream pickers Pick element from list with probabilities { a,b,c,d } [a,b,c,d]
  • 34. M.-A. Plourde, S. Hallé Geometric Pickers 2D point in Cartesian coordinates (x,y) 2D point in polar coordinates (r,θ) Sides of a triangle of unit perimeter Polyomino of given size r θ x y b 1 m 2 Affine transform mx+b
  • 35. M.-A. Plourde, S. Hallé Behavioral pickers Some pickers produce objects following a complex sequence, useful to simulate the "behavior" of some component. The possible sequences can be defined using... Markov chain Behavior tree Formal grammar
  • 36. M.-A. Plourde, S. Hallé P p m Knit interleaves objects produced by multiple instances of a picker P to form a single sequence of objects Behavioral pickers P P P a b c d e f g h i a h d e i b f g c p m 42 42 1 2 3
  • 37. M.-A. Plourde, S. Hallé A Java code example r θ HyperspherePicker h = new HyperspherePicker(r, a);
  • 38. M.-A. Plourde, S. Hallé r θ [1,2] 42 RandomInteger r = new RandomInteger(1, 2); HyperspherePicker h = new HyperspherePicker(r, a); A Java code example
  • 39. M.-A. Plourde, S. Hallé r θ b 0 m 2π [1,2] 42 RandomInteger r = new RandomInteger(1, 2); AffineTransformFloat a = new AffineTransformFloat(f, 2*PI, 0); HyperspherePicker h = new HyperspherePicker(r, a); A Java code example
  • 40. M.-A. Plourde, S. Hallé r θ b 0 m 2π 42 [1,2] 42 RandomInteger r = new RandomInteger(1, 2); RandomFloat f = new RandomFloat().setSeed(42); AffineTransformFloat a = new AffineTransformFloat(f, 2*PI, 0); HyperspherePicker h = new HyperspherePicker(r, a); A Java code example
  • 41. M.-A. Plourde, S. Hallé r θ b 0 m 2π 42 [1,2] 42 RandomInteger r = new RandomInteger(1, 2); RandomFloat f = new RandomFloat().setSeed(42); AffineTransformFloat a = new AffineTransformFloat(f, 2*PI, 0); HyperspherePicker h = new HyperspherePicker(r, a); for (int i = 0; i < 100; i++) { Utilities.print(System.out, h.pick()); } A Java code example
  • 42. M.-A. Plourde, S. Hallé r θ b 0 m 2π 42 [1,2] 42 RandomInteger r = new RandomInteger(1, 2); RandomFloat f = new RandomFloat().setSeed(42); AffineTransformFloat a = new AffineTransformFloat(f, 2*PI, 0); HyperspherePicker h = new HyperspherePicker(r, a); for (int i = 0; i < 100; i++) { Utilities.print(System.out, h.pick()); } A Java code example
  • 43. M.-A. Plourde, S. Hallé RandomInteger r = new RandomInteger(1, 2); RandomFloat f = new RandomFloat().setSeed(42); AffineTransformFloat a = new AffineTransformFloat(f, 2*PI, 0); HyperspherePicker h = new HyperspherePicker(r, a); for (int i = 0; i < 100; i++) { Utilities.print(System.out, h.pick()); } r θ b 0 m 2π 42 [1,2] 42 A Java code example
  • 44. M.-A. Plourde, S. Hallé r θ π/6 s δ 42 [0, ,π, ] π/2 π/2 3 s δ /6 1 [0,1] 42 RandomFloat f1 = new RandomFloat().setSeed(42); RandomFloat f2 = new RandomFloat().setSeed(40); AffineTransformFloat af = new AffineTransformFloat(f1, 2, 1); Freeze<Float> r = new Freeze<Float>(af); Choice<Double> a = new Choice<Double>(f2) .add(0d, 0.25).add(PI / 2, 0.25) .add(PI, 0.25).add(3*PI / 2, 0.25); HyperspherePicker hp = new HyperspherePicker(radius, angle); A Java code example
  • 45. M.-A. Plourde, S. Hallé Other examples s δ -1 10-4 x y 1000 s δ 0 .1 s δ 0 k 1 0 0
  • 46. M.-A. Plourde, S. Hallé Other examples 11.205.232.45 - - [26-Oct-1985 01:21:00 EDT 0] "GET J0.html HTTP/2" 200 1000 11.130.222.207 - - [26-Oct-1985 01:21:04 EDT 0] "GET Xv.html HTTP/2" 200 1000 11.130.222.207 - - [26-Oct-1985 01:21:09 EDT 0] "GET 9y.html HTTP/2" 200 1000 11.16.2.198 - - [26-Oct-1985 01:21:17 EDT 0] "GET Xv.html HTTP/2" 200 1000 11.130.222.207 - - [26-Oct-1985 01:21:27 EDT 0] "GET t0.html HTTP/2" 200 1000 45.86.208.44 - - [26-Oct-1985 01:21:29 EDT 0] "GET b7.html HTTP/2" 200 1000 10.112.251.183 - - [26-Oct-1985 01:21:34 EDT 0] "GET b7.html HTTP/2" 200 1000 11.130.222.207 - - [26-Oct-1985 01:21:40 EDT 0] "GET 9y.html HTTP/2" 200 1000 11.16.2.198 - - [26-Oct-1985 01:21:41 EDT 0] "GET 9y.html HTTP/2" 200 1000 45.86.208.44 - - [26-Oct-1985 01:21:45 EDT 0] "GET 9y.html HTTP/2" 200 1000
  • 47. M.-A. Plourde, S. Hallé Other features Since Synthia can generate inputs for a system, it is natural to use it in a software testing context. The library offers a few features for this purpose: Test input shrinking: generate inputs that violate a condition, and automatically find "smaller" inputs that also violate it Object mutation: special pickers receive objects and apply a "modification" to them Monkey testing: generate sequences of actions sent to a reactive system Provenance tracking: explain the origins of a value generated by a wiring diagram
  • 48. M.-A. Plourde, S. Hallé Explainability We point to a part of a result produced by a picker, and Synthia can provide an explanation for it.
  • 49. M.-A. Plourde, S. Hallé Explainability We point to a part of a result produced by a picker, and Synthia can provide an explanation for it. [1,2] 42 s δ [0,1,-1] x y 4 x ≠ y 0
  • 50. M.-A. Plourde, S. Hallé Explainability [1,2] 42 s δ [0,1,-1] x y 4 x ≠ y 0 [(2,-1),(3,0),(4,1),(5,-1)] We point to a part of a result produced by a picker, and Synthia can provide an explanation for it.
  • 51. M.-A. Plourde, S. Hallé [1,2] 42 s δ [0,1,-1] x y 4 x ≠ y 0 [(2,-1),(3,0),(4,1),(5,-1)] Explainability We point to a part of a result produced by a picker, and Synthia can provide an explanation for it.
  • 52. M.-A. Plourde, S. Hallé 1∘1 1 3 3 3 1 [0,1,-1] 3 1 1 0 2 2 1 1 -1 [1,2] 42 s δ [0,1,-1] x y 4 x ≠ y 0 [(2,-1),(3,0),(4,1),(5,-1)] Explainability We point to a part of a result produced by a picker, and Synthia can provide an explanation for it.
  • 53. M.-A. Plourde, S. Hallé Automatic shrinking Pickers implementing the Shrinkable interface can produce a picker returning "smaller" objects. interface Shrinkable<T> extends Picker<T> { public Shrinkable<T> shrink(T t); } P t shrink( ) t P' t' t' t
  • 54. M.-A. Plourde, S. Hallé Automatic shrinking Pickers implementing the Shrinkable interface can produce a picker returning "smaller" objects. P 1 shrink( ) t1 t1 P 2 shrink( ) t2 t2 ... shrink( ) tn-1 P n tn
  • 55. M.-A. Plourde, S. Hallé Automatic shrinking Pickers implementing the Shrinkable interface can produce a picker returning "smaller" objects. P 1 shrink( ) t1 t1 P 2 shrink( ) t2 t2 ... shrink( ) tn-1 P n tn
  • 56. M.-A. Plourde, S. Hallé Automatic shrinking Pickers implementing the Shrinkable interface can produce a picker returning "smaller" objects. P 1 shrink( ) t1 t1 P 2 shrink( ) t2 t2 ... shrink( ) tn-1 P n tn
  • 57. M.-A. Plourde, S. Hallé Grammar-based shrinking Synthia can interact with a reactive component by producing sequences of actions following a grammar (or Markov chain, behavior tree). <S> := <number> <op> <number> <inop> ; <inop> := <op> <number> <inop> | = ; <number> := <integer> <digit> <rest> | <integer> ; <integer> := <nzdigit> <rest> ; <rest> := <digit> <rest> | ε ; <digit> := 0 | <nzdigit> ; <nzdigit> := 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 ; <op> := + | − | × | ÷ ; A sequence leading to a failure can be automatically shrunk and still follow the grammar.
  • 58. M.-A. Plourde, S. Hallé Eat your own dog food Public disclosure: the authors of Synthia use Synthia themselves! Examples: Test Suite Generation for Boolean Conditions with Equivalence Class Partitioning, FormaliSE 2022 Boolean formulas A Modular Runtime Enforcement Model using Multi- Traces, FPS 2021 Behavioral sequences of events Automated Repair of Layout Bugs in Web Pages with Linear Programming, ICWE 2021 Web pages with injected layout faults
  • 59. M.-A. Plourde, S. Hallé Code examples Synthia comes with many detailed code examples highlighting its features. https://liflab.github.io/synthia/javadoc
  • 60. M.-A. Plourde, S. Hallé Conclusion Many other features left uncovered: picker duplication, object mutation, value enumeration, etc. Many other data types not showcased: graphs, complex Java objects, etc. Simple and "clean" set of abstract interfaces allow a modular and versatile design. Used in computer experiments in multiple scientific publications https://github.com/liflab/synthia