You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-- An index can just be any set (of any universe, which is why it looks so complicated).
@@ -130,6 +130,19 @@ _⊢_≡ⁱ_ : ∀ {I : Set iℓ} (A : IndexedSet I) → I → I → Set ℓ
130
130
A ⊢ i ≡ⁱ j = A i ≈ A j
131
131
```
132
132
133
+
## Inverse Operations
134
+
135
+
```agda
136
+
_∉_ : ∀ {I : Set iℓ} → Carrier → IndexedSet I → Set (ℓ ⊔ iℓ)
137
+
a ∉ A = ∀ i → ¬ (a ≈ A i)
138
+
139
+
Disjoint : ∀ {I : Set iℓ} {J : Set jℓ} (A : IndexedSet I) (B : IndexedSet J) → Set (ℓ ⊔ iℓ ⊔ jℓ)
140
+
Disjoint A B = ∀ i → A i ∉ B
141
+
142
+
Disjoint-flip : ∀ {I : Set iℓ} {J : Set jℓ} {A : IndexedSet I} {B : IndexedSet J} → Disjoint A B → Disjoint B A
143
+
Disjoint-flip disjointAB j i Bj≈Ai = disjointAB i j (Eq.sym Bj≈Ai)
144
+
```
145
+
133
146
## Singletons
134
147
135
148
```agda
@@ -164,11 +177,13 @@ We now prove the following theorems:
164
177
⊆-refl i = i , Eq.refl
165
178
166
179
-- There is no antisymmetry definition in Relation.Binary.Indexed.Heterogeneous.Definition. Adding that to the standard library would be good and a low hanging fruit.
⊆-antisym : ∀ {I : Set iℓ} {J : Set jℓ} {A : IndexedSet I} {B : IndexedSet J} → A ⊆ B → B ⊆ A → A ≅ B
168
182
⊆-antisym l r = l , r
169
183
170
184
-- There are no generalized transitivity, symmetry and antisymmetry definitions which allow different levels in Relation.Binary.Indexed.Heterogeneous.Definition . Adding that to the standard library would be good and a low hanging fruit.
171
-
⊆-trans : Transitive (IndexedSet {iℓ}) _⊆_
185
+
-- ⊆-trans : Transitive (IndexedSet {iℓ}) _⊆_
186
+
⊆-trans : ∀ {I : Set iℓ} {J : Set jℓ} {K : Set kℓ} {A : IndexedSet I} {B : IndexedSet J} {C : IndexedSet K} → A ⊆ B → B ⊆ C → A ⊆ C
172
187
⊆-trans A⊆B B⊆C i =
173
188
-- This proof looks resembles state monad bind >>=.
174
189
-- interesting... 🤔
@@ -179,10 +194,10 @@ We now prove the following theorems:
179
194
≅-refl : Reflexive (IndexedSet {iℓ}) _≅_
180
195
≅-refl = ⊆-refl , ⊆-refl
181
196
182
-
≅-sym : Symmetric (IndexedSet {iℓ}) _≅_
197
+
≅-sym : ∀ {I : Set iℓ} {J : Set jℓ} {A : IndexedSet I} {B : IndexedSet J} → A ≅ B → B ≅ A
183
198
≅-sym (l , r) = r , l
184
199
185
-
≅-trans : Transitive (IndexedSet {iℓ}) _≅_
200
+
≅-trans : ∀ {I : Set iℓ} {J : Set jℓ} {K : Set kℓ} {A : IndexedSet I} {B : IndexedSet J} {C : IndexedSet K} → A ≅ B → B ≅ C → A ≅ C
186
201
≅-trans (A⊆B , B⊆A) (B⊆C , C⊆B) =
187
202
⊆-trans A⊆B B⊆C
188
203
, ⊆-trans C⊆B B⊆A
@@ -625,6 +640,183 @@ singleton-set-is-nonempty : (A : 𝟙 iℓ) → nonempty A
625
640
singleton-set-is-nonempty _ = tt
626
641
```
627
642
643
+
## Operations
644
+
645
+
```agda
646
+
module _ where
647
+
open import Data.Sum using (_⊎_; inj₁; inj₂)
648
+
private variable
649
+
α : Set iℓ
650
+
β : Set jℓ
651
+
652
+
{-|
653
+
Indexed Set Union (Or):
654
+
We can create the union of two indexed sets by accepting either of the input indices.
Copy file name to clipboardExpand all lines: src/Vatras/Lang/NCC.lagda.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,10 +3,12 @@
3
3
This module defines the choice calculus in which every choice must have the same
4
4
fixed number of alternatives, called $n-CC$ in our paper.
5
5
6
-
It's required that arity $n$ is at least one to have semantics. However, we require
7
-
that the arity is at least two, otherwise there is this annoying one-arity
8
-
language in the NCC language family which is incomplete.
9
-
In our paper, we also only inspect the languages with `n ≥ 2`.
6
+
We require the arity $n$ to be at least two.
7
+
An arity of zero would mean that all choices have zero alternatives.
8
+
Choices with zero alternatives hence would constitute leaf terms without a clear purpose.
9
+
Choices with exactly one alternative have only one way to be configured: selecting that single alternative.
10
+
In both cases of an arity of zero or one, an $n-CC$ term denotes a single constant variant.
11
+
For this reason, we restrict $n$ to be at least two, as we also did in our paper.
10
12
11
13
## Module
12
14
@@ -39,10 +41,8 @@ data NCC : Size → 𝔼 where
39
41
## Semantics
40
42
41
43
The semantics is very similar to the semantics for core choice calculus.
42
-
The differences are:
43
-
44
-
- We can restrict configuration to choose alternatives within bounds because the arity of choices is known in advance.
45
-
- We can then do a vector lookup instead of a list lookup in the semantics.
44
+
The only difference is that we can restrict the configuration process to choose alternatives within bounds because the arity of choices is known in advance.
45
+
We hence do a vector lookup instead of a list lookup.
0 commit comments