GaeBlogX Arista Networks, Software-Defined Networking

Recursive Programs


Partial Functions

System $T$, $F$ are total languages.

PCF (Programming Language for Computable Functions) (By Gordon Plotkin) - E. col. of partial languages.

Idea: Extending the theory of computability to HIGHER TYPE. Standard computability courses only talk about computation over $\mathbb{N}$, but nothing beyond that.

e.g. $gcd$ is defined by the following (recursive) equations:

We can transcribe the above in a real programming language (ML, Haskell) in an evident way.

We call it “Recursive function” in a typical course - it is using recursion.

Then the next typical topic would be about “stack”.

Recursion has nothing to do with the stack. (One obvious example is flip-flop with two $NOR$ gates.)

Better idea (correct idea): simultaneous equations in the variable gcd. Solve for gcd!

We want: where $G$ is the function of definition my $gcd$. We are looking for a FIXED POINT.

The equations only make sense (solution exists) with computable partial functions.

Recursive Programs in Plotkin PCF

($\rightharpoonup$ means partial functions)

is called general recursion.

Examples of equations:

Both equations have solutions (only in the context of partial function, 2nd won’t work for total setting becuase it’s like $x=x+1$): totally undefined function!

is the solution to $x=e_x$

($\perp$ is called bottom (the least element in a certain pre-order)) (This is undefined, which mean it has no value)

Then we can define (Note: There is not occurrence of $gcd$ on the right hand side! It is solving a fixed point equation!)

Why do we have partial functions

  1. Challenge: Try to define $gcd$ in $Godel’s T$ (using products, sums, subtractions, equality/ inequality). This is hard! Because you must bake the termination proof into the code (not your head).
  2. Blum Size Theorm: Fix an expansion factor, say $2^{2^n}$, there is a function whose shortest program in $T$ (or any total language) is $2^{2^n}$ longer than it’s code in $PCF$.

Statics

(Note: All $\tau$’’s are the same! The crucial thing: you assume what you are trying prove!) In other words, you assume what you are trying to prove, and you are showing that assumption is tenable (show that nothing contradicts that fact), then it just is the case! I don’t show anything absolutely outright. I just assume what I am trying to prove and consider that sufficient to be true because I don’t care if thing diverges like in partial maps.

Dynamics

(It’s just “$F\mapsto[F/x]e$”) It’s called “unrolling recursion”.

There is no stack in the dynamics! :)

Equivalence

Main theorm

Fixed point induction

For admissible relations only:

To show:

It’s suffice to show:

( means the n-fold unrolling of the fix)


Similar Posts

Comments

Search