Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of the legacy frontend finally! #1251

Merged
merged 12 commits into from
Oct 8, 2024
Merged

Conversation

Halbaroth
Copy link
Collaborator

@Halbaroth Halbaroth commented Oct 7, 2024

This PR removes:

  • the deprecated legacy frontend (parser and typechecker),
  • the deprecated AB-Why3 plugin which depends on the legacy parser,
  • the associated opam packages and dependencies (including shell.nix
    and our Makefile),
  • all the reference in the documentation to these features,
  • simplify gentest and rename the tag dolmen and models into default in tests/ and
    remove it when it is useless,
  • the option frontend in Options.

We keep the --frontend option but now it is a no op command and we
output an appropriate message if users still use it.

This PR removes:
- the deprecated legacy frontend (parser and typechecker),
- the deprecated AB-Why3 plugin which depends on the legacy parser,
- the associated opam packages and dependencies (including `shell.nix`
  and our Makefile),
- all the reference in the documentation to these features,
- simplify `gentest` and rename the tag `dolmen` into `cdcl` in `tests/` and
  remove it when it is useless,
- the option `frontend` in `Options`.

I also update the `Lib_usage` example because we now use Dolmen.

We keep the `--frontend` option but now it is a no op command and we
output an appropriate message if users still use it.
@Halbaroth Halbaroth force-pushed the die-die-die branch 2 times, most recently from 5592515 to 6405283 Compare October 8, 2024 09:36
@Halbaroth Halbaroth marked this pull request as ready for review October 8, 2024 09:36
@Halbaroth
Copy link
Collaborator Author

I rollbacked modifications I have done in the tests directory and gentest script. I merged models and dolmen into an new default tag.

Notice that the +2662 comes from the fact I rename D_cnf into Cnf. There is absolutely no new line in this file but Github didn't manage to produce a proper diff. This happens also for some test files.

Copy link
Collaborator

@bclement-ocp bclement-ocp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels good to finally see this go!

Notice that the +2662 comes from the fact I rename D_cnf into Cnf. There is absolutely no new line in this file but Github didn't manage to produce a proper diff. This happens also for some test files.

Hm that is unfortunate. I think this is because the Cnf module already exists before this PR. It's not only a (minor) issue for viewing the PR but I think it will also mess up git facilities for tracking a specific line across renames, I'd prefer if we could work around it.

Anyways this module should not be called Cnf because it doesn't actually perform anything related to CNF-conversion (and the previous Cnf module did not either). What about calling it Convert or Translate instead? This would make more sense and also solve the +2k issue.

Comment on lines 1188 to 1191
let set_frontend _ = () in

let set_frontend =
Term.(const set_frontend $ frontend)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let set_frontend _ = () in
let set_frontend =
Term.(const set_frontend $ frontend)
let set_frontend =
Term.(const ignore $ frontend)

removes one level of indirection for the reader

@@ -619,7 +619,7 @@ module Main_Default : S = struct
| Unknown ->
(* In the current implementation of optimization, the function
[CC_X.optimizing_objective] cannot fail to optimize the objective
function [obj]. First of all, the legacy parser only accepts
function [obj]. First of all, the parser only accepts
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is false given that #898 works. I think it's fine to say that CC_X.optimizing_objective is required to actually optimize the objective function as an internal invariant and raise an internal error here if it fails.

Copy link
Collaborator Author

@Halbaroth Halbaroth Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, this documentation is outdated. I will update it now. Notice that the point of this comment was not to explain we have not implemented the feature for some theory but our implementation of optimizing_objective for the Int and Real theories will always produce an answer even if this answer is not correct. Calling optimizing_objective on a split involving unsupported theory will produce None:

  • None means that no theory knows how to optimize this value,
  • Unknown means the split has no already be optimized.

I will clarify this point in the documentation of Rel.optimizing_objective.

Comment on lines 1 to 7
(set-logic ALL)
(set-option :produce-models true)
(declare-const x (_ BitVec 8))
(declare-const y (_ BitVec 8))
(assert (= x (bvxor #b10100101 y)))
(check-sat)
(get-model)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is duplication with bvxor-1.default.smt2 (same for many others); is it intended?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, I duplicate some tests by accident as you can see with my last commit. I removed it.

Copy link
Collaborator

@bclement-ocp bclement-ocp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there are still some duplicated tests — everything else is OK!

Comment on lines 1 to 11
(set-option :produce-models true)
(set-logic ALL)
(declare-datatypes ((data1 0) (data2 0)) (
((cons1 (d1 data1)) (cons2 (d2 data2)))
((cons3 (d3 data1)) (cons4 (d4 Int) (d5 Int) (d6 Bool))
(cons5 (d7 Bool)))
))
(declare-const a data1)
(assert ((_ is cons1) a))
(check-sat)
(get-model)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there are still duplicates (with small.default.smt2)?

Copy link
Collaborator

@bclement-ocp bclement-ocp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hate to be a bother but there are still duplicate tests 😅

I think the following should solve it:

$ find tests -name '*.default.smt2' -exec sh -c 'rm -f ${0%.default.smt2}.smt2' {} \;
$ find tests -name '*.default.ae' -exec sh -c 'rm -f ${0%.default.ae}.ae' {} \;
$ find tests -name '*.default.expected' -exec sh -c 'rm -f ${0%.default.expected}.expected' {} \;

@Halbaroth
Copy link
Collaborator Author

Done!

bclement-ocp
bclement-ocp previously approved these changes Oct 8, 2024
Copy link
Collaborator

@bclement-ocp bclement-ocp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And with that the net difference is over 10k lines removed 🎉

(Although it was already over 9000)

@bclement-ocp bclement-ocp dismissed their stale review October 8, 2024 16:13

719.err is stlil duplicate!

Comment on lines 1 to 19
(set-logic ALL)
(set-option :produce-models true)
(declare-const a (Array Int Int))
(declare-const s Int)
(assert (and (<= 0 s) (<= s 10)))
(assert (forall ((k Int)) (=> (and (<= 0 k) (< k s)) (<= (select a k) (select a s)))))
(assert (forall ((k Int)) (=> (and (< s k) (<= k 10)) (<= (select a s) (select a k)))))
(assert (
forall ((p Int) (q Int))
(=> (and (<= 0 p) (< p q) (<= q (- s 1))) (<= (select a p) (select a q)))))
(assert (
forall ((p Int) (q Int))
(=> (and (<= (+ s 1) p) (< p q) (<= q 10)) (<= (select a p) (select a q)))))
(assert (not (
forall ((p Int) (q Int))
(=> (and (<= 0 p) (< p q) (<= q 10)) (<= (select a p) (select a q))))))
(check-sat)
(get-model)
; (get-model) should fail because the problem is UNSAT.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one is the last duplicate actually which was not caught by the script because the new file is called .default.err (and not err.default)!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH

Copy link
Collaborator

@bclement-ocp bclement-ocp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving conditionally to the removal of 719.err ; you can click the big green button once that one is removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants