Skip to content

feat: Dyadic is a localization - #43045

Open
plp127 wants to merge 27 commits into
leanprover-community:masterfrom
plp127:aliu/dyadic-localization
Open

plp127 wants to merge 27 commits into
leanprover-community:masterfrom
plp127:aliu/dyadic-localization

Conversation

@plp127

@plp127 plp127 commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Prove that Dyadic is a localization of the integers generated by inverting 2.


Open in Gitpod

@plp127
plp127 requested a review from vihdzp August 22, 2026 16:37
@github-actions

github-actions Bot commented Aug 22, 2026 •

Copy link
Copy Markdown

PR summary 750a719b08

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Data.Dyadic.IsLocalization (new file) 966

Declarations diff (regex)

+ half
+ instance : Invertible (2 : Dyadic)
+ instance : IsLocalization (Submonoid.powers (2 : ℤ)) Dyadic
+ invOf_two_eq_half
+ isUnit_iff_exists_half_pow
+ val_half_eq_ofOdd
+ val_half_zpow_eq_ofOdd
+ val_inv_half

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

✅ Lean-aware diff — post-build, computed from the Lean environment (commit 750a719).

  • +8 new declarations
  • −0 removed declarations
+Dyadic.half
+Dyadic.instInvertibleOfNat
+Dyadic.instIsLocalizationIntPowersOfNat
+Dyadic.invOf_two_eq_half
+Dyadic.isUnit_iff_exists_half_pow
+Dyadic.val_half_eq_ofOdd
+Dyadic.val_half_zpow_eq_ofOdd
+Dyadic.val_inv_half

No changes to strong technical debt.
No changes to weak technical debt.

Current commit 750a719b08
Reference commit 68dd2955f5

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.py 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 github-actions Bot added the t-data Data (lists, quotients, numbers, etc) label Aug 22, 2026
@mathlib-dependent-issues mathlib-dependent-issues Bot added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Aug 22, 2026
Comment thread Mathlib/Data/Dyadic/IsLocalization.lean Resolved
@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 Sep 7, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

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

@github-actions github-actions Bot added tech debt Fixes cross-cutting technical debt, see the "technical debt counters" stream on zulip and removed merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) labels Sep 8, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

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

@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 Oct 9, 2026
inv_val := rfl

-- `@[simps]` for `Units` is broken, see https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/.60.40.5Bsimps.5D.60.20for.20.60Units.60.20is.20broken/near/618107577
@[simp] theorem val_inv_half : ↑(half⁻¹) = (2 : Dyadic) := rfl

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we have val_half too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What's the statement?

@vihdzp vihdzp Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@[simp] theorem val_half : ↑half = 1 >>> 1 := rfl

-- `@[simps]` for `Units` is broken, see https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/.60.40.5Bsimps.5D.60.20for.20.60Units.60.20is.20broken/near/618107577
@[simp] theorem val_inv_half : ↑(half⁻¹) = (2 : Dyadic) := rfl

instance : Invertible (2 : Dyadic) where

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is there not some theorem Invertible x.inv for x : Rˣ?

invOf_mul_self := rfl
mul_invOf_self := rfl

theorem invOf_two_eq_half : (⅟2 : Dyadic) = half := rfl

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
theorem invOf_two_eq_half : (⅟2 : Dyadic) = half := rfl
@[simp] theorem invOf_two_eq_half : (⅟2 : Dyadic) = half := rfl

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm thinking maybe we might want to make ⅟2 the simp normal form? Since there are 40 some theorems about ⅟2 already but none about half.


theorem val_half_zpow_eq_ofOdd (n : ℤ) : ↑(half ^ n) = ofOdd 1 n rfl := by
rw [← neg_neg n]
induction -n using Int.negInduction with

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Surely there's an easier proof by passing to the rationals?

simp

instance : IsLocalization (Submonoid.powers (2 : ℤ)) Dyadic where
map_units := by

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think IsUnit (1 <<< n) would be a nice lemma to have.

@mathlib-dependent-issues mathlib-dependent-issues Bot removed the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Nov 10, 2026
@mathlib-dependent-issues

Copy link
Copy Markdown

This PR/issue depends on:

@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 Nov 10, 2026

This branch has not been deployed

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

Labels

t-data Data (lists, quotients, numbers, etc) tech debt Fixes cross-cutting technical debt, see the "technical debt counters" stream on zulip

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants