Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Remove diffs as internal data structure #213

Merged
merged 4 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/demo.zxp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"initial_graph": "{\"wire_vertices\": {\"b0\": {\"annotation\": {\"boundary\": true, \"coord\": [1, 0], \"input\": 0}}, \"b1\": {\"annotation\": {\"boundary\": true, \"coord\": [1, -1], \"input\": 1}}, \"b2\": {\"annotation\": {\"boundary\": true, \"coord\": [1, -2], \"input\": 2}}, \"b3\": {\"annotation\": {\"boundary\": true, \"coord\": [1, -3], \"input\": 3}}, \"b4\": {\"annotation\": {\"boundary\": true, \"coord\": [6, 0], \"output\": 0}}, \"b5\": {\"annotation\": {\"boundary\": true, \"coord\": [6, -1], \"output\": 1}}, \"b6\": {\"annotation\": {\"boundary\": true, \"coord\": [6, -2], \"output\": 2}}, \"b7\": {\"annotation\": {\"boundary\": true, \"coord\": [6, -3], \"output\": 3}}}, \"node_vertices\": {\"v0\": {\"annotation\": {\"coord\": [2, 0]}, \"data\": {\"type\": \"Z\"}}, \"v1\": {\"annotation\": {\"coord\": [2, -1]}, \"data\": {\"type\": \"X\"}}, \"v2\": {\"annotation\": {\"coord\": [2, -2]}, \"data\": {\"type\": \"Z\"}}, \"v3\": {\"annotation\": {\"coord\": [2, -3]}, \"data\": {\"type\": \"Z\"}}, \"v4\": {\"annotation\": {\"coord\": [3, 0]}, \"data\": {\"type\": \"Z\"}}, \"v5\": {\"annotation\": {\"coord\": [3, -1]}, \"data\": {\"type\": \"Z\"}}, \"v6\": {\"annotation\": {\"coord\": [3, -2]}, \"data\": {\"type\": \"X\"}}, \"v7\": {\"annotation\": {\"coord\": [3, -3]}, \"data\": {\"type\": \"Z\"}}, \"v8\": {\"annotation\": {\"coord\": [4, 0]}, \"data\": {\"type\": \"Z\"}}, \"v9\": {\"annotation\": {\"coord\": [4, -1]}, \"data\": {\"type\": \"X\"}}, \"v10\": {\"annotation\": {\"coord\": [4, -2]}, \"data\": {\"type\": \"Z\"}}, \"v11\": {\"annotation\": {\"coord\": [4, -3]}, \"data\": {\"type\": \"Z\"}}, \"v12\": {\"annotation\": {\"coord\": [5, 0]}, \"data\": {\"type\": \"X\"}}, \"v13\": {\"annotation\": {\"coord\": [5, -1]}, \"data\": {\"type\": \"X\"}}, \"v14\": {\"annotation\": {\"coord\": [5, -2]}, \"data\": {\"type\": \"Z\"}}, \"v15\": {\"annotation\": {\"coord\": [5, -3]}, \"data\": {\"type\": \"X\"}}, \"v16\": {\"annotation\": {\"coord\": [3.5, -1.0]}, \"data\": {\"type\": \"hadamard\", \"is_edge\": \"true\"}}, \"v17\": {\"annotation\": {\"coord\": [4.5, -1.0]}, \"data\": {\"type\": \"hadamard\", \"is_edge\": \"true\"}}, \"v18\": {\"annotation\": {\"coord\": [4.5, -1.5]}, \"data\": {\"type\": \"hadamard\", \"is_edge\": \"true\"}}}, \"undir_edges\": {\"e0\": {\"src\": \"b0\", \"tgt\": \"v0\"}, \"e1\": {\"src\": \"b1\", \"tgt\": \"v1\"}, \"e2\": {\"src\": \"b2\", \"tgt\": \"v2\"}, \"e3\": {\"src\": \"b3\", \"tgt\": \"v3\"}, \"e4\": {\"src\": \"v0\", \"tgt\": \"v1\"}, \"e5\": {\"src\": \"v0\", \"tgt\": \"v4\"}, \"e6\": {\"src\": \"v1\", \"tgt\": \"v5\"}, \"e7\": {\"src\": \"v1\", \"tgt\": \"v6\"}, \"e8\": {\"src\": \"v2\", \"tgt\": \"v6\"}, \"e9\": {\"src\": \"v3\", \"tgt\": \"v7\"}, \"e10\": {\"src\": \"v4\", \"tgt\": \"v8\"}, \"e11\": {\"src\": \"v5\", \"tgt\": \"v16\"}, \"e12\": {\"src\": \"v9\", \"tgt\": \"v16\"}, \"e13\": {\"src\": \"v6\", \"tgt\": \"v10\"}, \"e14\": {\"src\": \"v7\", \"tgt\": \"v11\"}, \"e15\": {\"src\": \"v8\", \"tgt\": \"v12\"}, \"e16\": {\"src\": \"v8\", \"tgt\": \"v13\"}, \"e17\": {\"src\": \"v9\", \"tgt\": \"v17\"}, \"e18\": {\"src\": \"v13\", \"tgt\": \"v17\"}, \"e19\": {\"src\": \"v9\", \"tgt\": \"v18\"}, \"e20\": {\"src\": \"v14\", \"tgt\": \"v18\"}, \"e21\": {\"src\": \"v10\", \"tgt\": \"v13\"}, \"e22\": {\"src\": \"v10\", \"tgt\": \"v14\"}, \"e23\": {\"src\": \"v11\", \"tgt\": \"v14\"}, \"e24\": {\"src\": \"v11\", \"tgt\": \"v15\"}, \"e25\": {\"src\": \"v12\", \"tgt\": \"b4\"}, \"e26\": {\"src\": \"v13\", \"tgt\": \"b5\"}, \"e27\": {\"src\": \"v14\", \"tgt\": \"b6\"}, \"e28\": {\"src\": \"v15\", \"tgt\": \"b7\"}}, \"scalar\": \"{\\\"power2\\\": 0, \\\"phase\\\": \\\"0\\\"}\"}", "proof_steps": ["{\"display_name\": \"fuse spiders\", \"rule\": \"fuse spiders\", \"diff\": \"{\\\"removed_verts\\\": [8], \\\"new_verts\\\": [], \\\"removed_edges\\\": [], \\\"new_edges\\\": [[4, 12]], \\\"changed_vertex_types\\\": {}, \\\"changed_edge_types\\\": {\\\"4,12\\\": 1}, \\\"changed_phases\\\": {}, \\\"changed_pos\\\": {}, \\\"changed_vdata\\\": {}, \\\"variable_types\\\": {}}\"}"]}
{"initial_graph": "{\"wire_vertices\": {\"b0\": {\"annotation\": {\"boundary\": true, \"coord\": [1, 0], \"input\": 0}}, \"b1\": {\"annotation\": {\"boundary\": true, \"coord\": [1, -1], \"input\": 1}}, \"b2\": {\"annotation\": {\"boundary\": true, \"coord\": [1, -2], \"input\": 2}}, \"b3\": {\"annotation\": {\"boundary\": true, \"coord\": [1, -3], \"input\": 3}}, \"b4\": {\"annotation\": {\"boundary\": true, \"coord\": [6, 0], \"output\": 0}}, \"b5\": {\"annotation\": {\"boundary\": true, \"coord\": [6, -1], \"output\": 1}}, \"b6\": {\"annotation\": {\"boundary\": true, \"coord\": [6, -2], \"output\": 2}}, \"b7\": {\"annotation\": {\"boundary\": true, \"coord\": [6, -3], \"output\": 3}}}, \"node_vertices\": {\"v0\": {\"annotation\": {\"coord\": [2, 0]}, \"data\": {\"type\": \"Z\"}}, \"v1\": {\"annotation\": {\"coord\": [2, -1]}, \"data\": {\"type\": \"X\"}}, \"v2\": {\"annotation\": {\"coord\": [2, -2]}, \"data\": {\"type\": \"Z\"}}, \"v3\": {\"annotation\": {\"coord\": [2, -3]}, \"data\": {\"type\": \"Z\"}}, \"v4\": {\"annotation\": {\"coord\": [3, 0]}, \"data\": {\"type\": \"Z\"}}, \"v5\": {\"annotation\": {\"coord\": [3, -1]}, \"data\": {\"type\": \"Z\"}}, \"v6\": {\"annotation\": {\"coord\": [3, -2]}, \"data\": {\"type\": \"X\"}}, \"v7\": {\"annotation\": {\"coord\": [3, -3]}, \"data\": {\"type\": \"Z\"}}, \"v8\": {\"annotation\": {\"coord\": [4, 0]}, \"data\": {\"type\": \"Z\"}}, \"v9\": {\"annotation\": {\"coord\": [4, -1]}, \"data\": {\"type\": \"X\"}}, \"v10\": {\"annotation\": {\"coord\": [4, -2]}, \"data\": {\"type\": \"Z\"}}, \"v11\": {\"annotation\": {\"coord\": [4, -3]}, \"data\": {\"type\": \"Z\"}}, \"v12\": {\"annotation\": {\"coord\": [5, 0]}, \"data\": {\"type\": \"X\"}}, \"v13\": {\"annotation\": {\"coord\": [5, -1]}, \"data\": {\"type\": \"X\"}}, \"v14\": {\"annotation\": {\"coord\": [5, -2]}, \"data\": {\"type\": \"Z\"}}, \"v15\": {\"annotation\": {\"coord\": [5, -3]}, \"data\": {\"type\": \"X\"}}, \"v16\": {\"annotation\": {\"coord\": [3.5, -1.0]}, \"data\": {\"type\": \"hadamard\", \"is_edge\": \"true\"}}, \"v17\": {\"annotation\": {\"coord\": [4.5, -1.0]}, \"data\": {\"type\": \"hadamard\", \"is_edge\": \"true\"}}, \"v18\": {\"annotation\": {\"coord\": [4.5, -1.5]}, \"data\": {\"type\": \"hadamard\", \"is_edge\": \"true\"}}}, \"undir_edges\": {\"e0\": {\"src\": \"b0\", \"tgt\": \"v0\"}, \"e1\": {\"src\": \"b1\", \"tgt\": \"v1\"}, \"e2\": {\"src\": \"b2\", \"tgt\": \"v2\"}, \"e3\": {\"src\": \"b3\", \"tgt\": \"v3\"}, \"e4\": {\"src\": \"v0\", \"tgt\": \"v1\"}, \"e5\": {\"src\": \"v0\", \"tgt\": \"v4\"}, \"e6\": {\"src\": \"v1\", \"tgt\": \"v5\"}, \"e7\": {\"src\": \"v1\", \"tgt\": \"v6\"}, \"e8\": {\"src\": \"v2\", \"tgt\": \"v6\"}, \"e9\": {\"src\": \"v3\", \"tgt\": \"v7\"}, \"e10\": {\"src\": \"v4\", \"tgt\": \"v8\"}, \"e11\": {\"src\": \"v5\", \"tgt\": \"v16\"}, \"e12\": {\"src\": \"v9\", \"tgt\": \"v16\"}, \"e13\": {\"src\": \"v6\", \"tgt\": \"v10\"}, \"e14\": {\"src\": \"v7\", \"tgt\": \"v11\"}, \"e15\": {\"src\": \"v8\", \"tgt\": \"v12\"}, \"e16\": {\"src\": \"v8\", \"tgt\": \"v13\"}, \"e17\": {\"src\": \"v9\", \"tgt\": \"v17\"}, \"e18\": {\"src\": \"v13\", \"tgt\": \"v17\"}, \"e19\": {\"src\": \"v9\", \"tgt\": \"v18\"}, \"e20\": {\"src\": \"v14\", \"tgt\": \"v18\"}, \"e21\": {\"src\": \"v10\", \"tgt\": \"v13\"}, \"e22\": {\"src\": \"v10\", \"tgt\": \"v14\"}, \"e23\": {\"src\": \"v11\", \"tgt\": \"v14\"}, \"e24\": {\"src\": \"v11\", \"tgt\": \"v15\"}, \"e25\": {\"src\": \"v12\", \"tgt\": \"b4\"}, \"e26\": {\"src\": \"v13\", \"tgt\": \"b5\"}, \"e27\": {\"src\": \"v14\", \"tgt\": \"b6\"}, \"e28\": {\"src\": \"v15\", \"tgt\": \"b7\"}}, \"scalar\": \"{\\\"power2\\\": 0, \\\"phase\\\": \\\"0\\\"}\"}", "proof_steps": ["{\"display_name\": \"fuse spiders\", \"rule\": \"fuse spiders\", \"graph\": \"{\\\"wire_vertices\\\": {\\\"b0\\\": {\\\"annotation\\\": {\\\"boundary\\\": true, \\\"coord\\\": [1, 0], \\\"input\\\": 0}}, \\\"b1\\\": {\\\"annotation\\\": {\\\"boundary\\\": true, \\\"coord\\\": [1, -1], \\\"input\\\": 1}}, \\\"b2\\\": {\\\"annotation\\\": {\\\"boundary\\\": true, \\\"coord\\\": [1, -2], \\\"input\\\": 2}}, \\\"b3\\\": {\\\"annotation\\\": {\\\"boundary\\\": true, \\\"coord\\\": [1, -3], \\\"input\\\": 3}}, \\\"b4\\\": {\\\"annotation\\\": {\\\"boundary\\\": true, \\\"coord\\\": [6, 0], \\\"output\\\": 0}}, \\\"b5\\\": {\\\"annotation\\\": {\\\"boundary\\\": true, \\\"coord\\\": [6, -1], \\\"output\\\": 1}}, \\\"b6\\\": {\\\"annotation\\\": {\\\"boundary\\\": true, \\\"coord\\\": [6, -2], \\\"output\\\": 2}}, \\\"b7\\\": {\\\"annotation\\\": {\\\"boundary\\\": true, \\\"coord\\\": [6, -3], \\\"output\\\": 3}}}, \\\"node_vertices\\\": {\\\"v0\\\": {\\\"annotation\\\": {\\\"coord\\\": [2, 0]}, \\\"data\\\": {\\\"type\\\": \\\"Z\\\"}}, \\\"v1\\\": {\\\"annotation\\\": {\\\"coord\\\": [2, -1]}, \\\"data\\\": {\\\"type\\\": \\\"X\\\"}}, \\\"v2\\\": {\\\"annotation\\\": {\\\"coord\\\": [2, -2]}, \\\"data\\\": {\\\"type\\\": \\\"Z\\\"}}, \\\"v3\\\": {\\\"annotation\\\": {\\\"coord\\\": [2, -3]}, \\\"data\\\": {\\\"type\\\": \\\"Z\\\"}}, \\\"v4\\\": {\\\"annotation\\\": {\\\"coord\\\": [3, 0]}, \\\"data\\\": {\\\"type\\\": \\\"Z\\\"}}, \\\"v5\\\": {\\\"annotation\\\": {\\\"coord\\\": [3, -1]}, \\\"data\\\": {\\\"type\\\": \\\"Z\\\"}}, \\\"v6\\\": {\\\"annotation\\\": {\\\"coord\\\": [3, -2]}, \\\"data\\\": {\\\"type\\\": \\\"X\\\"}}, \\\"v7\\\": {\\\"annotation\\\": {\\\"coord\\\": [3, -3]}, \\\"data\\\": {\\\"type\\\": \\\"Z\\\"}}, \\\"v8\\\": {\\\"annotation\\\": {\\\"coord\\\": [4, 0]}, \\\"data\\\": {\\\"type\\\": \\\"Z\\\"}}, \\\"v9\\\": {\\\"annotation\\\": {\\\"coord\\\": [4, -1]}, \\\"data\\\": {\\\"type\\\": \\\"X\\\"}}, \\\"v10\\\": {\\\"annotation\\\": {\\\"coord\\\": [4, -2]}, \\\"data\\\": {\\\"type\\\": \\\"Z\\\"}}, \\\"v11\\\": {\\\"annotation\\\": {\\\"coord\\\": [5, 0]}, \\\"data\\\": {\\\"type\\\": \\\"X\\\"}}, \\\"v12\\\": {\\\"annotation\\\": {\\\"coord\\\": [5, -1]}, \\\"data\\\": {\\\"type\\\": \\\"X\\\"}}, \\\"v13\\\": {\\\"annotation\\\": {\\\"coord\\\": [5, -2]}, \\\"data\\\": {\\\"type\\\": \\\"Z\\\"}}, \\\"v14\\\": {\\\"annotation\\\": {\\\"coord\\\": [5, -3]}, \\\"data\\\": {\\\"type\\\": \\\"X\\\"}}, \\\"v15\\\": {\\\"annotation\\\": {\\\"coord\\\": [3.5, -1.0]}, \\\"data\\\": {\\\"type\\\": \\\"hadamard\\\", \\\"is_edge\\\": \\\"true\\\"}}, \\\"v16\\\": {\\\"annotation\\\": {\\\"coord\\\": [4.5, -1.0]}, \\\"data\\\": {\\\"type\\\": \\\"hadamard\\\", \\\"is_edge\\\": \\\"true\\\"}}, \\\"v17\\\": {\\\"annotation\\\": {\\\"coord\\\": [4.5, -1.5]}, \\\"data\\\": {\\\"type\\\": \\\"hadamard\\\", \\\"is_edge\\\": \\\"true\\\"}}}, \\\"undir_edges\\\": {\\\"e0\\\": {\\\"src\\\": \\\"b0\\\", \\\"tgt\\\": \\\"v0\\\"}, \\\"e1\\\": {\\\"src\\\": \\\"b1\\\", \\\"tgt\\\": \\\"v1\\\"}, \\\"e2\\\": {\\\"src\\\": \\\"b2\\\", \\\"tgt\\\": \\\"v2\\\"}, \\\"e3\\\": {\\\"src\\\": \\\"b3\\\", \\\"tgt\\\": \\\"v3\\\"}, \\\"e4\\\": {\\\"src\\\": \\\"v0\\\", \\\"tgt\\\": \\\"v1\\\"}, \\\"e5\\\": {\\\"src\\\": \\\"v0\\\", \\\"tgt\\\": \\\"v4\\\"}, \\\"e6\\\": {\\\"src\\\": \\\"v1\\\", \\\"tgt\\\": \\\"v5\\\"}, \\\"e7\\\": {\\\"src\\\": \\\"v1\\\", \\\"tgt\\\": \\\"v6\\\"}, \\\"e8\\\": {\\\"src\\\": \\\"v2\\\", \\\"tgt\\\": \\\"v6\\\"}, \\\"e9\\\": {\\\"src\\\": \\\"v3\\\", \\\"tgt\\\": \\\"v7\\\"}, \\\"e10\\\": {\\\"src\\\": \\\"v4\\\", \\\"tgt\\\": \\\"v8\\\"}, \\\"e11\\\": {\\\"src\\\": \\\"v5\\\", \\\"tgt\\\": \\\"v15\\\"}, \\\"e12\\\": {\\\"src\\\": \\\"v9\\\", \\\"tgt\\\": \\\"v15\\\"}, \\\"e13\\\": {\\\"src\\\": \\\"v6\\\", \\\"tgt\\\": \\\"v10\\\"}, \\\"e14\\\": {\\\"src\\\": \\\"v7\\\", \\\"tgt\\\": \\\"v13\\\"}, \\\"e15\\\": {\\\"src\\\": \\\"v8\\\", \\\"tgt\\\": \\\"v11\\\"}, \\\"e16\\\": {\\\"src\\\": \\\"v8\\\", \\\"tgt\\\": \\\"v12\\\"}, \\\"e17\\\": {\\\"src\\\": \\\"v9\\\", \\\"tgt\\\": \\\"v16\\\"}, \\\"e18\\\": {\\\"src\\\": \\\"v12\\\", \\\"tgt\\\": \\\"v16\\\"}, \\\"e19\\\": {\\\"src\\\": \\\"v9\\\", \\\"tgt\\\": \\\"v17\\\"}, \\\"e20\\\": {\\\"src\\\": \\\"v13\\\", \\\"tgt\\\": \\\"v17\\\"}, \\\"e21\\\": {\\\"src\\\": \\\"v10\\\", \\\"tgt\\\": \\\"v12\\\"}, \\\"e22\\\": {\\\"src\\\": \\\"v10\\\", \\\"tgt\\\": \\\"v13\\\"}, \\\"e23\\\": {\\\"src\\\": \\\"v11\\\", \\\"tgt\\\": \\\"b4\\\"}, \\\"e24\\\": {\\\"src\\\": \\\"v12\\\", \\\"tgt\\\": \\\"b5\\\"}, \\\"e25\\\": {\\\"src\\\": \\\"v13\\\", \\\"tgt\\\": \\\"b6\\\"}, \\\"e26\\\": {\\\"src\\\": \\\"v13\\\", \\\"tgt\\\": \\\"v14\\\"}, \\\"e27\\\": {\\\"src\\\": \\\"v14\\\", \\\"tgt\\\": \\\"b7\\\"}}, \\\"scalar\\\": \\\"{\\\\\\\"power2\\\\\\\": 0, \\\\\\\"phase\\\\\\\": \\\\\\\"0\\\\\\\"}\\\"}\"}", "{\"display_name\": \"bialgebra\", \"rule\": \"bialgebra\", \"graph\": \"{\\\"wire_vertices\\\": {\\\"b0\\\": {\\\"annotation\\\": {\\\"boundary\\\": true, \\\"coord\\\": [1, 0], \\\"input\\\": 0}}, \\\"b1\\\": {\\\"annotation\\\": {\\\"boundary\\\": true, \\\"coord\\\": [1, -1], \\\"input\\\": 1}}, \\\"b2\\\": {\\\"annotation\\\": {\\\"boundary\\\": true, \\\"coord\\\": [1, -2], \\\"input\\\": 2}}, \\\"b3\\\": {\\\"annotation\\\": {\\\"boundary\\\": true, \\\"coord\\\": [1, -3], \\\"input\\\": 3}}, \\\"b4\\\": {\\\"annotation\\\": {\\\"boundary\\\": true, \\\"coord\\\": [6, 0], \\\"output\\\": 0}}, \\\"b5\\\": {\\\"annotation\\\": {\\\"boundary\\\": true, \\\"coord\\\": [6, -1], \\\"output\\\": 1}}, \\\"b6\\\": {\\\"annotation\\\": {\\\"boundary\\\": true, \\\"coord\\\": [6, -2], \\\"output\\\": 2}}, \\\"b7\\\": {\\\"annotation\\\": {\\\"boundary\\\": true, \\\"coord\\\": [6, -3], \\\"output\\\": 3}}}, \\\"node_vertices\\\": {\\\"v0\\\": {\\\"annotation\\\": {\\\"coord\\\": [2, 0]}, \\\"data\\\": {\\\"type\\\": \\\"Z\\\"}}, \\\"v1\\\": {\\\"annotation\\\": {\\\"coord\\\": [2, -1]}, \\\"data\\\": {\\\"type\\\": \\\"X\\\"}}, \\\"v2\\\": {\\\"annotation\\\": {\\\"coord\\\": [2, -2]}, \\\"data\\\": {\\\"type\\\": \\\"Z\\\"}}, \\\"v3\\\": {\\\"annotation\\\": {\\\"coord\\\": [2, -3]}, \\\"data\\\": {\\\"type\\\": \\\"Z\\\"}}, \\\"v4\\\": {\\\"annotation\\\": {\\\"coord\\\": [3, 0]}, \\\"data\\\": {\\\"type\\\": \\\"Z\\\"}}, \\\"v5\\\": {\\\"annotation\\\": {\\\"coord\\\": [3, -1]}, \\\"data\\\": {\\\"type\\\": \\\"Z\\\"}}, \\\"v6\\\": {\\\"annotation\\\": {\\\"coord\\\": [3, -3]}, \\\"data\\\": {\\\"type\\\": \\\"Z\\\"}}, \\\"v7\\\": {\\\"annotation\\\": {\\\"coord\\\": [4, 0]}, \\\"data\\\": {\\\"type\\\": \\\"Z\\\"}}, \\\"v8\\\": {\\\"annotation\\\": {\\\"coord\\\": [4, -1]}, \\\"data\\\": {\\\"type\\\": \\\"X\\\"}}, \\\"v9\\\": {\\\"annotation\\\": {\\\"coord\\\": [5, 0]}, \\\"data\\\": {\\\"type\\\": \\\"X\\\"}}, \\\"v10\\\": {\\\"annotation\\\": {\\\"coord\\\": [5, -1]}, \\\"data\\\": {\\\"type\\\": \\\"X\\\"}}, \\\"v11\\\": {\\\"annotation\\\": {\\\"coord\\\": [5, -2]}, \\\"data\\\": {\\\"type\\\": \\\"Z\\\"}}, \\\"v12\\\": {\\\"annotation\\\": {\\\"coord\\\": [5, -3]}, \\\"data\\\": {\\\"type\\\": \\\"X\\\"}}, \\\"v13\\\": {\\\"annotation\\\": {\\\"coord\\\": [4.4, -1.6]}, \\\"data\\\": {\\\"type\\\": \\\"X\\\"}}, \\\"v14\\\": {\\\"annotation\\\": {\\\"coord\\\": [4.4, -2.0]}, \\\"data\\\": {\\\"type\\\": \\\"X\\\"}}, \\\"v15\\\": {\\\"annotation\\\": {\\\"coord\\\": [2.6, -1.6]}, \\\"data\\\": {\\\"type\\\": \\\"Z\\\"}}, \\\"v16\\\": {\\\"annotation\\\": {\\\"coord\\\": [2.6, -2.0]}, \\\"data\\\": {\\\"type\\\": \\\"Z\\\"}}, \\\"v17\\\": {\\\"annotation\\\": {\\\"coord\\\": [3.5, -1.0]}, \\\"data\\\": {\\\"type\\\": \\\"hadamard\\\", \\\"is_edge\\\": \\\"true\\\"}}, \\\"v18\\\": {\\\"annotation\\\": {\\\"coord\\\": [4.5, -1.0]}, \\\"data\\\": {\\\"type\\\": \\\"hadamard\\\", \\\"is_edge\\\": \\\"true\\\"}}, \\\"v19\\\": {\\\"annotation\\\": {\\\"coord\\\": [4.5, -1.5]}, \\\"data\\\": {\\\"type\\\": \\\"hadamard\\\", \\\"is_edge\\\": \\\"true\\\"}}}, \\\"undir_edges\\\": {\\\"e0\\\": {\\\"src\\\": \\\"b0\\\", \\\"tgt\\\": \\\"v0\\\"}, \\\"e1\\\": {\\\"src\\\": \\\"b1\\\", \\\"tgt\\\": \\\"v1\\\"}, \\\"e2\\\": {\\\"src\\\": \\\"b2\\\", \\\"tgt\\\": \\\"v2\\\"}, \\\"e3\\\": {\\\"src\\\": \\\"b3\\\", \\\"tgt\\\": \\\"v3\\\"}, \\\"e4\\\": {\\\"src\\\": \\\"v0\\\", \\\"tgt\\\": \\\"v1\\\"}, \\\"e5\\\": {\\\"src\\\": \\\"v0\\\", \\\"tgt\\\": \\\"v4\\\"}, \\\"e6\\\": {\\\"src\\\": \\\"v1\\\", \\\"tgt\\\": \\\"v5\\\"}, \\\"e7\\\": {\\\"src\\\": \\\"v1\\\", \\\"tgt\\\": \\\"v15\\\"}, \\\"e8\\\": {\\\"src\\\": \\\"v2\\\", \\\"tgt\\\": \\\"v16\\\"}, \\\"e9\\\": {\\\"src\\\": \\\"v3\\\", \\\"tgt\\\": \\\"v6\\\"}, \\\"e10\\\": {\\\"src\\\": \\\"v4\\\", \\\"tgt\\\": \\\"v7\\\"}, \\\"e11\\\": {\\\"src\\\": \\\"v5\\\", \\\"tgt\\\": \\\"v17\\\"}, \\\"e12\\\": {\\\"src\\\": \\\"v8\\\", \\\"tgt\\\": \\\"v17\\\"}, \\\"e13\\\": {\\\"src\\\": \\\"v6\\\", \\\"tgt\\\": \\\"v11\\\"}, \\\"e14\\\": {\\\"src\\\": \\\"v7\\\", \\\"tgt\\\": \\\"v9\\\"}, \\\"e15\\\": {\\\"src\\\": \\\"v7\\\", \\\"tgt\\\": \\\"v10\\\"}, \\\"e16\\\": {\\\"src\\\": \\\"v8\\\", \\\"tgt\\\": \\\"v18\\\"}, \\\"e17\\\": {\\\"src\\\": \\\"v10\\\", \\\"tgt\\\": \\\"v18\\\"}, \\\"e18\\\": {\\\"src\\\": \\\"v8\\\", \\\"tgt\\\": \\\"v19\\\"}, \\\"e19\\\": {\\\"src\\\": \\\"v11\\\", \\\"tgt\\\": \\\"v19\\\"}, \\\"e20\\\": {\\\"src\\\": \\\"v9\\\", \\\"tgt\\\": \\\"b4\\\"}, \\\"e21\\\": {\\\"src\\\": \\\"v10\\\", \\\"tgt\\\": \\\"b5\\\"}, \\\"e22\\\": {\\\"src\\\": \\\"v10\\\", \\\"tgt\\\": \\\"v13\\\"}, \\\"e23\\\": {\\\"src\\\": \\\"v11\\\", \\\"tgt\\\": \\\"b6\\\"}, \\\"e24\\\": {\\\"src\\\": \\\"v11\\\", \\\"tgt\\\": \\\"v12\\\"}, \\\"e25\\\": {\\\"src\\\": \\\"v11\\\", \\\"tgt\\\": \\\"v14\\\"}, \\\"e26\\\": {\\\"src\\\": \\\"v12\\\", \\\"tgt\\\": \\\"b7\\\"}, \\\"e27\\\": {\\\"src\\\": \\\"v13\\\", \\\"tgt\\\": \\\"v15\\\"}, \\\"e28\\\": {\\\"src\\\": \\\"v13\\\", \\\"tgt\\\": \\\"v16\\\"}, \\\"e29\\\": {\\\"src\\\": \\\"v14\\\", \\\"tgt\\\": \\\"v15\\\"}, \\\"e30\\\": {\\\"src\\\": \\\"v14\\\", \\\"tgt\\\": \\\"v16\\\"}}, \\\"scalar\\\": \\\"{\\\\\\\"power2\\\\\\\": 1, \\\\\\\"phase\\\\\\\": \\\\\\\"0\\\\\\\"}\\\"}\"}"]}
9 changes: 4 additions & 5 deletions zxlive/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,7 @@ def redo(self) -> None:
for _ in range(self.proof_model.rowCount() - self._old_selected - 1):
self._old_steps.append(self.proof_model.pop_rewrite())

diff = self.diff or GraphDiff(self.g, self.new_g)
self.proof_model.add_rewrite(Rewrite(self.name, self.name, diff), self.new_g)
self.proof_model.add_rewrite(Rewrite(self.name, self.name, self.new_g))

# Select the added step
idx = self.step_view.model().index(self.proof_model.rowCount() - 1, 0, QModelIndex())
Expand All @@ -403,7 +402,7 @@ def undo(self) -> None:

# Add back steps that were previously removed
for rewrite, graph in reversed(self._old_steps):
self.proof_model.add_rewrite(rewrite, graph)
self.proof_model.add_rewrite(rewrite)

# Select the previously selected step
assert self._old_selected is not None
Expand Down Expand Up @@ -456,10 +455,10 @@ def redo(self) -> None:
super().redo()
model = self.step_view.model()
assert isinstance(model, ProofModel)
model.graphs[self.step_view.currentIndex().row()] = self.g
model.set_graph(self.step_view.currentIndex().row(), self.g)

def undo(self) -> None:
super().undo()
model = self.step_view.model()
assert isinstance(model, ProofModel)
model.graphs[self.step_view.currentIndex().row()] = self.g
model.set_graph(self.step_view.currentIndex().row(), self.g)
Loading
Loading