From d49313989b69f30072e7f36a380ecd538a3ac18e Mon Sep 17 00:00:00 2001 From: Alec Edgington <54802828+cqc-alec@users.noreply.github.com> Date: Mon, 22 Jul 2024 15:47:49 +0100 Subject: [PATCH] feat: Serialization upgrade path (#1327) This PR does three things: - makes changes to serialization code necessary to allow backwards-compatible upgrades; - makes a small change to serialization (changing "op_name" to "name" in `CustomOp`s), adding v2 of the serialization format; - adds documentation in `DEVELOPMENT.md` on how to make upgrades in the future. --- DEVELOPMENT.md | 32 + hugr-core/src/extension.rs | 8 +- hugr-core/src/hugr/serialize.rs | 71 +- hugr-core/src/hugr/serialize/test.rs | 192 +- hugr-core/src/hugr/serialize/upgrade.rs | 37 + hugr-core/src/hugr/serialize/upgrade/test.rs | 80 + .../upgrade/testcases/empty_hugr.json | 15 + .../upgrade/testcases/hugr_with_named_op.json | 134 ++ hugr-core/src/ops/custom.rs | 26 +- hugr-py/src/hugr/__init__.py | 5 + hugr-py/src/hugr/ops.py | 10 +- hugr-py/src/hugr/serialization/ops.py | 6 +- hugr-py/src/hugr/serialization/serial_hugr.py | 12 +- .../src/hugr/serialization/testing_hugr.py | 5 +- hugr-py/src/hugr/std/int.py | 2 +- hugr-py/tests/conftest.py | 7 +- hugr-py/tests/serialization/test_basic.py | 3 +- poetry.lock | 308 +-- .../schema/hugr_schema_strict_v2.json | 2036 ++++++++++++++++ specification/schema/hugr_schema_v2.json | 2036 ++++++++++++++++ .../schema/testing_hugr_schema_strict_v2.json | 2081 +++++++++++++++++ .../schema/testing_hugr_schema_v2.json | 2081 +++++++++++++++++ 22 files changed, 8892 insertions(+), 295 deletions(-) create mode 100644 hugr-core/src/hugr/serialize/upgrade.rs create mode 100644 hugr-core/src/hugr/serialize/upgrade/test.rs create mode 100644 hugr-core/src/hugr/serialize/upgrade/testcases/empty_hugr.json create mode 100644 hugr-core/src/hugr/serialize/upgrade/testcases/hugr_with_named_op.json create mode 100644 specification/schema/hugr_schema_strict_v2.json create mode 100644 specification/schema/hugr_schema_v2.json create mode 100644 specification/schema/testing_hugr_schema_strict_v2.json create mode 100644 specification/schema/testing_hugr_schema_v2.json diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 2e95b7fa1..74902ec7b 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -110,6 +110,38 @@ just coverage and open it with your favourite coverage viewer. In VSCode, you can use [`coverage-gutters`](https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters). +## Serialization + +If you want to make a change that modifies the serialization schema, you must +ensure backwards-compatibility by writing a method to convert from the existing +format to the new one. We suggest the following process. (For concreteness we +assume that you are upgrading from v5 to v6.) + +1. Add a test case in `hugr-core/src/hugr/serialize/upgrade/test.rs` that + exercises the part of the schema that will change in v6. +2. Run the tests. This will create a new JSON file in the `testcases` + subdirectory. Commit this to the repo. +3. Implement the schema-breaking change. Expect the test you added in step 1 + (and possibly others) to fail. +4. In `hugr/hugr-core/src/hugr/serialize.rs`: + - Add a new line `V6(SerHugr),` in `enum Versioned`, and change the previous + line to `V5(serde_json::Value),`. + - In `Versioned::upgrade()` insert the line + `Self::V5(json) => self = Self::V6(upgrade::v5_to_v6(json).and_then(go)?),` + and change `V5` to `V6` in the line + `Self::V5(ser_hugr) => return Ok(ser_hugr),`. + - Change `new_latest()` to return `Self::V6(t)`. +5. In `hugr-core/src/hugr/serialize/upgrade.rs` add a stub implementation of + `v5_to_v6()`. +6. In `hugr-py/src/hugr/__init__.py` update `get_serialisation_version()` to + return `"v6"`. +7. Run `just update-schema` to generate new v6 schema files. Commit these to + the repo. +8. In `hugr-core/src/hugr/serialize/test.rs`, in the `include_schema` macro + change `v5` to `v6`. +9. Implement `v5_to_v6()`. +10. Ensure all tests are passing. + ## 🌐 Contributing to HUGR We welcome contributions to HUGR! Please open [an issue](https://github.com/CQCL/hugr/issues/new) or [pull request](https://github.com/CQCL/hugr/compare) if you have any questions or suggestions. diff --git a/hugr-core/src/extension.rs b/hugr-core/src/extension.rs index 9f59c9106..cec55ae69 100644 --- a/hugr-core/src/extension.rs +++ b/hugr-core/src/extension.rs @@ -301,8 +301,8 @@ impl Extension { } /// Allows read-only access to the operations in this Extension - pub fn get_op(&self, op_name: &OpNameRef) -> Option<&Arc> { - self.operations.get(op_name) + pub fn get_op(&self, name: &OpNameRef) -> Option<&Arc> { + self.operations.get(name) } /// Allows read-only access to the types in this Extension @@ -352,11 +352,11 @@ impl Extension { /// Instantiate an [`ExtensionOp`] which references an [`OpDef`] in this extension. pub fn instantiate_extension_op( &self, - op_name: &OpNameRef, + name: &OpNameRef, args: impl Into>, ext_reg: &ExtensionRegistry, ) -> Result { - let op_def = self.get_op(op_name).expect("Op not found."); + let op_def = self.get_op(name).expect("Op not found."); ExtensionOp::new(op_def.clone(), args, ext_reg) } diff --git a/hugr-core/src/hugr/serialize.rs b/hugr-core/src/hugr/serialize.rs index b146d08df..4e935bbcc 100644 --- a/hugr-core/src/hugr/serialize.rs +++ b/hugr-core/src/hugr/serialize.rs @@ -1,6 +1,7 @@ //! Serialization definition for [`Hugr`] //! [`Hugr`]: crate::hugr::Hugr +use serde::de::DeserializeOwned; use std::collections::HashMap; use thiserror::Error; @@ -13,8 +14,12 @@ use portgraph::{Direction, LinkError, PortView}; use serde::{Deserialize, Deserializer, Serialize}; +use self::upgrade::UpgradeError; + use super::{HugrMut, HugrView, NodeMetadataMap}; +mod upgrade; + /// A wrapper over the available HUGR serialization formats. /// /// The implementation of `Serialize` for `Hugr` encodes the graph in the most @@ -26,21 +31,44 @@ use super::{HugrMut, HugrView, NodeMetadataMap}; /// /// Make sure to order the variants from newest to oldest, as the deserializer /// will try to deserialize them in order. -#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(tag = "version", rename_all = "lowercase")] -enum Versioned { +enum Versioned { + #[serde(skip_serializing)] /// Version 0 of the HUGR serialization format. V0, - /// Version 1 of the HUGR serialization format. - V1(SerHugr), + V1(serde_json::Value), + V2(SerHugr), + + #[serde(skip_serializing)] #[serde(other)] Unsupported, } impl Versioned { - pub fn new(t: T) -> Self { - Self::V1(t) + pub fn new_latest(t: T) -> Self { + Self::V2(t) + } +} + +impl Versioned { + fn upgrade(mut self) -> Result { + // go is polymorphic in D. When we are upgrading to the latest version + // D is T. When we are upgrading to a version which is not the latest D + // is serde_json::Value. + fn go(v: serde_json::Value) -> Result { + serde_json::from_value(v).map_err(Into::into) + } + loop { + match self { + Self::V0 => Err(UpgradeError::KnownVersionUnsupported("0".into()))?, + // the upgrade lines remain unchanged when adding a new constructor + Self::V1(json) => self = Self::V2(upgrade::v1_to_v2(json).and_then(go)?), + Self::V2(ser_hugr) => return Ok(ser_hugr), + Versioned::Unsupported => Err(UpgradeError::UnknownVersionUnsupported)?, + } + } } } @@ -52,8 +80,8 @@ struct NodeSer { } /// Version 1 of the HUGR serialization format. -#[derive(Serialize, Deserialize, PartialEq, Debug)] -struct SerHugrV1 { +#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] +struct SerHugrLatest { /// For each node: (parent, node_operation) nodes: Vec, /// for each edge: (src, src_offset, tgt, tgt_offset) @@ -102,8 +130,8 @@ impl Serialize for Hugr { where S: serde::Serializer, { - let shg: SerHugrV1 = self.try_into().map_err(serde::ser::Error::custom)?; - let versioned = Versioned::new(shg); + let shg: SerHugrLatest = self.try_into().map_err(serde::ser::Error::custom)?; + let versioned = Versioned::new_latest(shg); versioned.serialize(serializer) } } @@ -113,20 +141,13 @@ impl<'de> Deserialize<'de> for Hugr { where D: Deserializer<'de>, { - let shg: Versioned = Versioned::deserialize(deserializer)?; - match shg { - Versioned::V0 => Err(serde::de::Error::custom( - "Version 0 HUGR serialization format is not supported.", - )), - Versioned::V1(shg) => shg.try_into().map_err(serde::de::Error::custom), - Versioned::Unsupported => Err(serde::de::Error::custom( - "Unsupported HUGR serialization format.", - )), - } + let versioned = Versioned::deserialize(deserializer)?; + let shl: SerHugrLatest = versioned.upgrade().map_err(serde::de::Error::custom)?; + shl.try_into().map_err(serde::de::Error::custom) } } -impl TryFrom<&Hugr> for SerHugrV1 { +impl TryFrom<&Hugr> for SerHugrLatest { type Error = HUGRSerializationError; fn try_from(hugr: &Hugr) -> Result { @@ -188,15 +209,15 @@ impl TryFrom<&Hugr> for SerHugrV1 { } } -impl TryFrom for Hugr { +impl TryFrom for Hugr { type Error = HUGRSerializationError; fn try_from( - SerHugrV1 { + SerHugrLatest { nodes, edges, metadata, - .. - }: SerHugrV1, + encoder: _, + }: SerHugrLatest, ) -> Result { // Root must be first node let mut nodes = nodes.into_iter(); diff --git a/hugr-core/src/hugr/serialize/test.rs b/hugr-core/src/hugr/serialize/test.rs index 1822aa346..e52cd3e49 100644 --- a/hugr-core/src/hugr/serialize/test.rs +++ b/hugr-core/src/hugr/serialize/test.rs @@ -32,7 +32,7 @@ const QB: Type = crate::extension::prelude::QB_T; /// Version 1 of the Testing HUGR serialization format, see `testing_hugr.py`. #[derive(Serialize, Deserialize, PartialEq, Debug, Default)] -struct SerTestingV1 { +struct SerTestingLatest { typ: Option, sum_type: Option, poly_func_type: Option, @@ -41,44 +41,75 @@ struct SerTestingV1 { op_def: Option, } -type TestingModel = SerTestingV1; +struct NamedSchema { + name: &'static str, + schema: JSONSchema, +} + +impl NamedSchema { + pub fn new(name: &'static str, schema: JSONSchema) -> Self { + Self { name, schema } + } + + pub fn check(&self, val: &serde_json::Value) { + if let Err(errors) = self.schema.validate(val) { + // errors don't necessarily implement Debug + eprintln!("Schema failed to validate: {}", self.name); + for error in errors { + eprintln!("Validation error: {}", error); + eprintln!("Instance path: {}", error.instance_path); + } + panic!("Serialization test failed."); + } + } + + pub fn check_schemas( + val: &serde_json::Value, + schemas: impl IntoIterator, + ) { + for schema in schemas { + schema.check(val); + } + } +} macro_rules! include_schema { ($name:ident, $path:literal) => { lazy_static! { - static ref $name: JSONSchema = { - let schema_val: serde_json::Value = - serde_json::from_str(include_str!($path)).unwrap(); - JSONSchema::options() - .with_draft(Draft::Draft7) - .compile(&schema_val) - .expect("Schema is invalid.") - }; + static ref $name: NamedSchema = + NamedSchema::new("$name", { + let schema_val: serde_json::Value = serde_json::from_str(include_str!( + concat!("../../../../specification/schema/", $path, "_v2.json") + )) + .unwrap(); + JSONSchema::options() + .with_draft(Draft::Draft7) + .compile(&schema_val) + .expect("Schema is invalid.") + }); } }; } -include_schema!( - SCHEMA, - "../../../../specification/schema/hugr_schema_v1.json" -); -include_schema!( - SCHEMA_STRICT, - "../../../../specification/schema/hugr_schema_strict_v1.json" -); -include_schema!( - TESTING_SCHEMA, - "../../../../specification/schema/testing_hugr_schema_v1.json" -); -include_schema!( - TESTING_SCHEMA_STRICT, - "../../../../specification/schema/testing_hugr_schema_strict_v1.json" -); +include_schema!(SCHEMA, "hugr_schema"); +include_schema!(SCHEMA_STRICT, "hugr_schema_strict"); +include_schema!(TESTING_SCHEMA, "testing_hugr_schema"); +include_schema!(TESTING_SCHEMA_STRICT, "testing_hugr_schema_strict"); + +fn get_schemas(b: bool) -> impl IntoIterator { + let schemas: [&'static NamedSchema; 2] = [&SCHEMA, &SCHEMA_STRICT]; + b.then_some(schemas.into_iter()).into_iter().flatten() +} + +fn get_testing_schemas(b: bool) -> impl IntoIterator { + let schemas: Vec<&'static NamedSchema> = vec![&TESTING_SCHEMA, &TESTING_SCHEMA_STRICT]; + b.then_some(schemas.into_iter()).into_iter().flatten() +} macro_rules! impl_sertesting_from { ($typ:ty, $field:ident) => { #[cfg(test)] - impl From<$typ> for TestingModel { + impl From<$typ> for SerTestingLatest { fn from(v: $typ) -> Self { let mut r: Self = Default::default(); r.$field = Some(v); @@ -95,14 +126,14 @@ impl_sertesting_from!(crate::ops::Value, value); impl_sertesting_from!(NodeSer, optype); impl_sertesting_from!(SimpleOpDef, op_def); -impl From for TestingModel { +impl From for SerTestingLatest { fn from(v: PolyFuncType) -> Self { let v: PolyFuncTypeRV = v.into(); v.into() } } -impl From for TestingModel { +impl From for SerTestingLatest { fn from(v: Type) -> Self { let t: TypeRV = v.into(); t.into() @@ -114,35 +145,22 @@ fn empty_hugr_serialize() { check_hugr_roundtrip(&Hugr::default(), true); } -/// Serialize and deserialize a value, optionally validating against a schema. -pub fn ser_serialize_check_schema( - g: &T, - schema: Option<&JSONSchema>, -) -> serde_json::Value { - let s = serde_json::to_string(g).unwrap(); - let val: serde_json::Value = serde_json::from_str(&s).unwrap(); - - if let Some(schema) = schema { - let validate = schema.validate(&val); - - if let Err(errors) = validate { - // errors don't necessarily implement Debug - for error in errors { - println!("Validation error: {}", error); - println!("Instance path: {}", error.instance_path); - } - panic!("Serialization test failed."); - } - } - val +fn ser_deserialize_check_schema( + val: serde_json::Value, + schemas: impl IntoIterator, +) -> T { + NamedSchema::check_schemas(&val, schemas); + serde_json::from_value(val).unwrap() } -/// Serialize and deserialize a HUGR, and check that the result is the same as the original. -/// Checks the serialized json against the in-tree schema. -/// -/// Returns the deserialized HUGR. -pub fn check_hugr_schema_roundtrip(hugr: &Hugr) -> Hugr { - check_hugr_roundtrip(hugr, true) +/// Serialize and deserialize a value, validating against a schema. +fn ser_roundtrip_check_schema( + g: &T, + schemas: impl IntoIterator, +) -> T { + let val = serde_json::to_value(g).unwrap(); + NamedSchema::check_schemas(&val, schemas); + serde_json::from_value(val).unwrap() } /// Serialize and deserialize a HUGR, and check that the result is the same as the original. @@ -155,22 +173,33 @@ pub fn check_hugr_schema_roundtrip(hugr: &Hugr) -> Hugr { /// /// Returns the deserialized HUGR. pub fn check_hugr_roundtrip(hugr: &Hugr, check_schema: bool) -> Hugr { - let hugr_ser = ser_serialize_check_schema(hugr, check_schema.then_some(&SCHEMA)); - let _ = ser_serialize_check_schema(hugr, check_schema.then_some(&SCHEMA_STRICT)); - let new_hugr: Hugr = serde_json::from_value(hugr_ser).unwrap(); + let new_hugr = ser_roundtrip_check_schema(hugr, get_schemas(check_schema)); + + check_hugr(hugr, &new_hugr); + new_hugr +} + +pub fn check_hugr_deserialize(hugr: &Hugr, value: serde_json::Value, check_schema: bool) -> Hugr { + let new_hugr = ser_deserialize_check_schema(value, get_schemas(check_schema)); + + check_hugr(hugr, &new_hugr); + new_hugr +} + +pub fn check_hugr(lhs: &Hugr, rhs: &Hugr) { // Original HUGR, with canonicalized node indices // // The internal port indices may still be different. - let mut h_canon = hugr.clone(); + let mut h_canon = lhs.clone(); h_canon.canonicalize_nodes(|_, _| {}); - assert_eq!(new_hugr.root, h_canon.root); - assert_eq!(new_hugr.hierarchy, h_canon.hierarchy); - assert_eq!(new_hugr.metadata, h_canon.metadata); + assert_eq!(rhs.root, h_canon.root); + assert_eq!(rhs.hierarchy, h_canon.hierarchy); + assert_eq!(rhs.metadata, h_canon.metadata); // Extension operations may have been downgraded to opaque operations. - for node in new_hugr.nodes() { - let new_op = new_hugr.get_optype(node); + for node in rhs.nodes() { + let new_op = rhs.get_optype(node); let old_op = h_canon.get_optype(node); if !new_op.is_const() { assert_eq!(new_op, old_op); @@ -178,7 +207,7 @@ pub fn check_hugr_roundtrip(hugr: &Hugr, check_schema: bool) -> Hugr { } // Check that the graphs are equivalent up to port renumbering. - let new_graph = &new_hugr.graph; + let new_graph = &rhs.graph; let old_graph = &h_canon.graph; assert_eq!(new_graph.node_count(), old_graph.node_count()); assert_eq!(new_graph.port_count(), old_graph.port_count()); @@ -191,21 +220,12 @@ pub fn check_hugr_roundtrip(hugr: &Hugr, check_schema: bool) -> Hugr { old_graph.output_neighbours(n).collect_vec() ); } - - new_hugr } -fn check_testing_roundtrip(t: impl Into) { - let before = Versioned::new(t.into()); - let after_strict = serde_json::from_value(ser_serialize_check_schema( - &before, - Some(&TESTING_SCHEMA_STRICT), - )) - .unwrap(); - let after = - serde_json::from_value(ser_serialize_check_schema(&before, Some(&TESTING_SCHEMA))).unwrap(); +fn check_testing_roundtrip(t: impl Into) { + let before = Versioned::new_latest(t.into()); + let after = ser_roundtrip_check_schema(&before, get_testing_schemas(true)); assert_eq!(before, after); - assert_eq!(after, after_strict); } /// Generate an optype for a node with a matching amount of inputs and outputs. @@ -257,7 +277,7 @@ fn simpleser() { metadata: Default::default(), }; - check_hugr_schema_roundtrip(&hugr); + check_hugr_roundtrip(&hugr, true); } #[test] @@ -291,7 +311,7 @@ fn weighted_hugr_ser() { module_builder.finish_prelude_hugr().unwrap() }; - check_hugr_schema_roundtrip(&hugr); + check_hugr_roundtrip(&hugr, true); } #[test] @@ -307,7 +327,7 @@ fn dfg_roundtrip() -> Result<(), Box> { } let hugr = dfg.finish_hugr_with_outputs(params, &EMPTY_REG)?; - check_hugr_schema_roundtrip(&hugr); + check_hugr_roundtrip(&hugr, true); Ok(()) } @@ -330,7 +350,7 @@ fn opaque_ops() -> Result<(), Box> { let hugr = dfg.finish_hugr_with_outputs([wire], &PRELUDE_REGISTRY)?; - check_hugr_schema_roundtrip(&hugr); + check_hugr_roundtrip(&hugr, true); Ok(()) } @@ -341,7 +361,7 @@ fn function_type() -> Result<(), Box> { let op = bldr.add_dataflow_op(Noop { ty: fn_ty }, bldr.input_wires())?; let h = bldr.finish_prelude_hugr_with_outputs(op.outputs())?; - check_hugr_schema_roundtrip(&h); + check_hugr_roundtrip(&h, true); Ok(()) } @@ -359,9 +379,9 @@ fn hierarchy_order() -> Result<(), Box> { hugr.remove_node(old_in); hugr.update_validate(&PRELUDE_REGISTRY)?; - let new_hugr: Hugr = check_hugr_schema_roundtrip(&hugr); - new_hugr.validate(&EMPTY_REG).unwrap_err(); - new_hugr.validate(&PRELUDE_REGISTRY)?; + let rhs: Hugr = check_hugr_roundtrip(&hugr, true); + rhs.validate(&EMPTY_REG).unwrap_err(); + rhs.validate(&PRELUDE_REGISTRY)?; Ok(()) } diff --git a/hugr-core/src/hugr/serialize/upgrade.rs b/hugr-core/src/hugr/serialize/upgrade.rs new file mode 100644 index 000000000..b6faa1741 --- /dev/null +++ b/hugr-core/src/hugr/serialize/upgrade.rs @@ -0,0 +1,37 @@ +use serde::de::Error; +use thiserror::Error; + +#[derive(Debug, Error)] +pub enum UpgradeError { + #[error(transparent)] + Deserialize(#[from] serde_json::Error), + + #[error("Version {0} HUGR serialization format is not supported.")] + KnownVersionUnsupported(String), + + #[error("Unsupported HUGR serialization format.")] + UnknownVersionUnsupported, +} + +pub fn v1_to_v2(mut input: serde_json::Value) -> Result { + let input_obj = input + .as_object_mut() + .ok_or(serde_json::Error::custom("Value is not an object"))?; + let nodes = input_obj + .get_mut("nodes") + .ok_or(serde_json::Error::custom("No nodes field"))? + .as_array_mut() + .ok_or(serde_json::Error::custom("nodes is not an array"))?; + for node in nodes.iter_mut() { + let node_obj = node + .as_object_mut() + .ok_or(serde_json::Error::custom("node is not an object"))?; + if let Some(name) = node_obj.remove("op_name") { + node_obj.insert("name".to_owned(), name); + } + } + Ok(input) +} + +#[cfg(test)] +mod test; diff --git a/hugr-core/src/hugr/serialize/upgrade/test.rs b/hugr-core/src/hugr/serialize/upgrade/test.rs new file mode 100644 index 000000000..5c838583e --- /dev/null +++ b/hugr-core/src/hugr/serialize/upgrade/test.rs @@ -0,0 +1,80 @@ +use crate::{ + builder::{DFGBuilder, Dataflow, DataflowHugr}, + extension::prelude::BOOL_T, + hugr::serialize::test::check_hugr_deserialize, + std_extensions::logic::NaryLogic, + type_row, + types::Signature, +}; +use lazy_static::lazy_static; +use std::{ + fs::OpenOptions, + path::{Path, PathBuf}, +}; + +use crate::Hugr; +use rstest::{fixture, rstest}; + +lazy_static! { + static ref TEST_CASE_DIR: PathBuf = { + PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .parent() + .unwrap() + .join(file!()) + .parent() + .unwrap() + .join("testcases") + }; +} + +#[test] +fn test_case_dir_exists() { + let test_case_dir: &Path = &TEST_CASE_DIR; + assert!( + test_case_dir.exists(), + "Upgrade test case directory does not exist: {:?}", + test_case_dir + ); +} + +#[fixture] +#[once] +pub fn empty_hugr() -> Hugr { + Hugr::default() +} + +#[fixture] +#[once] +pub fn hugr_with_named_op() -> Hugr { + let mut builder = + DFGBuilder::new(Signature::new(type_row![BOOL_T, BOOL_T], type_row![BOOL_T])).unwrap(); + let [a, b] = builder.input_wires_arr(); + let x = builder + .add_dataflow_op(NaryLogic::And.with_n_inputs(2), [a, b]) + .unwrap(); + builder + .finish_prelude_hugr_with_outputs(x.outputs()) + .unwrap() +} + +#[rstest] +#[case("empty_hugr", empty_hugr())] +#[case("hugr_with_named_op", hugr_with_named_op())] +#[cfg_attr(feature = "extension_inference", ignore = "Fails extension inference")] +fn serial_upgrade(#[case] name: String, #[case] hugr: Hugr) { + let path = TEST_CASE_DIR.join(format!("{}.json", name)); + if !path.exists() { + let f = OpenOptions::new() + .create(true) + .truncate(true) + .write(true) + .open(&path) + .unwrap(); + serde_json::to_writer_pretty(f, &hugr).unwrap(); + } + + let val = serde_json::from_reader(std::fs::File::open(&path).unwrap()).unwrap(); + // we do not expect `val` to satisfy any schemas, it is a non-latest + // version. + check_hugr_deserialize(&hugr, val, false); +} diff --git a/hugr-core/src/hugr/serialize/upgrade/testcases/empty_hugr.json b/hugr-core/src/hugr/serialize/upgrade/testcases/empty_hugr.json new file mode 100644 index 000000000..67dc07800 --- /dev/null +++ b/hugr-core/src/hugr/serialize/upgrade/testcases/empty_hugr.json @@ -0,0 +1,15 @@ +{ + "version": "v1", + "nodes": [ + { + "parent": 0, + "input_extensions": [], + "op": "Module" + } + ], + "edges": [], + "metadata": [ + null + ], + "encoder": "hugr-rs v0.1.0" +} diff --git a/hugr-core/src/hugr/serialize/upgrade/testcases/hugr_with_named_op.json b/hugr-core/src/hugr/serialize/upgrade/testcases/hugr_with_named_op.json new file mode 100644 index 000000000..43c8f7472 --- /dev/null +++ b/hugr-core/src/hugr/serialize/upgrade/testcases/hugr_with_named_op.json @@ -0,0 +1,134 @@ +{ + "version": "v1", + "nodes": [ + { + "parent": 0, + "op": "DFG", + "signature": { + "input": [ + { + "t": "Sum", + "s": "Unit", + "size": 2 + }, + { + "t": "Sum", + "s": "Unit", + "size": 2 + } + ], + "output": [ + { + "t": "Sum", + "s": "Unit", + "size": 2 + } + ], + "extension_reqs": [] + } + }, + { + "parent": 0, + "op": "Input", + "types": [ + { + "t": "Sum", + "s": "Unit", + "size": 2 + }, + { + "t": "Sum", + "s": "Unit", + "size": 2 + } + ] + }, + { + "parent": 0, + "op": "Output", + "types": [ + { + "t": "Sum", + "s": "Unit", + "size": 2 + } + ] + }, + { + "parent": 0, + "op": "CustomOp", + "extension": "logic", + "op_name": "And", + "description": "logical 'and'", + "args": [ + { + "tya": "BoundedNat", + "n": 2 + } + ], + "signature": { + "input": [ + { + "t": "Sum", + "s": "Unit", + "size": 2 + }, + { + "t": "Sum", + "s": "Unit", + "size": 2 + } + ], + "output": [ + { + "t": "Sum", + "s": "Unit", + "size": 2 + } + ], + "extension_reqs": [ + "logic" + ] + } + } + ], + "edges": [ + [ + [ + 1, + 0 + ], + [ + 3, + 0 + ] + ], + [ + [ + 1, + 1 + ], + [ + 3, + 1 + ] + ], + [ + [ + 3, + 0 + ], + [ + 2, + 0 + ] + ] + ], + "metadata": [ + null, + null, + null, + null + ], + "encoder": "hugr-rs v0.5.0" +} diff --git a/hugr-core/src/ops/custom.rs b/hugr-core/src/ops/custom.rs index 4b4e3092c..3b726ec79 100644 --- a/hugr-core/src/ops/custom.rs +++ b/hugr-core/src/ops/custom.rs @@ -112,11 +112,11 @@ impl CustomOp { impl NamedOp for CustomOp { /// The name of the operation. fn name(&self) -> OpName { - let (res_id, op_name) = match self { - Self::Opaque(op) => (&op.extension, &op.op_name), + let (res_id, name) = match self { + Self::Opaque(op) => (&op.extension, &op.name), Self::Extension(ext) => (ext.def.extension(), ext.def.name()), }; - qualify_name(res_id, op_name) + qualify_name(res_id, name) } } @@ -225,7 +225,7 @@ impl ExtensionOp { pub fn make_opaque(&self) -> OpaqueOp { OpaqueOp { extension: self.def.extension().clone(), - op_name: self.def.name().clone(), + name: self.def.name().clone(), description: self.def.description().into(), args: self.args.clone(), signature: self.signature.clone(), @@ -242,7 +242,7 @@ impl From for OpaqueOp { } = op; OpaqueOp { extension: def.extension().clone(), - op_name: def.name().clone(), + name: def.name().clone(), description: def.description().into(), args, signature, @@ -290,7 +290,7 @@ impl DataflowOpTrait for ExtensionOp { pub struct OpaqueOp { extension: ExtensionId, #[cfg_attr(test, proptest(strategy = "any_nonempty_smolstr()"))] - op_name: OpName, + name: OpName, #[cfg_attr(test, proptest(strategy = "any_nonempty_string()"))] description: String, // cache in advance so description() can return &str args: Vec, @@ -300,22 +300,22 @@ pub struct OpaqueOp { signature: Signature, } -fn qualify_name(res_id: &ExtensionId, op_name: &OpNameRef) -> OpName { - format!("{}.{}", res_id, op_name).into() +fn qualify_name(res_id: &ExtensionId, name: &OpNameRef) -> OpName { + format!("{}.{}", res_id, name).into() } impl OpaqueOp { /// Creates a new OpaqueOp from all the fields we'd expect to serialize. pub fn new( extension: ExtensionId, - op_name: impl Into, + name: impl Into, description: String, args: impl Into>, signature: Signature, ) -> Self { Self { extension, - op_name: op_name.into(), + name: name.into(), description, args: args.into(), signature, @@ -326,7 +326,7 @@ impl OpaqueOp { impl OpaqueOp { /// Unique name of the operation. pub fn name(&self) -> &OpName { - &self.op_name + &self.name } /// Type arguments. @@ -399,9 +399,9 @@ pub fn resolve_opaque_op( ) -> Result, CustomOpError> { if let Some(r) = extension_registry.get(&opaque.extension) { // Fail if the Extension was found but did not have the expected operation - let Some(def) = r.get_op(&opaque.op_name) else { + let Some(def) = r.get_op(&opaque.name) else { return Err(CustomOpError::OpNotFoundInExtension( - opaque.op_name.clone(), + opaque.name.clone(), r.name().clone(), )); }; diff --git a/hugr-py/src/hugr/__init__.py b/hugr-py/src/hugr/__init__.py index 048ac1423..aa93c9499 100644 --- a/hugr-py/src/hugr/__init__.py +++ b/hugr-py/src/hugr/__init__.py @@ -5,3 +5,8 @@ # This is updated by our release-please workflow, triggered by this # annotation: x-release-please-version __version__ = "0.4.0" + + +def get_serialisation_version() -> str: + """Return the current version of the serialization schema.""" + return "v2" diff --git a/hugr-py/src/hugr/ops.py b/hugr-py/src/hugr/ops.py index 4a76c6d59..651b3287f 100644 --- a/hugr-py/src/hugr/ops.py +++ b/hugr-py/src/hugr/ops.py @@ -255,7 +255,7 @@ def __eq__(self, other: object) -> bool: slf, other = self.custom_op, other.custom_op return ( slf.extension == other.extension - and slf.op_name == other.op_name + and slf.name == other.name and slf.signature == other.signature and slf.args == other.args ) @@ -275,7 +275,7 @@ def num_out(self) -> int: class Custom(AsCustomOp): """A non-core dataflow operation defined in an extension.""" - op_name: str + name: str signature: tys.FunctionType = field(default_factory=tys.FunctionType.empty) description: str = "" extension: tys.ExtensionId = "" @@ -285,7 +285,7 @@ def to_serial(self, parent: Node) -> sops.CustomOp: return sops.CustomOp( parent=parent.idx, extension=self.extension, - op_name=self.op_name, + name=self.name, signature=self.signature.to_serial(), description=self.description, args=ser_it(self.args), @@ -298,9 +298,9 @@ def to_custom(self) -> Custom: def from_custom(cls, custom: Custom) -> Custom: return custom - def check_id(self, extension: tys.ExtensionId, op_name: str) -> bool: + def check_id(self, extension: tys.ExtensionId, name: str) -> bool: """Check if the operation matches the given extension and operation name.""" - return self.extension == extension and self.op_name == op_name + return self.extension == extension and self.name == name @dataclass() diff --git a/hugr-py/src/hugr/serialization/ops.py b/hugr-py/src/hugr/serialization/ops.py index e778939c1..f45a02121 100644 --- a/hugr-py/src/hugr/serialization/ops.py +++ b/hugr-py/src/hugr/serialization/ops.py @@ -504,7 +504,7 @@ class CustomOp(DataflowOp): op: Literal["CustomOp"] = "CustomOp" extension: ExtensionId - op_name: str + name: str signature: stys.FunctionType = Field(default_factory=stys.FunctionType.empty) description: str = "" args: list[stys.TypeArg] = Field(default_factory=list) @@ -513,12 +513,12 @@ def insert_port_types(self, in_types: TypeRow, out_types: TypeRow) -> None: self.signature = stys.FunctionType(input=list(in_types), output=list(out_types)) def display_name(self) -> str: - return self.op_name + return self.name def deserialize(self) -> ops.Custom: return ops.Custom( extension=self.extension, - op_name=self.op_name, + name=self.name, signature=self.signature.deserialize(), args=deser_it(self.args), ) diff --git a/hugr-py/src/hugr/serialization/serial_hugr.py b/hugr-py/src/hugr/serialization/serial_hugr.py index 619eaca90..fc5ad03b6 100644 --- a/hugr-py/src/hugr/serialization/serial_hugr.py +++ b/hugr-py/src/hugr/serialization/serial_hugr.py @@ -1,8 +1,9 @@ -from typing import Any, Literal +from typing import Any from pydantic import ConfigDict, Field import hugr +from hugr import get_serialisation_version from .ops import NodeID, OpType from .ops import classes as ops_classes @@ -11,11 +12,18 @@ Port = tuple[NodeID, int | None] # (node, offset) Edge = tuple[Port, Port] +VersionField = Field( + default_factory=get_serialisation_version, + title="Version", + description="Serialisation Schema Version", + frozen=True, +) + class SerialHugr(ConfiguredBaseModel): """A serializable representation of a Hugr.""" - version: Literal["v1"] = "v1" + version: str = VersionField nodes: list[OpType] edges: list[Edge] metadata: list[dict[str, Any] | None] | None = None diff --git a/hugr-py/src/hugr/serialization/testing_hugr.py b/hugr-py/src/hugr/serialization/testing_hugr.py index 43acd1d43..6dcaed156 100644 --- a/hugr-py/src/hugr/serialization/testing_hugr.py +++ b/hugr-py/src/hugr/serialization/testing_hugr.py @@ -1,9 +1,8 @@ -from typing import Literal - from pydantic import ConfigDict from .ops import OpDef, OpType, Value from .ops import classes as ops_classes +from .serial_hugr import VersionField from .tys import ConfiguredBaseModel, PolyFuncType, SumType, Type, model_rebuild @@ -12,7 +11,7 @@ class TestingHugr(ConfiguredBaseModel): Value, OpType. Intended for testing only. """ - version: Literal["v1"] = "v1" + version: str = VersionField typ: Type | None = None sum_type: SumType | None = None poly_func_type: PolyFuncType | None = None diff --git a/hugr-py/src/hugr/std/int.py b/hugr-py/src/hugr/std/int.py index 391ebc7eb..a6a560cb0 100644 --- a/hugr-py/src/hugr/std/int.py +++ b/hugr-py/src/hugr/std/int.py @@ -57,7 +57,7 @@ def to_value(self) -> val.Extension: class _DivModDef(AsCustomOp): """DivMod operation, has two inputs and two outputs.""" - op_name: ClassVar[str] = "idivmod_u" + name: ClassVar[str] = "idivmod_u" arg1: int = 5 arg2: int = 5 diff --git a/hugr-py/tests/conftest.py b/hugr-py/tests/conftest.py index 6da88c4ba..075b70efb 100644 --- a/hugr-py/tests/conftest.py +++ b/hugr-py/tests/conftest.py @@ -26,11 +26,8 @@ def _load_enum(enum_cls: type[E], custom: Custom) -> E | None: - if ( - custom.extension == QUANTUM_EXTENSION_ID - and custom.op_name in enum_cls.__members__ - ): - return enum_cls(custom.op_name) + if custom.extension == QUANTUM_EXTENSION_ID and custom.name in enum_cls.__members__: + return enum_cls(custom.name) return None diff --git a/hugr-py/tests/serialization/test_basic.py b/hugr-py/tests/serialization/test_basic.py index 1479888eb..ae1815bf2 100644 --- a/hugr-py/tests/serialization/test_basic.py +++ b/hugr-py/tests/serialization/test_basic.py @@ -1,10 +1,11 @@ +from hugr import get_serialisation_version from hugr.serialization.serial_hugr import SerialHugr def test_empty(): h = SerialHugr(nodes=[], edges=[]) assert h.model_dump() == { - "version": "v1", + "version": get_serialisation_version(), "nodes": [], "edges": [], "metadata": None, diff --git a/poetry.lock b/poetry.lock index 0a82d9f3c..aac6c9c01 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "annotated-types" @@ -35,63 +35,63 @@ files = [ [[package]] name = "coverage" -version = "7.5.4" +version = "7.6.0" description = "Code coverage measurement for Python" optional = false python-versions = ">=3.8" files = [ - {file = "coverage-7.5.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:6cfb5a4f556bb51aba274588200a46e4dd6b505fb1a5f8c5ae408222eb416f99"}, - {file = "coverage-7.5.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2174e7c23e0a454ffe12267a10732c273243b4f2d50d07544a91198f05c48f47"}, - {file = "coverage-7.5.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2214ee920787d85db1b6a0bd9da5f8503ccc8fcd5814d90796c2f2493a2f4d2e"}, - {file = "coverage-7.5.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1137f46adb28e3813dec8c01fefadcb8c614f33576f672962e323b5128d9a68d"}, - {file = "coverage-7.5.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b385d49609f8e9efc885790a5a0e89f2e3ae042cdf12958b6034cc442de428d3"}, - {file = "coverage-7.5.4-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:b4a474f799456e0eb46d78ab07303286a84a3140e9700b9e154cfebc8f527016"}, - {file = "coverage-7.5.4-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:5cd64adedf3be66f8ccee418473c2916492d53cbafbfcff851cbec5a8454b136"}, - {file = "coverage-7.5.4-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:e564c2cf45d2f44a9da56f4e3a26b2236504a496eb4cb0ca7221cd4cc7a9aca9"}, - {file = "coverage-7.5.4-cp310-cp310-win32.whl", hash = "sha256:7076b4b3a5f6d2b5d7f1185fde25b1e54eb66e647a1dfef0e2c2bfaf9b4c88c8"}, - {file = "coverage-7.5.4-cp310-cp310-win_amd64.whl", hash = "sha256:018a12985185038a5b2bcafab04ab833a9a0f2c59995b3cec07e10074c78635f"}, - {file = "coverage-7.5.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:db14f552ac38f10758ad14dd7b983dbab424e731588d300c7db25b6f89e335b5"}, - {file = "coverage-7.5.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:3257fdd8e574805f27bb5342b77bc65578e98cbc004a92232106344053f319ba"}, - {file = "coverage-7.5.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3a6612c99081d8d6134005b1354191e103ec9705d7ba2754e848211ac8cacc6b"}, - {file = "coverage-7.5.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d45d3cbd94159c468b9b8c5a556e3f6b81a8d1af2a92b77320e887c3e7a5d080"}, - {file = "coverage-7.5.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ed550e7442f278af76d9d65af48069f1fb84c9f745ae249c1a183c1e9d1b025c"}, - {file = "coverage-7.5.4-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:7a892be37ca35eb5019ec85402c3371b0f7cda5ab5056023a7f13da0961e60da"}, - {file = "coverage-7.5.4-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:8192794d120167e2a64721d88dbd688584675e86e15d0569599257566dec9bf0"}, - {file = "coverage-7.5.4-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:820bc841faa502e727a48311948e0461132a9c8baa42f6b2b84a29ced24cc078"}, - {file = "coverage-7.5.4-cp311-cp311-win32.whl", hash = "sha256:6aae5cce399a0f065da65c7bb1e8abd5c7a3043da9dceb429ebe1b289bc07806"}, - {file = "coverage-7.5.4-cp311-cp311-win_amd64.whl", hash = "sha256:d2e344d6adc8ef81c5a233d3a57b3c7d5181f40e79e05e1c143da143ccb6377d"}, - {file = "coverage-7.5.4-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:54317c2b806354cbb2dc7ac27e2b93f97096912cc16b18289c5d4e44fc663233"}, - {file = "coverage-7.5.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:042183de01f8b6d531e10c197f7f0315a61e8d805ab29c5f7b51a01d62782747"}, - {file = "coverage-7.5.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a6bb74ed465d5fb204b2ec41d79bcd28afccf817de721e8a807d5141c3426638"}, - {file = "coverage-7.5.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b3d45ff86efb129c599a3b287ae2e44c1e281ae0f9a9bad0edc202179bcc3a2e"}, - {file = "coverage-7.5.4-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5013ed890dc917cef2c9f765c4c6a8ae9df983cd60dbb635df8ed9f4ebc9f555"}, - {file = "coverage-7.5.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:1014fbf665fef86cdfd6cb5b7371496ce35e4d2a00cda501cf9f5b9e6fced69f"}, - {file = "coverage-7.5.4-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:3684bc2ff328f935981847082ba4fdc950d58906a40eafa93510d1b54c08a66c"}, - {file = "coverage-7.5.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:581ea96f92bf71a5ec0974001f900db495488434a6928a2ca7f01eee20c23805"}, - {file = "coverage-7.5.4-cp312-cp312-win32.whl", hash = "sha256:73ca8fbc5bc622e54627314c1a6f1dfdd8db69788f3443e752c215f29fa87a0b"}, - {file = "coverage-7.5.4-cp312-cp312-win_amd64.whl", hash = "sha256:cef4649ec906ea7ea5e9e796e68b987f83fa9a718514fe147f538cfeda76d7a7"}, - {file = "coverage-7.5.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:cdd31315fc20868c194130de9ee6bfd99755cc9565edff98ecc12585b90be882"}, - {file = "coverage-7.5.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:02ff6e898197cc1e9fa375581382b72498eb2e6d5fc0b53f03e496cfee3fac6d"}, - {file = "coverage-7.5.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d05c16cf4b4c2fc880cb12ba4c9b526e9e5d5bb1d81313d4d732a5b9fe2b9d53"}, - {file = "coverage-7.5.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c5986ee7ea0795a4095ac4d113cbb3448601efca7f158ec7f7087a6c705304e4"}, - {file = "coverage-7.5.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5df54843b88901fdc2f598ac06737f03d71168fd1175728054c8f5a2739ac3e4"}, - {file = "coverage-7.5.4-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:ab73b35e8d109bffbda9a3e91c64e29fe26e03e49addf5b43d85fc426dde11f9"}, - {file = "coverage-7.5.4-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:aea072a941b033813f5e4814541fc265a5c12ed9720daef11ca516aeacd3bd7f"}, - {file = "coverage-7.5.4-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:16852febd96acd953b0d55fc842ce2dac1710f26729b31c80b940b9afcd9896f"}, - {file = "coverage-7.5.4-cp38-cp38-win32.whl", hash = "sha256:8f894208794b164e6bd4bba61fc98bf6b06be4d390cf2daacfa6eca0a6d2bb4f"}, - {file = "coverage-7.5.4-cp38-cp38-win_amd64.whl", hash = "sha256:e2afe743289273209c992075a5a4913e8d007d569a406ffed0bd080ea02b0633"}, - {file = "coverage-7.5.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b95c3a8cb0463ba9f77383d0fa8c9194cf91f64445a63fc26fb2327e1e1eb088"}, - {file = "coverage-7.5.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3d7564cc09dd91b5a6001754a5b3c6ecc4aba6323baf33a12bd751036c998be4"}, - {file = "coverage-7.5.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:44da56a2589b684813f86d07597fdf8a9c6ce77f58976727329272f5a01f99f7"}, - {file = "coverage-7.5.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e16f3d6b491c48c5ae726308e6ab1e18ee830b4cdd6913f2d7f77354b33f91c8"}, - {file = "coverage-7.5.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dbc5958cb471e5a5af41b0ddaea96a37e74ed289535e8deca404811f6cb0bc3d"}, - {file = "coverage-7.5.4-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:a04e990a2a41740b02d6182b498ee9796cf60eefe40cf859b016650147908029"}, - {file = "coverage-7.5.4-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:ddbd2f9713a79e8e7242d7c51f1929611e991d855f414ca9996c20e44a895f7c"}, - {file = "coverage-7.5.4-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:b1ccf5e728ccf83acd313c89f07c22d70d6c375a9c6f339233dcf792094bcbf7"}, - {file = "coverage-7.5.4-cp39-cp39-win32.whl", hash = "sha256:56b4eafa21c6c175b3ede004ca12c653a88b6f922494b023aeb1e836df953ace"}, - {file = "coverage-7.5.4-cp39-cp39-win_amd64.whl", hash = "sha256:65e528e2e921ba8fd67d9055e6b9f9e34b21ebd6768ae1c1723f4ea6ace1234d"}, - {file = "coverage-7.5.4-pp38.pp39.pp310-none-any.whl", hash = "sha256:79b356f3dd5b26f3ad23b35c75dbdaf1f9e2450b6bcefc6d0825ea0aa3f86ca5"}, - {file = "coverage-7.5.4.tar.gz", hash = "sha256:a44963520b069e12789d0faea4e9fdb1e410cdc4aab89d94f7f55cbb7fef0353"}, + {file = "coverage-7.6.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:dff044f661f59dace805eedb4a7404c573b6ff0cdba4a524141bc63d7be5c7fd"}, + {file = "coverage-7.6.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:a8659fd33ee9e6ca03950cfdcdf271d645cf681609153f218826dd9805ab585c"}, + {file = "coverage-7.6.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7792f0ab20df8071d669d929c75c97fecfa6bcab82c10ee4adb91c7a54055463"}, + {file = "coverage-7.6.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d4b3cd1ca7cd73d229487fa5caca9e4bc1f0bca96526b922d61053ea751fe791"}, + {file = "coverage-7.6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e7e128f85c0b419907d1f38e616c4f1e9f1d1b37a7949f44df9a73d5da5cd53c"}, + {file = "coverage-7.6.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:a94925102c89247530ae1dab7dc02c690942566f22e189cbd53579b0693c0783"}, + {file = "coverage-7.6.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:dcd070b5b585b50e6617e8972f3fbbee786afca71b1936ac06257f7e178f00f6"}, + {file = "coverage-7.6.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:d50a252b23b9b4dfeefc1f663c568a221092cbaded20a05a11665d0dbec9b8fb"}, + {file = "coverage-7.6.0-cp310-cp310-win32.whl", hash = "sha256:0e7b27d04131c46e6894f23a4ae186a6a2207209a05df5b6ad4caee6d54a222c"}, + {file = "coverage-7.6.0-cp310-cp310-win_amd64.whl", hash = "sha256:54dece71673b3187c86226c3ca793c5f891f9fc3d8aa183f2e3653da18566169"}, + {file = "coverage-7.6.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c7b525ab52ce18c57ae232ba6f7010297a87ced82a2383b1afd238849c1ff933"}, + {file = "coverage-7.6.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:4bea27c4269234e06f621f3fac3925f56ff34bc14521484b8f66a580aacc2e7d"}, + {file = "coverage-7.6.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ed8d1d1821ba5fc88d4a4f45387b65de52382fa3ef1f0115a4f7a20cdfab0e94"}, + {file = "coverage-7.6.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:01c322ef2bbe15057bc4bf132b525b7e3f7206f071799eb8aa6ad1940bcf5fb1"}, + {file = "coverage-7.6.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:03cafe82c1b32b770a29fd6de923625ccac3185a54a5e66606da26d105f37dac"}, + {file = "coverage-7.6.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:0d1b923fc4a40c5832be4f35a5dab0e5ff89cddf83bb4174499e02ea089daf57"}, + {file = "coverage-7.6.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:4b03741e70fb811d1a9a1d75355cf391f274ed85847f4b78e35459899f57af4d"}, + {file = "coverage-7.6.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:a73d18625f6a8a1cbb11eadc1d03929f9510f4131879288e3f7922097a429f63"}, + {file = "coverage-7.6.0-cp311-cp311-win32.whl", hash = "sha256:65fa405b837060db569a61ec368b74688f429b32fa47a8929a7a2f9b47183713"}, + {file = "coverage-7.6.0-cp311-cp311-win_amd64.whl", hash = "sha256:6379688fb4cfa921ae349c76eb1a9ab26b65f32b03d46bb0eed841fd4cb6afb1"}, + {file = "coverage-7.6.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:f7db0b6ae1f96ae41afe626095149ecd1b212b424626175a6633c2999eaad45b"}, + {file = "coverage-7.6.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:bbdf9a72403110a3bdae77948b8011f644571311c2fb35ee15f0f10a8fc082e8"}, + {file = "coverage-7.6.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9cc44bf0315268e253bf563f3560e6c004efe38f76db03a1558274a6e04bf5d5"}, + {file = "coverage-7.6.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:da8549d17489cd52f85a9829d0e1d91059359b3c54a26f28bec2c5d369524807"}, + {file = "coverage-7.6.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0086cd4fc71b7d485ac93ca4239c8f75732c2ae3ba83f6be1c9be59d9e2c6382"}, + {file = "coverage-7.6.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:1fad32ee9b27350687035cb5fdf9145bc9cf0a094a9577d43e909948ebcfa27b"}, + {file = "coverage-7.6.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:044a0985a4f25b335882b0966625270a8d9db3d3409ddc49a4eb00b0ef5e8cee"}, + {file = "coverage-7.6.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:76d5f82213aa78098b9b964ea89de4617e70e0d43e97900c2778a50856dac605"}, + {file = "coverage-7.6.0-cp312-cp312-win32.whl", hash = "sha256:3c59105f8d58ce500f348c5b56163a4113a440dad6daa2294b5052a10db866da"}, + {file = "coverage-7.6.0-cp312-cp312-win_amd64.whl", hash = "sha256:ca5d79cfdae420a1d52bf177de4bc2289c321d6c961ae321503b2ca59c17ae67"}, + {file = "coverage-7.6.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:d39bd10f0ae453554798b125d2f39884290c480f56e8a02ba7a6ed552005243b"}, + {file = "coverage-7.6.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:beb08e8508e53a568811016e59f3234d29c2583f6b6e28572f0954a6b4f7e03d"}, + {file = "coverage-7.6.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b2e16f4cd2bc4d88ba30ca2d3bbf2f21f00f382cf4e1ce3b1ddc96c634bc48ca"}, + {file = "coverage-7.6.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6616d1c9bf1e3faea78711ee42a8b972367d82ceae233ec0ac61cc7fec09fa6b"}, + {file = "coverage-7.6.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ad4567d6c334c46046d1c4c20024de2a1c3abc626817ae21ae3da600f5779b44"}, + {file = "coverage-7.6.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:d17c6a415d68cfe1091d3296ba5749d3d8696e42c37fca5d4860c5bf7b729f03"}, + {file = "coverage-7.6.0-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:9146579352d7b5f6412735d0f203bbd8d00113a680b66565e205bc605ef81bc6"}, + {file = "coverage-7.6.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:cdab02a0a941af190df8782aafc591ef3ad08824f97850b015c8c6a8b3877b0b"}, + {file = "coverage-7.6.0-cp38-cp38-win32.whl", hash = "sha256:df423f351b162a702c053d5dddc0fc0ef9a9e27ea3f449781ace5f906b664428"}, + {file = "coverage-7.6.0-cp38-cp38-win_amd64.whl", hash = "sha256:f2501d60d7497fd55e391f423f965bbe9e650e9ffc3c627d5f0ac516026000b8"}, + {file = "coverage-7.6.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:7221f9ac9dad9492cecab6f676b3eaf9185141539d5c9689d13fd6b0d7de840c"}, + {file = "coverage-7.6.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ddaaa91bfc4477d2871442bbf30a125e8fe6b05da8a0015507bfbf4718228ab2"}, + {file = "coverage-7.6.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c4cbe651f3904e28f3a55d6f371203049034b4ddbce65a54527a3f189ca3b390"}, + {file = "coverage-7.6.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:831b476d79408ab6ccfadaaf199906c833f02fdb32c9ab907b1d4aa0713cfa3b"}, + {file = "coverage-7.6.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:46c3d091059ad0b9c59d1034de74a7f36dcfa7f6d3bde782c49deb42438f2450"}, + {file = "coverage-7.6.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:4d5fae0a22dc86259dee66f2cc6c1d3e490c4a1214d7daa2a93d07491c5c04b6"}, + {file = "coverage-7.6.0-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:07ed352205574aad067482e53dd606926afebcb5590653121063fbf4e2175166"}, + {file = "coverage-7.6.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:49c76cdfa13015c4560702574bad67f0e15ca5a2872c6a125f6327ead2b731dd"}, + {file = "coverage-7.6.0-cp39-cp39-win32.whl", hash = "sha256:482855914928c8175735a2a59c8dc5806cf7d8f032e4820d52e845d1f731dca2"}, + {file = "coverage-7.6.0-cp39-cp39-win_amd64.whl", hash = "sha256:543ef9179bc55edfd895154a51792b01c017c87af0ebaae092720152e19e42ca"}, + {file = "coverage-7.6.0-pp38.pp39.pp310-none-any.whl", hash = "sha256:6fe885135c8a479d3e37a7aae61cbd3a0fb2deccb4dda3c25f92a49189f766d6"}, + {file = "coverage-7.6.0.tar.gz", hash = "sha256:289cc803fa1dc901f84701ac10c9ee873619320f2f9aff38794db4a4a0268d51"}, ] [package.dependencies] @@ -113,13 +113,13 @@ files = [ [[package]] name = "exceptiongroup" -version = "1.2.1" +version = "1.2.2" description = "Backport of PEP 654 (exception groups)" optional = false python-versions = ">=3.7" files = [ - {file = "exceptiongroup-1.2.1-py3-none-any.whl", hash = "sha256:5258b9ed329c5bbdd31a309f53cbfb0b155341807f6ff7606a1e801a891b29ad"}, - {file = "exceptiongroup-1.2.1.tar.gz", hash = "sha256:a4785e48b045528f5bfe627b6ad554ff32def154f42372786903b7abcfe1aa16"}, + {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, + {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"}, ] [package.extras] @@ -143,7 +143,7 @@ typing = ["typing-extensions (>=4.8)"] [[package]] name = "hugr" -version = "0.2.1" +version = "0.4.0" description = "Quantinuum's common representation for quantum programs" optional = false python-versions = ">=3.10" @@ -151,7 +151,7 @@ files = [] develop = true [package.dependencies] -pydantic = "~2.7.0" +pydantic = ">=2.7,<2.9" [package.source] type = "directory" @@ -159,13 +159,13 @@ url = "hugr-py" [[package]] name = "identify" -version = "2.5.36" +version = "2.6.0" description = "File identification library for Python" optional = false python-versions = ">=3.8" files = [ - {file = "identify-2.5.36-py2.py3-none-any.whl", hash = "sha256:37d93f380f4de590500d9dba7db359d0d3da95ffe7f9de1753faa159e71e7dfa"}, - {file = "identify-2.5.36.tar.gz", hash = "sha256:e5e00f54165f9047fbebeb4a560f9acfb8af4c88232be60a488e9b68d122745d"}, + {file = "identify-2.6.0-py2.py3-none-any.whl", hash = "sha256:e79ae4406387a9d300332b5fd366d8994f1525e8414984e1a59e058b2eda2dd0"}, + {file = "identify-2.6.0.tar.gz", hash = "sha256:cb171c685bdc31bcc4c1734698736a7d5b6c8bf2e0c15117f4d469c8640ae5cf"}, ] [package.extras] @@ -313,109 +313,122 @@ virtualenv = ">=20.10.0" [[package]] name = "pydantic" -version = "2.7.4" +version = "2.8.2" description = "Data validation using Python type hints" optional = false python-versions = ">=3.8" files = [ - {file = "pydantic-2.7.4-py3-none-any.whl", hash = "sha256:ee8538d41ccb9c0a9ad3e0e5f07bf15ed8015b481ced539a1759d8cc89ae90d0"}, - {file = "pydantic-2.7.4.tar.gz", hash = "sha256:0c84efd9548d545f63ac0060c1e4d39bb9b14db8b3c0652338aecc07b5adec52"}, + {file = "pydantic-2.8.2-py3-none-any.whl", hash = "sha256:73ee9fddd406dc318b885c7a2eab8a6472b68b8fb5ba8150949fc3db939f23c8"}, + {file = "pydantic-2.8.2.tar.gz", hash = "sha256:6f62c13d067b0755ad1c21a34bdd06c0c12625a22b0fc09c6b149816604f7c2a"}, ] [package.dependencies] annotated-types = ">=0.4.0" -pydantic-core = "2.18.4" -typing-extensions = ">=4.6.1" +pydantic-core = "2.20.1" +typing-extensions = [ + {version = ">=4.12.2", markers = "python_version >= \"3.13\""}, + {version = ">=4.6.1", markers = "python_version < \"3.13\""}, +] [package.extras] email = ["email-validator (>=2.0.0)"] [[package]] name = "pydantic-core" -version = "2.18.4" +version = "2.20.1" description = "Core functionality for Pydantic validation and serialization" optional = false python-versions = ">=3.8" files = [ - {file = "pydantic_core-2.18.4-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:f76d0ad001edd426b92233d45c746fd08f467d56100fd8f30e9ace4b005266e4"}, - {file = "pydantic_core-2.18.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:59ff3e89f4eaf14050c8022011862df275b552caef8082e37b542b066ce1ff26"}, - {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a55b5b16c839df1070bc113c1f7f94a0af4433fcfa1b41799ce7606e5c79ce0a"}, - {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4d0dcc59664fcb8974b356fe0a18a672d6d7cf9f54746c05f43275fc48636851"}, - {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8951eee36c57cd128f779e641e21eb40bc5073eb28b2d23f33eb0ef14ffb3f5d"}, - {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4701b19f7e3a06ea655513f7938de6f108123bf7c86bbebb1196eb9bd35cf724"}, - {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e00a3f196329e08e43d99b79b286d60ce46bed10f2280d25a1718399457e06be"}, - {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:97736815b9cc893b2b7f663628e63f436018b75f44854c8027040e05230eeddb"}, - {file = "pydantic_core-2.18.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:6891a2ae0e8692679c07728819b6e2b822fb30ca7445f67bbf6509b25a96332c"}, - {file = "pydantic_core-2.18.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:bc4ff9805858bd54d1a20efff925ccd89c9d2e7cf4986144b30802bf78091c3e"}, - {file = "pydantic_core-2.18.4-cp310-none-win32.whl", hash = "sha256:1b4de2e51bbcb61fdebd0ab86ef28062704f62c82bbf4addc4e37fa4b00b7cbc"}, - {file = "pydantic_core-2.18.4-cp310-none-win_amd64.whl", hash = "sha256:6a750aec7bf431517a9fd78cb93c97b9b0c496090fee84a47a0d23668976b4b0"}, - {file = "pydantic_core-2.18.4-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:942ba11e7dfb66dc70f9ae66b33452f51ac7bb90676da39a7345e99ffb55402d"}, - {file = "pydantic_core-2.18.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b2ebef0e0b4454320274f5e83a41844c63438fdc874ea40a8b5b4ecb7693f1c4"}, - {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a642295cd0c8df1b86fc3dced1d067874c353a188dc8e0f744626d49e9aa51c4"}, - {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5f09baa656c904807e832cf9cce799c6460c450c4ad80803517032da0cd062e2"}, - {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:98906207f29bc2c459ff64fa007afd10a8c8ac080f7e4d5beff4c97086a3dabd"}, - {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:19894b95aacfa98e7cb093cd7881a0c76f55731efad31073db4521e2b6ff5b7d"}, - {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0fbbdc827fe5e42e4d196c746b890b3d72876bdbf160b0eafe9f0334525119c8"}, - {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f85d05aa0918283cf29a30b547b4df2fbb56b45b135f9e35b6807cb28bc47951"}, - {file = "pydantic_core-2.18.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e85637bc8fe81ddb73fda9e56bab24560bdddfa98aa64f87aaa4e4b6730c23d2"}, - {file = "pydantic_core-2.18.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:2f5966897e5461f818e136b8451d0551a2e77259eb0f73a837027b47dc95dab9"}, - {file = "pydantic_core-2.18.4-cp311-none-win32.whl", hash = "sha256:44c7486a4228413c317952e9d89598bcdfb06399735e49e0f8df643e1ccd0558"}, - {file = "pydantic_core-2.18.4-cp311-none-win_amd64.whl", hash = "sha256:8a7164fe2005d03c64fd3b85649891cd4953a8de53107940bf272500ba8a788b"}, - {file = "pydantic_core-2.18.4-cp311-none-win_arm64.whl", hash = "sha256:4e99bc050fe65c450344421017f98298a97cefc18c53bb2f7b3531eb39bc7805"}, - {file = "pydantic_core-2.18.4-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:6f5c4d41b2771c730ea1c34e458e781b18cc668d194958e0112455fff4e402b2"}, - {file = "pydantic_core-2.18.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2fdf2156aa3d017fddf8aea5adfba9f777db1d6022d392b682d2a8329e087cef"}, - {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4748321b5078216070b151d5271ef3e7cc905ab170bbfd27d5c83ee3ec436695"}, - {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:847a35c4d58721c5dc3dba599878ebbdfd96784f3fb8bb2c356e123bdcd73f34"}, - {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3c40d4eaad41f78e3bbda31b89edc46a3f3dc6e171bf0ecf097ff7a0ffff7cb1"}, - {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:21a5e440dbe315ab9825fcd459b8814bb92b27c974cbc23c3e8baa2b76890077"}, - {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:01dd777215e2aa86dfd664daed5957704b769e726626393438f9c87690ce78c3"}, - {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4b06beb3b3f1479d32befd1f3079cc47b34fa2da62457cdf6c963393340b56e9"}, - {file = "pydantic_core-2.18.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:564d7922e4b13a16b98772441879fcdcbe82ff50daa622d681dd682175ea918c"}, - {file = "pydantic_core-2.18.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:0eb2a4f660fcd8e2b1c90ad566db2b98d7f3f4717c64fe0a83e0adb39766d5b8"}, - {file = "pydantic_core-2.18.4-cp312-none-win32.whl", hash = "sha256:8b8bab4c97248095ae0c4455b5a1cd1cdd96e4e4769306ab19dda135ea4cdb07"}, - {file = "pydantic_core-2.18.4-cp312-none-win_amd64.whl", hash = "sha256:14601cdb733d741b8958224030e2bfe21a4a881fb3dd6fbb21f071cabd48fa0a"}, - {file = "pydantic_core-2.18.4-cp312-none-win_arm64.whl", hash = "sha256:c1322d7dd74713dcc157a2b7898a564ab091ca6c58302d5c7b4c07296e3fd00f"}, - {file = "pydantic_core-2.18.4-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:823be1deb01793da05ecb0484d6c9e20baebb39bd42b5d72636ae9cf8350dbd2"}, - {file = "pydantic_core-2.18.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:ebef0dd9bf9b812bf75bda96743f2a6c5734a02092ae7f721c048d156d5fabae"}, - {file = "pydantic_core-2.18.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ae1d6df168efb88d7d522664693607b80b4080be6750c913eefb77e34c12c71a"}, - {file = "pydantic_core-2.18.4-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f9899c94762343f2cc2fc64c13e7cae4c3cc65cdfc87dd810a31654c9b7358cc"}, - {file = "pydantic_core-2.18.4-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:99457f184ad90235cfe8461c4d70ab7dd2680e28821c29eca00252ba90308c78"}, - {file = "pydantic_core-2.18.4-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:18f469a3d2a2fdafe99296a87e8a4c37748b5080a26b806a707f25a902c040a8"}, - {file = "pydantic_core-2.18.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b7cdf28938ac6b8b49ae5e92f2735056a7ba99c9b110a474473fd71185c1af5d"}, - {file = "pydantic_core-2.18.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:938cb21650855054dc54dfd9120a851c974f95450f00683399006aa6e8abb057"}, - {file = "pydantic_core-2.18.4-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:44cd83ab6a51da80fb5adbd9560e26018e2ac7826f9626bc06ca3dc074cd198b"}, - {file = "pydantic_core-2.18.4-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:972658f4a72d02b8abfa2581d92d59f59897d2e9f7e708fdabe922f9087773af"}, - {file = "pydantic_core-2.18.4-cp38-none-win32.whl", hash = "sha256:1d886dc848e60cb7666f771e406acae54ab279b9f1e4143babc9c2258213daa2"}, - {file = "pydantic_core-2.18.4-cp38-none-win_amd64.whl", hash = "sha256:bb4462bd43c2460774914b8525f79b00f8f407c945d50881568f294c1d9b4443"}, - {file = "pydantic_core-2.18.4-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:44a688331d4a4e2129140a8118479443bd6f1905231138971372fcde37e43528"}, - {file = "pydantic_core-2.18.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a2fdd81edd64342c85ac7cf2753ccae0b79bf2dfa063785503cb85a7d3593223"}, - {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:86110d7e1907ab36691f80b33eb2da87d780f4739ae773e5fc83fb272f88825f"}, - {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:46387e38bd641b3ee5ce247563b60c5ca098da9c56c75c157a05eaa0933ed154"}, - {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:123c3cec203e3f5ac7b000bd82235f1a3eced8665b63d18be751f115588fea30"}, - {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dc1803ac5c32ec324c5261c7209e8f8ce88e83254c4e1aebdc8b0a39f9ddb443"}, - {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:53db086f9f6ab2b4061958d9c276d1dbe3690e8dd727d6abf2321d6cce37fa94"}, - {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:abc267fa9837245cc28ea6929f19fa335f3dc330a35d2e45509b6566dc18be23"}, - {file = "pydantic_core-2.18.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:a0d829524aaefdebccb869eed855e2d04c21d2d7479b6cada7ace5448416597b"}, - {file = "pydantic_core-2.18.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:509daade3b8649f80d4e5ff21aa5673e4ebe58590b25fe42fac5f0f52c6f034a"}, - {file = "pydantic_core-2.18.4-cp39-none-win32.whl", hash = "sha256:ca26a1e73c48cfc54c4a76ff78df3727b9d9f4ccc8dbee4ae3f73306a591676d"}, - {file = "pydantic_core-2.18.4-cp39-none-win_amd64.whl", hash = "sha256:c67598100338d5d985db1b3d21f3619ef392e185e71b8d52bceacc4a7771ea7e"}, - {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:574d92eac874f7f4db0ca653514d823a0d22e2354359d0759e3f6a406db5d55d"}, - {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:1f4d26ceb5eb9eed4af91bebeae4b06c3fb28966ca3a8fb765208cf6b51102ab"}, - {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77450e6d20016ec41f43ca4a6c63e9fdde03f0ae3fe90e7c27bdbeaece8b1ed4"}, - {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d323a01da91851a4f17bf592faf46149c9169d68430b3146dcba2bb5e5719abc"}, - {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:43d447dd2ae072a0065389092a231283f62d960030ecd27565672bd40746c507"}, - {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:578e24f761f3b425834f297b9935e1ce2e30f51400964ce4801002435a1b41ef"}, - {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:81b5efb2f126454586d0f40c4d834010979cb80785173d1586df845a632e4e6d"}, - {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:ab86ce7c8f9bea87b9d12c7f0af71102acbf5ecbc66c17796cff45dae54ef9a5"}, - {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:90afc12421df2b1b4dcc975f814e21bc1754640d502a2fbcc6d41e77af5ec312"}, - {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:51991a89639a912c17bef4b45c87bd83593aee0437d8102556af4885811d59f5"}, - {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:293afe532740370aba8c060882f7d26cfd00c94cae32fd2e212a3a6e3b7bc15e"}, - {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b48ece5bde2e768197a2d0f6e925f9d7e3e826f0ad2271120f8144a9db18d5c8"}, - {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:eae237477a873ab46e8dd748e515c72c0c804fb380fbe6c85533c7de51f23a8f"}, - {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:834b5230b5dfc0c1ec37b2fda433b271cbbc0e507560b5d1588e2cc1148cf1ce"}, - {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:e858ac0a25074ba4bce653f9b5d0a85b7456eaddadc0ce82d3878c22489fa4ee"}, - {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:2fd41f6eff4c20778d717af1cc50eca52f5afe7805ee530a4fbd0bae284f16e9"}, - {file = "pydantic_core-2.18.4.tar.gz", hash = "sha256:ec3beeada09ff865c344ff3bc2f427f5e6c26401cc6113d77e372c3fdac73864"}, + {file = "pydantic_core-2.20.1-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:3acae97ffd19bf091c72df4d726d552c473f3576409b2a7ca36b2f535ffff4a3"}, + {file = "pydantic_core-2.20.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:41f4c96227a67a013e7de5ff8f20fb496ce573893b7f4f2707d065907bffdbd6"}, + {file = "pydantic_core-2.20.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5f239eb799a2081495ea659d8d4a43a8f42cd1fe9ff2e7e436295c38a10c286a"}, + {file = "pydantic_core-2.20.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:53e431da3fc53360db73eedf6f7124d1076e1b4ee4276b36fb25514544ceb4a3"}, + {file = "pydantic_core-2.20.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f1f62b2413c3a0e846c3b838b2ecd6c7a19ec6793b2a522745b0869e37ab5bc1"}, + {file = "pydantic_core-2.20.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5d41e6daee2813ecceea8eda38062d69e280b39df793f5a942fa515b8ed67953"}, + {file = "pydantic_core-2.20.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3d482efec8b7dc6bfaedc0f166b2ce349df0011f5d2f1f25537ced4cfc34fd98"}, + {file = "pydantic_core-2.20.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:e93e1a4b4b33daed65d781a57a522ff153dcf748dee70b40c7258c5861e1768a"}, + {file = "pydantic_core-2.20.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:e7c4ea22b6739b162c9ecaaa41d718dfad48a244909fe7ef4b54c0b530effc5a"}, + {file = "pydantic_core-2.20.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:4f2790949cf385d985a31984907fecb3896999329103df4e4983a4a41e13e840"}, + {file = "pydantic_core-2.20.1-cp310-none-win32.whl", hash = "sha256:5e999ba8dd90e93d57410c5e67ebb67ffcaadcea0ad973240fdfd3a135506250"}, + {file = "pydantic_core-2.20.1-cp310-none-win_amd64.whl", hash = "sha256:512ecfbefef6dac7bc5eaaf46177b2de58cdf7acac8793fe033b24ece0b9566c"}, + {file = "pydantic_core-2.20.1-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:d2a8fa9d6d6f891f3deec72f5cc668e6f66b188ab14bb1ab52422fe8e644f312"}, + {file = "pydantic_core-2.20.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:175873691124f3d0da55aeea1d90660a6ea7a3cfea137c38afa0a5ffabe37b88"}, + {file = "pydantic_core-2.20.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:37eee5b638f0e0dcd18d21f59b679686bbd18917b87db0193ae36f9c23c355fc"}, + {file = "pydantic_core-2.20.1-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:25e9185e2d06c16ee438ed39bf62935ec436474a6ac4f9358524220f1b236e43"}, + {file = "pydantic_core-2.20.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:150906b40ff188a3260cbee25380e7494ee85048584998c1e66df0c7a11c17a6"}, + {file = "pydantic_core-2.20.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8ad4aeb3e9a97286573c03df758fc7627aecdd02f1da04516a86dc159bf70121"}, + {file = "pydantic_core-2.20.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d3f3ed29cd9f978c604708511a1f9c2fdcb6c38b9aae36a51905b8811ee5cbf1"}, + {file = "pydantic_core-2.20.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b0dae11d8f5ded51699c74d9548dcc5938e0804cc8298ec0aa0da95c21fff57b"}, + {file = "pydantic_core-2.20.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:faa6b09ee09433b87992fb5a2859efd1c264ddc37280d2dd5db502126d0e7f27"}, + {file = "pydantic_core-2.20.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:9dc1b507c12eb0481d071f3c1808f0529ad41dc415d0ca11f7ebfc666e66a18b"}, + {file = "pydantic_core-2.20.1-cp311-none-win32.whl", hash = "sha256:fa2fddcb7107e0d1808086ca306dcade7df60a13a6c347a7acf1ec139aa6789a"}, + {file = "pydantic_core-2.20.1-cp311-none-win_amd64.whl", hash = "sha256:40a783fb7ee353c50bd3853e626f15677ea527ae556429453685ae32280c19c2"}, + {file = "pydantic_core-2.20.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:595ba5be69b35777474fa07f80fc260ea71255656191adb22a8c53aba4479231"}, + {file = "pydantic_core-2.20.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a4f55095ad087474999ee28d3398bae183a66be4823f753cd7d67dd0153427c9"}, + {file = "pydantic_core-2.20.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f9aa05d09ecf4c75157197f27cdc9cfaeb7c5f15021c6373932bf3e124af029f"}, + {file = "pydantic_core-2.20.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e97fdf088d4b31ff4ba35db26d9cc472ac7ef4a2ff2badeabf8d727b3377fc52"}, + {file = "pydantic_core-2.20.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:bc633a9fe1eb87e250b5c57d389cf28998e4292336926b0b6cdaee353f89a237"}, + {file = "pydantic_core-2.20.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d573faf8eb7e6b1cbbcb4f5b247c60ca8be39fe2c674495df0eb4318303137fe"}, + {file = "pydantic_core-2.20.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:26dc97754b57d2fd00ac2b24dfa341abffc380b823211994c4efac7f13b9e90e"}, + {file = "pydantic_core-2.20.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:33499e85e739a4b60c9dac710c20a08dc73cb3240c9a0e22325e671b27b70d24"}, + {file = "pydantic_core-2.20.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:bebb4d6715c814597f85297c332297c6ce81e29436125ca59d1159b07f423eb1"}, + {file = "pydantic_core-2.20.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:516d9227919612425c8ef1c9b869bbbee249bc91912c8aaffb66116c0b447ebd"}, + {file = "pydantic_core-2.20.1-cp312-none-win32.whl", hash = "sha256:469f29f9093c9d834432034d33f5fe45699e664f12a13bf38c04967ce233d688"}, + {file = "pydantic_core-2.20.1-cp312-none-win_amd64.whl", hash = "sha256:035ede2e16da7281041f0e626459bcae33ed998cca6a0a007a5ebb73414ac72d"}, + {file = "pydantic_core-2.20.1-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:0827505a5c87e8aa285dc31e9ec7f4a17c81a813d45f70b1d9164e03a813a686"}, + {file = "pydantic_core-2.20.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:19c0fa39fa154e7e0b7f82f88ef85faa2a4c23cc65aae2f5aea625e3c13c735a"}, + {file = "pydantic_core-2.20.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4aa223cd1e36b642092c326d694d8bf59b71ddddc94cdb752bbbb1c5c91d833b"}, + {file = "pydantic_core-2.20.1-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:c336a6d235522a62fef872c6295a42ecb0c4e1d0f1a3e500fe949415761b8a19"}, + {file = "pydantic_core-2.20.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7eb6a0587eded33aeefea9f916899d42b1799b7b14b8f8ff2753c0ac1741edac"}, + {file = "pydantic_core-2.20.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:70c8daf4faca8da5a6d655f9af86faf6ec2e1768f4b8b9d0226c02f3d6209703"}, + {file = "pydantic_core-2.20.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e9fa4c9bf273ca41f940bceb86922a7667cd5bf90e95dbb157cbb8441008482c"}, + {file = "pydantic_core-2.20.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:11b71d67b4725e7e2a9f6e9c0ac1239bbc0c48cce3dc59f98635efc57d6dac83"}, + {file = "pydantic_core-2.20.1-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:270755f15174fb983890c49881e93f8f1b80f0b5e3a3cc1394a255706cabd203"}, + {file = "pydantic_core-2.20.1-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:c81131869240e3e568916ef4c307f8b99583efaa60a8112ef27a366eefba8ef0"}, + {file = "pydantic_core-2.20.1-cp313-none-win32.whl", hash = "sha256:b91ced227c41aa29c672814f50dbb05ec93536abf8f43cd14ec9521ea09afe4e"}, + {file = "pydantic_core-2.20.1-cp313-none-win_amd64.whl", hash = "sha256:65db0f2eefcaad1a3950f498aabb4875c8890438bc80b19362cf633b87a8ab20"}, + {file = "pydantic_core-2.20.1-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:4745f4ac52cc6686390c40eaa01d48b18997cb130833154801a442323cc78f91"}, + {file = "pydantic_core-2.20.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:a8ad4c766d3f33ba8fd692f9aa297c9058970530a32c728a2c4bfd2616d3358b"}, + {file = "pydantic_core-2.20.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:41e81317dd6a0127cabce83c0c9c3fbecceae981c8391e6f1dec88a77c8a569a"}, + {file = "pydantic_core-2.20.1-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:04024d270cf63f586ad41fff13fde4311c4fc13ea74676962c876d9577bcc78f"}, + {file = "pydantic_core-2.20.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:eaad4ff2de1c3823fddf82f41121bdf453d922e9a238642b1dedb33c4e4f98ad"}, + {file = "pydantic_core-2.20.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:26ab812fa0c845df815e506be30337e2df27e88399b985d0bb4e3ecfe72df31c"}, + {file = "pydantic_core-2.20.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3c5ebac750d9d5f2706654c638c041635c385596caf68f81342011ddfa1e5598"}, + {file = "pydantic_core-2.20.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2aafc5a503855ea5885559eae883978c9b6d8c8993d67766ee73d82e841300dd"}, + {file = "pydantic_core-2.20.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:4868f6bd7c9d98904b748a2653031fc9c2f85b6237009d475b1008bfaeb0a5aa"}, + {file = "pydantic_core-2.20.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:aa2f457b4af386254372dfa78a2eda2563680d982422641a85f271c859df1987"}, + {file = "pydantic_core-2.20.1-cp38-none-win32.whl", hash = "sha256:225b67a1f6d602de0ce7f6c1c3ae89a4aa25d3de9be857999e9124f15dab486a"}, + {file = "pydantic_core-2.20.1-cp38-none-win_amd64.whl", hash = "sha256:6b507132dcfc0dea440cce23ee2182c0ce7aba7054576efc65634f080dbe9434"}, + {file = "pydantic_core-2.20.1-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:b03f7941783b4c4a26051846dea594628b38f6940a2fdc0df00b221aed39314c"}, + {file = "pydantic_core-2.20.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:1eedfeb6089ed3fad42e81a67755846ad4dcc14d73698c120a82e4ccf0f1f9f6"}, + {file = "pydantic_core-2.20.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:635fee4e041ab9c479e31edda27fcf966ea9614fff1317e280d99eb3e5ab6fe2"}, + {file = "pydantic_core-2.20.1-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:77bf3ac639c1ff567ae3b47f8d4cc3dc20f9966a2a6dd2311dcc055d3d04fb8a"}, + {file = "pydantic_core-2.20.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7ed1b0132f24beeec5a78b67d9388656d03e6a7c837394f99257e2d55b461611"}, + {file = "pydantic_core-2.20.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c6514f963b023aeee506678a1cf821fe31159b925c4b76fe2afa94cc70b3222b"}, + {file = "pydantic_core-2.20.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:10d4204d8ca33146e761c79f83cc861df20e7ae9f6487ca290a97702daf56006"}, + {file = "pydantic_core-2.20.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2d036c7187b9422ae5b262badb87a20a49eb6c5238b2004e96d4da1231badef1"}, + {file = "pydantic_core-2.20.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:9ebfef07dbe1d93efb94b4700f2d278494e9162565a54f124c404a5656d7ff09"}, + {file = "pydantic_core-2.20.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:6b9d9bb600328a1ce523ab4f454859e9d439150abb0906c5a1983c146580ebab"}, + {file = "pydantic_core-2.20.1-cp39-none-win32.whl", hash = "sha256:784c1214cb6dd1e3b15dd8b91b9a53852aed16671cc3fbe4786f4f1db07089e2"}, + {file = "pydantic_core-2.20.1-cp39-none-win_amd64.whl", hash = "sha256:d2fe69c5434391727efa54b47a1e7986bb0186e72a41b203df8f5b0a19a4f669"}, + {file = "pydantic_core-2.20.1-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:a45f84b09ac9c3d35dfcf6a27fd0634d30d183205230a0ebe8373a0e8cfa0906"}, + {file = "pydantic_core-2.20.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:d02a72df14dfdbaf228424573a07af10637bd490f0901cee872c4f434a735b94"}, + {file = "pydantic_core-2.20.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d2b27e6af28f07e2f195552b37d7d66b150adbaa39a6d327766ffd695799780f"}, + {file = "pydantic_core-2.20.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:084659fac3c83fd674596612aeff6041a18402f1e1bc19ca39e417d554468482"}, + {file = "pydantic_core-2.20.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:242b8feb3c493ab78be289c034a1f659e8826e2233786e36f2893a950a719bb6"}, + {file = "pydantic_core-2.20.1-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:38cf1c40a921d05c5edc61a785c0ddb4bed67827069f535d794ce6bcded919fc"}, + {file = "pydantic_core-2.20.1-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:e0bbdd76ce9aa5d4209d65f2b27fc6e5ef1312ae6c5333c26db3f5ade53a1e99"}, + {file = "pydantic_core-2.20.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:254ec27fdb5b1ee60684f91683be95e5133c994cc54e86a0b0963afa25c8f8a6"}, + {file = "pydantic_core-2.20.1-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:407653af5617f0757261ae249d3fba09504d7a71ab36ac057c938572d1bc9331"}, + {file = "pydantic_core-2.20.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:c693e916709c2465b02ca0ad7b387c4f8423d1db7b4649c551f27a529181c5ad"}, + {file = "pydantic_core-2.20.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5b5ff4911aea936a47d9376fd3ab17e970cc543d1b68921886e7f64bd28308d1"}, + {file = "pydantic_core-2.20.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:177f55a886d74f1808763976ac4efd29b7ed15c69f4d838bbd74d9d09cf6fa86"}, + {file = "pydantic_core-2.20.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:964faa8a861d2664f0c7ab0c181af0bea66098b1919439815ca8803ef136fc4e"}, + {file = "pydantic_core-2.20.1-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:4dd484681c15e6b9a977c785a345d3e378d72678fd5f1f3c0509608da24f2ac0"}, + {file = "pydantic_core-2.20.1-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:f6d6cff3538391e8486a431569b77921adfcdef14eb18fbf19b7c0a5294d4e6a"}, + {file = "pydantic_core-2.20.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:a6d511cc297ff0883bc3708b465ff82d7560193169a8b93260f74ecb0a5e08a7"}, + {file = "pydantic_core-2.20.1.tar.gz", hash = "sha256:26ca695eeee5f9f1aeeb211ffc12f10bcb6f71e2989988fda61dabd65db878d4"}, ] [package.dependencies] @@ -486,6 +499,7 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, diff --git a/specification/schema/hugr_schema_strict_v2.json b/specification/schema/hugr_schema_strict_v2.json new file mode 100644 index 000000000..15f2ffa61 --- /dev/null +++ b/specification/schema/hugr_schema_strict_v2.json @@ -0,0 +1,2036 @@ +{ + "$defs": { + "Alias": { + "additionalProperties": false, + "description": "An Alias Type.", + "properties": { + "t": { + "const": "Alias", + "default": "Alias", + "enum": [ + "Alias" + ], + "title": "T", + "type": "string" + }, + "bound": { + "$ref": "#/$defs/TypeBound" + }, + "name": { + "title": "Name", + "type": "string" + } + }, + "required": [ + "bound", + "name" + ], + "title": "Alias", + "type": "object" + }, + "AliasDecl": { + "additionalProperties": false, + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "AliasDecl", + "default": "AliasDecl", + "enum": [ + "AliasDecl" + ], + "title": "Op", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "bound": { + "$ref": "#/$defs/TypeBound" + } + }, + "required": [ + "parent", + "name", + "bound" + ], + "title": "AliasDecl", + "type": "object" + }, + "AliasDefn": { + "additionalProperties": false, + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "AliasDefn", + "default": "AliasDefn", + "enum": [ + "AliasDefn" + ], + "title": "Op", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "definition": { + "$ref": "#/$defs/Type" + } + }, + "required": [ + "parent", + "name", + "definition" + ], + "title": "AliasDefn", + "type": "object" + }, + "Array": { + "additionalProperties": false, + "description": "Known size array whose elements are of the same type.", + "properties": { + "ty": { + "$ref": "#/$defs/Type" + }, + "t": { + "const": "Array", + "default": "Array", + "enum": [ + "Array" + ], + "title": "T", + "type": "string" + }, + "len": { + "title": "Len", + "type": "integer" + } + }, + "required": [ + "ty", + "len" + ], + "title": "Array", + "type": "object" + }, + "BoundedNatArg": { + "additionalProperties": false, + "properties": { + "tya": { + "const": "BoundedNat", + "default": "BoundedNat", + "enum": [ + "BoundedNat" + ], + "title": "Tya", + "type": "string" + }, + "n": { + "title": "N", + "type": "integer" + } + }, + "required": [ + "n" + ], + "title": "BoundedNatArg", + "type": "object" + }, + "BoundedNatParam": { + "additionalProperties": false, + "properties": { + "tp": { + "const": "BoundedNat", + "default": "BoundedNat", + "enum": [ + "BoundedNat" + ], + "title": "Tp", + "type": "string" + }, + "bound": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Bound" + } + }, + "required": [ + "bound" + ], + "title": "BoundedNatParam", + "type": "object" + }, + "CFG": { + "additionalProperties": false, + "description": "A dataflow node which is defined by a child CFG.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "CFG", + "default": "CFG", + "enum": [ + "CFG" + ], + "title": "Op", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent" + ], + "title": "CFG", + "type": "object" + }, + "Call": { + "additionalProperties": false, + "description": "Operation to call a function directly. The first port is connected to the def/declare of the function being called directly, with a `Static` edge. The signature of the remaining ports matches the function being called.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Call", + "default": "Call", + "enum": [ + "Call" + ], + "title": "Op", + "type": "string" + }, + "func_sig": { + "$ref": "#/$defs/PolyFuncType" + }, + "type_args": { + "items": { + "$ref": "#/$defs/TypeArg" + }, + "title": "Type Args", + "type": "array" + }, + "instantiation": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent", + "func_sig", + "type_args", + "instantiation" + ], + "title": "Call", + "type": "object" + }, + "CallIndirect": { + "additionalProperties": false, + "description": "Call a function indirectly.\n\nLike call, but the first input is a standard dataflow graph type.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "CallIndirect", + "default": "CallIndirect", + "enum": [ + "CallIndirect" + ], + "title": "Op", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent" + ], + "title": "CallIndirect", + "type": "object" + }, + "Case": { + "additionalProperties": false, + "description": "Case ops - nodes valid inside Conditional nodes.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Case", + "default": "Case", + "enum": [ + "Case" + ], + "title": "Op", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent" + ], + "title": "Case", + "type": "object" + }, + "Conditional": { + "additionalProperties": false, + "description": "Conditional operation, defined by child `Case` nodes for each branch.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Conditional", + "default": "Conditional", + "enum": [ + "Conditional" + ], + "title": "Op", + "type": "string" + }, + "other_inputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Other Inputs", + "type": "array" + }, + "outputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Outputs", + "type": "array" + }, + "sum_rows": { + "description": "The possible rows of the Sum input", + "items": { + "items": { + "$ref": "#/$defs/Type" + }, + "type": "array" + }, + "title": "Sum Rows", + "type": "array" + }, + "extension_delta": { + "items": { + "type": "string" + }, + "title": "Extension Delta", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "Conditional", + "type": "object" + }, + "Const": { + "additionalProperties": false, + "description": "A Const operation definition.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Const", + "default": "Const", + "enum": [ + "Const" + ], + "title": "Op", + "type": "string" + }, + "v": { + "$ref": "#/$defs/Value" + } + }, + "required": [ + "parent", + "v" + ], + "title": "Const", + "type": "object" + }, + "CustomConst": { + "additionalProperties": false, + "properties": { + "c": { + "title": "C", + "type": "string" + }, + "v": { + "title": "V" + } + }, + "required": [ + "c", + "v" + ], + "title": "CustomConst", + "type": "object" + }, + "CustomOp": { + "additionalProperties": false, + "description": "A user-defined operation that can be downcasted by the extensions that define it.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "CustomOp", + "default": "CustomOp", + "enum": [ + "CustomOp" + ], + "title": "Op", + "type": "string" + }, + "extension": { + "title": "Extension", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + }, + "description": { + "default": "", + "title": "Description", + "type": "string" + }, + "args": { + "items": { + "$ref": "#/$defs/TypeArg" + }, + "title": "Args", + "type": "array" + } + }, + "required": [ + "parent", + "extension", + "name" + ], + "title": "CustomOp", + "type": "object" + }, + "DFG": { + "additionalProperties": false, + "description": "A simply nested dataflow graph.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "DFG", + "default": "DFG", + "enum": [ + "DFG" + ], + "title": "Op", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent" + ], + "title": "DFG", + "type": "object" + }, + "DataflowBlock": { + "additionalProperties": false, + "description": "A CFG basic block node. The signature is that of the internal Dataflow graph.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "DataflowBlock", + "default": "DataflowBlock", + "enum": [ + "DataflowBlock" + ], + "title": "Op", + "type": "string" + }, + "inputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Inputs", + "type": "array" + }, + "other_outputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Other Outputs", + "type": "array" + }, + "sum_rows": { + "items": { + "items": { + "$ref": "#/$defs/Type" + }, + "type": "array" + }, + "title": "Sum Rows", + "type": "array" + }, + "extension_delta": { + "items": { + "type": "string" + }, + "title": "Extension Delta", + "type": "array" + } + }, + "required": [ + "parent", + "sum_rows" + ], + "title": "DataflowBlock", + "type": "object" + }, + "ExitBlock": { + "additionalProperties": false, + "description": "The single exit node of the CFG, has no children, stores the types of the CFG node output.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "ExitBlock", + "default": "ExitBlock", + "enum": [ + "ExitBlock" + ], + "title": "Op", + "type": "string" + }, + "cfg_outputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Cfg Outputs", + "type": "array" + } + }, + "required": [ + "parent", + "cfg_outputs" + ], + "title": "ExitBlock", + "type": "object" + }, + "ExtensionValue": { + "additionalProperties": false, + "description": "An extension constant value, that can check it is of a given [CustomType].", + "properties": { + "v": { + "const": "Extension", + "default": "Extension", + "enum": [ + "Extension" + ], + "title": "ValueTag", + "type": "string" + }, + "extensions": { + "items": { + "type": "string" + }, + "title": "Extensions", + "type": "array" + }, + "typ": { + "$ref": "#/$defs/Type" + }, + "value": { + "$ref": "#/$defs/CustomConst" + } + }, + "required": [ + "extensions", + "typ", + "value" + ], + "title": "ExtensionValue", + "type": "object" + }, + "ExtensionsArg": { + "additionalProperties": false, + "properties": { + "tya": { + "const": "Extensions", + "default": "Extensions", + "enum": [ + "Extensions" + ], + "title": "Tya", + "type": "string" + }, + "es": { + "items": { + "type": "string" + }, + "title": "Es", + "type": "array" + } + }, + "required": [ + "es" + ], + "title": "ExtensionsArg", + "type": "object" + }, + "ExtensionsParam": { + "additionalProperties": false, + "properties": { + "tp": { + "const": "Extensions", + "default": "Extensions", + "enum": [ + "Extensions" + ], + "title": "Tp", + "type": "string" + } + }, + "title": "ExtensionsParam", + "type": "object" + }, + "FuncDecl": { + "additionalProperties": false, + "description": "External function declaration, linked at runtime.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "FuncDecl", + "default": "FuncDecl", + "enum": [ + "FuncDecl" + ], + "title": "Op", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/PolyFuncType" + } + }, + "required": [ + "parent", + "name", + "signature" + ], + "title": "FuncDecl", + "type": "object" + }, + "FuncDefn": { + "additionalProperties": false, + "description": "A function definition. Children nodes are the body of the definition.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "FuncDefn", + "default": "FuncDefn", + "enum": [ + "FuncDefn" + ], + "title": "Op", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/PolyFuncType" + } + }, + "required": [ + "parent", + "name", + "signature" + ], + "title": "FuncDefn", + "type": "object" + }, + "FunctionType": { + "additionalProperties": false, + "description": "A graph encoded as a value. It contains a concrete signature and a set of required resources.", + "properties": { + "t": { + "const": "G", + "default": "G", + "enum": [ + "G" + ], + "title": "T", + "type": "string" + }, + "input": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Input", + "type": "array" + }, + "output": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Output", + "type": "array" + }, + "extension_reqs": { + "items": { + "type": "string" + }, + "title": "Extension Reqs", + "type": "array" + } + }, + "required": [ + "input", + "output" + ], + "title": "FunctionType", + "type": "object" + }, + "FunctionValue": { + "additionalProperties": false, + "description": "A higher-order function value.", + "properties": { + "v": { + "const": "Function", + "default": "Function", + "enum": [ + "Function" + ], + "title": "ValueTag", + "type": "string" + }, + "hugr": { + "title": "Hugr" + } + }, + "required": [ + "hugr" + ], + "title": "FunctionValue", + "type": "object" + }, + "GeneralSum": { + "additionalProperties": false, + "description": "General sum type that explicitly stores the types of the variants.", + "properties": { + "t": { + "const": "Sum", + "default": "Sum", + "enum": [ + "Sum" + ], + "title": "T", + "type": "string" + }, + "s": { + "const": "General", + "default": "General", + "enum": [ + "General" + ], + "title": "S", + "type": "string" + }, + "rows": { + "items": { + "items": { + "$ref": "#/$defs/Type" + }, + "type": "array" + }, + "title": "Rows", + "type": "array" + } + }, + "required": [ + "rows" + ], + "title": "GeneralSum", + "type": "object" + }, + "Input": { + "additionalProperties": false, + "description": "An input node. The outputs of this node are the inputs to the parent node.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Input", + "default": "Input", + "enum": [ + "Input" + ], + "title": "Op", + "type": "string" + }, + "types": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Types", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "Input", + "type": "object" + }, + "Lift": { + "additionalProperties": false, + "description": "Fixes some TypeParams of a polymorphic type by providing TypeArgs.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Lift", + "default": "Lift", + "enum": [ + "Lift" + ], + "title": "Op", + "type": "string" + }, + "type_row": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Type Row", + "type": "array" + }, + "new_extension": { + "title": "New Extension", + "type": "string" + } + }, + "required": [ + "parent", + "type_row", + "new_extension" + ], + "title": "Lift", + "type": "object" + }, + "ListParam": { + "additionalProperties": false, + "properties": { + "tp": { + "const": "List", + "default": "List", + "enum": [ + "List" + ], + "title": "Tp", + "type": "string" + }, + "param": { + "$ref": "#/$defs/TypeParam" + } + }, + "required": [ + "param" + ], + "title": "ListParam", + "type": "object" + }, + "LoadConstant": { + "additionalProperties": false, + "description": "An operation that loads a static constant in to the local dataflow graph.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "LoadConstant", + "default": "LoadConstant", + "enum": [ + "LoadConstant" + ], + "title": "Op", + "type": "string" + }, + "datatype": { + "$ref": "#/$defs/Type" + } + }, + "required": [ + "parent", + "datatype" + ], + "title": "LoadConstant", + "type": "object" + }, + "LoadFunction": { + "additionalProperties": false, + "description": "Load a static function in to the local dataflow graph.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "LoadFunction", + "default": "LoadFunction", + "enum": [ + "LoadFunction" + ], + "title": "Op", + "type": "string" + }, + "func_sig": { + "$ref": "#/$defs/PolyFuncType" + }, + "type_args": { + "items": { + "$ref": "#/$defs/TypeArg" + }, + "title": "Type Args", + "type": "array" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent", + "func_sig", + "type_args", + "signature" + ], + "title": "LoadFunction", + "type": "object" + }, + "MakeTuple": { + "additionalProperties": false, + "description": "An operation that packs all its inputs into a tuple.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "MakeTuple", + "default": "MakeTuple", + "enum": [ + "MakeTuple" + ], + "title": "Op", + "type": "string" + }, + "tys": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Tys", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "MakeTuple", + "type": "object" + }, + "Module": { + "additionalProperties": false, + "description": "The root of a module, parent of all other `ModuleOp`s.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Module", + "default": "Module", + "enum": [ + "Module" + ], + "title": "Op", + "type": "string" + } + }, + "required": [ + "parent" + ], + "title": "Module", + "type": "object" + }, + "Noop": { + "additionalProperties": false, + "description": "A no-op operation.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Noop", + "default": "Noop", + "enum": [ + "Noop" + ], + "title": "Op", + "type": "string" + }, + "ty": { + "$ref": "#/$defs/Type" + } + }, + "required": [ + "parent", + "ty" + ], + "title": "Noop", + "type": "object" + }, + "OpType": { + "description": "A constant operation.", + "discriminator": { + "mapping": { + "AliasDecl": "#/$defs/AliasDecl", + "AliasDefn": "#/$defs/AliasDefn", + "CFG": "#/$defs/CFG", + "Call": "#/$defs/Call", + "CallIndirect": "#/$defs/CallIndirect", + "Case": "#/$defs/Case", + "Conditional": "#/$defs/Conditional", + "Const": "#/$defs/Const", + "CustomOp": "#/$defs/CustomOp", + "DFG": "#/$defs/DFG", + "DataflowBlock": "#/$defs/DataflowBlock", + "ExitBlock": "#/$defs/ExitBlock", + "FuncDecl": "#/$defs/FuncDecl", + "FuncDefn": "#/$defs/FuncDefn", + "Input": "#/$defs/Input", + "Lift": "#/$defs/Lift", + "LoadConstant": "#/$defs/LoadConstant", + "LoadFunction": "#/$defs/LoadFunction", + "MakeTuple": "#/$defs/MakeTuple", + "Module": "#/$defs/Module", + "Noop": "#/$defs/Noop", + "Output": "#/$defs/Output", + "Tag": "#/$defs/Tag", + "TailLoop": "#/$defs/TailLoop", + "UnpackTuple": "#/$defs/UnpackTuple" + }, + "propertyName": "op" + }, + "oneOf": [ + { + "$ref": "#/$defs/Module" + }, + { + "$ref": "#/$defs/Case" + }, + { + "$ref": "#/$defs/FuncDefn" + }, + { + "$ref": "#/$defs/FuncDecl" + }, + { + "$ref": "#/$defs/Const" + }, + { + "$ref": "#/$defs/DataflowBlock" + }, + { + "$ref": "#/$defs/ExitBlock" + }, + { + "$ref": "#/$defs/Conditional" + }, + { + "$ref": "#/$defs/TailLoop" + }, + { + "$ref": "#/$defs/CFG" + }, + { + "$ref": "#/$defs/Input" + }, + { + "$ref": "#/$defs/Output" + }, + { + "$ref": "#/$defs/Call" + }, + { + "$ref": "#/$defs/CallIndirect" + }, + { + "$ref": "#/$defs/LoadConstant" + }, + { + "$ref": "#/$defs/LoadFunction" + }, + { + "$ref": "#/$defs/CustomOp" + }, + { + "$ref": "#/$defs/Noop" + }, + { + "$ref": "#/$defs/MakeTuple" + }, + { + "$ref": "#/$defs/UnpackTuple" + }, + { + "$ref": "#/$defs/Tag" + }, + { + "$ref": "#/$defs/Lift" + }, + { + "$ref": "#/$defs/DFG" + }, + { + "$ref": "#/$defs/AliasDecl" + }, + { + "$ref": "#/$defs/AliasDefn" + } + ], + "required": [ + "parent", + "op" + ], + "title": "OpType" + }, + "Opaque": { + "additionalProperties": false, + "description": "An opaque Type that can be downcasted by the extensions that define it.", + "properties": { + "t": { + "const": "Opaque", + "default": "Opaque", + "enum": [ + "Opaque" + ], + "title": "T", + "type": "string" + }, + "extension": { + "title": "Extension", + "type": "string" + }, + "id": { + "title": "Id", + "type": "string" + }, + "args": { + "items": { + "$ref": "#/$defs/TypeArg" + }, + "title": "Args", + "type": "array" + }, + "bound": { + "$ref": "#/$defs/TypeBound" + } + }, + "required": [ + "extension", + "id", + "args", + "bound" + ], + "title": "Opaque", + "type": "object" + }, + "OpaqueArg": { + "additionalProperties": false, + "properties": { + "tya": { + "const": "Opaque", + "default": "Opaque", + "enum": [ + "Opaque" + ], + "title": "Tya", + "type": "string" + }, + "typ": { + "$ref": "#/$defs/Opaque" + }, + "value": { + "title": "Value" + } + }, + "required": [ + "typ", + "value" + ], + "title": "OpaqueArg", + "type": "object" + }, + "OpaqueParam": { + "additionalProperties": false, + "properties": { + "tp": { + "const": "Opaque", + "default": "Opaque", + "enum": [ + "Opaque" + ], + "title": "Tp", + "type": "string" + }, + "ty": { + "$ref": "#/$defs/Opaque" + } + }, + "required": [ + "ty" + ], + "title": "OpaqueParam", + "type": "object" + }, + "Output": { + "additionalProperties": false, + "description": "An output node. The inputs are the outputs of the function.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Output", + "default": "Output", + "enum": [ + "Output" + ], + "title": "Op", + "type": "string" + }, + "types": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Types", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "Output", + "type": "object" + }, + "PolyFuncType": { + "additionalProperties": false, + "description": "A polymorphic type scheme, i.e. of a FuncDecl, FuncDefn or OpDef. (Nodes/operations in the Hugr are not polymorphic.)", + "properties": { + "params": { + "items": { + "$ref": "#/$defs/TypeParam" + }, + "title": "Params", + "type": "array" + }, + "body": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "params", + "body" + ], + "title": "PolyFuncType", + "type": "object" + }, + "Qubit": { + "additionalProperties": false, + "description": "A qubit.", + "properties": { + "t": { + "const": "Q", + "default": "Q", + "enum": [ + "Q" + ], + "title": "T", + "type": "string" + } + }, + "title": "Qubit", + "type": "object" + }, + "RowVar": { + "additionalProperties": false, + "description": "A variable standing for a row of some (unknown) number of types.\nMay occur only within a row; not a node input/output.", + "properties": { + "t": { + "const": "R", + "default": "R", + "enum": [ + "R" + ], + "title": "T", + "type": "string" + }, + "i": { + "title": "I", + "type": "integer" + }, + "b": { + "$ref": "#/$defs/TypeBound" + } + }, + "required": [ + "i", + "b" + ], + "title": "RowVar", + "type": "object" + }, + "SequenceArg": { + "additionalProperties": false, + "properties": { + "tya": { + "const": "Sequence", + "default": "Sequence", + "enum": [ + "Sequence" + ], + "title": "Tya", + "type": "string" + }, + "elems": { + "items": { + "$ref": "#/$defs/TypeArg" + }, + "title": "Elems", + "type": "array" + } + }, + "required": [ + "elems" + ], + "title": "SequenceArg", + "type": "object" + }, + "SumType": { + "discriminator": { + "mapping": { + "General": "#/$defs/GeneralSum", + "Unit": "#/$defs/UnitSum" + }, + "propertyName": "s" + }, + "oneOf": [ + { + "$ref": "#/$defs/UnitSum" + }, + { + "$ref": "#/$defs/GeneralSum" + } + ], + "required": [ + "s" + ], + "title": "SumType" + }, + "SumValue": { + "additionalProperties": false, + "description": "A Sum variant For any Sum type where this value meets the type of the variant indicated by the tag.", + "properties": { + "v": { + "const": "Sum", + "default": "Sum", + "enum": [ + "Sum" + ], + "title": "ValueTag", + "type": "string" + }, + "tag": { + "title": "Tag", + "type": "integer" + }, + "typ": { + "$ref": "#/$defs/SumType" + }, + "vs": { + "items": { + "$ref": "#/$defs/Value" + }, + "title": "Vs", + "type": "array" + } + }, + "required": [ + "tag", + "typ", + "vs" + ], + "title": "SumValue", + "type": "object" + }, + "Tag": { + "additionalProperties": false, + "description": "An operation that creates a tagged sum value from one of its variants.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Tag", + "default": "Tag", + "enum": [ + "Tag" + ], + "title": "Op", + "type": "string" + }, + "tag": { + "title": "Tag", + "type": "integer" + }, + "variants": { + "items": { + "items": { + "$ref": "#/$defs/Type" + }, + "type": "array" + }, + "title": "Variants", + "type": "array" + } + }, + "required": [ + "parent", + "tag", + "variants" + ], + "title": "Tag", + "type": "object" + }, + "TailLoop": { + "additionalProperties": false, + "description": "Tail-controlled loop.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "TailLoop", + "default": "TailLoop", + "enum": [ + "TailLoop" + ], + "title": "Op", + "type": "string" + }, + "just_inputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Just Inputs", + "type": "array" + }, + "just_outputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Just Outputs", + "type": "array" + }, + "rest": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Rest", + "type": "array" + }, + "extension_delta": { + "items": { + "type": "string" + }, + "title": "Extension Delta", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "TailLoop", + "type": "object" + }, + "TupleParam": { + "additionalProperties": false, + "properties": { + "tp": { + "const": "Tuple", + "default": "Tuple", + "enum": [ + "Tuple" + ], + "title": "Tp", + "type": "string" + }, + "params": { + "items": { + "$ref": "#/$defs/TypeParam" + }, + "title": "Params", + "type": "array" + } + }, + "required": [ + "params" + ], + "title": "TupleParam", + "type": "object" + }, + "TupleValue": { + "additionalProperties": false, + "description": "A constant tuple value.", + "properties": { + "v": { + "const": "Tuple", + "default": "Tuple", + "enum": [ + "Tuple" + ], + "title": "ValueTag", + "type": "string" + }, + "vs": { + "items": { + "$ref": "#/$defs/Value" + }, + "title": "Vs", + "type": "array" + } + }, + "required": [ + "vs" + ], + "title": "TupleValue", + "type": "object" + }, + "Type": { + "description": "A HUGR type.", + "discriminator": { + "mapping": { + "Alias": "#/$defs/Alias", + "Array": "#/$defs/Array", + "G": "#/$defs/FunctionType", + "I": "#/$defs/USize", + "Opaque": "#/$defs/Opaque", + "Q": "#/$defs/Qubit", + "R": "#/$defs/RowVar", + "Sum": "#/$defs/SumType", + "V": "#/$defs/Variable" + }, + "propertyName": "t" + }, + "oneOf": [ + { + "$ref": "#/$defs/Qubit" + }, + { + "$ref": "#/$defs/Variable" + }, + { + "$ref": "#/$defs/RowVar" + }, + { + "$ref": "#/$defs/USize" + }, + { + "$ref": "#/$defs/FunctionType" + }, + { + "$ref": "#/$defs/Array" + }, + { + "$ref": "#/$defs/SumType" + }, + { + "$ref": "#/$defs/Opaque" + }, + { + "$ref": "#/$defs/Alias" + } + ], + "required": [ + "t" + ], + "title": "Type" + }, + "TypeArg": { + "description": "A type argument.", + "discriminator": { + "mapping": { + "BoundedNat": "#/$defs/BoundedNatArg", + "Extensions": "#/$defs/ExtensionsArg", + "Opaque": "#/$defs/OpaqueArg", + "Sequence": "#/$defs/SequenceArg", + "Type": "#/$defs/TypeTypeArg", + "Variable": "#/$defs/VariableArg" + }, + "propertyName": "tya" + }, + "oneOf": [ + { + "$ref": "#/$defs/TypeTypeArg" + }, + { + "$ref": "#/$defs/BoundedNatArg" + }, + { + "$ref": "#/$defs/OpaqueArg" + }, + { + "$ref": "#/$defs/SequenceArg" + }, + { + "$ref": "#/$defs/ExtensionsArg" + }, + { + "$ref": "#/$defs/VariableArg" + } + ], + "required": [ + "tya" + ], + "title": "TypeArg" + }, + "TypeBound": { + "enum": [ + "E", + "C", + "A" + ], + "title": "TypeBound", + "type": "string" + }, + "TypeParam": { + "description": "A type parameter.", + "discriminator": { + "mapping": { + "BoundedNat": "#/$defs/BoundedNatParam", + "Extensions": "#/$defs/ExtensionsParam", + "List": "#/$defs/ListParam", + "Opaque": "#/$defs/OpaqueParam", + "Tuple": "#/$defs/TupleParam", + "Type": "#/$defs/TypeTypeParam" + }, + "propertyName": "tp" + }, + "oneOf": [ + { + "$ref": "#/$defs/TypeTypeParam" + }, + { + "$ref": "#/$defs/BoundedNatParam" + }, + { + "$ref": "#/$defs/OpaqueParam" + }, + { + "$ref": "#/$defs/ListParam" + }, + { + "$ref": "#/$defs/TupleParam" + }, + { + "$ref": "#/$defs/ExtensionsParam" + } + ], + "required": [ + "tp" + ], + "title": "TypeParam" + }, + "TypeTypeArg": { + "additionalProperties": false, + "properties": { + "tya": { + "const": "Type", + "default": "Type", + "enum": [ + "Type" + ], + "title": "Tya", + "type": "string" + }, + "ty": { + "$ref": "#/$defs/Type" + } + }, + "required": [ + "ty" + ], + "title": "TypeTypeArg", + "type": "object" + }, + "TypeTypeParam": { + "additionalProperties": false, + "properties": { + "tp": { + "const": "Type", + "default": "Type", + "enum": [ + "Type" + ], + "title": "Tp", + "type": "string" + }, + "b": { + "$ref": "#/$defs/TypeBound" + } + }, + "required": [ + "b" + ], + "title": "TypeTypeParam", + "type": "object" + }, + "USize": { + "additionalProperties": false, + "description": "Unsigned integer size type.", + "properties": { + "t": { + "const": "I", + "default": "I", + "enum": [ + "I" + ], + "title": "T", + "type": "string" + } + }, + "title": "USize", + "type": "object" + }, + "UnitSum": { + "additionalProperties": false, + "description": "Simple sum type where all variants are empty tuples.", + "properties": { + "t": { + "const": "Sum", + "default": "Sum", + "enum": [ + "Sum" + ], + "title": "T", + "type": "string" + }, + "s": { + "const": "Unit", + "default": "Unit", + "enum": [ + "Unit" + ], + "title": "S", + "type": "string" + }, + "size": { + "title": "Size", + "type": "integer" + } + }, + "required": [ + "size" + ], + "title": "UnitSum", + "type": "object" + }, + "UnpackTuple": { + "additionalProperties": false, + "description": "An operation that packs all its inputs into a tuple.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "UnpackTuple", + "default": "UnpackTuple", + "enum": [ + "UnpackTuple" + ], + "title": "Op", + "type": "string" + }, + "tys": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Tys", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "UnpackTuple", + "type": "object" + }, + "Value": { + "description": "A constant Value.", + "discriminator": { + "mapping": { + "Extension": "#/$defs/ExtensionValue", + "Function": "#/$defs/FunctionValue", + "Sum": "#/$defs/SumValue", + "Tuple": "#/$defs/TupleValue" + }, + "propertyName": "v" + }, + "oneOf": [ + { + "$ref": "#/$defs/ExtensionValue" + }, + { + "$ref": "#/$defs/FunctionValue" + }, + { + "$ref": "#/$defs/TupleValue" + }, + { + "$ref": "#/$defs/SumValue" + } + ], + "required": [ + "v" + ], + "title": "Value" + }, + "Variable": { + "additionalProperties": false, + "description": "A type variable identified by an index into the array of TypeParams.", + "properties": { + "t": { + "const": "V", + "default": "V", + "enum": [ + "V" + ], + "title": "T", + "type": "string" + }, + "i": { + "title": "I", + "type": "integer" + }, + "b": { + "$ref": "#/$defs/TypeBound" + } + }, + "required": [ + "i", + "b" + ], + "title": "Variable", + "type": "object" + }, + "VariableArg": { + "additionalProperties": false, + "properties": { + "tya": { + "const": "Variable", + "default": "Variable", + "enum": [ + "Variable" + ], + "title": "Tya", + "type": "string" + }, + "idx": { + "title": "Idx", + "type": "integer" + }, + "cached_decl": { + "$ref": "#/$defs/TypeParam" + } + }, + "required": [ + "idx", + "cached_decl" + ], + "title": "VariableArg", + "type": "object" + } + }, + "additionalProperties": false, + "description": "A serializable representation of a Hugr.", + "properties": { + "version": { + "description": "Serialisation Schema Version", + "title": "Version", + "type": "string" + }, + "nodes": { + "items": { + "$ref": "#/$defs/OpType" + }, + "title": "Nodes", + "type": "array" + }, + "edges": { + "items": { + "maxItems": 2, + "minItems": 2, + "prefixItems": [ + { + "maxItems": 2, + "minItems": 2, + "prefixItems": [ + { + "type": "integer" + }, + { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ] + } + ], + "type": "array" + }, + { + "maxItems": 2, + "minItems": 2, + "prefixItems": [ + { + "type": "integer" + }, + { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ] + } + ], + "type": "array" + } + ], + "type": "array" + }, + "title": "Edges", + "type": "array" + }, + "metadata": { + "anyOf": [ + { + "items": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ] + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Metadata" + }, + "encoder": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The name of the encoder used to generate the Hugr.", + "title": "Encoder" + } + }, + "required": [ + "version", + "nodes", + "edges" + ], + "title": "Hugr", + "type": "object" +} \ No newline at end of file diff --git a/specification/schema/hugr_schema_v2.json b/specification/schema/hugr_schema_v2.json new file mode 100644 index 000000000..155c2bf05 --- /dev/null +++ b/specification/schema/hugr_schema_v2.json @@ -0,0 +1,2036 @@ +{ + "$defs": { + "Alias": { + "additionalProperties": true, + "description": "An Alias Type.", + "properties": { + "t": { + "const": "Alias", + "default": "Alias", + "enum": [ + "Alias" + ], + "title": "T", + "type": "string" + }, + "bound": { + "$ref": "#/$defs/TypeBound" + }, + "name": { + "title": "Name", + "type": "string" + } + }, + "required": [ + "bound", + "name" + ], + "title": "Alias", + "type": "object" + }, + "AliasDecl": { + "additionalProperties": true, + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "AliasDecl", + "default": "AliasDecl", + "enum": [ + "AliasDecl" + ], + "title": "Op", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "bound": { + "$ref": "#/$defs/TypeBound" + } + }, + "required": [ + "parent", + "name", + "bound" + ], + "title": "AliasDecl", + "type": "object" + }, + "AliasDefn": { + "additionalProperties": true, + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "AliasDefn", + "default": "AliasDefn", + "enum": [ + "AliasDefn" + ], + "title": "Op", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "definition": { + "$ref": "#/$defs/Type" + } + }, + "required": [ + "parent", + "name", + "definition" + ], + "title": "AliasDefn", + "type": "object" + }, + "Array": { + "additionalProperties": true, + "description": "Known size array whose elements are of the same type.", + "properties": { + "ty": { + "$ref": "#/$defs/Type" + }, + "t": { + "const": "Array", + "default": "Array", + "enum": [ + "Array" + ], + "title": "T", + "type": "string" + }, + "len": { + "title": "Len", + "type": "integer" + } + }, + "required": [ + "ty", + "len" + ], + "title": "Array", + "type": "object" + }, + "BoundedNatArg": { + "additionalProperties": true, + "properties": { + "tya": { + "const": "BoundedNat", + "default": "BoundedNat", + "enum": [ + "BoundedNat" + ], + "title": "Tya", + "type": "string" + }, + "n": { + "title": "N", + "type": "integer" + } + }, + "required": [ + "n" + ], + "title": "BoundedNatArg", + "type": "object" + }, + "BoundedNatParam": { + "additionalProperties": true, + "properties": { + "tp": { + "const": "BoundedNat", + "default": "BoundedNat", + "enum": [ + "BoundedNat" + ], + "title": "Tp", + "type": "string" + }, + "bound": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Bound" + } + }, + "required": [ + "bound" + ], + "title": "BoundedNatParam", + "type": "object" + }, + "CFG": { + "additionalProperties": true, + "description": "A dataflow node which is defined by a child CFG.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "CFG", + "default": "CFG", + "enum": [ + "CFG" + ], + "title": "Op", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent" + ], + "title": "CFG", + "type": "object" + }, + "Call": { + "additionalProperties": true, + "description": "Operation to call a function directly. The first port is connected to the def/declare of the function being called directly, with a `Static` edge. The signature of the remaining ports matches the function being called.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Call", + "default": "Call", + "enum": [ + "Call" + ], + "title": "Op", + "type": "string" + }, + "func_sig": { + "$ref": "#/$defs/PolyFuncType" + }, + "type_args": { + "items": { + "$ref": "#/$defs/TypeArg" + }, + "title": "Type Args", + "type": "array" + }, + "instantiation": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent", + "func_sig", + "type_args", + "instantiation" + ], + "title": "Call", + "type": "object" + }, + "CallIndirect": { + "additionalProperties": true, + "description": "Call a function indirectly.\n\nLike call, but the first input is a standard dataflow graph type.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "CallIndirect", + "default": "CallIndirect", + "enum": [ + "CallIndirect" + ], + "title": "Op", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent" + ], + "title": "CallIndirect", + "type": "object" + }, + "Case": { + "additionalProperties": true, + "description": "Case ops - nodes valid inside Conditional nodes.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Case", + "default": "Case", + "enum": [ + "Case" + ], + "title": "Op", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent" + ], + "title": "Case", + "type": "object" + }, + "Conditional": { + "additionalProperties": true, + "description": "Conditional operation, defined by child `Case` nodes for each branch.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Conditional", + "default": "Conditional", + "enum": [ + "Conditional" + ], + "title": "Op", + "type": "string" + }, + "other_inputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Other Inputs", + "type": "array" + }, + "outputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Outputs", + "type": "array" + }, + "sum_rows": { + "description": "The possible rows of the Sum input", + "items": { + "items": { + "$ref": "#/$defs/Type" + }, + "type": "array" + }, + "title": "Sum Rows", + "type": "array" + }, + "extension_delta": { + "items": { + "type": "string" + }, + "title": "Extension Delta", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "Conditional", + "type": "object" + }, + "Const": { + "additionalProperties": true, + "description": "A Const operation definition.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Const", + "default": "Const", + "enum": [ + "Const" + ], + "title": "Op", + "type": "string" + }, + "v": { + "$ref": "#/$defs/Value" + } + }, + "required": [ + "parent", + "v" + ], + "title": "Const", + "type": "object" + }, + "CustomConst": { + "additionalProperties": true, + "properties": { + "c": { + "title": "C", + "type": "string" + }, + "v": { + "title": "V" + } + }, + "required": [ + "c", + "v" + ], + "title": "CustomConst", + "type": "object" + }, + "CustomOp": { + "additionalProperties": true, + "description": "A user-defined operation that can be downcasted by the extensions that define it.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "CustomOp", + "default": "CustomOp", + "enum": [ + "CustomOp" + ], + "title": "Op", + "type": "string" + }, + "extension": { + "title": "Extension", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + }, + "description": { + "default": "", + "title": "Description", + "type": "string" + }, + "args": { + "items": { + "$ref": "#/$defs/TypeArg" + }, + "title": "Args", + "type": "array" + } + }, + "required": [ + "parent", + "extension", + "name" + ], + "title": "CustomOp", + "type": "object" + }, + "DFG": { + "additionalProperties": true, + "description": "A simply nested dataflow graph.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "DFG", + "default": "DFG", + "enum": [ + "DFG" + ], + "title": "Op", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent" + ], + "title": "DFG", + "type": "object" + }, + "DataflowBlock": { + "additionalProperties": true, + "description": "A CFG basic block node. The signature is that of the internal Dataflow graph.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "DataflowBlock", + "default": "DataflowBlock", + "enum": [ + "DataflowBlock" + ], + "title": "Op", + "type": "string" + }, + "inputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Inputs", + "type": "array" + }, + "other_outputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Other Outputs", + "type": "array" + }, + "sum_rows": { + "items": { + "items": { + "$ref": "#/$defs/Type" + }, + "type": "array" + }, + "title": "Sum Rows", + "type": "array" + }, + "extension_delta": { + "items": { + "type": "string" + }, + "title": "Extension Delta", + "type": "array" + } + }, + "required": [ + "parent", + "sum_rows" + ], + "title": "DataflowBlock", + "type": "object" + }, + "ExitBlock": { + "additionalProperties": true, + "description": "The single exit node of the CFG, has no children, stores the types of the CFG node output.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "ExitBlock", + "default": "ExitBlock", + "enum": [ + "ExitBlock" + ], + "title": "Op", + "type": "string" + }, + "cfg_outputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Cfg Outputs", + "type": "array" + } + }, + "required": [ + "parent", + "cfg_outputs" + ], + "title": "ExitBlock", + "type": "object" + }, + "ExtensionValue": { + "additionalProperties": true, + "description": "An extension constant value, that can check it is of a given [CustomType].", + "properties": { + "v": { + "const": "Extension", + "default": "Extension", + "enum": [ + "Extension" + ], + "title": "ValueTag", + "type": "string" + }, + "extensions": { + "items": { + "type": "string" + }, + "title": "Extensions", + "type": "array" + }, + "typ": { + "$ref": "#/$defs/Type" + }, + "value": { + "$ref": "#/$defs/CustomConst" + } + }, + "required": [ + "extensions", + "typ", + "value" + ], + "title": "ExtensionValue", + "type": "object" + }, + "ExtensionsArg": { + "additionalProperties": true, + "properties": { + "tya": { + "const": "Extensions", + "default": "Extensions", + "enum": [ + "Extensions" + ], + "title": "Tya", + "type": "string" + }, + "es": { + "items": { + "type": "string" + }, + "title": "Es", + "type": "array" + } + }, + "required": [ + "es" + ], + "title": "ExtensionsArg", + "type": "object" + }, + "ExtensionsParam": { + "additionalProperties": true, + "properties": { + "tp": { + "const": "Extensions", + "default": "Extensions", + "enum": [ + "Extensions" + ], + "title": "Tp", + "type": "string" + } + }, + "title": "ExtensionsParam", + "type": "object" + }, + "FuncDecl": { + "additionalProperties": true, + "description": "External function declaration, linked at runtime.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "FuncDecl", + "default": "FuncDecl", + "enum": [ + "FuncDecl" + ], + "title": "Op", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/PolyFuncType" + } + }, + "required": [ + "parent", + "name", + "signature" + ], + "title": "FuncDecl", + "type": "object" + }, + "FuncDefn": { + "additionalProperties": true, + "description": "A function definition. Children nodes are the body of the definition.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "FuncDefn", + "default": "FuncDefn", + "enum": [ + "FuncDefn" + ], + "title": "Op", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/PolyFuncType" + } + }, + "required": [ + "parent", + "name", + "signature" + ], + "title": "FuncDefn", + "type": "object" + }, + "FunctionType": { + "additionalProperties": true, + "description": "A graph encoded as a value. It contains a concrete signature and a set of required resources.", + "properties": { + "t": { + "const": "G", + "default": "G", + "enum": [ + "G" + ], + "title": "T", + "type": "string" + }, + "input": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Input", + "type": "array" + }, + "output": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Output", + "type": "array" + }, + "extension_reqs": { + "items": { + "type": "string" + }, + "title": "Extension Reqs", + "type": "array" + } + }, + "required": [ + "input", + "output" + ], + "title": "FunctionType", + "type": "object" + }, + "FunctionValue": { + "additionalProperties": true, + "description": "A higher-order function value.", + "properties": { + "v": { + "const": "Function", + "default": "Function", + "enum": [ + "Function" + ], + "title": "ValueTag", + "type": "string" + }, + "hugr": { + "title": "Hugr" + } + }, + "required": [ + "hugr" + ], + "title": "FunctionValue", + "type": "object" + }, + "GeneralSum": { + "additionalProperties": true, + "description": "General sum type that explicitly stores the types of the variants.", + "properties": { + "t": { + "const": "Sum", + "default": "Sum", + "enum": [ + "Sum" + ], + "title": "T", + "type": "string" + }, + "s": { + "const": "General", + "default": "General", + "enum": [ + "General" + ], + "title": "S", + "type": "string" + }, + "rows": { + "items": { + "items": { + "$ref": "#/$defs/Type" + }, + "type": "array" + }, + "title": "Rows", + "type": "array" + } + }, + "required": [ + "rows" + ], + "title": "GeneralSum", + "type": "object" + }, + "Input": { + "additionalProperties": true, + "description": "An input node. The outputs of this node are the inputs to the parent node.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Input", + "default": "Input", + "enum": [ + "Input" + ], + "title": "Op", + "type": "string" + }, + "types": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Types", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "Input", + "type": "object" + }, + "Lift": { + "additionalProperties": true, + "description": "Fixes some TypeParams of a polymorphic type by providing TypeArgs.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Lift", + "default": "Lift", + "enum": [ + "Lift" + ], + "title": "Op", + "type": "string" + }, + "type_row": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Type Row", + "type": "array" + }, + "new_extension": { + "title": "New Extension", + "type": "string" + } + }, + "required": [ + "parent", + "type_row", + "new_extension" + ], + "title": "Lift", + "type": "object" + }, + "ListParam": { + "additionalProperties": true, + "properties": { + "tp": { + "const": "List", + "default": "List", + "enum": [ + "List" + ], + "title": "Tp", + "type": "string" + }, + "param": { + "$ref": "#/$defs/TypeParam" + } + }, + "required": [ + "param" + ], + "title": "ListParam", + "type": "object" + }, + "LoadConstant": { + "additionalProperties": true, + "description": "An operation that loads a static constant in to the local dataflow graph.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "LoadConstant", + "default": "LoadConstant", + "enum": [ + "LoadConstant" + ], + "title": "Op", + "type": "string" + }, + "datatype": { + "$ref": "#/$defs/Type" + } + }, + "required": [ + "parent", + "datatype" + ], + "title": "LoadConstant", + "type": "object" + }, + "LoadFunction": { + "additionalProperties": true, + "description": "Load a static function in to the local dataflow graph.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "LoadFunction", + "default": "LoadFunction", + "enum": [ + "LoadFunction" + ], + "title": "Op", + "type": "string" + }, + "func_sig": { + "$ref": "#/$defs/PolyFuncType" + }, + "type_args": { + "items": { + "$ref": "#/$defs/TypeArg" + }, + "title": "Type Args", + "type": "array" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent", + "func_sig", + "type_args", + "signature" + ], + "title": "LoadFunction", + "type": "object" + }, + "MakeTuple": { + "additionalProperties": true, + "description": "An operation that packs all its inputs into a tuple.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "MakeTuple", + "default": "MakeTuple", + "enum": [ + "MakeTuple" + ], + "title": "Op", + "type": "string" + }, + "tys": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Tys", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "MakeTuple", + "type": "object" + }, + "Module": { + "additionalProperties": true, + "description": "The root of a module, parent of all other `ModuleOp`s.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Module", + "default": "Module", + "enum": [ + "Module" + ], + "title": "Op", + "type": "string" + } + }, + "required": [ + "parent" + ], + "title": "Module", + "type": "object" + }, + "Noop": { + "additionalProperties": true, + "description": "A no-op operation.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Noop", + "default": "Noop", + "enum": [ + "Noop" + ], + "title": "Op", + "type": "string" + }, + "ty": { + "$ref": "#/$defs/Type" + } + }, + "required": [ + "parent", + "ty" + ], + "title": "Noop", + "type": "object" + }, + "OpType": { + "description": "A constant operation.", + "discriminator": { + "mapping": { + "AliasDecl": "#/$defs/AliasDecl", + "AliasDefn": "#/$defs/AliasDefn", + "CFG": "#/$defs/CFG", + "Call": "#/$defs/Call", + "CallIndirect": "#/$defs/CallIndirect", + "Case": "#/$defs/Case", + "Conditional": "#/$defs/Conditional", + "Const": "#/$defs/Const", + "CustomOp": "#/$defs/CustomOp", + "DFG": "#/$defs/DFG", + "DataflowBlock": "#/$defs/DataflowBlock", + "ExitBlock": "#/$defs/ExitBlock", + "FuncDecl": "#/$defs/FuncDecl", + "FuncDefn": "#/$defs/FuncDefn", + "Input": "#/$defs/Input", + "Lift": "#/$defs/Lift", + "LoadConstant": "#/$defs/LoadConstant", + "LoadFunction": "#/$defs/LoadFunction", + "MakeTuple": "#/$defs/MakeTuple", + "Module": "#/$defs/Module", + "Noop": "#/$defs/Noop", + "Output": "#/$defs/Output", + "Tag": "#/$defs/Tag", + "TailLoop": "#/$defs/TailLoop", + "UnpackTuple": "#/$defs/UnpackTuple" + }, + "propertyName": "op" + }, + "oneOf": [ + { + "$ref": "#/$defs/Module" + }, + { + "$ref": "#/$defs/Case" + }, + { + "$ref": "#/$defs/FuncDefn" + }, + { + "$ref": "#/$defs/FuncDecl" + }, + { + "$ref": "#/$defs/Const" + }, + { + "$ref": "#/$defs/DataflowBlock" + }, + { + "$ref": "#/$defs/ExitBlock" + }, + { + "$ref": "#/$defs/Conditional" + }, + { + "$ref": "#/$defs/TailLoop" + }, + { + "$ref": "#/$defs/CFG" + }, + { + "$ref": "#/$defs/Input" + }, + { + "$ref": "#/$defs/Output" + }, + { + "$ref": "#/$defs/Call" + }, + { + "$ref": "#/$defs/CallIndirect" + }, + { + "$ref": "#/$defs/LoadConstant" + }, + { + "$ref": "#/$defs/LoadFunction" + }, + { + "$ref": "#/$defs/CustomOp" + }, + { + "$ref": "#/$defs/Noop" + }, + { + "$ref": "#/$defs/MakeTuple" + }, + { + "$ref": "#/$defs/UnpackTuple" + }, + { + "$ref": "#/$defs/Tag" + }, + { + "$ref": "#/$defs/Lift" + }, + { + "$ref": "#/$defs/DFG" + }, + { + "$ref": "#/$defs/AliasDecl" + }, + { + "$ref": "#/$defs/AliasDefn" + } + ], + "required": [ + "parent", + "op" + ], + "title": "OpType" + }, + "Opaque": { + "additionalProperties": true, + "description": "An opaque Type that can be downcasted by the extensions that define it.", + "properties": { + "t": { + "const": "Opaque", + "default": "Opaque", + "enum": [ + "Opaque" + ], + "title": "T", + "type": "string" + }, + "extension": { + "title": "Extension", + "type": "string" + }, + "id": { + "title": "Id", + "type": "string" + }, + "args": { + "items": { + "$ref": "#/$defs/TypeArg" + }, + "title": "Args", + "type": "array" + }, + "bound": { + "$ref": "#/$defs/TypeBound" + } + }, + "required": [ + "extension", + "id", + "args", + "bound" + ], + "title": "Opaque", + "type": "object" + }, + "OpaqueArg": { + "additionalProperties": true, + "properties": { + "tya": { + "const": "Opaque", + "default": "Opaque", + "enum": [ + "Opaque" + ], + "title": "Tya", + "type": "string" + }, + "typ": { + "$ref": "#/$defs/Opaque" + }, + "value": { + "title": "Value" + } + }, + "required": [ + "typ", + "value" + ], + "title": "OpaqueArg", + "type": "object" + }, + "OpaqueParam": { + "additionalProperties": true, + "properties": { + "tp": { + "const": "Opaque", + "default": "Opaque", + "enum": [ + "Opaque" + ], + "title": "Tp", + "type": "string" + }, + "ty": { + "$ref": "#/$defs/Opaque" + } + }, + "required": [ + "ty" + ], + "title": "OpaqueParam", + "type": "object" + }, + "Output": { + "additionalProperties": true, + "description": "An output node. The inputs are the outputs of the function.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Output", + "default": "Output", + "enum": [ + "Output" + ], + "title": "Op", + "type": "string" + }, + "types": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Types", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "Output", + "type": "object" + }, + "PolyFuncType": { + "additionalProperties": true, + "description": "A polymorphic type scheme, i.e. of a FuncDecl, FuncDefn or OpDef. (Nodes/operations in the Hugr are not polymorphic.)", + "properties": { + "params": { + "items": { + "$ref": "#/$defs/TypeParam" + }, + "title": "Params", + "type": "array" + }, + "body": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "params", + "body" + ], + "title": "PolyFuncType", + "type": "object" + }, + "Qubit": { + "additionalProperties": true, + "description": "A qubit.", + "properties": { + "t": { + "const": "Q", + "default": "Q", + "enum": [ + "Q" + ], + "title": "T", + "type": "string" + } + }, + "title": "Qubit", + "type": "object" + }, + "RowVar": { + "additionalProperties": true, + "description": "A variable standing for a row of some (unknown) number of types.\nMay occur only within a row; not a node input/output.", + "properties": { + "t": { + "const": "R", + "default": "R", + "enum": [ + "R" + ], + "title": "T", + "type": "string" + }, + "i": { + "title": "I", + "type": "integer" + }, + "b": { + "$ref": "#/$defs/TypeBound" + } + }, + "required": [ + "i", + "b" + ], + "title": "RowVar", + "type": "object" + }, + "SequenceArg": { + "additionalProperties": true, + "properties": { + "tya": { + "const": "Sequence", + "default": "Sequence", + "enum": [ + "Sequence" + ], + "title": "Tya", + "type": "string" + }, + "elems": { + "items": { + "$ref": "#/$defs/TypeArg" + }, + "title": "Elems", + "type": "array" + } + }, + "required": [ + "elems" + ], + "title": "SequenceArg", + "type": "object" + }, + "SumType": { + "discriminator": { + "mapping": { + "General": "#/$defs/GeneralSum", + "Unit": "#/$defs/UnitSum" + }, + "propertyName": "s" + }, + "oneOf": [ + { + "$ref": "#/$defs/UnitSum" + }, + { + "$ref": "#/$defs/GeneralSum" + } + ], + "required": [ + "s" + ], + "title": "SumType" + }, + "SumValue": { + "additionalProperties": true, + "description": "A Sum variant For any Sum type where this value meets the type of the variant indicated by the tag.", + "properties": { + "v": { + "const": "Sum", + "default": "Sum", + "enum": [ + "Sum" + ], + "title": "ValueTag", + "type": "string" + }, + "tag": { + "title": "Tag", + "type": "integer" + }, + "typ": { + "$ref": "#/$defs/SumType" + }, + "vs": { + "items": { + "$ref": "#/$defs/Value" + }, + "title": "Vs", + "type": "array" + } + }, + "required": [ + "tag", + "typ", + "vs" + ], + "title": "SumValue", + "type": "object" + }, + "Tag": { + "additionalProperties": true, + "description": "An operation that creates a tagged sum value from one of its variants.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Tag", + "default": "Tag", + "enum": [ + "Tag" + ], + "title": "Op", + "type": "string" + }, + "tag": { + "title": "Tag", + "type": "integer" + }, + "variants": { + "items": { + "items": { + "$ref": "#/$defs/Type" + }, + "type": "array" + }, + "title": "Variants", + "type": "array" + } + }, + "required": [ + "parent", + "tag", + "variants" + ], + "title": "Tag", + "type": "object" + }, + "TailLoop": { + "additionalProperties": true, + "description": "Tail-controlled loop.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "TailLoop", + "default": "TailLoop", + "enum": [ + "TailLoop" + ], + "title": "Op", + "type": "string" + }, + "just_inputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Just Inputs", + "type": "array" + }, + "just_outputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Just Outputs", + "type": "array" + }, + "rest": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Rest", + "type": "array" + }, + "extension_delta": { + "items": { + "type": "string" + }, + "title": "Extension Delta", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "TailLoop", + "type": "object" + }, + "TupleParam": { + "additionalProperties": true, + "properties": { + "tp": { + "const": "Tuple", + "default": "Tuple", + "enum": [ + "Tuple" + ], + "title": "Tp", + "type": "string" + }, + "params": { + "items": { + "$ref": "#/$defs/TypeParam" + }, + "title": "Params", + "type": "array" + } + }, + "required": [ + "params" + ], + "title": "TupleParam", + "type": "object" + }, + "TupleValue": { + "additionalProperties": true, + "description": "A constant tuple value.", + "properties": { + "v": { + "const": "Tuple", + "default": "Tuple", + "enum": [ + "Tuple" + ], + "title": "ValueTag", + "type": "string" + }, + "vs": { + "items": { + "$ref": "#/$defs/Value" + }, + "title": "Vs", + "type": "array" + } + }, + "required": [ + "vs" + ], + "title": "TupleValue", + "type": "object" + }, + "Type": { + "description": "A HUGR type.", + "discriminator": { + "mapping": { + "Alias": "#/$defs/Alias", + "Array": "#/$defs/Array", + "G": "#/$defs/FunctionType", + "I": "#/$defs/USize", + "Opaque": "#/$defs/Opaque", + "Q": "#/$defs/Qubit", + "R": "#/$defs/RowVar", + "Sum": "#/$defs/SumType", + "V": "#/$defs/Variable" + }, + "propertyName": "t" + }, + "oneOf": [ + { + "$ref": "#/$defs/Qubit" + }, + { + "$ref": "#/$defs/Variable" + }, + { + "$ref": "#/$defs/RowVar" + }, + { + "$ref": "#/$defs/USize" + }, + { + "$ref": "#/$defs/FunctionType" + }, + { + "$ref": "#/$defs/Array" + }, + { + "$ref": "#/$defs/SumType" + }, + { + "$ref": "#/$defs/Opaque" + }, + { + "$ref": "#/$defs/Alias" + } + ], + "required": [ + "t" + ], + "title": "Type" + }, + "TypeArg": { + "description": "A type argument.", + "discriminator": { + "mapping": { + "BoundedNat": "#/$defs/BoundedNatArg", + "Extensions": "#/$defs/ExtensionsArg", + "Opaque": "#/$defs/OpaqueArg", + "Sequence": "#/$defs/SequenceArg", + "Type": "#/$defs/TypeTypeArg", + "Variable": "#/$defs/VariableArg" + }, + "propertyName": "tya" + }, + "oneOf": [ + { + "$ref": "#/$defs/TypeTypeArg" + }, + { + "$ref": "#/$defs/BoundedNatArg" + }, + { + "$ref": "#/$defs/OpaqueArg" + }, + { + "$ref": "#/$defs/SequenceArg" + }, + { + "$ref": "#/$defs/ExtensionsArg" + }, + { + "$ref": "#/$defs/VariableArg" + } + ], + "required": [ + "tya" + ], + "title": "TypeArg" + }, + "TypeBound": { + "enum": [ + "E", + "C", + "A" + ], + "title": "TypeBound", + "type": "string" + }, + "TypeParam": { + "description": "A type parameter.", + "discriminator": { + "mapping": { + "BoundedNat": "#/$defs/BoundedNatParam", + "Extensions": "#/$defs/ExtensionsParam", + "List": "#/$defs/ListParam", + "Opaque": "#/$defs/OpaqueParam", + "Tuple": "#/$defs/TupleParam", + "Type": "#/$defs/TypeTypeParam" + }, + "propertyName": "tp" + }, + "oneOf": [ + { + "$ref": "#/$defs/TypeTypeParam" + }, + { + "$ref": "#/$defs/BoundedNatParam" + }, + { + "$ref": "#/$defs/OpaqueParam" + }, + { + "$ref": "#/$defs/ListParam" + }, + { + "$ref": "#/$defs/TupleParam" + }, + { + "$ref": "#/$defs/ExtensionsParam" + } + ], + "required": [ + "tp" + ], + "title": "TypeParam" + }, + "TypeTypeArg": { + "additionalProperties": true, + "properties": { + "tya": { + "const": "Type", + "default": "Type", + "enum": [ + "Type" + ], + "title": "Tya", + "type": "string" + }, + "ty": { + "$ref": "#/$defs/Type" + } + }, + "required": [ + "ty" + ], + "title": "TypeTypeArg", + "type": "object" + }, + "TypeTypeParam": { + "additionalProperties": true, + "properties": { + "tp": { + "const": "Type", + "default": "Type", + "enum": [ + "Type" + ], + "title": "Tp", + "type": "string" + }, + "b": { + "$ref": "#/$defs/TypeBound" + } + }, + "required": [ + "b" + ], + "title": "TypeTypeParam", + "type": "object" + }, + "USize": { + "additionalProperties": true, + "description": "Unsigned integer size type.", + "properties": { + "t": { + "const": "I", + "default": "I", + "enum": [ + "I" + ], + "title": "T", + "type": "string" + } + }, + "title": "USize", + "type": "object" + }, + "UnitSum": { + "additionalProperties": true, + "description": "Simple sum type where all variants are empty tuples.", + "properties": { + "t": { + "const": "Sum", + "default": "Sum", + "enum": [ + "Sum" + ], + "title": "T", + "type": "string" + }, + "s": { + "const": "Unit", + "default": "Unit", + "enum": [ + "Unit" + ], + "title": "S", + "type": "string" + }, + "size": { + "title": "Size", + "type": "integer" + } + }, + "required": [ + "size" + ], + "title": "UnitSum", + "type": "object" + }, + "UnpackTuple": { + "additionalProperties": true, + "description": "An operation that packs all its inputs into a tuple.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "UnpackTuple", + "default": "UnpackTuple", + "enum": [ + "UnpackTuple" + ], + "title": "Op", + "type": "string" + }, + "tys": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Tys", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "UnpackTuple", + "type": "object" + }, + "Value": { + "description": "A constant Value.", + "discriminator": { + "mapping": { + "Extension": "#/$defs/ExtensionValue", + "Function": "#/$defs/FunctionValue", + "Sum": "#/$defs/SumValue", + "Tuple": "#/$defs/TupleValue" + }, + "propertyName": "v" + }, + "oneOf": [ + { + "$ref": "#/$defs/ExtensionValue" + }, + { + "$ref": "#/$defs/FunctionValue" + }, + { + "$ref": "#/$defs/TupleValue" + }, + { + "$ref": "#/$defs/SumValue" + } + ], + "required": [ + "v" + ], + "title": "Value" + }, + "Variable": { + "additionalProperties": true, + "description": "A type variable identified by an index into the array of TypeParams.", + "properties": { + "t": { + "const": "V", + "default": "V", + "enum": [ + "V" + ], + "title": "T", + "type": "string" + }, + "i": { + "title": "I", + "type": "integer" + }, + "b": { + "$ref": "#/$defs/TypeBound" + } + }, + "required": [ + "i", + "b" + ], + "title": "Variable", + "type": "object" + }, + "VariableArg": { + "additionalProperties": true, + "properties": { + "tya": { + "const": "Variable", + "default": "Variable", + "enum": [ + "Variable" + ], + "title": "Tya", + "type": "string" + }, + "idx": { + "title": "Idx", + "type": "integer" + }, + "cached_decl": { + "$ref": "#/$defs/TypeParam" + } + }, + "required": [ + "idx", + "cached_decl" + ], + "title": "VariableArg", + "type": "object" + } + }, + "additionalProperties": true, + "description": "A serializable representation of a Hugr.", + "properties": { + "version": { + "description": "Serialisation Schema Version", + "title": "Version", + "type": "string" + }, + "nodes": { + "items": { + "$ref": "#/$defs/OpType" + }, + "title": "Nodes", + "type": "array" + }, + "edges": { + "items": { + "maxItems": 2, + "minItems": 2, + "prefixItems": [ + { + "maxItems": 2, + "minItems": 2, + "prefixItems": [ + { + "type": "integer" + }, + { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ] + } + ], + "type": "array" + }, + { + "maxItems": 2, + "minItems": 2, + "prefixItems": [ + { + "type": "integer" + }, + { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ] + } + ], + "type": "array" + } + ], + "type": "array" + }, + "title": "Edges", + "type": "array" + }, + "metadata": { + "anyOf": [ + { + "items": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ] + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Metadata" + }, + "encoder": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The name of the encoder used to generate the Hugr.", + "title": "Encoder" + } + }, + "required": [ + "version", + "nodes", + "edges" + ], + "title": "Hugr", + "type": "object" +} \ No newline at end of file diff --git a/specification/schema/testing_hugr_schema_strict_v2.json b/specification/schema/testing_hugr_schema_strict_v2.json new file mode 100644 index 000000000..32c6b1dd3 --- /dev/null +++ b/specification/schema/testing_hugr_schema_strict_v2.json @@ -0,0 +1,2081 @@ +{ + "$defs": { + "Alias": { + "additionalProperties": false, + "description": "An Alias Type.", + "properties": { + "t": { + "const": "Alias", + "default": "Alias", + "enum": [ + "Alias" + ], + "title": "T", + "type": "string" + }, + "bound": { + "$ref": "#/$defs/TypeBound" + }, + "name": { + "title": "Name", + "type": "string" + } + }, + "required": [ + "bound", + "name" + ], + "title": "Alias", + "type": "object" + }, + "AliasDecl": { + "additionalProperties": false, + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "AliasDecl", + "default": "AliasDecl", + "enum": [ + "AliasDecl" + ], + "title": "Op", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "bound": { + "$ref": "#/$defs/TypeBound" + } + }, + "required": [ + "parent", + "name", + "bound" + ], + "title": "AliasDecl", + "type": "object" + }, + "AliasDefn": { + "additionalProperties": false, + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "AliasDefn", + "default": "AliasDefn", + "enum": [ + "AliasDefn" + ], + "title": "Op", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "definition": { + "$ref": "#/$defs/Type" + } + }, + "required": [ + "parent", + "name", + "definition" + ], + "title": "AliasDefn", + "type": "object" + }, + "Array": { + "additionalProperties": false, + "description": "Known size array whose elements are of the same type.", + "properties": { + "ty": { + "$ref": "#/$defs/Type" + }, + "t": { + "const": "Array", + "default": "Array", + "enum": [ + "Array" + ], + "title": "T", + "type": "string" + }, + "len": { + "title": "Len", + "type": "integer" + } + }, + "required": [ + "ty", + "len" + ], + "title": "Array", + "type": "object" + }, + "BoundedNatArg": { + "additionalProperties": false, + "properties": { + "tya": { + "const": "BoundedNat", + "default": "BoundedNat", + "enum": [ + "BoundedNat" + ], + "title": "Tya", + "type": "string" + }, + "n": { + "title": "N", + "type": "integer" + } + }, + "required": [ + "n" + ], + "title": "BoundedNatArg", + "type": "object" + }, + "BoundedNatParam": { + "additionalProperties": false, + "properties": { + "tp": { + "const": "BoundedNat", + "default": "BoundedNat", + "enum": [ + "BoundedNat" + ], + "title": "Tp", + "type": "string" + }, + "bound": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Bound" + } + }, + "required": [ + "bound" + ], + "title": "BoundedNatParam", + "type": "object" + }, + "CFG": { + "additionalProperties": false, + "description": "A dataflow node which is defined by a child CFG.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "CFG", + "default": "CFG", + "enum": [ + "CFG" + ], + "title": "Op", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent" + ], + "title": "CFG", + "type": "object" + }, + "Call": { + "additionalProperties": false, + "description": "Operation to call a function directly. The first port is connected to the def/declare of the function being called directly, with a `Static` edge. The signature of the remaining ports matches the function being called.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Call", + "default": "Call", + "enum": [ + "Call" + ], + "title": "Op", + "type": "string" + }, + "func_sig": { + "$ref": "#/$defs/PolyFuncType" + }, + "type_args": { + "items": { + "$ref": "#/$defs/TypeArg" + }, + "title": "Type Args", + "type": "array" + }, + "instantiation": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent", + "func_sig", + "type_args", + "instantiation" + ], + "title": "Call", + "type": "object" + }, + "CallIndirect": { + "additionalProperties": false, + "description": "Call a function indirectly.\n\nLike call, but the first input is a standard dataflow graph type.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "CallIndirect", + "default": "CallIndirect", + "enum": [ + "CallIndirect" + ], + "title": "Op", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent" + ], + "title": "CallIndirect", + "type": "object" + }, + "Case": { + "additionalProperties": false, + "description": "Case ops - nodes valid inside Conditional nodes.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Case", + "default": "Case", + "enum": [ + "Case" + ], + "title": "Op", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent" + ], + "title": "Case", + "type": "object" + }, + "Conditional": { + "additionalProperties": false, + "description": "Conditional operation, defined by child `Case` nodes for each branch.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Conditional", + "default": "Conditional", + "enum": [ + "Conditional" + ], + "title": "Op", + "type": "string" + }, + "other_inputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Other Inputs", + "type": "array" + }, + "outputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Outputs", + "type": "array" + }, + "sum_rows": { + "description": "The possible rows of the Sum input", + "items": { + "items": { + "$ref": "#/$defs/Type" + }, + "type": "array" + }, + "title": "Sum Rows", + "type": "array" + }, + "extension_delta": { + "items": { + "type": "string" + }, + "title": "Extension Delta", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "Conditional", + "type": "object" + }, + "Const": { + "additionalProperties": false, + "description": "A Const operation definition.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Const", + "default": "Const", + "enum": [ + "Const" + ], + "title": "Op", + "type": "string" + }, + "v": { + "$ref": "#/$defs/Value" + } + }, + "required": [ + "parent", + "v" + ], + "title": "Const", + "type": "object" + }, + "CustomConst": { + "additionalProperties": false, + "properties": { + "c": { + "title": "C", + "type": "string" + }, + "v": { + "title": "V" + } + }, + "required": [ + "c", + "v" + ], + "title": "CustomConst", + "type": "object" + }, + "CustomOp": { + "additionalProperties": false, + "description": "A user-defined operation that can be downcasted by the extensions that define it.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "CustomOp", + "default": "CustomOp", + "enum": [ + "CustomOp" + ], + "title": "Op", + "type": "string" + }, + "extension": { + "title": "Extension", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + }, + "description": { + "default": "", + "title": "Description", + "type": "string" + }, + "args": { + "items": { + "$ref": "#/$defs/TypeArg" + }, + "title": "Args", + "type": "array" + } + }, + "required": [ + "parent", + "extension", + "name" + ], + "title": "CustomOp", + "type": "object" + }, + "DFG": { + "additionalProperties": false, + "description": "A simply nested dataflow graph.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "DFG", + "default": "DFG", + "enum": [ + "DFG" + ], + "title": "Op", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent" + ], + "title": "DFG", + "type": "object" + }, + "DataflowBlock": { + "additionalProperties": false, + "description": "A CFG basic block node. The signature is that of the internal Dataflow graph.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "DataflowBlock", + "default": "DataflowBlock", + "enum": [ + "DataflowBlock" + ], + "title": "Op", + "type": "string" + }, + "inputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Inputs", + "type": "array" + }, + "other_outputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Other Outputs", + "type": "array" + }, + "sum_rows": { + "items": { + "items": { + "$ref": "#/$defs/Type" + }, + "type": "array" + }, + "title": "Sum Rows", + "type": "array" + }, + "extension_delta": { + "items": { + "type": "string" + }, + "title": "Extension Delta", + "type": "array" + } + }, + "required": [ + "parent", + "sum_rows" + ], + "title": "DataflowBlock", + "type": "object" + }, + "ExitBlock": { + "additionalProperties": false, + "description": "The single exit node of the CFG, has no children, stores the types of the CFG node output.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "ExitBlock", + "default": "ExitBlock", + "enum": [ + "ExitBlock" + ], + "title": "Op", + "type": "string" + }, + "cfg_outputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Cfg Outputs", + "type": "array" + } + }, + "required": [ + "parent", + "cfg_outputs" + ], + "title": "ExitBlock", + "type": "object" + }, + "ExtensionValue": { + "additionalProperties": false, + "description": "An extension constant value, that can check it is of a given [CustomType].", + "properties": { + "v": { + "const": "Extension", + "default": "Extension", + "enum": [ + "Extension" + ], + "title": "ValueTag", + "type": "string" + }, + "extensions": { + "items": { + "type": "string" + }, + "title": "Extensions", + "type": "array" + }, + "typ": { + "$ref": "#/$defs/Type" + }, + "value": { + "$ref": "#/$defs/CustomConst" + } + }, + "required": [ + "extensions", + "typ", + "value" + ], + "title": "ExtensionValue", + "type": "object" + }, + "ExtensionsArg": { + "additionalProperties": false, + "properties": { + "tya": { + "const": "Extensions", + "default": "Extensions", + "enum": [ + "Extensions" + ], + "title": "Tya", + "type": "string" + }, + "es": { + "items": { + "type": "string" + }, + "title": "Es", + "type": "array" + } + }, + "required": [ + "es" + ], + "title": "ExtensionsArg", + "type": "object" + }, + "ExtensionsParam": { + "additionalProperties": false, + "properties": { + "tp": { + "const": "Extensions", + "default": "Extensions", + "enum": [ + "Extensions" + ], + "title": "Tp", + "type": "string" + } + }, + "title": "ExtensionsParam", + "type": "object" + }, + "FixedHugr": { + "additionalProperties": false, + "properties": { + "extensions": { + "items": { + "type": "string" + }, + "title": "Extensions", + "type": "array" + }, + "hugr": { + "title": "Hugr" + } + }, + "required": [ + "extensions", + "hugr" + ], + "title": "FixedHugr", + "type": "object" + }, + "FuncDecl": { + "additionalProperties": false, + "description": "External function declaration, linked at runtime.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "FuncDecl", + "default": "FuncDecl", + "enum": [ + "FuncDecl" + ], + "title": "Op", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/PolyFuncType" + } + }, + "required": [ + "parent", + "name", + "signature" + ], + "title": "FuncDecl", + "type": "object" + }, + "FuncDefn": { + "additionalProperties": false, + "description": "A function definition. Children nodes are the body of the definition.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "FuncDefn", + "default": "FuncDefn", + "enum": [ + "FuncDefn" + ], + "title": "Op", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/PolyFuncType" + } + }, + "required": [ + "parent", + "name", + "signature" + ], + "title": "FuncDefn", + "type": "object" + }, + "FunctionType": { + "additionalProperties": false, + "description": "A graph encoded as a value. It contains a concrete signature and a set of required resources.", + "properties": { + "t": { + "const": "G", + "default": "G", + "enum": [ + "G" + ], + "title": "T", + "type": "string" + }, + "input": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Input", + "type": "array" + }, + "output": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Output", + "type": "array" + }, + "extension_reqs": { + "items": { + "type": "string" + }, + "title": "Extension Reqs", + "type": "array" + } + }, + "required": [ + "input", + "output" + ], + "title": "FunctionType", + "type": "object" + }, + "FunctionValue": { + "additionalProperties": false, + "description": "A higher-order function value.", + "properties": { + "v": { + "const": "Function", + "default": "Function", + "enum": [ + "Function" + ], + "title": "ValueTag", + "type": "string" + }, + "hugr": { + "title": "Hugr" + } + }, + "required": [ + "hugr" + ], + "title": "FunctionValue", + "type": "object" + }, + "GeneralSum": { + "additionalProperties": false, + "description": "General sum type that explicitly stores the types of the variants.", + "properties": { + "t": { + "const": "Sum", + "default": "Sum", + "enum": [ + "Sum" + ], + "title": "T", + "type": "string" + }, + "s": { + "const": "General", + "default": "General", + "enum": [ + "General" + ], + "title": "S", + "type": "string" + }, + "rows": { + "items": { + "items": { + "$ref": "#/$defs/Type" + }, + "type": "array" + }, + "title": "Rows", + "type": "array" + } + }, + "required": [ + "rows" + ], + "title": "GeneralSum", + "type": "object" + }, + "Input": { + "additionalProperties": false, + "description": "An input node. The outputs of this node are the inputs to the parent node.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Input", + "default": "Input", + "enum": [ + "Input" + ], + "title": "Op", + "type": "string" + }, + "types": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Types", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "Input", + "type": "object" + }, + "Lift": { + "additionalProperties": false, + "description": "Fixes some TypeParams of a polymorphic type by providing TypeArgs.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Lift", + "default": "Lift", + "enum": [ + "Lift" + ], + "title": "Op", + "type": "string" + }, + "type_row": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Type Row", + "type": "array" + }, + "new_extension": { + "title": "New Extension", + "type": "string" + } + }, + "required": [ + "parent", + "type_row", + "new_extension" + ], + "title": "Lift", + "type": "object" + }, + "ListParam": { + "additionalProperties": false, + "properties": { + "tp": { + "const": "List", + "default": "List", + "enum": [ + "List" + ], + "title": "Tp", + "type": "string" + }, + "param": { + "$ref": "#/$defs/TypeParam" + } + }, + "required": [ + "param" + ], + "title": "ListParam", + "type": "object" + }, + "LoadConstant": { + "additionalProperties": false, + "description": "An operation that loads a static constant in to the local dataflow graph.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "LoadConstant", + "default": "LoadConstant", + "enum": [ + "LoadConstant" + ], + "title": "Op", + "type": "string" + }, + "datatype": { + "$ref": "#/$defs/Type" + } + }, + "required": [ + "parent", + "datatype" + ], + "title": "LoadConstant", + "type": "object" + }, + "LoadFunction": { + "additionalProperties": false, + "description": "Load a static function in to the local dataflow graph.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "LoadFunction", + "default": "LoadFunction", + "enum": [ + "LoadFunction" + ], + "title": "Op", + "type": "string" + }, + "func_sig": { + "$ref": "#/$defs/PolyFuncType" + }, + "type_args": { + "items": { + "$ref": "#/$defs/TypeArg" + }, + "title": "Type Args", + "type": "array" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent", + "func_sig", + "type_args", + "signature" + ], + "title": "LoadFunction", + "type": "object" + }, + "MakeTuple": { + "additionalProperties": false, + "description": "An operation that packs all its inputs into a tuple.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "MakeTuple", + "default": "MakeTuple", + "enum": [ + "MakeTuple" + ], + "title": "Op", + "type": "string" + }, + "tys": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Tys", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "MakeTuple", + "type": "object" + }, + "Module": { + "additionalProperties": false, + "description": "The root of a module, parent of all other `ModuleOp`s.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Module", + "default": "Module", + "enum": [ + "Module" + ], + "title": "Op", + "type": "string" + } + }, + "required": [ + "parent" + ], + "title": "Module", + "type": "object" + }, + "Noop": { + "additionalProperties": false, + "description": "A no-op operation.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Noop", + "default": "Noop", + "enum": [ + "Noop" + ], + "title": "Op", + "type": "string" + }, + "ty": { + "$ref": "#/$defs/Type" + } + }, + "required": [ + "parent", + "ty" + ], + "title": "Noop", + "type": "object" + }, + "OpDef": { + "additionalProperties": false, + "description": "Serializable definition for dynamically loaded operations.", + "properties": { + "extension": { + "title": "Extension", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "description": { + "title": "Description", + "type": "string" + }, + "misc": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Misc" + }, + "signature": { + "anyOf": [ + { + "$ref": "#/$defs/PolyFuncType" + }, + { + "type": "null" + } + ], + "default": null + }, + "lower_funcs": { + "items": { + "$ref": "#/$defs/FixedHugr" + }, + "title": "Lower Funcs", + "type": "array" + } + }, + "required": [ + "extension", + "name", + "description", + "lower_funcs" + ], + "title": "OpDef", + "type": "object" + }, + "OpType": { + "description": "A constant operation.", + "discriminator": { + "mapping": { + "AliasDecl": "#/$defs/AliasDecl", + "AliasDefn": "#/$defs/AliasDefn", + "CFG": "#/$defs/CFG", + "Call": "#/$defs/Call", + "CallIndirect": "#/$defs/CallIndirect", + "Case": "#/$defs/Case", + "Conditional": "#/$defs/Conditional", + "Const": "#/$defs/Const", + "CustomOp": "#/$defs/CustomOp", + "DFG": "#/$defs/DFG", + "DataflowBlock": "#/$defs/DataflowBlock", + "ExitBlock": "#/$defs/ExitBlock", + "FuncDecl": "#/$defs/FuncDecl", + "FuncDefn": "#/$defs/FuncDefn", + "Input": "#/$defs/Input", + "Lift": "#/$defs/Lift", + "LoadConstant": "#/$defs/LoadConstant", + "LoadFunction": "#/$defs/LoadFunction", + "MakeTuple": "#/$defs/MakeTuple", + "Module": "#/$defs/Module", + "Noop": "#/$defs/Noop", + "Output": "#/$defs/Output", + "Tag": "#/$defs/Tag", + "TailLoop": "#/$defs/TailLoop", + "UnpackTuple": "#/$defs/UnpackTuple" + }, + "propertyName": "op" + }, + "oneOf": [ + { + "$ref": "#/$defs/Module" + }, + { + "$ref": "#/$defs/Case" + }, + { + "$ref": "#/$defs/FuncDefn" + }, + { + "$ref": "#/$defs/FuncDecl" + }, + { + "$ref": "#/$defs/Const" + }, + { + "$ref": "#/$defs/DataflowBlock" + }, + { + "$ref": "#/$defs/ExitBlock" + }, + { + "$ref": "#/$defs/Conditional" + }, + { + "$ref": "#/$defs/TailLoop" + }, + { + "$ref": "#/$defs/CFG" + }, + { + "$ref": "#/$defs/Input" + }, + { + "$ref": "#/$defs/Output" + }, + { + "$ref": "#/$defs/Call" + }, + { + "$ref": "#/$defs/CallIndirect" + }, + { + "$ref": "#/$defs/LoadConstant" + }, + { + "$ref": "#/$defs/LoadFunction" + }, + { + "$ref": "#/$defs/CustomOp" + }, + { + "$ref": "#/$defs/Noop" + }, + { + "$ref": "#/$defs/MakeTuple" + }, + { + "$ref": "#/$defs/UnpackTuple" + }, + { + "$ref": "#/$defs/Tag" + }, + { + "$ref": "#/$defs/Lift" + }, + { + "$ref": "#/$defs/DFG" + }, + { + "$ref": "#/$defs/AliasDecl" + }, + { + "$ref": "#/$defs/AliasDefn" + } + ], + "required": [ + "parent", + "op" + ], + "title": "OpType" + }, + "Opaque": { + "additionalProperties": false, + "description": "An opaque Type that can be downcasted by the extensions that define it.", + "properties": { + "t": { + "const": "Opaque", + "default": "Opaque", + "enum": [ + "Opaque" + ], + "title": "T", + "type": "string" + }, + "extension": { + "title": "Extension", + "type": "string" + }, + "id": { + "title": "Id", + "type": "string" + }, + "args": { + "items": { + "$ref": "#/$defs/TypeArg" + }, + "title": "Args", + "type": "array" + }, + "bound": { + "$ref": "#/$defs/TypeBound" + } + }, + "required": [ + "extension", + "id", + "args", + "bound" + ], + "title": "Opaque", + "type": "object" + }, + "OpaqueArg": { + "additionalProperties": false, + "properties": { + "tya": { + "const": "Opaque", + "default": "Opaque", + "enum": [ + "Opaque" + ], + "title": "Tya", + "type": "string" + }, + "typ": { + "$ref": "#/$defs/Opaque" + }, + "value": { + "title": "Value" + } + }, + "required": [ + "typ", + "value" + ], + "title": "OpaqueArg", + "type": "object" + }, + "OpaqueParam": { + "additionalProperties": false, + "properties": { + "tp": { + "const": "Opaque", + "default": "Opaque", + "enum": [ + "Opaque" + ], + "title": "Tp", + "type": "string" + }, + "ty": { + "$ref": "#/$defs/Opaque" + } + }, + "required": [ + "ty" + ], + "title": "OpaqueParam", + "type": "object" + }, + "Output": { + "additionalProperties": false, + "description": "An output node. The inputs are the outputs of the function.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Output", + "default": "Output", + "enum": [ + "Output" + ], + "title": "Op", + "type": "string" + }, + "types": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Types", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "Output", + "type": "object" + }, + "PolyFuncType": { + "additionalProperties": false, + "description": "A polymorphic type scheme, i.e. of a FuncDecl, FuncDefn or OpDef. (Nodes/operations in the Hugr are not polymorphic.)", + "properties": { + "params": { + "items": { + "$ref": "#/$defs/TypeParam" + }, + "title": "Params", + "type": "array" + }, + "body": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "params", + "body" + ], + "title": "PolyFuncType", + "type": "object" + }, + "Qubit": { + "additionalProperties": false, + "description": "A qubit.", + "properties": { + "t": { + "const": "Q", + "default": "Q", + "enum": [ + "Q" + ], + "title": "T", + "type": "string" + } + }, + "title": "Qubit", + "type": "object" + }, + "RowVar": { + "additionalProperties": false, + "description": "A variable standing for a row of some (unknown) number of types.\nMay occur only within a row; not a node input/output.", + "properties": { + "t": { + "const": "R", + "default": "R", + "enum": [ + "R" + ], + "title": "T", + "type": "string" + }, + "i": { + "title": "I", + "type": "integer" + }, + "b": { + "$ref": "#/$defs/TypeBound" + } + }, + "required": [ + "i", + "b" + ], + "title": "RowVar", + "type": "object" + }, + "SequenceArg": { + "additionalProperties": false, + "properties": { + "tya": { + "const": "Sequence", + "default": "Sequence", + "enum": [ + "Sequence" + ], + "title": "Tya", + "type": "string" + }, + "elems": { + "items": { + "$ref": "#/$defs/TypeArg" + }, + "title": "Elems", + "type": "array" + } + }, + "required": [ + "elems" + ], + "title": "SequenceArg", + "type": "object" + }, + "SumType": { + "discriminator": { + "mapping": { + "General": "#/$defs/GeneralSum", + "Unit": "#/$defs/UnitSum" + }, + "propertyName": "s" + }, + "oneOf": [ + { + "$ref": "#/$defs/UnitSum" + }, + { + "$ref": "#/$defs/GeneralSum" + } + ], + "required": [ + "s" + ], + "title": "SumType" + }, + "SumValue": { + "additionalProperties": false, + "description": "A Sum variant For any Sum type where this value meets the type of the variant indicated by the tag.", + "properties": { + "v": { + "const": "Sum", + "default": "Sum", + "enum": [ + "Sum" + ], + "title": "ValueTag", + "type": "string" + }, + "tag": { + "title": "Tag", + "type": "integer" + }, + "typ": { + "$ref": "#/$defs/SumType" + }, + "vs": { + "items": { + "$ref": "#/$defs/Value" + }, + "title": "Vs", + "type": "array" + } + }, + "required": [ + "tag", + "typ", + "vs" + ], + "title": "SumValue", + "type": "object" + }, + "Tag": { + "additionalProperties": false, + "description": "An operation that creates a tagged sum value from one of its variants.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Tag", + "default": "Tag", + "enum": [ + "Tag" + ], + "title": "Op", + "type": "string" + }, + "tag": { + "title": "Tag", + "type": "integer" + }, + "variants": { + "items": { + "items": { + "$ref": "#/$defs/Type" + }, + "type": "array" + }, + "title": "Variants", + "type": "array" + } + }, + "required": [ + "parent", + "tag", + "variants" + ], + "title": "Tag", + "type": "object" + }, + "TailLoop": { + "additionalProperties": false, + "description": "Tail-controlled loop.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "TailLoop", + "default": "TailLoop", + "enum": [ + "TailLoop" + ], + "title": "Op", + "type": "string" + }, + "just_inputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Just Inputs", + "type": "array" + }, + "just_outputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Just Outputs", + "type": "array" + }, + "rest": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Rest", + "type": "array" + }, + "extension_delta": { + "items": { + "type": "string" + }, + "title": "Extension Delta", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "TailLoop", + "type": "object" + }, + "TupleParam": { + "additionalProperties": false, + "properties": { + "tp": { + "const": "Tuple", + "default": "Tuple", + "enum": [ + "Tuple" + ], + "title": "Tp", + "type": "string" + }, + "params": { + "items": { + "$ref": "#/$defs/TypeParam" + }, + "title": "Params", + "type": "array" + } + }, + "required": [ + "params" + ], + "title": "TupleParam", + "type": "object" + }, + "TupleValue": { + "additionalProperties": false, + "description": "A constant tuple value.", + "properties": { + "v": { + "const": "Tuple", + "default": "Tuple", + "enum": [ + "Tuple" + ], + "title": "ValueTag", + "type": "string" + }, + "vs": { + "items": { + "$ref": "#/$defs/Value" + }, + "title": "Vs", + "type": "array" + } + }, + "required": [ + "vs" + ], + "title": "TupleValue", + "type": "object" + }, + "Type": { + "description": "A HUGR type.", + "discriminator": { + "mapping": { + "Alias": "#/$defs/Alias", + "Array": "#/$defs/Array", + "G": "#/$defs/FunctionType", + "I": "#/$defs/USize", + "Opaque": "#/$defs/Opaque", + "Q": "#/$defs/Qubit", + "R": "#/$defs/RowVar", + "Sum": "#/$defs/SumType", + "V": "#/$defs/Variable" + }, + "propertyName": "t" + }, + "oneOf": [ + { + "$ref": "#/$defs/Qubit" + }, + { + "$ref": "#/$defs/Variable" + }, + { + "$ref": "#/$defs/RowVar" + }, + { + "$ref": "#/$defs/USize" + }, + { + "$ref": "#/$defs/FunctionType" + }, + { + "$ref": "#/$defs/Array" + }, + { + "$ref": "#/$defs/SumType" + }, + { + "$ref": "#/$defs/Opaque" + }, + { + "$ref": "#/$defs/Alias" + } + ], + "required": [ + "t" + ], + "title": "Type" + }, + "TypeArg": { + "description": "A type argument.", + "discriminator": { + "mapping": { + "BoundedNat": "#/$defs/BoundedNatArg", + "Extensions": "#/$defs/ExtensionsArg", + "Opaque": "#/$defs/OpaqueArg", + "Sequence": "#/$defs/SequenceArg", + "Type": "#/$defs/TypeTypeArg", + "Variable": "#/$defs/VariableArg" + }, + "propertyName": "tya" + }, + "oneOf": [ + { + "$ref": "#/$defs/TypeTypeArg" + }, + { + "$ref": "#/$defs/BoundedNatArg" + }, + { + "$ref": "#/$defs/OpaqueArg" + }, + { + "$ref": "#/$defs/SequenceArg" + }, + { + "$ref": "#/$defs/ExtensionsArg" + }, + { + "$ref": "#/$defs/VariableArg" + } + ], + "required": [ + "tya" + ], + "title": "TypeArg" + }, + "TypeBound": { + "enum": [ + "E", + "C", + "A" + ], + "title": "TypeBound", + "type": "string" + }, + "TypeParam": { + "description": "A type parameter.", + "discriminator": { + "mapping": { + "BoundedNat": "#/$defs/BoundedNatParam", + "Extensions": "#/$defs/ExtensionsParam", + "List": "#/$defs/ListParam", + "Opaque": "#/$defs/OpaqueParam", + "Tuple": "#/$defs/TupleParam", + "Type": "#/$defs/TypeTypeParam" + }, + "propertyName": "tp" + }, + "oneOf": [ + { + "$ref": "#/$defs/TypeTypeParam" + }, + { + "$ref": "#/$defs/BoundedNatParam" + }, + { + "$ref": "#/$defs/OpaqueParam" + }, + { + "$ref": "#/$defs/ListParam" + }, + { + "$ref": "#/$defs/TupleParam" + }, + { + "$ref": "#/$defs/ExtensionsParam" + } + ], + "required": [ + "tp" + ], + "title": "TypeParam" + }, + "TypeTypeArg": { + "additionalProperties": false, + "properties": { + "tya": { + "const": "Type", + "default": "Type", + "enum": [ + "Type" + ], + "title": "Tya", + "type": "string" + }, + "ty": { + "$ref": "#/$defs/Type" + } + }, + "required": [ + "ty" + ], + "title": "TypeTypeArg", + "type": "object" + }, + "TypeTypeParam": { + "additionalProperties": false, + "properties": { + "tp": { + "const": "Type", + "default": "Type", + "enum": [ + "Type" + ], + "title": "Tp", + "type": "string" + }, + "b": { + "$ref": "#/$defs/TypeBound" + } + }, + "required": [ + "b" + ], + "title": "TypeTypeParam", + "type": "object" + }, + "USize": { + "additionalProperties": false, + "description": "Unsigned integer size type.", + "properties": { + "t": { + "const": "I", + "default": "I", + "enum": [ + "I" + ], + "title": "T", + "type": "string" + } + }, + "title": "USize", + "type": "object" + }, + "UnitSum": { + "additionalProperties": false, + "description": "Simple sum type where all variants are empty tuples.", + "properties": { + "t": { + "const": "Sum", + "default": "Sum", + "enum": [ + "Sum" + ], + "title": "T", + "type": "string" + }, + "s": { + "const": "Unit", + "default": "Unit", + "enum": [ + "Unit" + ], + "title": "S", + "type": "string" + }, + "size": { + "title": "Size", + "type": "integer" + } + }, + "required": [ + "size" + ], + "title": "UnitSum", + "type": "object" + }, + "UnpackTuple": { + "additionalProperties": false, + "description": "An operation that packs all its inputs into a tuple.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "UnpackTuple", + "default": "UnpackTuple", + "enum": [ + "UnpackTuple" + ], + "title": "Op", + "type": "string" + }, + "tys": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Tys", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "UnpackTuple", + "type": "object" + }, + "Value": { + "description": "A constant Value.", + "discriminator": { + "mapping": { + "Extension": "#/$defs/ExtensionValue", + "Function": "#/$defs/FunctionValue", + "Sum": "#/$defs/SumValue", + "Tuple": "#/$defs/TupleValue" + }, + "propertyName": "v" + }, + "oneOf": [ + { + "$ref": "#/$defs/ExtensionValue" + }, + { + "$ref": "#/$defs/FunctionValue" + }, + { + "$ref": "#/$defs/TupleValue" + }, + { + "$ref": "#/$defs/SumValue" + } + ], + "required": [ + "v" + ], + "title": "Value" + }, + "Variable": { + "additionalProperties": false, + "description": "A type variable identified by an index into the array of TypeParams.", + "properties": { + "t": { + "const": "V", + "default": "V", + "enum": [ + "V" + ], + "title": "T", + "type": "string" + }, + "i": { + "title": "I", + "type": "integer" + }, + "b": { + "$ref": "#/$defs/TypeBound" + } + }, + "required": [ + "i", + "b" + ], + "title": "Variable", + "type": "object" + }, + "VariableArg": { + "additionalProperties": false, + "properties": { + "tya": { + "const": "Variable", + "default": "Variable", + "enum": [ + "Variable" + ], + "title": "Tya", + "type": "string" + }, + "idx": { + "title": "Idx", + "type": "integer" + }, + "cached_decl": { + "$ref": "#/$defs/TypeParam" + } + }, + "required": [ + "idx", + "cached_decl" + ], + "title": "VariableArg", + "type": "object" + } + }, + "additionalProperties": false, + "description": "A serializable representation of a Hugr Type, SumType, PolyFuncType,\nValue, OpType. Intended for testing only.", + "properties": { + "version": { + "description": "Serialisation Schema Version", + "title": "Version", + "type": "string" + }, + "typ": { + "anyOf": [ + { + "$ref": "#/$defs/Type" + }, + { + "type": "null" + } + ], + "default": null + }, + "sum_type": { + "anyOf": [ + { + "$ref": "#/$defs/SumType" + }, + { + "type": "null" + } + ], + "default": null + }, + "poly_func_type": { + "anyOf": [ + { + "$ref": "#/$defs/PolyFuncType" + }, + { + "type": "null" + } + ], + "default": null + }, + "value": { + "anyOf": [ + { + "$ref": "#/$defs/Value" + }, + { + "type": "null" + } + ], + "default": null + }, + "optype": { + "anyOf": [ + { + "$ref": "#/$defs/OpType" + }, + { + "type": "null" + } + ], + "default": null + }, + "op_def": { + "anyOf": [ + { + "$ref": "#/$defs/OpDef" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "TestingHugr", + "type": "object" +} \ No newline at end of file diff --git a/specification/schema/testing_hugr_schema_v2.json b/specification/schema/testing_hugr_schema_v2.json new file mode 100644 index 000000000..56fe27bc6 --- /dev/null +++ b/specification/schema/testing_hugr_schema_v2.json @@ -0,0 +1,2081 @@ +{ + "$defs": { + "Alias": { + "additionalProperties": true, + "description": "An Alias Type.", + "properties": { + "t": { + "const": "Alias", + "default": "Alias", + "enum": [ + "Alias" + ], + "title": "T", + "type": "string" + }, + "bound": { + "$ref": "#/$defs/TypeBound" + }, + "name": { + "title": "Name", + "type": "string" + } + }, + "required": [ + "bound", + "name" + ], + "title": "Alias", + "type": "object" + }, + "AliasDecl": { + "additionalProperties": true, + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "AliasDecl", + "default": "AliasDecl", + "enum": [ + "AliasDecl" + ], + "title": "Op", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "bound": { + "$ref": "#/$defs/TypeBound" + } + }, + "required": [ + "parent", + "name", + "bound" + ], + "title": "AliasDecl", + "type": "object" + }, + "AliasDefn": { + "additionalProperties": true, + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "AliasDefn", + "default": "AliasDefn", + "enum": [ + "AliasDefn" + ], + "title": "Op", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "definition": { + "$ref": "#/$defs/Type" + } + }, + "required": [ + "parent", + "name", + "definition" + ], + "title": "AliasDefn", + "type": "object" + }, + "Array": { + "additionalProperties": true, + "description": "Known size array whose elements are of the same type.", + "properties": { + "ty": { + "$ref": "#/$defs/Type" + }, + "t": { + "const": "Array", + "default": "Array", + "enum": [ + "Array" + ], + "title": "T", + "type": "string" + }, + "len": { + "title": "Len", + "type": "integer" + } + }, + "required": [ + "ty", + "len" + ], + "title": "Array", + "type": "object" + }, + "BoundedNatArg": { + "additionalProperties": true, + "properties": { + "tya": { + "const": "BoundedNat", + "default": "BoundedNat", + "enum": [ + "BoundedNat" + ], + "title": "Tya", + "type": "string" + }, + "n": { + "title": "N", + "type": "integer" + } + }, + "required": [ + "n" + ], + "title": "BoundedNatArg", + "type": "object" + }, + "BoundedNatParam": { + "additionalProperties": true, + "properties": { + "tp": { + "const": "BoundedNat", + "default": "BoundedNat", + "enum": [ + "BoundedNat" + ], + "title": "Tp", + "type": "string" + }, + "bound": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Bound" + } + }, + "required": [ + "bound" + ], + "title": "BoundedNatParam", + "type": "object" + }, + "CFG": { + "additionalProperties": true, + "description": "A dataflow node which is defined by a child CFG.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "CFG", + "default": "CFG", + "enum": [ + "CFG" + ], + "title": "Op", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent" + ], + "title": "CFG", + "type": "object" + }, + "Call": { + "additionalProperties": true, + "description": "Operation to call a function directly. The first port is connected to the def/declare of the function being called directly, with a `Static` edge. The signature of the remaining ports matches the function being called.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Call", + "default": "Call", + "enum": [ + "Call" + ], + "title": "Op", + "type": "string" + }, + "func_sig": { + "$ref": "#/$defs/PolyFuncType" + }, + "type_args": { + "items": { + "$ref": "#/$defs/TypeArg" + }, + "title": "Type Args", + "type": "array" + }, + "instantiation": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent", + "func_sig", + "type_args", + "instantiation" + ], + "title": "Call", + "type": "object" + }, + "CallIndirect": { + "additionalProperties": true, + "description": "Call a function indirectly.\n\nLike call, but the first input is a standard dataflow graph type.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "CallIndirect", + "default": "CallIndirect", + "enum": [ + "CallIndirect" + ], + "title": "Op", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent" + ], + "title": "CallIndirect", + "type": "object" + }, + "Case": { + "additionalProperties": true, + "description": "Case ops - nodes valid inside Conditional nodes.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Case", + "default": "Case", + "enum": [ + "Case" + ], + "title": "Op", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent" + ], + "title": "Case", + "type": "object" + }, + "Conditional": { + "additionalProperties": true, + "description": "Conditional operation, defined by child `Case` nodes for each branch.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Conditional", + "default": "Conditional", + "enum": [ + "Conditional" + ], + "title": "Op", + "type": "string" + }, + "other_inputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Other Inputs", + "type": "array" + }, + "outputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Outputs", + "type": "array" + }, + "sum_rows": { + "description": "The possible rows of the Sum input", + "items": { + "items": { + "$ref": "#/$defs/Type" + }, + "type": "array" + }, + "title": "Sum Rows", + "type": "array" + }, + "extension_delta": { + "items": { + "type": "string" + }, + "title": "Extension Delta", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "Conditional", + "type": "object" + }, + "Const": { + "additionalProperties": true, + "description": "A Const operation definition.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Const", + "default": "Const", + "enum": [ + "Const" + ], + "title": "Op", + "type": "string" + }, + "v": { + "$ref": "#/$defs/Value" + } + }, + "required": [ + "parent", + "v" + ], + "title": "Const", + "type": "object" + }, + "CustomConst": { + "additionalProperties": true, + "properties": { + "c": { + "title": "C", + "type": "string" + }, + "v": { + "title": "V" + } + }, + "required": [ + "c", + "v" + ], + "title": "CustomConst", + "type": "object" + }, + "CustomOp": { + "additionalProperties": true, + "description": "A user-defined operation that can be downcasted by the extensions that define it.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "CustomOp", + "default": "CustomOp", + "enum": [ + "CustomOp" + ], + "title": "Op", + "type": "string" + }, + "extension": { + "title": "Extension", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + }, + "description": { + "default": "", + "title": "Description", + "type": "string" + }, + "args": { + "items": { + "$ref": "#/$defs/TypeArg" + }, + "title": "Args", + "type": "array" + } + }, + "required": [ + "parent", + "extension", + "name" + ], + "title": "CustomOp", + "type": "object" + }, + "DFG": { + "additionalProperties": true, + "description": "A simply nested dataflow graph.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "DFG", + "default": "DFG", + "enum": [ + "DFG" + ], + "title": "Op", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent" + ], + "title": "DFG", + "type": "object" + }, + "DataflowBlock": { + "additionalProperties": true, + "description": "A CFG basic block node. The signature is that of the internal Dataflow graph.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "DataflowBlock", + "default": "DataflowBlock", + "enum": [ + "DataflowBlock" + ], + "title": "Op", + "type": "string" + }, + "inputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Inputs", + "type": "array" + }, + "other_outputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Other Outputs", + "type": "array" + }, + "sum_rows": { + "items": { + "items": { + "$ref": "#/$defs/Type" + }, + "type": "array" + }, + "title": "Sum Rows", + "type": "array" + }, + "extension_delta": { + "items": { + "type": "string" + }, + "title": "Extension Delta", + "type": "array" + } + }, + "required": [ + "parent", + "sum_rows" + ], + "title": "DataflowBlock", + "type": "object" + }, + "ExitBlock": { + "additionalProperties": true, + "description": "The single exit node of the CFG, has no children, stores the types of the CFG node output.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "ExitBlock", + "default": "ExitBlock", + "enum": [ + "ExitBlock" + ], + "title": "Op", + "type": "string" + }, + "cfg_outputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Cfg Outputs", + "type": "array" + } + }, + "required": [ + "parent", + "cfg_outputs" + ], + "title": "ExitBlock", + "type": "object" + }, + "ExtensionValue": { + "additionalProperties": true, + "description": "An extension constant value, that can check it is of a given [CustomType].", + "properties": { + "v": { + "const": "Extension", + "default": "Extension", + "enum": [ + "Extension" + ], + "title": "ValueTag", + "type": "string" + }, + "extensions": { + "items": { + "type": "string" + }, + "title": "Extensions", + "type": "array" + }, + "typ": { + "$ref": "#/$defs/Type" + }, + "value": { + "$ref": "#/$defs/CustomConst" + } + }, + "required": [ + "extensions", + "typ", + "value" + ], + "title": "ExtensionValue", + "type": "object" + }, + "ExtensionsArg": { + "additionalProperties": true, + "properties": { + "tya": { + "const": "Extensions", + "default": "Extensions", + "enum": [ + "Extensions" + ], + "title": "Tya", + "type": "string" + }, + "es": { + "items": { + "type": "string" + }, + "title": "Es", + "type": "array" + } + }, + "required": [ + "es" + ], + "title": "ExtensionsArg", + "type": "object" + }, + "ExtensionsParam": { + "additionalProperties": true, + "properties": { + "tp": { + "const": "Extensions", + "default": "Extensions", + "enum": [ + "Extensions" + ], + "title": "Tp", + "type": "string" + } + }, + "title": "ExtensionsParam", + "type": "object" + }, + "FixedHugr": { + "additionalProperties": true, + "properties": { + "extensions": { + "items": { + "type": "string" + }, + "title": "Extensions", + "type": "array" + }, + "hugr": { + "title": "Hugr" + } + }, + "required": [ + "extensions", + "hugr" + ], + "title": "FixedHugr", + "type": "object" + }, + "FuncDecl": { + "additionalProperties": true, + "description": "External function declaration, linked at runtime.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "FuncDecl", + "default": "FuncDecl", + "enum": [ + "FuncDecl" + ], + "title": "Op", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/PolyFuncType" + } + }, + "required": [ + "parent", + "name", + "signature" + ], + "title": "FuncDecl", + "type": "object" + }, + "FuncDefn": { + "additionalProperties": true, + "description": "A function definition. Children nodes are the body of the definition.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "FuncDefn", + "default": "FuncDefn", + "enum": [ + "FuncDefn" + ], + "title": "Op", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "signature": { + "$ref": "#/$defs/PolyFuncType" + } + }, + "required": [ + "parent", + "name", + "signature" + ], + "title": "FuncDefn", + "type": "object" + }, + "FunctionType": { + "additionalProperties": true, + "description": "A graph encoded as a value. It contains a concrete signature and a set of required resources.", + "properties": { + "t": { + "const": "G", + "default": "G", + "enum": [ + "G" + ], + "title": "T", + "type": "string" + }, + "input": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Input", + "type": "array" + }, + "output": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Output", + "type": "array" + }, + "extension_reqs": { + "items": { + "type": "string" + }, + "title": "Extension Reqs", + "type": "array" + } + }, + "required": [ + "input", + "output" + ], + "title": "FunctionType", + "type": "object" + }, + "FunctionValue": { + "additionalProperties": true, + "description": "A higher-order function value.", + "properties": { + "v": { + "const": "Function", + "default": "Function", + "enum": [ + "Function" + ], + "title": "ValueTag", + "type": "string" + }, + "hugr": { + "title": "Hugr" + } + }, + "required": [ + "hugr" + ], + "title": "FunctionValue", + "type": "object" + }, + "GeneralSum": { + "additionalProperties": true, + "description": "General sum type that explicitly stores the types of the variants.", + "properties": { + "t": { + "const": "Sum", + "default": "Sum", + "enum": [ + "Sum" + ], + "title": "T", + "type": "string" + }, + "s": { + "const": "General", + "default": "General", + "enum": [ + "General" + ], + "title": "S", + "type": "string" + }, + "rows": { + "items": { + "items": { + "$ref": "#/$defs/Type" + }, + "type": "array" + }, + "title": "Rows", + "type": "array" + } + }, + "required": [ + "rows" + ], + "title": "GeneralSum", + "type": "object" + }, + "Input": { + "additionalProperties": true, + "description": "An input node. The outputs of this node are the inputs to the parent node.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Input", + "default": "Input", + "enum": [ + "Input" + ], + "title": "Op", + "type": "string" + }, + "types": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Types", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "Input", + "type": "object" + }, + "Lift": { + "additionalProperties": true, + "description": "Fixes some TypeParams of a polymorphic type by providing TypeArgs.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Lift", + "default": "Lift", + "enum": [ + "Lift" + ], + "title": "Op", + "type": "string" + }, + "type_row": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Type Row", + "type": "array" + }, + "new_extension": { + "title": "New Extension", + "type": "string" + } + }, + "required": [ + "parent", + "type_row", + "new_extension" + ], + "title": "Lift", + "type": "object" + }, + "ListParam": { + "additionalProperties": true, + "properties": { + "tp": { + "const": "List", + "default": "List", + "enum": [ + "List" + ], + "title": "Tp", + "type": "string" + }, + "param": { + "$ref": "#/$defs/TypeParam" + } + }, + "required": [ + "param" + ], + "title": "ListParam", + "type": "object" + }, + "LoadConstant": { + "additionalProperties": true, + "description": "An operation that loads a static constant in to the local dataflow graph.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "LoadConstant", + "default": "LoadConstant", + "enum": [ + "LoadConstant" + ], + "title": "Op", + "type": "string" + }, + "datatype": { + "$ref": "#/$defs/Type" + } + }, + "required": [ + "parent", + "datatype" + ], + "title": "LoadConstant", + "type": "object" + }, + "LoadFunction": { + "additionalProperties": true, + "description": "Load a static function in to the local dataflow graph.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "LoadFunction", + "default": "LoadFunction", + "enum": [ + "LoadFunction" + ], + "title": "Op", + "type": "string" + }, + "func_sig": { + "$ref": "#/$defs/PolyFuncType" + }, + "type_args": { + "items": { + "$ref": "#/$defs/TypeArg" + }, + "title": "Type Args", + "type": "array" + }, + "signature": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "parent", + "func_sig", + "type_args", + "signature" + ], + "title": "LoadFunction", + "type": "object" + }, + "MakeTuple": { + "additionalProperties": true, + "description": "An operation that packs all its inputs into a tuple.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "MakeTuple", + "default": "MakeTuple", + "enum": [ + "MakeTuple" + ], + "title": "Op", + "type": "string" + }, + "tys": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Tys", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "MakeTuple", + "type": "object" + }, + "Module": { + "additionalProperties": true, + "description": "The root of a module, parent of all other `ModuleOp`s.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Module", + "default": "Module", + "enum": [ + "Module" + ], + "title": "Op", + "type": "string" + } + }, + "required": [ + "parent" + ], + "title": "Module", + "type": "object" + }, + "Noop": { + "additionalProperties": true, + "description": "A no-op operation.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Noop", + "default": "Noop", + "enum": [ + "Noop" + ], + "title": "Op", + "type": "string" + }, + "ty": { + "$ref": "#/$defs/Type" + } + }, + "required": [ + "parent", + "ty" + ], + "title": "Noop", + "type": "object" + }, + "OpDef": { + "additionalProperties": true, + "description": "Serializable definition for dynamically loaded operations.", + "properties": { + "extension": { + "title": "Extension", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "description": { + "title": "Description", + "type": "string" + }, + "misc": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Misc" + }, + "signature": { + "anyOf": [ + { + "$ref": "#/$defs/PolyFuncType" + }, + { + "type": "null" + } + ], + "default": null + }, + "lower_funcs": { + "items": { + "$ref": "#/$defs/FixedHugr" + }, + "title": "Lower Funcs", + "type": "array" + } + }, + "required": [ + "extension", + "name", + "description", + "lower_funcs" + ], + "title": "OpDef", + "type": "object" + }, + "OpType": { + "description": "A constant operation.", + "discriminator": { + "mapping": { + "AliasDecl": "#/$defs/AliasDecl", + "AliasDefn": "#/$defs/AliasDefn", + "CFG": "#/$defs/CFG", + "Call": "#/$defs/Call", + "CallIndirect": "#/$defs/CallIndirect", + "Case": "#/$defs/Case", + "Conditional": "#/$defs/Conditional", + "Const": "#/$defs/Const", + "CustomOp": "#/$defs/CustomOp", + "DFG": "#/$defs/DFG", + "DataflowBlock": "#/$defs/DataflowBlock", + "ExitBlock": "#/$defs/ExitBlock", + "FuncDecl": "#/$defs/FuncDecl", + "FuncDefn": "#/$defs/FuncDefn", + "Input": "#/$defs/Input", + "Lift": "#/$defs/Lift", + "LoadConstant": "#/$defs/LoadConstant", + "LoadFunction": "#/$defs/LoadFunction", + "MakeTuple": "#/$defs/MakeTuple", + "Module": "#/$defs/Module", + "Noop": "#/$defs/Noop", + "Output": "#/$defs/Output", + "Tag": "#/$defs/Tag", + "TailLoop": "#/$defs/TailLoop", + "UnpackTuple": "#/$defs/UnpackTuple" + }, + "propertyName": "op" + }, + "oneOf": [ + { + "$ref": "#/$defs/Module" + }, + { + "$ref": "#/$defs/Case" + }, + { + "$ref": "#/$defs/FuncDefn" + }, + { + "$ref": "#/$defs/FuncDecl" + }, + { + "$ref": "#/$defs/Const" + }, + { + "$ref": "#/$defs/DataflowBlock" + }, + { + "$ref": "#/$defs/ExitBlock" + }, + { + "$ref": "#/$defs/Conditional" + }, + { + "$ref": "#/$defs/TailLoop" + }, + { + "$ref": "#/$defs/CFG" + }, + { + "$ref": "#/$defs/Input" + }, + { + "$ref": "#/$defs/Output" + }, + { + "$ref": "#/$defs/Call" + }, + { + "$ref": "#/$defs/CallIndirect" + }, + { + "$ref": "#/$defs/LoadConstant" + }, + { + "$ref": "#/$defs/LoadFunction" + }, + { + "$ref": "#/$defs/CustomOp" + }, + { + "$ref": "#/$defs/Noop" + }, + { + "$ref": "#/$defs/MakeTuple" + }, + { + "$ref": "#/$defs/UnpackTuple" + }, + { + "$ref": "#/$defs/Tag" + }, + { + "$ref": "#/$defs/Lift" + }, + { + "$ref": "#/$defs/DFG" + }, + { + "$ref": "#/$defs/AliasDecl" + }, + { + "$ref": "#/$defs/AliasDefn" + } + ], + "required": [ + "parent", + "op" + ], + "title": "OpType" + }, + "Opaque": { + "additionalProperties": true, + "description": "An opaque Type that can be downcasted by the extensions that define it.", + "properties": { + "t": { + "const": "Opaque", + "default": "Opaque", + "enum": [ + "Opaque" + ], + "title": "T", + "type": "string" + }, + "extension": { + "title": "Extension", + "type": "string" + }, + "id": { + "title": "Id", + "type": "string" + }, + "args": { + "items": { + "$ref": "#/$defs/TypeArg" + }, + "title": "Args", + "type": "array" + }, + "bound": { + "$ref": "#/$defs/TypeBound" + } + }, + "required": [ + "extension", + "id", + "args", + "bound" + ], + "title": "Opaque", + "type": "object" + }, + "OpaqueArg": { + "additionalProperties": true, + "properties": { + "tya": { + "const": "Opaque", + "default": "Opaque", + "enum": [ + "Opaque" + ], + "title": "Tya", + "type": "string" + }, + "typ": { + "$ref": "#/$defs/Opaque" + }, + "value": { + "title": "Value" + } + }, + "required": [ + "typ", + "value" + ], + "title": "OpaqueArg", + "type": "object" + }, + "OpaqueParam": { + "additionalProperties": true, + "properties": { + "tp": { + "const": "Opaque", + "default": "Opaque", + "enum": [ + "Opaque" + ], + "title": "Tp", + "type": "string" + }, + "ty": { + "$ref": "#/$defs/Opaque" + } + }, + "required": [ + "ty" + ], + "title": "OpaqueParam", + "type": "object" + }, + "Output": { + "additionalProperties": true, + "description": "An output node. The inputs are the outputs of the function.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Output", + "default": "Output", + "enum": [ + "Output" + ], + "title": "Op", + "type": "string" + }, + "types": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Types", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "Output", + "type": "object" + }, + "PolyFuncType": { + "additionalProperties": true, + "description": "A polymorphic type scheme, i.e. of a FuncDecl, FuncDefn or OpDef. (Nodes/operations in the Hugr are not polymorphic.)", + "properties": { + "params": { + "items": { + "$ref": "#/$defs/TypeParam" + }, + "title": "Params", + "type": "array" + }, + "body": { + "$ref": "#/$defs/FunctionType" + } + }, + "required": [ + "params", + "body" + ], + "title": "PolyFuncType", + "type": "object" + }, + "Qubit": { + "additionalProperties": true, + "description": "A qubit.", + "properties": { + "t": { + "const": "Q", + "default": "Q", + "enum": [ + "Q" + ], + "title": "T", + "type": "string" + } + }, + "title": "Qubit", + "type": "object" + }, + "RowVar": { + "additionalProperties": true, + "description": "A variable standing for a row of some (unknown) number of types.\nMay occur only within a row; not a node input/output.", + "properties": { + "t": { + "const": "R", + "default": "R", + "enum": [ + "R" + ], + "title": "T", + "type": "string" + }, + "i": { + "title": "I", + "type": "integer" + }, + "b": { + "$ref": "#/$defs/TypeBound" + } + }, + "required": [ + "i", + "b" + ], + "title": "RowVar", + "type": "object" + }, + "SequenceArg": { + "additionalProperties": true, + "properties": { + "tya": { + "const": "Sequence", + "default": "Sequence", + "enum": [ + "Sequence" + ], + "title": "Tya", + "type": "string" + }, + "elems": { + "items": { + "$ref": "#/$defs/TypeArg" + }, + "title": "Elems", + "type": "array" + } + }, + "required": [ + "elems" + ], + "title": "SequenceArg", + "type": "object" + }, + "SumType": { + "discriminator": { + "mapping": { + "General": "#/$defs/GeneralSum", + "Unit": "#/$defs/UnitSum" + }, + "propertyName": "s" + }, + "oneOf": [ + { + "$ref": "#/$defs/UnitSum" + }, + { + "$ref": "#/$defs/GeneralSum" + } + ], + "required": [ + "s" + ], + "title": "SumType" + }, + "SumValue": { + "additionalProperties": true, + "description": "A Sum variant For any Sum type where this value meets the type of the variant indicated by the tag.", + "properties": { + "v": { + "const": "Sum", + "default": "Sum", + "enum": [ + "Sum" + ], + "title": "ValueTag", + "type": "string" + }, + "tag": { + "title": "Tag", + "type": "integer" + }, + "typ": { + "$ref": "#/$defs/SumType" + }, + "vs": { + "items": { + "$ref": "#/$defs/Value" + }, + "title": "Vs", + "type": "array" + } + }, + "required": [ + "tag", + "typ", + "vs" + ], + "title": "SumValue", + "type": "object" + }, + "Tag": { + "additionalProperties": true, + "description": "An operation that creates a tagged sum value from one of its variants.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "Tag", + "default": "Tag", + "enum": [ + "Tag" + ], + "title": "Op", + "type": "string" + }, + "tag": { + "title": "Tag", + "type": "integer" + }, + "variants": { + "items": { + "items": { + "$ref": "#/$defs/Type" + }, + "type": "array" + }, + "title": "Variants", + "type": "array" + } + }, + "required": [ + "parent", + "tag", + "variants" + ], + "title": "Tag", + "type": "object" + }, + "TailLoop": { + "additionalProperties": true, + "description": "Tail-controlled loop.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "TailLoop", + "default": "TailLoop", + "enum": [ + "TailLoop" + ], + "title": "Op", + "type": "string" + }, + "just_inputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Just Inputs", + "type": "array" + }, + "just_outputs": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Just Outputs", + "type": "array" + }, + "rest": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Rest", + "type": "array" + }, + "extension_delta": { + "items": { + "type": "string" + }, + "title": "Extension Delta", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "TailLoop", + "type": "object" + }, + "TupleParam": { + "additionalProperties": true, + "properties": { + "tp": { + "const": "Tuple", + "default": "Tuple", + "enum": [ + "Tuple" + ], + "title": "Tp", + "type": "string" + }, + "params": { + "items": { + "$ref": "#/$defs/TypeParam" + }, + "title": "Params", + "type": "array" + } + }, + "required": [ + "params" + ], + "title": "TupleParam", + "type": "object" + }, + "TupleValue": { + "additionalProperties": true, + "description": "A constant tuple value.", + "properties": { + "v": { + "const": "Tuple", + "default": "Tuple", + "enum": [ + "Tuple" + ], + "title": "ValueTag", + "type": "string" + }, + "vs": { + "items": { + "$ref": "#/$defs/Value" + }, + "title": "Vs", + "type": "array" + } + }, + "required": [ + "vs" + ], + "title": "TupleValue", + "type": "object" + }, + "Type": { + "description": "A HUGR type.", + "discriminator": { + "mapping": { + "Alias": "#/$defs/Alias", + "Array": "#/$defs/Array", + "G": "#/$defs/FunctionType", + "I": "#/$defs/USize", + "Opaque": "#/$defs/Opaque", + "Q": "#/$defs/Qubit", + "R": "#/$defs/RowVar", + "Sum": "#/$defs/SumType", + "V": "#/$defs/Variable" + }, + "propertyName": "t" + }, + "oneOf": [ + { + "$ref": "#/$defs/Qubit" + }, + { + "$ref": "#/$defs/Variable" + }, + { + "$ref": "#/$defs/RowVar" + }, + { + "$ref": "#/$defs/USize" + }, + { + "$ref": "#/$defs/FunctionType" + }, + { + "$ref": "#/$defs/Array" + }, + { + "$ref": "#/$defs/SumType" + }, + { + "$ref": "#/$defs/Opaque" + }, + { + "$ref": "#/$defs/Alias" + } + ], + "required": [ + "t" + ], + "title": "Type" + }, + "TypeArg": { + "description": "A type argument.", + "discriminator": { + "mapping": { + "BoundedNat": "#/$defs/BoundedNatArg", + "Extensions": "#/$defs/ExtensionsArg", + "Opaque": "#/$defs/OpaqueArg", + "Sequence": "#/$defs/SequenceArg", + "Type": "#/$defs/TypeTypeArg", + "Variable": "#/$defs/VariableArg" + }, + "propertyName": "tya" + }, + "oneOf": [ + { + "$ref": "#/$defs/TypeTypeArg" + }, + { + "$ref": "#/$defs/BoundedNatArg" + }, + { + "$ref": "#/$defs/OpaqueArg" + }, + { + "$ref": "#/$defs/SequenceArg" + }, + { + "$ref": "#/$defs/ExtensionsArg" + }, + { + "$ref": "#/$defs/VariableArg" + } + ], + "required": [ + "tya" + ], + "title": "TypeArg" + }, + "TypeBound": { + "enum": [ + "E", + "C", + "A" + ], + "title": "TypeBound", + "type": "string" + }, + "TypeParam": { + "description": "A type parameter.", + "discriminator": { + "mapping": { + "BoundedNat": "#/$defs/BoundedNatParam", + "Extensions": "#/$defs/ExtensionsParam", + "List": "#/$defs/ListParam", + "Opaque": "#/$defs/OpaqueParam", + "Tuple": "#/$defs/TupleParam", + "Type": "#/$defs/TypeTypeParam" + }, + "propertyName": "tp" + }, + "oneOf": [ + { + "$ref": "#/$defs/TypeTypeParam" + }, + { + "$ref": "#/$defs/BoundedNatParam" + }, + { + "$ref": "#/$defs/OpaqueParam" + }, + { + "$ref": "#/$defs/ListParam" + }, + { + "$ref": "#/$defs/TupleParam" + }, + { + "$ref": "#/$defs/ExtensionsParam" + } + ], + "required": [ + "tp" + ], + "title": "TypeParam" + }, + "TypeTypeArg": { + "additionalProperties": true, + "properties": { + "tya": { + "const": "Type", + "default": "Type", + "enum": [ + "Type" + ], + "title": "Tya", + "type": "string" + }, + "ty": { + "$ref": "#/$defs/Type" + } + }, + "required": [ + "ty" + ], + "title": "TypeTypeArg", + "type": "object" + }, + "TypeTypeParam": { + "additionalProperties": true, + "properties": { + "tp": { + "const": "Type", + "default": "Type", + "enum": [ + "Type" + ], + "title": "Tp", + "type": "string" + }, + "b": { + "$ref": "#/$defs/TypeBound" + } + }, + "required": [ + "b" + ], + "title": "TypeTypeParam", + "type": "object" + }, + "USize": { + "additionalProperties": true, + "description": "Unsigned integer size type.", + "properties": { + "t": { + "const": "I", + "default": "I", + "enum": [ + "I" + ], + "title": "T", + "type": "string" + } + }, + "title": "USize", + "type": "object" + }, + "UnitSum": { + "additionalProperties": true, + "description": "Simple sum type where all variants are empty tuples.", + "properties": { + "t": { + "const": "Sum", + "default": "Sum", + "enum": [ + "Sum" + ], + "title": "T", + "type": "string" + }, + "s": { + "const": "Unit", + "default": "Unit", + "enum": [ + "Unit" + ], + "title": "S", + "type": "string" + }, + "size": { + "title": "Size", + "type": "integer" + } + }, + "required": [ + "size" + ], + "title": "UnitSum", + "type": "object" + }, + "UnpackTuple": { + "additionalProperties": true, + "description": "An operation that packs all its inputs into a tuple.", + "properties": { + "parent": { + "title": "Parent", + "type": "integer" + }, + "op": { + "const": "UnpackTuple", + "default": "UnpackTuple", + "enum": [ + "UnpackTuple" + ], + "title": "Op", + "type": "string" + }, + "tys": { + "items": { + "$ref": "#/$defs/Type" + }, + "title": "Tys", + "type": "array" + } + }, + "required": [ + "parent" + ], + "title": "UnpackTuple", + "type": "object" + }, + "Value": { + "description": "A constant Value.", + "discriminator": { + "mapping": { + "Extension": "#/$defs/ExtensionValue", + "Function": "#/$defs/FunctionValue", + "Sum": "#/$defs/SumValue", + "Tuple": "#/$defs/TupleValue" + }, + "propertyName": "v" + }, + "oneOf": [ + { + "$ref": "#/$defs/ExtensionValue" + }, + { + "$ref": "#/$defs/FunctionValue" + }, + { + "$ref": "#/$defs/TupleValue" + }, + { + "$ref": "#/$defs/SumValue" + } + ], + "required": [ + "v" + ], + "title": "Value" + }, + "Variable": { + "additionalProperties": true, + "description": "A type variable identified by an index into the array of TypeParams.", + "properties": { + "t": { + "const": "V", + "default": "V", + "enum": [ + "V" + ], + "title": "T", + "type": "string" + }, + "i": { + "title": "I", + "type": "integer" + }, + "b": { + "$ref": "#/$defs/TypeBound" + } + }, + "required": [ + "i", + "b" + ], + "title": "Variable", + "type": "object" + }, + "VariableArg": { + "additionalProperties": true, + "properties": { + "tya": { + "const": "Variable", + "default": "Variable", + "enum": [ + "Variable" + ], + "title": "Tya", + "type": "string" + }, + "idx": { + "title": "Idx", + "type": "integer" + }, + "cached_decl": { + "$ref": "#/$defs/TypeParam" + } + }, + "required": [ + "idx", + "cached_decl" + ], + "title": "VariableArg", + "type": "object" + } + }, + "additionalProperties": true, + "description": "A serializable representation of a Hugr Type, SumType, PolyFuncType,\nValue, OpType. Intended for testing only.", + "properties": { + "version": { + "description": "Serialisation Schema Version", + "title": "Version", + "type": "string" + }, + "typ": { + "anyOf": [ + { + "$ref": "#/$defs/Type" + }, + { + "type": "null" + } + ], + "default": null + }, + "sum_type": { + "anyOf": [ + { + "$ref": "#/$defs/SumType" + }, + { + "type": "null" + } + ], + "default": null + }, + "poly_func_type": { + "anyOf": [ + { + "$ref": "#/$defs/PolyFuncType" + }, + { + "type": "null" + } + ], + "default": null + }, + "value": { + "anyOf": [ + { + "$ref": "#/$defs/Value" + }, + { + "type": "null" + } + ], + "default": null + }, + "optype": { + "anyOf": [ + { + "$ref": "#/$defs/OpType" + }, + { + "type": "null" + } + ], + "default": null + }, + "op_def": { + "anyOf": [ + { + "$ref": "#/$defs/OpDef" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "TestingHugr", + "type": "object" +} \ No newline at end of file