(
&mut self,
ind_id: &KId<M>,
levels: &[KUniv<M>],
binders: usize,
)
| 484 | |
| 485 | fn inductive_app_is_prop( |
| 486 | &mut self, |
| 487 | ind_id: &KId<M>, |
| 488 | levels: &[KUniv<M>], |
| 489 | binders: usize, |
| 490 | ) -> Result<bool, TcError<M>> { |
| 491 | use super::level::{KUniv, univ_eq}; |
| 492 | |
| 493 | let ind_ty = match self.try_get_const(ind_id)? { |
| 494 | Some(KConst::Indc { ty, .. }) => ty, |
| 495 | _ => { |
| 496 | return Err(TcError::Other("projection: not an inductive type".into())); |
| 497 | }, |
| 498 | }; |
| 499 | let levels_vec: Vec<_> = levels.to_vec(); |
| 500 | let mut r = self.instantiate_univ_params(&ind_ty, &levels_vec)?; |
| 501 | for _ in 0..binders { |
| 502 | let wr = self.whnf(&r)?; |
| 503 | match wr.data() { |
| 504 | ExprData::All(_, _, _, body, _) => { |
| 505 | r = body.clone(); |
| 506 | }, |
| 507 | _ => { |
| 508 | return Err(TcError::Other( |
| 509 | "projection: expected forall in inductive type".into(), |
| 510 | )); |
| 511 | }, |
| 512 | } |
| 513 | } |
| 514 | let sort_ty = self.whnf(&r)?; |
| 515 | let level = self.ensure_sort(&sort_ty)?; |
| 516 | Ok(univ_eq(&level, &KUniv::zero())) |
| 517 | } |
| 518 | } |
| 519 | |
| 520 | fn compact_expr<M: KernelMode>(e: &KExpr<M>) -> String { |
| 521 | compact_expr_deep(e, 1) |
no test coverage detected