Download presentation
Presentation is loading. Please wait.
1
School of Computing and Mathematics, University of Huddersfield CHA2545 Last Lecture LECTURE: LAMBDA CALCULUS SEMANTICS TUTORIAL: Revision
2
School of Computing and Mathematics, University of Huddersfield LAMBDA CALCULUS it is a notation for describing the behaviour of ALL COMPUTABLE FUNCTIONS. LAMBDA CALCULUS functions are the denotations in our semantic definition. We will study briefly its semantics.
3
School of Computing and Mathematics, University of Huddersfield The Problem with recursive definitions - Russell’s Paradox for sets: We can define SETS of things which are sets e.g. X = { {1,2}, {2,4} } is a set of sets. We can define sets implicitly via properties e.gX ={x : x is a set containing 3 elements} We can define sets of things that contain themselves: e.g. X = {x : x is a set of sets} X contains itself…! Define Z = { x : x does not contain itself} does Z contain itself!!
4
School of Computing and Mathematics, University of Huddersfield Russell’s Paradox is related to recursive Lambda calculus functions : At the heart of the paradox is self-reference - recursive functions are self-referential - basic lambda calculus was shown to be inconsistent by a similar argument, which led to “typed” Lambda calculus ie without “type theory” to limit expression we can introduce paradoxes into recursive definitions.
5
School of Computing and Mathematics, University of Huddersfield Fixed point Semantics A recursive function can be recast as the solution to fixed point equation H f = f One way of finding fixed points is to use a “Fixed Point Combinator”. This is a function which computes fixed points of other functions. Most commonly used is Y = lf ( lx f (x x) ) ( lx f (x x) ) Then for all F, F (YF) = YF. PROOF: YF = lf ( lx f (x x) ) ( lx f (x x) ) F = (lx F (x x) ) ( lx F (x x) ) = F ( (lx F (x x))(lx F (x x)) ) = F ( lg (lx g (x x))(lx g (x x))F ) = F (YF)
6
School of Computing and Mathematics, University of Huddersfield LAMBDA CALCULUS - Fixed Point Semantics But consider the following function: f = x. y.( x=y => y+1, f x (f (x-1) (y-1)) ) In this case H has many fixed points !! E.g. u. v. u+1 u. v. (u=v => u+1, ) are fixed points of H.
7
School of Computing and Mathematics, University of Huddersfield Fixed point Semantics via Approximations An approximation f’ of a function f is defined as If f’ s is defined then f’ s = f s Eg f’ 0 = 0, f’ 1 = 1, f’ n = undefined for n>1 Is an approximation of f n = n*n
8
School of Computing and Mathematics, University of Huddersfield Fixed point theorem A static solution of the fixed point equation can be given by approximations: f = H n ( , as n tends to infinity H H H H H H are improving approximations of f Example: For the factorial function: H = g. n.(n=0 => 1, n*g(n-1)) H n.(n=0 => 1, Graph(H = (0,1), (1, ), (2, ), (3, ), (4, )… H H g. n.(n=0 => 1, n*g(n-1)) ( n.(n=0 => 1, Graph(H H (0,1), (1, 1), (2, ), (3, ), (4, )…
9
School of Computing and Mathematics, University of Huddersfield LAMBDA CALCULUS - Fixed Point Semantics Assume H (f ) = f. Then H n ( as n tends to infinity, gives us the “LEAST DEFINED” fixed point f of H, which is defined as the “non-recursive” meaning of function f
10
School of Computing and Mathematics, University of Huddersfield CALCULUS: operational semantics An operational semantics gives us an abstract but precise way to execute functions (programs). A expression is in NORMAL FORM if it is a abstraction - i.e. It cannot be reduced. Operational Semantics: Repeatedly apply the conversion rules to an “application” until it is in normal form.
11
School of Computing and Mathematics, University of Huddersfield CALCULUS: order of application Two main ones: Left-most innermost (call by value)..basically reduce arguments of a function before reducing the function Left-most outermost (call by name) (also called normal order reduction)..basically reduce the outer-most function without reducing its arguments
12
School of Computing and Mathematics, University of Huddersfield CALCULUS: operational semantics Problem: the ORDER of application sometimes makes a difference! E.g. Try ( x. y.y) ( ( v.vv)( z.zz) )
13
School of Computing and Mathematics, University of Huddersfield CALCULUS: Church-Rosser Theorem (Paraphrase) If a Calculus Application can be reduced to a normal form then -- that normal form is UNIQUE up to naming -- the normal form can be reached using normal- order reduction Corollary: We now have a nice operational semantics for calculus and hence pure functional programming
14
School of Computing and Mathematics, University of Huddersfield LAMBDA CALCULUS - Fixed Point Semantics = Operational Semantics BIG THEOREM: The least defined fixed point of f IS OPERATIONALLY THE SAME AS f NB All above is paraphrased in that I have extracted all the maths/domain theory out to give you the gist.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.