I have a graph with objects and arrows and from this I have defined the notion of a path of arrows. I want to define concatenation of these paths. The following code is my naive attempt. But I get an error when p'
is emptyPath
in the match
clause: 'The term "p" has type "path A B" while it is expected to have type
"path A C".' Conceptually there should be no problem since in this case B
equals C
. How can I get this to work?
Parameter Object : Set.
Parameter Arrow : Object -> Object -> Set.
Inductive path : Object -> Object -> Set :=
emptyPath : forall X, path X X
| cons : forall {A B C} (p : path A B) (f : Arrow B C), path A C.
Fixpoint concat {A B C : Object} (p : path A B) (p' : path B C) : path A C :=
match p' return path A C with
| emptyPath _ => p
| cons _ _ _ p0 f => cons (concat p p0) f
end.