SlideShare a Scribd company logo
Pattern-Based
Debugging of
Declarative Models
Vajih Montaghami and Derek Rayside
{vmontagh,drayside}@uwaterloo.ca
Electrical and Computer Engineering
University of Waterloo Waterloo, Ontario, Canada
Fri 2 Oct 2015
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Say what you mean
Adapted from: http://cloudcomputingcell.com/computer-programmer-images/
sig Node{next:
Node}

one sig Head
extends Node{}
pred
StructuralConstr
aints{
all n: Node |
head
2
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Say what you mean
Adapted from: http://cloudcomputingcell.com/computer-programmer-images/
sig Node{next:
Node}

one sig Head
extends Node{}
pred
StructuralConstr
aints{
all n: Node |
head
φintended
2
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Say what you mean
Adapted from: http://cloudcomputingcell.com/computer-programmer-images/
sig Node{next:
Node}

one sig Head
extends Node{}
pred
StructuralConstr
aints{
all n: Node |
head
φexpressed φintended
2
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Say what you mean
Adapted from: http://cloudcomputingcell.com/computer-programmer-images/
sig Node{next:
Node}

one sig Head
extends Node{}
pred
StructuralConstr
aints{
all n: Node |
head
⇎φexpressed φintended
2
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Engineer intends to model a linear linked list
Adapted from: http://cloudcomputingcell.com/computer-programmer-images/
sig Node{next:
Node}

one sig Head
extends Node{}
pred
StructuralConstra
ints{
all n: Node | one
n.next}
head
3
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Engineer intends to model a linear linked list
Adapted from: http://cloudcomputingcell.com/computer-programmer-images/
sig Node{next:
Node}

one sig Head
extends Node{}
pred
StructuralConstra
ints{
all n: Node | one
n.next}
head
head
3
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Adapted from: http://cloudcomputingcell.com/computer-programmer-images/
sig Node{next:
Node}

one sig Head
extends Node{}
pred
StructuralConstra
ints{
all n: Node | one
n.next}
head
head
✗Underconstraint
But, what engineer expresses is not what he intended
3
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Adapted from: http://cloudcomputingcell.com/computer-programmer-images/
sig Node{next:
Node}

one sig Head
extends Node{}
pred
StructuralConstra
ints{
all n: Node | one
n.next}
head
∅
head
✗Underconstraint
But, what engineer expresses is not what he intended
3
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Adapted from: http://cloudcomputingcell.com/computer-programmer-images/
sig Node{next:
Node}

one sig Head
extends Node{}
pred
StructuralConstra
ints{
all n: Node | one
n.next}
head
∅
head
✗Underconstraint
Engineer Strengthens the constraints, but gets nothing!
✗Full-Overconstraint
3
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Adapted from: http://cloudcomputingcell.com/computer-programmer-images/
sig Node{next:
Node}

one sig Head
extends Node{}
pred
StructuralConstra
ints{
all n: Node | one
n.next}
head
∅
head
head
✗Underconstraint
Engineer Strengthens the constraints, but gets nothing!
✗Full-Overconstraint
3
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Adapted from: http://cloudcomputingcell.com/computer-programmer-images/
sig Node{next:
Node}

one sig Head
extends Node{}
pred
StructuralConstra
ints{
all n: Node | one
n.next}
head
∅
head
head
✗Underconstraint
Engineer Weakens the constraints, but excludes some examples
✗Full-Overconstraint
✗Partial-Overconstraint
3
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Adapted from: http://cloudcomputingcell.com/computer-programmer-images/
sig Node{next:
Node}

one sig Head
extends Node{}
pred
StructuralConstra
ints{
all n: Node | one
n.next}
head
∅
head
head
✗Underconstraint
Engineer Weakens the constraints, and gets intended examples
✗Full-Overconstraint
✗Partial-Overconstraint
✓
head
headhead
3
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca4
Can we invent a tool to
guide this strengthening
and weakening of the
model?
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Idea: Discriminating Examples
5
φintended
φexpressed
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Idea: Discriminating Examples
5
φintended
φexpressed example
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Idea: Discriminating Examples
5
φintended
φexpressed example discriminating
example
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Mean what you say
No bug φintended
⇔ φexpressed
Underconstraint φintended
⇒ φexpressed
Partial-overconstraint φintended
⇐ φexpressed
Fully-overconstraint (︎∄i: I| i ⊨ φexpressed) ∧ (∃j: I| j ⊨ φintended)
Loosely Intersecting
Intention
∃i: I | (i ⊨ φintended ⋀ φexpressed) ⋀
(i ⊭ φintended ⇒ φexpressed) ⋀ (i ⊭ φexpressed
⇒ φintended)
6
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Mean what you say
No bug φintended
⇔ φexpressed
Underconstraint φintended
⇒ φexpressed
Partial-overconstraint φintended
⇐ φexpressed
Fully-overconstraint (︎∄i: I| i ⊨ φexpressed) ∧ (∃j: I| j ⊨ φintended)
Loosely Intersecting
Intention
∃i: I | (i ⊨ φintended ⋀ φexpressed) ⋀
(i ⊭ φintended ⇒ φexpressed) ⋀ (i ⊭ φexpressed
⇒ φintended)
6
φintended
φexpressed
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Mean what you say
No bug φintended
⇔ φexpressed
Underconstraint φintended
⇒ φexpressed
Partial-overconstraint φintended
⇐ φexpressed
Fully-overconstraint (︎∄i: I| i ⊨ φexpressed) ∧ (∃j: I| j ⊨ φintended)
Loosely Intersecting
Intention
∃i: I | (i ⊨ φintended ⋀ φexpressed) ⋀
(i ⊭ φintended ⇒ φexpressed) ⋀ (i ⊭ φexpressed
⇒ φintended)
6
φintended
φexpressed
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Mean what you say
No bug φintended
⇔ φexpressed
Underconstraint φintended
⇒ φexpressed
Partial-overconstraint φintended
⇐ φexpressed
Fully-overconstraint (︎∄i: I| i ⊨ φexpressed) ∧ (∃j: I| j ⊨ φintended)
Loosely Intersecting
Intention
∃i: I | (i ⊨ φintended ⋀ φexpressed) ⋀
(i ⊭ φintended ⇒ φexpressed) ⋀ (i ⊭ φexpressed
⇒ φintended)
6
φintended
φexpressed
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Mean what you say
No bug φintended
⇔ φexpressed
Underconstraint φintended
⇒ φexpressed
Partial-overconstraint φintended
⇐ φexpressed
Fully-overconstraint (︎∄i: I| i ⊨ φexpressed) ∧ (∃j: I| j ⊨ φintended)
Loosely Intersecting
Intention
∃i: I | (i ⊨ φintended ⋀ φexpressed) ⋀
(i ⊭ φintended ⇒ φexpressed) ⋀ (i ⊭ φexpressed
⇒ φintended)
6
φintended
φexpressed
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Mean what you say
No bug φintended
⇔ φexpressed
Underconstraint φintended
⇒ φexpressed
Partial-overconstraint φintended
⇐ φexpressed
Fully-overconstraint (︎∄i: I| i ⊨ φexpressed) ∧ (∃j: I| j ⊨ φintended)
Loosely Intersecting
Intention
∃i: I | (i ⊨ φintended ⋀ φexpressed) ⋀
(i ⊭ φintended ⇒ φexpressed) ⋀ (i ⊭ φexpressed
⇒ φintended)
6
φintended
φexpressed
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Pattern-based debugging
Existing tools Pattern-based
Underconstraint
Random examples
Minimal examples
Discriminating examples
Help the engineer decide if certain properties
need to be strengthened or weakened
Overconstraint
UnSAT-Core Subset of UnSAT-Core
Accepting or Rejecting discriminating
examples localizes area to fix
Explanation None By Pattern Semantics
7
Better Understanding
Increase Localization
Best-effort Fix suggestion
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Context
❖ Model: A text written in a logical
language
❖ Bug: a divergence between the
engineers intended logical model and
the expressed logic model
8
sig Node{next: Node}

one sig Head extends Node{}
pred StructuralConstraints{
all n: Node | one n.next}
pred Noloop{
all n: Node | n !in n.^next}
pred showLists{
StructuralConstraints
Noloop}
run showLists
❖ Logical language: Alloy
๏ First-order relational logic with closure
๏ Alloy Analyzer: Instance finder equipped
with Inconsistent core finder in finite domain
๏ Bugs:
- Unintended instances
- Inconsistent constraints
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Generating Discriminating Examples
9
Engineer: expressed
her intention φintended
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Generating Discriminating Examples
9
Engineer: expressed
her intention φintended
φexpressed
Debugger: Infer Semantic
⇒ p[R] ⋀ …
P[R]: Pattern P
applied to relation R
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Generating Discriminating Examples
9
Engineer: expressed
her intention φintended
φexpressed
Debugger: Infer Semantic
⇒ p[R] ⋀ …
P[R]: Pattern P
applied to relation R
Debugger: Take a guess
that the model
might be underconstrained
w.r.t. φintended
p’ [R]
Weaken p to p’
p[R] p’ [R]
Strengthening is in reverse
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Generating Discriminating Examples
9
Engineer: expressed
her intention φintended
φexpressed
Debugger: Infer Semantic
⇒ p[R] ⋀ …
P[R]: Pattern P
applied to relation R
Debugger: Take a guess
that the model
might be underconstrained
w.r.t. φintended
p’ [R]
Weaken p to p’
p[R] p’ [R]
Strengthening is in reverse
Debugger: Mutate
the semantic
p’ [R] ⋀ ¬p[R] ⋀ …
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Generating Discriminating Examples
9
Engineer: expressed
her intention φintended
φexpressed
Debugger: Infer Semantic
⇒ p[R] ⋀ …
P[R]: Pattern P
applied to relation R
Debugger: Take a guess
that the model
might be underconstrained
w.r.t. φintended
p’ [R]
Weaken p to p’
p[R] p’ [R]
Strengthening is in reverse
Debugger: Mutate
the semantic
Debugger: Find
discriminating example
p’ [R] ⋀ ¬p[R] ⋀ …
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Generating Discriminating Examples
9
Engineer: expressed
her intention φintended
φexpressed
Debugger: Infer Semantic
⇒ p[R] ⋀ …
P[R]: Pattern P
applied to relation R
Debugger: Take a guess
that the model
might be underconstrained
w.r.t. φintended
p’ [R]
Weaken p to p’
p[R] p’ [R]
Strengthening is in reverse
Debugger: Mutate
the semantic
Debugger: Find
discriminating example
p’ [R] ⋀ ¬p[R] ⋀ …
Engineer: accepts or
rejects the discriminating
example
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Patterns
Binary relations
❖ Relational properties
❖ 21 are commonly known
❖ used in structural modelling
❖ e.g.: acyclic, antisymmetric,
irreflexive, …
Ternary relations
❖ Inclusion and Ordering
❖ we define 160
❖ used in behavioural modelling
❖ e.g.: ExpandHeadOfRight, …

(ece.uwaterloo.ca/~vmontagh/alloy/debugger/)
10
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Pattern-based Debugger’s components
11
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Pattern-based Debugger’s components:
UI: DiscriminatingExample
12
❖ Back to the Linked list example
❖ Debugger finds: φexpressed ⇒ Total_Function[next],…
❖ Debugger generates a discriminating example, w.r.t.:
E ⊨ ¬Total_Function[next] ⋀ Partial_Function[next]
Engineer accepts E
φexpressed is overconstrained w.r.t. φintended
Fix by weakening
Engineer rejects E
Generate another example
❌✓
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Pattern-based Debugger’s components:
Knowledge-base
Consistency Graph
❖ Undirected graph
❖ Nodes: Patterns
❖ Edges: Two nodes are consistent
over the same relation
❖ Nodes: 160 Edges: 6764
Implication Lattice
❖ Directed graph
❖ Nodes: Patterns
❖ Edges: The source node implies the
sink node over the same relation
❖ Sources:12 Sinks:6 Longest Path:6
Acyclic Irreflexive
Acyclic Partial-function
13
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Pattern-based Debugger’s components:
Reasoner
Generate discriminating examples
❖ Infer Semantic
❖ Semantic Mutation
❖ Generation tactics (see paper)
❖ antecedent satisfaction,
❖ disjunction vacuity detection
❖ conjunction vacuity detection
14
Localize the issue
❖ UnSAT-Core
❖ Correspondence tactics (see paper)
❖ quantifier unrolling
❖ function and predicate inlining
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
A case study
❖ Dijkstra’s Dining Philosophers algorithm
❖ The bogus model shipped with Alloy for years
❖ Was fixed in 2012 by team from KIT Germany
๏ Fix is subtle and was not explained in their publications
❖ In four interactions, the pattern-based debugger assists
the engineer to
Understand, Localize, and Fix the defects
Source: wikipedia.org
15
Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca
Summary and Future work
Now
❖ Pattern-based debugging
๏ Discriminating examples
๏ Library of ternary patterns
๏ Generation tactics
๏ Correspondence tactics
❖ Dining Philosophers case study
16
Next
❖ Automating search
procedure
❖ Improve pattern library
❖ More case studies

More Related Content

What's hot (6)

PDF
Analysis of the Trans-Proteomic Pipeline (TPP) project
PVS-Studio
 
PDF
Analyzing FreeCAD's Source Code and Its "Sick" Dependencies
PVS-Studio
 
PDF
Source code of WPF samples by Microsoft was checked
PVS-Studio
 
PDF
Analyzing Firebird 3.0
Ekaterina Milovidova
 
ODP
Klee introduction
Georgiana T.
 
PDF
Tesseract. Recognizing Errors in Recognition Software
Andrey Karpov
 
Analysis of the Trans-Proteomic Pipeline (TPP) project
PVS-Studio
 
Analyzing FreeCAD's Source Code and Its "Sick" Dependencies
PVS-Studio
 
Source code of WPF samples by Microsoft was checked
PVS-Studio
 
Analyzing Firebird 3.0
Ekaterina Milovidova
 
Klee introduction
Georgiana T.
 
Tesseract. Recognizing Errors in Recognition Software
Andrey Karpov
 

Viewers also liked (10)

DOCX
Michael L Klemt
Michael Klemt
 
PDF
Seconda prova liceo economico sociale dal 2013 al 2015
liceodonmilaniacquaviva
 
PDF
Programma progetto orientamento
liceodonmilaniacquaviva
 
PDF
Indirizzi di studio e quadri orario
liceodonmilaniacquaviva
 
PDF
Seconda prova liceo pedagogico dal 2009 al 2015
liceodonmilaniacquaviva
 
PDF
Anno 2016 numero unico
liceodonmilaniacquaviva
 
PDF
Certificado Marketing digital básico
Ricardo Bandala
 
PDF
Prima prova italiano dal 2009 al 2014
liceodonmilaniacquaviva
 
PPTX
Cicloturismo market farm
liceodonmilaniacquaviva
 
PPTX
Systemic lupus erythromatosus
Habeeb Baloch
 
Michael L Klemt
Michael Klemt
 
Seconda prova liceo economico sociale dal 2013 al 2015
liceodonmilaniacquaviva
 
Programma progetto orientamento
liceodonmilaniacquaviva
 
Indirizzi di studio e quadri orario
liceodonmilaniacquaviva
 
Seconda prova liceo pedagogico dal 2009 al 2015
liceodonmilaniacquaviva
 
Anno 2016 numero unico
liceodonmilaniacquaviva
 
Certificado Marketing digital básico
Ricardo Bandala
 
Prima prova italiano dal 2009 al 2014
liceodonmilaniacquaviva
 
Cicloturismo market farm
liceodonmilaniacquaviva
 
Systemic lupus erythromatosus
Habeeb Baloch
 
Ad

Similar to Pattern-Based Debugging of Declarative Models (20)

PDF
Neal Gafter Java Evolution
deimos
 
PDF
The Need for Async @ ScalaWorld
Konrad Malawski
 
PDF
C++11: Rvalue References, Move Semantics, Perfect Forwarding
Francesco Casalegno
 
PDF
Concurrent Programming in Go basics and programming
Temur10
 
PDF
Evolving The Java Language
QConLondon2008
 
PDF
Need for Async: Hot pursuit for scalable applications
Konrad Malawski
 
PDF
FregeDay: Roadmap for resolving differences between Haskell and Frege (Ingo W...
Dierk König
 
PDF
Creational Design Patterns
Jamie (Taka) Wang
 
ODP
New Ideas for Old Code - Greach
HamletDRC
 
PDF
Core Java Programming Language (JSE) : Chapter IV - Expressions and Flow Cont...
WebStackAcademy
 
PDF
Proxy deep-dive java-one_20151027_001
Sven Ruppert
 
PDF
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
corehard_by
 
PDF
Troubleshooting tips from docker support engineers
Docker, Inc.
 
PPT
Lec_1_Integration.ppt
samaghorab
 
PPTX
Framework engineering JCO 2011
YoungSu Son
 
PDF
Introduction to Scala for JCConf Taiwan
Jimin Hsieh
 
PDF
Javascript Unittesting with js-test-driver
westhoff
 
PPT
Parallel Programming: Beyond the Critical Section
Tony Albrecht
 
PDF
Craftsmanship in Computational Work
Yung-Yu Chen
 
PDF
Lecture 5 interface.pdf
AdilAijaz3
 
Neal Gafter Java Evolution
deimos
 
The Need for Async @ ScalaWorld
Konrad Malawski
 
C++11: Rvalue References, Move Semantics, Perfect Forwarding
Francesco Casalegno
 
Concurrent Programming in Go basics and programming
Temur10
 
Evolving The Java Language
QConLondon2008
 
Need for Async: Hot pursuit for scalable applications
Konrad Malawski
 
FregeDay: Roadmap for resolving differences between Haskell and Frege (Ingo W...
Dierk König
 
Creational Design Patterns
Jamie (Taka) Wang
 
New Ideas for Old Code - Greach
HamletDRC
 
Core Java Programming Language (JSE) : Chapter IV - Expressions and Flow Cont...
WebStackAcademy
 
Proxy deep-dive java-one_20151027_001
Sven Ruppert
 
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
corehard_by
 
Troubleshooting tips from docker support engineers
Docker, Inc.
 
Lec_1_Integration.ppt
samaghorab
 
Framework engineering JCO 2011
YoungSu Son
 
Introduction to Scala for JCConf Taiwan
Jimin Hsieh
 
Javascript Unittesting with js-test-driver
westhoff
 
Parallel Programming: Beyond the Critical Section
Tony Albrecht
 
Craftsmanship in Computational Work
Yung-Yu Chen
 
Lecture 5 interface.pdf
AdilAijaz3
 
Ad

Recently uploaded (20)

PDF
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
PDF
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PDF
MiniTool Power Data Recovery 8.8 With Crack New Latest 2025
bashirkhan333g
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PPTX
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
PDF
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PPTX
Customise Your Correlation Table in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PDF
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
PDF
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PPTX
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
PDF
Add Background Images to Charts in IBM SPSS Statistics Version 31.pdf
Version 1 Analytics
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PDF
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
PPTX
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
MiniTool Power Data Recovery 8.8 With Crack New Latest 2025
bashirkhan333g
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
Customise Your Correlation Table in IBM SPSS Statistics.pptx
Version 1 Analytics
 
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
Add Background Images to Charts in IBM SPSS Statistics Version 31.pdf
Version 1 Analytics
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 

Pattern-Based Debugging of Declarative Models

  • 1. Pattern-Based Debugging of Declarative Models Vajih Montaghami and Derek Rayside {vmontagh,drayside}@uwaterloo.ca Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Fri 2 Oct 2015
  • 2. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Say what you mean Adapted from: http://cloudcomputingcell.com/computer-programmer-images/ sig Node{next: Node}
 one sig Head extends Node{} pred StructuralConstr aints{ all n: Node | head 2
  • 3. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Say what you mean Adapted from: http://cloudcomputingcell.com/computer-programmer-images/ sig Node{next: Node}
 one sig Head extends Node{} pred StructuralConstr aints{ all n: Node | head φintended 2
  • 4. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Say what you mean Adapted from: http://cloudcomputingcell.com/computer-programmer-images/ sig Node{next: Node}
 one sig Head extends Node{} pred StructuralConstr aints{ all n: Node | head φexpressed φintended 2
  • 5. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Say what you mean Adapted from: http://cloudcomputingcell.com/computer-programmer-images/ sig Node{next: Node}
 one sig Head extends Node{} pred StructuralConstr aints{ all n: Node | head ⇎φexpressed φintended 2
  • 6. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Engineer intends to model a linear linked list Adapted from: http://cloudcomputingcell.com/computer-programmer-images/ sig Node{next: Node}
 one sig Head extends Node{} pred StructuralConstra ints{ all n: Node | one n.next} head 3
  • 7. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Engineer intends to model a linear linked list Adapted from: http://cloudcomputingcell.com/computer-programmer-images/ sig Node{next: Node}
 one sig Head extends Node{} pred StructuralConstra ints{ all n: Node | one n.next} head head 3
  • 8. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Adapted from: http://cloudcomputingcell.com/computer-programmer-images/ sig Node{next: Node}
 one sig Head extends Node{} pred StructuralConstra ints{ all n: Node | one n.next} head head ✗Underconstraint But, what engineer expresses is not what he intended 3
  • 9. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Adapted from: http://cloudcomputingcell.com/computer-programmer-images/ sig Node{next: Node}
 one sig Head extends Node{} pred StructuralConstra ints{ all n: Node | one n.next} head ∅ head ✗Underconstraint But, what engineer expresses is not what he intended 3
  • 10. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Adapted from: http://cloudcomputingcell.com/computer-programmer-images/ sig Node{next: Node}
 one sig Head extends Node{} pred StructuralConstra ints{ all n: Node | one n.next} head ∅ head ✗Underconstraint Engineer Strengthens the constraints, but gets nothing! ✗Full-Overconstraint 3
  • 11. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Adapted from: http://cloudcomputingcell.com/computer-programmer-images/ sig Node{next: Node}
 one sig Head extends Node{} pred StructuralConstra ints{ all n: Node | one n.next} head ∅ head head ✗Underconstraint Engineer Strengthens the constraints, but gets nothing! ✗Full-Overconstraint 3
  • 12. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Adapted from: http://cloudcomputingcell.com/computer-programmer-images/ sig Node{next: Node}
 one sig Head extends Node{} pred StructuralConstra ints{ all n: Node | one n.next} head ∅ head head ✗Underconstraint Engineer Weakens the constraints, but excludes some examples ✗Full-Overconstraint ✗Partial-Overconstraint 3
  • 13. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Adapted from: http://cloudcomputingcell.com/computer-programmer-images/ sig Node{next: Node}
 one sig Head extends Node{} pred StructuralConstra ints{ all n: Node | one n.next} head ∅ head head ✗Underconstraint Engineer Weakens the constraints, and gets intended examples ✗Full-Overconstraint ✗Partial-Overconstraint ✓ head headhead 3
  • 14. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca4 Can we invent a tool to guide this strengthening and weakening of the model?
  • 15. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Idea: Discriminating Examples 5 φintended φexpressed
  • 16. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Idea: Discriminating Examples 5 φintended φexpressed example
  • 17. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Idea: Discriminating Examples 5 φintended φexpressed example discriminating example
  • 18. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Mean what you say No bug φintended ⇔ φexpressed Underconstraint φintended ⇒ φexpressed Partial-overconstraint φintended ⇐ φexpressed Fully-overconstraint (︎∄i: I| i ⊨ φexpressed) ∧ (∃j: I| j ⊨ φintended) Loosely Intersecting Intention ∃i: I | (i ⊨ φintended ⋀ φexpressed) ⋀ (i ⊭ φintended ⇒ φexpressed) ⋀ (i ⊭ φexpressed ⇒ φintended) 6
  • 19. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Mean what you say No bug φintended ⇔ φexpressed Underconstraint φintended ⇒ φexpressed Partial-overconstraint φintended ⇐ φexpressed Fully-overconstraint (︎∄i: I| i ⊨ φexpressed) ∧ (∃j: I| j ⊨ φintended) Loosely Intersecting Intention ∃i: I | (i ⊨ φintended ⋀ φexpressed) ⋀ (i ⊭ φintended ⇒ φexpressed) ⋀ (i ⊭ φexpressed ⇒ φintended) 6 φintended φexpressed
  • 20. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Mean what you say No bug φintended ⇔ φexpressed Underconstraint φintended ⇒ φexpressed Partial-overconstraint φintended ⇐ φexpressed Fully-overconstraint (︎∄i: I| i ⊨ φexpressed) ∧ (∃j: I| j ⊨ φintended) Loosely Intersecting Intention ∃i: I | (i ⊨ φintended ⋀ φexpressed) ⋀ (i ⊭ φintended ⇒ φexpressed) ⋀ (i ⊭ φexpressed ⇒ φintended) 6 φintended φexpressed
  • 21. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Mean what you say No bug φintended ⇔ φexpressed Underconstraint φintended ⇒ φexpressed Partial-overconstraint φintended ⇐ φexpressed Fully-overconstraint (︎∄i: I| i ⊨ φexpressed) ∧ (∃j: I| j ⊨ φintended) Loosely Intersecting Intention ∃i: I | (i ⊨ φintended ⋀ φexpressed) ⋀ (i ⊭ φintended ⇒ φexpressed) ⋀ (i ⊭ φexpressed ⇒ φintended) 6 φintended φexpressed
  • 22. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Mean what you say No bug φintended ⇔ φexpressed Underconstraint φintended ⇒ φexpressed Partial-overconstraint φintended ⇐ φexpressed Fully-overconstraint (︎∄i: I| i ⊨ φexpressed) ∧ (∃j: I| j ⊨ φintended) Loosely Intersecting Intention ∃i: I | (i ⊨ φintended ⋀ φexpressed) ⋀ (i ⊭ φintended ⇒ φexpressed) ⋀ (i ⊭ φexpressed ⇒ φintended) 6 φintended φexpressed
  • 23. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Mean what you say No bug φintended ⇔ φexpressed Underconstraint φintended ⇒ φexpressed Partial-overconstraint φintended ⇐ φexpressed Fully-overconstraint (︎∄i: I| i ⊨ φexpressed) ∧ (∃j: I| j ⊨ φintended) Loosely Intersecting Intention ∃i: I | (i ⊨ φintended ⋀ φexpressed) ⋀ (i ⊭ φintended ⇒ φexpressed) ⋀ (i ⊭ φexpressed ⇒ φintended) 6 φintended φexpressed
  • 24. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Pattern-based debugging Existing tools Pattern-based Underconstraint Random examples Minimal examples Discriminating examples Help the engineer decide if certain properties need to be strengthened or weakened Overconstraint UnSAT-Core Subset of UnSAT-Core Accepting or Rejecting discriminating examples localizes area to fix Explanation None By Pattern Semantics 7 Better Understanding Increase Localization Best-effort Fix suggestion
  • 25. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Context ❖ Model: A text written in a logical language ❖ Bug: a divergence between the engineers intended logical model and the expressed logic model 8 sig Node{next: Node}
 one sig Head extends Node{} pred StructuralConstraints{ all n: Node | one n.next} pred Noloop{ all n: Node | n !in n.^next} pred showLists{ StructuralConstraints Noloop} run showLists ❖ Logical language: Alloy ๏ First-order relational logic with closure ๏ Alloy Analyzer: Instance finder equipped with Inconsistent core finder in finite domain ๏ Bugs: - Unintended instances - Inconsistent constraints
  • 26. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Generating Discriminating Examples 9 Engineer: expressed her intention φintended
  • 27. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Generating Discriminating Examples 9 Engineer: expressed her intention φintended φexpressed Debugger: Infer Semantic ⇒ p[R] ⋀ … P[R]: Pattern P applied to relation R
  • 28. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Generating Discriminating Examples 9 Engineer: expressed her intention φintended φexpressed Debugger: Infer Semantic ⇒ p[R] ⋀ … P[R]: Pattern P applied to relation R Debugger: Take a guess that the model might be underconstrained w.r.t. φintended p’ [R] Weaken p to p’ p[R] p’ [R] Strengthening is in reverse
  • 29. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Generating Discriminating Examples 9 Engineer: expressed her intention φintended φexpressed Debugger: Infer Semantic ⇒ p[R] ⋀ … P[R]: Pattern P applied to relation R Debugger: Take a guess that the model might be underconstrained w.r.t. φintended p’ [R] Weaken p to p’ p[R] p’ [R] Strengthening is in reverse Debugger: Mutate the semantic p’ [R] ⋀ ¬p[R] ⋀ …
  • 30. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Generating Discriminating Examples 9 Engineer: expressed her intention φintended φexpressed Debugger: Infer Semantic ⇒ p[R] ⋀ … P[R]: Pattern P applied to relation R Debugger: Take a guess that the model might be underconstrained w.r.t. φintended p’ [R] Weaken p to p’ p[R] p’ [R] Strengthening is in reverse Debugger: Mutate the semantic Debugger: Find discriminating example p’ [R] ⋀ ¬p[R] ⋀ …
  • 31. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Generating Discriminating Examples 9 Engineer: expressed her intention φintended φexpressed Debugger: Infer Semantic ⇒ p[R] ⋀ … P[R]: Pattern P applied to relation R Debugger: Take a guess that the model might be underconstrained w.r.t. φintended p’ [R] Weaken p to p’ p[R] p’ [R] Strengthening is in reverse Debugger: Mutate the semantic Debugger: Find discriminating example p’ [R] ⋀ ¬p[R] ⋀ … Engineer: accepts or rejects the discriminating example
  • 32. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Patterns Binary relations ❖ Relational properties ❖ 21 are commonly known ❖ used in structural modelling ❖ e.g.: acyclic, antisymmetric, irreflexive, … Ternary relations ❖ Inclusion and Ordering ❖ we define 160 ❖ used in behavioural modelling ❖ e.g.: ExpandHeadOfRight, …
 (ece.uwaterloo.ca/~vmontagh/alloy/debugger/) 10
  • 33. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Pattern-based Debugger’s components 11
  • 34. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Pattern-based Debugger’s components: UI: DiscriminatingExample 12 ❖ Back to the Linked list example ❖ Debugger finds: φexpressed ⇒ Total_Function[next],… ❖ Debugger generates a discriminating example, w.r.t.: E ⊨ ¬Total_Function[next] ⋀ Partial_Function[next] Engineer accepts E φexpressed is overconstrained w.r.t. φintended Fix by weakening Engineer rejects E Generate another example ❌✓
  • 35. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Pattern-based Debugger’s components: Knowledge-base Consistency Graph ❖ Undirected graph ❖ Nodes: Patterns ❖ Edges: Two nodes are consistent over the same relation ❖ Nodes: 160 Edges: 6764 Implication Lattice ❖ Directed graph ❖ Nodes: Patterns ❖ Edges: The source node implies the sink node over the same relation ❖ Sources:12 Sinks:6 Longest Path:6 Acyclic Irreflexive Acyclic Partial-function 13
  • 36. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Pattern-based Debugger’s components: Reasoner Generate discriminating examples ❖ Infer Semantic ❖ Semantic Mutation ❖ Generation tactics (see paper) ❖ antecedent satisfaction, ❖ disjunction vacuity detection ❖ conjunction vacuity detection 14 Localize the issue ❖ UnSAT-Core ❖ Correspondence tactics (see paper) ❖ quantifier unrolling ❖ function and predicate inlining
  • 37. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca A case study ❖ Dijkstra’s Dining Philosophers algorithm ❖ The bogus model shipped with Alloy for years ❖ Was fixed in 2012 by team from KIT Germany ๏ Fix is subtle and was not explained in their publications ❖ In four interactions, the pattern-based debugger assists the engineer to Understand, Localize, and Fix the defects Source: wikipedia.org 15
  • 38. Pattern-Based Debugging of Declarative Models {vmontagh,drayside}@uwaterloo.ca Summary and Future work Now ❖ Pattern-based debugging ๏ Discriminating examples ๏ Library of ternary patterns ๏ Generation tactics ๏ Correspondence tactics ❖ Dining Philosophers case study 16 Next ❖ Automating search procedure ❖ Improve pattern library ❖ More case studies