I have the following definition:
ren-refl′ : ∀ {Γ i t} (ts′ : List Ty) → (e : Tm {i} (Γ <>< ts′) t) → ren (keep* ts′ reflᵣ) e ≡ e
ren-refl′ {Γ} ts′ (var v) rewrite keep*-refl {Γ} ts′ | ren-var-refl v = refl
ren-refl′ {Γ} ts′ (con e) rewrite keep*-refl {Γ} ts′ | ren-con-refl e = refl
I would like to factor out the rewriting by keep*-refl {Γ} ts′
since we can do that (and do that uniformly) before pattern matching on the e
argument.
The closest I got is with a pattern matching lambda:
ren-refl′ {Γ} ts′ rewrite keep*-refl {Γ} ts′ = λ
{ (var v) → cong var (ren-var-refl v)
; (con e) → cong con (ren-con-refl e)
}
However, I don't like it because it requires me to do some cong
shuffling that I wouldn't need with a straight rewrite
; and I can't do a rewrite
in a lambda.