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

Function good_peano3

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

Source from the content-addressed store, hash-verified

233 /// Tests that 2 * 2 reduces to 4 via Church numeral reduction.
234 #[test]
235 fn good_peano3() {
236 let env = peano_env();
237 let ty = npi(
238 "t",
239 pi(cnst("PN", &[]), sort0()),
240 npi(
241 "v",
242 npi("n", cnst("PN", &[]), app(var(1), var(0))),
243 app(var(1), cnst("PN.lit4", &[])),
244 ),
245 );
246 let two_times_two =
247 app(app(cnst("PN.mul", &[]), cnst("PN.lit2", &[])), cnst("PN.lit2", &[]));
248 let val = nlam(
249 "t",
250 pi(cnst("PN", &[]), sort0()),
251 nlam(
252 "v",
253 npi("n", cnst("PN", &[]), app(var(1), var(0))),
254 app(var(0), two_times_two),
255 ),
256 );
257 let mut env2 = env;
258 let (id, c) = mk_thm("peano3", 0, vec![], ty, val);
259 env2.insert(id.clone(), c);
260 check_accepts(&mut env2, &id);
261 }
262
263 // ==========================================================================
264 // Batch 13: Bool inductive + recursor reduction (Tutorial.lean 206, 693)

Callers

nothing calls this directly

Calls 12

peano_envFunction · 0.85
npiFunction · 0.85
nlamFunction · 0.85
mk_thmFunction · 0.85
check_acceptsFunction · 0.85
piFunction · 0.50
cnstFunction · 0.50
sort0Function · 0.50
appFunction · 0.50
varFunction · 0.50
insertMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected