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

Method try_reduce_bitvec_lt_prop

crates/kernel/src/whnf.rs:2537–2558  ·  view source on GitHub ↗
(
    &mut self,
    prop: &KExpr<M>,
  )

Source from the content-addressed store, hash-verified

2535 }
2536 if !self.is_nat_succ_ih_step(step)? {
2537 return Ok(None);
2538 }
2539
2540 let base = base.clone();
2541 let base_whnf = self.whnf(&base)?;
2542 let Some(base_val) = extract_nat_value(&base_whnf, &self.prims) else {
2543 // Symbolic base: collapse `succ^offset(Nat.rec base succ-step (Lit n))`
2544 // to the compact offset `Nat.add base (Lit (n + offset))` rather than
2545 // declining into n iota steps that materialize succ^n(base). Keeps the
2546 // value in the same `base + k` form a literal already has, so def-eq
2547 // converges instead of descending n unary succ layers. Conservative:
2548 // only when the recursor application carries no post-major arguments.
2549 // Mirrors IxVM dbc4177.
2550 if parts.spine.len() != parts.major_idx + 1 {
2551 return Ok(None);
2552 }
2553 let total = Nat(&parts.major.0 + offset);
2554 let lit = self.nat_expr_from_value(total);
2555 let result = self.mk_nat_add(base_whnf, lit);
2556 return Ok(Some(result));
2557 };
2558
2559 let mut total = base_val.0;
2560 total += parts.major.0;
2561 total += offset;

Callers 1

try_reduce_bitvecMethod · 0.80

Calls 4

collect_app_spineFunction · 0.85
try_reduce_bitvec_ultMethod · 0.80
dataMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected