Theoretical Program Checking Greg Bronevetsky. Background The field of Program Checking is about 13 years old. Pioneered by Manuel Blum, Hal Wasserman,

Slides:



Advertisements
Similar presentations
Sublinear Algorithms … Lecture 23: April 20.
Advertisements

Python Crash Course Accuracy 3 rd year Bachelors V1.0 dd Hour 7.
Sub Exponential Randomize Algorithm for Linear Programming Paper by: Bernd Gärtner and Emo Welzl Presentation by : Oz Lavee.
Counting the bits Analysis of Algorithms Will it run on a larger problem? When will it fail?
A simple example finding the maximum of a set S of n numbers.
Theory of Computing Lecture 3 MAS 714 Hartmut Klauck.
Certification of Computational Results Greg Bronevetsky.
David Brumley, Pongsin Poosankam, Dawn Song and Jiang Zheng Presented by Nimrod Partush.
מבוא מורחב 1 Lecture 4 Material in the textbook on Pages 44-46, of 2nd Edition Sections and Hanoy towers.
DIVIDE AND CONQUER APPROACH. General Method Works on the approach of dividing a given problem into smaller sub problems (ideally of same size).  Divide.
Divide and Conquer. Recall Complexity Analysis – Comparison of algorithm – Big O Simplification From source code – Recursive.
Nattee Niparnan. Recall  Complexity Analysis  Comparison of Two Algos  Big O  Simplification  From source code  Recursive.
Reliability of Disk Systems. Reliability So far, we looked at ways to improve the performance of disk systems. Next, we will look at ways to improve the.
Performance/Reliability of Disk Systems So far, we looked at ways to improve the performance of disk systems. Next, we will look at ways to improve the.
Introduction to Analysis of Algorithms
CEG 221 Lesson 5: Algorithm Development II Mr. David Lippa.
Algorithm Design Techniques: Induction Chapter 5 (Except Section 5.6)
Tirgul 8 Universal Hashing Remarks on Programming Exercise 1 Solution to question 2 in theoretical homework 2.
Tirgul 7. Find an efficient implementation of a dynamic collection of elements with unique keys Supported Operations: Insert, Search and Delete. The keys.
ED 4 I: Error Detection by Diverse Data and Duplicated Instructions Greg Bronevetsky.
7-2 Estimating a Population Proportion
Mathematics of Cryptography Part I: Modular Arithmetic, Congruence,
1 Verification Codes Michael Luby, Digital Fountain, Inc. Michael Mitzenmacher Harvard University and Digital Fountain, Inc.
HumanAUT Secure Human Identification Protocols Adam Bender Avrim Blum Manuel Blum Nick Hopper The ALADDIN Center Carnegie Mellon University.
Normalised Least Mean-Square Adaptive Filtering
Quadratic Residuosity and Two Distinct Prime Factor ZK Protocols By Stephen Hall.
1.1 Chapter 1: Introduction What is the course all about? Problems, instances and algorithms Running time v.s. computational complexity General description.
1 1.1 © 2012 Pearson Education, Inc. Linear Equations in Linear Algebra SYSTEMS OF LINEAR EQUATIONS.
Mathematics of Cryptography Part I: Modular Arithmetic, Congruence,
Chapter 5 Algorithm Analysis 1CSCI 3333 Data Structures.
Ch 8.1 Numerical Methods: The Euler or Tangent Line Method
© Copyright McGraw-Hill CHAPTER 6 The Normal Distribution.
Exercise problems for students taking the Programming Parallel Computers course. Janusz Kowalik Piotr Arlukowicz Tadeusz Puzniakowski Informatics Institute.
Numerical Computations in Linear Algebra. Mathematically posed problems that are to be solved, or whose solution is to be confirmed on a digital computer.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
SEARCHING, SORTING, AND ASYMPTOTIC COMPLEXITY Lecture 12 CS2110 – Fall 2009.
Approximation Algorithms Pages ADVANCED TOPICS IN COMPLEXITY THEORY.
INTEGRALS Areas and Distances INTEGRALS In this section, we will learn that: We get the same special type of limit in trying to find the area under.
Basic Concepts in Number Theory Background for Random Number Generation 1.For any pair of integers n and m, m  0, there exists a unique pair of integers.
The Examination of Residuals. Examination of Residuals The fitting of models to data is done using an iterative approach. The first step is to fit a simple.
The Selection Problem. 2 Median and Order Statistics In this section, we will study algorithms for finding the i th smallest element in a set of n elements.
Analysis of Algorithms CSCI Previous Evaluations of Programs Correctness – does the algorithm do what it is supposed to do? Generality – does it.
CSC 211 Data Structures Lecture 13
CS717 Algorithm-Based Fault Tolerance Matrix Multiplication Greg Bronevetsky.
Umans Complexity Theory Lectures Lecture 1a: Problems and Languages.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
SEM Basics 2 Byrne Chapter 2 Kline pg 7-15, 50-51, ,
College Algebra Sixth Edition James Stewart Lothar Redlin Saleem Watson.
1 Lecture 3 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
מבוא מורחב 1 Lecture 4 Material in the textbook on Pages 44-46, of 2nd Edition Sections and Hanoy towers.
Topics 1 Specific topics to be covered are: Discrete-time signals Z-transforms Sampling and reconstruction Aliasing and anti-aliasing filters Sampled-data.
Big O David Kauchak cs302 Spring Administrative Assignment 1: how’d it go? Assignment 2: out soon… Lab code.
MA/CSSE 473 Day 10 Primality Testing. MA/CSSE 473 Day 10 In-class exam: Friday, Sept 28 –You may bring a two-sided 8.5x11 inch piece of paper containing.
MA/CSSE 473 Day 09 Modular Division Revisited Fermat's Little Theorem Primality Testing.
Approximation Algorithms based on linear programming.
0 Simulation Modeling and Analysis: Input Analysis 7 Random Numbers Ref: Law & Kelton, Chapter 7.
Reliability of Disk Systems. Reliability So far, we looked at ways to improve the performance of disk systems. Next, we will look at ways to improve the.
PROBABILITY AND COMPUTING RANDOMIZED ALGORITHMS AND PROBABILISTIC ANALYSIS CHAPTER 1 IWAMA and ITO Lab. M1 Sakaidani Hikaru 1.
Designing Programs that Check Their Work
Verification and Testing
Number Theory (Chapter 7)
Objective of This Course
Unit-2 Divide and Conquer
RS – Reed Solomon List Decoding.
Searching, Sorting, and Asymptotic Complexity
CS21 Decidability and Tractability
Finding Equations of Exponential Function
Cryptography Lecture 16.
Generating Random Variates
Presentation transcript:

Theoretical Program Checking Greg Bronevetsky

Background The field of Program Checking is about 13 years old. Pioneered by Manuel Blum, Hal Wasserman, Sampath Kanaan and others. Branch of Theoretical Computer Science that deals with probabilistic verification of whether a particular implementation solves a given problem. probabilistic fixing of program errors (if possible).

Simple Checker A simple checker C for problem f: Accepts a pair where x is the input and y is the output produced by a given program. If y=f(x) then return ACCEPT with probability ≥P C Else, return REJECT with probability ≥P C, Where P C is a constant close to 1. If the original program runs in time O(T(n)), the checker must run in asymptotically less time o(T(n)).

Simple Checker Example For example, a simple checker for sorting Verifies that the sorted list of elements is a permutation of the original one. Ensures that the sorted elements appear in a non- decreasing order. Checking is certain, so P C =1. Runtime of checker = O(n) vs. O(n log n) for the original program.

Complex Checker A complex checker is just like a simple checker, except that It is given P, a program that computes the problem f with low probability of error =p. Time Bound: If the original program runs in time O(T(n)), the complex checker must run in time o(T(n)), counting calls to P as one step.

Self-Corrector A self-corrector for problem f: Accepts x, an input to f, along with the program P that computes f with a low probability of error =p. Outputs the correct value of f(x) with probability ≥P C, where P C is a constant close to 1. If the original program runs in time O(T(n)), the self- corrector must also run in O(T(n))-time, counting calls to P as one step. (ie. Must remain in the same time class as original program.)

Uses for Checkers Checkers and Self-Correctors are intended to protect systems against software bugs and failures. Because of their speed, simple checkers can be run on each input, raising alarms about bad computations. When alarms are raised a self-corrector can try to fix the output. Because checkers and self-correctors are written differently from the original program, errors should not be correlated. (ex: SCCM)

Sample Checkers: Equations A simple checker for programs that compute equations: A program that claims to solve a given equation can be checked by taking the solutions and plugging them back into the equation. In fact we can do this any time the program purports to produce objects that satisfy given constraints: just verify the constraints.

Simple Checkers: Integrals Given a program to compute definite integral, we can check it by approximating the area under the curve by using a small number of rectangles. Given a formula and a program to compute its integral, we can verify the results by differentiating the output (usually easier than integration). Also, can pick a random range, and compute the area under the curve using the purported integral vs. using original formula with a lot of rectangles.

Simple Checking Multiplication Simple Checker for Multiplication of integers and the mantissas of floating point numbers. Assumption: addition is fast and reliable. Checking that AB=C. Procedure: Generate a random r Compute A (mod r) and B (mod r) Compute [A (mod r) B (mod r)] (mod r) Compare result to C (mod r). Note: [A (mod r) B (mod r)] (mod r) = AB (mod r) = C(mod r)

Simple Checking Multiplication A (mod r) and B (mod r) are O(log n)-bits long. Multiplying them takes O((log n) 2 )-time. To get the modulus, need 4 divisions by a small r. Such divisions take O(n log n)-time. Total checker time = O(n log n). Most processors compute multiplication in O(n 2 ) time (n-length numbers).

Multiplication Self-Corrector Self-Corrector for Multiplication Procedure: Generate random R 1 and R 2. Compute Note: Above equals Self-Corrector works by sampling the space of 4 points around A and B and working with them in the case where AB doesn't work.

How does it work? Addition, Subtraction and divisions by 2 and 4 assumed to be fast and reliable. We're dealing with 4 numbers: In order to operate on them we need to use n+1 bit operations. All 4 numbers vary over half the n+1 bit range. Because in each multiplication both numbers are independent, their pair varies over a quarter of the range of pairs of n+1 bit numbers.

The odds of a multiplication failing are =p. But all the erroneous inputs may occur in our quarter of the range. Thus, the odds of failure become ≤4p. Thus, the odds that none of the 4 multiplications fail ≤16p. How does it work?

Other Self-Correctors Note that a similar self-corrector can be used for matrix multiplication: Want to compute AB Generate random matrices R 1 and R 2 Compute: By spreading the multiplications over 4 random matrices, we avoid the problematic input A, B. If the odds of a matrix multiplication failing =p, then the self-corrector's odds of failure are =4p. It has been shown that self-correctors can be developed for “Robust functional equations”.

Simple Checker for Division Trying to perform division: N/Q Note: N = DQ + R R = Remainder D = some integer Equivalently: N – R = DQ Checking Division reduces to Checking Multiplication!

Self-Corrector for Division Calculate, where R is random. The three multiplications can be checked and corrected (if necessary) using aforementioned method. The one division can also be checked as above. Note that the one division is unlikely to be faulty: As R varies over its n-bit range, RD varies such that a given R maps to ≤ 2 different values of RD. If division's odds of failure =p, then the odds of failure for ≤ 2p, which is about as low as p.

Checking Linear Transformations Given a Linear Transformation A, want to compute Given input, want to output. We wish to check computations on floating point numbers, so we'll need to tolerate rounding error. Let be the error vector. is definitely correct iff is definitely incorrect iff

Checking Scheme Generate 10 random vectors where each ± is chosen positive or negative with 50/50 odds. Goal: Determine whether or not For k= 1 to 10 Calculate If, REJECT If all 10 tests are passed, ACCEPT.

Why does this work? Where each ± is positive or negative with independent 50/50 probability

Why does this work? Working out the probabilities, we can prove:

Why does this work? We can also prove the other side:

Conclusion A number of simple/complex checkers and self- testers have been developed for many problems. Those presented here are some of the simplest. Work has been done on finding general types of problems for which efficient testers and self- correctors can be created. It is not advanced enough to allow automation. There is some promise in finding techniques to test simple operations that we can use to build up more complex techniques.