VeriML: Typed Computation of Logical Terms inside a Language with Effects

Size: px
Start display at page:

Download "VeriML: Typed Computation of Logical Terms inside a Language with Effects"

Transcription

1 VeriML: Typed Computation of Logical Terms inside a Language with Effects Antonis Stampoulis Zhong Shao Department of Computer Science, Yale University ICFP 2010

2 Proof assistants are becoming popular in the PL community!

3 Proof assistants are becoming popular in the PL community! Anything from metatheory proofs

4 Proof assistants are becoming popular in the PL community! Anything from metatheory proofs... to verified compilers (CompCert by Leroy et al.)

5 Proof assistants are becoming popular in the PL community! Anything from metatheory proofs... to verified compilers (CompCert by Leroy et al.)... and verified operating systems (sel4 verification by Klein et al.)

6 How to go to the next step?

7 How to go to the next step? Manual proof effort needs to be reduced

8 How to go to the next step? Manual proof effort needs to be reduced CompCert: proofs are 44% of the development (executable code 1045 lines, proofs 16543)

9 How to go to the next step? Manual proof effort needs to be reduced CompCert: proofs are 44% of the development (executable code 1045 lines, proofs 16543) proof to executable code ratio is about 16 to 1 sel4: about 11 to 1

10 Maybe inherrent complexity of proofs?

11 Maybe inherrent complexity of proofs? Not necessarily e.g. Chlipala (POPL 2010): verified compiler where only 25% of development is proofs

12 What s the trick? Focus less on writing proof scripts, focus more on writing tactics.

13 Proof scripts? A series of applications of tactics.

14 Proof scripts? A series of applications of tactics. Tactics? No clear definition Very informally: functions that generate (part of a) proof for specific kinds of goals Reality much more complicated (Asperti et al. A New Type for Tactics)

15 More liberal definition: tactics are functions that operate on propositions and proofs and produce other proofs

16 More liberal definition: tactics are functions that operate on propositions and proofs (in general: on logical terms) and produce other proofs

17 More liberal definition: tactics are functions that operate on propositions and proofs (in general: on logical terms) (and potentially on other things as well) and produce other proofs (and potentially other things as well)

18 So the motto? instead of scripts with lots of general-purpose tactics develop domain-specific tactics thus smaller scripts

19 So the motto? instead of scripts with lots of general-purpose tactics develop domain-specific tactics thus smaller scripts more reusable than proof scripts more modular thus more scalable e.g. to prove Hoare triples {P } c {Q}: tactic to decide arithmetic formulas tactic to do VC gen compose one with the other for Hoare triples tactic

20 Why not more popular? Claim: Language support for writing tactics relatively poor!

21 Why not more popular? Claim: Language support for writing tactics relatively poor! no good way to specify what tactics do: arguments? goals they operate on? etc. rely on documentation hurts composability of tactics! OR trade expressivity for being able to specify them

22 Need language to specify and implement tactics!

23 Sounds familiar...

24 Sounds familiar... Robin Milner, circa 1973 : ML (originally to write tactics for LCF)

25 But programming language theory has evolved!

26 But programming language theory has evolved! Leverage dependent types as a step towards more detailed specifications

27 Our contribution: VeriML ML core calculus (keep expressivity) extended with dependent types for logical terms but can still operate on logical terms use a logic similar to CIC (no dependent types!) with explicit proof objects type system that guarantees validity of logical terms and safe handling of binding proof of type safety prototype implementation

28 An example: equality tactic Based on a list of equations like x = y, y = z, w = q, w = z decide whether e.g. x = q

29 Type for this tactic? Based on a list of equations like x = y, y = z, w = q, w = z decide whether e.g. x = q equality : list ( term term proof ) term term option proof

30 Type for this tactic? Based on a list of equations like x = y, y = z, w = q, w = z decide whether e.g. x = q equality : list ( term term proof ) term term option proof But

31 Type for this tactic? Based on a list of equations like x = y, y = z, w = q, w = z decide whether e.g. x = q But equality : list ( T : Set a : T b : T proof ) T : Set x : T y : T option proof terms should be of the same type T ( = Nat, List,...)

32 Type for this tactic? Based on a list of equations like x = y, y = z, w = q, w = z decide whether e.g. x = q equality : list ( T : Set a : T b : T pf : a = b ) T : Set x : T y : T option ( pf : x = y ) But terms should be of the same type T ( = Nat, List,...) the proof should prove that they re equal

33 equality : list ( T : Set a : T b : T pf : a = b ) T : Set x : T y : T option ( pf : x = y ) Better specification means more composable (know input/outputs precisely) more errors can be caught at compile time

34 How to implement? Union-find data structure each equivalence class has a representative each term has a parent term if parent term equal to term, it s the representative merge representatives on new equality

35 How to implement? Union-find data structure each equivalence class has a representative each term has a parent term if parent term equal to term, it s the representative merge representatives on new equality Assume: uftype type for union-find data structure ufget : uftype ( base : T ) option ( parent : T pf : base = parent ) ufset : uftype ( base : T parent : T pf : base = parent ) unit

36 Implementation of find Find the representative of the equiv. class of a term find : uftype ( base : T ) ( rep : T ) find uf base = match ufget uf base with None ufset ( base )( base ); ( base ) Some ( parent ) holcase parent with base ( base ) let rep = find uf parent in ( rep )

37 Implementation of find Find the representative of the equiv. class of a term find : uftype ( base : T ) ( rep : T pf : base = rep ) find uf base = match ufget uf base with None ufset ( base )( base, reflexivity base ); ( base, reflexivity base ) Some ( parent, pf ) holcase parent with base ( base, reflexivity base ) let rep, pf = find uf parent in ( rep, transitivity pf pf )

38 Implementation of find Find the representative of the equiv. class of a term find : uftype ( base : T ) ( rep : T pf : base = rep ) find uf base = match ufget uf base with None ufset ( base )( base, reflexivity base : base = base ); ( base, reflexivity base : base = base ) Some ( parent, pf ) holcase parent with base ( base, reflexivity base ) let rep, pf = find uf parent in ( rep, transitivity pf pf ) ufset : uftype ( base : T parent : T pf : base = parent ) unit

39 Implementation of find Find the representative of the equiv. class of a term find : uftype ( base : T ) ( rep : T pf : base = rep ) find uf base = match ufget uf base with None ufset ( base )( base, reflexivity base : base = base ); ( base, reflexivity base : base = base ) Some ( parent, pf : base = parent ) holcase parent with base ( base, reflexivity base ) let rep, pf = find uf parent in ( rep, transitivity pf pf ) ufget : uftype ( base : T ) option ( parent : T pf : base = parent )

40 Implementation of find Find the representative of the equiv. class of a term find : uftype ( base : T ) ( rep : T pf : base = rep ) find uf base = match ufget uf base with None ufset ( base )( base, reflexivity base : base = base ); ( base, reflexivity base : base = base ) Some ( parent, pf : base = parent ) holcase parent with base ( base, reflexivity base : base = base ) let rep, pf = find uf parent in ( rep, transitivity pf pf )

41 Implementation of find Find the representative of the equiv. class of a term find : uftype ( base : T ) ( rep : T pf : base = rep ) find uf base = match ufget uf base with None ufset ( base )( base, reflexivity base : base = base ); ( base, reflexivity base : base = base ) Some ( parent, pf : base = parent ) holcase parent with base ( base, reflexivity base : base = base ) let rep, pf : parent = rep = find uf parent in ( rep, transitivity pf pf )

42 Implementation of find Find the representative of the equiv. class of a term find : uftype ( base : T ) ( rep : T pf : base = rep ) find uf base = match ufget uf base with None ufset ( base )( base, reflexivity base : base = base ); ( base, reflexivity base : base = base ) Some ( parent, pf : base = parent ) holcase parent with base ( base, reflexivity base : base = base ) let rep, pf : parent = rep = find uf parent in ( rep, transitivity pf pf : base = rep ) type checker would not allow to switch arguments to transitivity!

43 Another example simplify : A tactic that simplifies propositions like P True to P, recursively.

44 Implementation simplify : ( P : Prop ) ( P : Prop pf : P P ) simplify P = holcase P with P 1 True let P 1, pf = simplify P 1 in ( P 1, ) P 1 P 2 let P 1, pf 1 = simplify P 1 in let P 2, pf 2 = simplify P 2 in ( P 1 P 2, ) x : Nat.P 1 let P 1, pf = simplify P 1 in ( P 1, ) ( P, )

45 Implementation simplify : ( P : Prop ) ( P : Prop pf : P P ) simplify P = holcase P with P 1 True let P 1, pf = simplify P 1 in ( P 1, ) P 1 P 2 let P 1, pf 1 = simplify P 1 in let P 2, pf 2 = simplify P 2 in ( P 1 P 2, ) x : Nat.P 1 let P 1, pf = simplify P 1 in ( P 1, ) ( P, ) oops: what if we could apply it to x : Nat.x = 3 variable x escapes into ill-formed x = 3

46 Solution Type system should keep track of free variables environment of logical terms! Provide substitution for free variables a term depends on, in the current environment

47 Solution simplify : ( Φ : context ) ( P : [Φ]Prop ) ( P : [Φ]Prop pf : [Φ](P P ) ) simplify Φ P = holcase P with P 1 True let P 1, pf = simplify Φ P 1 in ( P 1, ) P 1 P 2 let P 1, pf 1 = simplify Φ P 1 in let P 2, pf 2 = simplify Φ P 2 in ( P 1 P 2, ) x : Nat.P 1 let P 1, pf = simplify (Φ, x : Nat) P 1 in ( P 1, ) ( P, )

48 Solution simplify : ( Φ : context ) ( P : [Φ]Prop ) ( P : [Φ]Prop pf : [Φ](P P ) ) simplify Φ P = holcase P with P 1 True let P 1, pf = simplify Φ P 1 in ( P 1, ) P 1 P 2 let P 1, pf 1 = simplify Φ P 1 in let P 2, pf 2 = simplify Φ P 2 in ( P 1 P 2, ) x : Nat.P 1 let P 1, pf = simplify (Φ, x : Nat) P 1 in ( P 1, ) ( P, ) P 1 : [Φ, x : Nat]Prop needs a substitution into [Φ]Prop

49 Behind the scenes τ ::= int unit τ 1 τ 2 τ 1 + τ 2 µα.τ α.τ ref τ

50 Behind the scenes τ ::= int unit τ 1 τ 2 τ 1 + τ 2 µα.τ α.τ ref τ Π Φ : context.τ

51 Behind the scenes τ ::= int unit τ 1 τ 2 τ 1 + τ 2 µα.τ α.τ ref τ Π Φ : context.τ Π X : [Φ]T.τ

52 Behind the scenes τ ::= int unit τ 1 τ 2 τ 1 + τ 2 µα.τ α.τ ref τ Π Φ : context.τ Π X : [Φ]T.τ Σ X : [Φ]T.τ

53 Behind the scenes τ ::= int unit τ 1 τ 2 τ 1 + τ 2 µα.τ α.τ ref τ Π Φ : context.τ Π X : [Φ]T.τ Σ X : [Φ]T.τ e ::=

54 Behind the scenes τ ::= int unit τ 1 τ 2 τ 1 + τ 2 µα.τ α.τ ref τ Π Φ : context.τ Π X : [Φ]T.τ Σ X : [Φ]T.τ e ::= λ Φ : context.e e Φ

55 Behind the scenes τ ::= int unit τ 1 τ 2 τ 1 + τ 2 µα.τ α.τ ref τ Π Φ : context.τ Π X : [Φ]T.τ Σ X : [Φ]T.τ e ::= λ Φ : context.e e Φ λ X : [Φ]T.e e [Φ]T

56 Behind the scenes τ ::= int unit τ 1 τ 2 τ 1 + τ 2 µα.τ α.τ ref τ Π Φ : context.τ Π X : [Φ]T.τ Σ X : [Φ]T.τ e ::= λ Φ : context.e e Φ λ X : [Φ]T.e e [Φ]T [Φ]T, e let X, y = e in e

57 Behind the scenes τ ::= int unit τ 1 τ 2 τ 1 + τ 2 µα.τ α.τ ref τ Π Φ : context.τ Π X : [Φ]T.τ Σ X : [Φ]T.τ e ::= λ Φ : context.e e Φ λ X : [Φ]T.e e [Φ]T [Φ]T, e let X, y = e in e holcase [Φ]T with ( T 1 e 1 ) ( T n e n )

58 Behind the scenes τ ::= int unit τ 1 τ 2 τ 1 + τ 2 µα.τ α.τ ref τ Π Φ : context.τ Π X : [Φ]T.τ Σ X : [Φ]T.τ e ::= λ Φ : context.e e Φ λ X : [Φ]T.e e [Φ]T [Φ]T, e let X, y = e in e holcase [Φ]T with ( T 1 e 1 ) ( T n e n ) Full details of type system and metatheory in the paper and TR!

59 Implementation prototype in OCaml about 5k lines, trusted base is 800 lines examples: first-order tautologies prover conversion to NNF equality with uninterpreted functions download from

60 Comparison with Coq Three ways to write tactics: ML LTac proof-by-reflection

61 Comparison with Coq Three ways to write tactics: ML (untyped tactics, high barrier: requires knowledge of implementation internals) LTac proof-by-reflection

62 Comparison with Coq Three ways to write tactics: ML (untyped tactics, high barrier: requires knowledge of implementation internals) LTac (untyped tactics, somewhat limited programming model) proof-by-reflection

63 Comparison with Coq Three ways to write tactics: ML (untyped tactics, high barrier: requires knowledge of implementation internals) LTac (untyped tactics, somewhat limited programming model) proof-by-reflection (strong static guarantees but very limited programming model)

64 Comparison with Coq Three ways to write tactics: ML (untyped tactics, high barrier: requires knowledge of implementation internals) LTac (untyped tactics, somewhat limited programming model) proof-by-reflection (strong static guarantees but very limited programming model) VeriML enables all points between no static guarantees to strong ones, yet with full ML programming model

65 Conclusion new language design with first-class support for rich logical framework enables more modular development of tactics type safety guarantees valid terms are generated Future work type reconstruction, implicit parameters interactive proof support SAT-solving

66 Thank you!

67 Backup slides

68 Implementation of union union : uftype ( a : T b : T ) unit union uf ( a, b ) = let repa = find uf a in let repb = find uf B in holcase repa with repb () ufset repa ( repb )

69 Implementation of union union : uftype ( a : T b : T pf : a = b ) unit union uf ( a, b, pf ) = let repa, pfa = find uf a in let repb, pfb = find uf B in holcase repa with repb () ufset repa ( repb, )

70 Implementation of union union : uftype ( a : T b : T pf : a = b ) unit union uf ( a, b, pf ) = let repa, pfa : a = repa = find uf a in let repb, pfb : b = repb = find uf B in holcase repa with repb () ufset repa ( repb, )

71 Implementation of union union : uftype ( a : T b : T pf : a = b ) unit union uf ( a, b, pf ) = let repa, pfa : a = repa = find uf a in let repb, pfb : b = repb = find uf B in holcase repa with repb () ufset repa ( repb, : repa = repb )

72 What about uftype? implemented as a hash table mapping base terms to their parents should also store proofs uftype = array ( option ( base : T parent : T pf : base = parent ))

73 Solution Provide instantiation of free variables a term depends on, in the current environment x : Nat.P 1 let P 1, pf = simplify (Φ, x : Nat) P 1 in ( [Φ](P 1 /(Φ id Φ, x??)), )

74 Solution Provide instantiation of free variables a term depends on, in the current environment x : Nat.P 1 let P 1 : [Φ, x : Nat]Prop, pf = simplify (Φ, x : Nat) P 1 in ( [Φ](P 1 /(Φ id Φ, x??)), )

Interactive Theorem Provers

Interactive Theorem Provers Interactive Theorem Provers from the perspective of Isabelle/Isar Makarius Wenzel Univ. Paris-Sud, LRI July 2014 = Isabelle λ β Isar α 1 Introduction Notable ITP systems LISP based: ACL2 http://www.cs.utexas.edu/users/moore/acl2

More information

Lecture Notes on Data Abstraction

Lecture Notes on Data Abstraction Lecture Notes on Data Abstraction 15-814: Types and Programming Languages Frank Pfenning Lecture 14 October 23, 2018 1 Introduction Since we have moved from the pure λ-calculus to functional programming

More information

Write your own Theorem Prover

Write your own Theorem Prover Write your own Theorem Prover Phil Scott 27 October 2016 Phil Scott Write your own Theorem Prover 27 October 2016 1 / 31 Introduction We ll work through a toy LCF style theorem prover for classical propositional

More information

NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications. Gerwin Klein Formal Methods

NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications. Gerwin Klein Formal Methods NICTA Advanced Course Theorem Proving Principles, Techniques, Applications Gerwin Klein Formal Methods 1 ORGANISATORIALS When Mon 14:00 15:30 Wed 10:30 12:00 7 weeks ends Mon, 20.9.2004 Exceptions Mon

More information

Contextual equivalence

Contextual equivalence Techniques 16/22 ACS L16, lecture 2 4/10 Contextual equivalence Two phrases of a programming language are ( Morris style ) contextually equivalent ( = ctx ) if occurrences of the first phrase in any program

More information

Techniques. Contextual equivalence

Techniques. Contextual equivalence Techniques 16/22 Contextual equivalence Two phrases of a programming language are ( Morris style ) contextually equivalent ( = ctx )if occurrences of the first phrase in any program can be replaced by

More information

Programming with Dependent Types in Coq

Programming with Dependent Types in Coq Programming with Dependent Types in Coq Matthieu Sozeau LRI, Univ. Paris-Sud - Démons Team & INRIA Saclay - ProVal Project PPS Seminar February 26th 2009 Paris, France Coq A higher-order, polymorphic logic:

More information

The Curry-Howard Isomorphism

The Curry-Howard Isomorphism The Curry-Howard Isomorphism Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) The Curry-Howard Isomorphism MFES 2008/09

More information

Nunchaku: Flexible Model Finding for Higher-Order Logic

Nunchaku: Flexible Model Finding for Higher-Order Logic Nunchaku: Flexible Model Finding for Higher-Order Logic Simon Cruanes, Jasmin Blanchette, Andrew Reynolds Veridis, Inria Nancy https://cedeela.fr/~simon/ April 7th, 2016 1 / 21 Summary Introduction Nunchaku

More information

A Machine Checked Model of Idempotent MGU Axioms For a List of Equational Constraints

A Machine Checked Model of Idempotent MGU Axioms For a List of Equational Constraints A Machine Checked Model of Idempotent MGU Axioms For a List of Equational Constraints Sunil Kothari, James Caldwell Department of Computer Science, University of Wyoming, USA Machine checked proofs of

More information

Equality Logic and Uninterpreted Functions

Equality Logic and Uninterpreted Functions Equality Logic and Uninterpreted Functions Seminar: Decision Procedures Michaela Tießler 28.06.2016 Agenda 1. Definitions 2. Use of Uninterpreted Functions 3. Decision Procedures formula: atom: term: Equality

More information

Structuring the verification of heap-manipulating programs

Structuring the verification of heap-manipulating programs Structuring the verification of heap-manipulating programs Aleksandar Nanevski (IMDEA Madrid) Viktor Vafeiadis (MSR / Univ. of Cambridge) Josh Berdine (MSR Cambridge) Hoare/Separation Logic Hoare logic

More information

Normalization by Evaluation

Normalization by Evaluation Normalization by Evaluation Andreas Abel Department of Computer Science and Engineering Chalmers and Gothenburg University PhD Seminar in Mathematical Engineering EAFIT University, Medellin, Colombia 9

More information

A New Look at Generalized Rewriting in Type Theory

A New Look at Generalized Rewriting in Type Theory A New Look at Generalized Rewriting in Type Theory Matthieu Sozeau Harvard University 1st Coq Workshop August 21th 2009 Munich, Germany Generalized Rewriting Equational reasoning x = y - x + 1 ==> y +

More information

Last Time. Inference Rules

Last Time. Inference Rules Last Time When program S executes it switches to a different state We need to express assertions on the states of the program S before and after its execution We can do it using a Hoare triple written

More information

LCF + Logical Frameworks = Isabelle (25 Years Later)

LCF + Logical Frameworks = Isabelle (25 Years Later) LCF + Logical Frameworks = Isabelle (25 Years Later) Lawrence C. Paulson, Computer Laboratory, University of Cambridge 16 April 2012 Milner Symposium, Edinburgh 1979 Edinburgh LCF: From the Preface the

More information

Verified Characteristic Formulae for CakeML. Armaël Guéneau, Magnus O. Myreen, Ramana Kumar, Michael Norrish April 18, 2017

Verified Characteristic Formulae for CakeML. Armaël Guéneau, Magnus O. Myreen, Ramana Kumar, Michael Norrish April 18, 2017 Verified Characteristic Formulae for CakeML Armaël Guéneau, Magnus O. Myreen, Ramana Kumar, Michael Norrish April 18, 2017 CakeML Has: references, modules, datatypes, exceptions, a FFI,... Doesn t have:

More information

The L Machines are very high-level, in two senses:

The L Machines are very high-level, in two senses: What is a Computer? State of the machine. CMPSCI 630: Programming Languages An Abstract Machine for Control Spring 2009 (with thanks to Robert Harper) Internal registers, memory, etc. Initial and final

More information

Hoare Logic I. Introduction to Deductive Program Verification. Simple Imperative Programming Language. Hoare Logic. Meaning of Hoare Triples

Hoare Logic I. Introduction to Deductive Program Verification. Simple Imperative Programming Language. Hoare Logic. Meaning of Hoare Triples Hoare Logic I Introduction to Deductive Program Verification Işıl Dillig Program Spec Deductive verifier FOL formula Theorem prover valid contingent Example specs: safety (no crashes), absence of arithmetic

More information

Relational Models and Program Logics: Logical Relations in Iris

Relational Models and Program Logics: Logical Relations in Iris 1 Relational Models and Program Logics: Logical Relations in Iris Lars Birkedal Aaarhus University Joint work with Amin Timany and Robbert Krebbers October 2017, Shonan, Japan 2 Relational Models and Program

More information

A New Look At Generalized Rewriting in Type Theory

A New Look At Generalized Rewriting in Type Theory A New Look At Generalized Rewriting in Type Theory Matthieu Sozeau Harvard University TYPES 09 May 13th 2009 Aussois, France Generalized Rewriting Equational reasoning x = y - x + 1 ==> y + 1 Logical reasoning

More information

Equalities and Uninterpreted Functions. Chapter 3. Decision Procedures. An Algorithmic Point of View. Revision 1.0

Equalities and Uninterpreted Functions. Chapter 3. Decision Procedures. An Algorithmic Point of View. Revision 1.0 Equalities and Uninterpreted Functions Chapter 3 Decision Procedures An Algorithmic Point of View D.Kroening O.Strichman Revision 1.0 Outline Decision Procedures Equalities and Uninterpreted Functions

More information

Proof assistants as a tool for thought

Proof assistants as a tool for thought Proof assistants as a tool for thought Katherine Ye @hypotext Tools for thought workshop, March 16 circa 1700 Disputants unable to agree would not waste much time in futile argument... Leibniz (Harrison)

More information

Classical First-Order Logic

Classical First-Order Logic Classical First-Order Logic Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) First-Order Logic (Classical) MFES 2008/09

More information

A Certified Denotational Abstract Interpreter (Proof Pearl)

A Certified Denotational Abstract Interpreter (Proof Pearl) A Certified Denotational Abstract Interpreter (Proof Pearl) David Pichardie INRIA Rennes David Cachera IRISA / ENS Cachan (Bretagne) Static Analysis Static Analysis Static analysis by abstract interpretation

More information

Static Program Analysis

Static Program Analysis Static Program Analysis Xiangyu Zhang The slides are compiled from Alex Aiken s Michael D. Ernst s Sorin Lerner s A Scary Outline Type-based analysis Data-flow analysis Abstract interpretation Theorem

More information

Modeling Ontological Structures with Type Classes in Coq

Modeling Ontological Structures with Type Classes in Coq Modeling Ontological Structures with Type Classes in Coq Richard Dapoigny 1 Patrick Barlatier 1 1 LISTIC/Polytech Savoie University of Savoie, Annecy, (FRANCE) Cite as: Dapoigny, R., Barlatier, P. Modeling

More information

Hoare Logic: Reasoning About Imperative Programs

Hoare Logic: Reasoning About Imperative Programs Hoare Logic: Reasoning About Imperative Programs COMP1600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2018 Programming Paradigms Functional. (Haskell, SML, OCaml,... ) main paradigm:

More information

Beyond First-Order Logic

Beyond First-Order Logic Beyond First-Order Logic Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) Beyond First-Order Logic MFES 2008/09 1 / 37 FOL

More information

An Introduction to Proof Assistants

An Introduction to Proof Assistants An Introduction to Proof Assistants Patrick Schnider Student Seminar in Combinatorics: Mathematical Software, ETH Zürich 1 Motivation The development of proof assistants was motivated by the use of computers

More information

Reasoning with Higher-Order Abstract Syntax and Contexts: A Comparison

Reasoning with Higher-Order Abstract Syntax and Contexts: A Comparison 1 Reasoning with Higher-Order Abstract Syntax and Contexts: A Comparison Amy Felty University of Ottawa July 13, 2010 Joint work with Brigitte Pientka, McGill University 2 Comparing Systems We focus on

More information

TR : Possible World Semantics for First Order LP

TR : Possible World Semantics for First Order LP City University of New York (CUNY) CUNY Academic Works Computer Science Technical Reports Graduate Center 2011 TR-2011010: Possible World Semantics for First Order LP Melvin Fitting Follow this and additional

More information

Program verification using Hoare Logic¹

Program verification using Hoare Logic¹ Program verification using Hoare Logic¹ Automated Reasoning - Guest Lecture Petros Papapanagiotou Part 2 of 2 ¹Contains material from Mike Gordon s slides: Previously on Hoare Logic A simple while language

More information

Program-ing in Coq. Matthieu Sozeau under the direction of Christine Paulin-Mohring

Program-ing in Coq. Matthieu Sozeau under the direction of Christine Paulin-Mohring Program-ing in Coq Matthieu Sozeau under the direction of Christine Paulin-Mohring LRI, Univ. Paris-Sud - Démons Team & INRIA Saclay - ProVal Project Foundations of Programming seminar February 15th 2008

More information

Propositions and Proofs

Propositions and Proofs Propositions and Proofs Gert Smolka, Saarland University April 25, 2018 Proposition are logical statements whose truth or falsity can be established with proofs. Coq s type theory provides us with a language

More information

Towards abstract and executable multivariate polynomials in Isabelle

Towards abstract and executable multivariate polynomials in Isabelle Towards abstract and executable multivariate polynomials in Isabelle Florian Haftmann Andreas Lochbihler Wolfgang Schreiner Institute for Informatics Institute of Information Security RISC TU Munich ETH

More information

Logic: Propositional Logic Truth Tables

Logic: Propositional Logic Truth Tables Logic: Propositional Logic Truth Tables Raffaella Bernardi bernardi@inf.unibz.it P.zza Domenicani 3, Room 2.28 Faculty of Computer Science, Free University of Bolzano-Bozen http://www.inf.unibz.it/~bernardi/courses/logic06

More information

Coinductive big-step operational semantics

Coinductive big-step operational semantics Coinductive big-step operational semantics Xavier Leroy a, Hervé Grall b a INRIA Paris-Rocquencourt Domaine de Voluceau, B.P. 105, 78153 Le Chesnay, France b École des Mines de Nantes La Chantrerie, 4,

More information

Section 2.2 Set Operations. Propositional calculus and set theory are both instances of an algebraic system called a. Boolean Algebra.

Section 2.2 Set Operations. Propositional calculus and set theory are both instances of an algebraic system called a. Boolean Algebra. Section 2.2 Set Operations Propositional calculus and set theory are both instances of an algebraic system called a Boolean Algebra. The operators in set theory are defined in terms of the corresponding

More information

Lecture Notes on Certifying Theorem Provers

Lecture Notes on Certifying Theorem Provers Lecture Notes on Certifying Theorem Provers 15-317: Constructive Logic Frank Pfenning Lecture 13 October 17, 2017 1 Introduction How do we trust a theorem prover or decision procedure for a logic? Ideally,

More information

SMT BASICS WS 2017/2018 ( ) LOGIC SATISFIABILITY MODULO THEORIES. Institute for Formal Models and Verification Johannes Kepler Universität Linz

SMT BASICS WS 2017/2018 ( ) LOGIC SATISFIABILITY MODULO THEORIES. Institute for Formal Models and Verification Johannes Kepler Universität Linz LOGIC SATISFIABILITY MODULO THEORIES SMT BASICS WS 2017/2018 (342.208) Armin Biere Martina Seidl biere@jku.at martina.seidl@jku.at Institute for Formal Models and Verification Johannes Kepler Universität

More information

The LCF Approach to Theorem Proving

The LCF Approach to Theorem Proving The LCF Approach to Theorem Proving 1 The LCF Approach to Theorem Proving John Harrison Intel Corporation Ideas and historical context Key ideas of LCF Equational logic example More about HOL Light Programming

More information

Formal Verification of Mathematical Algorithms

Formal Verification of Mathematical Algorithms Formal Verification of Mathematical Algorithms 1 Formal Verification of Mathematical Algorithms John Harrison Intel Corporation The cost of bugs Formal verification Levels of verification HOL Light Formalizing

More information

N-Synchronous Kahn Networks A Relaxed Model of Synchrony for Real-Time Systems

N-Synchronous Kahn Networks A Relaxed Model of Synchrony for Real-Time Systems N-Synchronous Kahn Networks A Relaxed Model of Synchrony for Real-Time Systems Albert Cohen 1, Marc Duranton 2, Christine Eisenbeis 1, Claire Pagetti 1,4, Florence Plateau 3 and Marc Pouzet 3 POPL, Charleston

More information

Code Generation for a Simple First-Order Prover

Code Generation for a Simple First-Order Prover Code Generation for a Simple First-Order Prover Jørgen Villadsen, Anders Schlichtkrull, and Andreas Halkjær From DTU Compute, Technical University of Denmark, 2800 Kongens Lyngby, Denmark Abstract. We

More information

Computer-Aided Program Design

Computer-Aided Program Design Computer-Aided Program Design Spring 2015, Rice University Unit 3 Swarat Chaudhuri February 5, 2015 Temporal logic Propositional logic is a good language for describing properties of program states. However,

More information

Formal Verification Techniques. Riccardo Sisto, Politecnico di Torino

Formal Verification Techniques. Riccardo Sisto, Politecnico di Torino Formal Verification Techniques Riccardo Sisto, Politecnico di Torino State exploration State Exploration and Theorem Proving Exhaustive exploration => result is certain (correctness or noncorrectness proof)

More information

Recursion and Intro to Coq

Recursion and Intro to Coq L02-1 Recursion and Intro to Coq Armando Solar Lezama Computer Science and Artificial Intelligence Laboratory M.I.T. With content from Arvind and Adam Chlipala. Used with permission. September 21, 2015

More information

Typed Arithmetic Expressions

Typed Arithmetic Expressions Typed Arithmetic Expressions CS 550 Programming Languages Jeremy Johnson TAPL Chapters 3 and 5 1 Types and Safety Evaluation rules provide operational semantics for programming languages. The rules provide

More information

The Formal Proof Susan Gillmor and Samantha Rabinowicz Project for MA341: Appreciation of Number Theory Boston University Summer Term

The Formal Proof Susan Gillmor and Samantha Rabinowicz Project for MA341: Appreciation of Number Theory Boston University Summer Term The Formal Proof Susan Gillmor and Samantha Rabinowicz Project for MA341: Appreciation of Number Theory Boston University Summer Term 1 2009 Instructor: Kalin Kostadinov The Formal Proof 2 A proof verifies

More information

CMSC 631 Program Analysis and Understanding Fall Type Systems

CMSC 631 Program Analysis and Understanding Fall Type Systems Program Analysis and Understanding Fall 2017 Type Systems Type Systems A type system is a tractable syntactic method for proving the absence of certain program behaviors by classifying phrases according

More information

Review. Principles of Programming Languages. Equality. The Diamond Property. The Church-Rosser Theorem. Corollaries. CSE 230: Winter 2007

Review. Principles of Programming Languages. Equality. The Diamond Property. The Church-Rosser Theorem. Corollaries. CSE 230: Winter 2007 CSE 230: Winter 2007 Principles of Programming Languages Lecture 12: The λ-calculus Ranjit Jhala UC San Diego Review The lambda calculus is a calculus of functions: e := x λx. e e 1 e 2 Several evaluation

More information

Verifying Self-stabilizing Population Protocols with Coq

Verifying Self-stabilizing Population Protocols with Coq Verifying Self-stabilizing Population Protocols with Coq Yuxin Deng and Jean-François Monin Department of Computer Science and Engineering, Shanghai Jiao Tong University, China Université de Grenoble 1,

More information

Introduction to Turing Machines. Reading: Chapters 8 & 9

Introduction to Turing Machines. Reading: Chapters 8 & 9 Introduction to Turing Machines Reading: Chapters 8 & 9 1 Turing Machines (TM) Generalize the class of CFLs: Recursively Enumerable Languages Recursive Languages Context-Free Languages Regular Languages

More information

Lecture Notes: Axiomatic Semantics and Hoare-style Verification

Lecture Notes: Axiomatic Semantics and Hoare-style Verification Lecture Notes: Axiomatic Semantics and Hoare-style Verification 17-355/17-665/17-819O: Program Analysis (Spring 2018) Claire Le Goues and Jonathan Aldrich clegoues@cs.cmu.edu, aldrich@cs.cmu.edu It has

More information

An Introduction to Z3

An Introduction to Z3 An Introduction to Z3 Huixing Fang National Trusted Embedded Software Engineering Technology Research Center April 12, 2017 Outline 1 SMT 2 Z3 Huixing Fang (ECNU) An Introduction to Z3 April 12, 2017 2

More information

Part 1: Propositional Logic

Part 1: Propositional Logic Part 1: Propositional Logic Literature (also for first-order logic) Schöning: Logik für Informatiker, Spektrum Fitting: First-Order Logic and Automated Theorem Proving, Springer 1 Last time 1.1 Syntax

More information

Human-Readable Machine-Verifiable Proofs for Teaching Constructive Logic

Human-Readable Machine-Verifiable Proofs for Teaching Constructive Logic Human-Readable Machine-Verifiable Proofs for Teaching Constructive Logic Andreas Abel, Bor-Yuh Evan Chang, and Frank Pfenning Workshop on Proof Transformations, Proof Presentations and Complexity of Proofs

More information

A Termination Checker for Isabelle Hoare Logic

A Termination Checker for Isabelle Hoare Logic A Termination Checker for Isabelle Hoare Logic Jia Meng 1, Lawrence C. Paulson 2, and Gerwin Klein 3 1 National ICT Australia jia.meng@nicta.com.au 2 Computer Laboratory, University of Cambridge lp15@cam.ac.uk

More information

Typing λ-terms. Types. Typed λ-terms. Base Types. The Typing Relation. Advanced Formal Methods. Lecture 3: Simply Typed Lambda calculus

Typing λ-terms. Types. Typed λ-terms. Base Types. The Typing Relation. Advanced Formal Methods. Lecture 3: Simply Typed Lambda calculus Course 2D1453, 200607 Advanced Formal Methods Lecture 3: Simply Typed Lambda calculus Mads Dam KTH/CSC Some material from B. Pierce: TAPL + some from G. Klein, NICTA Typing λterms The uptyped λcalculus

More information

Reasoning About Imperative Programs. COS 441 Slides 10b

Reasoning About Imperative Programs. COS 441 Slides 10b Reasoning About Imperative Programs COS 441 Slides 10b Last time Hoare Logic: { P } C { Q } Agenda If P is true in the initial state s. And C in state s evaluates to s. Then Q must be true in s. Program

More information

SMT: Satisfiability Modulo Theories

SMT: Satisfiability Modulo Theories SMT: Satisfiability Modulo Theories Ranjit Jhala, UC San Diego April 9, 2013 Decision Procedures Last Time Propositional Logic Today 1. Combining SAT and Theory Solvers 2. Theory Solvers Theory of Equality

More information

Functional Programming with F# Overview and Basic Concepts

Functional Programming with F# Overview and Basic Concepts Functional Programming with F# Overview and Basic Concepts Radu Nicolescu Department of Computer Science University of Auckland 27 Sep 2017 1 / 52 1 Background 2 Overview 3 Type System and Type Inference

More information

CIS 500: Software Foundations

CIS 500: Software Foundations CIS 500: Software Foundations Solutions Final Exam December 15, 2017 1. Inductive relations (11 points) Complete the definition at the bottom of the page of an Inductive relation count that relates a list

More information

Intel s Successes with Formal Methods

Intel s Successes with Formal Methods 0 Intel s Successes with Formal Methods John Harrison Intel Corporation Software, Science & Society World Forestry Center, Portland OR December 5, 2003 1 Bugs in computer systems Most modern computer systems

More information

Hoare Logic: Reasoning About Imperative Programs

Hoare Logic: Reasoning About Imperative Programs Hoare Logic: Reasoning About Imperative Programs COMP1600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2017 Catch Up / Drop in Lab When Fridays, 15.00-17.00 Where N335, CSIT Building

More information

A Calculus for Dynamic Loading

A Calculus for Dynamic Loading A Calculus for Dynamic Loading Michael Hicks University of Pennsylvania Stephanie Weirich Cornell University February 6, 2001 Abstract We present the load-calculus, used to model dynamic loading, and prove

More information

Towards Lightweight Integration of SMT Solvers

Towards Lightweight Integration of SMT Solvers Towards Lightweight Integration of SMT Solvers Andrei Lapets Boston University Boston, USA lapets@bu.edu Saber Mirzaei Boston University Boston, USA smirzaei@bu.edu 1 Introduction A large variety of SMT

More information

Homework 5: Parallelism and Control Flow : Types and Programming Languages Fall 2015 TA: Evan Cavallo

Homework 5: Parallelism and Control Flow : Types and Programming Languages Fall 2015 TA: Evan Cavallo Homework 5: Parallelism and Control Flow 15-814: Types and Programming Languages Fall 2015 TA: Evan Cavallo (ecavallo@cs.cmu.edu) Out: 11/5/15 Due: 11/17/15, 10:30am 1 Cost Dynamics In this section, we

More information

Static Program Analysis using Abstract Interpretation

Static Program Analysis using Abstract Interpretation Static Program Analysis using Abstract Interpretation Introduction Static Program Analysis Static program analysis consists of automatically discovering properties of a program that hold for all possible

More information

COMPUTER SCIENCE TRIPOS

COMPUTER SCIENCE TRIPOS CST.2014.6.1 COMPUTER SCIENCE TRIPOS Part IB Thursday 5 June 2014 1.30 to 4.30 pm COMPUTER SCIENCE Paper 6 Answer five questions. Submit the answers in five separate bundles, each with its own cover sheet.

More information

An extension of HM(X) with bounded existential and universal data-types

An extension of HM(X) with bounded existential and universal data-types Groupe de travail Cristal July, 2003 An extension of HM(X) with bounded existential and universal data-types (To appear at ICFP 03) Vincent Simonet INRIA Rocquencourt Cristal project Vincent.Simonet@inria.fr

More information

Classical First-Order Logic

Classical First-Order Logic Classical First-Order Logic Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2009/2010 Maria João Frade (DI-UM) First-Order Logic (Classical) MFES 2009/10

More information

Executing the formal semantics of the Accellera Property Specification Language

Executing the formal semantics of the Accellera Property Specification Language Executing the PSL semantics 1/17 Executing the formal semantics of the Accellera Property Specification Language joint work with Joe Hurd & Konrad Slind Standard practice: generate tools from formal syntax

More information

Software Engineering using Formal Methods

Software Engineering using Formal Methods Software Engineering using Formal Methods First-Order Logic Wolfgang Ahrendt 26th September 2013 SEFM: First-Order Logic 130926 1 / 53 Install the KeY-Tool... KeY used in Friday s exercise Requires: Java

More information

Deductive Verification

Deductive Verification Deductive Verification Mooly Sagiv Slides from Zvonimir Rakamaric First-Order Logic A formal notation for mathematics, with expressions involving Propositional symbols Predicates Functions and constant

More information

Unifying Theories of Programming

Unifying Theories of Programming 1&2 Unifying Theories of Programming Unifying Theories of Programming 3&4 Theories Unifying Theories of Programming designs predicates relations reactive CSP processes Jim Woodcock University of York May

More information

Introduction to functions

Introduction to functions Introduction to functions Comp Sci 1570 Introduction to C++ Outline 1 2 Functions A function is a reusable sequence of s designed to do a particular job. In C++, a function is a group of s that is given

More information

Probabilistic Guarded Commands Mechanized in HOL

Probabilistic Guarded Commands Mechanized in HOL Probabilistic Guarded Commands Mechanized in HOL Joe Hurd joe.hurd@comlab.ox.ac.uk Oxford University Joint work with Annabelle McIver (Macquarie University) and Carroll Morgan (University of New South

More information

Towards Operations on Operational Semantics

Towards Operations on Operational Semantics Towards Operations on Operational Semantics Mauro Jaskelioff mjj@cs.nott.ac.uk School of Computer Science & IT 22 nd British Colloquium for Theoretical Computer Science The Context We need semantics to

More information

EDA045F: Program Analysis LECTURE 10: TYPES 1. Christoph Reichenbach

EDA045F: Program Analysis LECTURE 10: TYPES 1. Christoph Reichenbach EDA045F: Program Analysis LECTURE 10: TYPES 1 Christoph Reichenbach In the last lecture... Performance Counters Challenges in Dynamic Performance Analysis Taint Analysis Binary Instrumentation 2 / 44 Types

More information

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 8: Procedures for First-Order Theories, Part 2

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 8: Procedures for First-Order Theories, Part 2 Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 8: Procedures for First-Order Theories, Part 2 Matt Fredrikson mfredrik@cs.cmu.edu October 17, 2016 Matt Fredrikson Theory Procedures

More information

Validating QBF Invalidity in HOL4

Validating QBF Invalidity in HOL4 Interactive Theorem Proving (ITP) 14 July, 2010 Quantified Boolean Formulae Quantified Boolean Formulae Motivation System Overview Related Work QBF = propositional logic + quantifiers over Boolean variables

More information

What happens to the value of the expression x + y every time we execute this loop? while x>0 do ( y := y+z ; x := x:= x z )

What happens to the value of the expression x + y every time we execute this loop? while x>0 do ( y := y+z ; x := x:= x z ) Starter Questions Feel free to discuss these with your neighbour: Consider two states s 1 and s 2 such that s 1, x := x + 1 s 2 If predicate P (x = y + 1) is true for s 2 then what does that tell us about

More information

Meta-Reasoning in a Concurrent Logical Framework

Meta-Reasoning in a Concurrent Logical Framework Meta-Reasoning in a Concurrent Logical Framework Iliano Cervesato and Jorge Luis Sacchini Carnegie Mellon University Chalmers University, 16 Oct 2013 Iliano Cervesato and Jorge Luis Sacchini Meta-Reasoning

More information

Reduced Ordered Binary Decision Diagrams

Reduced Ordered Binary Decision Diagrams Reduced Ordered Binary Decision Diagrams Lecture #13 of Advanced Model Checking Joost-Pieter Katoen Lehrstuhl 2: Software Modeling & Verification E-mail: katoen@cs.rwth-aachen.de June 5, 2012 c JPK Switching

More information

Combined Satisfiability Modulo Parametric Theories

Combined Satisfiability Modulo Parametric Theories Intel 07 p.1/39 Combined Satisfiability Modulo Parametric Theories Sava Krstić*, Amit Goel*, Jim Grundy*, and Cesare Tinelli** *Strategic CAD Labs, Intel **The University of Iowa Intel 07 p.2/39 This Talk

More information

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig First-Order Logic First-Order Theories Roopsha Samanta Partly based on slides by Aaron Bradley and Isil Dillig Roadmap Review: propositional logic Syntax and semantics of first-order logic (FOL) Semantic

More information

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 7: Procedures for First-Order Theories, Part 1

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 7: Procedures for First-Order Theories, Part 1 Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 7: Procedures for First-Order Theories, Part 1 Matt Fredrikson mfredrik@cs.cmu.edu October 17, 2016 Matt Fredrikson Theory Procedures

More information

Computation Tree Logic (CTL) & Basic Model Checking Algorithms

Computation Tree Logic (CTL) & Basic Model Checking Algorithms Computation Tree Logic (CTL) & Basic Model Checking Algorithms Martin Fränzle Carl von Ossietzky Universität Dpt. of Computing Science Res. Grp. Hybride Systeme Oldenburg, Germany 02917: CTL & Model Checking

More information

Abstractions and Decision Procedures for Effective Software Model Checking

Abstractions and Decision Procedures for Effective Software Model Checking Abstractions and Decision Procedures for Effective Software Model Checking Prof. Natasha Sharygina The University of Lugano, Carnegie Mellon University Microsoft Summer School, Moscow, July 2011 Lecture

More information

Hoare Calculus and Predicate Transformers

Hoare Calculus and Predicate Transformers Hoare Calculus and Predicate Transformers Wolfgang Schreiner Wolfgang.Schreiner@risc.uni-linz.ac.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.uni-linz.ac.at

More information

Integrating a SAT Solver with an LCF-style Theorem Prover

Integrating a SAT Solver with an LCF-style Theorem Prover Integrating a SAT Solver with an LCF-style Theorem Prover A Fast Decision Procedure for Propositional Logic for the System Tjark Weber webertj@in.tum.de PDPAR 05, July 12, 2005 Integrating a SAT Solver

More information

Logic - recap. So far, we have seen that: Logic is a language which can be used to describe:

Logic - recap. So far, we have seen that: Logic is a language which can be used to describe: Logic - recap So far, we have seen that: Logic is a language which can be used to describe: Statements about the real world The simplest pieces of data in an automatic processing system such as a computer

More information

Comp 11 Lectures. Mike Shah. July 26, Tufts University. Mike Shah (Tufts University) Comp 11 Lectures July 26, / 40

Comp 11 Lectures. Mike Shah. July 26, Tufts University. Mike Shah (Tufts University) Comp 11 Lectures July 26, / 40 Comp 11 Lectures Mike Shah Tufts University July 26, 2017 Mike Shah (Tufts University) Comp 11 Lectures July 26, 2017 1 / 40 Please do not distribute or host these slides without prior permission. Mike

More information

Safety Analysis versus Type Inference

Safety Analysis versus Type Inference Information and Computation, 118(1):128 141, 1995. Safety Analysis versus Type Inference Jens Palsberg palsberg@daimi.aau.dk Michael I. Schwartzbach mis@daimi.aau.dk Computer Science Department, Aarhus

More information

The TLA + proof system

The TLA + proof system The TLA + proof system Stephan Merz Kaustuv Chaudhuri, Damien Doligez, Leslie Lamport INRIA Nancy & INRIA-MSR Joint Centre, France Amir Pnueli Memorial Symposium New York University, May 8, 2010 Stephan

More information

CS294-9 September 14, 2006 Adam Chlipala UC Berkeley

CS294-9 September 14, 2006 Adam Chlipala UC Berkeley Interactive Computer Theorem Proving Lecture 4: Inductively- Defined Predicates CS294-9 September 14, 2006 Adam Chlipala UC Berkeley 1 Administrivia The course registration database has been updated so

More information

One Year Later. Iliano Cervesato. ITT Industries, NRL Washington, DC. MSR 3.0:

One Year Later. Iliano Cervesato. ITT Industries, NRL Washington, DC.  MSR 3.0: MSR 3.0: The Logical Meeting Point of Multiset Rewriting and Process Algebra MSR 3: Iliano Cervesato iliano@itd.nrl.navy.mil One Year Later ITT Industries, inc @ NRL Washington, DC http://www.cs.stanford.edu/~iliano

More information

Focusing on Binding and Computation

Focusing on Binding and Computation Focusing on Binding and Computation Dan Licata Joint work with Noam Zeilberger and Robert Harper Carnegie Mellon University 1 Programming with Proofs Represent syntax, judgements, and proofs Reason about

More information