Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Lean/Mathlib/MathlibTest/Util/     Datei vom 15.10.2026 mit Größe 1 kB image not shown  

Quelle  CountHeartbeats.lean   Sprache: Lean

 

module

public import Mathlib.Util.CountHeartbeats
public import Mathlib.Util.SleepHeartbeats

/-- info: Used approximately 0 heartbeats, which is less than the current maximum of 200000. -/
#guard_msgs in
#count_heartbeats approximately in
example (a : Nat) : a = a := rfl

/-- info: Used approximately 0 heartbeats, which is less than the minimum of 200000. -/
#guard_msgs in
guard_min_heartbeats approximately in
example (a : Nat) : a = a := rfl

/-- info: Used approximately 0 heartbeats, which is less than the minimum of 2000. -/
#guard_msgs in
guard_min_heartbeats approximately 2000 in
example (a : Nat) : a = a := rfl

guard_min_heartbeats approximately 1 in
example (a : Nat) : a = a := rfl

-- The `countHeartbeats` linter and its option-setting `#count_heartbeats` notation were deprecated
-- (lean4, 2026-07-30) in favour of `#count_heartbeats in`, so the linter-specific tests have been
-- retired. This preserves the non-trivial-count coverage via `#count_heartbeats in`, which is
-- exactly what the linter invoked internally for each declaration.
/-- info: Used approximately 1000 heartbeats, which is less than the current maximum of 200000. -/
#guard_msgs in
#count_heartbeats approximately in
example : True := by
  sleep_heartbeats 1000
  trivial

-- With `Elab.async` (the default), `theorem` bodies are elaborated in a separate task, and their
-- heartbeats were not counted; check they are. Note this needs a `theorem`, not an `example`:
-- `example` and `def` bodies are elaborated synchronously and did not exhibit the bug.
/-- info: Used approximately 5000 heartbeats, which is less than the current maximum of 200000. -/
#guard_msgs in
#count_heartbeats approximately in
theorem countHeartbeatsCountsAsyncTheoremBody : True := by
  sleep_heartbeats 5000
  trivial

Messung
CHZG
9410010097

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet am  2026-11-24) ¤

*© Formatika GbR, Deutschland