aboutsummaryrefslogtreecommitdiffstats
path: root/theories/nix/notations.v
diff options
context:
space:
mode:
Diffstat (limited to 'theories/nix/notations.v')
-rw-r--r--theories/nix/notations.v43
1 files changed, 43 insertions, 0 deletions
diff --git a/theories/nix/notations.v b/theories/nix/notations.v
new file mode 100644
index 0000000..e9995b5
--- /dev/null
+++ b/theories/nix/notations.v
@@ -0,0 +1,43 @@
1From mininix Require Export nix.operational.
2
3(* Influenced by
4https://gitlab.mpi-sws.org/iris/iris/-/blob/master/iris_heap_lang/notation.v
5But always uses ":" instead of a scope. *)
6
7Coercion EId' : string >-> expr.
8Coercion NInt : Z >-> num.
9Coercion NFloat : float >-> num.
10Coercion LitNum : num >-> base_lit.
11Coercion LitBool : bool >-> base_lit.
12Coercion ELit : base_lit >-> expr.
13Coercion EApp : expr >-> Funclass.
14
15Notation "λattr: a , e" := (EAbsMatch a true e)
16 (at level 200, e, a at level 200,
17 format "'[' 'λattr:' a , '/ ' e ']'").
18Notation "λattr: a .., e" := (EAbsMatch a false e)
19 (at level 200, e, a at level 200,
20 format "'[' 'λattr:' a .., '/ ' e ']'").
21
22Notation "λ: x .. y , e" := (EAbs x .. (EAbs y e) ..)
23 (at level 200, x, y at level 1, e at level 200,
24 format "'[' 'λ:' x .. y , '/ ' e ']'").
25Notation "'let:' x := e1 'in' e2" := (ELet x e1 e2)
26 (at level 200, x at level 1, e1, e2 at level 200,
27 format "'[' 'let:' x := '[' e1 ']' 'in' '/' e2 ']'").
28Notation "'with:' a 'in' e" := (EWith a e)
29 (at level 200, a, e at level 200,
30 format "'[' 'with:' a 'in' '/' e ']'").
31
32Notation "'if:' e1 'then' e2 'else' e3" := (EIf e1 e2 e3)
33 (at level 200, e1, e2, e3 at level 200).
34
35Notation "e1 .: e2" := (ESelect e1 e2) (at level 70, no associativity).
36
37Notation "e1 +: e2" := (EBinOp AddOp e1 e2) (at level 50, left associativity).
38Notation "e1 *: e2" := (EBinOp MulOp e1 e2).
39Notation "e1 -: e2" := (EBinOp SubOp e1 e2) (at level 50, left associativity).
40Notation "e1 /: e2" := (EBinOp DivOp e1 e2) (at level 40).
41Notation "e1 =: e2" := (EBinOp EqOp e1 e2) (at level 70, no associativity).
42Notation "e1 <: e2" := (EBinOp LtOp e1 e2) (at level 70, no associativity).
43Notation "'ceil:' e" := (EBinOp (RoundOp Ceil) e LitNull) (at level 10).