Skip to content

feat(Algebra/Module/ZLattice): align ZSpan.floor to Int.floor API#33746

Open
ster-oc wants to merge 12 commits intoleanprover-community:masterfrom
ster-oc:zspan-floor-ceil-add
Open

feat(Algebra/Module/ZLattice): align ZSpan.floor to Int.floor API#33746
ster-oc wants to merge 12 commits intoleanprover-community:masterfrom
ster-oc:zspan-floor-ceil-add

Conversation

@ster-oc
Copy link
Contributor

@ster-oc ster-oc commented Jan 8, 2026

This PR adds some of the existent lemmas about Int.floor, Int.ceil and Int.fract to the ZSpan namespace.


Open in Gitpod

@github-actions github-actions bot added new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-algebra Algebra (groups, rings, fields, etc) labels Jan 8, 2026
@github-actions
Copy link

github-actions bot commented Jan 8, 2026

PR summary f7ee1844c2

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ ceil_add_coe
+ ceil_coe_add
+ ceil_eq_iff
+ ceil_eq_on_vadd_fundamentalDomain
+ ceil_eq_self_iff_mem
+ ceil_eq_zero_iff
+ ceil_sub_coe
+ ceil_zero
+ floor_add_fract
+ floor_add_zSpanCast
+ floor_coe_add
+ floor_eq_iff
+ floor_eq_on_vadd_fundamentalDomain
+ floor_eq_self_iff_mem
+ floor_eq_zero_iff
+ floor_fract
+ floor_sub_coe
+ floor_zero
+ fract_add
+ fract_add_coe
+ fract_add_floor
+ fract_coe_add
+ fract_eq_iff
+ fract_eq_zero_iff
+ fract_ext
+ fract_floor
+ fract_ne_zero_iff
+ fract_neg_eq_zero
+ fract_sub_self
+ fract_zSpanCast
+ fract_zero
+ mem_neg_fundamentalDomain
+ mem_vadd_fundamentalDomain
+ mem_vadd_neg_fundamentalDomain
+ preimage_ceil_singleton
+ preimage_floor_singleton
+ self_sub_floor
+ self_sub_fract
- Zlattice.FG
- ceil_eq_self_of_mem
- floor_eq_self_of_mem
- fract_add_ZSpan
- fract_apply
- fract_zSpan_add

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for scripts/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions
Copy link

github-actions bot commented Jan 8, 2026

✅ PR Title Formatted Correctly

The title of this PR has been updated to match our commit style conventions.
Thank you!

@ster-oc ster-oc changed the title feat(Algebra/Module/ZLattice) : add lemma floor b (m + x) = m + floor b x and similar feat(Algebra/Module/ZLattice): add lemma floor b (m + x) = m + floor b x and similar Jan 8, 2026
@joelriou joelriou added the awaiting-author A reviewer has asked the author a question or requested changes. label Feb 1, 2026
@ster-oc ster-oc force-pushed the zspan-floor-ceil-add branch from a5d9ba1 to 224da71 Compare February 6, 2026 12:56
@ster-oc
Copy link
Contributor Author

ster-oc commented Feb 6, 2026

@joelriou thanks for the review!

I called them floor_mem_add and floor_add_mem to highlight on which side the member of the lattice is, otherwise the name would have been the same.

This branch grew a bit locally. I ended up adding some other lemmas, relaxed the hypotheses to [Ring K] here and there, and some other minor fixes. Should I push the branch here and change the name of the PR or is it not useful?

-awaiting-author

@github-actions github-actions bot removed the awaiting-author A reviewer has asked the author a question or requested changes. label Feb 6, 2026
@joelriou
Copy link
Contributor

joelriou commented Feb 6, 2026

@joelriou thanks for the review!

I called them floor_mem_add and floor_add_mem to highlight on which side the member of the lattice is, otherwise the name would have been the same.

This branch grew a bit locally. I ended up adding some other lemmas, relaxed the hypotheses to [Ring K] here and there, and some other minor fixes. Should I push the branch here and change the name of the PR or is it not useful?

-awaiting-author

Ok, then, my understanding is that floor_coe_add_of_mem and floor_add_coe_of_mem would be better names.
As the PR is short, do not hesitate to update it or add more material.

@github-actions github-actions bot added the awaiting-author A reviewer has asked the author a question or requested changes. label Feb 6, 2026
@mathlib-merge-conflicts mathlib-merge-conflicts bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Feb 8, 2026
@mathlib-merge-conflicts
Copy link

This pull request has conflicts, please merge master and resolve them.

@github-actions github-actions bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Feb 10, 2026
@ster-oc ster-oc changed the title feat(Algebra/Module/ZLattice): add lemma floor b (m + x) = m + floor b x and similar feat(Algebra/Module/ZLattice): align ZSpan.floor to Int.floor API Feb 10, 2026
@ster-oc
Copy link
Contributor Author

ster-oc commented Feb 17, 2026

Sparse thoughts:

  • Instead of (m : M) (hm : m ∈ span ℤ (Set.range b)) I think it would be good to use (m : span ℤ (Set.range b)) which is what most of the time people would deal with (and it is already used here and there in the API).
  • I am thinking about moving vadd_mem_fundamentalDomain in section floor and call it neg_floor_eq_iff or something like that.
  • I am still golfing the proofs a bit.
  • Probably with a bit of work one could define an attribute [to_zspan] to get rid of the newborn sections almost completely.
  • I was alto thinking to abbrev span ℤ (Set.range b)) to ZSpan b but again this is a style choice out of my competence

-awaiting-author

@github-actions github-actions bot removed the awaiting-author A reviewer has asked the author a question or requested changes. label Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-algebra Algebra (groups, rings, fields, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants