Documentation

Init.WFComputable

Computable Acc.rec and WellFounded.fix #

This file adds csimp theorems so that the compiler will be able to compile Acc.rec, WellFounded.fix and related operations.

Without this change, the following code will fail to compile as WellFounded.fix is noncomputable.

def log2p1 : NatNat :=
  WellFounded.fix Nat.lt_wfRel.2 fun n IH =>
    let m := n / 2
    if h : m < n then
      IH m h + 1
    else
      0
instance Acc.wfRel {α : Sort u_1} {r : ααProp} :
WellFoundedRelation { val : α // Acc r val }
Equations
@[irreducible, specialize #[]]
def Acc.recC {α : Sort u_1} {r : ααProp} {motive : (a : α) → Acc r aSort v} (intro : (x : α) → (h : ∀ (y : α), r y xAcc r y) → ((y : α) → (hr : r y x) → motive y )motive x ) {a : α} (t : Acc r a) :
motive a t

A computable version of Acc.rec.

Equations
Instances For
    @[csimp]
    @[reducible, inline]
    abbrev Acc.ndrecC {α : Sort u_1} {r : ααProp} {C : αSort v} (m : (x : α) → (∀ (y : α), r y xAcc r y)((y : α) → r y xC y)C x) {a : α} (n : Acc r a) :
    C a

    A computable version of Acc.ndrec.

    Equations
    Instances For
      @[reducible, inline]
      abbrev Acc.ndrecOnC {α : Sort u_1} {r : ααProp} {C : αSort v} {a : α} (n : Acc r a) (m : (x : α) → (∀ (y : α), r y xAcc r y)((y : α) → r y xC y)C x) :
      C a

      A computable version of Acc.ndrecOn.

      Equations
      Instances For
        @[inline]
        def WellFounded.fixFC {α : Sort u} {r : ααProp} {C : αSort v} (F : (x : α) → ((y : α) → r y xC y)C x) (x : α) (a : Acc r x) :
        C x

        A computable version of WellFounded.fixF.

        Equations
        • WellFounded.fixFC F x a = Acc.recC (fun (x₁ : α) (h : ∀ (y : α), r y x₁Acc r y) (ih : (y : α) → r y x₁C y) => F x₁ ih) a
        Instances For
          @[irreducible, specialize #[]]
          def WellFounded.fixC {α : Sort u} {C : αSort v} {r : ααProp} (hwf : WellFounded r) (F : (x : α) → ((y : α) → r y xC y)C x) (x : α) :
          C x

          A computable version of fix.

          Equations
          • hwf.fixC F x = F x fun (y : α) (x : r y x) => hwf.fixC F y
          Instances For