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

Port Coq code to use done tactic instead of easy and benchmark #128

Open
palmskog opened this issue Jul 9, 2024 · 4 comments
Open

Port Coq code to use done tactic instead of easy and benchmark #128

palmskog opened this issue Jul 9, 2024 · 4 comments

Comments

@palmskog
Copy link
Member

palmskog commented Jul 9, 2024

Math Classes currently uses the easy tactic from Coq's standard library as a finisher tactic to close a goal. However, easy is known to be slow, most directly because it uses inversion. For example, it can be slow when there are inductives with many constructors in the proof context.

An alternative to easy is the done tactic from Coq-Std++, which does not use inversion, and incorporates best practices from the MathComp done tactic. Math Classes could likely benefit from being ported to use done instead of easy, which would be a good project for a first-time contributor. There should be benchmarks with and without done to measure the improvements.

The port should not necessarily make Math Classes depend on Coq-Std++, but could bundle the done tactic.

@ndcroos
Copy link

ndcroos commented Jul 27, 2024

Hello, I'd like to work on this issue. Could you assign to to me please?

@palmskog
Copy link
Member Author

@ndcroos in all but the most active projects, we don't really do GitHub assignments for issues. Typically, an OK from the maintainers (@spitters or @Lysxia) is enough. For example, it's probably not convenient to let the project depend directly on MathComp or Coq-Std++, so the done tactic would have to be copied over.

@ndcroos
Copy link

ndcroos commented Jul 27, 2024

I will wait for an OK by the maintainers before doing anything.

There is also fast_done in Coq-Std++.
https://gitlab.mpi-sws.org/iris/stdpp/-/blob/master/stdpp/tactics.v?ref_type=heads#L45

(** [done] can get slow as it calls "trivial". [fast_done] can solve way less
goals, but it will also always finish quickly.  We do 'reflexivity' last because
for goals of the form ?x = y, if we have x = y in the context, we will typically
want to use the assumption and not reflexivity *)
Ltac fast_done :=
  solve
    [ eassumption
    | symmetry; eassumption
    | apply not_symmetry; eassumption
    | reflexivity ].
Tactic Notation "fast_by" tactic(tac) :=
  tac; fast_done.

The idea is to use fast_done where possible, and done where fast_done fails.

@spitters
Copy link
Collaborator

spitters commented Jul 27, 2024 via email

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

No branches or pull requests

3 participants