Browse Source

Finish execution model.

gas-move-test
Thomas Kerber 6 months ago
parent
commit
393ac3ba1c
Signed by: Thomas Kerber <t.kerber@ed.ac.uk> GPG Key ID: 8489B911F9ED617B
1 changed files with 7 additions and 9 deletions
  1. 7
    9
      Yggdrasil/World.agda

+ 7
- 9
Yggdrasil/World.agda View File

@@ -1,12 +1,13 @@
1 1
 module Yggdrasil.World where
2 2
 
3 3
 open import Data.Bool using (Bool)
4
+open import Data.Empty using (⊥-elim)
4 5
 open import Data.List using (List; _∷_; []; map)
5 6
 open import Data.Maybe using (Maybe; nothing; just)
6 7
 open import Data.Nat using (ℕ; zero; suc)
7
-open import Data.Product using (_×_) renaming (_,_ to ⟨_,_⟩)
8
+open import Data.Product using (_×_; ∃; ∃-syntax) renaming (_,_ to ⟨_,_⟩)
8 9
 open import Data.Sum using (_⊎_; inj₁; inj₂)
9
-open import Relation.Binary.PropositionalEquality using (_≡_; refl)
10
+open import Relation.Binary.PropositionalEquality using (_≡_; _≢_; refl)
10 11
 open import Level using (Level) renaming (suc to lsuc)
11 12
 open import Yggdrasil.List using (_∈_; here; there)
12 13
 
@@ -55,11 +56,12 @@ data _⊑_ {ℓ : Level} : (Γ₁ Γ₂ : WorldType ℓ) → Set (lsuc ℓ) wher
55 56
   here : ∀ {Γ} → Γ ⊑ Γ
56 57
   there : ∀ {Γ₁ Γ₂ Γ₃} → Γ₂ ∈ chld (node Γ₃) → Γ₁ ⊑ Γ₂ → Γ₁ ⊑ Γ₃
57 58
 
59
+⊑-trans : ∀ {ℓ} {Γ₁ Γ₂ Γ₃ : WorldType ℓ} → Γ₁ ⊑ Γ₂ → Γ₂ ⊑ Γ₃ → Γ₁ ⊑ Γ₃
60
+⊑-trans ⊑Γ here = ⊑Γ
61
+⊑-trans ⊑Γ (there Γ′∈ ⊑Γ′) = there Γ′∈ (⊑-trans ⊑Γ ⊑Γ′)
58 62
 
59 63
 ⊑-right : ∀ {ℓ} {Γ₁ Γ₂ Γ₃ : WorldType ℓ} → Γ₂ ⊑ Γ₃ → Γ₁ ∈ chld (node Γ₂) → Γ₁ ⊑ Γ₃
60
-⊑-right here ∈Γ = there ∈Γ here
61
-⊑-right (there Γ′∈ ⊑Γ′) ∈Γ = ?
64
+⊑-right Γ⊑ ∈Γ = ⊑-trans (there ∈Γ here) Γ⊑
62 65
 
63 66
 data Action↯ {ℓ} Γ where
64 67
   call↯ : ∀ {Γ′} {f : Call ℓ (node Γ′)} → f ∈ (adv Γ′) → Γ′ ⊑ Γ → (x : Call.A f) →
@@ -121,13 +123,6 @@ exec↓ : ∀ {ℓ Γ₁ Γ₂ A} → Oracle Γ₁ → Action↓ Γ₂ A → Wor
121 123
 exec↑ : ∀ {ℓ Γ₁ Γ₂ N A} → Oracle Γ₁ → Action↑ N A → WorldState {ℓ} Γ₁ →
122 124
   Γ₂ ⊑ Γ₁ → N ≡ node Γ₂ → ℕ → Maybe (A × WorldState {ℓ} Γ₁)
123 125
 
124
-
125
-
126 126
 exec (strat (inj₁ α) O) Σ g = exec↯ O α Σ g
127 127
 exec (strat (inj₂ α) O) Σ g = exec↓ O α Σ here g
128 128
 
@@ -145,9 +140,6 @@ exec↓ O (call↓ {f = f} f∈ x) Σ ⊑Γ (suc g) = let
145 140
     Σ′ = set ⊑Γ Σ σ′
146 141
   in exec↑ O α Σ′ ⊑Γ refl g
147 142
 
148
---Oracle Γ = ∀ {q} → q ∈↑ Γ → (x : Query.A q) → Action Γ (Query.B q x)
149
---path : ∀ {Γ′} → Γ′ ⊑ Γ → q ∈ qry (node Γ′) → q ∈↑ Γ
150
-
151 143
 -- NOTE: Gas is only used for termination here, it is NOT a computational model.
152 144
 exec↑ _ _ _ _ _ zero = nothing
153 145
 exec↑ O abort Σ ⊑Γ N≡ (suc g) = nothing

Loading…
Cancel
Save