Documentation

Init.Util

Debugging helper functions #

@[never_extract, extern lean_dbg_trace]
def dbgTrace {α : Type u} (s : String) (f : Unitα) :
α
Equations
def dbgTraceVal {α : Type u} [ToString α] (a : α) :
α
Equations
@[never_extract, extern lean_dbg_trace_if_shared]
def dbgTraceIfShared {α : Type u} (s : String) (a : α) :
α

Display the given message if a is shared, that is, RC(a) > 1

Equations
@[never_extract, extern lean_dbg_stack_trace]
def dbgStackTrace {α : Type u} (f : Unitα) :
α

Print stack trace to stderr before evaluating given closure. Currently supported on Linux only.

Equations
@[extern lean_dbg_sleep]
def dbgSleep {α : Type u} (ms : UInt32) (f : Unitα) :
α
Equations
@[never_extract, inline]
def panicWithPos {α : Sort u} [Inhabited α] (modName : String) (line col : Nat) (msg : String) :
α
Equations
@[never_extract, inline]
def panicWithPosWithDecl {α : Sort u} [Inhabited α] (modName declName : String) (line col : Nat) (msg : String) :
α
Equations
@[extern lean_ptr_addr]
unsafe opaque ptrAddrUnsafe {α : Type u} (a : α) :

Returns the address at which an object is allocated.

This function is unsafe because it can distinguish between definitionally equal values.

@[extern lean_is_exclusive_obj]
unsafe opaque isExclusiveUnsafe {α : Type u} (a : α) :

Returns true if a is an exclusive object.

An object is exclusive if it is single-threaded and its reference counter is 1. This function is unsafe because it can distinguish between definitionally equal values.

@[inline]
unsafe def withPtrAddrUnsafe {α : Type u} {β : Type v} (a : α) (k : USizeβ) (h : ∀ (u₁ u₂ : USize), k u₁ = k u₂) :
β
Equations
@[inline]
unsafe def ptrEq {α : Type u_1} (a b : α) :

Compares two objects for pointer equality.

Two objects are pointer-equal if, at runtime, they are allocated at exactly the same address. This function is unsafe because it can distinguish between definitionally equal values.

Equations
unsafe def ptrEqList {α : Type u_1} (as bs : List α) :

Compares two lists of objects for element-wise pointer equality. Returns true if both lists are the same length and the objects at the corresponding indices of each list are pointer-equal.

Two objects are pointer-equal if, at runtime, they are allocated at exactly the same address. This function is unsafe because it can distinguish between definitionally equal values.

Equations
@[inline]
unsafe def withPtrEqUnsafe {α : Type u} (a b : α) (k : UnitBool) (h : a = bk () = true) :
Equations
@[implemented_by withPtrEqUnsafe]
def withPtrEq {α : Type u} (a b : α) (k : UnitBool) (h : a = bk () = true) :
Equations
@[inline]
def withPtrEqDecEq {α : Type u} (a b : α) (k : UnitDecidable (a = b)) :
Decidable (a = b)

withPtrEq for DecidableEq

Equations
@[implemented_by withPtrAddrUnsafe]
def withPtrAddr {α : Type u} {β : Type v} (a : α) (k : USizeβ) (h : ∀ (u₁ u₂ : USize), k u₁ = k u₂) :
β
Equations