Method and system for promoting self-confidence verification by using isomorphism in quantum program

By defining tracking points and assumption-guarantee assertions in quantum programs and leveraging the isomorphism of quantum programs to construct approximate functions, the problems of insufficient confidence and efficiency in quantum program verification in existing technologies are solved, and efficient and confident quantum program verification is achieved.

WO2025213925A1PCT designated stage Publication Date: 2025-10-16ZHEJIANG UNIV
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/072924
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-04-09
Filing Date
2025-01-17
Publication Date
2025-10-16

AI Technical Summary

Technical Problem

Existing quantum program verification methods have deficiencies in confidence and efficiency, and are unable to effectively verify the overall correctness of quantum programs, especially because the superposition state expands the error search space and cannot effectively utilize input independent verification.

Method used

By defining tracking points and assumption-guarantee assertions, the isomorphism of quantum programs is used to construct approximate functions, which are packaged into constrained maximization problems for global search and solution to verify the correctness of quantum programs.

Benefits of technology

It improves the confidence and efficiency of quantum program verification, reduces the number of program executions, can output counterexamples and estimate the confidence of verification, and achieves confident verification results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025072924_16102025_PF_FP_ABST
    Figure CN2025072924_16102025_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the present invention are a method and system for promoting self-confidence verification by using the isomorphism in a quantum program. The method comprises: assertion statement: defining trace points, marking qubit states of a quantum program at different times by means of the trace points, and defining an assume-guarantee assertion to specify a range of single-qubit states and a relationship between multi-qubit states; program analysis: according to the quantum evolution isomorphism, constructing an approximation function of a real relationship between an input qubit state and qubit states of the trace points; and assertion verification: packaging the assume-guarantee assertion in the quantum program and the constructed approximation function into a constraint maximization problem, and performing global search and solving to verify the correctness of the quantum program. Thus, the present invention solves the problem that existing assertion methods present low confidence in verifying the overall correctness of quantum programs.
Need to check novelty before this filing date? Find Prior Art

Description

A method and system for promoting confident verification using isomorphism in quantum programs TECHNICAL FIELD

[0001] The present invention belongs to the technical field of quantum computing, and specifically relates to a method and system for promoting confident verification using isomorphism in quantum programs. BACKGROUND

[0002] Quantum computing is a promising technology that can achieve low power consumption and low computational complexity. A quantum program is composed of a series of quantum instructions that utilize quantum superposition and entanglement to accelerate computation. Similar to classical programs, quantum programs inevitably have many computational defects. Therefore, there is strong motivation to develop advanced verification tools to debug quantum programs. However, the inherent mechanisms of quantum computing hinder the verification of quantum programs. Specifically, superposition expands the search space of errors, while non-replicability leads to a large number of program executions to probe program states.

[0003] Quantum program verification (QPV) is mainly performed through deductive verification and runtime assertions. Deductive verification relies on a strict formulation of program behavior, the correctness of which can be compiled into a set of verification conditions. However, the reasoning about correctness relies on: (1) resolving verification conditions through classical computers, thus suffering from significant computational cost; (2) human expertise, such as finding inductive invariants, which limits the degree of automation. On the other hand, runtime assertions are a lightweight approach to testing programs under different inputs. An assertion is defined as a predicate on a property of the program state that should be true if there is no error. The assertion is verified in three steps: a) assertion statement; b) program analysis; c) assertion verification, checking whether the analysis result satisfies the assertion predicate.

[0004] Confidence is a key indicator for evaluating QPV, defined as the probability that the verification result holds for all inputs. Existing assertion works exhibit low confidence in verifying the overall correctness of the program. This limitation stems from their verification of assertions under a small number of test inputs, which cannot generalize the verification result to the entire input space. To improve confidence, some works perform exhaustive testing on a large number of inputs to cover the search space, but this is still insufficient considering the continuous Hilbert space.

[0005] Fundamentally, the implementation of current assertion methods cannot support the following limitations of each step with input-independent verification:

[0006] a) Assertion statements. Current assertions only include the predicate of a single program state and cannot check the relationship between states at different points in time. For example, the assertions of Li et al. and Liu et al. only check whether the qubit is in a specified set of states. This state set must be re-asserted for different inputs. b) Program analysis. Current techniques cannot characterize the relationship between states, resulting in the need to repeatedly test the execution of the program under each input. Furthermore, due to quantum collapse after measurement, they can only detect limited features of the state. c) Verification model. Current methods cannot aggregate the results of various test inputs for overall verification. Summary of the Invention

[0007] In view of the above, an object of the present invention is to provide a method and system for utilizing the isomorphism in quantum programs to promote confident verification, thereby improving the confidence level of quantum program verification.

[0008] To achieve the above-mentioned object of the invention, an embodiment provides a method for utilizing isomorphism in quantum programs to facilitate confident verification, characterized by comprising the following steps:

[0009] Assertion statements: Define tracking points and use them to mark the quantum bit states of the quantum program at different times. Define assumption-guarantee assertions to specify the range of single quantum bit states and the relationship between multi-quantum quantum bit states.

[0010] Program analysis: Based on quantum evolution isomorphism, an approximate function is constructed to describe the true relationship between the input qubit state and the qubit state of the tracking point;

[0011] Assertion verification: Package the assumption-guarantee assertions in the quantum program and the constructed approximation function into a constrained maximization problem for global search and solution to verify the correctness of the quantum program.

[0012] Preferably, each tracking point is defined to record time and qubits, and a tag is edited to label the qubit state in the quantum program.

[0013] Preferably, defining assumption-guarantee assertions to specify the range of single-qubit states and the relationship between multi-qubit states includes:

[0014] Through a predicate P k To describe the range of single quantum bit states, the predicate P k is an inequality or objective function that takes as input a single density matrix representing the qubit state if and only if the predicate P k When true, the objective function satisfies P k ≤0;

[0015] Through another predicate P sto describe the relationship between the plurality of quantum bit states, the predicate P s is an inequality or objective function taking as input a plurality of density matrices representing quantum bit states, when a plurality of single quantum bit states satisfy respective predicates P k , the relationship between the plurality of quantum bit states should satisfy the predicate P s .

[0016] Preferably, the constructing process of the approximation function is:

[0017] The input quantum bit state ρ in is represented as a linear combination of sampling inputs, i.e. ρ in =∑ i α i σ in,i , σ in,i denotes the i-th sampling input quantum bit state, and α i is a real value to be solved;

[0018] Based on the quantum evolution isomorphism and the parameter α i , the approximation function F between the quantum bit state ρ T of the tracing point and the input quantum bit state is constructed as:

[0019] σ T,i denotes the i-th sampling tracing point quantum bit state.

[0020] Preferably, the method further comprises: case one: for the sampling input that can be decomposed as ρ in =∑ i α i σ in,i , the accuracy of the quantum bit state of the tracing point solved by constructing the approximation function is 100%; case two: for the sampling input that cannot be decomposed as ρ in =∑ i α i σ in,i , the average accuracy of the quantum bit state of the tracing point is where N sample is the number of sampling inputs, and N in is the number of quantum bits of the program input;

[0021] When constructing the approximation function, the accuracy of solving the quantum bit state of the tracing point by the approximation function is improved by increasing the number of sampling inputs. Preferably, for case one, an exponential sampling method is used to increase the sampling input, and for case two, a linear increase method is used to increase the sampling input.

[0022] Preferably, when constructing the approximation function, the following three strategies are used for sampling input;

[0023] Strategy one: customizing the sampling input, including: applying feature decomposition to the sample data, and selecting the top K eigenvectors with large eigenvalues as the sampling input based on the feature decomposition screening;

[0024] Strategy two: setting part of the input quantum bit state as a constant;

[0025] Strategy three: checking a single property instead of the entire density function corresponding to the quantum bit state, wherein the single property is a property that satisfies the quantum evolution isomorphism and needs to be asserted and verified.

[0026] Preferably, the hypothesis-guarantee assertion in the quantum program is packaged with the constructed approximation function into a constraint maximization problem to perform global search and solution to verify the correctness of the quantum program, including:

[0027] The approximation function is brought into the hypothesis-guarantee assertion, and the hypothesis-guarantee assertion is converted into a constraint optimization problem, and the parameter a in the approximation function is solved by direct optimization i to find the maximum value that makes the hypothesis-guarantee assertion true, and if it can be found, the hypothesis-guarantee assertion is true, and the quantum program is correct.

[0028] Preferably, it also includes: when the quantum program verification is incorrect, the input quantum bit state is the counterexample that causes the error;

[0029] When the quantum program verification is correct, the confidence is estimated according to the accuracy of the analysis acc represents the accuracy, ∈ represents the accuracy threshold, P(acc<∈) represents the probability distribution of acc<∈, and N c-e represents the number of counterexamples.

[0030] To achieve the above-mentioned purposes, the embodiment also provides a system for promoting confident verification by using isomorphism in a quantum program, including:

[0031] An assertion statement module is configured to define a trace point and mark the quantum bit state of the quantum program at different times through the trace point, define a hypothesis-guarantee assertion to specify the range of single quantum bit state and the relationship between multiple quantum bit states, and define a hypothesis-guarantee assertion to specify the range of single quantum bit state and the relationship between multiple quantum bit states.

[0032] Program analysis is configured to construct an approximation function of the real relationship between the input quantum bit state and the quantum bit state of the trace point according to the quantum evolution isomorphism;

[0033] The assertion verification is configured to package the hypothesis-guarantee assertion in the quantum program with the constructed approximation function into a constraint maximization problem to perform global search and solution to verify the correctness of the quantum program.

[0034] To achieve the above object, the embodiment further provides a computing device, comprising a memory and one or more processors, the memory stores executable codes, and the one or more processors execute the executable codes to implement the method for promoting self-confidence verification by utilizing isomorphism in a quantum program.

[0035] Compared with the prior art, the present application has the beneficial effects at least including:

[0036] The method can promote reliable verification based on assertions. The multi-state assertion proposed is used to describe the relationship between a series of quantum states at different time points, which improves the efficiency and expressiveness of program verification. The approximation technique proposed is used to calculate the runtime state without executing the program. This approximation captures the program behavior at a relatively small computational cost. The input-independent verification method proposed is used for assertions, which can output counterexamples and estimate the confidence of verification. BRIEF DESCRIPTION OF DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description only constitute some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creative labor.

[0038] Figure 1 is an example diagram of the limitations of the assertion method in the prior art in verifying quantum programs;

[0039] Figure 2 is a flowchart of the method of the present application provided by the embodiment;

[0040] Figure 3 is a flowchart of the method of the present application provided by the embodiment;

[0041] Figure 4 is an example of quantum transmission in the assertion statement in the method of the present application provided by the embodiment;

[0042] Figure 5 is a visualization example of a single-qubit program in the method of the present application provided by the embodiment;

[0043] Figure 6 is a structural diagram of the system of the present application provided by the embodiment. DETAILED DESCRIPTION

[0044] In order to make the object, technical solutions and advantages of the present application more clear, the present application will be further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and do not limit the protection scope of the present application.

[0045] In a quantum program, information is encoded in the states of qubits. For an n-qubit system, its quantum state is precisely described by a density matrix p. The quantum state can be classified as pure or mixed. The density matrix p of a mixed state is a linear combination of pure state density matrices, denoted as p = ∑ i p i |ψ i ><ψ i |. Where p i is the probability, p i |ψ i ><ψ i | is the density matrix of a pure state. All properties of a quantum state can be analyzed from its density matrix. The quantum state in this invention is also denoted as a density matrix.

[0046] Figure 1(a) illustrates a quantum lock program to demonstrate the limitations of the existing assertion methods described in the background technology in quantum program verification. The quantum lock is used as an important module to encrypt the output of a quantum program, which encodes a binary key, for example, 001 in Figure 1(a). The program will only output |1> if the input equals the key, i.e., 001 → |1>, and others → |0>. The error in the program refers to an unexpected key 110 in the program. When there is an error, the program will also output |1> when inputting this key, i.e., 110 → |1>. In the process of assertion specification, the current work needs to make different assertions (output = |1> and output = |0>) for different inputs (key and others). In the analysis, these works will exhaustively test the inputs until the unexpected key is found. In verification, they cannot generalize the execution results of some inputs to other inputs. For example, they cannot use the results of inputs 010 and 101 to verify input 110. Figure 1(b) shows the confidence of the overall correctness of the method proposed by Liu et al. (Systematic approaches for precise and approximate quantum state runtime assertion). For a 15-qubit quantum lock program, the confidence is only 0.006%, and after one test, the confidence reaches 50% after testing 1.5 x 104 inputs.

[0047] Based on the above, existing assertion methods exhibit low confidence in verifying the overall correctness of quantum programs. This invention provides a confident verification method with minimal program execution. The key insight is to exploit program isomorphism, which indicates that the input and the program's runtime state maintain a structural relationship. Based on this isomorphism, the program's behavior under certain inputs can be used to describe its behavior under other inputs, which helps to extend the verification results to the entire input space. To achieve 100% confidence verification, the method of this invention is characterized by requiring only twice the effort of classical program verification, which is very impressive considering the exponentially increasing space of quantum states.

[0048] As shown in FIG2 , the method provided by the embodiment for utilizing isomorphism in quantum programs to facilitate confident verification includes the following steps:

[0049] S1, assertion statement: define tracking points and mark the quantum bit states of the quantum program at different times through tracking points, define assumption-guarantee assertions to specify the range of single quantum bit states and the relationship between multi-quantum qubit states.

[0050] This paper introduces assertions to specify the relationship between quantum bit states. Assertions are intended to describe the unified program behavior under various inputs. By defining trace points to mark the quantum bit states of a quantum program at different times, the quantum bit states marked by the trace points are then used to describe the expected program behavior. i is defined as the recording time and quantum bit, expressed as: T i ≡({Q i},time i ),Q i ∈Q (1)

[0051] Where Q is the set of quantum bits of the quantum program. i Is to obtain quantum bit Q i The density matrix The time required. Trace points are declared as compilation tags in the QASM language. Compilation tags label the quantum bit states in the quantum program. The specific compilation tag is defined as "T index q[qubits]". For example:

[0052] 1 hq[1]; / / add h gate to qubit 1;

[0053] 2 cx q[1],q[2]; / / add cx gate to qubit 1,2;

[0054] 3 T1 q[1,2]; / / Add tracking point T1 to qubits 1,2;

[0055] 4 cx q[2],q[3] / / Add cx gate to qubit 2,3;

[0056] At time 1 = 3, trace point T1 is inserted into the GHZ circuit.

[0057] The present invention defines an assumption-guarantee assertion using predicates to specify: a) the range of single-qubit states that are described by an objective function (e.g., and ); b) relationships between at least two qubit states, which are described as objective functions involving multiple qubit states (e.g., ). Specifically, the Assume-Guarantee assertion is defined as:

[0058] Among them, assert means assertion, assume means assumption, and guarantee means guarantee. The predicate P that describes the range of the state of a single quantum bit is k (·) is an inequality or objective function with a density matrix as input, and another predicate P describing the relationship between multiple quantum bit states s (·,·) is also an inequality or objective function that takes multiple density matrices representing the quantum bit states as input. k When true, the objective function satisfies P k ≤0. This assertion is intended to ensure that the program always satisfies the following conditions: and When predicates P1 and P2 are satisfied, they must also satisfy another predicate, P3. In other words, if there exists a state that satisfies P1 and P2 but violates P3, the assertion fails. The rules for predicates P1 and P2 are determined by the input format of the subsequent optimization-based verifier. The theoretical model of the present invention allows the use of predicates of arbitrary mathematical form because the density matrix of the asserted states is obtained on a classical computer.

[0059] The assertion definitions of the present invention are inspired by classical assumption-guaranteed assertions, which are used to identify deadlocks and concurrency anomalies in classically parallelized programs. Given that quantum programs are naturally parallel, the assertions of the present invention can describe in detail the amplitude transitions of the basis in the program. Furthermore, compared to classical assertions, the assumptions in the present invention are guaranteed conditions, which filters the input space that needs to be verified. This provides two advantages for debugging quantum programs. First, it makes it possible to debug programs with intermediate measurements, assuming that the asserted state is equal to the collapsed state after the measurement. Second, it helps prune the input space and optimize overhead. The present invention can use multiple assumption-guaranteed assertions to describe the functionality of the program in detail.

[0060] Figure 4 illustrates an example of quantum transmission to illustrate the assertion statement of the present invention. The desired of the transmission is to transfer the input state of q Alice to the output state of q Bob . The trace points T1 and T2 are injected to mark the input state and the output state. Using the notation in equation (1), T1 = ({q Alice}, 1), T2 = ({q Bob}, 10). The desired program behavior is that when both the input and the output are pure states, the input state is equal to the output state, denoted as:

[0061] S2, program analysis: construct an approximate function of the real relationship between the input quantum bit state and the quantum bit state of the trace point according to the quantum evolution isomorphism.

[0062] The present invention analyzes the real relationship between the states in the program by running the program on quantum hardware. The analysis starts from a single input sampling, and records the marked states under various inputs. By utilizing the quantum evolution isomorphism, and based on the sampling results, an approximate function (e.g. ) is constructed to represent the relationship between the input and the marked state.

[0063] Specifically, each trace point is introduced for analysis, and the analysis of each trace point aims to capture the real relationship between the program input ρ in and the state of the trace point during execution ρ T , which is formalized as an approximate function, i.e. ρ T = f(ρ in ).

[0064] The analysis starts from input sampling, which is used to initialize the approximate function, where the program is run under various inputs, and the trace point state is tomographic. These inputs are carefully designed to ensure high-precision representation. Specifically, the input states should be orthogonal and cover more eigenstates to maximize their changes. In addition, the desired input is easy to prepare. Based on this goal, circuits using the orthogonal Clifford group (Bravyi S, Maslov D. Hadamard-free circuits expose the structure of the Clifford group [J]. IEEE Transactions on Information Theory, 2021, 67(7): 4546-4563.) are used to prepare these inputs.

[0065] The quantum evolution in the quantum program is isomorphic, so it has additivity and homogeneity. The present invention uses this quantum evolution isomorphism to construct the approximation function. Specifically, in the program, ρ inand ρ T The true relationship between has the following properties. The input qubit state ρ in Expressed as a linear combination of sampled inputs, namely: ρ in =∑ i α i σ in,i (4)

[0066] The parameter α i is a real value, the tracking point state ρ under this input T Expressed as: ρ T =∑ i α i σ T,i (5)

[0067] This is because for the function F(ρ in )=ρ T The actual relationship is: F(ρ in )=F(∑ i α i σ in,i )=∑ i α i F(σ in,i )=∑ i α i σ T,i =ρ T (6)

[0068] This comes from additivity and homogeneity. Since these two states are collected from real program execution, F(σ in,i )=σ T,i is correct.

[0069] Based on this relationship, all possible inputs to the program can be divided into two parts. The first part includes inputs that can be decomposed into equation (4). The tracking point state at these inputs is accurately calculated by equation (5). The second part includes inputs that cannot be decomposed. However, the present invention can approximate them by equation (4). The tracking point state under these inputs can be approximated by equation (5). In general, the following function can be constructed to obtain the approximate tracking point state for any input.

[0070] Theorem 1 (approximate function): Function ρ T =f(ρ in ) is the input ρ in and tracking point state ρ T An under-approximation of the true relationship between . This approximate function is calculated in two steps:

[0071] 1. For input ρ in , first approximate ρ by equation (4)in to obtain parameters {a i};

[0072] 2. Then use parameters {a i} to output the state of the witness point p T by equation 5.

[0073] Note that parameters a i are mathematically equal to the expected value of the input s in,i on the input p in .

[0074] This approximation can be applied to programs with inputs and witness points that do not share non-overlapping qubits. The approximation also applies to programs with intermediate measurements and simple feedback, where the relationship of the qubit states is not homomorphic.

[0075] Figure 5 shows a visual example of a single-qubit program. In the input sample, three orthogonal input states s in,1 = |+> (on the x-axis of the Bloch sphere), s in,2 = |+i> (on the y-axis), and s in,3 = |1> (on the z-axis) are performed. The witness point states are recorded as s T,1 , s T,2 , and s T,3 . Given an input state p in , the first step is to approximate according to equation (4): p in = a1|+> + a2|+i> + a3|1> (7) a1 = E |+> [ p in ], a2 = E |+i> [ p in ], a3 = E |1 [ p in ] (8)

[0076] In the second step, the witness point state under this input is calculated according to equation (5): p T = a1s T,1 + a2s T,2 + a3s T,3 (9)

[0077] Note that in this example, the approximation of the input state and the witness point state has 100% accuracy, because the input can be exactly represented by equation 4.

[0078] The approximation error occurs when the input cannot be decomposed into a linear combination of sampled inputs. More samples ensure that there are fewer un-covered eigenstates in the sampled inputs, thus improving the accuracy. The present invention quantitatively analyzes this trade-off. Specifically, the approximation accuracy depends on the number of bits N in of the state sample .

[0079] Theorem 2 (Approximation accuracy): For different sampled inputs, there are two cases:

[0080] 1. For sampled inputs that can be exactly represented as equation (4), the accuracy of the quantum bit state of the traced point solved by constructing the approximation function is 100%;

[0081] 2. For sampled inputs with eigenstates that cannot be represented by equation (4), the average accuracy of the quantum bit state of the traced point is

[0082] When the number of samples , the approximation accuracy is 100% for any input. In other words, the trace point state of the approximation is always the same as the tomography. Here, the accuracy acc is defined as the Hilbert-Schmidt inner product between the approximate T and the true T obtained by executing the quantum program.

[0083] Theorem 2 shows that the inaccuracy comes from the space that cannot be represented by the sampled input (equation (4)). By increasing the number of sampled inputs N sample to improve the accuracy of the quantum bit state of the traced point solved by the approximation function, the space of case 1 can be exponentially increased, and the accuracy of case 2 can be linearly increased. Case 1 is the most accurate. For case 2, when an error occurs, the incorrect state usually has a significant difference from the expected state and can be identified with a certain accuracy threshold.

[0084] The accuracy of the approximation increases linearly with the number of sampled inputs. The present invention further proposes three strategies to prune the sample space during the analysis process.

[0085] Strategy 1 (Adaptive): adaptively determine the sampled input. The input of the program is usually a subspace of the entire quantum state, which can be represented by fewer orthogonal states. The present invention can reduce the number of sampled inputs by performing eigenvalue decomposition on the input space. The sampling only uses the eigenvectors with large eigenvalues as the input of the program. For example, when verifying a 5-qubit quantum neural network program for classifying handwritten digits, the present invention can apply eigenvalue decomposition to the training data set and use the first K eigenvectors with large eigenvalues as the sampled input.

[0086] Strategy two (constant): Set a part of the input state to be constant. The input of a program can consist of multiple parts of qubits representing different data. The invention can set the state of certain input qubits to be constant to reduce the size of the input space. For example, the quantum adder program has two-part input |x> and |y> represented as f(|x>, |y>) = |x+y> (e.g., f(|01>, |10>) = |11>). By keeping |x> constant, the sample space is pruned and focused on verifying the program at different |y> states.

[0087] Strategy three (property): Check a single property instead of the entire density matrix corresponding to the state of qubits. Usually, only a limited number of properties (e.g., probability distribution, expectation value, and purity) of the state are checked, which also satisfy additivity and homogeneity. The invention can reduce the complexity of tomography by only measuring the specific property verified in the assertion, i.e., the single property checked is the one that satisfies the isomorphism of quantum evolution and the property that needs to be verified in the assertion.

[0088] S3, package the hypothesis-guarantee assertion in the quantum program and the constructed approximation function into a constraint maximization problem to perform global search and solve to verify the correctness of the quantum program.

[0089] The invention verifies the assertion without specifying the test input. It formulates the characteristic relationship between the assertion and the state as a constraint optimization problem. When an error is found, the verification can provide a counterexample, or estimate the confidence when the program is correct.

[0090] For the assertion assert(T1, T2), an optimization-based method is used to verify the assertion. That is, check if the represented function (e.g. ) satisfies the predicate of the assertion. If not, the verification model will output a counterexample that causes the assertion to fail.

[0091] According to the definition of the hypothesis-guarantee assertion, the predicate P k is defined as an inequality or objective function. The inequality can also be converted into an objective function. The objective function satisfies P k <0 when and only when the predicate is true. Therefore, the assertion verification is converted into a constraint optimization problem:

[0092] where P3 is the guarantee, and P1, P2 are the hypotheses. Replace and with the approximation function and to check if the runtime state satisfies the assertion:

[0093] Since ρ in In the approximation function, the parameters {α i} are represented. Directly optimize {α i} to find the maximum value. The correctness of the assertion is equivalent to:

[0094] This optimization problem can be effectively solved by the current most advanced optimizers, such as stochastic gradient descent, genetic algorithms, and quadratic programming.

[0095] The approximation accuracy may not be sufficient to distinguish errors in edge cases, making the verification result invalid for all inputs of the program. This inaccuracy can be mitigated by sampling more inputs. The present invention proposes a quantitative method to analyze the relationship between confidence and sample size, which helps programmers estimate the additional overhead required to achieve the desired confidence.

[0096] The confidence is mainly determined by the approximation accuracy and the accuracy threshold ∈ defined as the identification of counterexamples. The confidence measures the probability that the verification result is valid for all inputs. Conversely, 1-confidence is the probability that there is at least one counterexample that has not been identified because their approximation accuracy is less than the accuracy threshold ∈.

[0097] Theorem 3 (Confidence). When the verification does not occur counterexample, the confidence of the program correctness is:

[0098] confidence = 1 - P(acc < ∈) (13)

[0099] In general, we assume here that the program has only one counterexample to simplify the estimation. A faulty program usually has more counterexamples. Therefore, the true confidence is higher because it is equal to the probability that the accuracy of all these counterexamples is below the threshold, i.e. N c-e is the number of counterexamples. Therefore, the present invention provides a lower bound estimate of the confidence.

[0100] Experiments using the above method show that when verifying a quantum lock algorithm with 27 qubits, MorphQPV reduces the number of program executions by 107.9 times, and the success probability increases by 3.3 to 9.9 times when debugging five benchmark tests.

[0101] As shown in FIG. 6, the application also provides a system 60 for facilitating confident verification by exploiting isomorphism in quantum programs, comprising: an assertion statement module 61, a program analysis module 62, and an assertion verification module 63, wherein the assertion statement module 61 is configured to define trace points and mark quantum bit states of the quantum program at different times through the trace points, define hypothesis-guarantee assertions to specify ranges of single quantum bit states and relationships between multiple quantum bit states; the program analysis module 62 is configured to construct an approximation function of real relationships between input quantum bit states and quantum bit states of the trace points according to quantum evolution isomorphism; and the assertion verification module 63 is configured to pack the hypothesis-guarantee assertions in the quantum program and the constructed approximation function into a constraint maximization problem to perform global search and solution to verify correctness of the quantum program.

[0102] It should be noted that the system provided by the above embodiments should be illustrated by the division of the above functional modules when performing program verification, and the above functions can be completed by different functional modules according to needs, i.e., the internal structure of the terminal or server is divided into different functional modules to complete all or part of the above described functions. In addition, the system provided by the above embodiments and the method embodiments of the application belong to the same concept, and the specific implementation process is detailed in the method embodiments of the application, which will not be repeated here.

[0103] Based on the same inventive concept, the embodiments also provide a computing device comprising a memory and one or more processors, the memory storing executable code, and the one or more processors executing the executable code to implement a method for facilitating confident verification by exploiting isomorphism in quantum programs, specifically comprising the following steps:

[0104] S1, assertion statement: defining trace points and marking quantum bit states of the quantum program at different times through the trace points, and defining hypothesis-guarantee assertions to specify ranges of single quantum bit states and relationships between multiple quantum bit states;

[0105] S2, program analysis: constructing an approximation function of real relationships between input quantum bit states and quantum bit states of the trace points according to quantum evolution isomorphism;

[0106] S3, assertion verification: packing the hypothesis-guarantee assertions in the quantum program and the constructed approximation function into a constraint maximization problem to perform global search and solution to verify correctness of the quantum program.

[0107] The computing device provided by the embodiment comprises, in addition to the processor and the memory, internal buses, network interfaces, memories and other hardware required by the business. The memory is a non-volatile memory, and the processor reads the corresponding computer program from the non-volatile memory into the memory and then runs to realize the program verification method described in S1-S3. Of course, in addition to the software implementation, the present application does not exclude other implementation manners, such as logic devices or the combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0108] The above detailed description of the specific embodiments of the present application has described the technical solutions and beneficial effects of the present application. It should be understood that the above description is only the most preferred embodiment of the present application and is not intended to limit the present application. Any modification, supplement and equivalent replacement within the principle range of the present application shall be included in the protection scope of the present application.

Claims

1. A method for exploiting isomorphism in quantum programs to facilitate confident verification, characterized in that The following steps are involved: Assertion statements: Define tracking points and use them to mark the quantum bit states of the quantum program at different times. Define assumption-guarantee assertions to specify the range of single quantum bit states and the relationship between multi-quantum quantum bit states. Program analysis: Based on quantum evolution isomorphism, an approximate function is constructed to describe the true relationship between the input qubit state and the qubit state of the tracking point; Assertion verification: Package the assumption-guarantee assertions in the quantum program and the constructed approximation function into a constrained maximization problem for global search and solution to verify the correctness of the quantum program.

2. The method of utilizing isomorphism in quantum programs to facilitate confident verification according to claim 1, characterized in that Each tracking point is defined to record time and qubits, and the qubit state in the quantum program is labeled by editing tags.

3. The method of utilizing isomorphism in quantum programs to facilitate confident verification according to claim 1, characterized in that Define assumptions-guaranteed assertions to specify the range of single-qubit states and the relationships between multi-qubit states, including: Through a predicate P k To describe the range of single quantum bit states, the predicate P k is an inequality or objective function that takes as input a single density matrix representing the qubit state if and only if the predicate P k When true, the objective function satisfies P k ≤0; Through another predicate P s To describe the relationship between multiple quantum bit states, the predicate P s is an inequality or objective function that takes multiple density matrices representing quantum bit states as input. When multiple single quantum bit states satisfy their respective predicates P k When the relationship between the states of multiple quantum bits should satisfy the predicate P s .

4. The method of claim 1, wherein: The construction process of the approximate function is: Input qubit state ρ in Expressed as a linear combination of sampled inputs, ρ in =∑ i α i σ in,i , σ in,i represents the quantum bit state of the i-th sample input, α i is the real value to be solved; Based on the quantum evolution isomorphism and parameter α i , construct the quantum bit state ρ of the tracking point T The approximate function F between the state of the input quantum bit is: σ T,i Represents the quantum bit state of the i-th sampling tracking point.

5. The method of utilizing isomorphism in quantum programs to facilitate confident verification according to claim 4, characterized in that Also includes: Case 1: For the in =∑ i α i σ in,i The accuracy of the quantum bit state of the tracking point solved by constructing an approximate function is 100%; Case 2: For the quantum bit state that cannot be decomposed into ρ in =∑ i α i σ in,i The average accuracy of the quantum bit state of the tracking point is Among them, N sample is the number of sample inputs, N in The number of bits of input for the program; When constructing an approximate function, the accuracy of solving the quantum bit state of the tracking point through the approximate function is improved by increasing the number of sampling inputs. Preferably, for case one, the sampling input is increased by exponential sampling, and for case two, the sampling input is increased by linear increase.

6. The method of claim 5, wherein: When building an approximate function, the following three strategies are used to sample inputs: Strategy 1: Customize the sampling input, including applying eigendecomposition to the sample data and using the first K eigenvectors with large eigenvalues ​​selected based on the eigendecomposition as the sampling input; Strategy 2: Set part of the input qubit state to a constant; Strategy 3: Check a single property rather than the entire density function corresponding to the quantum bit state, where the single property is the property that satisfies the quantum evolution isomorphism and needs to be asserted and verified.

7. The method of claim 1, wherein: The assumption-guarantee assertions in the quantum program and the constructed approximation function are packaged into a constrained maximization problem for global search and solution to verify the correctness of the quantum program, including: Bring the approximation function into the assumption-guarantee assertion, and transform the assumption-guarantee assertion into a constrained optimization problem, and solve the parameter α in the approximation function by direct optimization. i To find the maximum value that makes the assumption-guaranteed assertion true. If it can be found, then the assumption-guaranteed assertion is true and the quantum program is correct.

8. The method of claim 1, wherein: Also includes: When a quantum program verifies incorrectly, the input qubit states are counterexamples that cause the error; When a quantum program verifies correct, the confidence level is estimated based on the accuracy of the analysis. acc represents accuracy, ε represents the accuracy threshold, P(acc<ε) represents the probability distribution of acc<ε, N c-e Represents the number of counterexamples.

9. A system for exploiting isomorphism in quantum programs to facilitate confident verification, characterized in that include: Assertion statement module, which is used to define tracking points and mark the quantum bit states of quantum programs at different times through tracking points, and define assumption-guarantee assertions to specify the range of single quantum bit states and the relationship between multi-quantum qubit states; A program analysis module, which is used to construct an approximate function of the true relationship between the input qubit state and the qubit state of the tracking point based on quantum evolution isomorphism; The assertion verification module is used to package the assumption-guarantee assertions in the quantum program and the constructed approximation function into a constraint maximization problem for global search and solution to verify the correctness of the quantum program.

10. A computing device comprising a memory and one or more processors, wherein the memory stores executable code, characterized in that: When the one or more processors execute the executable code, the one or more processors are used to implement the method for facilitating confident verification by utilizing isomorphism in quantum programs according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Quantum bit calibration method and device and quantum computer operating system

    CN115249069A

  • Quantum symbol execution method for quantum program test

    CN115952871A

  • Method and system for promoting confidential verification by utilizing isomorphism in quantum program

    CN118333181A

  • Strong simulation methods for unit testing quantum software

    US20190180197A1

  • Methods for using quantum computers

    WO2024023515A1