{-# OPTIONS --safe #-}
open import Algebra
open import Data.Nat.Properties using (+-0-monoid)
open import Ledger.Prelude; open Equivalence
open import Ledger.Conway.Transaction
open import Ledger.Conway.Abstract
open import Ledger.Conway.TokenAlgebra
open import Ledger.Conway.TokenAlgebra.ValueSet
module ScriptVerification.StructuredContracts
(txs : _) (open TransactionStructure txs)
(abs : AbstractFunctions txs) (open AbstractFunctions abs)
where
open import Ledger.Conway.Ledger txs abs
open import Ledger.Conway.ScriptValidation txs abs
open import Ledger.Conway.Utxo txs abs
SSRel : Type → Type → Type → Type₁
SSRel Env State Input = Env → State → Input → State → Type
record StrucSimulation S I (_⊢_⇀⦇_,STRUC⦈_ : SSRel ⊤ S I) : Type₁ where
field
πˢ : LState → Maybe S
πⁱ : TxInfo → I
extraAssmp : LEnv → LState → Tx → Type
_~ˢ_ : LState → S → Type
u ~ˢ s = πˢ u ≡ just s
_~ᵉ_ : LEnv × Tx × LState → ⊤ × I → Type
_~ᵉ_ = λ (le , tx , u) (tt , i) → πⁱ (txInfo PlutusV3 (PParamsOf le) (UTxOOf u) tx) ≡ i
field
simulates : ∀ Γ s u tx i′ u′ → extraAssmp Γ u tx →
∙ Γ ⊢ u ⇀⦇ tx ,LEDGER⦈ u′
∙ (Γ , tx , u) ~ᵉ (tt , i′)
∙ u ~ˢ s
────────────────────────────────
∃[ s′ ] u′ ~ˢ s′
× tt ⊢ s ⇀⦇ i′ ,STRUC⦈ s′