Research Article  Open Access
Zhiping Shi, Weiqing Gu, Xiaojuan Li, Yong Guan, Shiwei Ye, Jie Zhang, Hongxing Wei, "The Gauge Integral Theory in HOL4", Journal of Applied Mathematics, vol. 2013, Article ID 160875, 7 pages, 2013. https://doi.org/10.1155/2013/160875
The Gauge Integral Theory in HOL4
Abstract
The integral is one of the most important foundations for modeling dynamical systems. The gauge integral is a generalization of the Riemann integral and the Lebesgue integral and applies to a much wider class of functions. In this paper, we formalize the operational properties which contain the linearity, monotonicity, integration by parts, the Cauchytype integrability criterion, and other important theorems of the gauge integral in higherorder logic 4 (HOL4) and then use them to verify an inverting integrator. The formalized theorem library has been accepted by the HOL4 authority and will appear in HOL4 Kananaskis9.
1. Introduction
In the recent years, hardware and software systems are widely used in safety critical applications like car, highway and air control systems, medical instruments, and so on. The cost of a failure in these systems is unacceptably high, thus making it important to make sure of the correctness of the functions in design. The traditional verification methods, which include simulation and testing, are not sufficient to validate confidence. Formal methods can be helpful in proving the correctness of systems. Theorem proving is one method for performing verification on formal specifications of system models [1]. It allows to mathematically reason about system properties by representing the behavior of a system in logic in a general model. In this way, the specification and implementation are expressed as the general mathematical model so that all the cases are covered when they are proved to be equivalent.
The integral is a mathematical tool to solve many practical problems in geometry, physics, economics, electrical systems, and so on. In order to formalize dynamic systems, some theorem provers have already formalized integral theorem library. The Isabelle/Isar theorem prover has the formalization of the Lebesgue integral [2], and the Isabelle/HOL has the formalization of the gauge Integral [3]. CruzFilipe reported a constructive theory of real analysis [4], which includes continuous functions and differential, integral, and transcendental functions in the COQ theorem prover. The PVS theorem prover has the Riemann integral formalized by Butler [5]. Mhamdi et al. [6] formalized the Lebesgue integration in HOL4 in order to formalize statistical properties of continuous random variables. Harrison formalized the gauge integral in HOL light [7]. Although there are the definition of the gauge integral and the fundamental theorem of calculus in HOL4 [7], there are no operation property and other theorems yet.
This paper presents the formalization of the complete gauge integral theory in HOL4 [8], including linearity, inequality, integration by parts, and the Cauchytype integrability criterion, as well as the formal analysis of an integral circuit based on the formalization. The properties of vectors and matrices are characterized in accordance with linear space properties. In this paper, we use HOL4 notations, and some notations are listed in Table 1.

The rest of the paper is organized as follows. In Section 2, we give an overview of the gauge integral and present the formalization of the properties and theorems in HOL4. In Section 3, the formal analysis of an integral circuit is presented. Section 4 concludes the paper. The definitions and theorems in this paper are described as formalizations in HOL4 and have been verified for correctness using the HOL4 theorem prover.
2. The Gauge Integral in HOL4
There are many ways of formally defining an integral, not all of which are equivalent. The differences exist mostly to deal with differing special cases which may not be integrable under other definitions. The definitions include the Newton integral, the Riemann integral, the Lebesgue integral, and the gauge integral, which had been proposed in different senses. The gauge integral proposed by Kurzweil and Henstock is a generalization of the Riemann integral and the Lebesgue integral, and it is suitable for wider situations [8]. The gauge integral is far simpler than the Lebesgue integral—it is not to be preceded by explanations of sigmaalgebras and measures [9] but to be based on the special properties of the closed interval [8]. Harrison made a detailed analysis of advantages of the gauge integral [7].
For any function , which may be not a derivative, we say that it has the gauge integral on the interval if for any , there is a gauge such that for any fine division, the usual Riemanntype sum approaches are closer than :
So, the above reasoning shows that a derivative always has the gauge integral over the interval ; that is, the fundamental theorem of calculus holds.
Definition 1 (the gauge integral). Let be some function, and let be some number. We say that is the gauge integral of , written , if for each number , there exists a corresponding function with the following property: whenever is a positive integer and and are some numbers satisfying and for all , then .
Definition 1 is formalized in HOL4 as [7]!???.? Dint <=>? !. ==>? ?. gauge ? !?. tdiv ? fine ==>? abs <,
where division ? denotes a division on interval :?division ?? .tdiv denotes to get any value between two contiguous dividing points:?tdiv <=> division .The gauge indicates that is a measure over a set (an interval commonly), formally as?!. gauge ,and fine means as follows:?!. fine .dsize? denotes the number of divisions of the interval divided by the division :?dsize .
In sum, “Dint ” denotes the integral of on is . Then, we give the definitions of integrable and integral based on Definition 1.
Definition 2 (integrable). Function is integrable on interval means that there exist a number that satisfy Definition 1.
Definition 2 is formalized in HOL4 as
integrable !. integrable . Dint .
Definition 3 (integral value). A function’s integral value is formalized as follows:
integral !. integral . Dint .
The relations between the definitions are described in Theorems 4 and 5.
Theorem 4 (INTEGRABLE_DINT). One has
. integrable Dint?? (integral ).
Theorem 5 (DINT_INTEGRAL). Consider
. ?Dint?? (integral ).
Then, we formalizes the operational properties of the gauge integral [8].
2.1. Linearity of the Gauge Integral
In this subsection, the formalizations of the linear properties are presented after the respective mathematical expressions.
Theorem 6 (DINT_CONST). The integral of a constant function is computed by:
The formalization is as follows:
Theorem 7 (DINT_0). The integral of zero is zero:
The formalization is as follows:
Theorem 8 (DINT_NEG). The integral is negated when the function is negated:
The formalization is as follows:
Theorem 9 (DINT_CMUL). The integral of the product of a function multiplied by a constant equals the product of the constant and the integral of the function:
The formalization is as follows:
Theorem 10 (DINT_ADD). The integral of the sum of two functions is the sum of the integrals of the two functions:
The formalization is as follows:
Theorem 11 (DINT_SUB). The integral of the difference of two functions is the difference of the integrals of the two functions:
The formalization is as follows:
Theorem 12 (DINT_LINEAR). The integral is linear:
The formalization is as follows:
These theorems are proven based on the definition of the gauge integral.
2.2. Inequalities of the Gauge Integral
The three inequalities are formalized in this subsection.
Theorem 13 (upper and lower bounds). An integrable function f over is necessarily bounded on that interval. Thus, there are real numbers and so that for all in . Since the lower and upper sums of over are therefore bounded by, respectively, and , it follows that
The formalization is as follows:?INTEGRAL_MVT_LE:?.? (!. )? (!. )==>? integral ??integral .
Theorem 14 (inequalities between functions). If for each in , then each of the upper and lower sums of is bounded above by the upper and lower sums of , respectively:
The formalization is as follows:?INTEGRAL_LE:?.? ??integrable ??integrable ? (!. )==>? integral integral .?DINT_LE:?!. ?Dint? (!. )? .
Theorem 15 (inequality of absolute value). If is the gaugeintegrable on , then the same is true for and
The formalization is as follows:?DINT_TRIANGLE:?.? ?Dint?Dint. ? abs .
This theorem could be proved by Theorem 14.
2.3. The Integral of the Pointwise Perturbation and the Spike Functions
Theorem 16 (DINT_DELTA). The integral of the delta function, which equals 1 only at one certain point otherwise keeps zero, is zero:
The formalization is as follows:
!. Dint?? (. if then 1 else 0) 0.
Theorem 17 (DINT_POINT_SPIKE). The two functions which are equal except at a certain point have same integrals:
The formalization is as follows:?.? !. <= <= <> ==>? Dint ==> Dint.
This shows that if one changes a function at one point, then its integral does not change.
2.4. Other Important Properties
Theorem 18 (integrable on subinterval). For all , if is integrable over , then is integrable over .
The formalization is as follows:?INTEGRABLE_SUBINTERVAL:?. integrable ?? integrable .
In order to prove Theorem 18, the following three lemmas need to be proved:?INTEGRABLE_SPLIT_SIDES ? ! .? integrable ? . ! . ? . gauge . ? ! ???.? tdiv (,) fine ? tdiv (,) fine ? abs (rsumrsum ?INTEGRABLE_SUBINTERVAL_LEFT =? ! . integrable integrable ?INTEGRABLE_SUBINTERVAL_RIGHT =? ! . ????.
The INTEGRABLE_SPLIT_SIDES is used to prove INTEGRABLE_SUBINTERVAL_LEFT and INTEGRABLE_SUBINTERVAL_RIGHT, then the theorem INTEGRABLE_SUBINTERVAL can be proved by the transitivity of real number.
Theorem 19 (additivity of integration on intervals). If is any element of , then
The formalization is as follows:?INTEGRAL_COMBINE:? !.? ? (integral ).
The proof of Theorem 19 is sophisticated. We utilize multiple lemmas shown in Table 2.

The proof is branched based on . It is easy in case of or . In case , is the tie point of two measure intervals. It needs the lemmas of Table 1 to prove interval measure and division fine. The proof program consists of over 400 lines of HOL4 code. The proof procedure is described as follows.
In case , the proof goal is extended as follows:
The proof goal transfers by using the fourth lemma:
This lemma is proven with two cases based on or . In case of , the goal is
The goal is rewritten by :
Let denote sum , and let denote sum ; the simplized goal is as follows:
For abs , we prove it based on and . Similarly, for abs , we prove it based on the cases or , then the goal is proved.
Theorem 20 (the Cauchytype integrability criterion). Let . Then, is integrable over if and only if for every , there is a gauge on such that if , then , where is a Riemann sum, and , are partitions of .
The formalization is as follows:?INTEGRABLE_CAUCHY:? !.? integrable ? !. ? ?. gauge (. ) ? !.? tdiv?fine div fine ? abs (rsumsum.
The Cauchy criterion indicates that an integrable function is always convergent for any division on the interval.
First of all, we should prove that a function for any gauge over the set is fine; we formalized the lemma as GAUGE_MIN_FINITE:? !.? (!. gauge )==>? ?.? gauge ? !. fine !. fine () ().
Theorem 21 (limit theorem). Let and assume that for every , there exists an integrable function such that on . Then, is integrable over .
The formalization is as follows:?INTEGRABLE_LIMIT:?!.? (!. ? ?. (!. ? integrable .
In order to make the proof easier, we proved the RSUM_DIFF_BOUND at first:?!.? tdiv? (!. ? .
Theorem 22 (integrability of continuous functions). If is continuous, then is integrable over .
The formalization is as follows:?INTEGRABLE_CONTINUOUS:?!. !. ==> integrable .
To prove Theorem 22, we first prove the uniform continuity theorem.
If is continuous, is uniformly continuous. And then, the result is given by that the uniformly continuous functions are integrable. The uniform continuity theorem is formalized as follows:?CONT_UNIFORM:?!.? (!. )==>? !. ? ?. ? !. ? abs .
3. Verifying a Summing Inverting Integrator
In order to illustrate the usefulness of the proposed approach, we use our formalization to analyze a summing integrator. Integration circuits are widely used in electronic circuits; they are often used for waveform transformation, amplifier offset voltage elimination, integral compensation in feedback control, and so on. In this section, we use the formalization above to verify a summing inverting integrator. Figure 1 shows the basic summing inverting integral circuit.
The relation between output and input voltage can be present as the following formula:
We assumed the integral constant , , then formula 1 can be simplified as the following formula:
When , , we can get
Formula (29) can be formalized in HOL4 as follows:?SUMMING_INTEGRATOR: ?!. .
The detailed formalization and proof are shown in Algorithm 1.

In this proof, we employ the linear property of integral DINT_LINEAR to divide the integral of the addition of two functions into the addition of two integrals of the two functions; then we prove the two integrals, respectively. For instantiating the input variable and , the derivative of negative cosine is proved in advance: ?val DIFF_NEG_COS = store_thm(“DIFF_NEG_COS”),?“!. ((.) diffl ) ”, ?GEN_TAC THEN SUBGOAL_THEN“” ASSUME_TAC THENL?[REWRITE_TAC[REAL_NEGNEG],ALL_TAC] THEN?ONCE_ASM_REWRITE_TAC THEN?MATCH_MP_TAC DIFF_NEG THEN REWRITE_TAC[DIFF_COS]).
4. Conclusion
In this paper, we presented a higherorder logic formalization of the gauge integral. The major properties of the gauge integral, including the linearity, boundedness, monotonicity, integration by parts, and Cauchytype integrability criterion, were formalized and proven in HOL4, and then a formal proving of an inverting integrator was presented. The proposed integral theorem library has been accepted by HOL4 authority and will appear in HOL4 Kananaskis9.
Acknowledgments
The authors thank Professor Jin Shengzhen and Dr. John Harrison for their helpful suggestions and thank Dr. Michael Norrish for reviewing their gauge integral theorem library. This work was supported by the International Cooperation Program on Science and Technology (2010DFB10930 and 2011DFG13000), the National Natural Science Foundation of China (60873006, 61070049, 61170304, and 61104035), the Natural Science Foundation of the City of Beijing (4122017), the S&R Key Program of the Beijing Municipal Education Commission (KZ201210028036), the Open Project Program of State Key Laboratory of Computer Architecture, and the Open Project Program of Guangxi Key Laboratory of Trusted Software.
References
 C. Kern and M. R. Greenstreet:, “Formal verification in hardware design: a survey,” ACM Transactions on Design Automation of Electronic Systems, vol. 4, no. 2, pp. 123–193, 1999. View at: Google Scholar
 Stefan Richter, “Formalizing integration theory with an application to probabilistic algorithms,” in Proceedings of the 17th International Conference on Theorem Proving in Higher Order Logics (TPHOLs '04), K. Slind, A. Bunker, and G. Gepalakrishnan, Eds., vol. 3223 of Lecture Notes in Computer Science, pp. 271–286, Springer, Park City, Utah, USA, September 2004. View at: Google Scholar
 J. D. Fleuriot, “On the mechanization of real analysis in Isabelle/HOL,” in Theorem Proving in Higher Order Logics, pp. 145–161, 2000. View at: Publisher Site  Google Scholar  Zentralblatt MATH  MathSciNet
 L. CruzFilipe, Constructive real analysis: a typetheoretical formalization and applications [Ph.D. thesis], University of Nijmegen, 2004.
 R. W. Butler, “Formalization of the integral calculus in the PVS theorem prover,” Journal of Formalized Reasoning, vol. 2, no. 1, pp. 1–26, 2009. View at: Google Scholar  Zentralblatt MATH  MathSciNet
 T. Mhamdi, O. Hasan, and S. Tahar, “On the formalization of the Lebesgue integration theory in HOL,” in Interacitve Theorem Proving, vol. 6172 of Lecture Notes in Computer Science, pp. 387–402, Springer, 2010. View at: Publisher Site  Google Scholar  MathSciNet
 J. Harrison, Theorem Proving with the Real Numbers, Springer, Heidelberg, Germany, 1998. View at: Publisher Site  MathSciNet
 C. Swartz, Introduction to Gauge Integrals, World Scientific, Singapore, 2001. View at: Publisher Site  MathSciNet
 R. A. Gordon, The Integrals of Lebesgue, Denjoy, Perron, and Henstock, vol. 4 of Graduate Studies in Mathematics, American Mathematical Society, Providence, RI, USA, 1994. View at: MathSciNet
Copyright
Copyright © 2013 Zhiping Shi et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.