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 : α →o α}, OmegaCompletePartialOrder.Continuous 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' := (_ : ∀ ⦃i j : ℕ⦄, i ≤ j → Part.Fix.approx (⇑f) i ≤ Part.Fix.approx (⇑f) j) }
Instances For
toUnit
as a monotone function
Equations
Instances For
Equations
- Part.lawfulFix = LawfulFix.mk (_ : ∀ {f : Part α →o Part α}, OmegaCompletePartialOrder.Continuous f → Part.fix ⇑(Part.toUnitMono f) () = f (Fix.fix ⇑f))
Equations
- Pi.lawfulFix = LawfulFix.mk (_ : ∀ {_f : (α → Part β) →o α → Part β}, OmegaCompletePartialOrder.Continuous _f → Part.fix ⇑_f = _f (Part.fix ⇑_f))
Sigma.curry
as a monotone function.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Sigma.uncurry
as a monotone function.
Equations
- Pi.monotoneUncurry α β γ = { toFun := Sigma.uncurry, monotone' := (_ : ∀ (_x _y : (a : α) → (b : β a) → γ a b), _x ≤ _y → ∀ (a : (a : α) × β a), _x a.fst a.snd ≤ _y a.fst a.snd) }
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
- One or more equations did not get rendered due to their size.