I'm trying to write the following function:
Ltac restore_dims :=
repeat match goal with
| [ |- context[@Mmult ?m ?n ?o ?A ?B]] => let Matrix m' n' := type of A in
let Matrix n'' o' := type of B in
replace m with m' by easy
end.
That is, I want to use information about the types of A and B (which are both matrices with 2 dimension arguments) in my Ltac. Is that possible, and if so, how?
(Ideally, this would replace the m
in question with m'
and likewise for n
and o
for all matrix products in my goal.)