-
Notifications
You must be signed in to change notification settings - Fork 163
Description
Instructions in QRE are a primitive, and carry a natural the structure of a type system (all arrow types). As such there is a natural notion of subtypes and supertypes. An already implemented example is H_XZ (ID 0x10) is a subtype of ONE_QUBIT_CLIFFORD (ID 0x50), which in turn is a subtype of GENERIC (ID 0xFFFF). While generally converting one instruction to another requires synthesis (and hence belongs to ISATransform), doing this for simple coersions such as the above is very heavyweight.
A natural approach to coersion would be to add a static database (presumably along with the predefined instruction IDs) that implements valid coersions. The database would need to provide functionality for user added IDs. Querying for valid coersion could be added to the Instruction class. Generators for iterating over superclasses could also be added to the Instruction class, best as a wrapper around such an iterator directly implemented in the database.