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

Function good_nat_lit

crates/kernel/src/tutorial/reduction.rs:980–999  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

978 // aNatLit : N := NatVal(0)
979 use bignat::Nat;
980 use ix_common::address::Address;
981 let nat_0 = ME::nat(Nat::from(0u64), Address::hash(b"natval_0"));
982 let (id, c) =
983 mk_defn("aNatLit", 0, vec![], nat(), nat_0, ReducibilityHints::Opaque);
984 env.insert(id.clone(), c);
985 let mut prims = test_prims(&env);
986 prims.nat = mk_id("N");
987 prims.nat_zero = mk_id("N.zero");
988 prims.nat_succ = mk_id("N.succ");
989 check_accepts_with_prims(&mut env, &id, prims);
990 }
991
992 /// natLitEq : Eq N 3 (N.succ (N.succ (N.succ N.zero))) := Eq.refl 3
993 /// Nat literal 3 must reduce to succ(succ(succ(zero))).
994 #[test]
995 fn good_nat_lit_eq() {
996 let mut env = nat_env();
997 let nat = || cnst("N", &[]);
998
999 use bignat::Nat;
1000 use ix_common::address::Address;
1001
1002 let nat_3 = ME::nat(Nat::from(3u64), Address::hash(b"natval_3"));

Callers

nothing calls this directly

Calls 9

mk_defnFunction · 0.85
test_primsFunction · 0.85
check_accepts_with_primsFunction · 0.85
nat_envFunction · 0.70
cnstFunction · 0.50
natFunction · 0.50
mk_idFunction · 0.50
insertMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected