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
Copy file name to clipboardExpand all lines: README.md
+106-1Lines changed: 106 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,110 @@ This library formalizes all results in our paper:
27
27
Additionally, our library comes with a small **demo**, and **tutorials** for getting to know the library and for formalizing your own variability languages (see "Tutorials" section below).
28
28
When run in a terminal, our demo will show a translation roundtrip, showcasing the circle of compilers developed for identifying the map of variability languages (Section 5).
29
29
30
+
## Overview: What is Static Variability and What is Vatras?
31
+
32
+
Vatras is a library to study and compare meta-languages for specifying variability in source code and data.
33
+
Some software systems are configurable _before_ they are compiled, i.e., statically.
34
+
A common way example for implementing static variability is by conditional compilation, as for example possible with the C preprocessor.
35
+
For instance, the following [code snippet from the Linux kernel](https://github.com/torvalds/linux/blob/e271ed52b344ac02d4581286961d0c40acc54c03/include/linux/console.h#L479-L486)
replaces the function `console_srcu_read_lock_is_held` with a default implementation in case a particular feature should be debugged.
49
+
Essentially, the code snippet above does not denote a single `C` program but two `C` programs, each using one of two alternatives for the function `console_srcu_read_lock_is_held`.
50
+
51
+
To model and analyze static variability, researchers have formalized various formal languages, including formalisms for conditional compilation.
52
+
For example, the _choice calculus_ is a small language to formalize conditional compilation in terms of a singly syntactic term, referred to as a _choice_.
53
+
A choice `F ⟨ l , r ⟩` specifies two alternatives `l` and `r` for a feature or configuration option `F`.
54
+
Encoding the example above in choice calculus yields
Apart from source code, static configuration processes emerge in many other areas, including our daily lives.
68
+
For instance, some restaurants offer your to configure your meal.
69
+
Sticking to the choice calculus, we may for example specify a configurable sandwich that _always_ has bread 🍞 and cheese, _maybe_ has salad 🥗 (expressed as a choice between Salad 🥗 and an empty value `ε`), _either_ has a meat 🍖 or falafel 🧆 patty, and has _any_ combination of mayonnaise 🥚 and ketchup 🍅 as follows:
70
+
71
+
```
72
+
🍞-<
73
+
Salad⟨ 🥗, ε ⟩,
74
+
🧀,
75
+
Patty⟨ 🍖, 🧆 ⟩,
76
+
Sauce⟨ ε, 🥚, 🍅, 🍅🥚 ⟩
77
+
>-
78
+
```
79
+
where the Y-brackets of the outer expression `🍞-< ... >-` denote that the ingredients go _within_ the bread (i.e., we build a tree where the ingredients are sub-expressions of bread).
80
+
81
+
The goal of Vatras is to formalize and _compare_ languages for static variabilty.
82
+
To this end, we formalize the syntax and semantics of the choice calculus, some of its dialects, and many more formal languages for static variability.
83
+
For instance, writing out the above sandwich expression in our Agda formalization of the choice calculus, closely resembles the original expressions (most boilerplate comes from explicit list syntax):
We may configure our sandwich in terms of the semantics `⟦_⟧` for choice calculus.
101
+
The semantics is a function takes a configuration as input to produce a variant.
102
+
For our sandwich example, a configuration decides for each configuration option `Salad`, `Patty`, and `Sauce` which alternative to pick.
103
+
A variant is a sandwich without any conditional elements left (i.e., a term without choices).
104
+
From a configuration, we can derive the respective sandwich variant, and we can use Agda to prove that the semantics derive the variant we expect:
105
+
106
+
```agda
107
+
config : Feature → ℕ
108
+
config "Salad" = 0
109
+
config "Patty" = 1
110
+
config "Sauce" = 2
111
+
config _ = 0
112
+
113
+
config-makes-falafel-ketchup-sandwich :
114
+
⟦ sandwich ⟧ config ≡
115
+
"🍞" -<
116
+
leaf "🥗"
117
+
∷ leaf "🧀"
118
+
∷ leaf "🧆"
119
+
∷ leaf "🍅"
120
+
∷ []
121
+
>-
122
+
config-makes-falafel-ketchup-sandwich = refl
123
+
```
124
+
125
+
Vatras enables semantic comparisons of variability languages based on a meta-theory centered around the three fundamental yet unexplored properties of completeness, soundness, and expressiveness.
126
+
Completeness serves as a lower bound (i.e., a language can express at least a given semantic domain),
127
+
soundness serves as an upper bound (i.e., a language can express at most a given semantic domain),
128
+
and expressiveness serves as a relative comparison (i.e., a language can express at least the semantic domain of another language).
129
+
Proofs of these properties come as _encodings_ for completeness (i.e., a function that creates a variational expression from a set of variants), _enumerations_ for soundness (i.e., a function that enumerates all variants denoted by a variational expression), and _compilers_ between languages for expressiveness.
130
+
Vatras includes a range of proofs of these properties for existing languages as explained in our respective paper.
131
+
As a showcase, Vatras will show a roundtrip translation of the configurable sandwich specification above when you run it.
132
+
Details on the features implemented in Vatras, including tutorials for integrating new languages, can be found in the **Reusability Guide** below.
133
+
30
134
## Kick-the-Tires
31
135
32
136
This section gives you a short "Getting Started" guide.
@@ -502,7 +606,8 @@ Executing `git submodule update --init` in the root of the repository should fix
502
606
## Where does the library name 'Vatras' come from?
503
607
504
608
The name Vatras is (of course) an acronym, which stands for _VAriability language TRAnslationS_.
505
-
Besides, Vatras is a water mage in the classic german RPG [Gothic II](https://almanach.worldofgothic.de/index.php/Vatras), who is praying to the god Adanos, who brings "some kind of equality" very loosely speaking.
609
+
Besides, Vatras is a water mage in the classic german RPG [Gothic II](https://almanach.worldofgothic.de/index.php/Vatras), who stems from the city of Varant, which almost sounds like _Variant_.
610
+
Vatras is praying to the god Adanos, who brings some kind of equality or balance loosely speaking.
open import Vatras.Framework.Definitions using (𝔽; 𝔸; atoms; 𝔼; ℂ)
7
+
module Vatras.Lang.2CC (Dimension : 𝔽) where
8
8
```
9
9
10
10
## Imports
11
11
12
12
```agda
13
-
open import Data.Bool using (Bool; true; false; if_then_else_)
14
-
open import Data.List
15
-
using (List; []; _∷_; lookup)
16
-
renaming (map to mapl)
17
-
open import Data.Product using (_,_)
18
-
open import Function using (id)
13
+
open import Data.Bool using (Bool; if_then_else_)
14
+
open import Data.List as List using (List)
19
15
open import Size using (Size; ↑_; ∞)
20
16
21
17
open import Vatras.Framework.Variants as V using (Rose)
22
-
open import Vatras.Framework.VariabilityLanguage
18
+
open import Vatras.Framework.VariabilityLanguage using (𝔼-Semantics; VariabilityLanguage; ⟪_,_,_⟫)
23
19
```
24
20
25
21
## Syntax
@@ -31,9 +27,9 @@ or a binary choice `D ⟨ l , r ⟩` between two sub-expressions `l` and `r`, wh
31
27
to identify the choice upon configuration.
32
28
Dimensions `D` can be of any given type `Dimension : 𝔽`.
33
29
```agda
34
-
data 2CC (Dimension : 𝔽) : Size → 𝔼 where
35
-
_-<_>- : ∀ {i A} → atoms A → List (2CC Dimension i A) → 2CC Dimension (↑ i) A
36
-
_⟨_,_⟩ : ∀ {i A} → Dimension → 2CC Dimension i A → 2CC Dimension i A → 2CC Dimension (↑ i) A
30
+
data 2CC : Size → 𝔼 where
31
+
_-<_>- : ∀ {i A} → atoms A → List (2CC i A) → 2CC (↑ i) A
32
+
_⟨_,_⟩ : ∀ {i A} → Dimension → 2CC i A → 2CC i A → 2CC (↑ i) A
37
33
```
38
34
39
35
## Semantics
@@ -47,175 +43,16 @@ We define `true` to mean choosing the left alternative and `false` to choose the
47
43
Defining it the other way around is also possible but we have to pick one definition and stay consistent.
48
44
We choose this order to follow the known _if c then a else b_ pattern where the evaluation of a condition _c_ to true means choosing the then-branch, which is the left one.
0 commit comments