Table of Contents Author Guidelines Submit a Manuscript
Mathematical Problems in Engineering
Volume 2015 (2015), Article ID 687152, 8 pages
Research Article

The Formalization of Discrete Fourier Transform in HOL

1Beijing Key Laboratory of Electronic System Reliability Technology, Capital Normal University, Beijing 100048, China
2College of Information Science and Technology, Beijing University of Chemical Technology, Beijing 100029, China

Received 6 March 2015; Revised 7 June 2015; Accepted 25 June 2015

Academic Editor: Jean-François Monin

Copyright © 2015 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.


Traditionally, Discrete Fourier Transform (DFT) is performed with numerical or symbolic computation, which cannot guarantee 100% accurate analysis which may be necessary for safety-critical applications. Machine theorem proving is one of the formal methods that perform accurate analysis with completeness to some extent. This paper proposes the formalization of DFT in a higher-order logic theorem prover named HOL. We propose the formal definition of DFT and verify the fundamental properties of DFT. Two case studies are presented to illustrate usefulness and correctness of the formalized DFT, including formal verifications of Fast Fourier Transform (FFT) and cosine frequency shift.

1. Introduction

Fourier Transform (FT), through which signal is transformed from time domain to frequency one, is a fundamental and core method for signal processing. DFT is the discrete version of FT on both time domain and frequency domain which is adapted to the actual environment of computers and digital signal processing (DSP) chips. DFT has been widely used in many fields such as spectral analysis, data compressing, digital communication, signal processing, and the solution of partial differential equations [1, 2]. Therefore tremendous algorithms and packages have been implemented to perform DFT. The algorithms and packages are based on numerical or symbolic computation. The numerical computation intuitively produces approximate solutions because floating-point numbers are used to represent reals in computers. Computer algebra systems (CAS) such as MATLAB, Maple, and Mathematica offer a large collection of powerful algebraic packages and can efficiently perform symbolic computation precisely without round-off. But CAS still can output incorrect results because they have no mechanism to check correctness of results mathematically. Errors can arise in mismatching the side conditions of functions, the determination of equality of two expressions, or the definedness of expressions with respect to symbolic parameters [3, 4]. Moreover both numerical and symbolic computations are implemented in unverified huge computer programs, which are bug prone. Thus the analysis of DFT based on the above mentioned techniques cannot be relied upon for safety-critical applications of which even tiny errors can cause loss of human lives.

Formal methods have succeeded in precise analysis and verification of hardware and software systems in the past decades. Theorem proving, one of the formal methods, models the systems in logic and then reasons and verifies the model’s properties using axioms, theorems, and inference rules in the logic. The proof is performed in a theorem prover [5, 6]. The precise analysis and verification of systems employing DFT need the formal implementation of DFT in a theorem prover. Formal methods have been successfully applied in the precise analyses and verifications of hardware and software systems in the past decades. As a formal method, theorem proving can be used to model the systems based on logic and then to reason and verify the model’s properties using axioms, theorems, and inference rules in the logic. Generally, the proving tasks are performed in a theorem prover [5, 6]. For example, one needs to implement DFT formally in a theorem prover to perform the precise analyses and verifications based on DFT. In recent years, some formalization and verification [710] have been done on Fast Fourier Transform (FFT), which is the most popular and efficient DFT method. All these works focused on the specific formal implementations of FFT at different levels in diverse algorithms. Bjesse [7] verified FFT hardware at the netlist level. Capretta [8] formalized FFT at the power list level in the Coq theorem prover, while Gamboa [9] performed similar work in ACL2. Akbarpour and Tahar [10] formally verified FFT at different abstraction levels including the real specification level, the floating and fixed-point description level, and the RT and netlist gate levels, and they also analyzed the round-off accumulation errors. Although FFT may be the most widely used implementation of DFT, it cannot take place of DFT completely. DFT has its own theoretical advantages and is much simpler than FFT in both theory and algorithm. Therefore, compared with FFT, DFT has been all along a dominant method in theoretical analysis, especially when theorem proving is used to analyze the functions and properties of a system model. The applications of DFT in theorem proving are very important in the early stages of engineering design. Generally, DFT can be adopted to perform real-time computation on local data in the process of sampling, while FFT computation can only be done when all the data is obtained. Besides, DFT has more advantages over FFT in the choice of sampling rate, the memory consumption of data, and so forth. To the best of our knowledge, no work has been done previously to formalize DFT in any theorem prover. In the present paper, DFT is for the first time formalized in the HOL theorem prover. To some extent, the present work is to develop a theoretical tool rather than to just provide an application. Systematic and detailed formalization of DFT is presented here to support flexible formal analyses of various systems.

The HOL system is a well-developed theorem prover from the University of Cambridge. It is equipped with the formalized mathematic theories needed for DFT such as real analysis [11], complex field [12], and matrix theory [13, 14]. The rest of the paper is organized as follows. After the formal definition of DFT in Section 2, the fundamental properties of DFT are formalized and verified in Section 3. And then in Section 4, two case studies are presented to illustrate the usefulness of the proposed formalization of DFT, including formal analysis of FFT and the cosine frequency shift. Section 5 concludes the paper.

2. Formal Definition of DFT

For a real or complex sequence with length of in time domain, DFT transforms it to a new complex sequence with the same length in frequency domain. The mathematical definition of DFT can be written as follows:where , is the frequency spectrum. For simplification, it is substituted by in the rest of the paper. The definition can be formalized in HOL as follows.

Definition 1. DFT_def,where accumulates the complex sequence from number 0 item for items. The function is the base- exponential function in which stands for the imaginary unit and stands for . The above mentioned symbols keep the same meanings in the rest of this paper.

When , the inverse DFT (IDFT) can be expressed as follows:The IDFT can be formalized as follows.

Definition 2. IDFT_def,where stands for the DFT sequence of with length of .

3. Formal Verification of the Properties

In this section, the classical properties of DFT are formalized and verified based on Definition 1 in HOL. The formal verification of the properties can check whether or not the definition is correct and reasonable, and moreover the verified properties turn into theorems in HOL and they can be utilized directly to facilitate formal analysis of DFT based systems.

3.1. Some Useful Lemmas

To conveniently read and understand formalizations of properties of DFT, some useful lemmas verified in HOL are presented in this subsection. ConsiderThe formalization is as follows.

Lemma 3. Equality of two complex functions’ cumulative sum     ,where functions and are functions from the natural numbers to complex numbers for convenience to DFT.

Intuitively, is an -periodic complex sequence. It holds thatThe formalization is as follows.

Lemma 4. Periodicity of is    .

For a complex number , IM returns the imaginary component of . One has

Lemma 5. Inverse operation of imaginary parts of complex numbers.

Suppose is a complex function; it holds that The formalization is as follows.

Lemma 6. Compound operation and accumulating operation .

For the conjugate operator and accumulating function, there is a similar property as follows:where stands for the conjugate operator of complex numbers. The formalization is as follows.

Lemma 7. Conjugate operation and accumulating operation ,where the function returns the conjugate of a complex number.

Accumulation of a series of complex numbers can be performed on the real and imaginary parts, respectively. Considerwhere the functions RE and IM return the real and imaginary components of a complex number, respectively. The formalization is as follows.

Lemma 8. Accumulating operation of complex numbers ,  .

3.2. Implicit Periodicity

DFT is derived from the Discrete Fourier Series. Considering is an -periodic sequence, suppose is a series with -periodic extension. Then for = DFT(), is periodic. One hasThe formal description is as follows.

Theorem 9. DFT_PERIODIC     .

3.3. Linearity

For two -length sequences and , and are their DFT sequences. The linearity is as follows:We verified this property as the following theorem.

Theorem 10. DFT_LINEAR   +  .

The linearity of DFT shows that it can be applied in discrete linear system. The proof is based on Definition 1 and Lemma 3.

3.4. Symmetry

The time domain and frequency domain of DFT are conjugated dually and written asThe formal description is as follows.

Theorem 11. DFT_SYMM        .

During verifying the theorem, we need to introduce a subgoal:in order to simplify the goal. Then apply some general operation rules in real script and Lemma 3 to make this theorem proved.

3.5. Conjugated Symmetry

The sequence after DFT is of conjugated symmetry. ConsiderThe formal description is as follows.

Theorem 12. DFT_CONJ_SYMM    .

3.6. Frequency Shift

The phase shift of the sequence in the time domain corresponds to the circular shift of the sequence in the frequency domain. The frequency shift contains the left shift and the right shift. They can be used in formal verification of cosine frequency shift. One hasThe left shift and the right shift are formalized into Theorems 13 and 14, respectively.



3.7. Time Shift

Because of the duality property between the time domain and the frequency one, the circular shift of in the time domain corresponds to the phase shift of in the frequency domain. ConsiderThe formal description is as follows.

Theorem 15. DFT_TIME_SHIFT    .

3.8. Convolution

The convolution can be obtained as the product’s IDFT of two sequences’ DFT. The property facilitates a remarkable simplification. For two -length sequences and , their circular convolution is defined as follows:The formal definition is as follows.

Definition 16. DFT_CONVOLUTION.
Let be DFT of ; the circular convolution theorem holds as follows:The formal theorem is as follows.


According to the theorem, the convolution can be calculated from the IDFT of . Benefiting from Fast FT algorithms, the computing complexity can be reduced greatly.

4. Applications

To illustrate the correctness and usefulness of our work, we formally verify FFT and cosine frequency shift as examples in this section. DFT always has been implemented by employing FFT, which is one of the most important algorithms. The formal verification of FFT is the basis to verify applications which employed FFT. Frequency shift is a significant property which should be taken into account at DFT applications. The two examples are chosen for their representativeness.

4.1. FFT

Without question, DFT is extremely useful in many fields but it often takes too long time to compute DFT directly by the definition, especially for long date sequences. Therefore, many FFT algorithms had been developed to perform DFT quickly. Directly computing DFT of an -length sequence takes arithmetical operations; by comparison, FFT algorithms take arithmetical operations to produce the same result. According to Formula (1) of DFT, the rotating operator , which is a periodic complex exponential sequence, enables the complexity reduction.

For the periodic complex-power sequence , it holds conjugated symmetry and reducibility as follows:The formalization is as follows.

Lemma 18. WN_CONJ_SYMM,

The formalization is as follows.

Lemma 19. WN_REDUCE    .

Because of the conjugated symmetry of the rotating operator, some multiplying terms can be merged and the amount of the multiplications reduces by a half roughly; because of the periodicity and the reducibility of the rotating operator, a DFT of a long length sequence can be factorized into multiple DFTs of short sequences, where the shorter the sequence, the lower the computing complexity. Based on the ideas above mentioned, many FFT algorithms had been developed. In this section, we formally verify the well-known radix-2 Cooley-Tukey algorithm.

From the reducibility of , taking -length DFT and , it holds thatThe formalization is as follows.


For computing DFT of -length sequence , , the sequence is divided into two length subsequences in terms of the parity of , as follows:

Suppose that ,  ,   ; FFT can be described as follows:

FFT is consisting of the inversion processing and the butterfly shaped computation. And according to the above expressions, the FFT of is the concatenation of Formula (23). The formal description of FFT is shown in Algorithm 1.

Algorithm 1: The formal definition of FFT.

The FFT can be formally verified as an implementation of DFT. Firstly, use DEF_def and WN_REDUCE_HALF to rewrite the goal. We also need to introduce a subgoal “” to simplify the current goal. Then we can use some tactics in hol4 and some appropriate operation rules in real script and complex script to extend and transform the goal as well as WN_PERIODIC, WN_CONJ_SYMM, WN_REDUCE, and other properties mentioned above. The procedure of validation is shown in Algorithm 2.

Algorithm 2: The validation of FFT.

4.2. Cosine Frequency Shift

Frequency shift is an important property of DFT, and it can derive many other similar properties like cosine frequency shift. This subsection presents formal verification of cosine frequency shift. A typical cosine frequency shift can be formulated as follows:

To verify the formula above using the frequency shift property of DFT, should be transformed to exponential formula with Euler’s formula as follows.

Lemma 21. EULER_COS:

Its formalization is shown in Algorithm 3.

Algorithm 3: The formalization of EULER_COS.

Based on the definition of DFT and the lemma EULER_COS, Formula (25) can be formally described and verified as in Algorithm 4.

Algorithm 4: The formalization of cosine frequency shift.

In the description of cosine frequency shift as shown in Algorithm 4, is directly expanded by the definition of DFT to facilitate the proving process.

5. Conclusion

DFT is widely used in DSP and linear time invariant (LTI) systems which could be in safety-critical fields where formal methods are expected to be employed to assure accurate and complete verification. This paper presented the formalization of DFT in HOL, including formal definition of DFT, formal verification of properties of DFT, and two case studies demonstrating usefulness and correctness of our work. Our work can be equipped as a library of HOL to facilitate formal verification of systems employing DFT.

Conflict of Interests

The authors declare that there is no conflict of interests regarding the publication of this paper.


The authors thank Professor Shengzhen Jin for his helpful suggestions. This work was supported by the International Cooperation Program on Science and Technology (2010DFB10930 and 2011DFG13000), the National Natural Science Foundation of China (61170304, 61104035, 61373034, 61303014, and 61472468), the Project of Construction of Innovative Teams and Teacher Career Development for Universities and Colleges Under Beijing Municipality, and the Scientific Research Base Development Program of the Beijing Municipal Commission of Education (TJSHG201310028014).


  1. S. W. Smith, Digital Signal Processing: A Practical Guide for Engineers and Scientists, Newnes, 2002.
  2. E. O. Brigham, The Fast Fourier Transform and Its Applications, Prentice Hall, Englewood Cliffs, NJ, USA, 1988.
  3. A. Adams, M. Dunstan, H. Gottliebsen, T. Kelsey, U. Martin, and S. Owre, “Computer algebra meets automated theorem proving: integrating maple and PVS,” in Theorem Proving in Higher Order Logics, R. J. Boulton and P. B. Jackson, Eds., vol. 2152 of Lecture Notes in Computer Science, pp. 27–42, Springer, Berlin, Germany, 2001. View at Publisher · View at Google Scholar
  4. K. Homann and J. Calmet, “Combining theorem proving and symbolic mathematical computing,” in Integrating Symbolic Mathematical Computation and Artificial Intelligence: Second International Conference, AISMC-2 Cambridge, United Kingdom, August 3-5, 1994 Selected Papers, J. Calmet and J. A. Campbell, Eds., vol. 958 of Lecture Notes in Computer Science, pp. 18–29, Springer, Berlin, Germany, 1995. View at Publisher · View at Google Scholar
  5. M. J. C. Gordon, “Mechanizing programming logics in higher-order logic,” in Current Trends in Hardware Verification and Automated Theorem Proving, pp. 387–439, Springer, 1989. View at Google Scholar
  6. L. Liu, O. Hasan, and S. Tahar, “Formal reasoning about finite-state discrete-time Markov chains in HOL,” Journal of Computer Science and Technology, vol. 28, no. 2, pp. 217–231, 2013. View at Publisher · View at Google Scholar · View at MathSciNet · View at Scopus
  7. P. Bjesse, “Automatic verification of combinational and pipelined FFT circuits,” in Computer Aided Verification, vol. 1633 of Lecture Notes in Computer Science, pp. 380–393, Springer, Berlin, Germany, 1999. View at Publisher · View at Google Scholar
  8. V. Capretta, “Certifying the fast fourier transform with Coq,” in Theorem Proving in Higher Order Logics, vol. 2152 of Lecture Notes in Computer Science, pp. 154–168, Springer, 2001. View at Publisher · View at Google Scholar · View at MathSciNet
  9. R. A. Gamboa, “The Correctness of the Fast Fourier Transform: A Structural Proof in ACL2,” Formal Methods in System Design, Special Issue on UNITY, 2002.
  10. B. Akbarpour and S. Tahar, “A methodology for the formal verification of FFT algorithms in HOL,” in Proceedings of the 5th International Conference on Formal Methods in Computer-Aided Design (FMCAD '04), pp. 37–51, Austin, Tex, USA, November 2004.
  11. J. Harrison, “Constructing the real numbers in HOL,” Formal Methods in System Design, vol. 5, no. 1-2, pp. 35–59, 1994. View at Publisher · View at Google Scholar
  12. Z. Shi, L. Li, Y. Guan, X. Song, M. Wu, and J. Zhang, “Formalization of the complex number theory in HOL4,” Applied Mathematics & Information Sciences, vol. 7, no. 1, pp. 279–286, 2013. View at Publisher · View at Google Scholar
  13. Z. Shi, Y. Zhang, Z. Liu et al., “Formalization of matrix theory in HOL4,” Advances in Mechanical Engineering, vol. 6, Article ID 195276, 16 pages, 2014. View at Publisher · View at Google Scholar
  14. Z. Shi, Z. Liu, Y. Guan, S. Ye, J. Zhang, and H. Wei, “Formalization of function matrix theory in HOL,” Journal of Applied Mathematics, vol. 2014, Article ID 201214, 10 pages, 2014. View at Publisher · View at Google Scholar