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

Function prop_intern_determinism

crates/kernel/src/subst.rs:1464–1476  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1462 let result = cheap_beta_reduce(&mut env, &app);
1463 assert_eq!(result, arg);
1464 }
1465
1466 #[test]
1467 fn cheap_beta_nested_bvar_picks_outer_arg() {
1468 // (λa b. a) x y → x (a is Var(1) under both binders)
1469 let mut env = InternTable::<Anon>::new();
1470 let nat = AE::cnst(KId::new(mk_addr("Nat"), ()), Box::new([]));
1471 let v1 = AE::var(1, ()); // refers to outermost lambda
1472 // λa:Nat. λb:Nat. a
1473 let inner_lam = AE::lam((), (), nat.clone(), v1);
1474 let outer_lam = AE::lam((), (), nat, inner_lam);
1475 let x = AE::nat(Nat::from(7u64), mk_addr("x"));
1476 let y = AE::nat(Nat::from(8u64), mk_addr("y"));
1477 let app = AE::app(AE::app(outer_lam, x.clone()), y);
1478 let result = cheap_beta_reduce(&mut env, &app);
1479 assert_eq!(result, x);

Callers

nothing calls this directly

Calls 5

gen_exprFunction · 0.85
intern_exprMethod · 0.80
into_kexprMethod · 0.80
cloneMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected