HOW TO BE MORE PRODUCTIVE Graham Hutton and Mauro Jaskelioff.

Slides:



Advertisements
Similar presentations
Introduction The concept of transform appears often in the literature of image processing and data compression. Indeed a suitable discrete representation.
Advertisements

Lecture 7 Surreal Numbers. Lecture 7 Surreal Numbers.
CALCULATING AN EXCEPTIONAL MACHINE Graham Hutton and Joel Wright University of Nottingham.
THE WORKER / WRAPPER TRANSFORMATION Graham Hutton and Andy Gill.
Lecture 6 Hyperreal Numbers (Nonstandard Analysis)
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
0 PROGRAMMING IN HASKELL Chapter 5 - List Comprehensions.
Programming Language Semantics Denotational Semantics Chapter 5 Based on a lecture by Martin Abadi.
Lecture 8 Recursively enumerable (r.e.) languages
Discrete Structures Chapter 2 Part A Sequences Nurul Amelina Nasharuddin Multimedia Department.
Discrete Mathematics Lecture 4 Harper Langston New York University.
Cse536 Functional Programming Lecture #14, Nov. 10, 2004 Programming with Streams –Infinite lists v.s. Streams –Normal order evaluation –Recursive streams.
CHAPTER 4 Decidability Contents Decidable Languages
Sparkle A theorem prover for the functional language Clean Maarten de Mol University of Nijmegen February 2002.
Concurrency. Correctness Principle A transaction is atomic -- all or none property. If it executes partly, an invalid state is likely to result. A transaction,
Chapter 14 Programming With Streams. Streams  A stream is an infinite sequence of values.  We could define a special data type for them: data Stream.
EXPRESS'011 Turing Machines, Transition Systems, and Interaction Dina Goldin, U.Connecticut Scott Smolka, SUNY at Stony Brook Peter Wegner, Brown University.
1 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY For next time: Read 2.1 & 2.2.
Programming Language Semantics Denotational Semantics Chapter 5 Part III Based on a lecture by Martin Abadi.
Function: Definition A function is a correspondence from a first set, called the domain, to a second set, called the range, such that each element in the.
 Limit Cycle Isolated closed trajectories Analysis is, in general, quite difficult. For nonlinear systems, two simple results exist. Limit Cycle
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
1 Iterative Program Analysis Abstract Interpretation Mooly Sagiv Tel Aviv University Textbook:
Information and Coding Theory Linear Block Codes. Basic definitions and some examples. Juris Viksna, 2015.
4 4.4 © 2012 Pearson Education, Inc. Vector Spaces COORDINATE SYSTEMS.
Lecture 4 Sequences CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Sequences Definition - A function whose domain is the set of all positive integers. Finite Sequence - finite number of values or elements Infinite Sequence.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Cyclic Groups (9/25) Definition. A group G is called cyclic if there exists an element a in G such that G =  a . That is, every element of G can be written.
Number Theory Project The Interpretation of the definition Andre (JianYou) Wang Joint with JingYi Xue.
Sound Haskell Dana N. Xu University of Cambridge Joint work with Simon Peyton Jones Microsoft Research Cambridge Koen Claessen Chalmers University of Technology.
Functions Is Fibonacci Repeated or Recursive? Created by: Rachel Oakley.
Notes on local determinism Days 12, 13 and 14 of Comp Sci 480.
FUNCTIONS Relation – a set of ( x, y ) points Function – a set of ( x, y ) points where there is only one output for each specific input – x can not be.
1 Finite Model Theory Lecture 3 Ehrenfeucht-Fraisse Games.
Math 3121 Abstract Algebra I Lecture 5 Finish Sections 6 + Review: Cyclic Groups, Review.
Math 344 Winter 07 Group Theory Part 2: Subgroups and Isomorphism
WORK IT, WRAP IT, FIX IT, FOLD IT Graham Hutton and Neil Sculthorpe.
Advanced Formal Methods Lecture 4: Isabelle – Types and Terms Mads Dam KTH/CSC Course 2D1453, Some material from Paulson.
Advanced Functional Programming Tim Sheard 1 Lecture 15 Advanced Functional Programming Tim Sheard Algebraic and CoAlgebraic Programs F Algebras Initial.
1 Static Contract Checking for Haskell Dana N. Xu University of Cambridge Joint work with Simon Peyton Jones Microsoft Research Cambridge Koen Claessen.
Algorithms for hard problems WQO theory and applications to parameterized complexity Juris Viksna, 2015.
1 Iterative Program Analysis Abstract Interpretation Mooly Sagiv Tel Aviv University Textbook:
UNIT 4 : State Minimization: Completely Specified Machines
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
Recursion Higher Order Functions CSCE 314 Spring 2016.
Functional Programming Lecture 3 - Lists Muffy Calder.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
1 Equality of Streams is a Problem Grigore Rosu University of Illinois at Urbana-Champaign.
CS321 Functional Programming 2 © JAS Programming with Streams A stream is never finite and could be defined as special polymorphic type data stream.
Turing Machines Sections 17.6 – The Universal Turing Machine Problem: All our machines so far are hardwired. ENIAC
1 Proving Properties of Recursive List Functions CS 270 Math Foundations of CS Jeremy Johnson.
Languages and Strings Chapter 2. (1) Lexical analysis: Scan the program and break it up into variable names, numbers, etc. (2) Parsing: Create a tree.
Set Comprehensions In mathematics, the comprehension notation can be used to construct new sets from old sets. {x2 | x  {1...5}} The set {1,4,9,16,25}
Set Comprehensions In mathematics, the comprehension notation can be used to construct new sets from old sets. {x2 | x  {1...5}} The set {1,4,9,16,25}
Function Hubert Chan (Chapter 2.1, 2.2) [O1 Abstract Concepts]
The Acceptance Problem for TMs
Function Hubert Chan (Chapter 2.1, 2.2) [O1 Abstract Concepts]
Turing Machines Acceptors; Enumerators
Proving Properties of Recursive List Functions
PROGRAMMING IN HASKELL
Copyright © Cengage Learning. All rights reserved.
CS 154, Lecture 4: Limitations on DFAs (I),
Functional Programming
PROGRAMMING IN HASKELL
Great Theoretical Ideas in Computer Science
Verifying a compiler for a simple language with exceptions (MPC 04).
Well-behaved Dataflow Graphs
Copyright © Cengage Learning. All rights reserved.
Calculus In Infinite dimensional spaces
Presentation transcript:

HOW TO BE MORE PRODUCTIVE Graham Hutton and Mauro Jaskelioff

1 A stream is an infinite sequence of values: The type of streams is co-inductively defined: Streams codata Stream A = A  Stream A 0  1  2  3  4...

2 Streams can be defined by recursive equations: Defining Streams ones :: Stream Nat ones = 1  ones nats :: Stream Nat nats = 0  map (+1) nats

3 This Talk zHow do we ensure such equations make sense, i.e. that they produce well-defined streams? zA new approach, based upon a representation theorem for contractive functions. loop :: Stream A loop = tail loop

4 Fixed Points ones = 1  ones ones = fix body body xs = 1  xs can be rewritten as: fix f = f (fix f) The starting point for our approach is the use of explicit fixed points. For example:

5 The Problem Given a function on streams when does makes sense, i.e. produce a well-defined stream? f :: Stream A  Stream A fix f :: Stream A

6 Adapting an idea from topology, let us say that a function f on streams is contractive iff: Equal for one further element. Equal for the first n elements. xs = n ysf xs = n+1 f ys Contractive Functions

7 Banach’s Theorem Every contractive function has a unique fixed point f :: Stream A  c Stream A fix f :: Stream A and hence produces a well-defined stream.

8 This theorem provides a semantic means of ensuring that stream definitions are valid.

9 Example The function (1  ) is contractive: Hence, it has a unique fixed point, and is a valid definition for a stream. xs = n ys 1  xs = n+1 1  ys ones = fix (1  )

10 Example The function tail is not contractive: Hence, Banach’s theorem does not apply, and is rejected as an invalid definition. xs = n ys tail xs = n+1 tail ys loop = fix tail

11 Questions zDoes the converse also hold - every function with a unique fixed point is contractive? zWhat does contractive actually mean? zWhat kind of functions are contractive?

12 Key Idea If we view a stream as a time-varying value then a function on streams is contractive iff x 0  x 1  x 2  x 3  x 4... Its output value at any time only depends on input values at strictly earlier times.

13 This result simplifies the process of deciding if a function is contractive.

14 Examples (1  ) tail Each output depends on the input one step earlier in time. Each output depends on the input one step later in time.

15 Generating Functions This idea is formalised using generating functions, which map finite lists to single values: [A]  B All earlier input values. The next output value.

Representation Theorem 16 Every contractive function can be represented by a generating function, and vice versa: Stream A  c Stream B[A]  B ge n rep Moreover, rep and gen form an isomorphism.

17 This theorem provides a practical means of producing streams that are well-defined.

Example 18 g :: [Nat]  Nat g [] = 1 g (x:xs) = x ones :: Stream Nat ones = fix (gen g) Generator for ones. Guaranteed to be well-defined.

Example 19 g :: [Nat]  Nat g [] = 0 g (x:xs) = x+1 nats :: Stream Nat nats = fix (gen g) Generator for nats. Guaranteed to be well-defined.

Example 20 g :: [Nat]  Nat g [] = 0 g [x] = 1 g (x:y:xs) = x+y fibs :: Stream Nat fibs = fix (gen g) Generator for fibs. Guaranteed to be well-defined.

21 Summary zGenerating functions are a sound and complete representation of contractive functions; zGives a precise characterisation of the class of functions that are contractive; zProvides a simple but rather general means of producing well-defined streams.

22 Ongoing and Further Work zGeneralisation to final co-algebras; zOther kinds of generating functions; zRelationship to other techniques; zImproving efficiency.