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 : Nat → Nat :=
WellFounded.fix Nat.lt_wfRel.2 fun n IH =>
let m := n / 2
if h : m < n then
IH m h + 1
else
0
@[inline]
def WellFounded.fixFC {α : Sort u} {r : α → α → Prop} {C : α → Sort v} (F : (x : α) → ((y : α) → r y x → C 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 x → C y) → C x) (x : α) :
C x
A computable version of fix.