I use the usual coinductive definition of the M-type.
record M (S : Set) (Q : S → Set) : Set where
coinductive
constructor sup-M
field
shape : S
pos : Q shape → M S Q
open M
Assume Y, S : Set
, Q : S → Set
, s : S
, h : Q s → Y
. I define a function β
going into M
by co-pattern matching.
β : Y → M S Q
shape (β y) = s
pos (β y) = β ∘ h
I would now like to show that any other function β̃
defined as above is equal to β
.
β-unique : (β̃ : Y → M S Q) →
((y : Y) → (shape (β̃ y) , pos (β̃ y)) ≡ (s , β̃ ∘ h)) →
β̃ ≡ β
I am trying to do this by co-pattern matching as below.
shape (β-unique β̃ β̃-comm i y) = fst (β̃-comm y i)
pos (β-unique β̃ β̃-comm i y) q = {!!}
Showing the shapes are equal is straightforward: this is given by the first component of β̃-comm
. Showing the positions are equal involves making use of the below path given by the second component of β̃-comm
,
pos-path : PathP (λ i → Q (fst (β̃-comm y i)) → M S Q) (pos (β̃ y)) (β̃ ∘ h)
pos-path i = snd (β̃-comm y i)
and recursively calling β-unique
to show (β̃ ∘ h)
is the same as β ∘ h
. I'm having trouble composing this reasoning in Cubical Agda, mainly because the variable q
has type Q (fst (β̃-comm y i))
which is in terms of a path variable i
. Trying to prove this without introducing any path variables leads me to non-termination errors.
How can I complete my proof β-unique?
Many thanks for reading!