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

Function good_peano2

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

Source from the content-addressed store, hash-verified

201 /// Tests that 1 + 1 reduces to 2 via Church numeral reduction.
202 #[test]
203 fn good_peano2() {
204 let env = peano_env();
205 let ty = npi(
206 "t",
207 pi(cnst("PN", &[]), sort0()),
208 npi(
209 "v",
210 npi("n", cnst("PN", &[]), app(var(1), var(0))),
211 app(var(1), cnst("PN.lit2", &[])),
212 ),
213 );
214 // Value uses add lit1 lit1 instead of lit2
215 let one_plus_one =
216 app(app(cnst("PN.add", &[]), cnst("PN.lit1", &[])), cnst("PN.lit1", &[]));
217 let val = nlam(
218 "t",
219 pi(cnst("PN", &[]), sort0()),
220 nlam(
221 "v",
222 npi("n", cnst("PN", &[]), app(var(1), var(0))),
223 app(var(0), one_plus_one),
224 ),
225 );
226 let mut env2 = env;
227 let (id, c) = mk_thm("peano2", 0, vec![], ty, val);
228 env2.insert(id.clone(), c);
229 check_accepts(&mut env2, &id);
230 }
231
232 /// peano3 : ∀ (t : PN → Prop) (v : (n : PN) → t n), t PN.lit4 := fun t v => v (PN.mul PN.lit2 PN.lit2)
233 /// Tests that 2 * 2 reduces to 4 via Church numeral reduction.

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