Lean4
/-- if `f src = #[a_1, ..., a_n]` and `f tgt = #[b_1, ... b_n]` then `proceedFieldsAux src tgt f`
will insert translations from `a_i` to `b_i`. -/
def proceedFieldsAux (src tgt : Name) (argInfo : ArgInfo) (f : Name → Array Name) : CoreM Unit := do
let srcFields := f src
let tgtFields := f tgt
if srcFields.size != tgtFields.size then
throwError "Failed to map fields of {src }, {tgt } with {srcFields } ↦ {tgtFields}.\n \
Lengths do not match."
for srcField in srcFields, tgtField in tgtFields do
insertTranslationAndInfo srcField tgtField argInfo