Auxiliary quantum bit reverse calculation method and device, equipment and storage medium

CN122596281APending Publication Date: 2026-08-18BEIJING ACAD OF ARTIFICIAL INTELLLIGENCE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610582857.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-29
Publication Date
2026-08-18

AI Technical Summary

Technical Problem

[0004]本发明提供一种辅助量子比特的逆计算方法、装置、设备及存储介质,用以解决现有技术中无法适用于脏辅助比特的管理需求的缺陷,实现了对干净辅助比特和脏辅助比特的自动逆计算

Benefits of technology

[0016]The present invention provides an inverse computation method, apparatus, device, and storage medium for auxiliary qubits. By declaring the type of auxiliary qubit using borrowed statements and verifying whether the sub-circuit meets the constraints of the corresponding template based on the inference system, the invention achieves automatic inverse computation of dirty auxiliary bits. It places clean auxiliary bits and dirty auxiliary bits under the same processing framework, thereby reducing the complexity of using dirty auxiliary bits to a level comparable to that of clean auxiliary bits.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122596281A_ABST
    Figure CN122596281A_ABST
Patent Text Reader

Abstract

The application provides an ancillary qubit inverse calculation method, device and equipment and a storage medium. The method comprises the following steps: obtaining a quantum circuit program, wherein the quantum circuit program comprises a borrowed statement; determining whether a sub-circuit corresponding to the borrowed statement satisfies a restriction condition of an ancillary qubit template corresponding to a category of the borrowed statement based on a predefined inference system; if the restriction condition is satisfied, synthesizing an inverse calculation circuit according to an inverse calculation structure predefined by the ancillary qubit template corresponding to the category of the borrowed statement, and completing the recovery of the ancillary qubit by using the inverse calculation circuit. The automatic inverse calculation of clean ancillary bits and dirty ancillary bits is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of quantum computing technology, and in particular to a method, apparatus, device, and storage medium for inverse computation of auxiliary qubits. Background Technology

[0002] Quantum computing is a novel computing paradigm based on the principles of quantum mechanics, with its basic information unit being the qubit (qubit). Quantum algorithms are typically represented as quantum circuits, consisting of a series of quantum logic gates acting sequentially on the qubits. When implementing complex quantum circuits, additional auxiliary qubits are usually introduced to store intermediate computation results or provide operational space. These auxiliary qubits need to be restored after computation to prevent residual entanglement from affecting the final measurement results or subsequent computation processes; this restoration operation is called inverse computation. Auxiliary qubits include clean auxiliary qubits with known initial states and dirty auxiliary qubits with unknown initial states. Existing inverse computation methods (such as Silq, Unqomp, and Reqomp) are all designed around clean auxiliary qubits, and their core algorithms are not suitable for managing dirty auxiliary qubits.

[0003] Therefore, how to achieve automatic inverse calculation of clean auxiliary bits and dirty auxiliary bits is a technical problem that urgently needs to be solved in this field. Summary of the Invention

[0004] This invention provides a method, apparatus, device, and storage medium for inverse computation of auxiliary qubits, which addresses the shortcomings of existing technologies that cannot be applied to the management needs of dirty auxiliary qubits, and realizes automatic inverse computation of clean and dirty auxiliary qubits.

[0005] This invention provides an inverse computation method for auxiliary qubits, comprising the following steps: A quantum circuit program is obtained, the quantum circuit program including borrow statements, the borrow statements being used to declare the borrowing of auxiliary qubits, the types of the borrow statements including clean borrow statements and dirty borrow statements; Based on a predefined reasoning system, it is determined whether the sub-circuit corresponding to the borrowed statement satisfies the constraint conditions of the auxiliary qubit template corresponding to the category of the borrowed statement. The reasoning system includes formal reasoning rules for determining the semantic attributes of the circuit, which are used to derive the properties of the sub-circuit. If the aforementioned constraints are met, an inverse computing circuit is synthesized according to the category of the borrowed statement and the inverse computing structure predefined by the auxiliary qubit template corresponding to the category of the borrowed statement, and the restoration of the auxiliary qubit is completed using the inverse computing circuit.

[0006] In some embodiments, the reasoning system includes a reasoning context and a set of reasoning rules; The reasoning context is used to record the proven circuit semantic attributes; The inference rule set includes one or more of the following inference rules: bracket inference rules, quantum-independent operation inference rules, quantum Boolean function inference rules, controlled quantum Boolean function inference rules, obelisk bracket inference rules, and commutativity inference rules.

[0007] In some embodiments, the borrowing statement includes a clean borrowing statement, and the auxiliary qubit template corresponding to the clean borrowing statement includes a first storage stage circuit and a first usage stage circuit; The first storage stage circuit has a bracketed form with respect to the working register and the auxiliary register, and is quantum independent of the auxiliary register; The first usage stage circuit has square brackets for the working register, auxiliary register, and destination register; The inverse computing circuit is the inverse circuit of the first storage stage circuit.

[0008] In some embodiments, the borrowing statement includes a dirty borrowing statement, and the auxiliary qubit template corresponding to the dirty borrowing statement includes a second storage stage circuit and a second use stage circuit; The second storage stage circuit has a bracketed form with respect to the working register and the auxiliary register, and is quantum independent of the auxiliary register; The second stage circuit has obelisk brackets for the working register, auxiliary register, and destination register; The inverse computing circuit is composed of the second usage stage circuit, the second storage stage circuit, and the inverse circuit of the second usage stage circuit and the second storage stage circuit in sequence.

[0009] In some embodiments, it also includes: By applying the circuit equivalence transformation rule, the gates targeting the auxiliary qubits are gradually moved to the right and clustered at the end of the circuit to form a normalized circuit. The circuit equivalence transformation rule is used to exchange the order of the gates targeting the auxiliary qubits and the gates operating on the working bits in a local range, and the circuit remains unitarily equivalent before and after the exchange. Once the quantum circuit program has completed the inverse calculation of the clean auxiliary bits and formed a normalized form, all gates involving auxiliary bits in the normalized form of the circuit are deleted to obtain the dirty auxiliary bit circuit corresponding to the quantum circuit program.

[0010] In some embodiments, the predefined inference system employs a recursive verification method: When deriving the properties of a sub-circuit of the current borrowed statement, if the sub-circuit contains nested borrowed statements, the correctness of the nested borrowed statements is verified first, and then the correctness of the current borrowed statement is verified.

[0011] In some embodiments, the step of synthesizing an inverse computing circuit according to a predefined inverse computing structure of an auxiliary qubit template corresponding to the category of the borrowed statement, and using the inverse computing circuit to complete the restoration of the auxiliary qubit, includes: Starting from the innermost borrow statement, the borrow statements are replaced with the corresponding atomic circuit fragments and their matching inverse computation fragments according to the borrow type; Processing the nested structure layer by layer from the inside out until the outermost layer uses a borrowed statement to complete the replacement, thus obtaining the target circuit that completes the restoration of the auxiliary qubits.

[0012] The present invention also provides an inverse computing device for auxiliary qubits, comprising the following modules: The statement acquisition module is used to acquire quantum circuit programs, which include borrow statements. The borrow statements are used to declare the borrowing of auxiliary qubits. The categories of borrow statements include clean borrow statements and dirty borrow statements. The circuit verification module is used to determine, based on a predefined reasoning system, whether the sub-circuit corresponding to the borrowed statement satisfies the constraint conditions of the auxiliary qubit template corresponding to the category of the borrowed statement. The reasoning system includes formal reasoning rules for determining the semantic attributes of the circuit, which are used to deduce the properties of the sub-circuit. The bit restoration module is used to, if the above-mentioned constraints are met, synthesize an inverse computing circuit according to the inverse computing structure predefined by the auxiliary qubit template corresponding to the category of the borrowed statement, based on the category of the borrowed statement, and use the inverse computing circuit to restore the auxiliary qubit.

[0013] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the inverse computation method for auxiliary qubits as described above.

[0014] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the inverse computation method for auxiliary qubits as described above.

[0015] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the inverse computation method for auxiliary qubits as described above.

[0016] The present invention provides an inverse computation method, apparatus, device, and storage medium for auxiliary qubits. By declaring the type of auxiliary qubit using borrowed statements and verifying whether the sub-circuit meets the constraints of the corresponding template based on the inference system, the invention achieves automatic inverse computation of dirty auxiliary bits. It places clean auxiliary bits and dirty auxiliary bits under the same processing framework, thereby reducing the complexity of using dirty auxiliary bits to a level comparable to that of clean auxiliary bits. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0018] Figure 1 This is a flowchart illustrating the inverse computation method for auxiliary qubits provided by the present invention.

[0019] Figure 2 This is a schematic diagram of the template circuit for storing and using clean auxiliary bits provided by the present invention.

[0020] Figure 3 This is a schematic diagram of the template circuit for storing and using dirty auxiliary bits provided by the present invention.

[0021] Figure 4 This is a schematic diagram of the structure of the inverse computing device for auxiliary qubits provided by the present invention.

[0022] Figure 5 This is a schematic diagram of the physical structure of the electronic device provided by the present invention. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0024] Quantum computing is a novel computing paradigm based on the principles of quantum mechanics, with its basic information unit being the qubit (qubit). Quantum algorithms are typically represented as quantum circuits, consisting of a series of quantum logic gates acting sequentially on the qubits. When implementing complex quantum circuits, additional auxiliary qubits are usually introduced to store intermediate computation results or provide operational space. These auxiliary qubits need to be restored after computation to prevent residual entanglement from affecting the final measurement results or subsequent computation processes; this restoration operation is called inverse computation. Auxiliary qubits include clean auxiliary qubits with known initial states and dirty auxiliary qubits with unknown initial states. Existing inverse computation methods (such as Silq, Unqomp, and Reqomp) are all designed around clean auxiliary qubits, and their core algorithms are not suitable for managing dirty auxiliary qubits.

[0025] Therefore, how to achieve automatic inverse calculation of clean auxiliary bits and dirty auxiliary bits is a technical problem that urgently needs to be solved in this field.

[0026] In view of this, the present invention provides an inverse computation method, apparatus, device and storage medium for auxiliary qubits. It is an automatic inverse computation method for auxiliary qubits (including clean auxiliary qubits and dirty auxiliary qubits) in quantum circuits. This method can be widely used in scenarios such as quantum algorithm design, quantum programming language compilers, and quantum circuit synthesis and optimization tools to realize the automated management and recycling of auxiliary qubits, improve the correctness of quantum computing results and the utilization efficiency of quantum resources.

[0027] Figure 1 This is a flowchart illustrating the inverse computation method for auxiliary qubits provided by this invention. Figure 1 As shown, the method includes the following: Step 101: Obtain the quantum circuit program, which includes borrowing statements used to declare the borrowing of auxiliary qubits.

[0028] The borrow statement is a syntactic structure in quantum circuit programs used to explicitly declare the borrowing of an auxiliary qubit and indicate the type of the auxiliary bit (clean or dirty) and subsequent storage and usage circuitry.

[0029] It should be noted that the quantum circuit program obtained in this step can be written using the quantum circuit language with borrowing statements defined in this invention. This language uses borrowing statements to pattern the use of auxiliary bits, providing a structured basis for subsequent automatic reasoning and inverse computation synthesis.

[0030] Step 102: Based on a predefined reasoning system, determine whether the sub-circuit corresponding to the borrowed statement satisfies the constraint conditions of the auxiliary qubit template corresponding to the category of the borrowed statement. The reasoning system includes formal reasoning rules for determining the semantic attributes of the circuit, used to derive the properties of the sub-circuit.

[0031] The reasoning system is a set of formal rules and reasoning contexts used to automatically deduce various semantic properties of quantum circuits at compile time, including bracket form, quantum independence, quantum Boolean function, controlled quantum Boolean function, obelisk bracket form, and commutativity.

[0032] It should be noted that in this step, the inference system calls the corresponding template constraints to verify the sub-circuit based on the type of borrowed statement (clean borrow or dirty borrow). For example, the verification process adopts a recursive approach: if the sub-circuit contains nested borrowed statements, the correctness of the inner borrowed statement is verified first, and then the correctness of the current borrowed statement is verified.

[0033] Step 103: If the above restrictions are met, according to the category of the borrowed statement, synthesize the inverse computing circuit according to the inverse computing structure predefined by the auxiliary qubit template corresponding to the category of the borrowed statement, and use the inverse computing circuit to complete the restoration of the auxiliary qubit.

[0034] Among them, the auxiliary qubit template is a standardized usage paradigm predefined for clean auxiliary bits and dirty auxiliary bits respectively. Each template not only specifies the structured pattern of the storage stage circuit and the usage stage circuit, but also predefines the inverse computation circuit structure corresponding to the template.

[0035] It should be noted that this step is only performed after verification. For example, for a clean borrow statement, its inverse computation circuit is the inverse circuit of the storage stage circuit; for a dirty borrow statement, its inverse computation circuit is composed of the inverse circuits of the use stage circuit, the storage stage circuit, the use stage circuit, and the storage stage circuit in sequence. The synthesis process starts from the innermost borrow statement and processes it layer by layer from the inside out according to the nested structure.

[0036] This invention achieves unified automatic inverse computation for clean and dirty auxiliary bits by using a template-based design and a static inference system to automatically infer the correctness of template usage during compilation and by ensuring the safety and reliability of inverse computation operations through formal constraint checks.

[0037] In some embodiments, the reasoning system includes a reasoning context and a set of reasoning rules; The reasoning context is used to record the proven circuit semantic attributes; The inference rule set includes one or more of the following inference rules: bracket inference rules, quantum-independent operation inference rules, quantum Boolean function inference rules, controlled quantum Boolean function inference rules, obelisk bracket inference rules, and commutativity inference rules.

[0038] The reasoning context is a set of circuit judgments accumulated gradually during the reasoning process, used to record the proven semantic properties of the circuit, such as whether a circuit has a bracketed form or is quantum independent. The reasoning rule set is a set of formalized derivation rules used to automatically derive new judgments from known circuit judgments.

[0039] It should be noted that the reasoning system of this invention represents various semantic attributes of a circuit as judgments in context, and applies reasoning rules to combine and derive these judgments, thereby automatically verifying whether a complex circuit satisfies the constraints of the auxiliary qubit template. The design of the reasoning rules follows the circuit structure; for example, for a sequentially composited circuit, if both sub-circuits have quantum-independent properties, then the composited circuit also has quantum-independent properties.

[0040] This invention achieves automated derivation and verification of circuit semantic attributes by constructing a static reasoning system that includes a reasoning context and a set of reasoning rules, and automatically reasoning the correctness of template usage at compile time.

[0041] For example, the reasoning system of the present invention consists of two parts: reasoning context and reasoning rules.

[0042] First, the inference context is introduced. In this invention, the static inference system operates within a context Γ. Context Γ is a set of circuit judgments accumulated progressively during the inference process, used to record the proven semantic properties of the circuit. Since the quantum circuits considered in this invention do not contain measurement operations, their semantics are entirely determined by the corresponding unitary operators. In other words, circuits and their corresponding unitary operators are not distinguished during the inference process and can be used directly interchangeably.

[0043] The judgments in the context Γ can express various semantic properties of the circuit, specifically including: Square bracket form: In this context, ⊢ is a derivation symbol, indicating that "under the context Γ, it can be derived / determined". Circuit C is a controlled operation whose effect on the target register t is determined by the state of register q. (Note: The last part about underlining letters is unrelated and appears to be a separate instruction.) , The hyphen () is a common notation for "quantum register," not a single qubit. Without the hyphen, it indicates a single qubit or a register of a specific size. The presence or absence of the hyphen clearly distinguishes different types of registers. Square brackets [·]: control / invariant registers, whose state does not change before or after the operation; parentheses (·): target registers, the actual quantum variable being operated on.

[0044] Quantum irrelevant: ,in, This indicates that the circuit C is quantum independent, meaning that the circuit C is quantum independent at the bit level in operation.

[0045] QBF judgment: ,in, The term represents a quantum Boolean function. The overall representation of circuit C is that the unitary operator corresponding to the circuit is a quantum Boolean function (QBF).

[0046] Controlled QBF judgment: This indicates that circuit C is a controlled quantum Boolean function. The non-trivial effect is applied to the target register t only when the control register q meets specific conditions. Although register p is also part of the control, it does not play the "trigger / not trigger" switching role, but rather serves as a more generalized control context. Curly braces {·}: trigger / switch registers, whose states can change before and after the operation, but the non-trivial effect of the operation on the target register only takes effect when the register is in a specific ground state; if it is in other states, the operation acts as an identity operator on the target.

[0047] SAP formal judgment: This indicates that circuit C has a square bracket shape. Angle brackets Special control bits whose state can change before and after an operation, but unlike curly braces, they satisfy the commutation condition with external control registers (see Definition 4), thus enabling them to be safely used and reclaimed in the dirty bit template.

[0048] Commutability judgment: This indicates that circuit C1 and circuit C2 are commutative, meaning that exchanging the execution order does not change the overall function.

[0049] Through these judgments, the reasoning system can systematically record and deduce the structural and semantic properties of circuits, thereby supporting automated reversibility analysis, assisted qubit elimination, and circuit optimization.

[0050] Reasoning Rules: This invention establishes a set of formal reasoning rules to automatically derive new judgments from known circuit judgments in the context Γ. Through these rules, the system can perform systematic reasoning on the various attributes mentioned above, thereby achieving circuit-level verification.

[0051] For example, for quantum-independent judgments, the reasoning system contains the following Sequential Rule: ; in, This indicates that circuit C1 is quantum independent of the active bits. This indicates that circuit C2 is quantum independent of the bits in operation. Let C1 and C2 be the circuits that are sequentially combined; C1 and C2 are also quantum independent. This rule states that if both circuits C1 and C2 are quantum independent, then their sequentially combined circuits C1 and C2 are also quantum independent.

[0052] By using similar rules, the reasoning system can combine locally known properties to automatically deduce the global properties of more complex circuits, thereby enabling automatic inverse computation of auxiliary qubits.

[0053] In the inference rules of this invention, U represents a basic unitary operation (unitary gate), and the syntax U[q] indicates that the unitary operation U is applied to the quantum register q.

[0054] All the reasoning rules provided by this invention are as follows: 1. The reasoning rules for bracketed form (SP-form) are as follows: ; Taking the first rule SP-SKIP in the top left corner as an example, the area above the long horizontal line represents the preconditions (which are empty here), and the area below represents the conclusion. This represents an empty context. This rule means that no preconditions or contextual information are required. The unitary operation corresponding to the statement always has the form of square brackets and parentheses, where both the square brackets and parentheses are empty.

[0055] SP-UNITARY indicates that the unitary operation has a bracketed form, and the quantum variable of the operation is located inside the brackets.

[0056] Prerequisites for SP-IDENTITY This indicates that the `you` operation is used in the `you` operation statement here. It is an identity operation In this case, the bracketed form of the unitary operation can place the quantum variable inside the brackets.

[0057] Among the prerequisites of SP-SEQ, and These represent the "union" and "difference" operations on sets, respectively. This indicates that circuit C1 is a controlled operation, and its effect on the target register t1 is determined by the state of register q1. This indicates that circuit C2 is a controlled operation, and its effect on the target register t2 is determined by the state of register q2. Indicates that the q register is... minus The result, express Register by minus Received from registers Let C1 represent the circuit after sequential composition; C2 determines its role in the target register t based on the state of register q. This rule states that the two circuits executed sequentially have square brackets, where the square brackets contain the union of the square bracket variables of each circuit minus the union of the two circuits' respective parentheses, and the parentheses contain all the quantum variables involved in the two circuits minus the quantum variables within the square brackets.

[0058] SP-QIF indicates that the conditional statement has square brackets, where the quantum variable within the brackets is obtained by treating the two branch statements as two sequentially executed circuits according to SP-SEQ, and finally, the condition variable is placed within the square brackets. express Not here middle, Indicates that the q register is... minus The result, express Register by minus Received from registers The conditional statement circuit uses square brackets.

[0059] SP-BORROW CLEAN, where the prerequisite is that both sub-circuits have a specific bracket form, and, Sub-circuits are quantum independent. Under the given conditions, statements borrowing clean auxiliary bits have square brackets, where the square brackets are the same as those in the sub-circuit, and the parentheses are the same as those in the sub-circuit. The parentheses are the same. Among them, Circuit representation It has the form of square brackets, Circuit C u It has the form of square brackets, Circuit representation It is quantum independent at the level of the bit in action. The circuit for indicating the borrowing of clean auxiliary bits has square brackets.

[0060] SP-BORROW DIRTY, explained similarly to SP-BORROW CLEAN, but with different preconditions. The requirements for the sub-circuit have changed from square brackets to angle brackets, with the borrowed dirty auxiliary bits located within the angle brackets. Circuit representation It has the form of a square bracket. The statement circuit indicating the use of dirty auxiliary bits has a bracketed form.

[0061] SP-CQBF indicates that if a circuit is a controlled quantum Boolean function, then it has a corresponding bracketed form. Circuit representation It is a controlled quantum Boolean function. Circuit representation It has the form of square brackets.

[0062] SP-SAP indicates that if a circuit has a square bracket form, then it also has a corresponding square bracket form. Wherein, Circuit representation It has the form of square brackets.

[0063] The prerequisites for SP-NEW SQUARE Representing quantum variables Not in register and The rule states that if a circuit already has a certain bracketed form, adding any irrelevant variable into the brackets will result in a new bracketed form that the circuit still satisfies. Circuit representation It has the form of square brackets.

[0064] SP-MOVE SQUARE means that any variable inside square brackets can be moved into parentheses. Wherein, Circuit representation It has the form of square brackets.

[0065] 2. The inference rules for quantum-independent operations (qfree) are as follows: ; QFREE-SKIP indicates that skipping statements is quantum independent.

[0066] Prerequisites for QFREE-BASIC The unitary operation must be an identity operation. Or flip operation Under this premise, unitary operations are quantum independent. Among them, This indicates that the circuit is quantum independent.

[0067] QFREE-SEQ indicates that quantum operations have combinatorial properties, meaning that two sequentially executed quantum-independent circuits are still quantum-independent.

[0068] QFREE-QIF means that if all branch statements are quantum-independent, then the conditional statements are quantum-independent. This indicates that the circuit in the conditional statement is quantum independent.

[0069] The first three prerequisites for QFREE-BORROW CLEAN are the same as those for SP-BORROW CLEAN, but the fourth condition requires... It is quantum independent. Under this premise, clean auxiliary bit borrowing statements are quantum independent. Among them, Circuit representation It has the form of square brackets, Circuit representation It has the form of square brackets, This indicates that the statement borrowing clean auxiliary bits is quantum independent.

[0070] QFREE-BORROW DIRTY is the same as above. Among them, Circuit representation It has the form of a square bracket. This indicates that the statement using dirty auxiliary bits is quantum independent.

[0071] 3. The inference rules for quantum Boolean functions (QBF) are as follows: ; QBF-SKIP indicates that skipping statements is a quantum Boolean function.

[0072] The prerequisite for QBF-BASIC is that unitary operations are... One of them, under this premise, is that unitary operations are quantum Boolean functions.

[0073] QBF-CONJUGATE means that placing a circuit before and after a quantum Boolean function circuit, and its inverse circuit, respectively, results in a combined circuit that is still a quantum Boolean function. This indicates that the unitary operator corresponding to circuit C1 is a quantum Boolean function. This indicates that combinational circuits are quantum Boolean functions.

[0074] Among the prerequisites for QBF-TENSOR, express All quantum variables used by the circuit. This rule states that if two circuits are both quantum Boolean functions and do not share any quantum variables, then their sequential execution remains a quantum Boolean function. Circuit representation and Quantum variables without common effect, Sequential combinational circuits are represented by quantum Boolean functions.

[0075] QBF-SEQ means that if two circuits are both quantum Boolean functions and they commute, then their sequential execution is still a quantum Boolean function.

[0076] QBF-QIF indicates that if both branch sub-circuits are quantum Boolean functions, then the conditional statement is a quantum Boolean function. Specifically, This indicates that the circuit for conditional statements is a quantum Boolean function.

[0077] The first three prerequisites of QBF-BORROW CLEAN are the same as those of SP-BORROW CLEAN. The fourth prerequisite requires... It is a quantum Boolean function. Under this premise, a clean auxiliary bit borrowing statement is a quantum Boolean function. Among them, This indicates that borrowing a clean auxiliary bit circuit is a quantum Boolean function.

[0078] QBF-BORROW DIRTY is consistent with the above.

[0079] QBF-CQBF means that if a circuit is a controlled quantum Boolean function, then it is also a quantum Boolean function, where... This indicates that the circuit is a controlled quantum Boolean function.

[0080] 4. The inference rules for controlled quantum Boolean functions (CQBF) are as follows: ; CQBF-SKIP indicates that the skip statement is a controlled quantum Boolean function.

[0081] CQBF-BASIC indicates that if the unitary operation is One of them is the unitary operation, which is a controlled quantum Boolean function whose quantum variable is enclosed in parentheses.

[0082] CQBF-IDENTITY indicates that if a unitary operation is an identity operation, then it is a controlled quantum Boolean function, and the variable of the operation is enclosed in curly braces.

[0083] Among the preconditions of CQBF-QIF, Require yes Statement. This rule states that if one of two branch statements is a controlled quantum Boolean function and the other is a skip statement, then the conditional statement is a controlled quantum Boolean function, with the same form as the branch statement containing the controlled quantum Boolean function, and the condition variable is enclosed in curly braces. Wherein, Circuit representation It is a controlled quantum Boolean function and Is it skipping statements or circuits? Is it a skip statement and It is a controlled quantum Boolean function. This indicates that the conditional statement circuit is a controlled quantum Boolean function.

[0084] In CQBF-BORROW CLEAN, registers The requirement was to split the registers into disjoint ones. The first three preconditions are the same as those in SP-BORROW CLEAN, while the latter two preconditions require that each of the two sub-circuits is a controlled quantum Boolean function with a specific form. Under these conditions, the clean auxiliary bit borrowing statement is a controlled quantum Boolean function, the form of which is derived from the form of the controlled quantum Boolean function possessed by the sub-circuit. Circuit representation It is a controlled quantum Boolean function. Circuit representation It is a controlled quantum Boolean function. This indicates that there is no overlap between these registers. express It is the union of these registers. The statement indicating the borrowing of clean auxiliary bits is a controlled quantum Boolean function.

[0085] In the representation of the controlled quantum Boolean function CQBF[p]{q}(t): The registers enclosed in square brackets [·] are control / invariant registers, whose states do not change before or after the operation, and serve as a generalized control context; The registers enclosed in curly braces {·} are trigger / switch registers. Their non-trivial effects only take effect when the register is in a specific ground state, and their state can change before and after the operation. The register within parentheses (·) is the target register, which is the actual quantum variable being manipulated.

[0086] For example, It is indicated that, under the context Γ, the storage circuit Cs is a controlled quantum Boolean function, whose control is jointly constituted by registers Λ, B, and C, the triggering condition is determined by the state of registers D, E, and F, and the operation target is auxiliary bit a.

[0087] CQBF-BORROW DIRTY is consistent with the above. The statement indicating the borrowing of dirty auxiliary bits is a controlled quantum Boolean function.

[0088] CQBF-NEW SQUARE indicates that if a circuit is a controlled quantum Boolean function, then irrelevant variables can be added inside its square brackets. This indicates that circuit C is a controlled quantum Boolean function. Representing quantum variables Not in these registers This indicates that circuit C is a controlled quantum Boolean function.

[0089] CQBF-MOVE SQUARE means that if a circuit is a controlled quantum Boolean function, then the variable inside the square brackets can be moved inside the parentheses. This indicates that circuit C is a controlled quantum Boolean function. This indicates that circuit C is a controlled quantum Boolean function.

[0090] CQBF-MOVE CURLY means that if a circuit is a controlled quantum Boolean function, then the variables inside the curly braces can be moved into the square brackets. Wherein, This indicates that circuit C is a controlled quantum Boolean function.

[0091] 5. The inference rules for the obelisk-bracket form (SAP-form) are as follows: ; SAP-SKIP indicates that the skip statement has square brackets.

[0092] SAP-UNITARY indicates that the unitary operation has the form of square brackets, and the variable being operated on is enclosed in the brackets.

[0093] SAP-IDETDITY indicates that if a unitary operation is an identity operation, then it has the form of angle brackets, and the variable being operated on is enclosed in angle brackets.

[0094] SAP-SEQ indicates that two circuits executed sequentially have angle brackets, where the variables within the square brackets and parentheses are identical to their standard square bracket form, and the angle brackets are empty.

[0095] SAP-QIFx indicates that if both branches of a conditional statement are quantum Boolean functions and the branches commute, then the conditional statement has an angle bracket form, where the variables within each bracket are derived according to their angle bracket form. Circuits that indicate conditional statements use square brackets. The conditional statement circuit has the form of square brackets.

[0096] SAP-QIF A This means that if both branches of a conditional statement have oblique brackets, then the conditional statement has oblique brackets, and the variables within the brackets are derived from the oblique bracket forms of the branches. The conditional statement circuit has the form of square brackets.

[0097] SAP-QIF states that if two branch statements of a conditional statement commute and both have obelisk brackets, then the conditional statement has obelisk brackets, and the variables within the brackets are derived from the obelisk bracket forms of the branch statements. The conditional statement circuit has the form of square brackets.

[0098] The first three preconditions of SAP-BORROW CLEAN are the same as those of SP-BORROW CLEAN, while the latter two conditions require that each of the two sub-circuits is a controlled quantum Boolean function. Under this premise, the clean auxiliary bit borrowing statement has the form of obeliskinesia, and the variables within the obeliskinesia are derived from the form of the controlled quantum Boolean function of the sub-circuit. Circuit representation It has the form of square brackets, Circuit representation It has the form of square brackets, Circuit representation It is a controlled quantum Boolean function. Circuit representation It is a controlled quantum Boolean function. This indicates that these registers have no overlap. This indicates that register q is the union of these registers. The statement indicating the borrowing of clean auxiliary bits has the form of angle brackets.

[0099] SAP-BORROW CLEAN rules are similar to SAP-BORROW CLEAN rules, but their sixth prerequisite requires additional requirements. It has the form of an obelisk-shaped bracket. Among them, Circuit representation It is a controlled quantum Boolean function. Indicator register It is a subset of the union of these three registers. The statement indicating the borrowing of clean auxiliary bits has the form of angle brackets.

[0100] SAP-BORROW DIRTY is similar to SAP-BORROW CLEAN. Among them, Circuit representation It has the form of a square bracket. The statement indicating the borrowing of dirty auxiliary bits has the form of angle brackets.

[0101] 6. The inference rules for the obelisk-bracket form (SAP-form) also include the following: ; SAP-SP indicates that a circuit with square brackets also has angle brackets, where the angle brackets are empty and the square brackets and parentheses correspond to each other.

[0102] SAP-CQBF indicates that if a circuit is a controlled quantum Boolean function, then it has the form of angle brackets, and the variable within the angle brackets can be any variable within the curly braces of the controlled quantum Boolean function. Circuit representation It is a controlled quantum Boolean function. This indicates that circuit C has a square bracket form.

[0103] SAP-NEW SQUARE means that any new variable can be added to the square brackets within the angle brackets. This indicates that circuit C has a square bracket form. express Not in the union of these registers, This indicates that circuit C has a square bracket form.

[0104] SAP-NEW ANGLE means that any new variable can be added either to square brackets within angle brackets or to parentheses within angle brackets, while simultaneously moving the original variable from the angle brackets into the square brackets. This indicates that circuit C has a square bracket form.

[0105] SAP-MOVE SQUARE means that you can move the variable inside square brackets into parentheses.

[0106] SAP-MOVE ANGLE means that variables within angle brackets can be moved into parentheses. This indicates that circuit C has a square bracket form.

[0107] 7. The inference rules for commutative properties are as follows: .

[0108] Here, COMM-SELF indicates that two identical circuits commute.

[0109] COMM-SKIP means skipping statements and commuting with any circuit.

[0110] COMM-SP states that two circuits commute if each circuit has bracketed form, the variables within the brackets are non-overlapping, and the union of the bracketed variables and the union of the bracketed variables are non-overlapping. Indicator register The intersection is empty and Union and The intersection of the union of the sets is empty.

[0111] COMM-QBF means that if two circuits are each quantum Boolean functions, and their sequential combination is also a quantum Boolean function, then they commute.

[0112] In some embodiments, the borrowing statement includes a clean borrowing statement, and the auxiliary qubit template corresponding to the clean borrowing statement includes a first storage stage circuit and a first usage stage circuit; The first storage stage circuit has a bracketed form with respect to the working register and the auxiliary register, and is quantum independent of the auxiliary register; The first usage stage circuit has square brackets for the working register, auxiliary register, and destination register; The inverse computing circuit is the inverse circuit of the first storage stage circuit.

[0113] Among them, the bracket form represents a circuit structure characteristic: when a circuit has information about registers... and bracket form When, it means register The state is only used as a control signal, and its value does not change before or after execution, while the specific operation is performed on the register. Quantum independence means that the circuit's operation on the ground state is equivalent to a reversible classical logic function, and will not produce quantum superposition or entanglement.

[0114] It should be noted that clean borrow statements are used to declare that the initial state is known (usually...). The auxiliary qubits of the working register are borrowed. The corresponding template consists of a storage stage circuit and a usage stage circuit: the storage stage circuit encodes the information from the working register into the auxiliary register, while the usage stage circuit uses the stored information to perform calculations on the target register. Since the storage stage circuit is quantum independent and the auxiliary register only serves as a control signal in the usage stage circuit, simply adding the inverse circuit of the storage stage circuit after the usage stage circuit will restore the auxiliary register to its initial state.

[0115] For example, suppose the working register is The auxiliary register is (initialized to) ), the target register is Storage stage circuit satisfy And in The above is quantum independent and uses staged circuits. satisfy The complete circuit that includes inverse computation is: ,in This is the inverse calculation circuit.

[0116] This invention utilizes the characteristics of normalized forms to complete the inverse calculation of clean auxiliary bits simply by reversing the gates targeting the auxiliary bits at the end. This method linearizes and structures the inverse calculation process, avoiding complex circuit analysis. Compared to methods like Unqomp and Reqomp, this invention guarantees successful inverse calculation in most scenarios, theoretically solving the problem of limited success rates in existing technologies.

[0117] In some embodiments, the borrowing statement includes a dirty borrowing statement, and the auxiliary qubit template corresponding to the dirty borrowing statement includes a second storage stage circuit and a second use stage circuit; The second storage stage circuit has a bracketed form with respect to the working register and the auxiliary register, and is quantum independent of the auxiliary register; The second stage circuit has obelisk brackets for the working register, auxiliary register, and destination register; The inverse computing circuit is composed of the second usage stage circuit, the second storage stage circuit, and the inverse circuit of the second usage stage circuit and the second storage stage circuit in sequence.

[0118] In this context, the square bracket form has the same meaning as in the previous embodiments, indicating that the register state serves only as a control signal, and its value remains unchanged before and after execution. The angled bracket form is a further limitation of the square bracket form, denoted as... , indicating circuit In register In each computational ground state, the action on the target register The operations satisfy a specific commutation relation, thereby enabling the auxiliary bits to... The initial state can be unknown. The meaning of quantum independence is the same as in the previous embodiments, referring to the circuit's action on the ground state being equivalent to a reversible classical logic function.

[0119] It should be noted that the dirty borrow statement is used to declare the borrowing of an auxiliary qubit whose initial state is unknown, and this auxiliary qubit may be in any computational ground state. The dirty auxiliary bit template also consists of a storage stage circuit and a use stage circuit, but the use stage circuit needs to satisfy a more stringent obelisk bracket form to ensure that the auxiliary bit can be correctly recovered regardless of its initial state. The inverse computation circuit of the dirty auxiliary bit template is not a simple U†, but rather a composite of V→U→V→U†. This structure can restore the auxiliary bit to its original state without depending on its initial state.

[0120] For example, assume the working register is The auxiliary register is (The initial state is unknown, denoted as) ), the target register is Storage stage circuit satisfy And in The above is quantum independent and uses staged circuits. satisfy The complete circuit that includes inverse computation is: ,in This is the inverse circuit of the storage stage circuit.

[0121] This invention reduces the complexity of using dirty auxiliary bits to a level comparable to that of clean auxiliary bits through templated design, enabling non-expert users to use dirty auxiliary bits safely and efficiently. At the same time, it places the inverse calculation problems of clean and dirty auxiliary bits under the same theoretical framework, solving the problem of the two types of bit management schemes being isolated and unable to communicate with each other in the prior art.

[0122] In some embodiments, it also includes: By applying the circuit equivalence transformation rule, the gates targeting the auxiliary qubits are gradually moved to the right and clustered at the end of the circuit to form a normalized circuit. The circuit equivalence transformation rule is used to exchange the order of the gates targeting the auxiliary qubits and the gates operating on the working bits in a local range, and the circuit remains unitarily equivalent before and after the exchange. Once the quantum circuit program has completed the inverse calculation of the clean auxiliary bits and formed a normalized form, all gates involving auxiliary bits in the normalized form of the circuit are deleted to obtain the dirty auxiliary bit circuit corresponding to the quantum circuit program.

[0123] Among them, the circuit equivalence transformation rules are a set of transformation rules that can safely exchange the order of quantum gates within a local range. These rules guarantee that the overall function of the circuit remains unchanged on all working bits before and after the exchange (i.e., it remains unitary equivalence). The normalized form refers to the regular circuit structure formed after all gates targeting auxiliary qubits are moved and clustered at the end of the circuit.

[0124] It should be noted that this implementation method includes two core processes: First, the circuit normalization process, which systematically and repeatedly applies the circuit equivalence transformation rules to gradually move all the scattered gates in the input circuit that target the auxiliary qubits to the right, eventually gathering them at the end of the circuit to form a normalized form with a regular structure; Second, the dirty auxiliary bit version conversion process, which, on the premise that the circuit has been normalized and the inverse calculation of the clean auxiliary bits has been completed, deletes all gates involving auxiliary qubits in the normalized form circuit to obtain the corresponding dirty auxiliary bit circuit.

[0125] For example, suppose the original circuit contains a gate G_a targeting the auxiliary bit 'a' and a gate G_q operating on the working bit 'q', with G_a and G_q interleaved in their original order. By applying circuit equivalence transformation rules, the order of G_a and G_q can be swapped locally, ensuring unitary equivalence before and after the swap. Repeating this transformation eventually moves all gates targeting the auxiliary bit 'a' to the end of the circuit and aggregates them into a normalized form. Subsequently, if the circuit has completed the inverse calculation of the clean auxiliary bit, deleting all gates involving the auxiliary bit 'a' yields a dirty auxiliary bit circuit that no longer depends on that auxiliary bit.

[0126] This invention, through a circuit normalization algorithm, demonstrates far superior applicability to existing technologies when dealing with circuits with complex dependencies. It also achieves for the first time an automatic conversion from a clean auxiliary bit version to a dirty auxiliary bit version, significantly reducing the occupation of quantum bit resources.

[0127] In some embodiments, the predefined inference system employs a recursive verification method: When deriving the properties of a sub-circuit of the current borrowed statement, if the sub-circuit contains nested borrowed statements, the correctness of the nested borrowed statements is verified first, and then the correctness of the current borrowed statement is verified.

[0128] Among them, recursive verification is a layer-by-layer verification strategy, that is, starting from the innermost borrow statement, verifying the correctness of each layer of borrow statements from the inside out. Nested borrow statements refer to the situation where a sub-circuit of a borrow statement contains another borrow statement.

[0129] It should be noted that since the sub-circuit of a borrowed statement may further contain other borrowed statements, the correctness of these inner borrowed statements directly affects the verification result of the outer borrowed statement. Therefore, the inference system adopts a recursive verification method: first, it recursively verifies the correctness of all inner nested borrowed statements; only after all inner borrowed statements have passed verification does it continue to verify whether the current borrowed statement satisfies the constraints of the auxiliary qubit template. This recursive verification ensures that the correctness of template use can be established layer by layer from bottom to top.

[0130] For example, suppose a quantum circuit program contains three nested borrow statements: the sub-circuit of the outermost borrow statement B1 contains borrow statement B2, and the sub-circuit of B2 contains borrow statement B3. The inference system first verifies whether the innermost B3 satisfies the constraints of its corresponding template; after passing the verification, it then verifies whether B2 satisfies the template constraints (at this point, the sub-circuit of B2 has already passed the verification); finally, it verifies whether B1 satisfies the template constraints. Only when the verification of all levels passes can the inverse computation of the entire program be correctly synthesized.

[0131] This invention uses a recursive verification method to ensure that the correctness of nested borrowing statements can be established layer by layer from bottom to top, thereby ensuring that nested structures of any complexity can be correctly verified.

[0132] In some embodiments, generating an inverse computation circuit based on the category of the borrowed statement and the auxiliary qubit template, and using the inverse computation circuit to restore the auxiliary qubit, includes: Starting from the innermost borrow statement, the borrow statements are replaced with the corresponding atomic circuit fragments and their matching inverse computation fragments according to the borrow type; Processing the nested structure layer by layer from the inside out until the outermost layer uses a borrowed statement to complete the replacement, thus obtaining the target circuit that completes the restoration of the auxiliary qubits.

[0133] Here, an atomic circuit segment refers to a predefined basic circuit unit in the auxiliary qubit template corresponding to the borrowed statement, including storage stage circuits and usage stage circuits. A matching inverse computation segment refers to the inverse computation circuit structure corresponding to the type of borrowed statement. For a clean borrowed statement, it is the inverse circuit of the storage stage circuit; for a dirty borrowed statement, it is a circuit composed of the usage stage circuit, the storage stage circuit, and the inverse circuit of the usage stage circuit in sequence.

[0134] It should be noted that this embodiment provides a specific processing order for the synthesis of the inverse computation circuit. Since borrowed statements may have nested structures, the processing result of the inner borrowed statement will affect the sub-circuit configuration of the outer borrowed statement. Therefore, the synthesis process adopts a layer-by-layer replacement strategy from the inside out: first, the innermost borrowed statement is processed, replacing it with the corresponding atomic circuit fragment and its inverse computation fragment; then, processing proceeds layer by layer outwards, replacing each layer of borrowed statements with the corresponding circuit fragment; finally, after the outermost borrowed statement is replaced, a complete target circuit containing inverse computation operations is obtained.

[0135] For example, suppose there are two nested borrowing statements: the outer layer is a clean borrowing statement B1, and its sub-circuit contains the inner dirty borrowing statement B2. The synthesis process first processes the inner B2: according to the template of the dirty borrowing statement, B2 is replaced with V→U→V→U† (where V is the use stage circuit and U is the storage stage circuit). At this time, the sub-circuit of the outer B1 has become a new circuit containing the above replacement result. Then, the outer B1 is processed: according to the template of the clean borrowing statement, B1 is replaced with U1→(processed sub-circuit)→U1†, where U1 is the storage stage circuit of B1. Finally, the target circuit that completes the reconstruction of the auxiliary qubit is obtained.

[0136] This invention achieves automatic synthesis of inverse computation circuits for nested borrowing statements by replacing layers from the inside out, ensuring that auxiliary qubits at any nesting depth can be correctly restored.

[0137] This invention proposes an inverse computation method for auxiliary qubits, which is a unified automatic inverse computation method for clean and dirty auxiliary qubits. Its beneficial effects are reflected in the following aspects: Key point 1: Door rewriting rules.

[0138] Technical means: This invention proposes a set of circuit equivalent transformation rules as a basic operational tool. These rules can safely swap the positions of "gates targeting auxiliary bits" and "gates targeting working bits but not the auxiliary bits" within a local range.

[0139] Beneficial effects: This method theoretically guarantees that each transformation does not change the overall function of the circuit across all working bits (i.e., maintaining unitary equivalence), providing a solid mathematical foundation for subsequent automated processing. This fundamentally overcomes the risk of errors introduced by some existing methods that rely on heuristic strategies or approximations, laying the cornerstone for achieving highly reliable automatic inverse computation.

[0140] Key point 2: It achieves widely applicable circuit normalization.

[0141] Technical means: By systematically and repeatedly applying the above-mentioned equivalent transformation rules, the normalization algorithm of the present invention can gradually move all the scattered gates in the input circuit that target auxiliary bits to the right, and finally gather them at the end of the circuit to form a normalized form with a regular structure.

[0142] Beneficial effects: This rule-based rewriting strategy enables the algorithm to demonstrate far superior applicability compared to existing techniques (such as Unqomp and Reqomp) when handling circuits with complex dependencies (such as nonlinear interactions). Experiments show that on a large set of reversible Boolean circuit test cases, the normalization success rate of this method is significantly higher than that of existing schemes, overcoming their fundamental limitation of "only being able to handle some special cases".

[0143] Key point 3: It simplifies the inverse calculation operation, making it direct, efficient and error-free.

[0144] Technical means: By utilizing the characteristics of the normalized form, the inverse calculation of the clean auxiliary bits can be completed simply by performing reverse cancellation on the gates that target the auxiliary bits at the end.

[0145] Beneficial effects: This method linearizes and structures the inverse computation process of clean auxiliary bits, avoiding complex circuit analysis. Compared to methods such as Unqomp and Reqomp, this invention guarantees successful inverse computation in most scenarios, theoretically solving the problem of limited success rate in existing technologies.

[0146] Key Point 4: For the first time, automatic conversion from clean auxiliary bit to dirty auxiliary bit version was achieved, unlocking key resource optimization capabilities.

[0147] Technical approach: If the circuit has been normalized and the clean auxiliary bit inverse calculation has been completed, then deleting all gates involving auxiliary bits will yield the corresponding dirty auxiliary bit version.

[0148] Beneficial effects: This capability is completely absent in existing technologies. This feature allows programmers to always design algorithms using the more intuitive clean auxiliary bit mode, while the compiler automatically handles the conversion to the more resource-efficient dirty auxiliary bit version. This significantly reduces the consumption of precious qubit resources and is a key optimization technique for realizing large-scale quantum algorithms, possessing significant practical value.

[0149] Key Point 5: A unified formal framework was established, which solved the problem of technological fragmentation.

[0150] Technical means: This invention is the first to solve the inverse computation problem of clean auxiliary bits and dirty auxiliary bits within the same theoretical framework and algorithmic flow. The normalization process is the first unified step, and subsequent different processing (removing the last gate or removing all gates) are simply different output options within the same framework.

[0151] Beneficial effects: This unification solves the problem of the two types of bit management schemes being fragmented and incompatible in existing technologies. It simplifies compiler design and provides a clear and scalable foundation for exploring more complex hybrid bit management strategies in the future.

[0152] The following describes an exemplary application of the embodiments of the present invention in a practical application scenario.

[0153] In quantum computing, inverse computation of auxiliary qubits is a fundamental and crucial problem. To accurately describe the technical problem that this invention aims to solve, we first formally define the "inverse computation problem".

[0154] 1. Definition: The problem of clean auxiliary bit inverse computation (Uncomputation).

[0155] Consider a register a consisting of m clean auxiliary bits (initialized to state ). A unitary quantum circuit G is constructed on a register q consisting of an arbitrary state and n working bits. At that time, assume that the function of G can be expressed as: Where i represents the computational ground state identifier of register a, and its value ranges from 0 to 1. ; This represents the state component corresponding to register q when register a is in the i-th ground state.

[0156] The input to the inverse computation problem is a unitary circuit G and a clean auxiliary register a. The goal of the problem is to output a new unitary circuit. (recorded as) ∈Uncomp(G, a)), this circuit can restore the auxiliary register a to its initial state while keeping the state of the working register q unchanged. .Right now, Must meet: ; It should be noted that the circuit that fulfills the above functions The corresponding unit operator is usually not unique.

[0157] 2. Definition: The Dirty Auxiliary Bit Inverse Computation Problem.

[0158] Consider a unitary quantum circuit G operating on register a consisting of m dirty auxiliary bits and register q consisting of n working bits. Assume that the auxiliary quantum bit register a is initialized to... During this state, the working register q is initialized to an arbitrary state. At that time, assume that the function of G can be expressed as: The input to the inverse computation problem is a unitary circuit G and a dirty auxiliary register a. The goal of the problem is to output a new unitary circuit. (recorded as) ∈Uncomp(G, This circuit can maintain the state of the working register q unchanged, regardless of the initial computational ground state of a. Both can restore auxiliary register a to its initial state. .Right now, Must meet: ; It should be noted that the circuit that fulfills the above functions It is not usually unique, but its corresponding unit operator is unique.

[0159] 3. Definition: Automatic inverse computation problem.

[0160] Design and implement an algorithm or system that, taking an input quantum circuit G and a specified auxiliary register a as input, automatically (i.e. without human intervention) synthesizes and outputs a circuit that meets the requirements of the "inverse computation problem". or .

[0161] This technical problem imposes the following core requirements on the algorithm or system: Automation: The entire process requires no manual derivation or insertion of inverse calculations by the programmer.

[0162] Correctness: Output circuit The formula requirements must be strictly met in terms of functionality.

[0163] Generality: The algorithm should be able to handle the widest possible range of input circuit types G.

[0164] Current technology can only handle the inverse computation problem of clean auxiliary bits. Even for experts, dirty auxiliary bits are more difficult to use than clean auxiliary bits.

[0165] Based on the above definitions and the current state of the technology, the present invention provides the following method: S1: Input program.

[0166] Obtain a quantum circuit program P, which is written in the language described in Definition 6 below.

[0167] S2: Identify and categorize borrowed phrases.

[0168] In program P, identify borrow statements and classify them according to their syntax: Clean borrow statement: its semantics correspond to the following definition three; Dirty borrow statement: Its semantics correspond to definition five below.

[0169] S3: Extract the sub-circuit to be verified.

[0170] For each borrowed statement, extract the sub-circuits within its body (i.e., the circuit segments enclosed and affected by the borrowed statement), and denot them as follows: and .

[0171] S4: Derive intermediate properties based on the reasoning system.

[0172] For the sub-circuit and The reasoning system uses the intermediate properties described in Definitions 7 and 8 as the basis for deduction, and automatically derives the relevant properties according to the predetermined reasoning rules based on syntax construction, thereby obtaining the deduction conclusion used to determine the correctness of the template (the deduction can be direct deduction or indirect deduction through intermediate properties).

[0173] S5: Automatically checks the correctness of template usage.

[0174] Based on the property derivation results obtained in step S4, the sub-circuit is automatically determined. and The semantics of the borrowed statement are checked against the constraints required by the auxiliary qubit template, as defined by Definitions 1, 2, and 4. If the constraints are not met, the output fails. The inference system further guarantees that the correctness of any borrowed statement is contingent upon the correctness of all embedded borrowed statements in its sub-circuit; therefore, when this step... and When the check passes, it has been recursively deduced that the correctness of all nested borrow statements within the sub-circuit is valid.

[0175] S6: Generate inverse computation and complete the recovery of auxiliary qubits.

[0176] When step S5 passes the check, automatic inverse computation synthesis is performed on the borrowed statement: starting from the innermost borrowed statement (i.e., the case where its sub-circuit no longer contains borrowed statements), the borrowed statement is replaced with "atomic circuit fragment + its matching inverse computation fragment" (Definition 3, Definition 5) according to the borrowing type (clean borrowing / dirty borrowing), and processed layer by layer from the inside to the outside according to the nested structure until the outermost borrowed statement is replaced, thereby obtaining the target circuit that completes the reconstruction of the auxiliary qubit.

[0177] This invention provides the following key definitions: Definition 1: Constant operations and bracketed forms (SP-form) applied to quantum registers.

[0178] To describe the key properties of quantum circuit normalization in this invention, the following definitions are introduced.

[0179] Suppose there exist two disjoint quantum registers and (Right now ),in It is a register with n qubits. It is a register with m qubits. One in a composite system (i.e., a register) and A unitary operation U acting on a Hilbert space (which together constitute a register space) is called a register-based operation if it satisfies the following conditions. The above is constant: There exists a dependency The unitary family of operations {Ui} for register states, where each Ui operates only on the register. This makes for Arbitrary computation ground state in register and arbitrary quantum states in the t register The effect of operating U is as follows: Among them, the unitary operation Acting on registers and superior, yes The identifier of the i-th computed ground state in the register. yes Any quantum state identifier, unitary operation Acting on registers superior.

[0180] The technical implication of this definition is: when an operation U is in The upper constant means The register's state serves only as a "control signal" or "index" for the U operation; its value itself remains unchanged before and after the U operation. (This is applied to...) The specific operation of the register, Ui, is determined by Current state Decide.

[0181] If unitary operation U is in If the upper bound is constant, then U is said to have a constant with respect to the upper bound. and The bracket form is denoted as: U: [ ]( ).

[0182] This notation clearly separates the "control / invariant" register ( (enclosed in square brackets) and the "operated / target" register ( (Place within parentheses).

[0183] Definition 2: Quantum-independent (qfree) operations.

[0184] In quantum computing, many operations that ensure the simplicity and feasibility of inverse computation share a key characteristic: they do not produce true quantum superposition states. Therefore, this invention defines "quantum-independent" operations.

[0185] A unitary operation W acting on a quantum register s is said to be quantum independent if and only if it maps any computational ground state of register s to another computational ground state.

[0186] In mathematical form: for any ground state in the computational basis of s Both exist in another ground state. , so that: ; In other words, a quantum-independent operation W is equivalent to a reversible classical logic function on the computational basis, and it does not produce quantum superposition or quantum entanglement (when applied alone to the ground state).

[0187] Based on the above definition, this invention provides a formal definition of a clean auxiliary bit template: Definition 3: Clean storage of auxiliary bits - using templates.

[0188] To achieve secure management and automatic inverse computation of clean auxiliary bits, this invention defines a "store-use" template. This template provides a structured and verifiable correct paradigm for computations using clean auxiliary bits.

[0189] Suppose there are three disjoint quantum registers: q: An n-bit working register used for main computation.

[0190] t: An m-bit target register used for main computation.

[0191] a: A clean, h-bit auxiliary register, initialized to a known state. .

[0192] Storage of a clean auxiliary bit – using a template consisting of two unitary circuits U and V, satisfying the following conditions: Storage phase: The circuit U has a bracketed form with respect to q and a (i.e., U:[q](a), according to definition 1).

[0193] Furthermore, circuit U is quantum independent of auxiliary register a.

[0194] This condition ensures that the effect of the U operation depends only on the state of q and that information can be reliably encoded (stored) into the auxiliary register a.

[0195] Usage phase: The circuit V has a bracketed form with respect to the compound registers q, a, and t (i.e., V:[q, a](t)).

[0196] This means that circuit V uses the working register q and the auxiliary register a with stored information to calculate and update the state of the target register t.

[0197] Figure 2 This is a schematic diagram of the template circuit for storing and using clean auxiliary bits provided by the present invention. Figure 2 As shown, the correctness of the template and automatic inverse computation: When a computation process conforms to the above store-and-use template, the inverse computation of the clean auxiliary bit a can be achieved by directly appending the inverse operation of U (i.e., U†) after circuit V. That is, the complete circuit including automatic inverse computation is U→V→U†, as shown in the figure below. This operation can correctly restore the auxiliary register a to its initial state and ensure the correctness of the computation results on the working register q and the target register t.

[0198] Definition 4: Square bracket form, SAP-form.

[0199] Let V be a unitary operation of the form [q, a](t). Let q be a quantum register, a be a qubit, and t be a quantum register. If we compute the ground state for each of the registers q... All of them have: and ; Then V is said to have an apex shape. .in, and These represent the states when auxiliary qubit a is in the state of 0 state and 1 In the state of unitary operation V, a reduction operation induced on the target register t is performed.

[0200] Definition 5: Storage of dirty auxiliary bits - using templates.

[0201] Let q be an n-bit quantum register, t be an m-bit quantum register, and a be a 1-bit dirty auxiliary bit. The storage-use template for a dirty auxiliary bit consists of two unitary circuits U and V, satisfying the following constraints: 1. Storage stage.

[0202] U has the form [q](a) in square brackets and is quantum independent on a.

[0203] 2. Usage phase.

[0204] Circuit V has the form of angle brackets with respect to the compound registers q, a, and t (i.e.) ).

[0205] This means that circuit V uses the working register q and the auxiliary register a, which already stores information, to calculate and update the state of the target register t. Further, consider the composite circuit V;U;V, where circuit V acts twice, with a circuit U in bracket form between it and the composite register q, a. The transformation induced on the target register t by the composite circuit V;U;V is independent of the initial state details of a; its effect depends only on whether circuit U changes the state of the auxiliary register a.

[0206] Figure 3 This is a schematic diagram of the template circuit for storing and using dirty auxiliary bits provided by the present invention. Figure 3 As shown, the complete inverse calculation circuit for the dirty auxiliary bit is composed of the usage stage circuit V, the storage stage circuit U, the usage stage circuit V, and the inverse circuit U† of the storage stage circuit in sequence, i.e., V→U→V→U†.

[0207] Based on the above template definition, this invention provides a quantum circuit language. The syntax definition is as follows: (a) Quantum circuit language The syntax definition.

[0208] Based on the template definition above, this invention provides the following syntax definition for QC^a: Definition 6: Quantum circuit language with borrow statements ( ): ; Where, skip: indicates a no-operation, i.e., no modification is made to the quantum register, used as a placeholder or to simplify reasoning. U[q]: indicates applying a unitary gate U to register q. C1; C2: indicates sequential composition, executing circuit C1 first, then circuit C2. qif q then C1 else C0: indicates a quantum conditional branch conditional on the value of quantum bit q, executing C1 if q=1, otherwise executing C2. borrow a := |0>store Cs use Cu: indicates clean borrowing. Where Cs and Cu correspond to the storage and use in the clean auxiliary bit template, respectively. borrow a storeCs use Cu: indicates dirty borrowing. Where Cs and Cu correspond to the storage and use in the dirty auxiliary bit template, respectively.

[0209] This syntax allows quantum circuit designers to clearly describe the templated use of auxiliary qubits. The syntax intuitively distinguishes between clean and dirty borrows by the presence or absence of := |0, enabling programmers to declare requirements for different types of auxiliary bits in a unified and concise manner, reducing programming complexity.

[0210] (b) Construction of a static reasoning system.

[0211] To construct a static reasoning system that automatically determines the correctness of reasoning templates, this invention provides the following additional attribute definitions: Definition 7: Quantum Boolean Function (QBF).

[0212] A quantum Boolean function is a unitary operator U that satisfies the following condition: ; That is, the square of U is equal to the identity operator I.

[0213] In other words, quantum Boolean functions are a special class of unitary operators, all of which are their own inverses.

[0214] Therefore, applying this operator twice is equivalent to doing nothing. These operators correspond to “Booleanized” quantum operations; for example, the Pauli gates X, Y, Z and the controlled NOT gate CX are typical quantum Boolean functions.

[0215] Definition 8: Controlled Quantum Boolean Function (CQBF).

[0216] Let p, q, and t be three quantum registers. If the following conditions are satisfied, then U is called a CQBF[p]{q}(t): 1. QBF and bracket forms.

[0217] U is a quantum Boolean function and has the form [p, q](t) in square brackets.

[0218] 2. Controlled conditions.

[0219] There exists a computational ground state q. When the value of register q is not When q = , the operator U acts as the identity operator on the destination register t, only if q = Only when it has a non-trivial effect on t.

[0220] CQBF is a "conditional" quantum Boolean function that operates only when the control register q is in a specific ground state. Only when the time is right will a nontrivial transformation be performed on the target register t. This restricts the effect of the quantum Boolean function to specific conditions, thereby enabling complex quantum logic reasoning.

[0221] In practical engineering applications, it can be Based on this, the syntax can be further expanded to form a more practical quantum programming language that supports automatic inverse calculation of auxiliary qubits; it can also be used to... This extends to the compiler intermediate representation (IR) or the backend target language. Based on the template mechanism of this invention, the compilation process can automatically construct inverse computation circuits and automatically check the correctness of template usage according to the static inference rules. Furthermore, the automated checking mechanism of this invention can be extended by introducing additional rules, type annotations, or constraint checking rules.

[0222] The inverse computing device for auxiliary qubits provided by the present invention will be described below. The inverse computing device for auxiliary qubits described below and the inverse computing method for auxiliary qubits described above can be referred to in correspondence with each other.

[0223] Figure 4 This is a schematic diagram of the structure of the inverse computing device for auxiliary qubits provided by the present invention. Figure 4 As shown, the inverse computing device for the auxiliary qubit includes the following modules: The statement acquisition module 210 is used to acquire a quantum circuit program, which includes borrowing statements. The borrowing statements are used to declare the borrowing of auxiliary qubits. The categories of the borrowing statements include clean borrowing statements and dirty borrowing statements. The circuit verification module 220 is used to determine, based on a predefined reasoning system, whether the sub-circuit corresponding to the borrowed statement satisfies the constraint conditions of the auxiliary qubit template corresponding to the category of the borrowed statement. The reasoning system includes formal reasoning rules for determining the semantic attributes of the circuit, which are used to deduce the properties of the sub-circuit. The bit restoration module 230 is used to, if the above-mentioned constraints are met, synthesize an inverse computing circuit according to the inverse computing structure predefined by the auxiliary qubit template corresponding to the category of the borrowed statement, based on the category of the borrowed statement, and use the inverse computing circuit to complete the restoration of the auxiliary qubit.

[0224] In some embodiments, the reasoning system includes a reasoning context and a set of reasoning rules; The reasoning context is used to record the proven circuit semantic attributes; The inference rule set includes one or more of the following inference rules: bracket inference rules, quantum-independent operation inference rules, quantum Boolean function inference rules, controlled quantum Boolean function inference rules, obelisk bracket inference rules, and commutativity inference rules.

[0225] In some embodiments, the borrowing statement includes a clean borrowing statement, and the auxiliary qubit template corresponding to the clean borrowing statement includes a first storage stage circuit and a first usage stage circuit; The first storage stage circuit has a bracketed form with respect to the working register and the auxiliary register, and is quantum independent of the auxiliary register; The first usage stage circuit has square brackets for the working register, auxiliary register, and destination register; The inverse computing circuit is the inverse circuit of the first storage stage circuit.

[0226] In some embodiments, the borrowing statement includes a dirty borrowing statement, and the auxiliary qubit template corresponding to the dirty borrowing statement includes a second storage stage circuit and a second use stage circuit; The second storage stage circuit has a bracketed form with respect to the working register and the auxiliary register, and is quantum independent of the auxiliary register; The second stage circuit has obelisk brackets for the working register, auxiliary register, and destination register; The inverse computing circuit is composed of the second usage stage circuit, the second storage stage circuit, and the inverse circuit of the second usage stage circuit and the second storage stage circuit in sequence.

[0227] In some embodiments, it also includes: The circuit forming module is used to gradually move the gates targeting the auxiliary qubits to the right and gather them at the end of the circuit by applying the circuit equivalence transformation rule to form a normalized circuit. The circuit equivalence transformation rule is used to exchange the order of the gates targeting the auxiliary qubits and the gates operating on the working bits in a local range, and the circuit remains unitary equivalence before and after the exchange. The dirty auxiliary bit conversion module is used to delete all gates involving auxiliary qubits in the normalized circuit after the quantum circuit program has completed the inverse calculation of the clean auxiliary bits and formed a normalized form, so as to obtain the dirty auxiliary bit circuit corresponding to the quantum circuit program.

[0228] In some embodiments, the predefined inference system employs a recursive verification method: When deriving the properties of a sub-circuit of the current borrowed statement, if the sub-circuit contains nested borrowed statements, the correctness of the nested borrowed statements is verified first, and then the correctness of the current borrowed statement is verified.

[0229] In some embodiments, the bit restoration module 230 is specifically used for: Starting from the innermost borrow statement, the borrow statements are replaced with the corresponding atomic circuit fragments and their matching inverse computation fragments according to the borrow type; Processing the nested structure layer by layer from the inside out until the outermost layer uses a borrowed statement to complete the replacement, thus obtaining the target circuit that completes the restoration of the auxiliary qubits.

[0230] Figure 5 This is a schematic diagram of the physical structure of the electronic device provided by the present invention. For example... Figure 5 As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330, and a communication bus 340, wherein the processor 310, the communication interface 320, and the memory 330 communicate with each other via the communication bus 340. The processor 310 can call logical instructions in the memory 330 to execute an inverse computation method for auxiliary qubits, the method including: A quantum circuit program is obtained, the quantum circuit program including borrow statements, the borrow statements being used to declare the borrowing of auxiliary qubits, the types of the borrow statements including clean borrow statements and dirty borrow statements; Based on a predefined reasoning system, it is determined whether the sub-circuit corresponding to the borrowed statement satisfies the constraint conditions of the auxiliary qubit template corresponding to the category of the borrowed statement. The reasoning system includes formal reasoning rules for determining the semantic attributes of the circuit, which are used to derive the properties of the sub-circuit. If the aforementioned constraints are met, an inverse computing circuit is synthesized according to the category of the borrowed statement and the inverse computing structure predefined by the auxiliary qubit template corresponding to the category of the borrowed statement, and the restoration of the auxiliary qubit is completed using the inverse computing circuit.

[0231] Furthermore, the logical instructions in the aforementioned memory 330 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0232] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program that can be stored on a non-transitory computer-readable storage medium, wherein when the computer program is executed by a processor, the computer is capable of executing the inverse calculation method for auxiliary qubits provided by the above methods, the method comprising: A quantum circuit program is obtained, the quantum circuit program including borrow statements, the borrow statements being used to declare the borrowing of auxiliary qubits, the types of the borrow statements including clean borrow statements and dirty borrow statements; Based on a predefined reasoning system, it is determined whether the sub-circuit corresponding to the borrowed statement satisfies the constraint conditions of the auxiliary qubit template corresponding to the category of the borrowed statement. The reasoning system includes formal reasoning rules for determining the semantic attributes of the circuit, which are used to derive the properties of the sub-circuit. If the aforementioned constraints are met, an inverse computing circuit is synthesized according to the category of the borrowed statement and the inverse computing structure predefined by the auxiliary qubit template corresponding to the category of the borrowed statement, and the restoration of the auxiliary qubit is completed using the inverse computing circuit.

[0233] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements an inverse computation method for auxiliary qubits provided by the methods described above, the method comprising: A quantum circuit program is obtained, the quantum circuit program including borrow statements, the borrow statements being used to declare the borrowing of auxiliary qubits, the types of the borrow statements including clean borrow statements and dirty borrow statements; Based on a predefined reasoning system, it is determined whether the sub-circuit corresponding to the borrowed statement satisfies the constraint conditions of the auxiliary qubit template corresponding to the category of the borrowed statement. The reasoning system includes formal reasoning rules for determining the semantic attributes of the circuit, which are used to derive the properties of the sub-circuit. If the aforementioned constraints are met, an inverse computing circuit is synthesized according to the category of the borrowed statement and the inverse computing structure predefined by the auxiliary qubit template corresponding to the category of the borrowed statement, and the restoration of the auxiliary qubit is completed using the inverse computing circuit.

[0234] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0235] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0236] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for inverse computation of auxiliary qubits, characterized in that, include: A quantum circuit program is obtained, the quantum circuit program including borrow statements, the borrow statements being used to declare the borrowing of auxiliary qubits, the types of the borrow statements including clean borrow statements and dirty borrow statements; Based on a predefined reasoning system, it is determined whether the sub-circuit corresponding to the borrowed statement satisfies the constraint conditions of the auxiliary qubit template corresponding to the category of the borrowed statement. The reasoning system includes formal reasoning rules for determining the semantic attributes of the circuit, which are used to derive the properties of the sub-circuit. If the aforementioned constraints are met, an inverse computing circuit is synthesized according to the category of the borrowed statement and the inverse computing structure predefined by the auxiliary qubit template corresponding to the category of the borrowed statement, and the restoration of the auxiliary qubit is completed using the inverse computing circuit.

2. The method according to claim 1, characterized in that, The reasoning system includes a reasoning context and a set of reasoning rules; The reasoning context is used to record the proven circuit semantic attributes; The inference rule set includes one or more of the following inference rules: bracket inference rules, quantum-independent operation inference rules, quantum Boolean function inference rules, controlled quantum Boolean function inference rules, obelisk bracket inference rules, and commutativity inference rules.

3. The method according to claim 1, characterized in that, The borrowing statement includes a clean borrowing statement, and the auxiliary qubit template corresponding to the clean borrowing statement includes a first storage stage circuit and a first usage stage circuit; The first storage stage circuit has a bracketed form with respect to the working register and the auxiliary register, and is quantum independent of the auxiliary register; The first usage stage circuit has square brackets for the working register, auxiliary register, and destination register; The inverse computing circuit is the inverse circuit of the first storage stage circuit.

4. The method according to claim 1, characterized in that, The borrowing statement includes a dirty borrowing statement, and the auxiliary qubit template corresponding to the dirty borrowing statement includes a second storage stage circuit and a second usage stage circuit. The second storage stage circuit has a bracketed form with respect to the working register and the auxiliary register, and is quantum independent of the auxiliary register; The second stage circuit has obelisk brackets for the working register, auxiliary register, and destination register; The inverse computing circuit is composed of the second usage stage circuit, the second storage stage circuit, and the inverse circuit of the second usage stage circuit and the second storage stage circuit in sequence.

5. The method according to claim 1, characterized in that, Also includes: By applying the circuit equivalence transformation rule, the gates targeting the auxiliary qubits are gradually moved to the right and clustered at the end of the circuit to form a normalized circuit. The circuit equivalence transformation rule is used to exchange the order of the gates targeting the auxiliary qubits and the gates operating on the working bits in a local range, and the circuit remains unitarily equivalent before and after the exchange. Once the quantum circuit program has completed the inverse calculation of the clean auxiliary bits and formed a normalized form, all gates involving auxiliary bits in the normalized form of the circuit are deleted to obtain the dirty auxiliary bit circuit corresponding to the quantum circuit program.

6. The method according to claim 1, characterized in that, The predefined reasoning system employs a recursive verification method: When deriving the properties of a sub-circuit of the current borrowed statement, if the sub-circuit contains nested borrowed statements, the correctness of the nested borrowed statements is verified first, and then the correctness of the current borrowed statement is verified.

7. The method according to claim 1, characterized in that, The step of synthesizing an inverse computing circuit according to the category of the borrowed statement and a predefined inverse computing structure based on the auxiliary qubit template corresponding to the category of the borrowed statement, and using the inverse computing circuit to restore the auxiliary qubit, includes: Starting from the innermost borrow statement, the borrow statements are replaced with the corresponding atomic circuit fragments and their matching inverse computation fragments according to the borrow type; Processing the nested structure layer by layer from the inside out until the outermost layer uses a borrowed statement to complete the replacement, thus obtaining the target circuit that completes the restoration of the auxiliary qubits.

8. An inverse computing device with auxiliary qubits, characterized in that, include: The statement acquisition module is used to acquire quantum circuit programs, which include borrow statements. The borrow statements are used to declare the borrowing of auxiliary qubits. The categories of borrow statements include clean borrow statements and dirty borrow statements. The circuit verification module is used to determine, based on a predefined reasoning system, whether the sub-circuit corresponding to the borrowed statement satisfies the constraint conditions of the auxiliary qubit template corresponding to the category of the borrowed statement. The reasoning system includes formal reasoning rules for determining the semantic attributes of the circuit, which are used to deduce the properties of the sub-circuit. The bit restoration module is used to, if the above-mentioned constraints are met, synthesize an inverse computing circuit according to the inverse computing structure predefined by the auxiliary qubit template corresponding to the category of the borrowed statement, based on the category of the borrowed statement, and use the inverse computing circuit to restore the auxiliary qubit.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the inverse computation method for the auxiliary qubit as described in any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the inverse computation method for the auxiliary qubit as described in any one of claims 1 to 7.