Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation for graphs with resource variables #457

Closed
Tracked by #426
croyzor opened this issue Aug 25, 2023 · 2 comments
Closed
Tracked by #426

Validation for graphs with resource variables #457

croyzor opened this issue Aug 25, 2023 · 2 comments

Comments

@croyzor
Copy link
Contributor

croyzor commented Aug 25, 2023

Currently, extension validation assumes that hugrs should be extensions-closed. Which is to say that every node in the hugr should have concrete extensions for its incoming and outgoing edges. This makes sense for a static function definition, but may be needlessly restrictive for other types of hugrs.

Concretely, in the below diagram, input0 could have an open extension variable as its input extensions. Extension inference could conclude that the rest of the graph makes sense given any value for this variable, but validation would complain that DFG0's input doesn't have a concrete extension set!

flowchart
    direction TB
    subgraph DFG0
        direction TB
        subgraph DFG1
            direction TB
            Input1 --> op0
            op0 --> op1
            op1 --> Output1
        end
        Input0 --> DFG1
        Input1 --> DFG1
        DFG1 --> Output0
    end
Loading

The workaround for this lack of more permissive extension validation as introduced by #456 is for extension inference to return a closure -- a mapping of solutions for extension sets in the graph which depend on open variables which it then passes to validation, allowing validation to operate on an extension-closed hugr.

I.e. extension inference checks that there is a solution given any value for the remaining extension variables, and for validation it sets their values to the empty extension set.

@acl-cqc
Copy link
Contributor

acl-cqc commented Apr 10, 2024

Update: there are a few other issues relevant here:

Also note that we already validate that

Thus, we think the only things remaining are:

@acl-cqc
Copy link
Contributor

acl-cqc commented May 13, 2024

New approach using extension typevars should let us do something similar to this following #709

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

No branches or pull requests

2 participants