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

Method check_param_agreement

crates/kernel/src/inductive.rs:1661–1700  ·  view source on GitHub ↗

A1: Check that the first `n_params` forall domains of ind_ty and ctor_ty agree.

(
    &mut self,
    ind_ty: &KExpr<M>,
    ctor_ty: &KExpr<M>,
    n_params: usize,
  )

Source from the content-addressed store, hash-verified

1659 log::info!(" sto: {rhs}");
1660 return Ok(true);
1661 }
1662
1663 let lw = self.whnf(lhs)?;
1664 let rw = self.whnf(rhs)?;
1665 match (lw.data(), rw.data()) {
1666 (
1667 ExprData::Lam(_, _, lty, lbody, _),
1668 ExprData::Lam(_, _, rty, rbody, _),
1669 )
1670 | (
1671 ExprData::All(_, _, lty, lbody, _),
1672 ExprData::All(_, _, rty, rbody, _),
1673 ) => {
1674 if !self.is_def_eq(lty, rty)? {
1675 log::info!("[rule rhs diff] first diff {path}.dom");
1676 log::info!(" gen: {lty}");
1677 log::info!(" sto: {rty}");
1678 return Ok(true);
1679 }
1680 let saved = self.lctx.len();
1681 let (lbody_open, fv, _) =
1682 self.open_binder_anon_with_fv(lty.clone(), lbody);
1683 let rbody_open = instantiate_rev(&mut self.env.intern, rbody, &[fv]);
1684 let found = self.dump_rule_rhs_first_diff(
1685 &lbody_open,
1686 &rbody_open,
1687 &format!("{path}.body"),
1688 depth + 1,
1689 );
1690 self.lctx.truncate(saved);
1691 found
1692 },
1693 (ExprData::App(lf, la, _), ExprData::App(rf, ra, _)) => {
1694 if self.dump_rule_rhs_first_diff(
1695 lf,
1696 rf,
1697 &format!("{path}.fn"),
1698 depth + 1,
1699 )? {
1700 return Ok(true);
1701 }
1702 self.dump_rule_rhs_first_diff(la, ra, &format!("{path}.arg"), depth + 1)
1703 },

Calls 8

whnfMethod · 0.80
truncateMethod · 0.80
instantiate_revFunction · 0.70
lenMethod · 0.45
cloneMethod · 0.45
dataMethod · 0.45
is_def_eqMethod · 0.45

Tested by

no test coverage detected