Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Least fix point, greatest fix point

How come the least fix point coincides with the greatest fix point in a lazy non-total language like Haskell. What does continuity on complete partial orders have to do with that?

like image 380
Marius Catalin Avatar asked Aug 04 '18 07:08

Marius Catalin


People also ask

What is the lowest fixed point?

Lower fixed point of a lab thermometer is the melting point of pure ice. In Celcius scale, melting point is about 0∘C. Fahrenheit equivalent of 0∘C is 32∘F.

What is least point?

In order theory, a branch of mathematics, the least fixed point (lfp or LFP, sometimes also smallest fixed point) of a function from a partially ordered set to itself is the fixed point which is less than each other fixed point, according to the order of the poset.

What is an attractive fixed point?

A fixed point z0 is said to be an attracting fixed point for f if there is a neighborhood. D of z0 such that if z ∈ D, then f(z) ∈ D for all n > 0, and in fact. f(z) → z0 as n → ∞.

What is fixed point of a function?

A fixed point (sometimes shortened to fixpoint, also known as an invariant point) is a value that does not change under a given transformation. Specifically, in mathematics, a fixed point of a function is an element that is mapped to itself by the function.


1 Answers

In a CPO (which we interpret a type as), any increasing chain has a least upper bound.

Here's an example that should convey the intuition why, in the domain of CPOs, least fixed points and greatest fixed points coincide. Consider the following functor, abusing the list notation for conciseness:

data ListF a x = [] | a : x

Its greatest fixed point is the type of Haskell lists (possibly infinite, possibly partial). What about its least fixed point? The following elements must be in it (Fix constructors are omitted):

0 : _|_
0 : 1 : _|_
0 : 1 : 2 : _|_
...

And they form an increasing chain, so there must be a least upper bound, which has to be the infinite list of natural integers 0 : 1 : 2 : .... So the least fixed point of ListF contains infinite lists, and consequently coincides with the greatest fixed point.


As was pointed out in the comments, the claim that the greatest fixed point is given by the type [] may need clarification. For instance, wouldn't some CPO "BigList" of lists indexed by large ordinals make an even greater fixed point?

One can first show that [] satisfies the definition of a final ListF-coalgebra. Then, a property of final coalgebras is that they are unique up to isomorphism. Therefore, lists indexed by larger ordinals would result in a non-isomorphic CPO, so that cannot be a final coalgebra.

I could stop there, but hold on, isn't BigList still a greater fixed point of ListF? My conclusion is to chalk the issue up to bad terminology and formally we should only discuss "final coalgebras", and not "greatest fixed points".

Depending on how you define a "fixed point" of a functor in CPO and a notion of (pre)order between CPOs, you may find that BigList is a fixed point of ListF, that it is greater than [], that you run into set-theoretic paradoxes when reaching towards the "greatest fixed point", and that ultimately there is nothing of value to Haskell practitioners in that way of formalizing a "greatest fixed point" because you actually wanted the nice properties of a final coalgebra.

(I'd be interested to know of a direct way to define "fixed point" that excludes BigList as one.)

So instead, the term "greatest fixed point" might as well be a synonym for "final coalgebra". Some intuition carries over ("fixed points" can commonly be approached by iteration), some doesn't (it's not "greatest" in a set-theoretic sense).

like image 99
Li-yao Xia Avatar answered Sep 27 '22 20:09

Li-yao Xia