Upload
others
View
9
Download
1
Embed Size (px)
Citation preview
DFTandFFTimplementationsandproofsusingACL2
MertcanTemel
11/10/17
WhatisFourierTransform?
• 3maintypes:• ContinuousTimeFourierTransform(CTFT)
• Input:Continuous,Output:Continuous• DiscreteTimeFourierTransform(DTFT)
• Input:Discrete,Output:Continuous• DiscreteFourierTransform(DFT)
• Input:Discrete,Output:Discrete
• Decompositionofasignalintothefrequenciesthatmakeitup• Applicationsinclude:• Differential/DifferenceEqs,FilterDesign,SpeechRecognition,FastLargeIntegerMultiplication…
• Theoneweareinterestedin• FastFourierTransform(FFT):someefficientalgorithmstocomputeDFT
11/10/17 1 of22
WhatisDiscreteFourierTransform(DFT)?
𝑋" = $ 𝑥&𝑒()*+&"
,-,(.
&/0
DFT
𝑥& =1𝑁$ 𝑋"𝑒
)*+&",-
,(.
"/0
InverseDFT(IDFT)
x:inputvectoroffinitelengthNxm:mth elementofxX:outputvectorofthesamelengthNXk:kth elementofXj:squarerootof-1
DFTImplementation:• Calculatethesumoverm from0toN-1foreverykin[0N-1]• TimecomplexityofO(N2)
11/10/17 2 of22
WhatisFastFourierTransform(FFT)?• AnefficientimplementationofDFT• Twomostcommonlyknownways:• Decimation-in-time(DIT)• Decimation-in-frequency(DIF)
• Restriction:vectorlengthNshouldbepowerof2.Ifnot,fillwith0s.• Arecursivealgorithm
11/10/17 3 of22
WhatisFastFourierTransform(FFT)?
11/10/17 4 of22
N/2pointDFT(FFT)
N/2pointDFT(FFT)
x0x2x4...
x1x3x5...
Evens
Odds
G0
G1
G2
.
.
.
H0
H1
H2
.
.
.
𝑊,0
𝑊,.
𝑊,*
𝑊,…
𝑊,,/*
𝑊,,/*6.
𝑊,,/*6*
𝑊,…
X0 =G0 +H0*𝑊,0
X1 =G1 +H1*𝑊,.
X2 =…
X…
XN/2XN/2+1XN/2+2X…
• where𝑊,& =𝑒()*+&/,
• Decimation-in-time• Recursivedefinitionwith
baseN=2• N=2stepisalsocalled
butterflystep• Timecomplexityof
O(Nlog(N))
WorkDoneinACL2
11/10/17 5 of22
• DFTImplementation• Prooffor(idft (dft xN)N)=x
• FFTdecimation-in-timeimplementation• Prooffor(fft xN)=(dft xN)
DFTImplementationinACL2
𝑋" = $ 𝑥&𝑒()*+&"
,-,(.
&/0
DFT
𝑥& =1𝑁$ 𝑋"𝑒
)*+&",-
,(.
"/0
InverseDFT(IDFT)
11/10/17 6 of22
ProofforIDFTofDFTofXisX
Goal:ProvethatinverseDFTofDFTofavectorgivestheoriginalvector.i.e.(idft (dft x))=x?
ACL2theorem:
11/10/17 7 of22
ProofforIDFTofDFTofXisX- Steps
Step1:PlugDFTsumintoIDFTsum.3variables:p,q,andm
1𝑁$($ 𝑥9𝑒
()*+:9,-
,(.
9/0
)𝑒)*+&:
,-,(.
:/0
Step2:Mergeexponentials
1𝑁$ $ 𝑥9𝑒
()*+:96)*+&:,-
,(.
9/0
,(.
:/0
11/10/17 8 of22
ProofforIDFTofDFTofXisX- Steps
Step2:Mergeexponentials
1𝑁$ $ 𝑥9𝑒
()*+:96)*+&:,-
,(.
𝒑/0
,(.
𝒒/0
Step3:Changesummationorder
1𝑁$ $ 𝑥9𝑒
)*+:(&(9),-
,(.
𝒒/0
,(.
𝒑/0
11/10/17 9 of22
ProofforIDFTofDFTofXisX- Steps
Step3:Changesummationorder
1𝑁$ $ 𝑥9𝑒
)*+:(&(9),-
,(.
:/0
,(.
9/0
Step4:Takexp out
1𝑁$ 𝑥9 $ 𝑒
)*+:(&(9),-
,(.
:/0
,(.
9/0
11/10/17 10 of22
ProofforIDFTofDFTofXisX- Steps
Step4:Takexp out
1𝑁$ 𝑥9 $ 𝑒
)*+:(&(9),-
,(.
:/0
,(.
9/0
Step5:Take1/Nin
$𝑥9(1𝑁$ 1 ∗ 𝑒
)*+: &(9,- )
,(.
:/0
,(.
9/0
11/10/17 11
ProofforIDFTofDFTofXisX- Steps
Step5:Take1/Nin
$𝑥9(1𝑁$ 1 ∗ 𝑒
)*+: &(9,- )
,(.
:/0
,(.
9/0
Step6:Rewriteimpulsefromidft ofones
$𝑥9𝛿[𝑚 − 𝑝],(.
9/0
where
𝛿 𝑎 = F1, 𝑎 = 00, 𝑎 ≠ 0
11/10/17 12
ProofforIDFTofDFTofXisX- Steps
Step6:Rewriteimpulsefromidft ofones
$𝑥9𝛿[𝑚 − 𝑝],(.
9/0
where
𝛿 𝑎 = F1, 𝑎 = 00, 𝑎 ≠ 0
Step7:Equatethetermto𝑥&.Thisconcludestheproof.
11/10/17 13
FFTImplementationinACL2
11/10/17 14
N/2pointDFT(FFT)
N/2pointDFT(FFT)
x0x2x4...
x1x3x5...
Evens
Odds
G0
G1
G2
.
.
.
H0
H1
H2
.
.
.
𝑊,0
𝑊,.
𝑊,*
𝑊,…
𝑊,,/*
𝑊,,/*6.
𝑊,,/*6*
𝑊,…
X0 =G0 +H0*𝑊,0
X1 =G1 +H1*𝑊,.
X2 =…
X…
XN/2XN/2+1XN/2+2X…
• where𝑊,& =
𝑒()*+&/,• Recursivelycalculate
N/2pointFFTsofevenandoddindices
• PerformG+H*Wovereachelement(GandHvaluesareusedtwice)
FFTImplementationinACL2
11/10/17 15
ProofforFFTisDFT
11/10/17 16
• BasicideaofFFT:• Getridofredundant/repeatedmultiplications• Rememberintermediateresults
• DifferentderivationsforDecimation-in-time(DIT)andDecimation-in-frequency(DIF).OnlyDITwillbediscussedhere.• ACL2Theorem:
ProofforFFTisDFT- Steps
11/10/17 17
DFTformula:
𝑋" = $ 𝑥J𝑒()*+J"
,-,(.
J/0
Step1:Divideintotwosummations
𝑋" = $ 𝑥*J𝑒()*+(*J)"
,-,/*(.
J/0
+ $ 𝑥*J6.𝑒()*+(*J6.)"
,-,/*(.
J/0
ProofforFFTisDFT- Steps
11/10/17 18
Step1:Divideintotwosummations
𝑋" = $ 𝑥*J𝑒()*+(*J)"
,-,/*(.
J/0
+ $ 𝑥*J6.𝑒()*+(*J6.)"
,-,/*(.
J/0
Step2:Distributeandcommuteconstants
𝑋" = $ 𝑥*J𝑒()*+"
(,/*)-,/*(.
J/0
+ $ 𝑥*J6.𝑒()*+"J
(,/*)- 𝑒()*+"
,-,/*(.
J/0
ProofforFFTisDFT- Steps
11/10/17 19
Step2:Distributeandcommuteconstants
𝑋" = $ 𝑥*J𝑒()*+"
(,/*)-,/*(.
J/0
+ $ 𝑥*J6.𝑒()*+"J
(,/*)- 𝑒()*+"
,-,/*(.
J/0
Step3:Taketheconstantexponentialout
𝑋" = $ 𝑥*J𝑒()*+"
(,/*)-,/*(.
J/0
+ (𝑒()*+"
,- ) $ 𝑥*J6.𝑒()*+"J
(,/*)-,/*(.
J/0
ProofforFFTisDFT- Steps
11/10/17 20
Step3:Taketheconstantexponentialout
𝑋" = $ 𝑥*J𝑒()*+"
(,/*)-,/*(.
J/0
+ (𝑒()*+"
,- ) $ 𝑥*J6.𝑒()*+"J
(,/*)-,/*(.
J/0
Observation1:𝑋" = (𝑁/2𝑝𝑜𝑖𝑛𝑡𝐷𝐹𝑇𝑜𝑓𝑒𝑣𝑒𝑛𝑠𝑥) + (𝑒
()*+",- ) ∗ (𝑁/2𝑝𝑜𝑖𝑛𝑡𝐷𝐹𝑇𝑜𝑓𝑜𝑑𝑑𝑠𝑥)
Observation2:NpointDFTisperiodicwithN(i.e.Xk =Xk+N)
ProofforFFTisDFT- Steps
11/10/17 21
Observation1:𝑋" = (𝑁/2𝑝𝑜𝑖𝑛𝑡𝐷𝐹𝑇𝑜𝑓𝑒𝑣𝑒𝑛𝑠𝑥) + (𝑒
()*+",- ) ∗ (𝑁/2𝑝𝑜𝑖𝑛𝑡𝐷𝐹𝑇𝑜𝑓𝑜𝑑𝑑𝑠𝑥)
Observation2:NpointDFTisperiodicwithN(i.e.Xk =Xk+N)=>1st and2nd DFTsgivethesameresultforkandk+N/2
(e.g.evendft(x)k=evendft(x)k+N/2)=>Insteadofcalculatingseparatelyforallk∈ [0N-1],
calculate1st and2nd DFTsfork∈ [0N/2-1]rememberandusethosevaluestwiceforkandk+N/2
Applyingtheseconcludestheproof.
FutureWork
11/10/17 22
ImplementthisFFTweb,- intheDEsysteminACL2- asaself-timed,asynchronouscircuit