\documentclass[11pt]{article}

\usepackage{fullpage}
%\usepackage{epic}
%\usepackage{eepic}
\usepackage{psfig}

%\newcommand{\proof}[1]{
%{\noindent {\it Proof.} {#1} \rule{2mm}{2mm} \vskip \belowdisplayskip}
%}


%\newtheorem{lemma}{Lemma}[section]
%\newtheorem{theorem}[lemma]{Theorem}
%\newtheorem{claim}[lemma]{Claim}
%\newtheorem{definition}[lemma]{Definition}
%\newtheorem{corollary}[lemma]{Corollary}

%Theorems and likes
\newtheorem{assumption}{Assumption}[section]
\newtheorem{theorem}{Theorem}[section]
\newtheorem{fact}{Fact}[section]
\newtheorem{claim}{Claim}[section]
\newtheorem{lemma}{Lemma}[section]
\newtheorem{definition}{Definition}[section]
\newtheorem{corollary}{Corollary}[section]


\newcommand{\bproof}{\noindent{\it Proof}}
%\newcommand{\eproof}{\hspace*{\fill}$\Box$~~~~~\bigskip}
\newcommand{\eproof}{\hspace*{\fill}\rule{2mm}{2mm}~~~~~\bigskip}
\newenvironment{proof}{\bproof: }{\eproof}

% symbols and notation
\newcommand{\defeq}{\stackrel{\rm def}{=}}


\setlength{\oddsidemargin}{0in}
\setlength{\topmargin}{0in}
\setlength{\textwidth}{6in}
\setlength{\textheight}{8in}

\begin{document}

\setlength{\fboxrule}{.5mm}\setlength{\fboxsep}{1.2mm}
\newlength{\boxlength}\setlength{\boxlength}{\textwidth}
\addtolength{\boxlength}{-4mm}
\begin{center}\framebox{\parbox{\boxlength}{\bf
CS 681: Computational Number Theory and Algebra \hfill Lecture 17
\\
Lecturer: Manindra Agrawal \hfill
Notes by: Ashwini Aroskar
%\\
\begin{flushright}
%date
September 15, 2005.
\end{flushright}
}}\end{center}
\vspace{5mm}

\section{Hensel Lifting}

%\begin{fact}
%\label{first-fact}
%\end{fact}

Let $R$ be a unique factorization domain. \\e.g. $R = Z$, the ring
of integers; or $R=F[x]$, $F$ is a field.\\
\\
Let $f(y) \in R[y]$.\\ Let $m \in R$.\\
\\
Suppose we know $f=gh(\mbox{mod } m)$ and $s$ and $t$ are such
that
$sg+th=1(mod$ $m)$.\\
Then, Hensel Lifting efficiently computes $f=g^{'}h^{'}(\mbox{mod
}m^2)$ and $s^{'}$, $t^{'}$,\\ such that, \quad $s^{'}g^{'} +
t^{'}h^{'}= 1(\mbox{mod }m^2)$, \\ and \quad $g^{'} = g(\mbox{mod
}m)$ \quad
\& \quad $h^{'} = h(\mbox{mod }m)$.\\
\\
Let $e=f-gh(\mbox{mod }m^2)$.\\
\\
Assume $e \neq 0$. \quad [If $e=0$, then we need not use Hensel
Lifting.]\\
\\
Let $g^{'}=g+te(\mbox{mod }m^2)$\\
\& \quad $h^{'}=h+se(\mbox{mod }m^2)$\\
\\
\begin{eqnarray*}
g^{'}h^{'}(mod m^2) & = & (g+te)(h+se) (\mbox{mod } m^2)\\
 & = & gh + (sg+th)e + ste^2 (\mbox{mod } m^2)\\
 & = & gh + (1+ m\mu)e(\mbox{mod } m^2) \quad \mbox{ as } e \vert m\\
 & = & gh + e (\mbox{mod } m^2)\\
 & = & f (\mbox{mod } m^2)\\
\end{eqnarray*}
\\
Let $d = sg^{'} + th^{'} - 1 (\mbox{mod } m^2)$\\
Note that $d=0(\mbox{mod } m)$ as $g^{'}=g(\mbox{mod } m)$ \&
$h^{'}=h(\mbox{mod } m)$\\
Let $s^{'}=s(1-d) (\mbox{mod } m^2)$\\
and $t^{'}=t(1-d) (\mbox{mod } m^2)$\\
\\
\begin{eqnarray*}
s^{'}g^{'}+t^{'}h^{'} & = & s(1-d)g^{'} + t(1-d)h^{'} (\mbox{mod }
m^2)\\
& = & (sg^{'}+th^{'})(1-d)(\mbox{mod } m^2)\\
& = & (1+d)(1-d) (\mbox{mod } m^2)\\
& = & 1 - d^2 (\mbox{mod } m^2)\\
& = & 1 (\mbox{mod } m^2) \\
\end{eqnarray*}
\\
Remark : As described above, $\deg g^{'}$ or $\deg h^{'}$ can
exceed $\deg f$, while $f=g^{'}h^{'}(\mbox{mod }m^2)$. So the
degrees of factors can keep increasing at every iteration, which
is undesirable.
This problem can be resolved, as we shall see later.\\

\section{Polynomial Division}
Given $f$, $g$ of degree $n$ and $m$ respectively, compute $q$ and
$r$ such that $f=qg+r$ with $\deg r < m$.\\
\\
Obvious Time Complexity = $\bigcirc (nm)$ \quad (using long
division)\\
\\
Let $\hat{f}= x^nf(\frac{1}{x})$.\\
\\
So, \quad $x^nf(\frac{1}{x}) = x^n[q(\frac{1}{x})g(\frac{1}{x}) +
r(\frac{1}{x})]$\\
\quad $\hat{f}(x) = \hat{q}(x)\hat{g}(x) + x^{n-\deg r}\hat{r}(x)$
\quad and \quad $n-\deg r \geq n-m+1$
\\
$\hat{f}(x) = \hat{q}(x)\hat{g}(x) (\mbox{mod }x^{n-m+1})$\\
\\
Now the constant term of $\hat{g}(x)$ is the leading coefficient
of $g(x)$ and hence non-zero. So, $\hat{g}(x)$ has an inverse
$\mbox{modulo }x^{n-m+1}$.\\
So, $\hat{q}(x) = \hat{f}(x)\hat{g}^{-1}(x) (\mbox{mod }x^{n-m+1})$\\
\\
\underline{Problem}: To compute $\hat{g}^{-1}(x)$ from $g(x)$
$(\mbox{mod }x^{n-m+1})$\\
\\
Let $\hat{g}h=1 (\mbox{mod }x)$.\\
So, $h = $a constant, the inverse of the leading coefficient of $g$.\\
Let $s=h$ and $t=0$. So, $s\hat{g}+th=1(\mbox{mod }x)$.\\
\\
Note that, $\hat{g}^{'} = g$ and $t^{'}=0$ as $t=0$. Hence,
$\hat{g}$ and $t$ remain unchanged for every application of Hensel
lifting.\\
Eventually we get $\hat{g}\tilde{h}=1(\mbox{mod }x^{2^k})$\quad
with $2^k \geq n-m+1$\\
Once we obtain $\hat{g}^{-1}(x) =\tilde{h}(x)$, we can get
$\hat{q}(x)$ \& $q(x)$ and then compute $r(x)$.\\
\\
At the $i^{th}$ step, we carry out a constant number of additions
and multiplications (using $FFT$) of polynomials of $\deg < 2^i$
and also quotient polynomials $(\mbox{mod }x^{2^i})$ \\
\\
Time complexity $ = \bigcirc(\sum_{i=1}^{\log n} 2^i i) +
\bigcirc(n\log n) = \bigcirc(n\log n)$\\
\\
Note that we started with $m=x$ for Hensel lifting in this case,
but $x \notin R$. But this lifting is valid because of our choice
of $t=0$.\\


\end{document}

