Synthesis using Variable Elimination
|
|
- Poppy Alaina Heath
- 5 years ago
- Views:
Transcription
1 Synthesis using Variable Elimination Viktor Kuncak EPF Lausanne
2 Implicit Programming at All Levels Opportunities for implicit programming in Development within an IDE InSynth tool Compilation Comfusy and RegSy tools Execution Scala^Z3, UDITA, Kaplan
3 constraint (relation): P(a,x) between inputs and outputs a. pre(a) P(a,f(a)) precondition: pre(a) function: x = f(a) from inputs to outputs
4 Compilation in Comfusy def secondstotime(totalseconds: Int) : (Int, Int, Int) = choose((h: Int, m: Int, s: Int) ( h * m * 60 + s == totalseconds && h 0 && m 0 && m < 60 && s 0 && s < 60 )) def secondstotime(totalseconds: Int) : (Int, Int, Int) = val t1 =? val t2 = val t3 = val t4 = (t1, t3, t4) Mikaël Mayer Ruzica Piskac Philippe Suter, PLDI 10
5 Todays Approach:
6 Equations Use one equation to reduce the number of variables by one: choose((h: Int, m: Int, s: Int) ( h * m * 60 + s == totalseconds && h 0 && m 0 && m < 60 && s 0 && s < 60 ))
7 One equation where no coefficient is 1 choose((x,y) => 10 x + 14 y == a ) Find one possible pair x,y, as a function of a.
8 Constructive (Extended) Euclid s Algorithm: gcd(10,14) x + 14 y == 10 x + 14 y == a
9 Result of Synthesis for one Equation choose((x,y) => 10 x + 14 y == a ) assert ( ) val x = val y = check the solution: Change in requirements! Customer also wants: x < y does our solution work for e.g. a=2
10 Idea: Eliminate Variables choose((x,y) => 10 x + 14 y == a && x < y) Cannot easily eliminate one of the x,y. Eliminate both x,y, get one free - z x = 3/2 a + c 1 z y = -a + c 2 z c 1 =? c 2 =? Find general form, characterize all solutions, parametric solution
11 Idea: Eliminate Variables choose((x,y) => 10 x + 14 y == a && x < y) x = 3/2 a + c 1 z y = -a + c 2 z 10 x y 0 + (10 c c 2 ) == a 10 c c 2 == 0 c 1 =? c 2 =?
12 choose((x,y) => 10 x + 14 y == a && x < y) x = 3/2 a + 5 z y = -a - 7 z
13 I forgot to say, we also wish: 0 < x choose((x,y) => 10 x + 14 y == a && 0 < x && x < y)
14 Compilation in Comfusy def secondstotime(totalseconds: Int) : (Int, Int, Int) = choose((h: Int, m: Int, s: Int) ( h * m * 60 + s == totalseconds && h 0 && m 0 && m < 60 && s 0 && s < 60 )) def secondstotime(totalseconds: Int) : (Int, Int, Int) = val t1 =? val t2 = val t3 = val t4 = (t1, t3, t4) Mikaël Mayer Ruzica Piskac Philippe Suter, PLDI 10
15 Synthesis Procedure on Example process every equality: take an equality E i, compute a parametric description of the solution set and insert those values in the rest of formula 15 Z totalsecon ds s m h, CODE: <further code will come here> val h = lambda val m = mu val s = (-3600) * lambda + (-60) * mu + totalseconds
16 Synthesis Procedure by Example process every equality: take an equality E i, compute a parametric description of the solution set and insert those values in the rest of formula 16 Z totalsecon ds s m h, Formula (remain specification): 0 λ, 0 μ, μ 59, 0 totalseconds 3600λ - 60μ, totalseconds 3600λ - 60μ 59
17 Processing Inequalities process output variables one by one 0 λ, 0 μ, μ 59, 0 totalseconds 3600λ - 60μ, totalseconds 3600λ - 60μ 59 expressing constraints as bounds on μ 0 λ, 0 μ, μ 59, μ (totalseconds 3600λ)/60, (totalseconds 3600λ 59)/60 μ Code: val mu = min(59, (totalseconds -3600* lambda) div 60)
18 Fourier-Motzkin-Style Elimination 0 λ, 0 μ, μ 59, μ (totalseconds 3600λ)/60, (totalseconds 3600λ 59)/60 μ combine each lower and upper bound 0 λ, 0 59, 0 (totalseconds 3600λ)/60, (totalseconds 3600λ 59)/60 (totalseconds 3600λ)/60, (totalseconds 3600λ 59)/60 59 basic simplifications 0 λ, 60λ totalseconds /60, (totalseconds 59)/ λ Code: val lambda = totalseconds div 3600 Preconditions: 0 totalseconds
19 Compilation in Comfusy def secondstotime(totalseconds: Int) : (Int, Int, Int) = choose((h: Int, m: Int, s: Int) ( h * m * 60 + s == totalseconds && h 0 && m 0 && m < 60 && s 0 && s < 60 )) def secondstotime(totalseconds: Int) : (Int, Int, Int) = val t1 = totalseconds div 3600 val t2 = totalseconds * t1 val t3 = t2 div 60 val t4 = totalseconds * t1-60 * t3 (t1, t3, t4) Mikaël Mayer Ruzica Piskac Philippe Suter, PLDI 10
20 Handling of Inequalities Solve for one by one variable: separate inequalities depending on polarity of x: A i α i x β j x B j define values a = max i A i /α i and b = min j B j / β j if b is defined, return x = b else return x = a further continue with the conjunction of all formulas A i /α i B j / β j 20
21 2y b 3x + a 2x a 4y + b 2y b a 3x 2x 4y + a + b 4y 2b 2a 6x 12y + 3a + 3b (4y 2b 2a) / 6 x (12y + 3a + 3b) / 6 (4y 2b 2a) / 6 (12y + 3a + 3b) / 6 two extra variables: (4y 2b 2a) / 6 l 12y + 3a + 3b = 6 l + k 0 k 5 4y 2b 2a 6 * l 12y + 3a + 3b = 6 l + k 0 k 5 pre: 6 3a + 3b k 4y 2b 2a 12y + 3a + 3b k 5b 5a +k 8y y = (k 5a 5b)/8 21
22 Generated Code Contains Loops val (x1, y1) = choose(x: Int, y: Int => 2*y b =< 3*x + a && 2*x a =< 4*y + b) val kfound = false for k = 0 to 5 do { val v1 = 3 * a + 3 * b k if (v1 mod 6 == 0) { val alpha = ((k 5 * a 5 * b)/8).ceiling val l = (v1 / 6) + 2 * alpha val y = alpha val kfound = true break } } if (kfound) val x = ((4 * y + a + b)/2).floor else throw new Exception( No solution exists ) 22
23 NP-Hard Constructs Divisibility combined with inequalities: corresponding to big disjunction in q.e., we will generate a for loop with constant bounds (could be expanded if we wish) Disjunctions Synthesis of a formula computes program and exact precondition of when output exists Given disjunctive normal form, use preconditions to generate if-then-else expressions (try one by one)
24 Synthesis for Disjunctions
25 General Form of Synthesized Functions for Presburger Arithmetic choose x such that F(x,a) x = t(a) Result t(a) is expressed in terms of +, -, C*, /C, if Need arithmetic for solving equations Need conditionals for disjunctions in input formula divisibility and inequalities (find a witness meeting bounds and divisibility by constants) t(a) = if P 1 (a) t 1 (a) elseif elseif P n (a) t n (a) else error( No solution exists for input,a)
26 Methodology QE Synthesis Each quantifier elimination trick we found corresponds to a synthesis trick Find the corresponding terms Key techniques: one point rule immediately gives a term change variables, using a computable function strengthen formula while preserving realizability recursively eliminate variables one-by one Example use transform formula into disjunction strengthen each disjunct using equality apply one-point rule
27 Synthesis for non-linear arithmetic def decomposeoffset(offset: Int, dimension: Int) : (Int, Int) = choose((x: Int, y: Int) ( offset == x + dimension * y && 0 x && x < dimension )) The predicate becomes linear at run-time Synthesized program must do case analysis on the sign of the input variables Some coefficients are computed at run-time
28 Generated Code May Contain Loops val (x1, y1) = choose(x: Int, y: Int => 2*y b =< 3*x + a && 2*x a =< 4*y + b) val kfound = false for k = 0 to 5 do { val v1 = 3 * a + 3 * b k if (v1 mod 6 == 0) { val alpha = ((k 5 * a 5 * b)/8).ceiling val l = (v1 / 6) + 2 * alpha val y = alpha val kfound = true break } } if (kfound) val x = ((4 * y + a + b)/2).floor else throw new Exception( No solution exists )
29 Basic Compile-Time Analysis
30 Compile-time warnings def secondstotime(totalseconds: Int) : (Int, Int, Int) = choose((h: Int, m: Int, s: Int) ( h * m * 60 + s == totalseconds && h 0 && h < 24 && m 0 && m < 60 && s 0 && s < 60 )) Warning: Synthesis predicate is not satisfiable for variable assignment: totalseconds = 86400
31 Compile-time warnings def secondstotime(totalseconds: Int) : (Int, Int, Int) = choose((h: Int, m: Int, s: Int) ( h * m * 60 + s == totalseconds && h 0 && m 0 && m 60 && s 0 && s < 60 )) Warning: Synthesis predicate has multiple solutions for variable assignment: totalseconds = 60 Solution 1: h = 0, m = 0, s = 60 Solution 2: h = 0, m = 1, s = 0
32 Handling Data Structures
33 Synthesis for sets def splitbalanced[t](s: Set[T]) : (Set[T], Set[T]) = choose((a: Set[T], b: Set[T]) ( a union b == s && a intersect b == empty && a.size b.size 1 && b.size a.size 1 )) def splitbalanced[t](s: Set[T]) : (Set[T], Set[T]) = val k = ((s.size + 1)/2).floor val t1 = k val t2 = s.size k val s1 = take(t1, s) val s2 = take(t2, s minus s1) (s1, s2) s a b
34 From Data Structures to Numbers Observation: Reasoning about collections reduces to reasoning about linear integer arithmetic! a.size == b.size && a union b == bigset && a intersect b == empty a b bigset 34
35 From Data Structures to Numbers Observation: Reasoning about collections reduces to reasoning about linear integer arithmetic! a.size == b.size && a union b == bigset && a intersect b == empty a b bigset 35
36 From Data Structures to Numbers Observation: Reasoning about collections reduces to reasoning about linear integer arithmetic! a.size == b.size && a union b == bigset && a intersect b == empty a b bigset 36
37 From Data Structures to Numbers Observation: Reasoning about collections reduces to reasoning about linear integer arithmetic! a.size == b.size && a union b == bigset && a intersect b == empty a b New specification: ka = kb bigset 37
38 From Data Structures to Numbers Observation: Reasoning about collections reduces to reasoning about linear integer arithmetic! a.size == b.size && a union b == bigset && a intersect b == empty a b New specification: ka = kb && ka +kb = bigset bigset 38
39
40
41 Experience with Comfusy Works well for examples we encountered Needed: synthesis for more expressive logics, to handle more examples seems ideal for domain-specific languages Efficient for conjunctions of equations (could be made polynomial) Extends to synthesis with parametric coefficients Extends to logics that reduce to Presburger arithmetic (implemented for BAPA)
42 Comfusy for Arithmetic Limitations of Comfusy for arithmetic: Naïve handling of disjunctions Blowup in elimination, divisibility constraints Complexity of running synthesized code (from QE): doubly exponential in formula size Not tested on modular arithmetic, or on synthesis with optimization objectives Arbitrary-precision arithmetic with multiple operations generates time-inefficient code Cannot do bitwise operations (not in PA)
43 Arithmetic Synthesis using Automata
44 RegSy Synthesis for regular specifications over unbounded domains J. Hamza, B. Jobstmann, V. Kuncak FMCAD 2010
45 Automata-Based Synthesis Disjunctions not a problem Result not depends on the syntax of input formula Complexity of running synthesized code: ALWAYS LINEAR IN THE NUMBER OF BITS Modular arithmetic and bitwise operators: synthesize bit tricks for unbounded number of bits, uniformly without skeletons Supports quantified constraints including optimization constraints
46 Expressiveness of Spec Language Non-negative integer constants and variables Boolean operators Linear arithmetic operator Bitwise operators Quantifiers over numbers and bit positions (,,) (, &,!) (, c x) PAbit = Presburger arithmetic with bitwise operators WS1S= weak monadic second-order logic of one successor
47
48 Basic Idea View integers as finite (unbounded) bit-streams (binary representation starting with LSB) Specification in WS1S (PAbit) Synthesis approach: Step 1: Compile specification to automaton over combined input/output alphabet (automaton specifying relation) Step 2: Use automaton to generate efficient function from inputs to outputs realizing relation
49 Inefficient but Correct Method Run over a deterministic automaton over inputs and outputs Becomes run of a non-deterministic if we look only at outputs Simulate all branches until the end of input Successful branches indicate outputs that work
50 Our Approach: Precompute without losing backward information WS1S spec Synthesis: 1. Det. automaton for spec over joint alphabet 2. Project, determinize, extract lookup table Mona Synthesized program: Automaton + lookup table Input word Execution: 1. Run A on input w and record trace 2. Use table to run backwards and output Output word
51 Experiments No Example MONA (ms) Syn (ms) A A 512b 1024b 2048b 4096b 1 addition approx company parity mod weightsmin weights smooth-4b smooth-f-2b smooth-b-2b Linear scaling observed in length of input n In 3 seconds solve constraint, minimizing the output; Inputs and outputs are of order
52 Thought: A quantifier not to forget Automatically synthesized and only automatically tested code is great But probably even less likely to be correct Synthesizing programs that are guaranteed to be correct by construction will remain important.
53 Implicit Programming at All Levels Opportunities for implicit programming in Development within an IDE InSynth tool Compilation Comfusy and RegSy tools Execution Scala^Z3 and UDITA tools requirements def f(x : Int) = { choose y st... } iload_0 iconst_1 call Z3 42
54 Example all : SequenceInputStream = tool
55 Code Synthesis inside IDE Find all visible symbols Create clauses: - encode in FOL - assign weights Program point Max steps Resolution algorithm with weights Code snippets
56 Curry-Howard Correspondence def map[a,b](x : List[T], f : A -> B) : List[B] = {...}
57 joint work with: Tihomir Gvero, Ruzica Piskac InSynth - Interactive Synthesis of Code Snippets def map[a,b](f:a => B, l:list[a]): List[B] = {... } def stringconcat(lst : List[String]): String = {... }... def printints(intlist:list[int], prn: Int => String): String = Returned value: stringconcat(map (prn, intlist)) Is there a term of given type in given environment? Monorphic: decidable. Polymorphic: undecidable
58 Features Parametric polymorphism Branching expressions with multiple arguments (not just chains of calls) Mining API usage frequencies but can still synthesize previously unseen code Distance to program point heuristics Filtering based on test-cases
59 Wrapping Up
60 Synthesis and Verification Some functionality is best synthesized from specs other: better implemented, verified (and put into library) Currently, no choice must always implement specifications and verification are viewed as overhead Goal: make specifications intrinsic part of programs, with clear benefits to programmers they run! Example: write an assertion, not how to establish it This will help both verifiability: document, not reverse-engineer the invariants productivity: avoid writing messy implementation
61 Conclusion: Implicit Programming Development within an IDE InSynth tool theorem proving as code completion Compilation Comfusy : decision procedure synthesis procedure Scala implementation for integer arithmetic, BAPA RegSy : solving WS1S constraints Execution UDITA: Java + choice as test generation language Scala^Z3 : invoking Z3 Kaplan: constraint programming in Scala
Implicit Programming
Implicit Programming Viktor Kuncak EPF Lausanne http://lara.epfl.ch/w/impro Joint work with Ruzica Piskac Philippe Suter Tihomir Gvero Mikaël Mayer Ali Sinan Köksal EPFL Sebastien Vasey Barbara Jobstmann
More informationSoftware Construction using Executable Constraints
Software Construction using Executable Constraints Presented by: Viktor Kuncak joint work with: Ali Sinan Köksal, Ruzica Piskac, and Philippe Suter Swiss Federal Institute of Technology Lausanne (EPFL)
More informationAutomating Construction of Provably Correct Software Viktor Kuncak
Your Wish is my Command Automating Construction of Provably Correct Software Viktor Kuncak EPFL School of Computer and Communication Sciences Laboratory for Automated Reasoning and Analysis http://lara.epfl.ch
More informationFunctional Synthesis for Linear Arithmetic and Sets
Software Tools for Technology Transfer manuscript No. (will be inserted by the editor) Functional Synthesis for Linear Arithmetic and Sets Viktor Kuncak, Mikaël Mayer, Ruzica Piskac, Philippe Suter School
More informationComplete Functional Synthesis
Complete Functional Synthesis Viktor Kuncak Mikaël Mayer Ruzica Piskac Philippe Suter School of Computer and Communication Sciences (I&C) - Swiss Federal Institute of Technology (EPFL), Switzerland firstname.lastname@epfl.ch
More informationYour Wish is my Command
Your Wish is my Command Viktor Kunčak School of Computer and Communication Sciences Laboratory for Automated Reasoning and Analysis http://lara.epfl.ch wish human effort Command(program) compilation 11011001
More informationdoi: / Software Synthesis Procedures By Viktor Kuncak, Mikaël Mayer, Ruzica Piskac, and Philippe Suter
doi:10.1145/2076450.2076472 Software Synthesis Procedures By Viktor Kuncak, Mikaël Mayer, Ruzica Piskac, and Philippe Suter Abstract Automated synthesis of program fragments from specifications can make
More informationSolving Computations. Viktor Kuncak. PhD MIT,
Solving Computations Viktor Kuncak PhD MIT, 2007 School of Computer and Communication Sciences Laboratory for Automated Reasoning and Analysis http://lara.epfl.ch/~kuncak 1 GOAL Help people construct software
More informationOn Interactive Synthesis of Code Snippets
On Interactive Synthesis of Code Snippets Tihomir Gvero, Viktor Kuncak, and Ruzica Piskac firstname.lastname@epfl.ch Swiss Federal Institute of Technology (EPFL), Switzerland Abstract. We describe a tool
More informationSynthesizing Computable Functions from Relations. Viktor Kuncak. EPFL Laboratory for Automated Reasoning and Analysis
Synthesizing Computable Functions from Relations Viktor Kuncak EPFL Laboratory for Automated Reasoning and Analysis http://lara.epfl.ch http://leon.epfl.ch wish requirement formalization From your wish
More informationAction Language Verifier, Extended
Action Language Verifier, Extended Tuba Yavuz-Kahveci 1, Constantinos Bartzis 2, and Tevfik Bultan 3 1 University of Florida 2 Carnegie Mellon University 3 UC, Santa Barbara 1 Introduction Action Language
More informationLaboratory for Automated Reasoning and Analysis
http://lara.epfl.ch Laboratory for Automated Reasoning and Analysis Viktor Kuncak Assistant Professor, IC a project: http://javaverification.org ongoing class: http://richmodels.org/lat Spring, will be
More informationRuzica Piskac Yale University
Ruzica Piskac Yale University Why Software Verification? Maiden flight of the Ariane 5 rocket on the 4th of June 1996 The reason for the explosion was a software error Financial loss: $500,000,000 (including
More informationDeductive Methods, Bounded Model Checking
Deductive Methods, Bounded Model Checking http://d3s.mff.cuni.cz Pavel Parízek CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Deductive methods Pavel Parízek Deductive Methods, Bounded
More informationLecture 1 Contracts. 1 A Mysterious Program : Principles of Imperative Computation (Spring 2018) Frank Pfenning
Lecture 1 Contracts 15-122: Principles of Imperative Computation (Spring 2018) Frank Pfenning In these notes we review contracts, which we use to collectively denote function contracts, loop invariants,
More informationLecture 1 Contracts : Principles of Imperative Computation (Fall 2018) Frank Pfenning
Lecture 1 Contracts 15-122: Principles of Imperative Computation (Fall 2018) Frank Pfenning In these notes we review contracts, which we use to collectively denote function contracts, loop invariants,
More informationDISCRETE MATHEMATICS
DISCRETE MATHEMATICS WITH APPLICATIONS THIRD EDITION SUSANNA S. EPP DePaul University THOIVISON * BROOKS/COLE Australia Canada Mexico Singapore Spain United Kingdom United States CONTENTS Chapter 1 The
More informationNumerical Computations and Formal Methods
Program verification Formal arithmetic Decision procedures Proval, Laboratoire de Recherche en Informatique INRIA Saclay IdF, Université Paris Sud, CNRS October 28, 2009 Program verification Formal arithmetic
More informationLTCS Report. Concept Descriptions with Set Constraints and Cardinality Constraints. Franz Baader. LTCS-Report 17-02
Technische Universität Dresden Institute for Theoretical Computer Science Chair for Automata Theory LTCS Report Concept Descriptions with Set Constraints and Cardinality Constraints Franz Baader LTCS-Report
More informationInduction and Semantics in Dafny
15-414 Lecture 11 1 Instructor: Matt Fredrikson Induction and Semantics in Dafny TA: Ryan Wagner Encoding the syntax of Imp Recall the abstract syntax of Imp: a AExp ::= n Z x Var a 1 + a 2 b BExp ::=
More informationFinite Model Generation for Isabelle/HOL Using a SAT Solver
Finite Model Generation for / Using a SAT Solver Tjark Weber webertj@in.tum.de Technische Universität München Winterhütte, März 2004 Finite Model Generation for / p.1/21 is a generic proof assistant: Highly
More informationSolving Linear Constraints over Real. German Vitaliy Jr. Researcher Glushkov Institute of Cybernetic NAS Ukraine
Solving Linear Constraints over Real German Vitaliy Jr. Researcher Glushkov Institute of Cybernetic NAS Ukraine Email: novaua@ukr.net Talk outline Introduction Fourier-Motzkin elimination The main algorithm
More information6. Hoare Logic and Weakest Preconditions
6. Hoare Logic and Weakest Preconditions Program Verification ETH Zurich, Spring Semester 07 Alexander J. Summers 30 Program Correctness There are many notions of correctness properties for a given program
More informationCS 267: Automated Verification. Lecture 13: Bounded Model Checking. Instructor: Tevfik Bultan
CS 267: Automated Verification Lecture 13: Bounded Model Checking Instructor: Tevfik Bultan Remember Symbolic Model Checking Represent sets of states and the transition relation as Boolean logic formulas
More informationChapter 3. Semantics. Topics. Introduction. Introduction. Introduction. Introduction
Topics Chapter 3 Semantics Introduction Static Semantics Attribute Grammars Dynamic Semantics Operational Semantics Axiomatic Semantics Denotational Semantics 2 Introduction Introduction Language implementors
More informationCS-XXX: Graduate Programming Languages. Lecture 9 Simply Typed Lambda Calculus. Dan Grossman 2012
CS-XXX: Graduate Programming Languages Lecture 9 Simply Typed Lambda Calculus Dan Grossman 2012 Types Major new topic worthy of several lectures: Type systems Continue to use (CBV) Lambda Caluclus as our
More informationIntroduction to Automata Theory. BİL405 - Automata Theory and Formal Languages 1
Introduction to Automata Theory BİL405 - Automata Theory and Formal Languages 1 Automata, Computability and Complexity Automata, Computability and Complexity are linked by the question: What are the fundamental
More informationCSE 20 DISCRETE MATH. Winter
CSE 20 DISCRETE MATH Winter 2017 http://cseweb.ucsd.edu/classes/wi17/cse20-ab/ Final exam The final exam is Saturday March 18 8am-11am. Lecture A will take the exam in GH 242 Lecture B will take the exam
More informationCase by Case. Chapter 3
Chapter 3 Case by Case In the previous chapter, we used the conditional expression if... then... else to define functions whose results depend on their arguments. For some of them we had to nest the conditional
More informationProgram Verification using Templates over Predicate Abstraction. Saurabh Srivastava and Sumit Gulwani
Program Verification using Templates over Predicate Abstraction Saurabh Srivastava and Sumit Gulwani ArrayInit(Array A, int n) i := 0; while (i < n) A[i] := 0; i := i + 1; Assert( j: 0 j
More informationDiscrete Optimization. Lecture Notes 2
Discrete Optimization. Lecture Notes 2 Disjunctive Constraints Defining variables and formulating linear constraints can be straightforward or more sophisticated, depending on the problem structure. The
More information1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:
P R O B L E M S Finite Autom ata. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which: a) Are a multiple of three in length. b) End with the string
More informationCSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter p. 1/27
CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 2.1-2.7 p. 1/27 CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer
More informationLecture #23: Conversion and Type Inference
Lecture #23: Conversion and Type Inference Administrivia. Due date for Project #2 moved to midnight tonight. Midterm mean 20, median 21 (my expectation: 17.5). Last modified: Fri Oct 20 10:46:40 2006 CS164:
More informationConversion vs. Subtyping. Lecture #23: Conversion and Type Inference. Integer Conversions. Conversions: Implicit vs. Explicit. Object x = "Hello";
Lecture #23: Conversion and Type Inference Administrivia. Due date for Project #2 moved to midnight tonight. Midterm mean 20, median 21 (my expectation: 17.5). In Java, this is legal: Object x = "Hello";
More informationRuntime Checking for Program Verification Systems
Runtime Checking for Program Verification Systems Karen Zee, Viktor Kuncak, and Martin Rinard MIT CSAIL Tuesday, March 13, 2007 Workshop on Runtime Verification 1 Background Jahob program verification
More informationLecture 6: Arithmetic and Threshold Circuits
IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Advanced Course on Computational Complexity Lecture 6: Arithmetic and Threshold Circuits David Mix Barrington and Alexis Maciel July
More informationReducing Clocks in Timed Automata while Preserving Bisimulation
Reducing Clocks in Timed Automata while Preserving Bisimulation Shibashis Guha Chinmay Narayan S. Arun-Kumar Indian Institute of Technology Delhi {shibashis, chinmay, sak}@cse.iitd.ac.in arxiv:1404.6613v2
More information3.7 Denotational Semantics
3.7 Denotational Semantics Denotational semantics, also known as fixed-point semantics, associates to each programming language construct a well-defined and rigorously understood mathematical object. These
More informationData types for mcrl2
Data types for mcrl2 Aad Mathijssen April 5, 2018 We provide a syntax for the standard data types of the mcrl2 language. This syntax is intended to be a practical mix between standard mathematical notation
More informationCuts from Proofs: A Complete and Practical Technique for Solving Linear Inequalities over Integers
Cuts from Proofs: A Complete and Practical Technique for Solving Linear Inequalities over Integers Isil Dillig, Thomas Dillig, and Alex Aiken Computer Science Department Stanford University Linear Arithmetic
More informationProgramming Languages Third Edition
Programming Languages Third Edition Chapter 12 Formal Semantics Objectives Become familiar with a sample small language for the purpose of semantic specification Understand operational semantics Understand
More informationLecture Notes on Ints
Lecture Notes on Ints 15-122: Principles of Imperative Computation Frank Pfenning Lecture 2 August 26, 2010 1 Introduction Two fundamental types in almost any programming language are booleans and integers.
More informationBut first, encode deck of cards. Integer Representation. Two possible representations. Two better representations WELLESLEY CS 240 9/8/15
Integer Representation Representation of integers: unsigned and signed Sign extension Arithmetic and shifting Casting But first, encode deck of cards. cards in suits How do we encode suits, face cards?
More informationIn Our Last Exciting Episode
In Our Last Exciting Episode #1 Lessons From Model Checking To find bugs, we need specifications What are some good specifications? To convert a program into a model, we need predicates/invariants and
More informationSmall Formulas for Large Programs: On-line Constraint Simplification In Scalable Static Analysis
Small Formulas for Large Programs: On-line Constraint Simplification In Scalable Static Analysis Isil Dillig, Thomas Dillig, Alex Aiken Stanford University Scalability and Formula Size Many program analysis
More informationCS 456 (Fall 2018) Scribe Notes: 2
CS 456 (Fall 2018) Scribe Notes: 2 Albert Yu, Adam Johnston Lists Bags Maps Inductive data type that has an infinite collection of elements Not through enumeration but inductive type definition allowing
More informationVerification Overview Testing Theory and Principles Testing in Practice. Verification. Miaoqing Huang University of Arkansas 1 / 80
1 / 80 Verification Miaoqing Huang University of Arkansas Outline 1 Verification Overview 2 Testing Theory and Principles Theoretical Foundations of Testing Empirical Testing Principles 3 Testing in Practice
More informationTHEORY OF COMPUTATION
THEORY OF COMPUTATION UNIT-1 INTRODUCTION Overview This chapter begins with an overview of those areas in the theory of computation that are basic foundation of learning TOC. This unit covers the introduction
More informationCS671 Parallel Programming in the Many-Core Era
1 CS671 Parallel Programming in the Many-Core Era Polyhedral Framework for Compilation: Polyhedral Model Representation, Data Dependence Analysis, Scheduling and Data Locality Optimizations December 3,
More informationCS 11 Haskell track: lecture 1
CS 11 Haskell track: lecture 1 This week: Introduction/motivation/pep talk Basics of Haskell Prerequisite Knowledge of basic functional programming e.g. Scheme, Ocaml, Erlang CS 1, CS 4 "permission of
More informationCSCI 3155: Homework Assignment 3
CSCI 3155: Homework Assignment 3 Spring 2012: Due Monday, February 27, 2012 Like last time, find a partner. You will work on this assignment in pairs. However, note that each student needs to submit a
More informationSoftwaretechnik. Program verification. Software Engineering Albert-Ludwigs-University Freiburg. June 30, 2011
Softwaretechnik Program verification Software Engineering Albert-Ludwigs-University Freiburg June 30, 2011 (Software Engineering) Softwaretechnik June 30, 2011 1 / 28 Road Map Program verification Automatic
More informationProofs and Counterexamples for Java Programs
http://lara.epfl.ch Proofs and Counterexamples for Java Programs Viktor Kuncak Laboratory for Automated Reasoning and Analysis School of Computer and Communication Sciences École Polytechnique Fédérale
More informationType Theory meets Effects. Greg Morrisett
Type Theory meets Effects Greg Morrisett A Famous Phrase: Well typed programs won t go wrong. 1. Describe abstract machine: M ::= 2. Give transition relation: M 1 M 2
More informationVerifying Liveness Properties of ML Programs
Verifying Liveness Properties of ML Programs M M Lester R P Neatherway C-H L Ong S J Ramsay Department of Computer Science, University of Oxford ACM SIGPLAN Workshop on ML, 2011 09 18 Gokigeny all! Motivation
More informationRecursion and Induction: Haskell; Primitive Data Types; Writing Function Definitions
Recursion and Induction: Haskell; Primitive Data Types; Writing Function Definitions Greg Plaxton Theory in Programming Practice, Spring 2005 Department of Computer Science University of Texas at Austin
More informationPLDI 2016 Tutorial Automata-Based String Analysis
PLDI 2016 Tutorial Automata-Based String Analysis Tevfik Bultan, Abdulbaki Aydin, Lucas Bang Verification Laboratory http://vlab.cs.ucsb.edu Department of Computer Science Common Usages of Strings } Input
More informationDecision Procedures in the Theory of Bit-Vectors
Decision Procedures in the Theory of Bit-Vectors Sukanya Basu Guided by: Prof. Supratik Chakraborty Department of Computer Science and Engineering, Indian Institute of Technology, Bombay May 1, 2010 Sukanya
More informationWhat is a Computer Algorithm?
What is a Computer Algorithm? A computer algorithm is a detailed step-by-step method for solving a problem by using a computer. Problem-Solving (Science and Engineering) Analysis How does it work? Breaking
More informationLOGIC AND DISCRETE MATHEMATICS
LOGIC AND DISCRETE MATHEMATICS A Computer Science Perspective WINFRIED KARL GRASSMANN Department of Computer Science University of Saskatchewan JEAN-PAUL TREMBLAY Department of Computer Science University
More informationV Advanced Data Structures
V Advanced Data Structures B-Trees Fibonacci Heaps 18 B-Trees B-trees are similar to RBTs, but they are better at minimizing disk I/O operations Many database systems use B-trees, or variants of them,
More informationTowards a Software Model Checker for ML. Naoki Kobayashi Tohoku University
Towards a Software Model Checker for ML Naoki Kobayashi Tohoku University Joint work with: Ryosuke Sato and Hiroshi Unno (Tohoku University) in collaboration with Luke Ong (Oxford), Naoshi Tabuchi and
More informationLecture #13: Type Inference and Unification. Typing In the Language ML. Type Inference. Doing Type Inference
Lecture #13: Type Inference and Unification Typing In the Language ML Examples from the language ML: fun map f [] = [] map f (a :: y) = (f a) :: (map f y) fun reduce f init [] = init reduce f init (a ::
More informationAbsolute C++ Walter Savitch
Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents
More informationInductive Synthesis. Neil Immerman. joint work with Shachar Itzhaky, Sumit Gulwani, and Mooly Sagiv
www.cs.umass.edu joint work with Shachar Itzhaky, Sumit Gulwani, and Mooly Sagiv : Goal Write specification, ϕ, in high level logical language, e.g., SO. : Goal Write specification, ϕ, in high level logical
More informationAlgorithmic Semi-algebraic Geometry and its applications. Saugata Basu School of Mathematics & College of Computing Georgia Institute of Technology.
1 Algorithmic Semi-algebraic Geometry and its applications Saugata Basu School of Mathematics & College of Computing Georgia Institute of Technology. 2 Introduction: Three problems 1. Plan the motion of
More informationMetaprogramming assignment 3
Metaprogramming assignment 3 Optimising embedded languages Due at noon on Thursday 29th November 2018 This exercise uses the BER MetaOCaml compiler, which you can install via opam. The end of this document
More informationProgramming with Contracts. Juan Pablo Galeotti, Alessandra Gorla Saarland University, Germany
Programming with Contracts Juan Pablo Galeotti, Alessandra Gorla Saarland University, Germany Contract A (formal) agreement between Method M (callee) Callers of M Rights Responsabilities Rights Responsabilities
More informationProgramming Languages Lecture 15: Recursive Types & Subtyping
CSE 230: Winter 2008 Principles of Programming Languages Lecture 15: Recursive Types & Subtyping Ranjit Jhala UC San Diego News? Formalize first-order type systems Simple types (integers and booleans)
More informationCS446: Machine Learning Fall Problem Set 4. Handed Out: October 17, 2013 Due: October 31 th, w T x i w
CS446: Machine Learning Fall 2013 Problem Set 4 Handed Out: October 17, 2013 Due: October 31 th, 2013 Feel free to talk to other members of the class in doing the homework. I am more concerned that you
More informationCSE 20 DISCRETE MATH. Fall
CSE 20 DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/ Final exam The final exam is Saturday December 16 11:30am-2:30pm. Lecture A will take the exam in Lecture B will take the exam
More informationHoare Logic: Proving Programs Correct
Hoare Logic: Proving Programs Correct 17-654/17-765 Analysis of Software Artifacts Jonathan Aldrich Reading: C.A.R. Hoare, An Axiomatic Basis for Computer Programming Some presentation ideas from a lecture
More informationCounting multiplicity over infinite alphabets
Counting multiplicity over infinite alphabets Amal Dev Manuel and R. Ramanujam The Institute of Mathematical Sciences, Chennai, India {amal,jam}@imsc.res.in Summary Motivation for infinite data. We need
More informationFormalization of Incremental Simplex Algorithm by Stepwise Refinement
Formalization of Incremental Simplex Algorithm by Stepwise Refinement Mirko Spasić, Filip Marić Faculty of Mathematics, University of Belgrade FM2012, 30. August 2012. Overview 1 Introduction 2 Approach
More informationCSE 331 Midterm Exam 2/13/12
Name There are 10 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes, closed
More informationDiagonalization. The cardinality of a finite set is easy to grasp: {1,3,4} = 3. But what about infinite sets?
Diagonalization Cardinalities The cardinality of a finite set is easy to grasp: {1,3,4} = 3. But what about infinite sets? We say that a set S has at least as great cardinality as set T, written S T, if
More informationV Advanced Data Structures
V Advanced Data Structures B-Trees Fibonacci Heaps 18 B-Trees B-trees are similar to RBTs, but they are better at minimizing disk I/O operations Many database systems use B-trees, or variants of them,
More informationCMSC 330: Organization of Programming Languages. Operational Semantics
CMSC 330: Organization of Programming Languages Operational Semantics Notes about Project 4, Parts 1 & 2 Still due today (7/2) Will not be graded until 7/11 (along with Part 3) You are strongly encouraged
More informationAn Introduction to Programming and Proving in Agda (incomplete draft)
An Introduction to Programming and Proving in Agda (incomplete draft) Peter Dybjer January 29, 2018 1 A first Agda module Your first Agda-file is called BoolModule.agda. Its contents are module BoolModule
More informationF28PL1 Programming Languages. Lecture 11: Standard ML 1
F28PL1 Programming Languages Lecture 11: Standard ML 1 Imperative languages digital computers are concrete realisations of von Neumann machines stored program memory associations between addresses and
More informationTesting and Debugging
Testing and Debugging Comp-303 : Programming Techniques Lecture 14 Alexandre Denault Computer Science McGill University Winter 2004 March 1, 2004 Lecture 14 Comp 303 : Testing and Debugging Page 1 Announcements...
More informationExercise 1: Graph coloring (10 points)
Exercise 1: Graph coloring (10 points) Graph coloring is the problem of assigning colors to vertices in a non-directed graph, so that no two adjacent nodes have the same color. In other words, if two vertices
More informationThe Pointer Assertion Logic Engine
The Pointer Assertion Logic Engine [PLDI 01] Anders Mφller Michael I. Schwartzbach Presented by K. Vikram Cornell University Introduction Pointer manipulation is hard Find bugs, optimize code General Approach
More informationAppendix Set Notation and Concepts
Appendix Set Notation and Concepts In mathematics you don t understand things. You just get used to them. John von Neumann (1903 1957) This appendix is primarily a brief run-through of basic concepts from
More informationFunctional Programming
Functional Programming Final Exam Friday, December 18 2015 First Name: Last Name: Your points are precious, don t let them go to waste! Your Name Work that can t be attributed to you is lost: write your
More informationArithmetic and Bitwise Operations on Binary Data
Arithmetic and Bitwise Operations on Binary Data CSCI 2400: Computer Architecture ECE 3217: Computer Architecture and Organization Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides
More informationBoolean Representations and Combinatorial Equivalence
Chapter 2 Boolean Representations and Combinatorial Equivalence This chapter introduces different representations of Boolean functions. It then discusses the applications of these representations for proving
More information1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.
1. true / false By a compiler we mean a program that translates to code that will run natively on some machine. 2. true / false ML can be compiled. 3. true / false FORTRAN can reasonably be considered
More information! Addition! Multiplication! Bigger Example - RSA cryptography
! Addition! Multiplication! Bigger Example - RSA cryptography Modular Arithmetic Modular Exponentiation Primality Testing (Fermat s little theorem) Probabilistic algorithm Euclid s Algorithm for gcd (greatest
More informationLectures 20, 21: Axiomatic Semantics
Lectures 20, 21: Axiomatic Semantics Polyvios Pratikakis Computer Science Department, University of Crete Type Systems and Static Analysis Based on slides by George Necula Pratikakis (CSD) Axiomatic Semantics
More informationCSE wi Midterm Exam 2/8/18. Name UW ID #
Name UW ID # There are 11 questions worth a total of 120 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes,
More informationBounded Model Checking Of C Programs: CBMC Tool Overview
Workshop on Formal Verification and Analysis Tools, CFDVS, IIT-Bombay - Feb 21,2017 Bounded Model Checking Of C Programs: CBMC Tool Overview Prateek Saxena CBMC Developed and Maintained by Dr Daniel Kröning
More information\n is used in a string to indicate the newline character. An expression produces data. The simplest expression
Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of
More information1KOd17RMoURxjn2 CSE 20 DISCRETE MATH Fall
CSE 20 https://goo.gl/forms/1o 1KOd17RMoURxjn2 DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/ Today's learning goals Explain the steps in a proof by mathematical and/or structural
More informationSoftwaretechnik. Program verification. Albert-Ludwigs-Universität Freiburg. June 28, Softwaretechnik June 28, / 24
Softwaretechnik Program verification Albert-Ludwigs-Universität Freiburg June 28, 2012 Softwaretechnik June 28, 2012 1 / 24 Road Map Program verification Automatic program verification Programs with loops
More informationCS 320: Concepts of Programming Languages
CS 320: Concepts of Programming Languages Wayne Snyder Computer Science Department Boston University Lecture 04: Basic Haskell Continued o Polymorphic Types o Type Inference with Polymorphism o Standard
More informationIntegrating verification in programming languages
Integrating verification in programming languages Thomas Jensen, INRIA Seminar INRIA Rennes, 04/11/2015 Collège de France Chaire Algorithmes, machines et langages x / y Types For division to make sense,
More informationMore Lambda Calculus and Intro to Type Systems
More Lambda Calculus and Intro to Type Systems Plan Heavy Class Participation Thus, wake up! Lambda Calculus How is it related to real life? Encodings Fixed points Type Systems Overview Static, Dyamic
More informationTerm Algebras with Length Function and Bounded Quantifier Elimination
with Length Function and Bounded Ting Zhang, Henny B Sipma, Zohar Manna Stanford University tingz,sipma,zm@csstanfordedu STeP Group, September 3, 2004 TPHOLs 2004 - p 1/37 Motivation: Program Verification
More information