Build an env that includes the full USize.size reduction chain: System.Platform.numBits (handled by try_reduce_native → 64) Nat.pow at the correct primitive address USize.size := Nat.pow 2 numBits (reducible def)
()
| 4211 | let lam = AE::lam((), (), sort0(), body); |
| 4212 | let app = AE::app(lam, opaque.clone()); |
| 4213 | assert_eq!(tc.whnf(&app).unwrap(), opaque); |
| 4214 | } |
| 4215 | |
| 4216 | #[test] |
| 4217 | fn whnf_machine_closure_iota_via_beta() { |
| 4218 | use super::super::constant::RecRule; |
| 4219 | // A beta whose body is a recursor application: the machine's Const |
| 4220 | // exit must take the closure-iota path (rule args ride through as |
| 4221 | // closures) and produce the same result as the eager iota. |
| 4222 | // |
| 4223 | // Unit-like inductive `U` with one ctor `U.mk` (no params/fields) |
| 4224 | // and recursor `U.rec : (motive) (minor) (major) → minor`. |
| 4225 | let u_id = mk_id("Test.U"); |
| 4226 | let u_mk_id = mk_id("Test.U.mk"); |
| 4227 | let u_rec_id = mk_id("Test.U.rec"); |
| 4228 | let mut env = env_with_id(); |
| 4229 | env.insert( |
| 4230 | u_id.clone(), |
| 4231 | KConst::Indc { |
| 4232 | name: (), |
| 4233 | level_params: (), |
| 4234 | lvls: 0, |
| 4235 | params: 0, |
| 4236 | indices: 0, |
| 4237 | is_unsafe: false, |
| 4238 | block: u_id.clone(), |
| 4239 | member_idx: 0, |
| 4240 | ty: sort0(), |
| 4241 | ctors: vec![u_mk_id.clone()], |
| 4242 | lean_all: (), |
| 4243 | }, |
| 4244 | ); |
| 4245 | env.insert( |
| 4246 | u_mk_id.clone(), |
| 4247 | KConst::Ctor { |
| 4248 | name: (), |
| 4249 | level_params: (), |
| 4250 | is_unsafe: false, |
| 4251 | lvls: 0, |
| 4252 | induct: u_id.clone(), |
| 4253 | cidx: 0, |
| 4254 | params: 0, |
| 4255 | fields: 0, |
| 4256 | ty: AE::cnst(u_id.clone(), Box::new([])), |
| 4257 | }, |
| 4258 | ); |
| 4259 | env.insert( |
| 4260 | u_rec_id.clone(), |
| 4261 | KConst::Recr { |
| 4262 | name: (), |
| 4263 | level_params: (), |
| 4264 | k: false, |
| 4265 | is_unsafe: false, |
| 4266 | lvls: 0, |
| 4267 | params: 0, |
| 4268 | indices: 0, |
| 4269 | motives: 1, |
| 4270 | minors: 1, |