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

Function bad_rule_k

crates/kernel/src/tutorial/defeq.rs:1177–1233  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1175 "_",
1176 apps(
1177 cnst("Eq", &[usucc(uzero())]),
1178 &[cnst("Bool", &[]), cnst("Bool.true", &[]), var(0)],
1179 ),
1180 cnst("Bool", &[]),
1181 ),
1182 );
1183 let rec_app = apps(
1184 cnst("Eq.rec", &[usucc(uzero()), usucc(uzero())]),
1185 &[
1186 cnst("Bool", &[]),
1187 cnst("Bool.true", &[]),
1188 motive,
1189 var(0), // a
1190 cnst("Bool.false", &[]), // a' = false (doesn't match a = true)
1191 var(1), // h
1192 ],
1193 );
1194
1195 let ty = npi(
1196 "h",
1197 tf_eq.clone(),
1198 npi(
1199 "a",
1200 cnst("Bool", &[]),
1201 eq_expr(usucc(uzero()), cnst("Bool", &[]), rec_app, var(0)),
1202 ),
1203 );
1204
1205 let val = nlam(
1206 "h",
1207 tf_eq,
1208 nlam(
1209 "a",
1210 cnst("Bool", &[]),
1211 eq_refl_expr(usucc(uzero()), cnst("Bool", &[]), var(0)),
1212 ),
1213 );
1214
1215 let (id, c) = mk_thm("ruleKbad", 0, vec![], ty, val);
1216 env.insert(id.clone(), c);
1217 check_rejects(&mut env, &id);
1218 }
1219
1220 /// A conclusive Rule-K rejection must not be followed by normalization of
1221 /// the same major premise. This is the small reducer shape behind the
1222 /// TauCeti `castLpₗᵢ` regression: the constructor candidate has already
1223 /// proved that the equality indices differ, while the propositional proof
1224 /// itself can be arbitrarily expensive to expose.
1225 #[test]
1226 fn rule_k_reject_skips_expensive_major_whnf() {
1227 let mut env = eq_inductive_env();
1228
1229 let tf_eq = apps(
1230 cnst("Eq", &[usucc(uzero())]),
1231 &[cnst("Bool", &[]), cnst("Bool.true", &[]), cnst("Bool.false", &[])],
1232 );
1233 let (impossible_id, impossible) =
1234 mk_axiom("impossibleEq", 0, vec![], tf_eq.clone());

Callers

nothing calls this directly

Calls 14

eq_inductive_envFunction · 0.85
appsFunction · 0.85
usuccFunction · 0.85
uzeroFunction · 0.85
nlamFunction · 0.85
npiFunction · 0.85
eq_exprFunction · 0.85
eq_refl_exprFunction · 0.85
mk_thmFunction · 0.85
check_rejectsFunction · 0.85
cnstFunction · 0.50
varFunction · 0.50

Tested by

no test coverage detected