Skip to content

Commit

Permalink
Locking the Dolmen to a dev commit
Browse files Browse the repository at this point in the history
This commit locks the Dolmen used by AE to a specific commit
in order to use the unreleased feature for custom statements.

I also notice that the `with_cache` in `d_cnf` was silently shadow by
the same function from the module `Expr` of `Dolmen`. The signature of
this latter changed recently. I fix it by using the `with_cache` from
Dolmen. Notice that the hash table of the cache is hidden in the closure
of `with_cache` and `bv2nat` and `int2bv` don't share their cache as
before.
  • Loading branch information
Halbaroth committed Oct 16, 2023
1 parent 03421e1 commit a89b7c9
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 25 deletions.
15 changes: 15 additions & 0 deletions alt-ergo-lib.opam
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,18 @@ license: [
"LicenseRef-OCamlpro-Non-Commercial"
"Apache-2.0"
]

pin-depends: [
[
"dolmen.dev"
"git+https://github.com/Gbury/dolmen.git#8e6887481019978c2ad5be762540c09dc8bc619b"
]
[
"dolmen_loop.dev"
"git+https://github.com/Gbury/dolmen.git#8e6887481019978c2ad5be762540c09dc8bc619b"
]
[
"dolmen_type.dev"
"git+https://github.com/Gbury/dolmen.git#8e6887481019978c2ad5be762540c09dc8bc619b"
]
]
43 changes: 27 additions & 16 deletions alt-ergo-lib.opam.locked
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ This is the core library used in the Alt-Ergo SMT solver.
Alt-Ergo is an automatic theorem prover of mathematical formulas. It was developed at LRI, and is now maintained at OCamlPro.

See more details on http://alt-ergo.ocamlpro.com/"""
maintainer: "Alt-Ergo developers"
authors: "Alt-Ergo developers"
maintainer: "Alt-Ergo developers <[email protected]>"
authors: "Alt-Ergo developers <[email protected]>"
license: ["LicenseRef-OCamlpro-Non-Commercial" "Apache-2.0"]
tags: "org:OCamlPro"
homepage: "https://alt-ergo.ocamlpro.com/"
doc: "https://ocamlpro.github.io/alt-ergo"
bug-reports: "https://github.com/OCamlPro/alt-ergo/issues"
depends: [
"base-bigarray" {= "base"}
"base-bytes" {= "base"}
"base-threads" {= "base"}
"base-unix" {= "base"}
"camlzip" {= "1.11"}
Expand All @@ -26,40 +25,34 @@ depends: [
"conf-pkg-config" {= "3"}
"conf-zlib" {= "1"}
"cppo" {= "1.6.9"}
"csexp" {= "1.5.2"}
"dolmen" {= "0.9"}
"dolmen_loop" {= "0.9"}
"dolmen_type" {= "0.9"}
"dolmen" {= "dev"}
"dolmen_loop" {= "dev"}
"dolmen_type" {= "dev"}
"dune" {= "3.10.0"}
"dune-build-info" {= "3.10.0"}
"dune-configurator" {= "3.10.0"}
"fmt" {= "0.9.0"}
"gen" {= "1.1"}
"js_of_ocaml" {= "5.4.0"}
"js_of_ocaml-compiler" {= "5.4.0"}
"logs" {= "0.7.0"}
"lwt" {= "5.6.1"}
"menhir" {= "20230608"}
"menhirLib" {= "20230608"}
"menhirSdk" {= "20230608"}
"num" {= "1.4"}
"ocaml-compiler-libs" {= "v0.12.4"}
"ocamlbuild" {= "0.14.2"}
"ocamlfind" {= "1.9.6"}
"ocplib-endian" {= "1.2"}
"ocplib-simplex" {= "0.5"}
"pp_loc" {= "2.1.0"}
"ppx_blob" {= "0.7.2"}
"ppx_derivers" {= "1.2.1"}
"ppx_deriving" {= "5.2.1"}
"ppxlib" {= "0.30.0"}
"sedlex" {= "3.2"}
"result" {= "1.5"}
"seq" {= "base"}
"sexplib0" {= "v0.15.1"}
"sexplib0" {= "v0.16.0"}
"spelll" {= "0.4"}
"stdlib-shims" {= "0.3.0"}
"topkg" {= "1.0.7"}
"uutf" {= "1.0.3"}
"yojson" {= "2.1.0"}
"zarith" {= "1.13"}
]
build: [
Expand All @@ -78,4 +71,22 @@ build: [
]
["dune" "install" "-p" name "--create-install-files" name]
]
dev-repo: "git+https://github.com/OCamlPro/alt-ergo.git"
dev-repo: "git+https://github.com/OCamlPro/alt-ergo.git"
conflicts: [
"ppxlib" {< "0.30.0"}
"result" {< "1.5"}
]
pin-depends: [
[
"dolmen.dev"
"git+https://github.com/Gbury/dolmen.git#7c7050bda83a86da7d81c088e4e5eba3cc58b948"
]
[
"dolmen_loop.dev"
"git+https://github.com/Gbury/dolmen.git#7c7050bda83a86da7d81c088e4e5eba3cc58b948"
]
[
"dolmen_type.dev"
"git+https://github.com/Gbury/dolmen.git#7c7050bda83a86da7d81c088e4e5eba3cc58b948"
]
]
15 changes: 15 additions & 0 deletions alt-ergo-lib.opam.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,18 @@ license: [
"LicenseRef-OCamlpro-Non-Commercial"
"Apache-2.0"
]

pin-depends: [
[
"dolmen.dev"
"git+https://github.com/Gbury/dolmen.git#8e6887481019978c2ad5be762540c09dc8bc619b"
]
[
"dolmen_loop.dev"
"git+https://github.com/Gbury/dolmen.git#8e6887481019978c2ad5be762540c09dc8bc619b"
]
[
"dolmen_type.dev"
"git+https://github.com/Gbury/dolmen.git#8e6887481019978c2ad5be762540c09dc8bc619b"
]
]
11 changes: 2 additions & 9 deletions src/lib/frontend/d_cnf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -193,24 +193,17 @@ type _ DStd.Builtin.t +=
(* Internal use for semantic triggers -- do not expose outside of theories *)
| Not_theory_constant | Is_theory_constant | Linear_dependency

let with_cache ~cache f x =
try Hashtbl.find cache x
with Not_found ->
let res = f x in
Hashtbl.add cache x res;
res

module Const = struct
open DE

let bv2nat =
with_cache ~cache:(Hashtbl.create 13) (fun n ->
with_cache (fun n ->
let name = "bv2nat" in
Id.mk ~name ~builtin:(BV2Nat n)
(DStd.Path.global name) Ty.(arrow [bitv n] int))

let int2bv =
with_cache ~cache:(Hashtbl.create 13) (fun n ->
with_cache (fun n ->
let name = "int2bv" in
Id.mk ~name ~builtin:(Int2BV n)
(DStd.Path.global name) Ty.(arrow [int] (bitv n)))
Expand Down

0 comments on commit a89b7c9

Please sign in to comment.