Auxiliary lemmas for PFunctor.M #
Small extensions to Mathlib.Data.PFunctor.Univariate.M used by the
ToMathlib.ITree port of the Coq InteractionTrees library.
The Mathlib file already supplies M.mk, M.dest, M.corec, M.dest_mk,
M.mk_dest, M.dest_corec, M.corec_unique, and the bisimulation principle
M.bisim. We add a few rewriting helpers that come up repeatedly when
defining and reasoning about ITrees:
M.dest_inj/M.eq_of_dest_eq—M.destis injective onM P(since it has a left inverseM.mk).M.dest_corec_apply— destructured form ofM.dest_corecwhose RHS unpacks theSigmaso that nested pattern matches reduce byrfl.M.dest_corec_eq— reformulation ofM.dest_corecthat letssimpsee the result as an explicitSigma.M.corec_eq_corec— bisimulation principle for twocorecs, the workhorse forbind/iterrewriting.M.corec_dest—M.corec dest = id. The corecursive identity.
Injectivity of dest #
M.dest is injective: equal destructions imply equal M-values, since
M.mk is a left inverse of M.dest (see M.mk_dest).
Corec helpers #
M.dest_corec with the result Sigma unpacked. The shape of M.dest's
output is (g x).1; the children component, after applying the PFunctor.map
on the RHS of M.dest_corec, is M.corec g ∘ (g x).2.
Pointwise version of dest_corec_apply written in Sigma-eta form,
convenient when the right-hand side of a corec step is already known
explicitly.
Bisimulation principle specialized to two corecs built from the same
shape transformer. If at every reachable state the two seed transitions agree
on shapes and yield bisimilar children, the two corecs are equal.