Given a dependent record type:
Record FinPath : Type := mkPath { fp_head : S i;
fp_tail : FinPathTail fp_head
}.
and two objects of type Path
that are equal, I'd like to infer that their heads and tails are equal. The problem is that I quickly get something of this form:
fpH : {| path_head := fp_head fp; path_tail := fpt_to_pt (fp_tail fp) |} =
{| path_head := fp_head fp'; path_tail := fpt_to_pt (fp_tail fp') |}
Using the injection tactic, I can infer that fp_head fp = fp_head fp'
and also this term:
existT (fun path_head : S i => PathTail path_head) (fp_head fp)
(fpt_to_pt (fp_tail fp)) =
existT (fun path_head : S i => PathTail path_head) (fp_head fp')
(fpt_to_pt (fp_tail fp'))
Assuming decidability of S i
, I'd normally then want to use inj_pair2_eq_dec
but that doesn't apply in this case because fp_head fp
and fp_head fp'
aren't syntactically the same. I also can't rewrite them to be the same because rewriting with fp_head fp' = fp_head fp
would leave the right hand side ill-typed.
How can I proceed from here? Is there some cleverer version of inj_pair2_eq_dec
that somehow uses the (non-syntactic) base equality rather than requiring the bases of the sigma types to be equal?
Edit: Thinking about this a little harder, I realise that it doesn't make sense to ask that the tails are equal (since they are of different types). But is it possible to prove some form of Leibniz equality between them based on eq_rect
?
S
andFinPathTail
? – eponier