Skip to content

feat(Logic.Equiv.BijectiveBase2): add bijective base-2 numeration#35857

Open
AlexeyMilovanov wants to merge 3 commits intoleanprover-community:masterfrom
AlexeyMilovanov:bijective-base-2
Open

feat(Logic.Equiv.BijectiveBase2): add bijective base-2 numeration#35857
AlexeyMilovanov wants to merge 3 commits intoleanprover-community:masterfrom
AlexeyMilovanov:bijective-base-2

Conversation

@AlexeyMilovanov
Copy link

@AlexeyMilovanov AlexeyMilovanov commented Feb 27, 2026

This PR introduces a formalization of the bijective base-2 numeration system.

Unlike standard binary representation, bijective base-2 avoids the "leading zeros" problem, providing a strict mathematical bijection between natural numbers () and lists of booleans (List Bool).

Main additions:

  • Equiv.BijectiveBase2.toBits: Encodes to List Bool.
  • Equiv.BijectiveBase2.ofBits: Decodes List Bool to .
  • equivBijectiveBase2: The formal ℕ ≃ List Bool equivalence.

(Note: This replaces my previously closed PR to avoid the terminology clash between "Dyadic" and dyadic rationals. The namespace and definitions have been updated accordingly).

(Note: Used AI to assist with standardizing proof structures).

@github-actions github-actions bot added the new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! label Feb 27, 2026
@github-actions
Copy link

Welcome new contributor!

Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions.

We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the awaiting-author tag, or another reason described in the Lifecycle of a PR.

If you haven't already done so, please come to https://leanprover.zulipchat.com/, introduce yourself, and mention your new PR.

Thank you again for joining our community.

@github-actions
Copy link

github-actions bot commented Feb 27, 2026

PR summary 7dfb413d60

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Logic.Equiv.ListNatBijective (new file) 290

Declarations diff

+ listNatBijectiveEquiv
+ ofBits
+ ofBits_nil
+ ofBits_toBits
+ toBits
+ toBits_ofBits
+ toBits_zero

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 github-actions bot added the t-logic Logic (model theory, etc) label Feb 27, 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-logic Logic (model theory, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants