Maybe the usual question: why are there assert
and have
which seem to do rather similar things. How to explain a user how to choose?
One is default coq the other ssreflect 0:-)
You mean like emacs and vi, Proof General and coqide?
Basically have
has many more features than assert
, and assert
has nothing over have
as far as I can tell. If it was for me I'd just deprecate assert
On the other hand assert does one thing and does it well so is in a sense more reliable. Many bigger proof scripts might require that. I don't know if "have" can fill the same role and I also don't know if people are willing to rely on ssreflect to use it.
So I guess to answer Hugo's question fully: assert
can be used, but is more simple. have
is a cleverer version which can do all sorts of fancy things too that you might like.
In what sense is more reliable? have
can do the exact thing that assert, in fact it has some extensions that once you are used to them, you can never go back to assert
currently assert
supports strict propositions while have
does not yet
I don't know if eassert
is a thing
FTR simple tactics are important for efficiency of proof scripts
like, you want both a swiss knife and a spoon
You mean @Pierre-Marie Pédrot like the 50% speedup people saw in some projects when switching from Coq's rewrite to ssreflect rewrite?
rewrite is another beast
have has more features but it doesn't make it slower per-se
precisely, the vanilla Coq rewrite is too clever for its own good
feel free to bench, but I guess they should be equivalent
no, it's not about that
already Assia's example would be much more painful for me to write with assert
it's about having access to low-level primitives you know what they do
ssr asser is doing random stuff with patterns and whatnot IIRC
When I'm writing proofs I don't care that at all
I know what have does
making my life much better
you're missing the point
I don't see where the mistery in in have H : T.
Because it has more features, features that I can't live without
because it has to compute evars, solve stuff and decide accordingly
when the low-level assert is mostly O(1)
Yes and that's essential
not for all use-cases
If that were a need have would have a flag to do that
no!
flags are bad
they don't compose well
bah that's FUD evidence strongly suggests otherwise
once again, no
I don't know anyone who would prefer assert after having used have
a lot of the contraptions developed by @Jason Gross are trying to work around the built-in cleverness of tactics
you're missing the point, again
you are maybe talking about destruct
neither
have is not "clever"
it just has more features
it is
in which way it is "clever"
@Emilio Jesús Gallego Arias We aren't suggesting you use assert everywhere, have is definitely an improvement on the user side. If I have a big fancy proof script that uses assert rather than have, now adding features to have can make that script break. assert on the other hand has a very clear function.
the context is Ltac scripts, not proofs
have also has a very clear function, how is have H : T
not clear?
because it computes more stuff and is not O(1)
Pierre-Marie Pédrot said:
the context is Ltac scripts, not proofs
LTAC is a terrible thing I'm not gonna accept it as evidence :)
whatever
when writing OCaml tactics that's the same
What was claimed was
you don't want to call ssr
or Coq's assert either actually
that assert is more reliable; modulo the SProp bug
you want the low-level stuff that tells you "just push that into the env"
there is not evidence for that
Pierre-Marie Pédrot said:
or Coq's assert either actually
exactly
that point I buy
and agree
but Coq assert is more predictible
in what sense?
show me an example where it is
performance !
ssr assert does a lot of stuff behind the scenes
we are talking about what?
2 milliseconds?
no!
it saves me hours per week
then what's the performance delta @Pierre-Marie Pédrot ?
you're missing the point, again
Doing have 1000 times in a proof script will mean a 2second increase for 2 millisecond differences
this
Pierre-Marie Pédrot said:
this
didn't you just said that assert shouldn't be used in that case?
and it's not linear because it depends on the size of the term and whatnot
I think assert
is also more predictable in the shape of the goal it produces. ssrtactics (including have
) turn TC instances that couldn't be found into quantifiers. assert
simply complains about them missing instead of giving a goal that looks different than what you expected.
Coq's assert is dumber than ssr have
dumb != worse
I'm talking about a human using a tactic
proof automation is a completely different beast
which is precisely you missing the point
and the least of my worries would be assert vs have
Nobody here is claiming that assert is better than have for a user
I would worry more to start with about the engine taking a linear amount of memory on the number of proof steps
we are just refuting you saying "lets get rid of assert we have have"
assert has uses that have cannot fulfill nor should it need to
this tension is pervasive, even within Coq tactics
ssr is leaning by design towards expressivity and human proofs
in Coq's tactics we have a hodgepodge of both approaches
in part because of stupid syntactic considerations mostly Ltac-specific
Anyways I should know better than to take the bait, sorry folks :)
:-)
For me the original "How to explain a user how to choose?" was understood as a user writing a proof like the one shown here
Emilio Jesús Gallego Arias said:
I don't know if
eassert
is a thing
Yes, it exists.
As said in another post (which now moved in another thread), discussing about have
vs assert
from a user point of view is a trap, as if we were customers of Coq while we are actually developers of Coq. The real question is about where we want to put our energy and I don't think that we can go anywhere interesting by using our energy in non-concluding flames rather than trying to gather the best of what we know to do, necessary step to go beyond what we currently exists and not be stuck.
I think that one misconception here is that basic tactics, like assert or have, have been given the status of "basic building blocks" for larger pieces of automation. They are not designed for that, even assert is too high level and has too few flags. It is better explained on other tactics, like ring: when writing proof automation I'd better know if the tactic failed because the goal is outside the supported domain, or because the goal is false. Running the tactic and try something else on failure is not a nice API.
So IMO you should not compare have and assert on that respect, they both suck IMO for that purpose.
Not just for automation, @Enrico Tassi , but also for Defined
terms. I've seen sometimes that translating a proof script from plain ltac to ssreflect sometimes introduces extra noise.
I agree, there is little care in ssr into making proof terms nice, it is not really an objective of ssr.
Enrico Tassi said:
I agree, there is little care in ssr into making proof terms nice, it is not really an objective of ssr.
That could precisely be a point where the two implementations could learn the one from the others :)
It seems from this discussion that "user" is not uniquely defined :wink:. Maybe we should partition users by class (e.g "ltac users" vs "human readable scripts don't care about the term" vs "human readable scripts and terms"), dispatch all existing tactics in these groups, deprecate the ones that are subsumed by another in any of these classes and then write one doc per class?
And then, only then we can work on a minimal covering
Well, computer power doubles every few months while brains are mostly the same since hundred of thousands of years -- I say: let the computers cope with big terms and prefer readable proofs!
I can understand that the core team is concerned with tactic languages (or proof languages) working well. But should individual tactics really be a focus for core?
@Julien Puydt humans must cope with Defined
terms.
@Julien Puydt and computer power can't solve exponential problems like those from Coq... (Technically, you also have O(n^6) problems, and superexponential ones).
Last updated: Oct 03 2023 at 04:02 UTC