summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChloe Brown <chloe.brown.00@outlook.com>2021-03-05 14:59:58 +0000
committerChloe Brown <chloe.brown.00@outlook.com>2021-03-05 14:59:58 +0000
commit8fa61609ca049d960922128f32d7509e4055227d (patch)
tree8f1aa5de7a0b24dc410e5fe3662893546a2302d7
parent29c4bfe1440efb1de1ed6d000fcc1cd73dc26f12 (diff)
Add base types and operators
-rw-r--r--src/Cfe/Type/Base.agda33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/Cfe/Type/Base.agda b/src/Cfe/Type/Base.agda
index ea4a657..90506b7 100644
--- a/src/Cfe/Type/Base.agda
+++ b/src/Cfe/Type/Base.agda
@@ -6,13 +6,15 @@ module Cfe.Type.Base
{c ā„“} (over : Setoid c ā„“)
where
-open Setoid over using () renaming (Carrier to C)
+open Setoid over using () renaming (Carrier to C; _ā‰ˆ_ to _∼_)
open import Cfe.Language over
-open import Data.Bool
-open import Level renaming (suc to lsuc)
-open import Relation.Unary
+open import Data.Bool as š”¹ hiding (_∨_)
+open import Level as L renaming (suc to lsuc)
+open import Relation.Unary as U
+infix 7 _āˆ™_
+infix 6 _∨_
infix 4 _⊨_
record Type fā„“ lā„“ : Set (c āŠ” lsuc (fā„“ āŠ” lā„“)) where
@@ -23,6 +25,29 @@ record Type fā„“ lā„“ : Set (c āŠ” lsuc (fā„“ āŠ” lā„“)) where
open Type public
+Ļ„āŠ„ : Type 0ā„“ 0ā„“
+Ļ„āŠ„ = record { Null = false ; First = U.āˆ… ; Flast = U.āˆ… }
+
+τε : Type 0ā„“ 0ā„“
+τε = record { Null = true ; First = U.āˆ… ; Flast = U.āˆ… }
+
+Ļ„[_] : C → Type ā„“ 0ā„“
+Ļ„[ c ] = record { Null = false ; First = c ∼_ ; Flast = U.āˆ… }
+
+_∨_ : āˆ€ {fℓ₁ lℓ₁ fā„“ā‚‚ lā„“ā‚‚} → Type fℓ₁ lℓ₁ → Type fā„“ā‚‚ lā„“ā‚‚ → Type (fℓ₁ āŠ” fā„“ā‚‚) (lℓ₁ āŠ” lā„“ā‚‚)
+τ₁ ∨ τ₂ = record
+ { Null = Null τ₁ š”¹.∨ Null τ₂
+ ; First = First τ₁ ∪ First τ₂
+ ; Flast = Flast τ₁ ∪ Flast τ₂
+ }
+
+_āˆ™_ : āˆ€ {fℓ₁ lℓ₁ fā„“ā‚‚ lā„“ā‚‚} → Type fℓ₁ lℓ₁ → Type fā„“ā‚‚ lā„“ā‚‚ → Type (fℓ₁ āŠ” fā„“ā‚‚) (lℓ₁ āŠ” fā„“ā‚‚ āŠ” lā„“ā‚‚)
+_āˆ™_ {lℓ₁ = lℓ₁} {fā„“ā‚‚} {lā„“ā‚‚} τ₁ τ₂ = record
+ { Null = Null τ₁ ∧ Null τ₂
+ ; First = First τ₁ ∪ (if Null τ₁ then First τ₂ else Ī» x → L.Lift fā„“ā‚‚ (x U.∈ U.āˆ…))
+ ; Flast = Flast τ₂ ∪ (if Null τ₂ then First τ₂ ∪ Flast τ₁ else Ī» x → L.Lift (lℓ₁ āŠ” fā„“ā‚‚) (x U.∈ U.āˆ…))
+ }
+
record _⊨_ {a} {aā„“} {fā„“} {lā„“} (A : Language a aā„“) (Ļ„ : Type fā„“ lā„“) : Set (c āŠ” a āŠ” fā„“ āŠ” lā„“) where
field
n⇒n : null A → T (Null Ļ„)