The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V33. Data structures and computation

Mathlib.Control.Fix

13 declarations. Mathlib docs · Source

Fixed point

This module defines a generic fix operator for defining recursive computations that are not necessarily well-founded or productive. An instance is defined for Part.

Main definition

  • class Fix
  • Part.fix

theorem Part.Fix.approx.match_1.congr_eq_2 E1 #

∀ (motive : ℕ → Sort u_1) (x : ℕ) (h_1 : Unit → motive 0) (h_2 : (i : ℕ) → motive i.succ) (i : ℕ),
  x = i.succ →
    (match x with
      | 0 => h_1 ()
      | i.succ => h_2 i) ≍
      h_2 i

theorem Part.Fix.approx.match_1.congr_eq_1 E1 #

∀ (motive : ℕ → Sort u_1) (x : ℕ) (h_1 : Unit → motive 0) (h_2 : (i : ℕ) → motive i.succ),
  x = 0 →
    (match x with
      | 0 => h_1 ()
      | i.succ => h_2 i) ≍
      h_1 ()

def Fix.ctorIdx E1 #

{α : Type u_3} → Fix α → ℕ

class Fix E3 #

Type u_3 → Type u_3

Fix α provides a fix operator to define recursive computation via the fixed point of function of type α → α.

ctor Fix.mk E3 #

{α : Type u_3} → ((α → α) → α) → Fix α

abbrev Fix.fix E1 #

{α : Type u_3} → [self : Fix α] → (α → α) → α

fix f represents the computation of a fixed point for f.

def Part.Fix.approx E1 #

{α : Type u_1} → {β : α → Type u_2} → (((a : α) → Part (β a)) → (a : α) → Part (β a)) → Stream' ((a : α) → Part (β a))

A series of successive, finite approximation of the fixed point of f, defined by approx f n = f^[n] ⊥. The limit of this chain is the fixed point of f.

def Part.fixAux E0 #

{α : Type u_1} →
  {β : α → Type u_2} →
    (((a : α) → Part (β a)) → (a : α) → Part (β a)) →
      {p : ℕ → Prop} → (i : Nat.Upto p) → ((j : Nat.Upto p) → i < j → (a : α) → Part (β a)) → (a : α) → Part (β a)

loop body for finding the fixed point of f

def Part.fix E3 #

{α : Type u_1} → {β : α → Type u_2} → (((a : α) → Part (β a)) → (a : α) → Part (β a)) → (x : α) → Part (β x)

The least fixed point of f.

If f is a continuous function (according to complete partial orders), it satisfies the equations:

  1. fix f = f (fix f) (is a fixed point)
  2. ∀ X, f X ≤ X → fix f ≤ X (least fixed point)

theorem Part.fix_def E0 #

∀ {α : Type u_1} {β : α → Type u_2} (f : ((a : α) → Part (β a)) → (a : α) → Part (β a)) {x : α}
  (h' : ∃ i, (Part.Fix.approx f i x).Dom), Part.fix f x = Part.Fix.approx f (Nat.find h').succ x

theorem Part.fix_def' E1 #

∀ {α : Type u_1} {β : α → Type u_2} (f : ((a : α) → Part (β a)) → (a : α) → Part (β a)) {x : α},
  (¬∃ i, (Part.Fix.approx f i x).Dom) → Part.fix f x = Part.none

instance Part.hasFix E0 #

{α : Type u_1} → Fix (Part α)

instance Pi.Part.hasFix E0 #

{α : Type u_1} → {β : Type u_3} → Fix (α → Part β)