I have the following setup (sorry if it's a bit long for an MCVE) and am trying to prove the last theorem, but I'm getting stuck because it can't unify the types of the morphisms as they rely on theoretically different object types, even though the object types are identical.
Is there a general strategy for decomposing constructors with dependent types in them? injection
and inversion
produce what seem to be useless results having to do with ob_fn
(which I can prove the equivalent theorem for easily) rather than morph_fn
.
Inductive Cat := cons_cat (O : Type) (M : O -> O -> Type).
Definition ob (c : Cat) :=
match c with cons_cat o _ => o end.
Definition morph (c : Cat) : ob c -> ob c -> Type :=
match c with cons_cat _ m => m end.
Inductive Functor
(A B : Cat)
: Type :=
cons_functor
(ob_fn : ob A -> ob B)
(morph_fn : forall {c d : ob A}, morph A c d -> morph B (ob_fn c) (ob_fn d)).
Definition ob_fn {A B : Cat} (f : Functor A B) : ob A -> ob B :=
match f with cons_functor f' _ => f' end.
Definition morph_fn {A B : Cat} {c d : ob A} (f : Functor A B)
: morph A c d -> morph B (ob_fn f c) (ob_fn f d) :=
match f with cons_functor _ f' => f' c d end.
Theorem functor_decompose {A B : Cat} {o fm gm} : cons_functor A B o fm = cons_functor A B o gm -> fm = gm.
intros H.
assert (forall c d, @morph_fn A B c d (cons_functor A B o fm) = @morph_fn A B c d (cons_functor A B o gm)).
intros.
rewrite H.