From 8fa61609ca049d960922128f32d7509e4055227d Mon Sep 17 00:00:00 2001 From: Chloe Brown Date: Fri, 5 Mar 2021 14:59:58 +0000 Subject: Add base types and operators --- src/Cfe/Type/Base.agda | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'src') 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 Ļ„) -- cgit v1.2.3