Skip to content

Commit

Permalink
Move every file to src root and create logic.ml
Browse files Browse the repository at this point in the history
  • Loading branch information
filipeom committed Dec 6, 2024
1 parent 7f25a33 commit 3d872d2
Show file tree
Hide file tree
Showing 53 changed files with 116 additions and 150 deletions.
4 changes: 2 additions & 2 deletions src/ast/ast.ml → src/ast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type t =
| Reset
| Reset_assertions
| Set_info of Expr.t
| Set_logic of Ty.logic
| Set_logic of Logic.t
| Set_option of Expr.t

type script = t list
Expand Down Expand Up @@ -51,7 +51,7 @@ let pp fmt (instr : t) =
| Reset -> Fmt.string fmt "(reset)"
| Reset_assertions -> Fmt.string fmt "(reset-assertions)"
| Set_info info -> Fmt.pf fmt "(set-info %a)" Expr.pp info
| Set_logic logic -> Fmt.pf fmt "(set-logic %a)" Ty.pp_logic logic
| Set_logic logic -> Fmt.pf fmt "(set-logic %a)" Logic.pp logic
| Set_option opt -> Fmt.pf fmt "(set-option %a)" Expr.pp opt

let to_string (instr : t) : string = Fmt.str "%a" pp instr
2 changes: 1 addition & 1 deletion src/ast/ast.mli → src/ast.mli
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type t =
| Reset
| Reset_assertions
| Set_info of Expr.t
| Set_logic of Ty.logic
| Set_logic of Logic.t
| Set_option of Expr.t

type script = t list
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 15 additions & 9 deletions src/dune
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
(include_subdirs unqualified)

(library
(name smtml_prelude)
(public_name smtml.prelude)
(modules smtml_prelude)
(libraries prelude))

(ocamllex
(modules lexer))

(menhir
(modules parser)
(flags --table))

(library
(name smtml)
(public_name smtml)
(modules
ast
altergo_mappings
bitwuzla_mappings
ast
;axioms
bitwuzla_mappings
cache
cache_intf
colibri2_mappings
compile
constructors_intf
colibri2_mappings
cvc5_mappings
dolmenexpr_to_expr
eval
Expand All @@ -27,25 +32,26 @@
interpret_intf
lexer
log
logic
mappings
mappings_intf
model
num
op_intf
optimizer
optimizer_intf
parser
params
parse
parser
rewrite
smtlib
solver
solver_dispatcher
solver_intf
solver_mode
solver_type
solver_dispatcher
smtlib
symbol
statistics
symbol
ty
utils
value
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
88 changes: 88 additions & 0 deletions src/logic.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
type t =
| ALL
| AUFLIA
| AUFLIRA
| AUFNIRA
| LIA
| LRA
| QF_ABV
| QF_AUFBV
| QF_AUFLIA
| QF_AX
| QF_BV
| QF_BVFP
| QF_IDL
| QF_LIA
| QF_LRA
| QF_NIA
| QF_NRA
| QF_RDL
| QF_S
| QF_UF
| QF_UFBV
| QF_UFIDL
| QF_UFLIA
| QF_UFLRA
| QF_UFNRA
| UFLRA
| UFNIA

let pp fmt = function
| ALL -> Fmt.string fmt "ALL"
| AUFLIA -> Fmt.string fmt "AUFLIA"
| AUFLIRA -> Fmt.string fmt "AUFLIRA"
| AUFNIRA -> Fmt.string fmt "AUFNIRA"
| LIA -> Fmt.string fmt "LIA"
| LRA -> Fmt.string fmt "LRA"
| QF_ABV -> Fmt.string fmt "QF_ABV"
| QF_AUFBV -> Fmt.string fmt "QF_AUFBV"
| QF_AUFLIA -> Fmt.string fmt "QF_AUFLIA"
| QF_AX -> Fmt.string fmt "QF_AX"
| QF_BV -> Fmt.string fmt "QF_BV"
| QF_BVFP -> Fmt.string fmt "QF_BVFP"
| QF_IDL -> Fmt.string fmt "QF_IDL"
| QF_LIA -> Fmt.string fmt "QF_LIA"
| QF_LRA -> Fmt.string fmt "QF_LRA"
| QF_NIA -> Fmt.string fmt "QF_NIA"
| QF_NRA -> Fmt.string fmt "QF_NRA"
| QF_RDL -> Fmt.string fmt "QF_RDL"
| QF_S -> Fmt.string fmt "QF_S"
| QF_UF -> Fmt.string fmt "QF_UF"
| QF_UFBV -> Fmt.string fmt "QF_UFBV"
| QF_UFIDL -> Fmt.string fmt "QF_UFIDL"
| QF_UFLIA -> Fmt.string fmt "QF_UFLIA"
| QF_UFLRA -> Fmt.string fmt "QF_UFLRA"
| QF_UFNRA -> Fmt.string fmt "QF_UFNRA"
| UFLRA -> Fmt.string fmt "UFLRA"
| UFNIA -> Fmt.string fmt "UFNIA"

let of_string logic =
match logic with
| "ALL" -> Ok ALL
| "AUFLIA" -> Ok AUFLIA
| "AUFLIRA" -> Ok AUFLIRA
| "AUFNIRA" -> Ok AUFNIRA
| "LIA" -> Ok LIA
| "LRA" -> Ok LRA
| "QF_ABV" -> Ok QF_ABV
| "QF_AUFBV" -> Ok QF_AUFBV
| "QF_AUFLIA" -> Ok QF_AUFLIA
| "QF_AX" -> Ok QF_AX
| "QF_BV" -> Ok QF_BV
| "QF_BVFP" -> Ok QF_BVFP
| "QF_IDL" -> Ok QF_IDL
| "QF_LIA" -> Ok QF_LIA
| "QF_LRA" -> Ok QF_LRA
| "QF_NIA" -> Ok QF_NIA
| "QF_NRA" -> Ok QF_NRA
| "QF_RDL" -> Ok QF_RDL
| "QF_S" -> Ok QF_S
| "QF_UF" -> Ok QF_UF
| "QF_UFBV" -> Ok QF_UFBV
| "QF_UFIDL" -> Ok QF_UFIDL
| "QF_UFLIA" -> Ok QF_UFLIA
| "QF_UFLRA" -> Ok QF_UFLRA
| "QF_UFNRA" -> Ok QF_UFNRA
| "UFLRA" -> Ok UFLRA
| "UFNIA" -> Ok UFNIA
| _ -> Error (`Msg (Fmt.str "unknown logic %s" logic))
8 changes: 4 additions & 4 deletions src/mappings_intf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ module type M = sig
end

module Solver : sig
val make : ?params:Params.t -> ?logic:Ty.logic -> unit -> solver
val make : ?params:Params.t -> ?logic:Logic.t -> unit -> solver

val clone : solver -> solver

Expand Down Expand Up @@ -396,7 +396,7 @@ module type M = sig
module Smtlib : sig
val pp :
?name:string
-> ?logic:Ty.logic
-> ?logic:Logic.t
-> ?status:satisfiability
-> term list Fmt.t
end
Expand Down Expand Up @@ -428,13 +428,13 @@ module type S = sig
module Smtlib : sig
val pp :
?name:string
-> ?logic:Ty.logic
-> ?logic:Logic.t
-> ?status:satisfiability
-> Expr.t list Fmt.t
end

module Solver : sig
val make : ?params:Params.t -> ?logic:Ty.logic -> unit -> solver
val make : ?params:Params.t -> ?logic:Logic.t -> unit -> solver

val add_simplifier : solver -> solver

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/parser/parser.mly → src/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ let get_bind x = Hashtbl.find varmap x
%token <Ty.t * Ty.cvtop> CVTOP
%token <Ty.t * Ty.naryop> NARY
%token <Ty.t> TYPE
%token <Ty.logic> LOGIC
%token <Logic.t> LOGIC

%start <Ast.t list> script
%%
Expand Down
6 changes: 0 additions & 6 deletions src/parser/dune

This file was deleted.

File renamed without changes.
4 changes: 2 additions & 2 deletions src/parser/smtlib.ml → src/smtlib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ module Statement = struct
let logic =
Log.on_error ~level:Logs.Debug
~pp:(fun fmt (`Msg err) -> Fmt.pf fmt "%a%s. Using: ALL" pp_loc loc err)
~use:(fun _ -> Ty.ALL)
(Ty.logic_of_string logic)
~use:(fun _ -> Logic.ALL)
(Logic.of_string logic)
in
Set_logic logic
end
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/solvers/solver_intf.ml → src/solver_intf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module type S = sig
assertions used. When knowing what the underlying theory is going to be,
setting this parameter can help the SMT solver be more performant. The
default logic is {e unknown_theory}. *)
val create : ?params:Params.t -> ?logic:Ty.logic -> unit -> t
val create : ?params:Params.t -> ?logic:Logic.t -> unit -> t

(** Interrupt solver. *)
val interrupt : t -> unit
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
89 changes: 0 additions & 89 deletions src/ast/ty.ml → src/ty.ml
Original file line number Diff line number Diff line change
Expand Up @@ -267,35 +267,6 @@ let naryop_equal op1 op2 =
true
| (Logand | Logor | Concat | Regexp_union), _ -> false

type logic =
| ALL
| AUFLIA
| AUFLIRA
| AUFNIRA
| LIA
| LRA
| QF_ABV
| QF_AUFBV
| QF_AUFLIA
| QF_AX
| QF_BV
| QF_BVFP
| QF_IDL
| QF_LIA
| QF_LRA
| QF_NIA
| QF_NRA
| QF_RDL
| QF_S
| QF_UF
| QF_UFBV
| QF_UFIDL
| QF_UFLIA
| QF_UFLRA
| QF_UFNRA
| UFLRA
| UFNIA

let pp_unop fmt (op : unop) =
match op with
| Neg -> Fmt.string fmt "neg"
Expand Down Expand Up @@ -448,66 +419,6 @@ let of_string = function
end
else Error (Fmt.str "can not parse type %s" s)

let pp_logic fmt = function
| ALL -> Fmt.string fmt "ALL"
| AUFLIA -> Fmt.string fmt "AUFLIA"
| AUFLIRA -> Fmt.string fmt "AUFLIRA"
| AUFNIRA -> Fmt.string fmt "AUFNIRA"
| LIA -> Fmt.string fmt "LIA"
| LRA -> Fmt.string fmt "LRA"
| QF_ABV -> Fmt.string fmt "QF_ABV"
| QF_AUFBV -> Fmt.string fmt "QF_AUFBV"
| QF_AUFLIA -> Fmt.string fmt "QF_AUFLIA"
| QF_AX -> Fmt.string fmt "QF_AX"
| QF_BV -> Fmt.string fmt "QF_BV"
| QF_BVFP -> Fmt.string fmt "QF_BVFP"
| QF_IDL -> Fmt.string fmt "QF_IDL"
| QF_LIA -> Fmt.string fmt "QF_LIA"
| QF_LRA -> Fmt.string fmt "QF_LRA"
| QF_NIA -> Fmt.string fmt "QF_NIA"
| QF_NRA -> Fmt.string fmt "QF_NRA"
| QF_RDL -> Fmt.string fmt "QF_RDL"
| QF_S -> Fmt.string fmt "QF_S"
| QF_UF -> Fmt.string fmt "QF_UF"
| QF_UFBV -> Fmt.string fmt "QF_UFBV"
| QF_UFIDL -> Fmt.string fmt "QF_UFIDL"
| QF_UFLIA -> Fmt.string fmt "QF_UFLIA"
| QF_UFLRA -> Fmt.string fmt "QF_UFLRA"
| QF_UFNRA -> Fmt.string fmt "QF_UFNRA"
| UFLRA -> Fmt.string fmt "UFLRA"
| UFNIA -> Fmt.string fmt "UFNIA"

let logic_of_string logic =
match logic with
| "ALL" -> Ok ALL
| "AUFLIA" -> Ok AUFLIA
| "AUFLIRA" -> Ok AUFLIRA
| "AUFNIRA" -> Ok AUFNIRA
| "LIA" -> Ok LIA
| "LRA" -> Ok LRA
| "QF_ABV" -> Ok QF_ABV
| "QF_AUFBV" -> Ok QF_AUFBV
| "QF_AUFLIA" -> Ok QF_AUFLIA
| "QF_AX" -> Ok QF_AX
| "QF_BV" -> Ok QF_BV
| "QF_BVFP" -> Ok QF_BVFP
| "QF_IDL" -> Ok QF_IDL
| "QF_LIA" -> Ok QF_LIA
| "QF_LRA" -> Ok QF_LRA
| "QF_NIA" -> Ok QF_NIA
| "QF_NRA" -> Ok QF_NRA
| "QF_RDL" -> Ok QF_RDL
| "QF_S" -> Ok QF_S
| "QF_UF" -> Ok QF_UF
| "QF_UFBV" -> Ok QF_UFBV
| "QF_UFIDL" -> Ok QF_UFIDL
| "QF_UFLIA" -> Ok QF_UFLIA
| "QF_UFLRA" -> Ok QF_UFLRA
| "QF_UFNRA" -> Ok QF_UFNRA
| "UFLRA" -> Ok UFLRA
| "UFNIA" -> Ok UFNIA
| _ -> Error (`Msg (Fmt.str "unknown logic %s" logic))

let discr = function
| Ty_app -> 0
| Ty_bool -> 1
Expand Down
Loading

0 comments on commit 3d872d2

Please sign in to comment.