Skip to content

feat: add basic byte order support#1811

Open
fgdorais wants to merge 11 commits into
mainfrom
endian
Open

feat: add basic byte order support#1811
fgdorais wants to merge 11 commits into
mainfrom
endian

Conversation

@fgdorais

Copy link
Copy Markdown
Collaborator

No description provided.

@github-actions github-actions Bot added the WIP work in progress label May 18, 2026
@fgdorais fgdorais force-pushed the endian branch 2 times, most recently from e317fb6 to 07fb31b Compare May 18, 2026 04:19
mathlib-nightly-testing Bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request May 18, 2026
@mathlib-nightly-testing

Copy link
Copy Markdown
Contributor

Mathlib CI status (docs):

@fgdorais fgdorais force-pushed the endian branch 2 times, most recently from 2ddc168 to 0f8ffe9 Compare May 18, 2026 04:39
mathlib-nightly-testing Bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request May 18, 2026
@mathlib-nightly-testing

Copy link
Copy Markdown
Contributor

Mathlib CI status (docs):

mathlib-nightly-testing Bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request May 18, 2026
@mathlib-nightly-testing

Copy link
Copy Markdown
Contributor

Mathlib CI status (docs):

mathlib-nightly-testing Bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request May 18, 2026
@mathlib-nightly-testing

Copy link
Copy Markdown
Contributor

Mathlib CI status (docs):

@mathlib-nightly-testing

Copy link
Copy Markdown
Contributor

Mathlib CI status (docs):

mathlib-nightly-testing Bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request May 18, 2026
mathlib-nightly-testing Bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request May 18, 2026
@mathlib-nightly-testing

Copy link
Copy Markdown
Contributor

Mathlib CI status (docs):

@fgdorais fgdorais marked this pull request as ready for review May 18, 2026 07:16
@fgdorais fgdorais added awaiting-review This PR is ready for review; the author thinks it is ready to be merged. and removed WIP work in progress labels May 18, 2026
@mathlib-nightly-testing

Copy link
Copy Markdown
Contributor

Mathlib CI status (docs):

mathlib-nightly-testing Bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request May 18, 2026
@mathlib-nightly-testing

Copy link
Copy Markdown
Contributor

Mathlib CI status (docs):

mathlib-nightly-testing Bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request May 19, 2026
@mathlib-nightly-testing

Copy link
Copy Markdown
Contributor

Mathlib CI status (docs):

@wrenna-robson

Copy link
Copy Markdown
Contributor

This looks basically sensible to me and useful to have. However, I would feel more comfortable if there were some checks on all the definitions you've made - either with appropriately chosen theorems, or I suppose an addition to test suites. The actual endianness check feels a little hacky but so does every endianness check I've ever seen, so probably no issue.

@fgdorais

Copy link
Copy Markdown
Collaborator Author

I have no idea why precompileModules = true breaks the seq_focus and simp_trace tests.

@fgdorais

Copy link
Copy Markdown
Collaborator Author

I've added a bunch of theorems. I probably missed some. I still have no clue why the tests are broken.

mathlib-nightly-testing Bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request May 21, 2026
@mathlib-nightly-testing

Copy link
Copy Markdown
Contributor

Mathlib CI status (docs):

mathlib-nightly-testing Bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request May 21, 2026
@mathlib-nightly-testing

Copy link
Copy Markdown
Contributor

Mathlib CI status (docs):

mathlib-nightly-testing Bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request May 21, 2026
@mathlib-nightly-testing

Copy link
Copy Markdown
Contributor

Mathlib CI status (docs):

@kim-em

kim-em commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Could you say something about what this is for? I wasn't aware that endian-ness was a live issue anymore. :-)

@fgdorais fgdorais added WIP work in progress and removed awaiting-review This PR is ready for review; the author thinks it is ready to be merged. labels Jun 4, 2026
@fgdorais

fgdorais commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator Author

I meant this to stay WIP. While my primary purpose was to test whether extern c inline would even work here, there are some applications. For example, to properly encode/decode a utf16 or utf32 string, one must pay attention to the byte-order mark (BOM) and adapt. It's also important to properly verify some transmission protocols. You're right though, this is not a concern in many higher level languages where low-level stuff is handled behind the scenes by the compiler. This is true for Lean except for that verification is important in order to trust the compiler.

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

Labels

breaks-mathlib WIP work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants