package dolmen

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file ast.ml

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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235

(* This file is free software, part of dolmen. See file "LICENSE" for more information *)

module type Id = sig

  type t
  (** The type of identifiers *)

  type namespace
  (** The type for namespaces. *)

  val var : namespace
  (** Used for type variables. *)

  val term : namespace
  (** Usual namespace, used for terms and propositions. *)

  val sort : namespace
  (** Usual namespace, used for types. *)

  val decl : namespace
  (** Names used to refer to top-level declarations. *)

  val track : namespace
  (** Namespace used to tag and identify sub-terms occuring in files. *)

  val mk : namespace -> string -> t
  (** Make an identifier *)

  val tracked : track:t -> namespace -> string -> t
  (** Make an identifier with an additional name. *)

end

module type Term = sig

  type t
  (** The type of terms. *)

  type id
  (** The type of identifiers *)

  type location
  (** The type of locations attached to terms. *)

  val prop    : ?loc:location -> unit -> t
  val bool    : ?loc:location -> unit -> t
  val ty_unit : ?loc:location -> unit -> t
  val ty_int  : ?loc:location -> unit -> t
  val ty_real : ?loc:location -> unit -> t
  val ty_bitv : ?loc:location -> int -> t
  (** Builtin types. *)

  val void    : ?loc:location -> unit -> t
  val true_   : ?loc:location -> unit -> t
  val false_  : ?loc:location -> unit -> t
  (** Builtin constants.  *)

  val not_  : ?loc:location -> t -> t
  val and_  : ?loc:location -> t list -> t
  val or_   : ?loc:location -> t list -> t
  val xor   : ?loc:location -> t -> t -> t
  val imply : ?loc:location -> t -> t -> t
  val equiv : ?loc:location -> t -> t -> t
  (** Propositional builtins. *)

  val int : ?loc:location -> string -> t
  val real : ?loc:location -> string -> t
  val hexa : ?loc:location -> string -> t
  (** Numerical constant creation. *)

  val uminus    : ?loc:location -> t -> t
  val add       : ?loc:location -> t -> t -> t
  val sub       : ?loc:location -> t -> t -> t
  val mult      : ?loc:location -> t -> t -> t
  val div       : ?loc:location -> t -> t -> t
  val mod_      : ?loc:location -> t -> t -> t
  val int_pow   : ?loc:location -> t -> t -> t
  val real_pow  : ?loc:location -> t -> t -> t
  val lt        : ?loc:location -> t -> t -> t
  val leq       : ?loc:location -> t -> t -> t
  val gt        : ?loc:location -> t -> t -> t
  val geq       : ?loc:location -> t -> t -> t
  (** Arithmetic builtins. *)

  val eq        : ?loc:location -> t -> t -> t
  val neq       : ?loc:location -> t list -> t
  (** Equality and disequality. *)

  val array_get : ?loc:location -> t -> t -> t
  val array_set : ?loc:location -> t -> t -> t -> t
  (** Array primitives. *)

  val bitv : ?loc:location -> string -> t
  (** Bitvector litteral. *)

  val bitv_extract : ?loc:location -> t -> int -> int -> t
  (** Bitvoector extraction.
      TODO: document meaning of the itnegers indexes. *)

  val bitv_concat : ?loc:location -> t -> t -> t
  (** Bitvector concatenation. *)

  val const   : ?loc:location -> id -> t
  (** Constants, i.e non predefined symbols. This includes both constants
      defined by theories, defined locally in a problem, and also quantified variables. *)

  val colon   : ?loc:location -> t -> t -> t
  (** Juxtaposition of terms, used to annotate terms with their type. *)

  val apply : ?loc:location -> t -> t list -> t
  (** Application of terms (as well as types). *)

  val arrow : ?loc:location -> t -> t -> t
  (** Create a function type. *)

  val ite : ?loc:location -> t -> t -> t -> t
  (** Conditional terms. *)

  val forall : ?loc:location -> t list -> t -> t
  val exists : ?loc:location -> t list -> t -> t
  (** Universal and existential quantifications. *)

  val letin : ?loc:location -> t list -> t -> t
  (** Let-binding. *)

  val match_ : ?loc:location -> t -> (t * t) list -> t
  (** Pattern matching. The first term is the term to match,
      and each tuple in the list is a match case, which is a pair
      of a pattern and a match branch. *)

  val record : ?loc:location -> t list -> t
  (** Create a record expression, with a list of equalities of the form
      "label = expr". *)

  val record_with : ?loc:location -> t -> t list -> t
  (** Record update, of the form "s with [label = expr, ...]". *)

  val record_access : ?loc:location -> t -> id -> t
  (** Record access for the field given by the identifier. *)

  val adt_check : ?loc:location -> t -> id -> t
  (** Create a check agains the given adt constructor. *)

  val adt_project : ?loc:location -> t -> id -> t
  (** Create a projection for the given field of an adt constructor. *)

  val check : ?loc:location -> t -> t
  (** Create a term to "check" a formula.
      TODO: ask @iguernlala about this. *)

  val cut : ?loc:location -> t -> t
  (** Create a cut.
      TODO: ask @iguernlala about this. *)

  val in_interval : ?loc:location -> t -> (t * bool) -> (t * bool) -> t
  (** Create a trigger for the given term/variable being inside
      of a given interval, which is given as a lower bound, and an upper bound.
      Each bound contains an expression for the bound value, as well as a boolean
      indicating whether the bound is strict or not. *)

  val maps_to : ?loc:location -> id -> t -> t
  (** Used in trigger creation. *)

  val trigger : ?loc:location -> t list -> t
  (** Create a (multi) trigger. *)

  val triggers : ?loc:location -> t -> t list -> t
  (** Annotate a term (generally a quantified formula), with a list of triggers. *)

  val filters : ?loc:location -> t -> t list -> t
  (** Annotate a term (genrally a quantified formula) with a list of filters. *)

  val tracked : ?loc:location -> id -> t -> t
  (** Annotate a term with an id for tracking purposes. *)

end

module type Statement = sig

  type t
  (** The type of statements. *)

  type id
  (** The type of identifiers *)

  type term
  (** The type of terms used in statements. *)

  type location
  (** The type of locations attached to statements. *)

  val logic : ?loc:location -> ac:bool -> id list -> term -> t
  (** Function declaration. *)

  val record_type : ?loc:location -> id -> term list -> (id * term) list -> t
  (** Record type definition. *)

  val fun_def : ?loc:location -> id -> term list -> term list -> term -> term -> t
  (** Function definition. *)

  val pred_def : ?loc:location -> id -> term list -> term list -> term -> t
  (** Predicate definition. *)

  val defs : ?loc:location -> ?attrs:term list -> t list -> t
  (** Pack a list of mutually recursive definitions into a single statement. *)

  val abstract_type : ?loc:location -> id -> term list -> t
  (** Create a new abstract type, quantified over the given type variables. *)

  val algebraic_type : ?loc:location -> id -> term list -> (id * term list) list -> t
  (** An algebraic datatype definition. *)

  val rec_types : ?loc:location -> t list -> t
  (** Pack a list of mutually recursive algebraic datatypes together. *)

  val axiom : ?loc:location -> id -> term -> t
  (** Create an axiom. *)

  val case_split : ?loc:location -> id -> term -> t
  (** Create a case split. *)

  val theory : ?loc:location -> id -> id -> t list -> t
  (** Create a theory, extending another, with the given list of declarations. *)

  val rewriting : ?loc:location -> id -> term list -> t
  (** Create a (set of ?) rewriting rule(s). *)

  val prove_goal : ?loc:location -> id -> term -> t
  (** Goal declaration. *)

  val prove_sat : ?loc:location -> name:id -> term list -> t
  (** Check-sat declaration. *)

end
OCaml

Innovation. Community. Security.