Skip to content

Commit

Permalink
[spec] Specify Logic Resource. (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
cqc-alec authored Jul 13, 2023
1 parent 394dcfd commit f9d52b7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions specification/hugr.md
Original file line number Diff line number Diff line change
Expand Up @@ -1675,6 +1675,24 @@ implementation of this design document is available on GitHub.
`panic`: panics unconditionally; no inputs, any type of outputs (these
are never produced)

### Logic Resource

The Logic Resource provides a boolean type and basic logical operations.

The boolean type `bool` is defined to be `Sum((),())`, with the convention that the
first option in the sum represents "false" and the second represents "true".

The following operations are defined:

| Name | Inputs | Outputs | Meaning |
| -------- | ---------- | ------- | ----------------------------- |
| `not` | `bool` | `bool` | logical "not" |
| `and<N>` | `bool` x N | `bool` | N-ary logical "and" (N \>= 0) |
| `or<N>` | `bool` x N | `bool` | N-ary logical "or" (N \>= 0) |

Note that an `and<0>` operation produces the constant value "true" and an
`or<0>` operation produces the constant value "false".

### Arithmetic Resource

The Arithmetic Resource provides types and operations for integer and
Expand Down

0 comments on commit f9d52b7

Please sign in to comment.