In the following snippet of Coq code (cut down from a real example), I'm trying to declare the first argument to exponent_valid as implicit:
Require Import ZArith.
Open Scope Z.
Record float_format : Set := mk_float_format {
minimum_exponent : Z
}.
Record float (fmt : float_format) : Set := mk_float {
exponent : Z;
exponent_valid : minimum_exponent fmt <= exponent
}.
Arguments exponent_valid {fmt} _.
As I understand it, the exponent_valid function takes two arguments: one of type float_format and one of type float, and the first can be inferred. However, compiling the above snippet fails with the following error message:
File "/Users/mdickinson/Desktop/Coq/floats/bug.v", line 13, characters 0-33:
Error: The following arguments are not declared: _.
And indeed, changing the Arguments declaration to:
Arguments exponent_valid {fmt} _ _.
makes the error message go away.
That's okay; I'm a relative newcomer to Coq and I can well believe that I've overlooked something. But now for the bit that's really confusing me: if I replace the <= in the definition of exponent_valid with a <, the code compiles without error!
I have two questions:
- Why do I need an extra
_in the first case ? - Why does replacing
<=with<make a difference to the number of parameters expected byexponent_valid?
In case it's relevant, I'm working with Coq 8.4pl5.