I'm stuck on the following. I have the derivation of a pi calculus transition that takes place in some context Γ, plus a proof that Γ ≡ Γ′. I would like to coerce the derivation into a transition in Γ′, using subst
. The details of the setting are mostly unimportant, as usual.
module Temp where
open import Data.Nat as Nat using (_+_) renaming (ℕ to Cxt)
open import Function
open import Relation.Binary.PropositionalEquality
data _⟿ (Γ : Cxt) : Set where
bound : Γ ⟿
nonBound : Γ ⟿
target : ∀ {Γ} → Γ ⟿ → Cxt
target {Γ} bound = Γ + 1
target {Γ} nonBound = Γ
data Proc (Γ : Cxt) : Set where
data _—[_]→_ {Γ} : Proc Γ → (a : Γ ⟿) → Proc (target a) → Set where
-- Use a proof that Γ ≡ Γ′ to coerce a transition in Γ to one in Γ'.
coerce : ∀ {Γ Γ′} {P : Proc Γ} {a R} → P —[ a ]→ R → (q : Γ ≡ Γ′) →
subst Proc q P —[ subst _⟿ q a ]→ subst (Proc ∘ target) {!!} R
coerce E refl = {!!}
It's easy enough to coerce both the source P of the transition, and the action a which appears as a label on the transition. The problem is the target R of the transition, whose type depends on a. In the coerced transition, I use subst
to coerce a from Γ ⟿ to Γ' ⟿. Naively, I would like to then also use subst
to change the type of R from Proc (target a)
to Proc (target (subst _⟿ q a)
by showing that the Proc indices are equal. However, by its very nature subst _⟿ q a
has a distinct type from a, so I'm unsure how to do this. Maybe I need to use the proof of Γ ≡ Γ′ again or somehow "undo" the inner subst
to unify the types.
Is what I'm trying to do reasonable? If so, how do I coerce R given the heterogeneity?