{-# OPTIONS --cubical-compatible --safe #-}
open import Data.Fin.Substitution.Lemmas
open import Data.Nat.Base using (ℕ)
module Data.Fin.Substitution.List {ℓ} {T : ℕ → Set ℓ} (lemmas₄ : Lemmas₄ T) where
open import Data.List.Base
open import Data.List.Properties
open import Data.Fin.Substitution
import Function.Base as Fun
open import Relation.Binary.PropositionalEquality
private
variable
m n : ℕ
ListT : ℕ → Set ℓ
ListT = List Fun.∘ T
open module L = Lemmas₄ lemmas₄ using (_/_; id; _⊙_)
infixl 8 _//_
_//_ : ListT m → Sub T m n → ListT n
ts // ρ = map (λ σ → σ / ρ) ts
appLemmas : AppLemmas ListT T
appLemmas = record
{ application = record { _/_ = _//_ }
; lemmas₄ = lemmas₄
; id-vanishes = λ ts → begin
ts // id ≡⟨ map-cong L.id-vanishes ts ⟩
map Fun.id ts ≡⟨ map-id ts ⟩
ts ∎
; /-⊙ = λ {_ _ _ ρ₁ ρ₂} ts → begin
ts // ρ₁ ⊙ ρ₂ ≡⟨ map-cong L./-⊙ ts ⟩
map (λ σ → σ / ρ₁ / ρ₂) ts ≡⟨ map-∘ ts ⟩
ts // ρ₁ // ρ₂ ∎
} where open ≡-Reasoning
open AppLemmas appLemmas public
hiding (_/_) renaming (_/✶_ to _//✶_)