Documentation

Mathlib.Util.MemoFix

Fixpoint function with memoisation #

@[implemented_by _private.Mathlib.Util.MemoFix.0.memoFixImpl]
opaque memoFix {α : Type u} {β : Type v} [Nonempty β] (f : (αβ)αβ) :
αβ

Takes the fixpoint of f with caching of values that have been seen before. Hashing makes use of a pointer hash.

This is useful for implementing tree traversal functions where subtrees may be referenced in multiple places.