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

Method eta_expansion_base

crates/kernel/src/def_eq.rs:1229–1254  ·  view source on GitHub ↗
(
    &mut self,
    induct_id: &KId<M>,
    num_params: usize,
    num_fields: usize,
    args: &[KExpr<M>],
  )

Source from the content-addressed store, hash-verified

1227 let ctor_id = match s_head.data() {
1228 ExprData::Const(id, _, _) => id.clone(),
1229 _ => {
1230 self.dump_eta_trace("rhs-not-ctor-head", None, 0, &t_norm, s);
1231 return Ok(false);
1232 },
1233 };
1234
1235 // Head must be a constructor
1236 let (induct_id, num_params, num_fields) = match self
1237 .try_get_const(&ctor_id)?
1238 {
1239 Some(KConst::Ctor { induct, params, fields, .. }) => {
1240 (induct.clone(), u64_to_usize::<M>(params)?, u64_to_usize::<M>(fields)?)
1241 },
1242 _ => {
1243 self.dump_eta_trace("rhs-head-not-ctor", Some(&ctor_id), 0, &t_norm, s);
1244 return Ok(false);
1245 },
1246 };
1247
1248 // Must be fully applied
1249 if s_args.len() != num_params + num_fields {
1250 self.dump_eta_trace(
1251 "ctor-arity",
1252 Some(&ctor_id),
1253 s_args.len(),
1254 &t_norm,
1255 s,
1256 );
1257 return Ok(false);

Callers 1

try_eta_structMethod · 0.80

Calls 4

whnf_no_deltaMethod · 0.80
hash_keyMethod · 0.80
dataMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected