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

Function good_nat_lit_eq

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

Source from the content-addressed store, hash-verified

1002 let nat_3 = ME::nat(Nat::from(3u64), Address::hash(b"natval_3"));
1003 let succ_succ_succ_zero = app(
1004 cnst("N.succ", &[]),
1005 app(cnst("N.succ", &[]), app(cnst("N.succ", &[]), cnst("N.zero", &[]))),
1006 );
1007
1008 // Eq.{1} N 3 (succ (succ (succ zero)))
1009 let ty = eq_expr(usucc(uzero()), nat(), nat_3.clone(), succ_succ_succ_zero);
1010 // Eq.refl.{1} N 3
1011 let val = eq_refl_expr(usucc(uzero()), nat(), nat_3);
1012
1013 let (id, c) = mk_thm("natLitEq", 0, vec![], ty, val);
1014 env.insert(id.clone(), c);
1015 let mut prims = test_prims(&env);
1016 prims.nat = mk_id("N");
1017 prims.nat_zero = mk_id("N.zero");
1018 prims.nat_succ = mk_id("N.succ");
1019 check_accepts_with_prims(&mut env, &id, prims);
1020 }
1021
1022 // ==========================================================================
1023 // Prod + projection reduction (Tutorial.lean 701–705, 902–903)
1024 // ==========================================================================
1025
1026 /// Build Prod.{u,v} : Type u → Type v → Type (max u v) environment.
1027 fn prod_env() -> KEnv<Meta> {
1028 let mut env = KEnv::<Meta>::new();
1029 add_eq_axioms(&mut env);
1030
1031 // Also need Bool for projection tests
1032 let bool_id = mk_id("Bool");

Callers

nothing calls this directly

Calls 14

eq_exprFunction · 0.85
usuccFunction · 0.85
uzeroFunction · 0.85
eq_refl_exprFunction · 0.85
mk_thmFunction · 0.85
test_primsFunction · 0.85
check_accepts_with_primsFunction · 0.85
nat_envFunction · 0.70
cnstFunction · 0.50
natFunction · 0.50
appFunction · 0.50
mk_idFunction · 0.50

Tested by

no test coverage detected