Skip to content

Commit

Permalink
Add zarith in opam file + some misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gbury committed Sep 11, 2024
1 parent c3c571b commit 9419ec5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 29 deletions.
1 change: 1 addition & 0 deletions dolmen_loop.opam
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ depends: [
"dolmen_type" {= version }
"dune" { >= "3.0" }
"gen"
"zarith" { >= "1.10" }
"pp_loc" { >= "2.0.0" }
"odoc" { with-doc }
"mdx" { with-test & >= "2.0.0" }
Expand Down
27 changes: 13 additions & 14 deletions src/languages/smtlib2/poly/print.ml
Original file line number Diff line number Diff line change
Expand Up @@ -520,18 +520,7 @@ module Make
(* Matching *)
match V.Term.Cst.builtin head with

(* Base + Algebraic datatypes *)
| B.Base ->
begin match find_named env head with
| None ->
let poly () = if term_cst_poly env head then Some t_ty else None in
p ~poly Term (Env.Term_cst.name env head)
| Some expr ->
assert (args = []);
let f_id = Dolmen_std.Id.create Term (Env.Term_cst.name env head) in
Format.fprintf fmt "(! %a@ :named %a)"
(term env) expr (id ~allow_keyword:false env) f_id
end
(* Algebraic datatypes *)
| B.Constructor _ | B.Destructor _ ->
let poly () = if term_cst_poly env head then Some t_ty else None in
p ~poly Term (Env.Term_cst.name env head)
Expand Down Expand Up @@ -748,8 +737,18 @@ module Make
| B.Re_power n -> p Term (N.indexed "re.^" [int n])
| B.Re_loop (n1, n2) -> p Term (N.indexed "re.loop" [int n1; int n2])

(* fallback *)
| _ -> _cannot_print "unknown term builtin"
(* generic case + fallback *)
| B.Base | _ ->
begin match find_named env head with
| None ->
let poly () = if term_cst_poly env head then Some t_ty else None in
p ~poly Term (Env.Term_cst.name env head)
| Some expr ->
assert (args = []);
let f_id = Dolmen_std.Id.create Term (Env.Term_cst.name env head) in
Format.fprintf fmt "(! %a@ :named %a)"
(term env) expr (id ~allow_keyword:false env) f_id
end

and letin env fmt (l, body) =
(* reset some env state *)
Expand Down
29 changes: 14 additions & 15 deletions src/languages/smtlib2/v2.6/script/print.ml
Original file line number Diff line number Diff line change
Expand Up @@ -525,19 +525,7 @@ module Make
(* Matching *)
match V.Term.Cst.builtin head with

(* Base + Algebraic datatypes *)
| B.Base ->
begin match find_named env head with
| None ->
let poly () = if term_cst_poly env head then Some t_ty else None in
let h = Env.Term_cst.name env head in
p ~poly Term h
| Some expr ->
assert (args = []);
let f_id = Dolmen_std.Id.create Term (Env.Term_cst.name env head) in
Format.fprintf fmt "(! %a@ :named %a)"
(term env) expr (id ~allow_keyword:false env) f_id
end
(* Algebraic datatypes *)
| B.Constructor _ | B.Destructor _ ->
let poly () = if term_cst_poly env head then Some t_ty else None in
p ~poly Term (Env.Term_cst.name env head)
Expand Down Expand Up @@ -754,8 +742,19 @@ module Make
| B.Re_power n -> p Term (N.indexed "re.^" [int n])
| B.Re_loop (n1, n2) -> p Term (N.indexed "re.loop" [int n1; int n2])

(* fallback *)
| _ -> _cannot_print "unknown term builtin"
(* generic case + fallback *)
| B.Base | _ ->
begin match find_named env head with
| None ->
let poly () = if term_cst_poly env head then Some t_ty else None in
let h = Env.Term_cst.name env head in
p ~poly Term h
| Some expr ->
assert (args = []);
let f_id = Dolmen_std.Id.create Term (Env.Term_cst.name env head) in
Format.fprintf fmt "(! %a@ :named %a)"
(term env) expr (id ~allow_keyword:false env) f_id
end

and letin env fmt (l, body) =
(* reset some env state *)
Expand Down

0 comments on commit 9419ec5

Please sign in to comment.