-
Notifications
You must be signed in to change notification settings - Fork 1
/
ast.v
60 lines (45 loc) · 1.24 KB
/
ast.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Require Export Coq.Init.Datatypes.
Require Export List.
Export ListNotations.
Require Export tactics.
Open Scope type_scope.
Inductive term : Type :=
|lambda : term -> term
|loc : nat -> term
|unit : term
|var : nat -> term
|app : term -> term -> term
|get : term -> term
|put : term -> term -> term
|alloc : term -> term
|fork : term -> term
|atomic : term -> term
|inatomic : term -> term.
Inductive value : term -> Prop :=
|v_lam : forall e, value (lambda e)
|v_loc : forall n, value (loc n)
|v_unit : value unit.
(*Evaluation context*)
Inductive ctxt : Type :=
|hole : ctxt
|appCtxt : term -> ctxt -> ctxt
|appValCtxt (t:term) : value t -> ctxt -> ctxt
|getCtxt : ctxt -> ctxt
|putCtxt : term -> ctxt -> ctxt
|putValCtxt (t:term) : value t -> ctxt -> ctxt
|allocCtxt : ctxt -> ctxt
|inatomicCtxt : ctxt -> ctxt.
(*location (address)*)
Definition location := nat.
(*timestamp used by the STM*)
Definition stamp := nat.
(*log entry for STM metadata*)
Inductive logItem : Type :=
|readItem : location -> ctxt -> term -> logItem
|writeItem : location -> term -> logItem
.
Definition log := list logItem.
Definition thread := option (nat * term) * log * term.
Inductive pool : Type :=
|Single : thread -> pool
|Par : pool -> pool -> pool.