QuantaSight 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. quantasight-0.1.0/PKG-INFO +1492 -0
  2. quantasight-0.1.0/QuantaSight.egg-info/PKG-INFO +1492 -0
  3. quantasight-0.1.0/QuantaSight.egg-info/SOURCES.txt +40 -0
  4. quantasight-0.1.0/QuantaSight.egg-info/dependency_links.txt +1 -0
  5. quantasight-0.1.0/QuantaSight.egg-info/not-zip-safe +1 -0
  6. quantasight-0.1.0/QuantaSight.egg-info/requires.txt +23 -0
  7. quantasight-0.1.0/QuantaSight.egg-info/top_level.txt +9 -0
  8. quantasight-0.1.0/Quantra/__init__.py +38 -0
  9. quantasight-0.1.0/README.md +1443 -0
  10. quantasight-0.1.0/adapter/__init__.py +66 -0
  11. quantasight-0.1.0/adapter/capabilities.py +1006 -0
  12. quantasight-0.1.0/adapter/detector.py +630 -0
  13. quantasight-0.1.0/adapter/introspection.py +662 -0
  14. quantasight-0.1.0/adapter/universal.py +690 -0
  15. quantasight-0.1.0/audit/__init__.py +57 -0
  16. quantasight-0.1.0/audit/leakage.py +564 -0
  17. quantasight-0.1.0/audit/provenance.py +529 -0
  18. quantasight-0.1.0/audit/record.py +181 -0
  19. quantasight-0.1.0/circuit/__init__.py +51 -0
  20. quantasight-0.1.0/circuit/graph.py +2195 -0
  21. quantasight-0.1.0/circuit/ir.py +1624 -0
  22. quantasight-0.1.0/circuit/parser.py +2879 -0
  23. quantasight-0.1.0/correction/__init__.py +70 -0
  24. quantasight-0.1.0/correction/metrics.py +531 -0
  25. quantasight-0.1.0/correction/projector.py +432 -0
  26. quantasight-0.1.0/correction/residual.py +420 -0
  27. quantasight-0.1.0/measurement/__init__.py +52 -0
  28. quantasight-0.1.0/measurement/executor.py +751 -0
  29. quantasight-0.1.0/measurement/runtime.py +489 -0
  30. quantasight-0.1.0/measurement/single_shot.py +414 -0
  31. quantasight-0.1.0/quantra.py +1521 -0
  32. quantasight-0.1.0/reference/__init__.py +38 -0
  33. quantasight-0.1.0/reference/engine.py +1264 -0
  34. quantasight-0.1.0/reference/trajectory.py +474 -0
  35. quantasight-0.1.0/result/__init__.py +36 -0
  36. quantasight-0.1.0/result/result.py +408 -0
  37. quantasight-0.1.0/result/visualization.py +360 -0
  38. quantasight-0.1.0/setup.cfg +4 -0
  39. quantasight-0.1.0/setup.py +140 -0
  40. quantasight-0.1.0/tests/test_measurement_semantics.py +588 -0
  41. quantasight-0.1.0/tests/test_quantra_contextual_trajectory.py +1523 -0
  42. quantasight-0.1.0/tests/test_quantra_injected_errors.py +886 -0
@@ -0,0 +1,1492 @@
1
+ Metadata-Version: 2.4
2
+ Name: QuantaSight
3
+ Version: 0.1.0
4
+ Summary: Framework-independent contextual quantum reference and deterministic residual-projection library.
5
+ Author: Onur Kavrık
6
+ Maintainer: Biotronics AI
7
+ License: MIT
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Topic :: Scientific/Engineering
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ Requires-Dist: numpy==2.5.3
22
+ Provides-Extra: pennylane
23
+ Requires-Dist: pennylane==0.45.1; extra == "pennylane"
24
+ Requires-Dist: pennylane-lightning==0.45.0; extra == "pennylane"
25
+ Provides-Extra: qiskit
26
+ Requires-Dist: qiskit==2.5.2; extra == "qiskit"
27
+ Requires-Dist: qiskit-aer==0.17.2; extra == "qiskit"
28
+ Provides-Extra: cirq
29
+ Requires-Dist: cirq==1.7.0; extra == "cirq"
30
+ Provides-Extra: plot
31
+ Requires-Dist: matplotlib==3.11.2; extra == "plot"
32
+ Provides-Extra: all
33
+ Requires-Dist: pennylane==0.45.1; extra == "all"
34
+ Requires-Dist: pennylane-lightning==0.45.0; extra == "all"
35
+ Requires-Dist: qiskit==2.5.2; extra == "all"
36
+ Requires-Dist: qiskit-aer==0.17.2; extra == "all"
37
+ Requires-Dist: cirq==1.7.0; extra == "all"
38
+ Requires-Dist: matplotlib==3.11.2; extra == "all"
39
+ Dynamic: author
40
+ Dynamic: classifier
41
+ Dynamic: description
42
+ Dynamic: description-content-type
43
+ Dynamic: license
44
+ Dynamic: maintainer
45
+ Dynamic: provides-extra
46
+ Dynamic: requires-dist
47
+ Dynamic: requires-python
48
+ Dynamic: summary
49
+
50
+ > **Current release:** `0.1.0` (Alpha)
51
+
52
+ # Quantra
53
+
54
+ > **Author:** Onur Kavrik
55
+ > **Maintainer:** Biotronics AI
56
+ > **License:** MIT
57
+
58
+ **Context-aware, framework-independent quantum error correction through
59
+ deterministic reference tracking and residual projection.**
60
+
61
+ Quantra is a context-aware quantum error-correction framework designed
62
+ around a fundamental distinction: **not every deviation observed during
63
+ quantum computation is an error**. Changes produced legitimately by the
64
+ input data, circuit structure, gate sequence, parameterization, and the
65
+ intended evolution of the quantum state belong to the computational
66
+ context and must be preserved rather than corrected away.
67
+
68
+ Instead of treating every measured deviation as noise, Quantra tracks
69
+ the expected evolution of the computation within its circuit and data
70
+ context. It parses supported **PennyLane**, **Qiskit**, and **Cirq**
71
+ circuits into a framework-independent intermediate representation and
72
+ constructs an independent deterministic reference trajectory through
73
+ the legitimate circuit evolution. This allows Quantra to distinguish
74
+ context-preserving computational evolution from residual deviations
75
+ observed outside that expected trajectory.
76
+
77
+ The objective is therefore not merely to suppress deviation, but to
78
+ **correct error without destroying computational context**. Quantra is
79
+ designed to preserve the information encoded by the input and the
80
+ legitimate transformations performed by the circuit while isolating
81
+ the residual component relative to the contextual expected reference.
82
+ Under its deterministic residual-projection contract, the measured
83
+ result is projected exactly back onto that contextual reference, up to
84
+ numerical precision. Consequently, deviations represented by that
85
+ residual are completely eliminated in the correction domain while the
86
+ legitimate data- and circuit-dependent evolution represented by the
87
+ reference is retained.
88
+
89
+ Formally, for a measured result \(M\) and contextual expected reference
90
+ \(\hat{E}\), Quantra defines
91
+
92
+ \[
93
+ R = M - \hat{E}
94
+ \]
95
+
96
+ and performs
97
+
98
+ \[
99
+ M_{\mathrm{corr}} = M - R.
100
+ \]
101
+
102
+ Therefore,
103
+
104
+ \[
105
+ M_{\mathrm{corr}} = \hat{E},
106
+ \]
107
+
108
+ up to numerical precision. This exact-reference recovery is an
109
+ algebraic property of Quantra's deterministic projection model rather
110
+ than a hardcoded correction percentage.
111
+
112
+ A particularly important property of this architecture is that the
113
+ correction operation itself does **not require a large statistical
114
+ ensemble of repeated shots**. Quantra can perform its contextual
115
+ residual-projection workflow even when the execution is configured with
116
+ `shots=1`, provided that the measurement semantics and contextual
117
+ reference required by the correction contract are available. This
118
+ makes single-shot operation a first-class execution mode rather than
119
+ requiring repeated measurements merely to define the correction step.
120
+
121
+ This distinction is potentially important for quantum-hardware
122
+ efficiency. Conventional statistical error-mitigation and
123
+ characterization workflows can require repeated circuit executions to
124
+ estimate expectation values, noise characteristics, or corrected
125
+ quantities. Quantra's deterministic correction stage is structurally
126
+ different: it operates on the individual normalized measurement result
127
+ relative to its independently established contextual reference.
128
+ Reducing dependence on repeated sampling at the correction stage can
129
+ therefore be valuable where QPU executions, queue time, or shot budgets
130
+ are expensive.
131
+
132
+ Single-shot correction should not, however, be confused with obtaining
133
+ an exact statistical estimate of an unknown quantum probability
134
+ distribution from one physical measurement. Quantra does not claim that
135
+ a single stochastic observation contains such information. Rather, its
136
+ single-shot capability follows from the fact that correction is
137
+ **reference-assisted and context-aware instead of being derived solely
138
+ from statistical reconstruction of repeated noisy measurements**.
139
+
140
+ Quantra therefore focuses on two complementary quantities:
141
+
142
+ - **Precise correction ratio**, which quantifies how much of the
143
+ measured deviation relative to the contextual reference has been
144
+ removed by correction; and
145
+ - **Context preservation**, which requires legitimate evolution caused
146
+ by the data and circuit itself to remain part of the expected
147
+ computation rather than being misclassified as error.
148
+
149
+ This combination — contextual discrimination, deterministic residual
150
+ projection, exact recovery of the supplied contextual reference, and
151
+ support for correction at single-shot execution — is the central design
152
+ principle behind Quantra.
153
+
154
+ ---
155
+
156
+ ## Contents
157
+
158
+ - [Overview](#overview)
159
+ - [What Quantra Does](#what-quantra-does)
160
+ - [Scientific Interpretation](#scientific-interpretation)
161
+ - [Supported Frameworks](#supported-frameworks)
162
+ - [Installation](#installation)
163
+ - [Quick Start](#quick-start)
164
+ - [Framework Examples](#framework-examples)
165
+ - [PennyLane](#pennylane)
166
+ - [Qiskit](#qiskit)
167
+ - [Cirq](#cirq)
168
+ - [QuantraResult](#quantraresult)
169
+ - [Correction Model](#correction-model)
170
+ - [Measurement Semantics](#measurement-semantics)
171
+ - [Reference Engine](#reference-engine)
172
+ - [Runtime and Device Selection](#runtime-and-device-selection)
173
+ - [Audit and Provenance](#audit-and-provenance)
174
+ - [Visualization](#visualization)
175
+ - [Cross-Framework Behavior](#cross-framework-behavior)
176
+ - [Validated Scenarios](#validated-scenarios)
177
+ - [Current Limitations](#current-limitations)
178
+ - [Error Handling](#error-handling)
179
+ - [Package Architecture](#package-architecture)
180
+ - [Developer Installation](#developer-installation)
181
+ - [Testing](#testing)
182
+ - [Design Principles](#design-principles)
183
+ - [Roadmap](#roadmap)
184
+ - [Citation](#citation)
185
+ - [License](#license)
186
+ - [Disclaimer](#disclaimer)
187
+
188
+ ---
189
+
190
+ ## Overview
191
+
192
+ Quantra is designed to provide a consistent analysis contract across
193
+ multiple quantum software frameworks.
194
+
195
+ A typical Quantra workflow is:
196
+
197
+ ```text
198
+ Framework-native circuit
199
+ |
200
+ v
201
+ Circuit adaptation
202
+ |
203
+ v
204
+ Framework-independent IR
205
+ |
206
+ +----------------------+
207
+ | |
208
+ v v
209
+ Deterministic reference Native execution
210
+ trajectory |
211
+ | v
212
+ | Measurement result
213
+ | |
214
+ +----------+-----------+
215
+ |
216
+ v
217
+ Semantic normalization
218
+ |
219
+ v
220
+ measured / expected
221
+ |
222
+ v
223
+ residual = measured - expected
224
+ |
225
+ v
226
+ corrected = measured - residual
227
+ |
228
+ v
229
+ metrics + provenance + audit
230
+ |
231
+ v
232
+ QuantraResult
233
+ ```
234
+
235
+ The current automatic correction domain is the **computational-basis
236
+ probability domain**.
237
+
238
+ Quantra is intentionally conservative about ambiguous measurement
239
+ semantics. When a framework result cannot be mapped safely into the
240
+ supported correction domain, Quantra fails closed rather than guessing.
241
+
242
+ ---
243
+
244
+ ## What Quantra Does
245
+
246
+ Quantra currently provides:
247
+
248
+ - A single high-level public facade: `Quantra.Quantra`
249
+ - PennyLane circuit support
250
+ - Qiskit circuit support
251
+ - Cirq circuit support
252
+ - Framework-independent circuit parsing
253
+ - Canonical circuit event chronology
254
+ - Deterministic pure-state reference propagation
255
+ - Computational-basis probability references
256
+ - Single-shot execution
257
+ - Multi-shot execution
258
+ - Framework-aware sample/count normalization
259
+ - Canonical qubit-order normalization
260
+ - Qiskit classical-bit mapping support
261
+ - PennyLane permuted measurement-wire support
262
+ - Cirq permuted measurement-order support
263
+ - Residual calculation
264
+ - Deterministic residual projection
265
+ - Correction metrics
266
+ - Provenance tracing
267
+ - Observable correction-dataflow leakage auditing
268
+ - Immutable result aggregation
269
+ - Optional result visualization
270
+ - CPU execution
271
+ - Explicit runtime/device selection infrastructure
272
+ - Explicit backend support where supported by the underlying execution
273
+ path
274
+
275
+ Quantra does **not** reinterpret arbitrary numeric framework outputs as
276
+ probabilities. Measurement semantics must be supported and unambiguous.
277
+
278
+ ---
279
+
280
+ ## Scientific Interpretation
281
+
282
+ Quantra's deterministic residual projection is defined by:
283
+
284
+ \[ R = M - `\hat{E}`{=tex} \]
285
+
286
+ and
287
+
288
+ \[ M\_{`\mathrm{corr}`{=tex}} = M - R \]
289
+
290
+ where:
291
+
292
+ - \(M\) is the normalized measured result,
293
+ - (`\hat{E}`{=tex}) is the independently propagated contextual
294
+ expected reference,
295
+ - \(R\) is the residual,
296
+ - (M\_{`\mathrm{corr}`{=tex}}) is the corrected result.
297
+
298
+ Substitution gives:
299
+
300
+ \[ M\_{`\mathrm{corr}`{=tex}} = M - (M - `\hat{E}`{=tex}) =
301
+ `\hat{E}`{=tex} \]
302
+
303
+ Therefore, when the same supplied reference is used in the residual
304
+ definition, exact deterministic projection recovers that reference
305
+ algebraically, up to numerical tolerance.
306
+
307
+ ### Important interpretation of 100% recovery
308
+
309
+ A reported recovery value of `100.0` in this deterministic projection
310
+ setting means:
311
+
312
+ > **100% recovery of the contextual expected reference under the
313
+ > deterministic residual-projection definition.**
314
+
315
+ It must **not** be interpreted as:
316
+
317
+ - universal physical quantum error correction,
318
+ - proof that an unknown hardware error was inferred from a single
319
+ shot,
320
+ - proof of fault-tolerant quantum computation,
321
+ - proof that arbitrary QPU noise has been physically removed,
322
+ - a guarantee that an estimated or imperfect reference is physically
323
+ exact.
324
+
325
+ The recovery metric is calculated from the pre- and post-correction mean
326
+ absolute errors. It is not hardcoded to 100%.
327
+
328
+ For nonzero pre-correction error:
329
+
330
+ \[ `\mathrm{Recovery}`{=tex} = 100 `\left`{=tex}( 1 -
331
+ `\frac{\mathrm{post\_MAE}}`{=tex} {`\mathrm{pre\_MAE}`{=tex}}
332
+ `\right`{=tex}) \]
333
+
334
+ If the pre-correction error is effectively zero, recovery percentage is
335
+ treated as undefined rather than manufacturing a percentage.
336
+
337
+ ---
338
+
339
+ ## Supported Frameworks
340
+
341
+ Quantra `0.1.0` targets the following validated framework versions:
342
+
343
+ Framework Validated version
344
+
345
+ ---
346
+
347
+ PennyLane 0.45.1
348
+ PennyLane Lightning 0.45.0
349
+ Qiskit 2.5.2
350
+ Qiskit Aer 0.17.2
351
+ Cirq 1.7.0
352
+ NumPy 2.5.3
353
+
354
+ The development and regression environment also includes Python 3.14.
355
+
356
+ The package metadata currently declares Python `>=3.11`.
357
+
358
+ ---
359
+
360
+ ## Installation
361
+
362
+ The PyPI distribution name is lowercase:
363
+
364
+ ```bash
365
+ pip install quantra
366
+ ```
367
+
368
+ The Python import package is capitalized:
369
+
370
+ ```python
371
+ import Quantra
372
+ ```
373
+
374
+ ### Core installation
375
+
376
+ Install the minimal Quantra core:
377
+
378
+ ```bash
379
+ pip install quantra
380
+ ```
381
+
382
+ ### PennyLane support
383
+
384
+ ```bash
385
+ pip install "quantra[pennylane]"
386
+ ```
387
+
388
+ ### Qiskit support
389
+
390
+ ```bash
391
+ pip install "quantra[qiskit]"
392
+ ```
393
+
394
+ ### Cirq support
395
+
396
+ ```bash
397
+ pip install "quantra[cirq]"
398
+ ```
399
+
400
+ ### Plotting support
401
+
402
+ ```bash
403
+ pip install "quantra[plot]"
404
+ ```
405
+
406
+ ### Install all supported integrations
407
+
408
+ ```bash
409
+ pip install "quantra[all]"
410
+ ```
411
+
412
+ The `all` extra installs the supported PennyLane, Qiskit, Cirq, Qiskit
413
+ Aer, PennyLane Lightning, and plotting dependencies configured for the
414
+ release.
415
+
416
+ ---
417
+
418
+ ## Quick Start
419
+
420
+ The public API is intentionally small.
421
+
422
+ ```python
423
+ import Quantra
424
+
425
+ quantra = Quantra.Quantra(
426
+ circuit,
427
+ device="cpu", #"cpu", "gpu" or "qpu"
428
+ shots=1,
429
+ )
430
+
431
+ result = quantra.run()
432
+ ```
433
+
434
+ You can then access:
435
+
436
+ ```python
437
+ print(result.measured)
438
+ print(result.expected)
439
+ print(result.residual)
440
+ print(result.corrected)
441
+
442
+ print(result.pre_mae)
443
+ print(result.post_mae)
444
+ print(result.recovery_percentage)
445
+
446
+ print(result.audit_clean)
447
+ print(result.reference_mode)
448
+ ```
449
+
450
+ You may also import the facade directly:
451
+
452
+ ```python
453
+ from Quantra import Quantra
454
+
455
+ quantra = Quantra(
456
+ circuit,
457
+ device="cpu",
458
+ shots=1,
459
+ )
460
+
461
+ result = quantra.run()
462
+ ```
463
+
464
+ ---
465
+
466
+ ## Framework Examples
467
+
468
+ The following examples use only the public Quantra API.
469
+
470
+ ### PennyLane
471
+
472
+ ```python
473
+ import pennylane as qml
474
+ import Quantra
475
+
476
+
477
+ dev = qml.device(
478
+ "default.qubit",
479
+ wires=3,
480
+ )
481
+
482
+
483
+ @qml.qnode(dev)
484
+ def circuit():
485
+ qml.Hadamard(0)
486
+ qml.RY(0.37, wires=1)
487
+ qml.CNOT(wires=[0, 1])
488
+ qml.RZ(-0.41, wires=2)
489
+ qml.CNOT(wires=[1, 2])
490
+
491
+ return qml.sample(
492
+ wires=[2, 0, 1]
493
+ )
494
+
495
+
496
+ result = Quantra.Quantra(
497
+ circuit,
498
+ device="cpu",
499
+ shots=1,
500
+ ).run()
501
+
502
+
503
+ print("Measured:")
504
+ print(result.measured)
505
+
506
+ print("Expected:")
507
+ print(result.expected)
508
+
509
+ print("Residual:")
510
+ print(result.residual)
511
+
512
+ print("Corrected:")
513
+ print(result.corrected)
514
+
515
+ print("Recovery:")
516
+ print(result.recovery_percentage)
517
+ ```
518
+
519
+ Quantra normalizes supported permuted PennyLane measurement-wire
520
+ ordering back into its canonical computational-basis domain.
521
+
522
+ ---
523
+
524
+ ### Qiskit
525
+
526
+ ```python
527
+ from qiskit import QuantumCircuit
528
+ import Quantra
529
+
530
+
531
+ circuit = QuantumCircuit(3, 3)
532
+
533
+ circuit.h(0)
534
+ circuit.ry(0.37, 1)
535
+ circuit.cx(0, 1)
536
+ circuit.rz(-0.41, 2)
537
+ circuit.cx(1, 2)
538
+
539
+ # Deliberately nontrivial q -> c mapping:
540
+ #
541
+ # q0 -> c2
542
+ # q1 -> c1
543
+ # q2 -> c0
544
+
545
+ circuit.measure(0, 2)
546
+ circuit.measure(1, 1)
547
+ circuit.measure(2, 0)
548
+
549
+
550
+ result = Quantra.Quantra(
551
+ circuit,
552
+ device="cpu",
553
+ shots=1,
554
+ ).run()
555
+
556
+
557
+ print(result.expected)
558
+ print(result.corrected)
559
+ ```
560
+
561
+ Quantra reconstructs the supported terminal qubit-to-classical-bit
562
+ mapping and converts Qiskit's displayed bit ordering into Quantra's
563
+ canonical qubit basis.
564
+
565
+ ---
566
+
567
+ ### Cirq
568
+
569
+ ```python
570
+ import cirq
571
+ import Quantra
572
+
573
+
574
+ q0, q1, q2 = cirq.LineQubit.range(3)
575
+
576
+ circuit = cirq.Circuit(
577
+ cirq.H(q0),
578
+ cirq.ry(0.37)(q1),
579
+ cirq.CNOT(q0, q1),
580
+ cirq.rz(-0.41)(q2),
581
+ cirq.CNOT(q1, q2),
582
+
583
+ # Deliberately permuted measurement order.
584
+ cirq.measure(
585
+ q2,
586
+ q0,
587
+ q1,
588
+ key="result",
589
+ ),
590
+ )
591
+
592
+
593
+ result = Quantra.Quantra(
594
+ circuit,
595
+ device="cpu",
596
+ shots=1,
597
+ ).run()
598
+
599
+
600
+ print(result.expected)
601
+ print(result.corrected)
602
+ ```
603
+
604
+ Quantra preserves the parsed Cirq measurement order and maps the
605
+ resulting samples into the canonical computational-basis domain.
606
+
607
+ ---
608
+
609
+ ## QuantraResult
610
+
611
+ `Quantra.run()` returns an immutable `QuantraResult` aggregate.
612
+
613
+ Important public properties include:
614
+
615
+ ```python
616
+ result.measured
617
+ result.expected
618
+ result.residual
619
+ result.corrected
620
+
621
+ result.pre_mae
622
+ result.post_mae
623
+ result.recovery_percentage
624
+ result.recovery_defined
625
+
626
+ result.correction_improved
627
+ result.correction_unchanged
628
+ result.correction_worsened
629
+
630
+ result.shape
631
+ result.size
632
+ result.is_scalar
633
+
634
+ result.audit_clean
635
+ result.reference_mode
636
+ result.framework
637
+ ```
638
+
639
+ ### `measured`
640
+
641
+ The framework execution result after supported semantic normalization
642
+ into the common computational-basis probability domain.
643
+
644
+ ### `expected`
645
+
646
+ The deterministic contextual reference probability vector generated
647
+ independently from the parsed circuit.
648
+
649
+ ### `residual`
650
+
651
+ Defined as:
652
+
653
+ ```python
654
+ residual = measured - expected
655
+ ```
656
+
657
+ ### `corrected`
658
+
659
+ Defined as:
660
+
661
+ ```python
662
+ corrected = measured - residual
663
+ ```
664
+
665
+ ### `pre_mae`
666
+
667
+ Mean absolute error between `measured` and `expected`.
668
+
669
+ ### `post_mae`
670
+
671
+ Mean absolute error between `corrected` and `expected`.
672
+
673
+ ### `recovery_percentage`
674
+
675
+ Calculated recovery percentage when the pre-correction error is nonzero.
676
+
677
+ ### `audit_clean`
678
+
679
+ Indicates whether the configured leakage auditor observed any forbidden
680
+ direct error-injection fields in the correction-stage provenance
681
+ metadata.
682
+
683
+ A clean audit is a dataflow/provenance statement. It is not proof that
684
+ no hidden information could exist outside the audited interface.
685
+
686
+ ### `reference_mode`
687
+
688
+ Identifies the reference provenance mode. The current high-level
689
+ automatic pipeline uses:
690
+
691
+ ```text
692
+ simulation
693
+ ```
694
+
695
+ ---
696
+
697
+ ## Correction Model
698
+
699
+ Quantra separates the correction pipeline into explicit stages.
700
+
701
+ ### 1. Measurement
702
+
703
+ Obtain the framework-native execution result.
704
+
705
+ ### 2. Reference
706
+
707
+ Propagate the supported circuit independently through the deterministic
708
+ reference engine.
709
+
710
+ ### 3. Semantic normalization
711
+
712
+ Convert supported measurement outputs into the same computational-basis
713
+ probability representation used by the reference.
714
+
715
+ ### 4. Residual
716
+
717
+ ```python
718
+ residual = measured - expected
719
+ ```
720
+
721
+ ### 5. Projection
722
+
723
+ ```python
724
+ corrected = measured - residual
725
+ ```
726
+
727
+ ### 6. Metrics
728
+
729
+ Calculate pre-correction error, post-correction error, and recovery
730
+ percentage.
731
+
732
+ This separation is intentional. The result object aggregates these
733
+ stages but does not silently recompute or replace their values.
734
+
735
+ ---
736
+
737
+ ## Measurement Semantics
738
+
739
+ Quantra currently supports automatic correction for supported forms of:
740
+
741
+ - computational-basis probabilities,
742
+ - samples,
743
+ - counts,
744
+ - framework measurement outputs that can be mapped unambiguously into
745
+ those domains.
746
+
747
+ Quantra validates measurement semantics before correction.
748
+
749
+ ### Full terminal measurement
750
+
751
+ The current automatic correction path requires a supported terminal
752
+ full-qubit measurement.
753
+
754
+ Partial measurements fail closed.
755
+
756
+ ### Mid-circuit measurement
757
+
758
+ Automatic correction currently rejects mid-circuit measurement
759
+ semantics.
760
+
761
+ ### Duplicate measured qubits
762
+
763
+ Duplicate-qubit measurement mappings fail closed.
764
+
765
+ ### Multiple ambiguous outputs
766
+
767
+ Multiple measurement outputs that cannot be represented safely as one
768
+ supported correction domain fail closed.
769
+
770
+ ### Framework-specific mapping
771
+
772
+ Quantra does not assume all frameworks use the same display convention.
773
+
774
+ It contains framework-aware normalization for:
775
+
776
+ - PennyLane measurement-wire order,
777
+ - Qiskit qubit/classical-bit mapping and displayed bit ordering,
778
+ - Cirq measurement qubit order and measurement keys.
779
+
780
+ ---
781
+
782
+ ## Reference Engine
783
+
784
+ The deterministic reference engine propagates a pure state through the
785
+ canonical Quantra circuit representation.
786
+
787
+ The reference trajectory is independent of measurement execution noise
788
+ and is used to construct the contextual expected result.
789
+
790
+ ### Current reference behavior
791
+
792
+ - Default initial state: (\|0`\ldots`{=tex}0`\rangle`{=tex})
793
+ - Pure-state deterministic propagation
794
+ - Little-endian canonical qubit convention
795
+ - Measurement events are observational checkpoints
796
+ - Measurement collapse is not performed in the current reference mode
797
+ - State snapshots are immutable
798
+ - Final computational-basis probabilities are available to the facade
799
+
800
+ An optional initial state can be supplied:
801
+
802
+ ```python
803
+ result = quantra.run(
804
+ initial_state=my_initial_state
805
+ )
806
+ ```
807
+
808
+ The supplied state must satisfy the reference engine's dimensional and
809
+ normalization requirements.
810
+
811
+ ### Supported gate families
812
+
813
+ The current reference engine includes support for the gate families
814
+ exercised by Quantra's present circuit contract, including:
815
+
816
+ - Identity
817
+ - Pauli X
818
+ - Pauli Y
819
+ - Pauli Z
820
+ - Hadamard
821
+ - S / S-dagger
822
+ - T / T-dagger
823
+ - SX / SX-dagger
824
+ - RX
825
+ - RY
826
+ - RZ
827
+ - Phase
828
+ - CNOT / CX
829
+ - CY
830
+ - CZ
831
+ - Controlled phase
832
+ - CRX
833
+ - CRY
834
+ - CRZ
835
+ - Toffoli / CCX
836
+ - SWAP
837
+ - Fredkin / CSWAP
838
+
839
+ Barrier/delay-style operations may be represented as no-ops where
840
+ supported by the parser/reference contract.
841
+
842
+ Unsupported operations fail explicitly rather than being approximated
843
+ silently.
844
+
845
+ ---
846
+
847
+ ## Runtime and Device Selection
848
+
849
+ Quantra separates circuit adaptation from execution runtime selection.
850
+
851
+ Typical CPU execution:
852
+
853
+ ```python
854
+ result = Quantra.Quantra(
855
+ circuit,
856
+ device="cpu",
857
+ shots=1000,
858
+ ).run()
859
+ ```
860
+
861
+ Automatic runtime selection:
862
+
863
+ ```python
864
+ result = Quantra.Quantra(
865
+ circuit,
866
+ device="auto",
867
+ shots=1000,
868
+ ).run()
869
+ ```
870
+
871
+ The runtime layer distinguishes:
872
+
873
+ - CPU
874
+ - GPU
875
+ - QPU
876
+
877
+ ### CPU
878
+
879
+ CPU execution is the safe local fallback.
880
+
881
+ ### GPU
882
+
883
+ GPU execution is selected only when the relevant runtime path is
884
+ available and usable. An explicit GPU request should fail rather than
885
+ silently pretending GPU execution occurred when no usable GPU path
886
+ exists.
887
+
888
+ ---
889
+
890
+ ### QPU
891
+
892
+ Quantra is designed to extend its deterministic contextual
893
+ reference-projection workflow to real QPU execution through an
894
+ appropriately configured backend and framework integration.
895
+
896
+ Under Quantra's deterministic residual-projection contract, when the
897
+ contextual expected reference is correctly established and the QPU
898
+ measurement semantics are correctly mapped into the same canonical
899
+ domain, the correction step projects the measured result exactly onto
900
+ that reference, up to numerical precision.
901
+
902
+ In other words, the correction itself is deterministic. The principal
903
+ challenge in a real-QPU workflow is not the residual-projection
904
+ operation, but establishing a correct end-to-end integration between
905
+ the physical backend, circuit semantics, measurement mapping, and the
906
+ reference used by Quantra.
907
+
908
+ A QPU deployment therefore requires particular care with:
909
+
910
+ - backend and provider configuration,
911
+ - authentication and provider credentials,
912
+ - physical/logical qubit mapping,
913
+ - transpilation and backend-specific circuit transformations,
914
+ - measurement and classical-bit ordering,
915
+ - shot/result decoding,
916
+ - and selection or construction of the appropriate reference strategy.
917
+
918
+ When these components are correctly aligned, Quantra applies the same
919
+ reference-projection contract used by its framework-independent
920
+ correction pipeline to QPU-derived measurements.
921
+
922
+ The important distinction is that exact recovery of the supplied
923
+ contextual reference is a property of Quantra's deterministic
924
+ projection model. It should not, by itself, be interpreted as proof
925
+ that every unknown physical error mechanism of an arbitrary quantum
926
+ processor has been identified or that the hardware has become
927
+ fault-tolerant.
928
+
929
+ Real-QPU integration can therefore be more demanding than simulation:
930
+ the mathematical correction contract remains deterministic, while the
931
+ quality and physical interpretation of the result depend on the
932
+ correctness of the backend integration and, critically, on the
933
+ reference supplied to the correction process.
934
+
935
+ ## Audit and Provenance
936
+
937
+ Quantra records provenance for the major stages of the high-level
938
+ pipeline:
939
+
940
+ - circuit parsing,
941
+ - reference generation,
942
+ - measurement execution,
943
+ - residual calculation,
944
+ - residual projection,
945
+ - metric calculation.
946
+
947
+ The provenance trace records dataflow facts such as stage, action,
948
+ source, and selected metadata.
949
+
950
+ ### Leakage audit
951
+
952
+ The leakage auditor checks correction-stage metadata for configured
953
+ direct error-injection fields such as injection maps, injected angles,
954
+ injection seeds, explicit ground-truth errors, and similar oracle-style
955
+ fields.
956
+
957
+ The contextual expected reference itself is **not** classified as direct
958
+ injection leakage. Quantra is explicitly reference-assisted.
959
+
960
+ Therefore:
961
+
962
+ ```python
963
+ result.audit_clean
964
+ ```
965
+
966
+ means that no configured forbidden direct injection field was observed
967
+ in the audited correction metadata.
968
+
969
+ It does not prove:
970
+
971
+ - absence of all possible hidden information,
972
+ - causal independence outside the recorded interface,
973
+ - blind inference of unknown physical noise.
974
+
975
+ ---
976
+
977
+ ## Visualization
978
+
979
+ Install plotting support:
980
+
981
+ ```bash
982
+ pip install "quantra[plot]"
983
+ ```
984
+
985
+ Quantra includes result visualization support for compatible real scalar
986
+ or one-dimensional results.
987
+
988
+ The visualization layer is intentionally separate from correction and
989
+ does not recalculate the correction metrics.
990
+
991
+ ---
992
+
993
+ ## Cross-Framework Behavior
994
+
995
+ Quantra's canonical representation is designed so that mathematically
996
+ equivalent supported circuits can produce the same deterministic
997
+ reference domain across frameworks.
998
+
999
+ A pre-release real-use cross-framework validation was performed using
1000
+ the public facade with the same logical three-qubit circuit implemented
1001
+ independently in:
1002
+
1003
+ - PennyLane,
1004
+ - Qiskit,
1005
+ - Cirq.
1006
+
1007
+ The circuit included:
1008
+
1009
+ - Hadamard,
1010
+ - RY rotation,
1011
+ - CNOT,
1012
+ - RZ rotation,
1013
+ - a second CNOT,
1014
+ - intentionally different framework measurement mappings.
1015
+
1016
+ The public API was used as:
1017
+
1018
+ ```python
1019
+ import Quantra
1020
+
1021
+ result = Quantra.Quantra(
1022
+ circuit,
1023
+ device="cpu",
1024
+ shots=1,
1025
+ ).run()
1026
+ ```
1027
+
1028
+ The validation confirmed deterministic reference parity and
1029
+ corrected-result parity across the three framework implementations.
1030
+
1031
+ With `shots=1`, the measured sample itself is stochastic and therefore
1032
+ is **not expected to be identical across independent framework
1033
+ executions**. Cross-framework deterministic parity should be assessed on
1034
+ deterministic quantities such as the independently generated reference,
1035
+ while sampled quantities must be interpreted according to shot
1036
+ statistics.
1037
+
1038
+ ---
1039
+
1040
+ ## Validated Scenarios
1041
+
1042
+ The development regression suite has exercised scenarios including:
1043
+
1044
+ - PennyLane parsing and execution
1045
+ - Qiskit parsing and execution
1046
+ - Cirq parsing and execution
1047
+ - single-shot execution
1048
+ - multi-shot execution
1049
+ - deterministic reference trajectories
1050
+ - injected-error integration scenarios
1051
+ - contextual trajectory scenarios
1052
+ - Qiskit reversed classical mappings
1053
+ - PennyLane permuted measurement-wire order
1054
+ - Cirq permuted measurement order
1055
+ - partial-measurement rejection
1056
+ - mid-circuit-measurement rejection
1057
+ - ambiguous/multiple-output rejection
1058
+ - residual identity checks
1059
+ - deterministic projection identity checks
1060
+ - recovery metric calculation
1061
+ - provenance generation
1062
+ - correction-dataflow leakage audit
1063
+ - full regression testing
1064
+ - public-facade cross-framework use
1065
+
1066
+ These validations establish software behavior for the tested contracts.
1067
+ They are not a substitute for hardware-specific physical validation.
1068
+
1069
+ ---
1070
+
1071
+ ## Current Limitations
1072
+
1073
+ Quantra `0.1.0` is an alpha release.
1074
+
1075
+ Important current limitations include:
1076
+
1077
+ ### Correction domain
1078
+
1079
+ The automatic high-level correction domain is currently
1080
+ computational-basis probabilities.
1081
+
1082
+ ### Reference model
1083
+
1084
+ The current automatic high-level reference is simulation-based
1085
+ deterministic pure-state propagation.
1086
+
1087
+ ### Measurement collapse
1088
+
1089
+ The reference trajectory does not currently implement measurement
1090
+ collapse.
1091
+
1092
+ ### Mid-circuit measurement
1093
+
1094
+ Mid-circuit measurement is currently rejected by the automatic
1095
+ correction path.
1096
+
1097
+ ### Partial measurement
1098
+
1099
+ Partial terminal measurement is currently rejected by the automatic
1100
+ correction path.
1101
+
1102
+ ### Arbitrary observables
1103
+
1104
+ Arbitrary expectation-value or observable outputs are not automatically
1105
+ treated as computational-basis probabilities.
1106
+
1107
+ ### Arbitrary channels
1108
+
1109
+ Unsupported channels/noise operations are not silently approximated by
1110
+ the reference engine.
1111
+
1112
+ ### Symbolic parameters
1113
+
1114
+ Unbound/symbolic parameters must satisfy the current parser/reference
1115
+ binding contract. Unsupported unresolved parameters fail explicitly.
1116
+
1117
+ ### Hardware claims
1118
+
1119
+ The current software validation must not be interpreted as proof of
1120
+ universal QPU-level error correction, fault tolerance, or arbitrary
1121
+ unknown-noise reconstruction.
1122
+
1123
+ ### Reference assistance
1124
+
1125
+ The deterministic correction method is reference-assisted. It is not
1126
+ presented as blind reconstruction of an unknown ideal state from a
1127
+ single noisy observation.
1128
+
1129
+ ---
1130
+
1131
+ ## Error Handling
1132
+
1133
+ Quantra intentionally fails closed when it cannot establish a safe
1134
+ semantic mapping.
1135
+
1136
+ High-level exceptions include:
1137
+
1138
+ ```python
1139
+ Quantra.QuantraError
1140
+ Quantra.UnsupportedMeasurementSemanticsError
1141
+ Quantra.MeasurementReferenceMismatchError
1142
+ ```
1143
+
1144
+ ### `UnsupportedMeasurementSemanticsError`
1145
+
1146
+ Raised when a framework-native result or circuit measurement contract
1147
+ cannot safely be interpreted in the currently supported correction
1148
+ domain.
1149
+
1150
+ Examples include unsupported mid-circuit measurements, partial
1151
+ measurements, or ambiguous output semantics.
1152
+
1153
+ ### `MeasurementReferenceMismatchError`
1154
+
1155
+ Raised when the measured representation and reference representation
1156
+ cannot be reconciled safely, for example because their dimensions or
1157
+ validated measurement widths differ.
1158
+
1159
+ ---
1160
+
1161
+ ## Package Architecture
1162
+
1163
+ The current source tree is organized into focused components:
1164
+
1165
+ ```text
1166
+ Quantra/
1167
+ ├── Quantra/
1168
+ │ └── __init__.py
1169
+
1170
+ ├── quantra.py
1171
+
1172
+ ├── adapter/
1173
+ │ ├── detector.py
1174
+ │ ├── introspection.py
1175
+ │ ├── capabilities.py
1176
+ │ └── universal.py
1177
+
1178
+ ├── circuit/
1179
+ │ ├── ir.py
1180
+ │ ├── parser.py
1181
+ │ └── graph.py
1182
+
1183
+ ├── reference/
1184
+ │ ├── engine.py
1185
+ │ └── trajectory.py
1186
+
1187
+ ├── measurement/
1188
+ │ ├── executor.py
1189
+ │ ├── runtime.py
1190
+ │ └── single_shot.py
1191
+
1192
+ ├── correction/
1193
+ │ ├── residual.py
1194
+ │ ├── projector.py
1195
+ │ └── metrics.py
1196
+
1197
+ ├── audit/
1198
+ │ ├── record.py
1199
+ │ ├── provenance.py
1200
+ │ └── leakage.py
1201
+
1202
+ ├── result/
1203
+ │ ├── result.py
1204
+ │ └── visualization.py
1205
+
1206
+ ├── tests/
1207
+ ├── setup.py
1208
+ ├── README.md
1209
+ └── LICENSE
1210
+ ```
1211
+
1212
+ The distribution name and import name intentionally differ:
1213
+
1214
+ ```text
1215
+ Distribution name: quantra
1216
+ Import package: Quantra
1217
+ ```
1218
+
1219
+ Thus:
1220
+
1221
+ ```bash
1222
+ pip install quantra
1223
+ ```
1224
+
1225
+ corresponds to:
1226
+
1227
+ ```python
1228
+ import Quantra
1229
+ ```
1230
+
1231
+ ---
1232
+
1233
+ ## Developer Installation
1234
+
1235
+ For local development, clone or obtain the source tree and create a
1236
+ virtual environment.
1237
+
1238
+ Example:
1239
+
1240
+ ```bash
1241
+ python -m venv .venv
1242
+ source .venv/bin/activate
1243
+ ```
1244
+
1245
+ Upgrade packaging tools:
1246
+
1247
+ ```bash
1248
+ python -m pip install --upgrade pip setuptools wheel
1249
+ ```
1250
+
1251
+ Install the project with all supported integrations:
1252
+
1253
+ ```bash
1254
+ pip install -e ".[all]"
1255
+ ```
1256
+
1257
+ Then verify the public import:
1258
+
1259
+ ```bash
1260
+ python -c "import Quantra; print(Quantra.__version__)"
1261
+ ```
1262
+
1263
+ Expected release version:
1264
+
1265
+ ```text
1266
+ 0.1.0
1267
+ ```
1268
+
1269
+ ---
1270
+
1271
+ ## Testing
1272
+
1273
+ The test suite is designed to be executed from the project root.
1274
+
1275
+ ```bash
1276
+ python -m pytest -v
1277
+ ```
1278
+
1279
+ For measurement-semantic regression specifically:
1280
+
1281
+ ```bash
1282
+ python -m pytest tests/test_measurement_semantics.py -v
1283
+ ```
1284
+
1285
+ The project also uses public-API consumer-style validation to ensure the
1286
+ high-level facade can be exercised without importing internal Quantra
1287
+ components.
1288
+
1289
+ ### Recommended pre-release validation
1290
+
1291
+ Before publishing a release:
1292
+
1293
+ 1. Run the complete regression suite.
1294
+ 2. Build the source distribution and wheel.
1295
+ 3. Create a fresh virtual environment outside the repository.
1296
+ 4. Install the generated wheel.
1297
+ 5. Verify `import Quantra`.
1298
+ 6. Install/use the desired framework extra.
1299
+ 7. Execute independent PennyLane, Qiskit, and Cirq consumer examples.
1300
+ 8. Confirm deterministic cross-framework reference parity for
1301
+ mathematically equivalent supported circuits.
1302
+
1303
+ Do not treat a repository-root `PYTHONPATH` test as a substitute for the
1304
+ final installed-wheel consumer test.
1305
+
1306
+ ---
1307
+
1308
+ ## Design Principles
1309
+
1310
+ Quantra follows several design principles.
1311
+
1312
+ ### Framework independence
1313
+
1314
+ Framework-native circuits are converted into a common internal
1315
+ representation before deterministic reference propagation.
1316
+
1317
+ ### Explicit semantics
1318
+
1319
+ Numeric output alone is not enough to establish measurement meaning.
1320
+
1321
+ ### Fail closed
1322
+
1323
+ Ambiguous measurement contracts are rejected rather than guessed.
1324
+
1325
+ ### Deterministic reference separation
1326
+
1327
+ Reference propagation is separated from framework execution.
1328
+
1329
+ ### Canonical basis mapping
1330
+
1331
+ Framework-specific bit/wire conventions are normalized into a common
1332
+ canonical basis.
1333
+
1334
+ ### Immutable analytical results
1335
+
1336
+ Reference snapshots, residual results, projection results, metrics,
1337
+ provenance, audits, and final results are designed around immutable
1338
+ result objects.
1339
+
1340
+ ### Calculated metrics
1341
+
1342
+ Recovery percentages are calculated from errors rather than hardcoded.
1343
+
1344
+ ### Provenance-aware correction
1345
+
1346
+ Correction stages record their declared data sources and actions.
1347
+
1348
+ ### Scientific restraint
1349
+
1350
+ Algebraic recovery of a supplied contextual reference is distinguished
1351
+ from physical claims about arbitrary hardware noise.
1352
+
1353
+ ---
1354
+
1355
+ ## Roadmap
1356
+
1357
+ Potential future development areas include:
1358
+
1359
+ - additional circuit operations,
1360
+ - richer symbolic-parameter support,
1361
+ - broader control-flow semantics,
1362
+ - additional measurement domains,
1363
+ - additional observable semantics,
1364
+ - additional reference modes,
1365
+ - clean-execution reference workflows,
1366
+ - user-supplied reference workflows,
1367
+ - estimated-reference workflows,
1368
+ - broader GPU execution validation,
1369
+ - provider-specific QPU integrations,
1370
+ - hardware experiments,
1371
+ - hardware-specific benchmarks,
1372
+ - imperfect-reference benchmarks,
1373
+ - noise-model benchmarks,
1374
+ - larger cross-framework parity suites,
1375
+ - expanded visualization,
1376
+ - API stabilization,
1377
+ - packaging and documentation improvements.
1378
+
1379
+ Roadmap items are development directions, not guarantees of current
1380
+ functionality.
1381
+
1382
+ ---
1383
+
1384
+ ## Citation
1385
+
1386
+ A formal Quantra research-paper citation is not included in version
1387
+ `0.1.0` unless and until the associated publication metadata is
1388
+ available.
1389
+
1390
+ For software attribution in the meantime, use the project name, version,
1391
+ author, and release location, for example:
1392
+
1393
+ ```text
1394
+ Quantra, version 0.1.0.
1395
+ Author: Onur Kavrik.
1396
+ Maintainer: Biotronics AI.
1397
+ ```
1398
+
1399
+ Once a paper, DOI, or archival software identifier is available, this
1400
+ section can be updated with the canonical citation.
1401
+
1402
+ ---
1403
+
1404
+ ## License
1405
+
1406
+ Quantra is distributed under the **MIT License**.
1407
+
1408
+ See the repository's `LICENSE` file for the complete license text.
1409
+
1410
+ ---
1411
+
1412
+ ## Disclaimer
1413
+
1414
+ Quantra is research and developer software.
1415
+
1416
+ The deterministic residual-projection mechanism is reference-assisted.
1417
+ Exact recovery of the supplied contextual expected reference under the
1418
+ deterministic residual definition is an algebraic property of that
1419
+ definition and must not be interpreted as a universal physical quantum
1420
+ error-correction guarantee.
1421
+
1422
+ Results obtained in simulation do not by themselves establish equivalent
1423
+ performance on real quantum hardware.
1424
+
1425
+ Users are responsible for validating Quantra, the underlying quantum
1426
+ framework, backend configuration, reference strategy, circuit semantics,
1427
+ numerical assumptions, and hardware behavior for their own application.
1428
+
1429
+ ---
1430
+
1431
+ ## Minimal Example
1432
+
1433
+ ```python
1434
+ import Quantra
1435
+ import pennylane as qml
1436
+
1437
+
1438
+ dev = qml.device(
1439
+ "default.qubit",
1440
+ wires=2,
1441
+ )
1442
+
1443
+
1444
+ @qml.qnode(dev)
1445
+ def circuit():
1446
+ qml.Hadamard(0)
1447
+ qml.CNOT(wires=[0, 1])
1448
+
1449
+ return qml.sample(
1450
+ wires=[0, 1]
1451
+ )
1452
+
1453
+
1454
+ quantra = Quantra.Quantra(
1455
+ circuit,
1456
+ device="cpu",
1457
+ shots=1,
1458
+ )
1459
+
1460
+
1461
+ result = quantra.run()
1462
+
1463
+
1464
+ print("Measured:")
1465
+ print(result.measured)
1466
+
1467
+ print("Expected:")
1468
+ print(result.expected)
1469
+
1470
+ print("Residual:")
1471
+ print(result.residual)
1472
+
1473
+ print("Corrected:")
1474
+ print(result.corrected)
1475
+
1476
+ print("Pre-MAE:", result.pre_mae)
1477
+ print("Post-MAE:", result.post_mae)
1478
+ print(
1479
+ "Recovery:",
1480
+ result.recovery_percentage,
1481
+ )
1482
+
1483
+ print(
1484
+ "Audit clean:",
1485
+ result.audit_clean,
1486
+ )
1487
+ ```
1488
+
1489
+ ---
1490
+
1491
+ **Quantra 0.1.0 --- contextual reference, framework-independent
1492
+ execution semantics, and deterministic residual projection.**