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

Function subsume_vars

crates/kernel/src/level.rs:506–533  ·  view source on GitHub ↗

Subsumption (Phase 2)

(xs: &[VarNode], ys: &[VarNode])

Source from the content-addressed store, hash-verified

504 }
505 } else {
506 // All UnivData variants for `b` are covered above.
507 unreachable!(
508 "normalize_imax_dispatch: all UnivData variants for b should be covered"
509 );
510 }
511}
512
513// Subsumption (Phase 2)
514fn subsume_vars(xs: &[VarNode], ys: &[VarNode]) -> Vec<VarNode> {
515 let mut result = Vec::new();
516 let mut xi = 0;
517 let mut yi = 0;
518 while xi < xs.len() {
519 if yi >= ys.len() {
520 result.extend_from_slice(&xs[xi..]);
521 break;
522 }
523 match xs[xi].idx.cmp(&ys[yi].idx) {
524 std::cmp::Ordering::Less => {
525 result.push(xs[xi].clone());
526 xi += 1;
527 },
528 std::cmp::Ordering::Equal => {
529 if xs[xi].offset > ys[yi].offset {
530 result.push(xs[xi].clone());
531 }
532 xi += 1;
533 yi += 1;
534 },
535 std::cmp::Ordering::Greater => {
536 yi += 1;

Callers 1

subsumptionFunction · 0.85

Calls 4

pushMethod · 0.80
lenMethod · 0.45
cmpMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected