SlideShare une entreprise Scribd logo
1  sur  32
Télécharger pour lire hors ligne
Programas y Pruebas en Dafny 1/ 25
Programas y Pruebas en Dafny
Paqui Lucio
Dpto de Lenguajes y Sistemas Inform´aticos.
Madrid, 10 de Junio de 2015
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 2/ 25
Outline
1. Deductive Verification
2. Dafny
3. Dafny in Teaching
4. Advantages
5. Limitations
6. Conclusion
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 3/ 25
Deductive Verification
Expressive (at least first-order) logic.
Logical reasoning (deduction) is used to prove properties.
Functional Correctness
All possible runs satisfy a declarative specification of the
externally observable behavior.
Contract-based specifications (standard approach)
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 4/ 25
Arquitectures in deductive verification
1 On top of interactive proof assistants
Isabelle/HOL, Coq, HOL Ligth, PVS.
2 Automatic Program Verifiers
2.1 Program logics for a specific target language
ACL2, KeY, KIV, VeriFun.
2.2 VCG + Automatic theorem provers (SMT-solver)
Spark, Verifast, Dafny, Why, Frama-C.
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 5/ 25
Pros & Cons
1 On top of interactive proof assistants
+ Higher level of assurance
- Greater demand of work/Lower level of automation
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 5/ 25
Pros & Cons
1 On top of interactive proof assistants
+ Higher level of assurance
- Greater demand of work/Lower level of automation
2 Automatic Program Verifiers
2.1 Program Logics for a specific target language
+ Verification flow follows flow of execution of target system
- Implementation effort for a new language is substantial
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 5/ 25
Pros & Cons
1 On top of interactive proof assistants
+ Higher level of assurance
- Greater demand of work/Lower level of automation
2 Automatic Program Verifiers
2.1 Program Logics for a specific target language
+ Verification flow follows flow of execution of target system
- Implementation effort for a new language is substantial
2.2 VCG + Automatic theorem provers
+ Modular architecture
+ Exploit the progress in automated reasoning
- Hard analysis of proof failures
- Lower level of trust
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 6/ 25
Dafny
Dafny is an automatic verifier of the family VCC + TP.
Dafny is being developed by Microsoft Research.
Dafny is also a programming language with built-in
specification constructs.
Dafny provides
Design-time feedback
Fluid interaction
for accessible integrated verification.
Dafny generates executable (.NET) code, omitting
specification (ghost) constructs.
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 7/ 25
f u n c t i o n f ( n: i n t ) : i n t
{ n∗n∗n + 2∗n }
p r e d i c a t e divBy3 ( n: i n t )
{ n % 3 = 0 }
lemma fnIsDivBy3 ( n: i n t )
r e q u i r e s 0 ≤ n
ensures divBy3 ( f ( n ))
+{}
method M (m: i n t ) r e t u r n s ( a: array i n t )
r e q u i r e s m ≥ 0
ensures a = n u l l
ensures a . Length = m+1;
ensures f o r a l l i • 0 ≤ i ≤ m =⇒ ( a [ i ]=f ( i ) ∧ divBy3 ( a [ i ] ) )
+{}
method Main ()
+{}
DFY FILE EXE FILE
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 8/ 25
Dafny in Teaching
M´etodos Formales de Desarrollo de Software
Optativa, 4o
Curso, 6 cr´editos
Grado en Ingenier´ıa Inform´atica, UPV/EHU
1 Introduction
2 Automated Reasoning and Software Development
3 Dafny
4 Verification Condition Generation
5 Datatypes and predicates
6 Lemmas, assume and calculations
7 Ghost Entities
8 Arrays and Framing
9 Object-Oriented Software
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 9/ 25
M´etodos Formales de Desarrollo de Software
Optativa, 4o
Curso, 6 cr´editos
Grado en Ingenier´ıa Inform´atica, UPV/EHU
1 Introduction
2 Automated Reasoning and Software Development
3 Dafny
4 Verification Condition Generation
5 Datatypes and predicates
6 Lemmas, assume and calculations
7 Ghost Entities
8 Arrays and Framing
9 Object-Oriented Software
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 10/ 25
Verification Condition Generation
VCG({ϕ}S{ψ}) = ϕ → wp(S,ψ) ∪ vc+(S, ψ)
where
wp is the well known weakest precondition and
vc+ is defined as follows
vc+
(x:=t, ψ) = vc+
(skip,ψ) = ∅
vc+
(S1; S2, ψ) = vc+
(S1, wp(S2, ψ)) ∪ vc+
(S2, ψ)
vc+
(if b then S1 else S2, ψ) = vc+
(S1, ψ) ∪ vc+
(S2, ψ)
vc+
(while b invariant α { S },ψ) =
{(α ∧ b) → wp(S,α), (α ∧ ¬b) → ψ} ∪ vc+
(S,α)
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 11/ 25
method RootApprox ( x: i n t ) r e t u r n s ( z: i n t )
r e q u i r e s x ≥ 0
ensures z ≤ x∗x < z+1
{
z:= 0;
while ( z+1 ≤ x∗x )
i n v a r i a n t z ≤ x∗x
// d e c r e a s e s x∗x−z
{
z := z +1;
}
}
RootApprox.dfy
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 12/ 25
M´etodos Formales de Desarrollo de Software
Optativa, 4o
Curso, 6 cr´editos
Grado en Ingenier´ıa Inform´atica, UPV/EHU
1 Introduction
2 Automated Reasoning and Software Development
3 Dafny
4 Verification Condition Generation
5 Datatypes and predicates
6 Lemmas, assume and calculations
7 Ghost Entities
8 Arrays and Framing
9 Object-Oriented Software
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 13/ 25
Natural Mergesort ([Knuth, 1973])
Input List
1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 13/ 25
Natural Mergesort ([Knuth, 1973])
Input List
1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3
taking advantage of the ascending and descending chains
1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 13/ 25
Natural Mergesort ([Knuth, 1973])
Input List
1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3
taking advantage of the ascending and descending chains
1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3
splits the data in as many ascending sublists as required
[1, 2, 8], [1, 5, 6], [0, 1, 4, 5, 6, 7], [1, 3]
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 13/ 25
Natural Mergesort ([Knuth, 1973])
Input List
1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3
taking advantage of the ascending and descending chains
1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3
splits the data in as many ascending sublists as required
[1, 2, 8], [1, 5, 6], [0, 1, 4, 5, 6, 7], [1, 3]
merge pairwise
[1, 1, 2, 5, 6, 8], [0, 1, 4, 5, 6, 7], [1, 3]
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 13/ 25
Natural Mergesort ([Knuth, 1973])
Input List
1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3
taking advantage of the ascending and descending chains
1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3
splits the data in as many ascending sublists as required
[1, 2, 8], [1, 5, 6], [0, 1, 4, 5, 6, 7], [1, 3]
merge pairwise
[1, 1, 2, 5, 6, 8], [0, 1, 4, 5, 6, 7], [1, 3]
merge pairwise again
[0, 1, 1, 1, 2, 4, 5, 5, 6, 6, 7, 8], [1, 3]
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 13/ 25
Natural Mergesort ([Knuth, 1973])
Input List
1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3
taking advantage of the ascending and descending chains
1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3
splits the data in as many ascending sublists as required
[1, 2, 8], [1, 5, 6], [0, 1, 4, 5, 6, 7], [1, 3]
merge pairwise
[1, 1, 2, 5, 6, 8], [0, 1, 4, 5, 6, 7], [1, 3]
merge pairwise again
[0, 1, 1, 1, 2, 4, 5, 5, 6, 6, 7, 8], [1, 3]
merge pairwise again
[0, 1, 1, 1, 1, 2, 3, 4, 5, 5, 6, 6, 7, 8]
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 14/ 25
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 15/ 25
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 16/ 25
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 17/ 25
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 18/ 25
DFY FILE
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 19/ 25
DFY FILE INTERMEDIATE DFY FILE CLEAN DFY FILE
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 20/ 25
M´etodos Formales de Desarrollo de Software
Optativa, 4o
Curso, 6 cr´editos
Grado en Ingenier´ıa Inform´atica, UPV/EHU
1 Introduction
2 Automated Reasoning and Software Development
3 Dafny
4 Verification Condition Generation
5 Datatypes and predicates
6 Lemmas, assume and calculations
7 Ghost Entities
8 Arrays and Framing
9 Object-Oriented Software
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 21/ 25
Specifications and ghost constructs are used only during
verification; the compiler omits them from the executable
code.
lemma is equivalent to ghost method.
By default, functions are ghost.
Ghost variables are useful when to compute a value x allows
to specify something interesting, but x is not really needed in
the real code. For example:
ghost value with some interesting property that can be
specified and used to prove a property.
termination proofs
to specify class invariants in OO programming
etc.
Demo: DFY FILE FINAL DFY FILE
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 22/ 25
Advantages
Dafny is concise, intuitive and fast.
My Experience.pdf
The programmer can interact with Dafny in the same way as
with the compiler.
The Dafny language syntax itself is not difficult to get used
to, as it is quite similar to other languages, such as Java and
C#, Haskell, etc.
Executable code generation.
Ghosting: one can include verification code without affecting
the performance of the executable program itself.
Dafny (i.g. VCG+TP) benefits from ATP improvements.
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 23/ 25
Limitations
Complex/subtle systems requires large annotations
“Not verification but specification could be the real bottleneck
for verification of large software systems.”
Correctness is relative to a given specification
Example: forgot permutation property of a sorting algorithm
Some violations asserts depends on the efficiency/heuristics of
the SMT-solver
Example: DFY FILE
The verifier does not produce useful information for
verification attempts that time out. Difficult problem.
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 24/ 25
Conclusion
Development of the language and verifier is very active and
ongoing.
Dafny 1.9.5 (May 11, 2015) is the 11th stable
release, since Oct 30, 2012.
Promising tool for the automatic, statical verification of full
functional correctness of programming code.
Dafny (and similar tools) are
not only useful tools for helping us in teaching
verification to undergraduate students,
but also one of the reasons why software verification
should be mandatory in the SE undergraduate
curriculum.
Paqui Lucio Programas y Pruebas en Dafny
Programas y Pruebas en Dafny 25/ 25
The beauty of a theorem from mathematics,
the preciseness of an inference rule in logic,
the intrigue of a puzzle,
and the challenge of a game – all are present
in the field of automated reasoning.
(Larry Wos, 1988)
Paqui Lucio Programas y Pruebas en Dafny

Contenu connexe

Tendances

GUESS FUNDAMENTAL PAPER FOE CCAT Feb 2014
GUESS FUNDAMENTAL PAPER FOE CCAT Feb 2014GUESS FUNDAMENTAL PAPER FOE CCAT Feb 2014
GUESS FUNDAMENTAL PAPER FOE CCAT Feb 2014prabhatjon
 
Insecure coding in C (and C++)
Insecure coding in C (and C++)Insecure coding in C (and C++)
Insecure coding in C (and C++)Olve Maudal
 
GPU Acceleration of Set Similarity Joins
GPU Acceleration of Set Similarity JoinsGPU Acceleration of Set Similarity Joins
GPU Acceleration of Set Similarity JoinsMateus S. H. Cruz
 

Tendances (6)

GUESS FUNDAMENTAL PAPER FOE CCAT Feb 2014
GUESS FUNDAMENTAL PAPER FOE CCAT Feb 2014GUESS FUNDAMENTAL PAPER FOE CCAT Feb 2014
GUESS FUNDAMENTAL PAPER FOE CCAT Feb 2014
 
Clotho : Saving Programs from Malformed Strings and Incorrect
Clotho : Saving Programs from Malformed Strings and IncorrectClotho : Saving Programs from Malformed Strings and Incorrect
Clotho : Saving Programs from Malformed Strings and Incorrect
 
Insecure coding in C (and C++)
Insecure coding in C (and C++)Insecure coding in C (and C++)
Insecure coding in C (and C++)
 
GPU Acceleration of Set Similarity Joins
GPU Acceleration of Set Similarity JoinsGPU Acceleration of Set Similarity Joins
GPU Acceleration of Set Similarity Joins
 
Interfacing C/C++ and Python with SWIG
Interfacing C/C++ and Python with SWIGInterfacing C/C++ and Python with SWIG
Interfacing C/C++ and Python with SWIG
 
Repair dagstuhl jan2017
Repair dagstuhl jan2017Repair dagstuhl jan2017
Repair dagstuhl jan2017
 

Similaire à Programas y Pruebas en Dafny

Unit Tests? It is Very Simple and Easy!
Unit Tests? It is Very Simple and Easy!Unit Tests? It is Very Simple and Easy!
Unit Tests? It is Very Simple and Easy!Return on Intelligence
 
OpenPOWER Webinar from University of Delaware - Title :OpenMP (offloading) o...
OpenPOWER Webinar from University of Delaware  - Title :OpenMP (offloading) o...OpenPOWER Webinar from University of Delaware  - Title :OpenMP (offloading) o...
OpenPOWER Webinar from University of Delaware - Title :OpenMP (offloading) o...Ganesan Narayanasamy
 
Computer Tools for Academic Research
Computer Tools for Academic ResearchComputer Tools for Academic Research
Computer Tools for Academic ResearchMiklos Koren
 
Cloud Reliability: Decreasing outage frequency using fault injection
Cloud Reliability: Decreasing outage frequency using fault injectionCloud Reliability: Decreasing outage frequency using fault injection
Cloud Reliability: Decreasing outage frequency using fault injectionJorge Cardoso
 
Testing practicies not only in scala
Testing practicies not only in scalaTesting practicies not only in scala
Testing practicies not only in scalaPaweł Panasewicz
 
Leveraging Open Source Automation: A Selenium WebDriver Example
Leveraging Open Source Automation: A Selenium WebDriver ExampleLeveraging Open Source Automation: A Selenium WebDriver Example
Leveraging Open Source Automation: A Selenium WebDriver ExampleTechWell
 
DevOps interview questions and answers
DevOps interview questions and answersDevOps interview questions and answers
DevOps interview questions and answersHopeTutors1
 
Software Security Assurance for DevOps
Software Security Assurance for DevOpsSoftware Security Assurance for DevOps
Software Security Assurance for DevOpsBlack Duck by Synopsys
 
Open & reproducible research - What can we do in practice?
Open & reproducible research - What can we do in practice?Open & reproducible research - What can we do in practice?
Open & reproducible research - What can we do in practice?Felix Z. Hoffmann
 
Trilinos progress, challenges and future plans
Trilinos progress, challenges and future plansTrilinos progress, challenges and future plans
Trilinos progress, challenges and future plansM Reza Rahmati
 
Software Analytics - Achievements and Challenges
Software Analytics - Achievements and ChallengesSoftware Analytics - Achievements and Challenges
Software Analytics - Achievements and ChallengesTao Xie
 
Sharing massive data analysis: from provenance to linked experiment reports
Sharing massive data analysis: from provenance to linked experiment reportsSharing massive data analysis: from provenance to linked experiment reports
Sharing massive data analysis: from provenance to linked experiment reportsGaignard Alban
 
How a Social Knowledge Graph Improves Remote Working by Capturing Context fro...
How a Social Knowledge Graph Improves Remote Working by Capturing Context fro...How a Social Knowledge Graph Improves Remote Working by Capturing Context fro...
How a Social Knowledge Graph Improves Remote Working by Capturing Context fro...Sabine Seitz
 
Esem2014 presentation
Esem2014 presentationEsem2014 presentation
Esem2014 presentationTanja Vos
 
Hyper-pragmatic Pure FP testing with distage-testkit
Hyper-pragmatic Pure FP testing with distage-testkitHyper-pragmatic Pure FP testing with distage-testkit
Hyper-pragmatic Pure FP testing with distage-testkit7mind
 
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...Nagios
 
Avi Pfeffer, Principal Scientist, Charles River Analytics at MLconf SEA - 5/2...
Avi Pfeffer, Principal Scientist, Charles River Analytics at MLconf SEA - 5/2...Avi Pfeffer, Principal Scientist, Charles River Analytics at MLconf SEA - 5/2...
Avi Pfeffer, Principal Scientist, Charles River Analytics at MLconf SEA - 5/2...MLconf
 

Similaire à Programas y Pruebas en Dafny (20)

Unit Tests? It is Very Simple and Easy!
Unit Tests? It is Very Simple and Easy!Unit Tests? It is Very Simple and Easy!
Unit Tests? It is Very Simple and Easy!
 
Symbexecsearch
SymbexecsearchSymbexecsearch
Symbexecsearch
 
OpenPOWER Webinar from University of Delaware - Title :OpenMP (offloading) o...
OpenPOWER Webinar from University of Delaware  - Title :OpenMP (offloading) o...OpenPOWER Webinar from University of Delaware  - Title :OpenMP (offloading) o...
OpenPOWER Webinar from University of Delaware - Title :OpenMP (offloading) o...
 
Computer Tools for Academic Research
Computer Tools for Academic ResearchComputer Tools for Academic Research
Computer Tools for Academic Research
 
Cloud Reliability: Decreasing outage frequency using fault injection
Cloud Reliability: Decreasing outage frequency using fault injectionCloud Reliability: Decreasing outage frequency using fault injection
Cloud Reliability: Decreasing outage frequency using fault injection
 
Testing practicies not only in scala
Testing practicies not only in scalaTesting practicies not only in scala
Testing practicies not only in scala
 
Leveraging Open Source Automation: A Selenium WebDriver Example
Leveraging Open Source Automation: A Selenium WebDriver ExampleLeveraging Open Source Automation: A Selenium WebDriver Example
Leveraging Open Source Automation: A Selenium WebDriver Example
 
Abhik-Satish-dagstuhl
Abhik-Satish-dagstuhlAbhik-Satish-dagstuhl
Abhik-Satish-dagstuhl
 
DevOps interview questions and answers
DevOps interview questions and answersDevOps interview questions and answers
DevOps interview questions and answers
 
Software Security Assurance for DevOps
Software Security Assurance for DevOpsSoftware Security Assurance for DevOps
Software Security Assurance for DevOps
 
Debugging
DebuggingDebugging
Debugging
 
Open & reproducible research - What can we do in practice?
Open & reproducible research - What can we do in practice?Open & reproducible research - What can we do in practice?
Open & reproducible research - What can we do in practice?
 
Trilinos progress, challenges and future plans
Trilinos progress, challenges and future plansTrilinos progress, challenges and future plans
Trilinos progress, challenges and future plans
 
Software Analytics - Achievements and Challenges
Software Analytics - Achievements and ChallengesSoftware Analytics - Achievements and Challenges
Software Analytics - Achievements and Challenges
 
Sharing massive data analysis: from provenance to linked experiment reports
Sharing massive data analysis: from provenance to linked experiment reportsSharing massive data analysis: from provenance to linked experiment reports
Sharing massive data analysis: from provenance to linked experiment reports
 
How a Social Knowledge Graph Improves Remote Working by Capturing Context fro...
How a Social Knowledge Graph Improves Remote Working by Capturing Context fro...How a Social Knowledge Graph Improves Remote Working by Capturing Context fro...
How a Social Knowledge Graph Improves Remote Working by Capturing Context fro...
 
Esem2014 presentation
Esem2014 presentationEsem2014 presentation
Esem2014 presentation
 
Hyper-pragmatic Pure FP testing with distage-testkit
Hyper-pragmatic Pure FP testing with distage-testkitHyper-pragmatic Pure FP testing with distage-testkit
Hyper-pragmatic Pure FP testing with distage-testkit
 
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
 
Avi Pfeffer, Principal Scientist, Charles River Analytics at MLconf SEA - 5/2...
Avi Pfeffer, Principal Scientist, Charles River Analytics at MLconf SEA - 5/2...Avi Pfeffer, Principal Scientist, Charles River Analytics at MLconf SEA - 5/2...
Avi Pfeffer, Principal Scientist, Charles River Analytics at MLconf SEA - 5/2...
 

Plus de Facultad de Informática UCM

¿Por qué debemos seguir trabajando en álgebra lineal?
¿Por qué debemos seguir trabajando en álgebra lineal?¿Por qué debemos seguir trabajando en álgebra lineal?
¿Por qué debemos seguir trabajando en álgebra lineal?Facultad de Informática UCM
 
TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...
TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...
TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...Facultad de Informática UCM
 
DRAC: Designing RISC-V-based Accelerators for next generation Computers
DRAC: Designing RISC-V-based Accelerators for next generation ComputersDRAC: Designing RISC-V-based Accelerators for next generation Computers
DRAC: Designing RISC-V-based Accelerators for next generation ComputersFacultad de Informática UCM
 
Tendencias en el diseño de procesadores con arquitectura Arm
Tendencias en el diseño de procesadores con arquitectura ArmTendencias en el diseño de procesadores con arquitectura Arm
Tendencias en el diseño de procesadores con arquitectura ArmFacultad de Informática UCM
 
Introduction to Quantum Computing and Quantum Service Oriented Computing
Introduction to Quantum Computing and Quantum Service Oriented ComputingIntroduction to Quantum Computing and Quantum Service Oriented Computing
Introduction to Quantum Computing and Quantum Service Oriented ComputingFacultad de Informática UCM
 
Inteligencia Artificial en la atención sanitaria del futuro
Inteligencia Artificial en la atención sanitaria del futuroInteligencia Artificial en la atención sanitaria del futuro
Inteligencia Artificial en la atención sanitaria del futuroFacultad de Informática UCM
 
Design Automation Approaches for Real-Time Edge Computing for Science Applic...
 Design Automation Approaches for Real-Time Edge Computing for Science Applic... Design Automation Approaches for Real-Time Edge Computing for Science Applic...
Design Automation Approaches for Real-Time Edge Computing for Science Applic...Facultad de Informática UCM
 
Estrategias de navegación para robótica móvil de campo: caso de estudio proye...
Estrategias de navegación para robótica móvil de campo: caso de estudio proye...Estrategias de navegación para robótica móvil de campo: caso de estudio proye...
Estrategias de navegación para robótica móvil de campo: caso de estudio proye...Facultad de Informática UCM
 
Fault-tolerance Quantum computation and Quantum Error Correction
Fault-tolerance Quantum computation and Quantum Error CorrectionFault-tolerance Quantum computation and Quantum Error Correction
Fault-tolerance Quantum computation and Quantum Error CorrectionFacultad de Informática UCM
 
Cómo construir un chatbot inteligente sin morir en el intento
Cómo construir un chatbot inteligente sin morir en el intentoCómo construir un chatbot inteligente sin morir en el intento
Cómo construir un chatbot inteligente sin morir en el intentoFacultad de Informática UCM
 
Automatic generation of hardware memory architectures for HPC
Automatic generation of hardware memory architectures for HPCAutomatic generation of hardware memory architectures for HPC
Automatic generation of hardware memory architectures for HPCFacultad de Informática UCM
 
Hardware/software security contracts: Principled foundations for building sec...
Hardware/software security contracts: Principled foundations for building sec...Hardware/software security contracts: Principled foundations for building sec...
Hardware/software security contracts: Principled foundations for building sec...Facultad de Informática UCM
 
Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...
Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...
Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...Facultad de Informática UCM
 
Redes neuronales y reinforcement learning. Aplicación en energía eólica.
Redes neuronales y reinforcement learning. Aplicación en energía eólica.Redes neuronales y reinforcement learning. Aplicación en energía eólica.
Redes neuronales y reinforcement learning. Aplicación en energía eólica.Facultad de Informática UCM
 
Challenges and Opportunities for AI and Data analytics in Offshore wind
Challenges and Opportunities for AI and Data analytics in Offshore windChallenges and Opportunities for AI and Data analytics in Offshore wind
Challenges and Opportunities for AI and Data analytics in Offshore windFacultad de Informática UCM
 

Plus de Facultad de Informática UCM (20)

¿Por qué debemos seguir trabajando en álgebra lineal?
¿Por qué debemos seguir trabajando en álgebra lineal?¿Por qué debemos seguir trabajando en álgebra lineal?
¿Por qué debemos seguir trabajando en álgebra lineal?
 
TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...
TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...
TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...
 
DRAC: Designing RISC-V-based Accelerators for next generation Computers
DRAC: Designing RISC-V-based Accelerators for next generation ComputersDRAC: Designing RISC-V-based Accelerators for next generation Computers
DRAC: Designing RISC-V-based Accelerators for next generation Computers
 
uElectronics ongoing activities at ESA
uElectronics ongoing activities at ESAuElectronics ongoing activities at ESA
uElectronics ongoing activities at ESA
 
Tendencias en el diseño de procesadores con arquitectura Arm
Tendencias en el diseño de procesadores con arquitectura ArmTendencias en el diseño de procesadores con arquitectura Arm
Tendencias en el diseño de procesadores con arquitectura Arm
 
Formalizing Mathematics in Lean
Formalizing Mathematics in LeanFormalizing Mathematics in Lean
Formalizing Mathematics in Lean
 
Introduction to Quantum Computing and Quantum Service Oriented Computing
Introduction to Quantum Computing and Quantum Service Oriented ComputingIntroduction to Quantum Computing and Quantum Service Oriented Computing
Introduction to Quantum Computing and Quantum Service Oriented Computing
 
Computer Design Concepts for Machine Learning
Computer Design Concepts for Machine LearningComputer Design Concepts for Machine Learning
Computer Design Concepts for Machine Learning
 
Inteligencia Artificial en la atención sanitaria del futuro
Inteligencia Artificial en la atención sanitaria del futuroInteligencia Artificial en la atención sanitaria del futuro
Inteligencia Artificial en la atención sanitaria del futuro
 
Design Automation Approaches for Real-Time Edge Computing for Science Applic...
 Design Automation Approaches for Real-Time Edge Computing for Science Applic... Design Automation Approaches for Real-Time Edge Computing for Science Applic...
Design Automation Approaches for Real-Time Edge Computing for Science Applic...
 
Estrategias de navegación para robótica móvil de campo: caso de estudio proye...
Estrategias de navegación para robótica móvil de campo: caso de estudio proye...Estrategias de navegación para robótica móvil de campo: caso de estudio proye...
Estrategias de navegación para robótica móvil de campo: caso de estudio proye...
 
Fault-tolerance Quantum computation and Quantum Error Correction
Fault-tolerance Quantum computation and Quantum Error CorrectionFault-tolerance Quantum computation and Quantum Error Correction
Fault-tolerance Quantum computation and Quantum Error Correction
 
Cómo construir un chatbot inteligente sin morir en el intento
Cómo construir un chatbot inteligente sin morir en el intentoCómo construir un chatbot inteligente sin morir en el intento
Cómo construir un chatbot inteligente sin morir en el intento
 
Automatic generation of hardware memory architectures for HPC
Automatic generation of hardware memory architectures for HPCAutomatic generation of hardware memory architectures for HPC
Automatic generation of hardware memory architectures for HPC
 
Type and proof structures for concurrency
Type and proof structures for concurrencyType and proof structures for concurrency
Type and proof structures for concurrency
 
Hardware/software security contracts: Principled foundations for building sec...
Hardware/software security contracts: Principled foundations for building sec...Hardware/software security contracts: Principled foundations for building sec...
Hardware/software security contracts: Principled foundations for building sec...
 
Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...
Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...
Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...
 
Do you trust your artificial intelligence system?
Do you trust your artificial intelligence system?Do you trust your artificial intelligence system?
Do you trust your artificial intelligence system?
 
Redes neuronales y reinforcement learning. Aplicación en energía eólica.
Redes neuronales y reinforcement learning. Aplicación en energía eólica.Redes neuronales y reinforcement learning. Aplicación en energía eólica.
Redes neuronales y reinforcement learning. Aplicación en energía eólica.
 
Challenges and Opportunities for AI and Data analytics in Offshore wind
Challenges and Opportunities for AI and Data analytics in Offshore windChallenges and Opportunities for AI and Data analytics in Offshore wind
Challenges and Opportunities for AI and Data analytics in Offshore wind
 

Dernier

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 

Dernier (20)

Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 

Programas y Pruebas en Dafny

  • 1. Programas y Pruebas en Dafny 1/ 25 Programas y Pruebas en Dafny Paqui Lucio Dpto de Lenguajes y Sistemas Inform´aticos. Madrid, 10 de Junio de 2015 Paqui Lucio Programas y Pruebas en Dafny
  • 2. Programas y Pruebas en Dafny 2/ 25 Outline 1. Deductive Verification 2. Dafny 3. Dafny in Teaching 4. Advantages 5. Limitations 6. Conclusion Paqui Lucio Programas y Pruebas en Dafny
  • 3. Programas y Pruebas en Dafny 3/ 25 Deductive Verification Expressive (at least first-order) logic. Logical reasoning (deduction) is used to prove properties. Functional Correctness All possible runs satisfy a declarative specification of the externally observable behavior. Contract-based specifications (standard approach) Paqui Lucio Programas y Pruebas en Dafny
  • 4. Programas y Pruebas en Dafny 4/ 25 Arquitectures in deductive verification 1 On top of interactive proof assistants Isabelle/HOL, Coq, HOL Ligth, PVS. 2 Automatic Program Verifiers 2.1 Program logics for a specific target language ACL2, KeY, KIV, VeriFun. 2.2 VCG + Automatic theorem provers (SMT-solver) Spark, Verifast, Dafny, Why, Frama-C. Paqui Lucio Programas y Pruebas en Dafny
  • 5. Programas y Pruebas en Dafny 5/ 25 Pros & Cons 1 On top of interactive proof assistants + Higher level of assurance - Greater demand of work/Lower level of automation Paqui Lucio Programas y Pruebas en Dafny
  • 6. Programas y Pruebas en Dafny 5/ 25 Pros & Cons 1 On top of interactive proof assistants + Higher level of assurance - Greater demand of work/Lower level of automation 2 Automatic Program Verifiers 2.1 Program Logics for a specific target language + Verification flow follows flow of execution of target system - Implementation effort for a new language is substantial Paqui Lucio Programas y Pruebas en Dafny
  • 7. Programas y Pruebas en Dafny 5/ 25 Pros & Cons 1 On top of interactive proof assistants + Higher level of assurance - Greater demand of work/Lower level of automation 2 Automatic Program Verifiers 2.1 Program Logics for a specific target language + Verification flow follows flow of execution of target system - Implementation effort for a new language is substantial 2.2 VCG + Automatic theorem provers + Modular architecture + Exploit the progress in automated reasoning - Hard analysis of proof failures - Lower level of trust Paqui Lucio Programas y Pruebas en Dafny
  • 8. Programas y Pruebas en Dafny 6/ 25 Dafny Dafny is an automatic verifier of the family VCC + TP. Dafny is being developed by Microsoft Research. Dafny is also a programming language with built-in specification constructs. Dafny provides Design-time feedback Fluid interaction for accessible integrated verification. Dafny generates executable (.NET) code, omitting specification (ghost) constructs. Paqui Lucio Programas y Pruebas en Dafny
  • 9. Programas y Pruebas en Dafny 7/ 25 f u n c t i o n f ( n: i n t ) : i n t { n∗n∗n + 2∗n } p r e d i c a t e divBy3 ( n: i n t ) { n % 3 = 0 } lemma fnIsDivBy3 ( n: i n t ) r e q u i r e s 0 ≤ n ensures divBy3 ( f ( n )) +{} method M (m: i n t ) r e t u r n s ( a: array i n t ) r e q u i r e s m ≥ 0 ensures a = n u l l ensures a . Length = m+1; ensures f o r a l l i • 0 ≤ i ≤ m =⇒ ( a [ i ]=f ( i ) ∧ divBy3 ( a [ i ] ) ) +{} method Main () +{} DFY FILE EXE FILE Paqui Lucio Programas y Pruebas en Dafny
  • 10. Programas y Pruebas en Dafny 8/ 25 Dafny in Teaching M´etodos Formales de Desarrollo de Software Optativa, 4o Curso, 6 cr´editos Grado en Ingenier´ıa Inform´atica, UPV/EHU 1 Introduction 2 Automated Reasoning and Software Development 3 Dafny 4 Verification Condition Generation 5 Datatypes and predicates 6 Lemmas, assume and calculations 7 Ghost Entities 8 Arrays and Framing 9 Object-Oriented Software Paqui Lucio Programas y Pruebas en Dafny
  • 11. Programas y Pruebas en Dafny 9/ 25 M´etodos Formales de Desarrollo de Software Optativa, 4o Curso, 6 cr´editos Grado en Ingenier´ıa Inform´atica, UPV/EHU 1 Introduction 2 Automated Reasoning and Software Development 3 Dafny 4 Verification Condition Generation 5 Datatypes and predicates 6 Lemmas, assume and calculations 7 Ghost Entities 8 Arrays and Framing 9 Object-Oriented Software Paqui Lucio Programas y Pruebas en Dafny
  • 12. Programas y Pruebas en Dafny 10/ 25 Verification Condition Generation VCG({ϕ}S{ψ}) = ϕ → wp(S,ψ) ∪ vc+(S, ψ) where wp is the well known weakest precondition and vc+ is defined as follows vc+ (x:=t, ψ) = vc+ (skip,ψ) = ∅ vc+ (S1; S2, ψ) = vc+ (S1, wp(S2, ψ)) ∪ vc+ (S2, ψ) vc+ (if b then S1 else S2, ψ) = vc+ (S1, ψ) ∪ vc+ (S2, ψ) vc+ (while b invariant α { S },ψ) = {(α ∧ b) → wp(S,α), (α ∧ ¬b) → ψ} ∪ vc+ (S,α) Paqui Lucio Programas y Pruebas en Dafny
  • 13. Programas y Pruebas en Dafny 11/ 25 method RootApprox ( x: i n t ) r e t u r n s ( z: i n t ) r e q u i r e s x ≥ 0 ensures z ≤ x∗x < z+1 { z:= 0; while ( z+1 ≤ x∗x ) i n v a r i a n t z ≤ x∗x // d e c r e a s e s x∗x−z { z := z +1; } } RootApprox.dfy Paqui Lucio Programas y Pruebas en Dafny
  • 14. Programas y Pruebas en Dafny 12/ 25 M´etodos Formales de Desarrollo de Software Optativa, 4o Curso, 6 cr´editos Grado en Ingenier´ıa Inform´atica, UPV/EHU 1 Introduction 2 Automated Reasoning and Software Development 3 Dafny 4 Verification Condition Generation 5 Datatypes and predicates 6 Lemmas, assume and calculations 7 Ghost Entities 8 Arrays and Framing 9 Object-Oriented Software Paqui Lucio Programas y Pruebas en Dafny
  • 15. Programas y Pruebas en Dafny 13/ 25 Natural Mergesort ([Knuth, 1973]) Input List 1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3 Paqui Lucio Programas y Pruebas en Dafny
  • 16. Programas y Pruebas en Dafny 13/ 25 Natural Mergesort ([Knuth, 1973]) Input List 1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3 taking advantage of the ascending and descending chains 1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3 Paqui Lucio Programas y Pruebas en Dafny
  • 17. Programas y Pruebas en Dafny 13/ 25 Natural Mergesort ([Knuth, 1973]) Input List 1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3 taking advantage of the ascending and descending chains 1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3 splits the data in as many ascending sublists as required [1, 2, 8], [1, 5, 6], [0, 1, 4, 5, 6, 7], [1, 3] Paqui Lucio Programas y Pruebas en Dafny
  • 18. Programas y Pruebas en Dafny 13/ 25 Natural Mergesort ([Knuth, 1973]) Input List 1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3 taking advantage of the ascending and descending chains 1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3 splits the data in as many ascending sublists as required [1, 2, 8], [1, 5, 6], [0, 1, 4, 5, 6, 7], [1, 3] merge pairwise [1, 1, 2, 5, 6, 8], [0, 1, 4, 5, 6, 7], [1, 3] Paqui Lucio Programas y Pruebas en Dafny
  • 19. Programas y Pruebas en Dafny 13/ 25 Natural Mergesort ([Knuth, 1973]) Input List 1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3 taking advantage of the ascending and descending chains 1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3 splits the data in as many ascending sublists as required [1, 2, 8], [1, 5, 6], [0, 1, 4, 5, 6, 7], [1, 3] merge pairwise [1, 1, 2, 5, 6, 8], [0, 1, 4, 5, 6, 7], [1, 3] merge pairwise again [0, 1, 1, 1, 2, 4, 5, 5, 6, 6, 7, 8], [1, 3] Paqui Lucio Programas y Pruebas en Dafny
  • 20. Programas y Pruebas en Dafny 13/ 25 Natural Mergesort ([Knuth, 1973]) Input List 1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3 taking advantage of the ascending and descending chains 1, 2, 8, 6, 5, 1, 7, 6, 5, 4, 1, 0, 1, 3 splits the data in as many ascending sublists as required [1, 2, 8], [1, 5, 6], [0, 1, 4, 5, 6, 7], [1, 3] merge pairwise [1, 1, 2, 5, 6, 8], [0, 1, 4, 5, 6, 7], [1, 3] merge pairwise again [0, 1, 1, 1, 2, 4, 5, 5, 6, 6, 7, 8], [1, 3] merge pairwise again [0, 1, 1, 1, 1, 2, 3, 4, 5, 5, 6, 6, 7, 8] Paqui Lucio Programas y Pruebas en Dafny
  • 21. Programas y Pruebas en Dafny 14/ 25 Paqui Lucio Programas y Pruebas en Dafny
  • 22. Programas y Pruebas en Dafny 15/ 25 Paqui Lucio Programas y Pruebas en Dafny
  • 23. Programas y Pruebas en Dafny 16/ 25 Paqui Lucio Programas y Pruebas en Dafny
  • 24. Programas y Pruebas en Dafny 17/ 25 Paqui Lucio Programas y Pruebas en Dafny
  • 25. Programas y Pruebas en Dafny 18/ 25 DFY FILE Paqui Lucio Programas y Pruebas en Dafny
  • 26. Programas y Pruebas en Dafny 19/ 25 DFY FILE INTERMEDIATE DFY FILE CLEAN DFY FILE Paqui Lucio Programas y Pruebas en Dafny
  • 27. Programas y Pruebas en Dafny 20/ 25 M´etodos Formales de Desarrollo de Software Optativa, 4o Curso, 6 cr´editos Grado en Ingenier´ıa Inform´atica, UPV/EHU 1 Introduction 2 Automated Reasoning and Software Development 3 Dafny 4 Verification Condition Generation 5 Datatypes and predicates 6 Lemmas, assume and calculations 7 Ghost Entities 8 Arrays and Framing 9 Object-Oriented Software Paqui Lucio Programas y Pruebas en Dafny
  • 28. Programas y Pruebas en Dafny 21/ 25 Specifications and ghost constructs are used only during verification; the compiler omits them from the executable code. lemma is equivalent to ghost method. By default, functions are ghost. Ghost variables are useful when to compute a value x allows to specify something interesting, but x is not really needed in the real code. For example: ghost value with some interesting property that can be specified and used to prove a property. termination proofs to specify class invariants in OO programming etc. Demo: DFY FILE FINAL DFY FILE Paqui Lucio Programas y Pruebas en Dafny
  • 29. Programas y Pruebas en Dafny 22/ 25 Advantages Dafny is concise, intuitive and fast. My Experience.pdf The programmer can interact with Dafny in the same way as with the compiler. The Dafny language syntax itself is not difficult to get used to, as it is quite similar to other languages, such as Java and C#, Haskell, etc. Executable code generation. Ghosting: one can include verification code without affecting the performance of the executable program itself. Dafny (i.g. VCG+TP) benefits from ATP improvements. Paqui Lucio Programas y Pruebas en Dafny
  • 30. Programas y Pruebas en Dafny 23/ 25 Limitations Complex/subtle systems requires large annotations “Not verification but specification could be the real bottleneck for verification of large software systems.” Correctness is relative to a given specification Example: forgot permutation property of a sorting algorithm Some violations asserts depends on the efficiency/heuristics of the SMT-solver Example: DFY FILE The verifier does not produce useful information for verification attempts that time out. Difficult problem. Paqui Lucio Programas y Pruebas en Dafny
  • 31. Programas y Pruebas en Dafny 24/ 25 Conclusion Development of the language and verifier is very active and ongoing. Dafny 1.9.5 (May 11, 2015) is the 11th stable release, since Oct 30, 2012. Promising tool for the automatic, statical verification of full functional correctness of programming code. Dafny (and similar tools) are not only useful tools for helping us in teaching verification to undergraduate students, but also one of the reasons why software verification should be mandatory in the SE undergraduate curriculum. Paqui Lucio Programas y Pruebas en Dafny
  • 32. Programas y Pruebas en Dafny 25/ 25 The beauty of a theorem from mathematics, the preciseness of an inference rule in logic, the intrigue of a puzzle, and the challenge of a game – all are present in the field of automated reasoning. (Larry Wos, 1988) Paqui Lucio Programas y Pruebas en Dafny