Build And : Prop → Prop → Prop with And.intro constructor.
()
| 1239 | // the redundant post-rejection major WHNF enters this beta chain. |
| 1240 | let mut slow_proof = cnst("impossibleEq", &[]); |
| 1241 | for _ in 0..1024 { |
| 1242 | slow_proof = app(nlam("h", tf_eq.clone(), var(0)), slow_proof); |
| 1243 | } |
| 1244 | let (slow_id, slow) = mk_defn( |
| 1245 | "slowImpossibleEq", |
| 1246 | 0, |
| 1247 | vec![], |
| 1248 | tf_eq, |
| 1249 | slow_proof, |
| 1250 | ix_common::env::ReducibilityHints::Abbrev, |
| 1251 | ); |
| 1252 | env.insert(slow_id, slow); |
| 1253 | |
| 1254 | let motive = nlam( |
| 1255 | "_", |
| 1256 | cnst("Bool", &[]), |
| 1257 | nlam( |
| 1258 | "_", |
| 1259 | apps( |
| 1260 | cnst("Eq", &[usucc(uzero())]), |
| 1261 | &[cnst("Bool", &[]), cnst("Bool.true", &[]), var(0)], |
| 1262 | ), |
| 1263 | cnst("Bool", &[]), |
| 1264 | ), |
| 1265 | ); |
| 1266 | let rec_app = apps( |
| 1267 | cnst("Eq.rec", &[usucc(uzero()), usucc(uzero())]), |
| 1268 | &[ |
| 1269 | cnst("Bool", &[]), |
| 1270 | cnst("Bool.true", &[]), |
| 1271 | motive, |
| 1272 | cnst("Bool.true", &[]), |
| 1273 | cnst("Bool.false", &[]), |
| 1274 | cnst("slowImpossibleEq", &[]), |
| 1275 | ], |
| 1276 | ); |
| 1277 | |
| 1278 | let mut tc = crate::tc::TypeChecker::new(&mut env); |
| 1279 | tc.rec_fuel = 512; |
| 1280 | let reduced = tc.whnf(&rec_app).expect( |
| 1281 | "a definitive K rejection should not normalize the expensive major", |
| 1282 | ); |
| 1283 | assert_eq!(reduced.hash_key(), rec_app.hash_key()); |
| 1284 | } |
| 1285 | |
| 1286 | // ========================================================================== |
| 1287 | // Projection tests (Tutorial.lean 760–900) |
| 1288 | // Requires And as structure |
| 1289 | // ========================================================================== |
| 1290 | |
| 1291 | /// Build And : Prop → Prop → Prop with And.intro constructor. |
| 1292 | fn and_env() -> KEnv<Meta> { |
| 1293 | let mut env = KEnv::<Meta>::new(); |
| 1294 | add_eq_axioms(&mut env); |
| 1295 | |
| 1296 | let n = "And"; |
| 1297 | let block_id = mk_id(n); |
| 1298 | let intro_id = mk_id("And.intro"); |