MCPcopy Create free account
hub / github.com/argumentcomputer/ix / clear

Method clear

crates/kernel/src/env.rs:509–539  ·  view source on GitHub ↗

Clear all worker-local kernel state before checking another scheduled block or when a caller needs a fresh environment.

(&mut self)

Source from the content-addressed store, hash-verified

507 /// Cheap def-eq cache: same key as `def_eq_cache`, but only for comparisons
508 /// performed inside cheap projection reductions. Cheap `false` can be a
509 /// full-mode false negative, so those entries must not be visible to full
510 /// callers.
511 pub def_eq_cheap_cache: FxHashMap<(Addr, Addr, CtxAddr), bool>,
512 /// Failed def-eq pairs in lazy delta: canonical ordering by hash.
513 pub def_eq_failure: FxHashSet<(Addr, Addr, CtxAddr)>,
514 /// Constant-instantiation cache: caches the result of
515 /// `instantiate_univ_params(val, us)` for each `Const(id, us)` head encountered
516 /// during delta unfolding. Keyed by the head expression's content hash, which
517 /// already content-addresses `(id, us)` (the head's address derives from id +
518 /// universe args). Mirrors lean4 C++ `m_unfold` cache. Cross-call sharing of
519 /// universe-substituted bodies eliminates O(body) walks on every unfold.
520 pub unfold_cache: FxHashMap<Addr, KExpr<M>>,
521 /// Memo of `try_reduce_nat_succ_iter` STUCK outcomes: succ-chain args
522 /// whose base never collapses to a literal. Keyed like `whnf_cache`
523 /// ((expr_hash, ctx_hash)). The succ-collapse loop runs its inner WHNF
524 /// in `NatSuccMode::Stuck`, which bypasses the WHNF caches, so without
525 /// this memo a stuck `Nat.succ^k(x)` chain is re-peeled from every
526 /// depth it is encountered at — O(k²) fuel for symbolic-plus-literal
527 /// Nat arithmetic (e.g. `x + 0xC0` in the UTF-8 codec proofs).
528 pub nat_succ_stuck: FxHashSet<(Addr, CtxAddr)>,
529 /// Ingress cache: LeanExpr → KExpr conversion results.
530 /// Keyed by (expr_hash, param_names_hash) to account for different
531 /// level param bindings producing different KExprs from the same LeanExpr.
532 pub ingress_cache: FxHashMap<(CtxAddr, CtxAddr), KExpr<M>>,
533 /// "Is this type Prop?" cache, keyed by (type_hash, ctx_hash).
534 ///
535 /// `try_proof_irrel` is called on essentially every `is_def_eq`
536 /// invocation, and its uncached path costs `infer ∘ infer ∘ whnf` —
537 /// two type-inference runs and one full WHNF — to decide whether the
538 /// term's type is `Prop`. Because the answer depends only on the
539 /// *type* (not on the term whose type was inferred), caching by the
540 /// type's content hash + suffix-aware context lets every subsequent
541 /// proof-irrelevance probe skip those three calls. Empirically this
542 /// is the dominant cost on mathlib proof-heavy blocks, where the same

Callers 13

substFunction · 0.45
simul_substFunction · 0.45
liftFunction · 0.45
instantiate_revFunction · 0.45
abstract_fvarsFunction · 0.45
ingress_muts_inductiveFunction · 0.45
ingress_anon_inductiveFunction · 0.45
resetMethod · 0.45
fm_refineFunction · 0.45
match_verticesFunction · 0.45
partition_for_cycle_capFunction · 0.45

Calls 1

takeMethod · 0.45

Tested by

no test coverage detected