Lawful fixed point operators #
This module defines the laws required of a Fix
instance, using the theory of
omega complete partial orders (ωCPO). Proofs of the lawfulness of all Fix
instances in
Control.Fix
are provided.
Main definition #
- class
LawfulFix
Intuitively, a fixed point operator fix
is lawful if it satisfies fix f = f (fix f)
for all
f
, but this is inconsistent / uninteresting in most cases due to the existence of "exotic"
functions f
, such as the function that is defined iff its argument is not, familiar from the
halting problem. Instead, this requirement is limited to only functions that are Continuous
in the
sense of ω
-complete partial orders, which excludes the example because it is not monotone
(making the input argument less defined can make f
more defined).
- fix : (α → α) → α
- fix_eq {f : α → α} : OmegaCompletePartialOrder.ωScottContinuous f → Fix.fix f = f (Fix.fix f)
Instances
The series of approximations of fix f
(see approx
) as a Chain
Equations
- Part.Fix.approxChain f = { toFun := Part.Fix.approx ⇑f, monotone' := ⋯ }
Instances For
Equations
- Part.lawfulFix = LawfulFix.mk ⋯
Equations
- Pi.lawfulFix = LawfulFix.mk ⋯
Sigma.curry
as a monotone function.
Equations
- Pi.monotoneCurry α β γ = { toFun := Sigma.curry, monotone' := ⋯ }
Instances For
Sigma.uncurry
as a monotone function.
Equations
- Pi.monotoneUncurry α β γ = { toFun := Sigma.uncurry, monotone' := ⋯ }
Instances For
Equations
- Pi.hasFix = { fix := fun (f : ((x : α) → (y : β x) → γ x y) → (x : α) → (y : β x) → γ x y) => Sigma.curry (Fix.fix (Sigma.uncurry ∘ f ∘ Sigma.curry)) }
Equations
- Pi.lawfulFix' = LawfulFix.mk ⋯