Skip to content

feat: Update logical verifier to use Iterable protocol for compatibility with LogicalBlock type - #199

Draft
hsemenenko wants to merge 5 commits into
mainfrom
hs/feat/iterable-protocol-verifier
Draft

hsemenenko wants to merge 5 commits into
mainfrom
hs/feat/iterable-protocol-verifier

Conversation

@hsemenenko

@hsemenenko hsemenenko commented Aug 7, 2026 •

Copy link
Copy Markdown
Collaborator

Adds a guppy protocol _GuppyIterable to avoid naming clashes with Python Iterable and an __iter__ method is added to LogicalBlock.

@hsemenenko
hsemenenko requested a review from CalMacCQ August 11, 2026 09:42
@hsemenenko
hsemenenko marked this pull request as ready for review August 11, 2026 09:42
@hsemenenko
hsemenenko requested a review from a team August 11, 2026 09:42
CalMacCQ
CalMacCQ previously approved these changes Aug 11, 2026

@CalMacCQ CalMacCQ left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, thanks Henry. Just one question that I think is inconsequential really.

block = state_prep_func()
state_output("total", block)
discard_array(block)
block_arr = array(q for q in block)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this extra block_arr = array(q for q in block) line just there for explicitness? I notice that the other compute_stabilizers_... type functions are left alone.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good catch! This is necessary as state_output does not accept a Guppy struct. The test I've included only checks compute_stabilizers_single_block_state so I did not realise the others that needed changing. I will update the other functions as well and add more tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay! Glad I asked then. Yeah in that case we should update the other functions and add corresponding tests

Comment thread src/guppyft/code/util.py Outdated
@hsemenenko
hsemenenko marked this pull request as draft August 11, 2026 11:02
@hsemenenko
hsemenenko dismissed CalMacCQ’s stale review August 11, 2026 11:03

This has highlighted a big issue with using Iterable in the unitary verification which need more thought on how to address.

@hsemenenko

Copy link
Copy Markdown
Collaborator Author

For the unitary tests, the Bell state is prepared as an array. This is incompatible with having an implementation function that expects LogicalBlock as an input.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants