CN109901993B - Single-path linear constraint cyclic program termination judgment method - Google Patents

Single-path linear constraint cyclic program termination judgment method Download PDF

Info

Publication number
CN109901993B
CN109901993B CN201910051138.7A CN201910051138A CN109901993B CN 109901993 B CN109901993 B CN 109901993B CN 201910051138 A CN201910051138 A CN 201910051138A CN 109901993 B CN109901993 B CN 109901993B
Authority
CN
China
Prior art keywords
program
loop
path
solution
termination
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910051138.7A
Other languages
Chinese (zh)
Other versions
CN109901993A (en
Inventor
李轶
杨文强
冯勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chongqing Institute of Green and Intelligent Technology of CAS
Original Assignee
Chongqing Institute of Green and Intelligent Technology of CAS
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chongqing Institute of Green and Intelligent Technology of CAS filed Critical Chongqing Institute of Green and Intelligent Technology of CAS
Priority to CN201910051138.7A priority Critical patent/CN109901993B/en
Publication of CN109901993A publication Critical patent/CN109901993A/en
Application granted granted Critical
Publication of CN109901993B publication Critical patent/CN109901993B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention relates to a method for judging the termination of a loop program with single-path linear constraint, which comprises the following steps: step one, extracting a loop program of single-path linear constraint; step two, converting the cyclic program of the single-path linear constraint into a linear inequality system and solving, if no solution exists, terminating the cyclic program, and if a solution exists, temporarily failing to judge the termination; step three, judging whether an immobile point exists in the solution of the linear inequality system, if so, not terminating the loop program; if no fixed point exists and the state variable is bounded, the loop program is terminated, otherwise, the termination of the loop program cannot be judged; and step four, judging whether the projection of the solution space of the linear inequality system is the same as the circulation condition, if so, not terminating the circulation program, otherwise, not judging the termination of the circulation program. According to the method, the cycle termination of the program can be analyzed in polynomial time by constructing a rank function and adopting a single quantitative word elimination method, and the calculation efficiency is improved.

Description

Single-path linear constraint cyclic program termination judgment method
Technical Field
The invention relates to a method for judging the termination of a single-path linear constrained loop program, belonging to the technical field of computers.
Background
With the rapid development of information technology, embedded systems play an increasingly important role in human life, and the accessibility, termination and invariance of the embedded program system in operation are particularly important, and the analysis of the termination of the program is a necessary basis for ensuring the complete correctness of the program. The technical personnel always hope to judge whether the program is terminated during the program writing process, and although the termination problem of the general program is proved to be inconclusive, the termination of the program can be analyzed by special programs, which also shows that the research on the termination in the program is of great theoretical significance and practical significance. Currently, the cycle termination analysis is mainly performed internationally by synthesizing a rank function, and is mainly used for analyzing a linear cycle program at present, which is generally based on a cylindrical algebraic decomposition method proposed by g.e. collins, but a mixed quantifier elimination method is adopted, so that more arguments are introduced, and the computational complexity is high.
Recently, computer numbers and algebraic theory are also increasingly applied to program automatic verification, making termination decisions for some linear and non-linear loop programs. The invention provides a terminating problem analysis method aiming at a loop program of single-path linear constraint, which is proved to be capable of accurately analyzing the terminating problem of the loop.
Disclosure of Invention
In view of this, the present invention provides a method for determining the termination of a loop program with single-path linear constraint, which abandons the method based on the Farkas theorem to achieve the purposes of reducing the computational complexity and improving the computational efficiency.
In order to achieve the purpose, the invention provides the following technical scheme:
a cyclic program termination judgment method of single-path linear constraint comprises the following steps:
step one, traversing a program, searching a circulating program in the program, and extracting the circulating program with single-path linear constraint;
step two, sequentially solving the linear inequality system converted by the cyclic program of the single-path linear constraint in the step one, if no solution exists, the cyclic program of the single-path linear constraint is terminated, and if a solution exists, the termination of the cyclic program cannot be judged temporarily;
step three, sequentially judging whether the solution of the linear inequality system with the solution in the step two has an immobile point, if so, not terminating the loop program of the single-path linear constraint; further, if no fixed point exists and the state variable is bounded, the loop program of the single-path linear constraint is terminated, otherwise, the termination of the loop program cannot be judged;
and step four, sequentially judging whether the projection of the solution space of the linear inequality system of the loop program of the single-path linear constraint which cannot be judged in the step three is the same as the loop condition, and if so, not terminating the loop program of the single-path linear constraint.
Further, the loop procedure of the single-path linear constraint in the step one can be expressed as: while { B · x0≤d}do{M1·xk+M2·xk+1C } end while; wherein the content of the first and second substances,
Figure BSA0000177556300000028
respectively, the matrix of rational numbers is a matrix of rational numbers,
Figure BSA0000177556300000022
respectively rational number array vectors, n, p and q respectively are positive integers,
Figure BSA0000177556300000029
and
Figure BSA00001775563000000210
the real column vector state variables for the k-th and k + 1-th cycles, respectively, in particular, k ═ 0 is the initial time, the time corresponding to the state variable x0、x1Can be directly used for analyzing the program cycle termination.
Further, the cyclic procedure of the step two, which is sequentially constrained to the single path in the step one, is converted into a linear inequality system in the form of:
Figure BSA0000177556300000023
wherein the content of the first and second substances,
Figure BSA0000177556300000024
in order to be a matrix of rational numbers,
Figure BSA0000177556300000025
and
Figure BSA0000177556300000026
is a variable to be solved; and then, judging the solution by using a quantifier elimination method, if no solution exists, terminating the loop program of the single-path linear constraint, and if a solution exists, temporarily failing to judge the termination.
Further, the third step of sequentially judging whether the solution of the linear inequality system with the solution in the second step is a fixed point, specifically, converting the linear inequality system form into a linear inequality system form
Figure BSA0000177556300000027
Solving is carried out, if the system has a solution, the fact that the loop program has a fixed point is indicated, and the loop program of the single-path linear constraint is not terminated; further, if there is no fixed point and the state variables are bounded, i.e. saveAt a positive real number L, so that | | | x0||And if the linear constraint is less than or equal to L, the loop program of the single-path linear constraint is terminated, otherwise, the termination of the loop program cannot be judged.
Further, the solution space of the linear inequality system of the cyclic program of the single path linear constraint which cannot be judged in the step three is sequentially judged in the step four and is in x0Whether the projection is identical to the cyclic condition, specifically, using quantifier to eliminate, eliminating x1、D0And D1Obtained about x0Solution of (2), determination and cycling condition { B · x }0D ≦ d, if so, the loop for the single-path linear constraint does not terminate, otherwise its termination cannot be determined.
The invention has the beneficial effects that: the invention provides a single-path linear constraint cyclic program termination judgment method, which is characterized in that a rank function is constructed, a single component word elimination method is adopted, and a columnar algebra decomposition method is abandoned, so that the calculation complexity is greatly reduced, the cyclic termination of a program can be analyzed within polynomial time, and the calculation efficiency is improved.
Drawings
For the purpose and technical solution of the present invention, the present invention is illustrated by the following drawings:
FIG. 1 is a flowchart of a method for determining the termination of a loop process with single-path linear constraints.
Detailed Description
The preferred embodiment of the present invention will be described in detail with reference to fig. 1.
Example 1: the program comprises the following loop program of single-path linear constraint
while xk≥0 do
xk+1≤xk+yk
yk+1≤yk-1
yk+1≥-2
end while
As shown in fig. 1, the method for determining the termination of a loop program with single-path linear constraint in embodiment 1 includes the following steps:
s1: traversing the program, searching a circulating program in the program, and extracting the circulating program with single-path linear constraint; wherein the content of the first and second substances,
Figure BSA0000177556300000031
Figure BSA0000177556300000032
respectively, the real number matrixes are used,
Figure BSA0000177556300000033
real number column vectors respectively;
s2: a linear inequality system converted from the loop program of the single-path linear constraint
Figure BSA0000177556300000034
Wherein the content of the first and second substances,
Figure BSA0000177556300000035
D0and D1The variables to be solved are column vectors. By using the quantifier elimination method, it is easy to find that the inequality system has no solution, and the loop program of the single-path linear constraint is terminated.
Example 2: the program comprises the following loop program of single-path linear constraint
while xk-yk≤0 and 2xk-yk≥1 and yk≤1 do
-xk+1-xk+yk+1≥0
yk-yk+1≥0
end while
As shown in fig. 1, the method for determining the termination of a loop program with single-path linear constraint in embodiment 2 includes the following steps:
s1: traversing the program, searching a circulating program in the program, and extracting the circulating program with single-path linear constraint; wherein the content of the first and second substances,
Figure BSA0000177556300000036
Figure BSA0000177556300000037
respectively, the real number matrixes are used,
Figure BSA0000177556300000038
real number column vectors respectively;
s2: a linear inequality system converted from the loop program of the single-path linear constraint
Figure BSA0000177556300000039
Wherein the content of the first and second substances,
Figure BSA0000177556300000041
D0and D1The variables to be solved are column vectors. The solution of the inequality system is easily obtained by adopting a quantifier elimination method, so that the termination of the inequality system cannot be judged temporarily;
s3: further converting the linear inequality system into:
Figure BSA0000177556300000042
and judging whether the inequality has a solution or not, and easily obtaining that the inequality system has the solution by adopting a quantifier elimination method, but the state variable is bounded, so that the loop program of the single-path linear constraint is terminated.
Example 3: the program comprises the following loop program of single-path linear constraint
while xk≥3 and xk+7yk≤-5 do
-xk+1-yk+1+xk≤12
end while
As shown in fig. 1, the method for determining the termination of a loop program with single-path linear constraint in embodiment 3 includes the following steps:
s1: traversing the program, searching a circulating program in the program, and extracting the circulating program with single-path linear constraint; wherein the content of the first and second substances,
Figure BSA0000177556300000043
M1=(1 0)、M2(-1-1) are each a real number matrix,
Figure BSA0000177556300000044
c is a real number column vector respectively as 12;
s2: a linear inequality system converted from the loop program of the single-path linear constraint
Figure BSA0000177556300000045
Wherein the content of the first and second substances,
Figure BSA0000177556300000046
D0and D1The variables to be solved are column vectors. The solution of the inequality system is easily obtained by adopting a quantifier elimination method, so that the termination of the inequality system cannot be judged temporarily;
s3: further converting the linear inequality system into:
Figure BSA0000177556300000047
judging whether the inequality has a solution or not, and easily obtaining that the inequality system has the solution by adopting a quantifier elimination method, but the state variable is unbounded, so that the termination of the loop program of the single-path linear constraint cannot be judged temporarily;
s4: elimination of x by quantifier elimination1、D0And D1Obtained about x0Has a solution of { xk≥3∧xk+7ykLess than or equal to-5, and circulation condition { B.x }0D ≦ d } is the same, then the loop procedure for the single-path linear constraint does not terminate.
Finally, it is noted that the above-mentioned preferred embodiments illustrate rather than limit the invention, and that, although the invention has been described in detail with reference to the above-mentioned preferred embodiments, it will be understood by those skilled in the art that various changes in form and detail may be made therein without departing from the scope of the invention as defined by the appended claims.

Claims (1)

1. A method for determining the termination of a loop process with single-path linear constraints, the method comprising the steps of:
step one, traversing a program, searching a circulating program in the program, and extracting the circulating program with single-path linear constraint;
step two, sequentially solving the linear inequality system converted by the cyclic program of the single-path linear constraint in the step one, if no solution exists, the cyclic program of the single-path linear constraint is terminated, and if a solution exists, the termination of the cyclic program cannot be judged temporarily;
step three, sequentially judging whether the solution of the linear inequality system with the solution in the step two has an immobile point, if so, not terminating the loop program of the single-path linear constraint; further, if no fixed point exists and the state variable is bounded, the loop program of the single-path linear constraint is terminated, otherwise, the termination of the loop program cannot be judged;
step four, sequentially judging whether the projection of the solution space of the linear inequality system of the loop program of the single-path linear constraint which cannot be judged in the step three is the same as the loop condition, if so, not terminating the loop program of the single-path linear constraint, otherwise, not judging the termination of the loop program;
the loop program of the single-path linear constraint in the step one is expressed as: while { B · x0≤d}do{M1·xk+M2·xk+1C } end while; wherein the content of the first and second substances,
Figure FSB0000197017270000011
respectively, the matrix of rational numbers is a matrix of rational numbers,
Figure FSB0000197017270000012
Figure FSB0000197017270000013
respectively rational number array vectors, n, p and q respectively are positive integers,
Figure FSB0000197017270000014
and
Figure FSB0000197017270000015
real column vector state variables corresponding to the kth cycle and the (k + 1) th cycle respectively; k is 0 as the initial time, and the state variable x corresponding to the time0、x1Directly analyzing the program cycle termination;
the linear inequality system form converted by the cyclic program of the single-path linear constraint in the step one in sequence is as follows:
Figure FSB0000197017270000016
wherein the content of the first and second substances,
Figure FSB0000197017270000017
in order to be a matrix of rational numbers,
Figure FSB0000197017270000018
and
Figure FSB0000197017270000019
is a variable to be solved; then, judging the solution by using a quantifier elimination method, if no solution exists, terminating the cyclic program of the single-path linear constraint, and if a solution exists, temporarily failing to judge the termination;
and step three, sequentially judging whether the solution of the linear inequality system with the solution in the step two is a fixed point or not, specifically, converting the form of the linear inequality system into a form of a fixed point
Figure FSB00001970172700000110
Solving is carried out, if the system has a solution, the fact that the loop program has a fixed point is indicated, and the loop program of the single-path linear constraint is not terminated; further, if there is no motionless point and the state variables are bounded, i.e., there is a positive real number L, so that | | x0||If the linear constraint of the single path is less than or equal to L, the loop program of the linear constraint of the single path is terminated, otherwise, the termination of the loop program cannot be judged;
said step four said sequentially judging step three said non-judging single path linear constraint loop program linear inequality system solution space in x0Whether the projection is identical to the cyclic condition, specifically, using quantifier to eliminate, eliminating x1、D0And D1Obtained about x0Solution of (2), determination and cycling condition { B · x }0D ≦ d, if so, the loop for the single-path linear constraint does not terminate, otherwise its termination cannot be determined.
CN201910051138.7A 2019-01-11 2019-01-11 Single-path linear constraint cyclic program termination judgment method Active CN109901993B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910051138.7A CN109901993B (en) 2019-01-11 2019-01-11 Single-path linear constraint cyclic program termination judgment method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910051138.7A CN109901993B (en) 2019-01-11 2019-01-11 Single-path linear constraint cyclic program termination judgment method

Publications (2)

Publication Number Publication Date
CN109901993A CN109901993A (en) 2019-06-18
CN109901993B true CN109901993B (en) 2022-01-28

Family

ID=66943865

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910051138.7A Active CN109901993B (en) 2019-01-11 2019-01-11 Single-path linear constraint cyclic program termination judgment method

Country Status (1)

Country Link
CN (1) CN109901993B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112698891B (en) * 2021-02-04 2023-10-31 中国科学院重庆绿色智能技术研究院 Method for judging termination of cyclic program based on boundary function synthesis

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101977180A (en) * 2010-06-08 2011-02-16 南京大学 Security protocol authentication method based on flaw attack
CN104751247A (en) * 2015-04-09 2015-07-01 广西大学 Modeling method of large-scale non-smooth box constraint convex optimization model
CN104750613A (en) * 2015-04-16 2015-07-01 中国科学院重庆绿色智能技术研究院 Cycle program termination judging method on first-type bounded interconnection domain

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2788933A4 (en) * 2011-12-22 2015-06-03 Ibm Mixing optimal solutions

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101977180A (en) * 2010-06-08 2011-02-16 南京大学 Security protocol authentication method based on flaw attack
CN104751247A (en) * 2015-04-09 2015-07-01 广西大学 Modeling method of large-scale non-smooth box constraint convex optimization model
CN104750613A (en) * 2015-04-16 2015-07-01 中国科学院重庆绿色智能技术研究院 Cycle program termination judging method on first-type bounded interconnection domain

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"有界闭域上的线性赋值循环终止性分析";李轶等;《软件学报》;20140823;第25卷(第6期);第1133-1141页 *

Also Published As

Publication number Publication date
CN109901993A (en) 2019-06-18

Similar Documents

Publication Publication Date Title
CN109543816B (en) Convolutional neural network calculation method and system based on weight kneading
US9665083B2 (en) Counter operation in a state machine lattice
US20150262062A1 (en) Decision tree threshold coding
US20120072704A1 (en) "or" bit matrix multiply vector instruction
US10241767B2 (en) Distributed function generation with shared structures
Zhang et al. A low-latency FPGA implementation for real-time object detection
CN109901993B (en) Single-path linear constraint cyclic program termination judgment method
Lasserre Moments and sums of squares for polynomial optimization and related problems
Soltaniyeh et al. An accelerator for sparse convolutional neural networks leveraging systolic general matrix-matrix multiplication
Jin et al. Relation of the relations: A new paradigm of the relation extraction problem
US20080288756A1 (en) "or" bit matrix multiply vector instruction
Zheng et al. Response length perception and sequence scheduling: An llm-empowered llm inference pipeline
CN105678083A (en) Rapid detection method capable of performing single-bit frequency detection and frequency detection within block
CN116166967B (en) Data processing method, equipment and storage medium based on meta learning and residual error network
CN106095669B (en) Parallel program testing method based on scheduling sequence reduction
Abich et al. The impact of precision bitwidth on the soft error reliability of the MobileNet network
Neelima et al. A GPU framework for sparse matrix vector multiplication
CN109815104B (en) GPGPU program approximate analysis system and method based on soft error perception
WO2023108800A1 (en) Performance analysis method based on cpu-gpu heterogeneous architecture, and device and storage medium
US11515995B2 (en) Efficient computation of univariate statistical moments for side channel vulnerability evaluation
Heisinger et al. QuAPI: Adding Assumptions to Non-Assuming SAT & QBF Solvers.
Mehrez et al. Machine learning for optimal compression format prediction on multiprocessor platform
Wang et al. Brief announcement: MIC++: accelerating maximal information coefficient calculation with GPUs and FPGAs
Zhang et al. Hlanc: heterogeneous parallel implementation of the implicitly restarted Lanczos method
Lescrenier et al. Large-scale unconstrained optimization on the FPS 164 and Cray X-MP vector processors

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant