Skip to content
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

Dual ereal #374

Merged
merged 4 commits into from
Nov 4, 2021
Merged

Dual ereal #374

merged 4 commits into from
Nov 4, 2021

Conversation

proux01
Copy link
Collaborator

@proux01 proux01 commented May 4, 2021

In Coquelicot, -oo + +oo was defined as 0, which was nice for morphisms with opposite but terrible as addition was not even associative. In ereal.v, the addition adde is such that -oo + +oo = -oo, making it associative an such that (er R, Order.max, adde) is a semiring (the id element -oo of Order.max is a zero for adde). However, sometimes we rather need (er R, Order.min, adde) to be a semiring, with -oo + +oo = +oo. This PR offers that, I don't know if we want it in analysis?

depends on: #403 (merged)

@CohenCyril
Copy link
Member

I'd rather keep extended reals a commutative monoid (which was the case before this PR), this is crucial for taking maximal advantage of bigops.

@proux01
Copy link
Collaborator Author

proux01 commented May 4, 2021

I fully agree, this PR doesn't change anything about extended reals, just offers dual extended reals where -oo++oo = +oo instead of -oo.

@CohenCyril
Copy link
Member

Sorry, I misunderstood your original post and did not open the diff. It seems reasonable to me although:

  • I cannot foresee a use yet (could you point me towards a concrete example)
  • I would not integrate this within the same scope and same names. We could use for example %dE (for "dual Extended") an the names could be prefixed with dual_?

@CohenCyril
Copy link
Member

CohenCyril commented May 4, 2021

Also, I would integrate it within ereal.v

@proux01
Copy link
Collaborator Author

proux01 commented May 4, 2021

  • I cannot foresee a use yet (could you point me towards a concrete example)

We use it in a formalization of Network Calculus (a static analysis for networks, used to certify embedded networks in civil aircrafts) that is based on min-plus algebra. Sorry, can't share the code yet due to licencing issues (hope to finally fix that in the coming weeks).

  • I would not integrate this within the same scope and same names. We could use for example %dE (for "dual Extended") an the names could be prefixed with dual_?

Would indeed make sense to enable mix use of both regular and dual versions (no idea if that can arise though).

@CohenCyril
Copy link
Member

Would indeed make sense to enable mix use of both regular and dual versions (no idea if that can arise though).

I think it can... and I forgot about providing correspondance lemmas under the negation add_undef precondition.
(Although we might very well switch to add_def as per #365)

theories/ereal.v Show resolved Hide resolved
theories/ereal.v Outdated Show resolved Hide resolved
theories/ereal.v Outdated Show resolved Hide resolved
theories/ereal.v Outdated Show resolved Hide resolved
theories/ereal.v Outdated Show resolved Hide resolved
theories/ereal.v Outdated Show resolved Hide resolved
@proux01 proux01 force-pushed the dual-ereal branch 5 times, most recently from 5813096 to 739a1a9 Compare May 6, 2021 14:25
@proux01
Copy link
Collaborator Author

proux01 commented May 6, 2021

@CohenCyril all your comments should be taken into account.

@proux01
Copy link
Collaborator Author

proux01 commented Aug 13, 2021

This is rebased on top of #403, dual_mule disappeared since it is now the same as mule.

@proux01
Copy link
Collaborator Author

proux01 commented Sep 28, 2021

Just rebased this on top of master now that #403 is merged.

@proux01
Copy link
Collaborator Author

proux01 commented Sep 29, 2021

@CohenCyril all notation seem to work properly (for instance x + y <= -(x + y))%dE uses dual_adde as expected and prints back identically), I just spotted an omission int the bigop notations and +? was missing in ereal_dual_scope.

theories/ereal.v Outdated Show resolved Hide resolved
@proux01
Copy link
Collaborator Author

proux01 commented Oct 29, 2021

@CohenCyril I'd like to rebase this on top of #459 once it is merged (to add lemmas about mine, the dual of maxe)

@CohenCyril
Copy link
Member

@CohenCyril I'd like to rebase this on top of #459 once it is merged (to add lemmas about mine, the dual of maxe)

Sure. I also think that the new convention is to use forall x : \bar R, x \in fin_num -> P x rather than forall r : R, P r%:E.
I also think theorems about dual ereal should be encapsulated in a submodule and imported on demand.

@proux01
Copy link
Collaborator Author

proux01 commented Nov 2, 2021

Indeed, done, this should now be ready.

BTW, this dual add thing is used there: https://gitlab.mpi-sws.org/proux/nc-coq
I wanted to do opam and nix packages for CI when I realized I'm still using dioid master that relies on a nasty hack to use HB on top of current MC https://github.com/math-comp/dioid/blob/master/HB_wrappers.v . So I should probably wait for MC 2.0.

@proux01 proux01 force-pushed the dual-ereal branch 2 times, most recently from f638570 to 29f335b Compare November 3, 2021 13:16
Copy link
Member

@CohenCyril CohenCyril left a comment

Choose a reason for hiding this comment

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

Ok, thanks!, let's rebase and merge.

@proux01
Copy link
Collaborator Author

proux01 commented Nov 4, 2021

rebased

@CohenCyril CohenCyril merged commit 2f2359f into math-comp:master Nov 4, 2021
@proux01
Copy link
Collaborator Author

proux01 commented Nov 5, 2021

Thanks!

@proux01 proux01 deleted the dual-ereal branch November 5, 2021 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants