@@ -27,6 +27,7 @@ open import Ledger.Prelude hiding (≤-trans; ≤-antisym; All); open Properties
2727open import Tactic.Cong using (cong!)
2828open import Tactic.EquationalReasoning using (module ≡-Reasoning)
2929open import stdlib-meta.Tactic.MonoidSolver.NonNormalising using (solve-macro)
30+ open import stdlib-meta.Tactic.GenError
3031
3132open import Ledger.Conway.Specification.Utxo txs abs
3233open import Ledger.Conway.Specification.Script.Validation txs abs
@@ -73,60 +74,17 @@ instance
7374 open Computational Computational-UTXOS
7475 renaming (computeProof to computeProof'; completeness to completeness')
7576
76- genErr : ¬ H → String
77- genErr ¬p = case dec-de-morgan ¬p of λ where
78- (inj₁ a) → "¬ TxBody.txIns (Tx.body tx) ≢ ∅"
79- (inj₂ b) → case dec-de-morgan b of λ where
80- (inj₁ a₁) → "¬ txIns ∪ refInputs ∪ collateralInputs ⊆ dom (UTxOOf s)"
81- (inj₂ b₁) → case dec-de-morgan b₁ of λ where
82- (inj₁ a₁') → "¬ txIns ∩ refInputs ≡ ∅"
83- (inj₂ b₂') → case dec-de-morgan b₂' of λ where
84- (inj₁ a₂) → "¬ inInterval (UTxOEnv.slot Γ) (txvldt (Tx.body tx))"
85- (inj₂ b₂) → case dec-de-morgan b₂ of λ where
86- (inj₁ a₃) → "¬ minfee pp utxo tx ≤ txFee"
87- (inj₂ b₃) → case dec-de-morgan b₃ of λ where
88- (inj₁ a₄) → "¬ (txrdmrs ˢ ≢ ∅ → collateralCheck pp tx utxo)"
89- (inj₂ b₄) → case dec-de-morgan b₄ of λ where
90- (inj₁ a₅) →
91- let
92- pp = PParamsOf Γ
93- txb = TxBodyOf tx
94- con = consumed pp s txb
95- prod = produced pp s txb
96- showValue = show ∘ coin
97- in
98- ( "¬consumed (UTxOEnv.pparams Γ) s (Tx.body tx) ≡ produced (PParamsOf Γ) s (Tx.body tx)"
99- +ˢ "\n consumed =\t\t" +ˢ showValue con
100- +ˢ "\n ins =\t\t" +ˢ showValue (balance (UTxOOf s ∣ txb .TxBody.txIns))
101- +ˢ "\n mint =\t\t" +ˢ showValue (TxBody.mint txb)
102- +ˢ "\n depositRefunds =\t" +ˢ showValue (inject (depositRefunds pp s txb))
103- +ˢ "\n produced =\t\t" +ˢ showValue prod
104- +ˢ "\n outs =\t\t" +ˢ showValue (balance $ outs txb)
105- +ˢ "\n fee =\t\t" +ˢ show (FeesOf tx)
106- +ˢ "\n newDeposits =\t" +ˢ show (newDeposits pp s txb)
107- +ˢ "\n donation =\t\t" +ˢ show (DonationsOf txb)
108- )
109- (inj₂ b₅) → case dec-de-morgan b₅ of λ where
110- (inj₁ a₆) → "¬ coin (TxBody.mint (Tx.body tx)) ≡ 0"
111- (inj₂ b₆) → case dec-de-morgan b₆ of λ where
112- (inj₁ a₇) → "¬ (∅ᵐ ≢ᵐ txrdmrs × nothing ≢ proj₂ txVldt → map epochInfoSlotToUTCTime (proj₂ txVldt) ≢ nothing)"
113- (inj₂ b₇) → case dec-de-morgan b₇ of λ where
114- (inj₁ a₈) → "¬ ((Tx.txsize tx) Data.Nat.Base.≤ maxTxSize (UTxOEnv.pparams Γ))"
115- (inj₂ b₈) → case dec-de-morgan b₈ of λ where
116- (inj₁ a₉) → "¬ refScriptsSize utxo tx ≤ maxRefScriptSizePerTx pp"
117- (inj₂ _) → "something else broke"
118-
11977 computeProofH : Dec H → ComputationResult String (∃[ s' ] Γ ⊢ s ⇀⦇ tx ,UTXO⦈ s')
120- computeProofH (yes (x , y , z , e , k , l , m , c , d , v , j , n , o , p , q , r , t , u)) =
121- map₂′ (UTXO-inductive⋯ _ _ _ x y z e k l m c d v j n o p q r t u) <$> computeProof' Γ s tx
122- computeProofH (no ¬p) = failure $ genErr ¬p
78+ computeProofH (yes (x , y , e , k , l , m , c , d , v , j , n , o , p , q , r , t , u)) =
79+ map₂′ (UTXO-inductive⋯ _ _ _ x y e k l m c d v j n o p q r t u) <$> computeProof' Γ s tx
80+ computeProofH (no ¬p) = failure $ genErrors ¬p
12381
12482 computeProof : ComputationResult String (∃[ s' ] Γ ⊢ s ⇀⦇ tx ,UTXO⦈ s')
12583 computeProof = computeProofH H?
12684
12785 completeness : ∀ s' → Γ ⊢ s ⇀⦇ tx ,UTXO⦈ s' → map proj₁ computeProof ≡ success s'
128- completeness s' (UTXO-inductive⋯ _ _ _ x y z w k l m c d v j n o p q r t u h) with H?
129- ... | no ¬p = ⊥-elim $ ¬p (x , y , z , w , k , l , m , c , d , v , j , n , o , p , q , r , t , u)
86+ completeness s' (UTXO-inductive⋯ _ _ _ x y w k l m c d v j n o p q r t u h) with H?
87+ ... | no ¬p = ⊥-elim $ ¬p (x , y , w , k , l , m , c , d , v , j , n , o , p , q , r , t , u)
13088 ... | yes _ with computeProof' Γ s tx | completeness' _ _ _ _ h
13189 ... | success _ | refl = refl
13290
0 commit comments