-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLocationConflictCtx.agda
63 lines (52 loc) · 3.34 KB
/
LocationConflictCtx.agda
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
open import Data.List using (List; []; _∷_; [_]; _++_)
open import Data.Product using (_×_; _,_; ∃-syntax)
open import Grove.Ident
open import Grove.Marking.STyp
open import Grove.Marking.Ctx
open import Grove.Marking.MExp
open import Grove.Marking.Grove using (Vertex; Location)
module Grove.Marking.LocationConflictCtx where
data Mode : Set where
Syn : Mode
Ana : (τ : STyp) → Mode
record LocationConflict : Set where
constructor ⟨_,_,_,_⟩
field
v : Vertex
w : EdgeId
Γ : Ctx
m : Mode
LocationConflictCtx = List LocationConflict
mutual
locationConflictCtx⇒ : ∀ {Γ τ} → (ě : Γ ⊢⇒ τ) → LocationConflictCtx
locationConflictCtx⇒ (⊢ _ ^ _) = []
locationConflictCtx⇒ (⊢λ _ ∶ _ ∙ ě ^ _) = locationConflictCtx⇒s ě
locationConflictCtx⇒ (⊢ ě₁ ∙ ě₂ [ _ ]^ _) = (locationConflictCtx⇒s ě₁) ++ (locationConflictCtx⇐s ě₂)
locationConflictCtx⇒ (⊢⸨ ě₁ ⸩∙ ě₂ [ _ ]^ _) = (locationConflictCtx⇒s ě₁) ++ (locationConflictCtx⇐s ě₂)
locationConflictCtx⇒ (⊢ℕ _ ^ _) = []
locationConflictCtx⇒ (⊢ ě₁ + ě₂ ^ _) = (locationConflictCtx⇐s ě₁) ++ (locationConflictCtx⇐s ě₂)
locationConflictCtx⇒ (⊢⟦ _ ⟧^ _) = []
locationConflictCtx⇒ {Γ} (⊢⋎^ w ^ v) = [ ⟨ v , w , Γ , Syn ⟩ ]
locationConflictCtx⇒ {Γ} (⊢↻^ w ^ v) = [ ⟨ v , w , Γ , Syn ⟩ ]
locationConflictCtx⇒s : ∀ {Γ τ} → (ě : Γ ⊢⇒s τ) → LocationConflictCtx
locationConflictCtx⇒s (⊢□ _) = []
locationConflictCtx⇒s (⊢∶ (_ , ě)) = locationConflictCtx⇒ ě
locationConflictCtx⇒s (⊢⋏ _ ė*) = locationConflictCtx⇒s* ė*
locationConflictCtx⇒s* : ∀ {Γ} → (ė* : List (EdgeId × ∃[ τ ] Γ ⊢⇒ τ)) → LocationConflictCtx
locationConflictCtx⇒s* [] = []
locationConflictCtx⇒s* ((_ , _ , ě) ∷ ė*) = (locationConflictCtx⇒ ě) ++ locationConflictCtx⇒s* ė*
locationConflictCtx⇐ : ∀ {Γ τ} → (ě : Γ ⊢⇐ τ) → LocationConflictCtx
locationConflictCtx⇐ (⊢λ _ ∶ _ ∙ ě [ _ ∙ _ ]^ _) = locationConflictCtx⇐s ě
locationConflictCtx⇐ (⊢⸨λ _ ∶ _ ∙ ě ⸩[ _ ]^ _) = locationConflictCtx⇐s ě
locationConflictCtx⇐ (⊢λ _ ∶⸨ _ ⸩∙ ě [ _ ∙ _ ]^ _) = locationConflictCtx⇐s ě
locationConflictCtx⇐ {Γ} {τ} (⊢⋎^ w ^ v) = [ ⟨ v , w , Γ , Ana τ ⟩ ]
locationConflictCtx⇐ {Γ} {τ} (⊢↻^ w ^ v) = [ ⟨ v , w , Γ , Ana τ ⟩ ]
locationConflictCtx⇐ ⊢⸨ ě ⸩[ _ ∙ _ ] = locationConflictCtx⇒ ě
locationConflictCtx⇐ ⊢∙ ě [ _ ∙ _ ] = locationConflictCtx⇒ ě
locationConflictCtx⇐s : ∀ {Γ τ} → (ě : Γ ⊢⇐s τ) → LocationConflictCtx
locationConflictCtx⇐s (⊢□ _) = []
locationConflictCtx⇐s (⊢∶ (_ , ě)) = locationConflictCtx⇐ ě
locationConflictCtx⇐s (⊢⋏ _ ė*) = locationConflictCtx⇐s* ė*
locationConflictCtx⇐s* : ∀ {Γ τ} → (ė* : List (EdgeId × Γ ⊢⇐ τ)) → LocationConflictCtx
locationConflictCtx⇐s* [] = []
locationConflictCtx⇐s* ((_ , ě) ∷ ė*) = (locationConflictCtx⇐ ě) ++ locationConflictCtx⇐s* ė*