Definition lattop {A} `{Lattice A} : A :=
fun (a b : A) => meet a b.
Error message: The type of this term is a product while it is expected to be A
.
Questions:
Pi
? product
in the sense that a lambda is an exponential which is a special case of a product? does this mean product as in dependent product as in Pi?
yes
on point “3”: Probably not ideal, I’ve also noticed it before negatively. @Jim Fehrle might have insights.
on point 2: “Pis” are called products because Pi (x : A) -> B x
is equivalent to the product of B x_1
, B x2
, …, B x_n
, … for all elements x_i
of A
.
I agree, "product" in that error message also makes me think of pairs before functions. I would find it clearer to say something like "this term is a function (of type "forall a ...") while it is expected to be of type A".
@Paolo Giarrusso that's what I meant by "in the sense that a lambda is an exponential which is a special case of a product"
@Paolo Giarrusso I know very little about this. It would be good to add the message to the documentation. A cursory search of the source code shows it is one of about 20 pretyping errors. For that matter, the documentation should say something about pretyping! cc: @Théo Zimmermann
FWIW, always feel free to open issues on GitHub for error messages that could be improved and / or documented.
@Jim Fehrle Today, I would say that pretyping is a mostly internal name (internal in the same sense as vernac, constr, etc.) for something that is called "elaboration" in user-facing documentation (https://coq.inria.fr/refman/language/extensions/index.html). Yes, we should add more documentation on some aspects of elaboration, in particular on unification. Some documentation of unification has been written by @Hugo Herbelin as part of https://github.com/coq/ceps/pull/59. It would be good if it could eventually end up in the refman (at least for the parts that are most relevant to the users), probably as a new sub-chapter of the "Language extensions" chapter.
I always thought of pretyping as "one of the main steps in Coq's implementation of elaboration" (which nearly every proof assistant does, i.e., nearly every proof assistant has elaboration)
OK, then the doc should mention that pretyping is part of elaboration. Also elaboration should be in the glossary.
Why should it mention the pretyping? The error message never says it's about pretyping does it?
The doc should mention the term for the benefit of those who read the source code.
Oh I see.
The doc should mention the term for the benefit of those who read the source code.
Why not but then the same reasoning could be done on other internal terms like vernac, which we've recently removed from the refman...
I guess an "internals" glossary would need to be larger
Anyway, I tagged @Jim Fehrle because I guessed that error messages fall into a bucket close to the manual.
And the language should be consistent.
it would make sense to have the doc mention the phase separation in elaboration: first intern then "pretyping" (tbh I would like to find a good name to rename pretyping to)
this is sometimes relevant, eg Ltac foo := exact c.
will intern c
but only pretypes when running the tactic, which means notations are resolved at Ltac definition time but it uses the coercions available at tactic execution time.
Indeed, phase separation is crucial at other points too.
Eg, parsing comes before notation scopes are resolved (including Bind Scope), which comes before any actual typechecking; at least AFAICT from blackbox testing.
Andrej Bauer had a nice abstract breakdown of vernacular -[elboration]-> formalism -[verification]-> kernel at http://math.andrej.com/asset/data/the-dawn-of-formalized-mathematics.pdf#page=23
Emilio summarized Coq's elaboration here: https://github.com/ejgallego/coq-serapi/blob/v8.13/FAQ.md#how-many-asts-does-coq-have
Why not but then the same reasoning could be done on other internal terms like vernac, which we've recently removed from the refman...
I consider each term on a case-by-case basis. Pretyping is one of the main steps of elaboration, so naming it will be helpful in the exposition of elaboration. "Vernac" didn't appear to be as useful a concept. If you or others want to include "vernac" in the doc, I'm openminded.
Not my point. This was a reply to your suggestion that we needed to "mention the term for the benefit of those who read the source code".
Documenting pretyping as a phase in elaboration is also beneficial for users who want to understand how Coq works without reading the source code. Like Gaëtan, I am not so fond of the name. But if we don't have a good replacement, we can keep it.
"interpretation" is used in a few places (INTERPRETED BY)
using this would mean renaming interp/, which considering it seems to be more appropriately named intern/ should not be a problem
https://github.com/coq/coq/pull/15158
EDIT: how does pretyping relate to type inference?
they are similar concepts, but pretyping is defined by the code organization whereas you could include things like implicit argument insertion in inference
I was wondering if more conventional terms could suffice, or if Coq-specific jargon is necessary…
A benefit of “pretyping” seems that it can’t be misunderstood by, say, a POPL audience, while interpretation likely would be misunderstood (without some context)
Last updated: Sep 30 2023 at 05:01 UTC