/ / Article
Special Issue

## Intelligent Modeling and Verification

View this Special Issue

Research Article | Open Access

Volume 2013 |Article ID 160875 | https://doi.org/10.1155/2013/160875

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

Accepted27 Feb 2013
Published02 May 2013

#### 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 Cauchy-type integrability criterion, and other important theorems of the gauge integral in higher-order 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 Kananaskis-9.

#### 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 . 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 , and the Isabelle/HOL has the formalization of the gauge Integral . Cruz-Filipe reported a constructive theory of real analysis , 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 . Mhamdi et al.  formalized the Lebesgue integration in HOL4 in order to formalize statistical properties of continuous random variables. Harrison formalized the gauge integral in HOL light . Although there are the definition of the gauge integral and the fundamental theorem of calculus in HOL4 , there are no operation property and other theorems yet.

This paper presents the formalization of the complete gauge integral theory in HOL4 , including linearity, inequality, integration by parts, and the Cauchy-type 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.

 Meaning HOL notations Standard notations Truth Falsity Negation ~t ¬t Disjunction Conjunction t1 t2 Implication 1==> 2 Equality 1= 2 ∀-quantification !  · ∀ ∃-quantification ?  · ∃ Lambda ·

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 . The gauge integral is far simpler than the Lebesgue integral—it is not to be preceded by explanations of sigma-algebras and measures  but to be based on the special properties of the closed interval . Harrison made a detailed analysis of advantages of the gauge integral .

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 Riemann-type 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 !???.? 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 .

##### 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 gauge-integrable 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.

 Name of lemma Description in HOL4 DIVISION_LE_SUC . division (a, b) d ==> n. d n <= d (SUC n) DIVISION_MONO_LE . division (a, b) d ==> m n. m <= n ==> d m <= d n DIVISION_MONO_LE_SUC . division (a, b) d ==> n. d n <= d (SUC n) DIVISION_INTERMEDIATE . division (a, b) d   a <= c   c <= b ==>   n. n <= dsize d   d n <= c   c <= d (SUC n) DIVISION_DSIZE_LE . division (a, b) d (d (SUC n) = d n) ==> dsize d <= n DIVISION_DSIZE_GE . division (a, b) d   d n < d (SUC n) ==> SUC n <= dsize d DIVISION_DSIZE_EQ ∀  . division (a, b) d   d n < d (SUC n) (d (SUC (SUC n)) = d (SUC n)) ==>  (dsize d = SUC n) DIVISION_DSIZE_EQ_ALT . division (a, b) d (d (SUC n) = d n) (∀ i. i < n ==> d i < d (SUC i)) ==> (dsize d = n)

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 Cauchy-type 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.

 val SUMMING_INTEGRATOR = store_thm(“SUMMING_INTEGRATOR”, “!x. 0<=x ==> (integral(0, x) ( t. (m * cos t) + (n * sin t)) = m * sin x + n *(cos 0 − cos x))”, RW_TAC std_ss THEN REWRITE_TAC integral THEN SELECT_ELIM_TAC THEN CONJ_TAC THENL EXISTS_TAC“m * sin x + n * (cos 0 − cos x)” THEN MATCH_MP_TAC DINT_LINEAR THEN CONJ_TAC THENL SUBGOAL_THEN“sin x = sin x − sin 0”ASSUME_TAC THENL SIMP_TAC std_ss SIN_0 THEN REAL_ARITH_TAC, ONCE_ASM_REWRITE_TAC THEN MATCH_MP_TAC FTC1 THEN RW_TAC std_ss THEN ASM_SIMP_TAC arith_ss DIFF_SIN , ALL_TAC THEN SUBGOAL_THEN“cos 0 − cos x = −cos x − cos 0”ASSUME_TAC THENL REWRITE_TAC REAL_SUB_NEG2 , ALL_TAC THEN ONCE_ASM_REWRITE_TAC THEN HO_MATCH_MP_TAC FTC1 THEN ASM_SIMP_TAC std_ss DIFF_NEG_COS ,ALL_TAC THEN RW_TAC std_ss THEN MATCH_MP_TAC DINT_UNIQ THEN MAP_EVERY EXISTS_TAC “0:real”,“x:real”, “(∖ t. (m * cos t) + (n * sin t)):real->real” THEN ASM_REWRITE_TAC THEN MATCH_MP_TAC DINT_LINEAR THEN CONJ_TAC THENL SUBGOAL_THEN “sin x = sin x − sin 0”ASSUME_TAC THENL SIMP_TAC std_ss SIN_0 THEN REAL_ARITH_TAC, ONCE_ASM_REWRITE_TAC THEN MATCH_MP_TAC FTC1 THEN RW_TAC std_ss THEN ASM_SIMP_TAC arith_ss DIFF_SIN , ALL_TAC THEN SUBGOAL_THEN“cos 0 − cos x = −cos x − cos 0”ASSUME_TAC THENL REWRITE_TAC REAL_SUB_NEG2 , ONCE_ASM_REWRITE_TAC THEN HO_MATCH_MP_TAC FTC1 THEN ASM_SIMP_TAC std_ss DIFF_NEG_COS );

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 higher-order logic formalization of the gauge integral. The major properties of the gauge integral, including the linearity, boundedness, monotonicity, integration by parts, and Cauchy-type 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 Kananaskis-9.

#### 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.

1. 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
2. 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
3. J. D. Fleuriot, “On the mechanization of real analysis in Isabelle/HOL,” in Theorem Proving in Higher Order Logics, pp. 145–161, 2000.
4. L. Cruz-Filipe, Constructive real analysis: a type-theoretical formalization and applications [Ph.D. thesis], University of Nijmegen, 2004.
5. 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.
6. 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
7. J. Harrison, Theorem Proving with the Real Numbers, Springer, Heidelberg, Germany, 1998. View at: Publisher Site | MathSciNet
8. C. Swartz, Introduction to Gauge Integrals, World Scientific, Singapore, 2001. View at: Publisher Site | MathSciNet
9. 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

#### More related articles

We are committed to sharing findings related to COVID-19 as quickly as possible. We will be providing unlimited waivers of publication charges for accepted research articles as well as case reports and case series related to COVID-19. Review articles are excluded from this waiver policy. Sign up here as a reviewer to help fast-track new submissions.