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
Add notations for patterns in [seq ... | ... ]
notations
#790
Conversation
636e71a
to
ecfb8e1
Compare
Apparently there is a conflict in fintype |
I think I need @herbelin 's help in how to factor notations so that they work: Require Import Coq.Lists.List.
Declare Scope seq_scope.
Open Scope seq_scope.
Notation "[ 'seq' E | i <- s ]" := (map (fun i => E) s)
(at level 0, E at level 99, i binder,
format "[ '[hv' 'seq' E '/ ' | i <- s ] ']'") : seq_scope.
Check [seq ?[F] i | i <- ?[enum] ?[P] ].
Reserved Notation "[ 'seq' F | x : T ]"
(at level 0, F at level 99, x ident,
format "'[hv' [ 'seq' F '/ ' | x : T ] ']'").
Check [seq ?[F] i | i <- ?[enum] ?[P] ].
(* Error: Syntax error: ':' expected after [name] (in [term]). *) |
Hi @JasonGross @herbelin any hope to make this PR go forward? |
Hi, At first view, supporting Assuming that there is no easy way to reformulate Hoping that it helps. |
@CohenCyril: we would need your help to know if there is a way to reformulate |
@herbelin What about using the |
I don't know if that'll work. We need |
What about the equivalent of |
(Of course the |
Notation "'type_of' x"
:= match _, (fun x => I) with
| T, f
=> match match f return T -> True with f' => f' end with
| _ => T
end
end
(x binder, only parsing, at level 20).
Check type_of x : nat. (* nat *)
Check type_of '((x, y) : nat * nat). (* (nat * nat)%type *) |
ecfb8e1
to
a56dba3
Compare
Updated PR, seems to be working |
Two issues seem to arise:
at https://github.com/math-comp/multinomials/blob/200ef66f7f892814dc7b9254f4f23bc7f59de093/src/freeg.v#L207 which is Definition predom s: seq K := [seq x.2 | x <- s]. with Variable G : zmodType.
Variable K : choiceType.
Implicit Types s : seq (G * K).
Implicit Types x y : K. The issue is that Coq now infers |
This will hopefully make the monomials package compatible with math-comp/math-comp#790 (see math-comp/math-comp#790 (comment)). Due to a change in how notations are interpreted, Coq will now resolve implicit types on `x` in `[seq _ | x <- _]` before performing unification rather than after, resulting in a type error. So we avoid using variables which have implicit types attached.
Coq 8.11 I think we can do it for the next release, for Coq 8.12 we might have to wait a few more month but eventually yes. |
a56dba3
to
fc51dec
Compare
This will hopefully make the monomials package compatible with math-comp/math-comp#790 (see math-comp/math-comp#790 (comment)). Due to a change in how notations are interpreted, Coq will now resolve implicit types on `x` in `[seq _ | x <- _]` before performing unification rather than after, resulting in a type error. So we avoid using variables which have implicit types attached.
Oops, I closed and reopened to restart the CI, and coqbot removed the 1.15.0 milestone :-( |
@JasonGross mathcomp now requires Coq >= 8.13, does that help here? |
Sorry, this fell off my todo list, I'll try to rebase shortly |
20a01b4
to
85ad786
Compare
I've rebased, but the CI seems extremely unhappy. |
And now there is no CI? |
Companion of math-comp#56, see math-comp#56 for explanation
Overlay for monomials: math-comp/multinomials#73 |
Companion of math-comp#56, see math-comp#56 for explanation
I'm confused by the error in odd-order: I cannot reproduce this locally. Can anyone else reproduce this? |
This allows syntax such as ```coq Check [seq '(x, y) <- List.combine (List.seq 0 5) (List.seq 0 5) | x == y ]. Check [seq x + y | '(x, y) <- List.combine (List.seq 5 5) (List.seq 5 5) ]. ``` to parse and print.
Ah, this only occurs with Coq 8.13. Is odd-order planning to drop support for Coq 8.13 anytime soon? (The rest of the ecosystem seems to build fine.) |
I hope this fixes the last build issue with math-comp/math-comp#790. This change is only needed in Coq 8.13; 8.14 and newer work fine without this change.
Ah, maybe if someone merges math-comp/odd-order#46 then this PR will work (finally) as-is |
* Add notations for patterns in [seq ... ] notations This allows syntax such as ```coq Check [seq '(x, y) <- List.combine (List.seq 0 5) (List.seq 0 5) | x == y ]. Check [seq x + y | '(x, y) <- List.combine (List.seq 5 5) (List.seq 5 5) ]. ``` to parse and print. * Fix fintype
This allows syntax such as
to parse and print.
Motivation for this change
Without this change,
prints as the ugly
instead of the much more understandable
Things done/to do
CHANGELOG_UNRELEASED.md
(do not edit former entries)added corresponding documentation in the headers(Do I need to do this? I think it's not relevant here? Can someone confirm?)Automatic note to reviewers
Read this Checklist and make sure there is a milestone.