Skip to content

Feature: is_separable to optionally return the criterion that determined its True/False result #1248

@poig

Description

@poig

Is your feature request related to a problem? Please describe.

User Story: As a quantum information researcher using toqito, when is_separable returns True or False, I want to know which specific test or criterion led to this conclusion so I can better understand the properties of my state and debug my analysis.

Problem: toqito.state_props.is_separable currently returns only a boolean. This lacks transparency for the user regarding the decision-making process of the function.

Describe the solution you'd like

  1. Change the return type of is_separable from -> bool to -> tuple[bool, str | None].
    • The first element (bool) remains the True/False result.
    • The second element (str | None) will be a human-readable string identifying the criterion met. If no specific criterion led to a conclusion before a default fallback, this can be None or an appropriate message.
  2. Modify every return True and return False statement to include a concise, descriptive string. (See previous draft for examples like "State is NPT (Not Positive Partial Transpose)", "Pure state with Schmidt rank 1", etc.).
  3. The final return False (if all checks are inconclusive for proving separability) should have a clear message like "All checks inconclusive; state is PPT but not proven separable by current tests."
    4.Update the function's docstring (especially :return: and examples) to reflect this new return type.
  • Function Signature (around line 22): Change -> bool to -> tuple[bool, str | None].
  • All return True / return False statements: Modify each to include the descriptive string.
  • Final return False (around line ~568): Add appropriate message.
  • Docstring: Update :return: type and examples.

Describe alternatives you've considered
Verbose flag/logging: Less programmatic.
Separate "explain" function: More complex than enhancing the return value.

Additional context
Primarily a software design enhancement; references pertain to the criteria being reported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions