Skip to content

Fixed the infamous %E scope bug#1869

Open
CohenCyril wants to merge 1 commit intomath-comp:masterfrom
CohenCyril:scope_bug
Open

Fixed the infamous %E scope bug#1869
CohenCyril wants to merge 1 commit intomath-comp:masterfrom
CohenCyril:scope_bug

Conversation

@CohenCyril
Copy link
Member

@CohenCyril CohenCyril commented Mar 2, 2026

Motivation for this change

Fixes #1476

Checklist
  • added corresponding entries in CHANGELOG_UNRELEASED.md
  • added corresponding documentation in the headers

Reference: How to document

Merge policy

As a rule of thumb:

  • PRs with several commits that make sense individually and that
    all compile are preferentially merged into master.
  • PRs with disorganized commits are very likely to be squash-rebased.
Reminder to reviewers

@CohenCyril CohenCyril force-pushed the scope_bug branch 3 times, most recently from 7f1dfca to 3986afe Compare March 3, 2026 12:09
@CohenCyril
Copy link
Member Author

CohenCyril commented Mar 3, 2026

All good, I can compile reals/signed.v on my own computer, provided unstable.v was compiled before. Not sure why this is not picked up correctly by the Makefile... The issue is unrelated anyway and the impact of this PR is real (pun intended)

Copy link
Member

@affeldt-aist affeldt-aist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! And I know that I am asking too much, but, since the Elpi code is so short, would it be possible to have a few lines of prose commentary? I'm sure readers more literate than me could make a good use of it. 🐱

Comment on lines +595 to +627
(* We provide local notations for parsing and printing of particular *)
(* instances of generic notations. *)
Local Notation add_parsingde := (@GRing.add (\bar^d _)).
Local Notation add_rcde := (@GRing.add (@reverse_coercion _ _ _ (\bar^d _))).
Local Notation add_cande := (@GRing.add dual_extended_nmodType).
Local Notation add_parsinge := (@GRing.add (\bar _)).
Local Notation add_rce := (@GRing.add (@reverse_coercion _ _ _ (\bar _))).
Local Notation add_cane := (@GRing.add extended_nmodType).

Notation "+%dE" := add_parsingde (only parsing).
Notation "+%dE" := add_rcde (only printing).
Notation "+%dE" := add_cande (only printing).
Notation "+%E" := add_parsinge (only parsing).
Notation "+%E" := add_rce (only printing).
Notation "+%E" := add_cane (only printing).
Notation "-%E" := oppe.
Notation "x + y" := (add_parsingde x%dE y%dE) (only parsing) : ereal_dual_scope.
Notation "x + y" := (add_rcde x%dE y%dE) (only printing) : ereal_dual_scope.
Notation "x + y" := (add_cande x%dE y%dE) (only printing) : ereal_dual_scope.
Notation "x + y" := (add_parsinge x%E y%E) (only parsing) : ereal_scope.
Notation "x + y" := (add_rce x%E y%E) (only printing) : ereal_scope.
Notation "x + y" := (add_cane x%E y%E) (only printing) : ereal_scope.
Notation "x - y" := (add_parsingde x%dE (oppe (y%dE : \bar^d _))%dE)
(only parsing) : ereal_dual_scope.
Notation "x - y" := (add_rcde x%dE (oppe y%dE))
(only printing) : ereal_dual_scope.
Notation "x - y" := (add_cande x%dE (oppe y%dE))
(only printing) : ereal_dual_scope.
Notation "x - y" := (add_parsinge x%E (oppe y%E)) (only parsing) : ereal_scope.
Notation "x - y" := (add_rce x%E (oppe y%E)) (only printing) : ereal_scope.
Notation "x - y" := (add_cane x%E (oppe y%E)) (only printing) : ereal_scope.
(* All previous notations should ideal by generated too, *)
(* but elpi lacks support for string notations. *)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the issue should be this and on coq-elpi

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

Labels

emergency 🚑 This must be fixed ASAP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extended reals notations shows up unexpectedly

2 participants