From 2ed2b3f6007ad497fc331c079ee2f74724b00669 Mon Sep 17 00:00:00 2001 From: Greg Brown Date: Tue, 8 Mar 2022 16:23:39 +0000 Subject: Add semantics of Hoare logic terms. --- src/Helium/Semantics/Axiomatic/Core.agda | 4 ++++ src/Helium/Semantics/Axiomatic/Term.agda | 11 +++++++++++ 2 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/Helium/Semantics/Axiomatic/Core.agda b/src/Helium/Semantics/Axiomatic/Core.agda index de4f411..3b7e8db 100644 --- a/src/Helium/Semantics/Axiomatic/Core.agda +++ b/src/Helium/Semantics/Axiomatic/Core.agda @@ -60,6 +60,10 @@ private ⟦ [] ⟧ₜ′ = Lift (b₁ ⊔ i₁ ⊔ r₁) ⊤ ⟦ t ∷ ts ⟧ₜ′ = ⟦ t ⟧ₜ × ⟦ ts ⟧ₜ′ +fetch : ∀ i → ⟦ Γ ⟧ₜ′ → ⟦ lookup Γ i ⟧ₜ +fetch {Γ = _ ∷ _} 0F (x , _) = x +fetch {Γ = _ ∷ _} (suc i) (_ , xs) = fetch i xs + Transform : Vec Type m → Type → Set (b₁ ⊔ i₁ ⊔ r₁) Transform ts t = ⟦ ts ⟧ₜ′ → ⟦ t ⟧ₜ diff --git a/src/Helium/Semantics/Axiomatic/Term.agda b/src/Helium/Semantics/Axiomatic/Term.agda index 1ccef89..c7c2797 100644 --- a/src/Helium/Semantics/Axiomatic/Term.agda +++ b/src/Helium/Semantics/Axiomatic/Term.agda @@ -355,3 +355,14 @@ module _ (2≉0 : 2≉0) where subst t (Code.cons ref ref₁) t′ = subst (subst t ref (func₁ proj₁ t′)) ref₁ (func₁ proj₂ t′) subst t (Code.head {e = e} ref) t′ = subst t ref (func₂ _,_ t′ (func₁ proj₂ (ℰ e))) subst t (Code.tail {t = τ} {e = e} ref) t′ = subst t ref (func₂ {t₁ = τ} _,_ (func₁ proj₁ (ℰ e)) t′) + +⟦_⟧ : Term Σ Γ Δ t → ⟦ Σ ⟧ₜ′ → ⟦ Γ ⟧ₜ′ → ⟦ Δ ⟧ₜ′ → ⟦ t ⟧ₜ +⟦_⟧′ : ∀ {ts} → All (Term Σ Γ Δ) {n} ts → ⟦ Σ ⟧ₜ′ → ⟦ Γ ⟧ₜ′ → ⟦ Δ ⟧ₜ′ → ⟦ ts ⟧ₜ′ + +⟦ state i ⟧ σ γ δ = fetch i σ +⟦ var i ⟧ σ γ δ = fetch i γ +⟦ meta i ⟧ σ γ δ = fetch i δ +⟦ func f ts ⟧ σ γ δ = f (⟦ ts ⟧′ σ γ δ) + +⟦ [] ⟧′ σ γ δ = _ +⟦ t ∷ ts ⟧′ σ γ δ = ⟦ t ⟧ σ γ δ , ⟦ ts ⟧′ σ γ δ -- cgit v1.2.3