Skip to content

Make Interleave agree with the rest of the module on the empty sequence - #129

Merged
lemmy merged 1 commit into
masterfrom
mku-interleave
Sep 9, 2026
Merged

Make Interleave agree with the rest of the module on the empty sequence#129
lemmy merged 1 commit into
masterfrom
mku-interleave

Conversation

@lemmy

@lemmy lemmy commented Sep 8, 2026

Copy link
Copy Markdown
Member

Interleave was the only operator that turned an empty argument into a non-empty result. It now yields the identity, as Zip, FlattenSeq and Reverse already do.

This is a breaking change, but a narrow one: it is confined to a single input, no other operator in the module reaches that input, and no proof depends on it.

[Refactor]

Interleave was the only operator that turned an empty argument into a
non-empty result. It now yields the identity, as Zip, FlattenSeq and Reverse
already do.

This is a breaking change, but a narrow one: it is confined to a single
input, no other operator in the module reaches that input, and no proof
depends on it.

[Refactor]

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Markus Alexander Kuppe <github.com@lemmster.de>
@lemmy lemmy self-assigned this Sep 8, 2026
@lemmy lemmy added the enhancement New feature or request label Sep 8, 2026
@lemmy
lemmy requested review from muenchnerkindl and a balanced review from Copilot September 8, 2026 17:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The implementation matches the existing documented behavior and is adequately covered by focused tests.

Pull request overview

Aligns Interleave’s empty-sequence behavior with its documented contract and related sequence operators.

Changes:

  • Returns <<>> when both inputs are empty.
  • Adds bounded property tests covering length and ordering invariants.
File summaries
File Description
modules/SequencesExt.tla Corrects the empty-input result and documents the rationale.
tests/SequencesExtTests.tla Updates the empty-case expectation and adds invariant coverage.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@muenchnerkindl

Copy link
Copy Markdown
Contributor

This definition clearly makes more sense than the previous one. Assuming Len(s) = Len(t), the operator now satisfies the recursive equation

Interleave(s,t) = IF Len(s) = 0 THEN << >> 
                  ELSE << <<Head(s)>>, <<Head(t)>> >> \o Interleave(Tail(s), Tail(t))

@lemmy
lemmy merged commit 03b25b3 into master Sep 9, 2026
7 checks passed
@lemmy
lemmy deleted the mku-interleave branch September 9, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

3 participants