% $Id: datarep-sec.tex,v 1.5 2002/04/17 20:05:58 ellard Exp $

\section{Introduction}

In order to understand how a computer is able
to manipulate data and perform computations,
you must first understand how data is represented by a computer.

At the lowest level, the indivisible unit of data in a computer is a
{\em bit}\index{bit}.
A bit represents a single binary value, which may be either 1 or 0.
In different contexts, a bit value of 1 and 0 may also be referred to as
``true'' and ``false'',
``yes'' and ``no'',
``high'' and ``low'',
``set'' and ``not set'', or
``on'' and ``off''.

The decision to use binary values, rather than something larger (such
as decimal values) was not purely arbitrary-- it is due
in a large part to the relative simplicity of building electronic
devices that can manipulate binary values.

\section{Representing Integers}

\subsection{Unsigned Binary Numbers}
\index{unsigned binary numbers}

%%% This really needs some explanation here.

While the idea of a number system with only two values may
seem odd, it is actually very similar to the decimal system
we are all familiar
with, except that each digit is a bit containing a 0 or 1
rather than a number from 0 to 9.
(The word ``bit'' itself is a contraction of the words ``binary digit'')
For example, figure~\ref{datarep-binary-decimal-table} shows several
binary numbers, and the equivalent decimal numbers.

\begin{figure}[hbtp]
\caption{Binary and Decimal Numbers}
\label{datarep-binary-decimal-table}
\begin{center}
\begin{tabular}{|rcr|}
\hline
{\bf Binary}    &       & {\bf Decimal} \\
\hline
       0        & =             & 0     \\
       1        & =             & 1     \\
      10        & =             & 2     \\
      11        & =             & 3     \\
     100        & =             & 4     \\
     101        & =             & 5     \\
     110        & =             & 6     \\
$\vdots$        & $\vdots$      & $\vdots$      \\
11111111        & =             & 255   \\
\hline
\end{tabular}
\end{center}
\end{figure}

In general, the binary representation of $2^{k}$ has a $1$ in
binary digit $k$ (counting from the {\em right}, starting at 0)
and a $0$ in every other digit.
(For notational convenience,
the $i$th bit of a binary number $A$ will be
denoted as $A_{i}$.)

The binary representation of a number that is not a power
of 2 has the bits set corresponding to the powers of two
that sum to the number:  for example, the decimal number
$6$ can be expressed in terms of powers of 2 as
$1 \times 2^{2} ~+~ 1 \times 2^{1} ~+~ 0 \times 2^{0}$,
so it is written in binary as $110$.

An eight-digit binary number is commonly called a {\em byte}.
In this text, binary numbers will usually be written as bytes
(i.e. as strings of eight binary digits).  For example, the binary number
$101$ would usually be written as $00000101$-- a $101$
padded on the left with five zeros, for a total of eight digits.

Whenever there is any possibility of ambiguity between
decimal and binary notation, the {\em base} of the number
system (which is 2 for binary, and 10 for decimal) is
appended to the number as a subscript.  Therefore, $101_{2}$
will always be interpreted as the binary representation for five,
and never the decimal representation of one hundred and one
(which would be written as $101_{10}$).

\subsubsection{Conversion of Binary to Decimal}
\label{datarep-binary-to-decimal-sec}

To convert an unsigned binary number to a decimal number, add
up the decimal values of the powers of 2 corresponding to bits
which are set to 1 in the binary number.
Algorithm~\ref{datarep-binary-to-decimal-alg} shows a method to do this.
Some examples of conversions from binary to decimal
are given in figure~\ref{datarep-bin-to-dec-figure}.

\begin{algorithm}{Binary to Decimal}{datarep-binary-to-decimal-alg}{
        To convert a binary number to decimal.
}

\begin{itemize}
\item   Let $X$ be a binary number, $n$ digits in length, composed of bits
                $X_{n-1} \cdots X_{0}$.
\item   Let $D$ be a decimal number.
\item   Let $i$ be a counter.
\end{itemize}

\begin{enumerate}
\item   Let $D \leftarrow 0$.
\item   Let $i \leftarrow 0$.
\item   While $i < n$ do:
        \begin{itemize}
        \item   If $X_{i}$ is $1$
                (i.e. if bit $i$ in $X$ is $1$),
                then set $D \leftarrow (D + 2^{i})$.
        \item   Set $i \leftarrow (i + 1)$.
        \end{itemize}
\end{enumerate}
\end{algorithm}

\begin{figure}[hbtp]
\caption{Examples of Conversion from Binary to Decimal}
\label{datarep-bin-to-dec-figure}
\begin{center}
\begin{tabular}{|lclclcr|}
\hline
{\bf Binary}    & & & & & & {\bf Decimal} \\
\hline

00000000        & = &   $0$                     & = &
                        $0$                     & = & 0 \\
& & & & & & \\
00000101        & = & $2^2 + 2^0$               & = &
                        $4 + 1$                 & = & 5 \\
& & & & & & \\
00000110        & = & $2^2 + 2^1$               & = &
                        $4 + 2$                 & = & 6 \\
& & & & & & \\
00101101        & = & $2^5 + 2^3 + 2^2 + 2^0$   & = &
                        $32 + 8 + 4 + 1$        & = & 45 \\
& & & & & & \\
10110000        & = & $2^7 + 2^5 + 2^4$         & = &
                        $128 + 32 + 16$         & = & 176 \\
\hline
\end{tabular}
\end{center}
\end{figure}

Since there are $2^{n}$ unique sequences of $n$ bits,
if all the possible bit sequences of length $n$ are used,
starting from zero, the largest number will be $2^{n} - 1$.

\subsubsection{Conversion of Decimal to Binary}
\label{datarep-decimal-to-binary-algorithm}

An algorithm for converting a decimal number to binary notation is
given in algorithm~\ref{datarep-decimal-to-binary-alg}.

\begin{algorithm}{Decimal to Binary}{datarep-decimal-to-binary-alg}{
        To convert a positive decimal number to binary.
}

\begin{itemize}
\item   Let $X$ be an unsigned binary number, $n$ digits in length.
\item   Let $D$ be a positive decimal number, no larger than $2^{n} - 1$.
\item   Let $i$ be a counter.
\end{itemize}
\begin{enumerate}
\item   Let $X \leftarrow 0$ (set all bits in $X$ to $0$).
\item   Let $i \leftarrow (n - 1)$.
\item   While $i \geq 0$ do:
        \begin{enumerate}
        \item   If $D \geq 2^{i}$, then
                \begin{itemize}
                \item   Set $X_{i} \leftarrow 1$
                        (i.e. set bit $i$ of $X$ to $1$).
                \item   Set $D \leftarrow (D - 2^{i})$.
                \end{itemize}
        \item   Set $i \leftarrow (i - 1)$.
        \end{enumerate}
\end{enumerate}
\end{algorithm}

\subsubsection{Addition of Unsigned Binary Numbers}
\label{datarep-unsigned-addition-sec}

Addition of binary numbers can be done in exactly the same
way as addition of decimal numbers, except that all of the
operations are done in binary (base 2) rather than
decimal (base 10).
Algorithm~\ref{datarep-unsigned-addition-alg} gives a method
which can be used to perform binary addition.

\begin{algorithm}{Unsigned Binary Addition}{datarep-unsigned-addition-alg}{
        Addition of unsigned binary numbers.
}

\begin{itemize}
\item   Let $A$ and $B$ be a pair of $n$-bit binary numbers.
\item   Let $X$ be a binary number which will hold the sum of $A$ and $B$.
\item   Let $c$ and $\hat{c}$ be carry bits.
\item   Let $i$ be a counter.
\item   Let $s$ be an integer.
\end{itemize}
\begin{enumerate}
\item   Let $c \leftarrow 0$.
\item   Let $i \leftarrow 0$.
\item   While $i < n$ do:
        \begin{enumerate}
	\item	Set $s \leftarrow A_{i} + B_{i} + c$.
        \item   Set $X_{i}$ and $\hat{c}$ according to the
		following rules:
		\begin{itemize}
		\item	If $s$ is $0$, then
			$X_{i} \leftarrow 0$ and $\hat{c} \leftarrow 0$.
		\item	If $s$ is $1$, then
			$X_{i} \leftarrow 1$ and $\hat{c} \leftarrow 0$.
		\item	If $s$ is $2$, then
			$X_{i} \leftarrow 0$ and $\hat{c} \leftarrow 1$.
		\item	If $s$ is $3$, then
			$X_{i} \leftarrow 1$ and $\hat{c} \leftarrow 1$.
		\end{itemize}
        \item   Set $c \leftarrow \hat{c}$.
        \item   Set $i \leftarrow (i + 1)$.
        \end{enumerate}
\end{enumerate}

\end{algorithm}

When algorithm~\ref{datarep-unsigned-addition-alg} terminates,
if $c$ is not 0, then an {\em overflow}\index{overflow}
has occurred-- the resulting number is simply too large to
be represented by
an $n$-bit unsigned binary number.

\subsection{Signed Binary Numbers}
\index{signed binary numbers}

The major flaw with the representation that we've used for
unsigned binary numbers is that it doesn't include a way to
represent negative numbers.

There are a number of ways to extend the unsigned representation
to include negative numbers.
One of the easiest is to add an additional bit
to each number that is used to represent the {\em sign} of the
number-- if this bit is $1$, then the number is negative; otherwise
the number is positive (or vice versa).
This is analogous to the way that we write negative numbers
in decimal-- if the first symbol of the number is a negative sign,
then the number is negative, otherwise the number is positive.

Unfortunately, when we try to adapt the algorithm for addition
to work properly with this representation, this apparently simple
method turns out to cause some trouble.
Instead of simply adding the numbers together
as we do with unsigned numbers, we now need to consider
whether the numbers being added are positive or negative.
If one number is positive and the other negative, then we
actually need to do subtraction instead of addition, so
we'll need to find an algorithm for subtraction.  Furthermore,
once we've done the subtraction, we need to compare the
the unsigned magnitudes of the numbers to determine whether the
result is positive or negative!

Luckily, there is a representation that allows us to represent
negative numbers in such a way that addition (or subtraction)
can be done easily, using algorithms very similar to the ones
that we already have.
The representation that we will use
is called {\em two's complement} notation.
\index{two's complement}
\index{2's complement}

To introduce two's complement, we'll start by defining, in
algorithm~\ref{datarep-twos-complement-negate-alg}, the
algorithm that is used to compute the negation of a two's complement number.

\begin{algorithm}{Two's Complement Negation}
	{datarep-twos-complement-negate-alg}{
        Negation of a two's complement number.
}

\begin{enumerate}
\item   Let $\bar{x}$ be the
        {\em logical complement}\index{logical complement} of $x$.

        The logical complement (also called the {\em one's complement})
        \index{one's complement} \index{1's complement}
        is formed by flipping all the bits in the number, changing
        all of the $1$ bits to $0$, and vice versa.

\item   Let $X \leftarrow \bar{x} + 1$.

        If this addition {\em overflows}, then the overflow bit
        is discarded.
\end{enumerate}

By the definition of two's complement, the resulting $X$ is the
negation of the original $x$.

\end{algorithm}

Figure~\ref{datarep-twos-complement-neg-table}
shows the process of negating several
numbers.  Note that the negation of zero is zero.

\begin{figure}[hbtp]
\caption{Examples of Negation Using Two's Complement}
\begin{center}
\label{datarep-twos-complement-neg-table}

\begin{tabular}{llcr}
                & 00000110      & = & 6 \\
1's complement  & 11111001      &   &   \\
Add 1           & 11111010      & = & -6 \\
\\
\end{tabular}

\begin{tabular}{llcr}
                & 11111010      & = & -6 \\
1's complement  & 00000101      &   &   \\
Add 1           & 00000110      & = & 6 \\
\\
\end{tabular}

\begin{tabular}{llcr}
                & 00000000      & = & 0 \\
1's complement  & 11111111      &   &   \\
Add 1           & 00000000      & = & 0 \\
\\
\end{tabular}
\end{center}
\end{figure}

This representation has several important properties:
\begin{itemize}
\item   The leftmost (most significant)
        bit also serves as a sign bit; if 1, then the number is negative,
        if 0, then the number is positive or zero.

\item   The rightmost (least significant)
        bit of a number always determines
        whether or not the number is odd or even--
        if bit 0 is 0, then the number is even, otherwise the number is odd.

\item   The largest positive number that can be represented in
        two's complement notation in an $n$-bit binary number is $2^{n-1} - 1$.
        For example, if $n$ is $8$, then the largest positive number is
        $01111111 ~~=~~ 2^{7} - 1 ~~=~~ 127$.

\item   Similarly, the ``most negative'' number is $-2^{n-1}$, so
        if $n = 8$, then it is $10000000$, which is $-2^{7} ~~=~~ -128$.
        Note that the negative of the most negative number (in this
        case, 128) cannot be represented in this notation.
\end{itemize}

\subsubsection{Addition and Subtraction of Signed Binary Numbers}

The same addition algorithm that was used for unsigned binary numbers
also works properly for two's complement numbers.

\begin{tabular}{llcr}
        \\
        &       00000101        & = & 5         \\
  $+$   &       11110101        & = & -11       \\
\hline
        &       11111010        & = & -6        \\
        \\
\end{tabular}

Subtraction is also done in a similar way: to subtract A from B, take
the two's complement of A and then add this number to B.

The conditions for detecting overflow are different for signed
and unsigned numbers, however.  If we use
algorithm~\ref{datarep-unsigned-addition-alg} to add two unsigned numbers,
then if $c$ is $1$ when the addition terminates,
this indicates that the result has an absolute value
too large to fit the number of bits allowed.
With signed numbers, however, $c$ is not relevant, and an overflow
occurs when the signs of both numbers being added are the same
but the sign of the result is opposite.  If the two numbers being added have
opposite signs, however, then an overflow {\em cannot} occur.

For example, consider the sum of $1$ and $-1$:

\begin{tabular}{llcrl}
        \\
        &       00000001        & = & 1         & \\
  $+$   &       11111111        & = & -1        & \\
\hline
        &       00000000        & = & 0         & {\bf Correct!}        \\
        \\
\end{tabular}

In this case, the addition will overflow, but it is not
an error, since the result that we get (without considering
the overflow) is exactly correct.

On the other hand, if we compute the sum of 127 and 1, then
a serious error occurs:

\begin{tabular}{llcrl}
        \\
        &       01111111        & = & 127       &       \\
  $+$   &       00000001        & = & 1         &       \\
\hline
        &       10000000        & = & -128      & {\bf Uh-oh!}  \\
        \\
\end{tabular}

Therefore, we must be very careful when doing signed binary arithmetic
that we take steps to detect bogus results.
In general:
\begin{itemize}
\item   If $A$ and $B$ are of the same sign, but $A + B$ is of
        the opposite sign, then an overflow or wraparound error
        has occurred.
\item   If $A$ and $B$ are of different signs, then $A + B$ will
        never overflow or wraparound.
\end{itemize}

\subsubsection{Shifting Signed Binary Numbers}

Another useful property of the two's complement notation
is the ease with which numbers can be multiplied or divided by
two.  To multiply a number by two, simply shift the number ``up''
(to the left) by one bit, placing a 0 in the least significant bit.
To divide a number in half, simply shift the the number ``down''
(to the right) by one bit (but do not change the sign bit).

Note that in the case of odd numbers, the effect of shifting
to the right one bit is like dividing in half, rounded towards
negative infinity, so that 51 shifted to the right one bit becomes 25,
while -51 shifted to the right one bit becomes -26.

\begin{figure}
\caption{ Doubling and Halving Two's Complement Numbers }
\begin{center}
\begin{tabular}{llcr}
\\
                & 00000001      & = & 1 \\
Double          & 00000010      & = & 2 \\
Halve		& 00000000      & = & 0 \\
\\
                & 00110011      & = & 51 \\
Double          & 01100110      & = & 102 \\
Halve           & 00011001      & = & 25 \\
\\
                & 11001101      & = & -51 \\
Double          & 10011010      & = & -102 \\
Halve           & 11100110      & = & -26 \\
\\
\end{tabular}
\end{center}
\end{figure}

\subsubsection{Hexadecimal Notation}
\index{hexadecimal}
\index{octal}

Writing numbers in binary notation can soon get tedious,
since even relatively small numbers require many
binary digits to express.  A more compact notation, called {\em hexadecimal}
(base 16), is usually used to express large binary numbers.
In hexadecimal, each digit represents four unsigned binary digits.

Another notation, which is not as common currently, is called {\em octal}
and uses base eight to represent groups of three bits.
Figure~\ref{datarep-hex-oct-table} show examples of binary, decimal, octal, and
hexadecimal numbers.

\begin{figure}
\caption{Hexadecimal and Octal}
\label{datarep-hex-oct-table}
\begin{center}
\begin{tabular}{|l|c|c|c|c|c|c|c|c|}
\hline
Binary  & 0000  & 0001  & 0010  & 0011  & 0100  & 0101  & 0110  & 0111  \\
\hline
Decimal & 0     & 1     & 2     & 3     & 4     & 5     & 6     & 7     \\
\hline
Hex     & 0     & 1     & 2     & 3     & 4     & 5     & 6     & 7     \\
\hline
Octal   & 0     & 1     & 2     & 3     & 4     & 5     & 6     & 7     \\
\hline
\end{tabular}
\end{center}

\begin{center}
\begin{tabular}{|l|c|c|c|c|c|c|c|c|}
\hline
Binary  & 1000  & 1001  & 1010  & 1011  & 1100  & 1101  & 1110  & 1111  \\
\hline
Decimal & 8     & 9     & 10    & 11    & 12    & 13    & 14    & 15    \\
\hline
Hex     & 8     & 9     & A     & B     & C     & D     & E     & F     \\
\hline
Octal   & 10    & 11    & 12    & 13    & 14    & 15    & 16    & 17    \\
\hline
\end{tabular}
\end{center}
\end{figure}

For example, the number ${\tt 200}_{10}$ can be written as
${\tt 11001000}_{2}$,
${\tt C8}_{16}$, or
${\tt 310}_{8}$.

\section{Representing Characters}

Just as sequences of bits can be used to represent numbers,
they can also be used to represent the letters of the alphabet,
as well as other characters.

Since all sequences of bits represent numbers, one way to
think about representing characters by sequences of bits
is to choose a number that corresponds to each character.
The most popular correspondence currently is the ASCII character set.
\index{ASCII}
ASCII, which stands for the American Standard Code for Information
Interchange, uses 7-bit integers to represent characters, using the
correspondence shown in table~\ref{ascii}.

%%% Jam the ASCII table in here.
\begin{figure}[hbt]
\caption{The ASCII Character Set}
\label{ascii}
\index{ASCII}
\begin{center}
\input{ascii}
\end{center}
\end{figure}

When the ASCII character set was chosen, some care was taken to
organize the way that characters are represented in order to make
them easy for a computer to manipulate.  For example, all of the
letters of the alphabet are arranged in order, so that sorting
characters into alphabetical order is the same as sorting in
numerical order.
In addition, different classes of characters
are arranged to have useful relations.  For example, to convert
the code for a lowercase letter to the code for the same letter in
uppercase, simply set the 6th bit of the code to 0 (or subtract 32).
ASCII is by no means the only character set to have
similar useful properties, but it has emerged as the standard.

The ASCII character set does have some important limitations, however.
One problem is that the character set only defines the representations
of the characters used in written English.  This causes problems with
using ASCII to represent other written languages.  In particular,
there simply aren't enough bits to represent all the written characters
of languages with a larger number of characters (such as Chinese or
Japanese).  Already new character sets which address these problems
(and can be used to represent characters of many languages side
by side) are being proposed, and eventually there will unquestionably
be a shift away from ASCII to a new multilanguage standard\footnote{
        This shift will break many, many existing programs.  Converting
        all of these programs will keep many, many programmers busy
        for some time.}.

%% This section isn't really very good, and
%% is unnecessary for CS50 anyway, so out it goes...
%% \input{datarep/datarep-representing-rational-numbers-de1}

\section{Representing Programs}

Just as sequences of bits can be used to represent numbers, they can
also be used to represent instructions for a computer to perform.
Unlike the two's complement notation for integers, which is a standard
representation used by nearly all computers, the representation of
instructions, and even the set of instructions, varies widely from one
type of computer to another.

The {\sc Ant-8} architecture, which is the focus of the rest of this
document, uses a relatively simple and straightforward representation.
Each instruction is exactly 16 bits in length, and consists of several
bit fields, as depicted in
figure~\ref{datarep-ant-instruction-figure}.

\begin{figure}[hbtp]
\caption{{\sc Ant-8} Instruction Formats}
\label{datarep-ant-instruction-figure}
\begin{center}
\begin{tabular}{|p{1.0in}|p{1.0in}|p{1.0in}|p{1.0in}|}
\hline
4 bits & 4 bits & 4 bits & 4 bits \\
\hline
\hline
op & des & reg1 & reg2 \\
\hline
op & des & reg1 & 4-bit constant \\
\hline
op & reg & \multicolumn{2}{|l|}{8-bit constant} \\
\hline
\end{tabular}
\end{center}
\end{figure}

The first four bits (reading from the left, or high-order bits) of
each instruction are called the {\tt op} field.  The op field
determines what operation the instruction represents.  Depending on
what the op is, the rest of the instruction may represent the names of
registers or constants used by the op.

For example, the instruction $1234_{16}$ has an op of 1, which
corresponds to the operation of loading a constant ({\tt
lc}).\footnote{The fact that most of the instructions consist of four
4-bit fields makes hexadecimal notation particularly appropriate for
expressing {\sc Ant-8} instructions.} With the addition operation, the
next 4-bit fields is interpreted as the names of the register to use
load the constant into, and the last 8 bits are the constant to load.
Therefore, instruction $1234_{16}$ places the value {\tt 0x34} into
register 2.  (The {\tt lc} instruction and the rest of the {\sc Ant-8}
instructions are described more fully in the {\sc Ant-8} tutorial.)

\section{Memory Organization}

We've seen how sequences of binary digits can be used
to represent numbers, characters, and instructions.
In a computer, these binary digits
are organized and manipulated in discrete groups,
and these groups are said to be the {\em memory} of the computer.

\subsection{Units of Memory}

The smallest of these groups, on most computers,
is called a {\em byte}\index{byte}.
On nearly all currently popular computers a byte is composed of 8 bits.

The next largest unit of memory is usually composed of
16 bits.  What this unit is called varies from computer
to computer-- on smaller machines, this is often called
a {\em word}\index{word}, while on newer architectures that
can handle larger chunks of data,
this is called a {\em halfword}\index{halfword}.

The next largest unit of memory is usually composed of 32 bits.
Once again, the name of this unit varies-- on smaller machines,
it is referred to as a {\em long}\index{long}, while
on newer and larger machines it is called a {\em word}\index{word}.

Finally, on the newest machines, the computer also can handle
data in groups of 64 bits.  On a smaller machine, this is known
as a {\em quadword}\index{quadword}, while on a larger machine
this is known as a {\em long}\index{long}.

\subsubsection{Historical Perspective}

There have been architectures that have used nearly
every imaginable word size-- from 6-bit bytes to 9-bit bytes,
and word sizes ranging from 12 bits to 48 bits.
There are even a few architectures that have no fixed
word size at all (such as the CM-2) or word sizes that
can be specified by the operating system at runtime.

Over the years, however, most architectures have converged
on 8-bit bytes and 32-bit longwords.
An 8-bit byte is a good match for the ASCII character set
(which has some popular extensions that require 8 bits),
and a 32-bit word has been, at least until recently,
large enough for most practical purposes.

\subsection{Addresses and Pointers}

Each unique byte\footnote{
	In some computers, the smallest distinct unit of memory
	is not a byte.  For the sake of simplicity, however,
	this section assumes that the smallest distinct unit
	of memory on the computer in question is a byte.}
of the computer's memory is given a unique identifier, known
as its {\em address}.  The {\em address of} a piece of memory is
often referred to as a {\em pointer to} that piece of memory--
the two terms are synonymous, although there are many contexts
where one is commonly used and the other is not.

The memory of the computer itself is often organized as a large array
(or group of arrays) of bytes of memory.  In this organization, the
address of each byte of memory is simply the index of the memory array
location where that byte is stored.

\subsection{Summary}

In this chapter, we've seen how computers represent integers
using groups of bits, and how basic arithmetic and other
operations can be performed using this representation.

We've also seen how the integers or groups of bits can be used
to represent several different kinds of data,
including written characters (using the ASCII character codes),
instructions for the computer to execute,
and addresses or pointers, which can be used to reference other data.

There are also many other ways that information can be represented
using groups of bits, including representations for rational
numbers (usually by a representation called {\em floating point}),
irrational numbers, graphics, arbitrary character sets, and
so on.  These topics, unfortunately, are beyond the scope of this
chapter.


\section{KFAC: Block-tridiagonal inverse approx, $\hat{F}^{-1} \approx \tilde{F}^{-1}$}
\frame{\tableofcontents[currentsection, hideothersubsections]}

\begin{frame}
\frametitle{KFAC: Block-tridiagonal inverse approx, $\hat{F}^{-1} \approx \tilde{F}^{-1}$}
Likely, tridiagonal approx $\hat{F}^{-1}$ is better than (one)diagonal $\breve{F}^{-1}$,
BUT harder to obtain because\\
approximating $\tilde{F}^{-1}$ as block-tridiagonal is NOT equivalent to approximating $\tilde{F}$ as block-tridiagonal.

\begin{figure}
    \centering
    \includegraphics[scale=0.175]{kfac_12}
\end{figure}

\end{frame}

\begin{frame}
\frametitle{KFAC: Block-tridiagonal inverse approx, $\hat{F}^{-1} \approx \tilde{F}^{-1}$}
\begin{itemize}
    % \item Define $\hat{F}$ that agrees with $\tilde{F}$ on the tridiagonal blocks,
    %     \begin{itemize}
    %         \item and that satisfies the property that $\hat{F}^{-1}$ is block-tridiagonal
    %     \end{itemize}
    \item Assume that $\hat{F}^{-1}$ is block-tridiagonal
        \begin{itemize}
            \item is equivalent to assuming that:
            $\hat{F}^{-1}$ is the precision matrix of an undirected Gaussian graphical model (UGGM) over $\mathcal{D}\theta$
        \end{itemize}
    \item As this graphical model has a tree structure, there is an equivalent
        directed graphical model with the same distribution
        \begin{itemize}
            \item this equivalent directed model will also be linear/Gaussian, and
            hence, a directed Gaussian Graphical model (DGGM).
        \end{itemize}
\end{itemize}

\vspace{10mm}
{\footnotesize
Recall: The precision matrix of a random vector is the inverse of its covariance matrix.
% * https://www.statlect.com/glossary/precision-matrix
}
\end{frame}

\begin{frame}
\frametitle{KFAC: Block-tridiagonal inverse approx, $\hat{F}^{-1} \approx \tilde{F}^{-1}$}
\begin{figure}
    \centering
    \includegraphics[scale=0.25]{kfac_fig_04_arxiv}
\end{figure}
\end{frame}

\begin{frame}
\frametitle{KFAC: Block-tridiagonal inverse approx, $\hat{F}^{-1} \approx \tilde{F}^{-1}$}
\begin{figure}
    \centering
    \includegraphics[scale=0.25]{kfac_16}
\end{figure}

\end{frame}

\begin{frame}
\frametitle{KFAC: Block-tridiagonal inverse approx, $\hat{F}^{-1} \approx \tilde{F}^{-1}$}
\begin{figure}
    \centering
    \includegraphics[scale=0.325]{kfac_17}
\end{figure}

\begin{figure}
    \centering
    \includegraphics[scale=0.325]{kfac_18}
\end{figure}
\begin{figure}
    \centering
    \includegraphics[scale=0.3]{kfac_19}
\end{figure}
\end{frame}

\begin{frame}
\frametitle{KFAC: Block-tridiagonal inverse approx, $\hat{F}^{-1} \approx \tilde{F}^{-1}$}
Applying formula for inverse covariance of directed model used in FActorized Natural Gradient (FANG)(Grosse and Salakhutdinov, 2015)
gives:

\begin{figure}
    \centering
    \includegraphics[scale=0.25]{kfac_14}
\end{figure}

% \begin{figure}
%     \centering
%     \includegraphics[scale=0.15]{kfac_15}
% \end{figure}
\end{frame}

% \begin{frame}
% \frametitle{KFAC: Block-tridiagonal inverse approx, $\hat{F}^{-1} \approx \tilde{F}^{-1}$}
% \begin{figure}
%     \centering
%     \includegraphics[scale=0.225]{kfac_11}
% \end{figure}
% \end{frame}


\chapter{Involutions and special $p$-groups}
\section{Dihedral Groups and Involutions}
{\bf Theorem 1:}
If $x, y \in Inv(G)$ then $ \langle x, y \rangle $ is a dihedral group of order $2|xy|$.
\begin{quote}
\emph{Proof:}
Let $u=xy$, $U= \langle u \rangle $ and $|xy|=n$. $U^x=U^y=U$ so $U \lhd D$.  $D= U \cup Ux$.
\end{quote}
{\bf Theorem 2:}
If $x, y \in Inv(G)$, $n=|xy|$ and $D= \langle x, y \rangle $ then
(1) $z \in D \setminus \langle xy \rangle $ is an
involution; (2) if $n$ is odd, $D$ is transitive on involutions;
(3) if $n$ is even,
exactly one of $x, y$ is conjugate to the unique involution in $ \langle xy \rangle $;
(4) if $n$ is even
and $z$ is the unique involution in $ \langle xy \rangle $ then $xz$ is conjugate to
$x$ in $D$ iff
$n= 0 \jmod{4}$.
\begin{quote}
\emph{Proof:}
Let $u=xy$, $U= \langle u \rangle $, and $|xy|=n$.  $u^x=u^{-1}$ and,
in fact, $v \in U \rightarrow v^x= v^{-1}$.
\\
(1) If $z \in D \setminus U$, $z= vx$ and $(vx)^2=vv^x=1$.
\\
(2) For $w \in U$, $(vx)^w = v x^w = v w^{-1} w^x x =v v w^{-2} x$ so
$x^D= \{ v^2x: v \in U \}$.
If $n$ is odd, $U$ has no involutions, so $x^D = Inv(D)= D \setminus U$.\\
(3) If $ux=y$, $D \setminus U = \{v^2x: v \in U\} \cup \{v^2ux: v \in U \}= x^D \cup y^D$\\
(4) $zx \in x^D$ when $z$ is a square in $U$ that is when $n=0 \jmod{4}$.
\end{quote}
{\bf Theorem 3:}
Let $G$ have even order with ${\mathbb Z}(G)=1$ and suppose
that $G$ has $m$ involutions with $n=|G|/m$ then
$G$ has a proper subgroup of index at most $2n^2$.
\begin{quote}
\emph{Proof:}
Let $I= Inv(G)$, $R= \{ g \in G: g^x=g^{-1}, x \in I \}$ and $\{x_i \}$ representatives of
the conjugacy classes of $G$ in $R$ for $0 \le i \le k$ and pick $x_0=1$.  Set $m_i= |x_i^G|$
and $B_i= \{ (u, v), u,v \in I: uv= x_i \}$, put $b_i= |B_i|$.  If $u,v \in I$ then either
$u=v, uv=1$ or $ \langle u,v \rangle $ is dihedral.
In either case, $(uv)^u= u^{-1}$ so $uv \in R$.
$m^2 = |I \times I| = \sum_{i=0}^k m_i b_i$.
\\
\\
Now, $\exists t_i \in Inv(G): (x_i)^{t_i}=x_i^{-1}$.  If $u,v \in B_i, (x_i)^u=x_i^{-1}$
and $(u,v) \mapsto u$ is an injection from $B_i$ into $t_iC_G(t_i)$; thus
$b_i \le |C_G(t_i)$ and $m_ib_i \le |G|$, in fact, $m_0=1$ and $b_0=m$ so
$m^2 \le m + k|G|$.  Let $H<G$ be a subgroup of minimal index, $s=|G/H|$.
If $i > 0$ then $x_i \notin {\mathbb Z}(G)$ and $m_i =|G:C_G(x_i)| \ge s$.
$|G| \ge \sum_{i=0}^k m_i \ge 1+ks$ and $k \le {\frac {(|G|-1)} {s}}$.  This gives
$m^2 \le (|G|{\frac {(|G|-1)} {s}})+m$.  But $n={\frac {|G|} {m}}$ and $m \ge 2$ so
$s \le {\frac {n(n-m^{-1})} {(1-m^{-1})}}$ and $s \le (2 n^2)!$.
\end{quote}
{\bf Theorem 4:}
The $G$ be a finite simple group of even order and $t \in Inv(G)$ with $n=|C_G(t)|$ then
$|G| \le (2 n^2 )!$.
\begin{quote}
\emph{Proof:}
By the previous result, $\exists H <G$ such that $|G:H| \le 2 n_0^2, n_0=|G|/m$ where
$m=|Inv(G)|$ and $m \ge |t^G|=|G:C_G(t)|$ and so $n_0 \le {\frac {|G|} {|G:C_G(t)|}}=n$.
Representing $G$ as a permutation group on the cosets $\{ Hx \}$, $k=|G/H| \le 2n^2$.  Since
$G$ is simple, this representation is faithful and $G$ is isomorphic to a subgroup of
$S_k$ and so $|G| \le k! \le (2n^2)!$.
\end{quote}
{\bf Brauer-Fowler Theorem:}  Let $H$ be a finite group.   There are at most finitely many
finite simple groups with an involution $t$ such that $H \cong C_G(t)$.
\begin{quote}
\emph{Proof:}
Follows from previous result.
\end{quote}
{\bf Thompson Order Formula:}  Let $G$ be a finite group with $k \ge 2$ conjugacy classes of
involutions $\{x_i^G\}$, $i= 1, 2, \ldots , k$.  Let $n_i$ be the number of ordered pairs
$u \in x_1^G, v \in x_2^G$ and $x_i \in \langle uv \rangle $ then
$|G|= |C_G(x_1)| |C_G(x_2)| \sum_{i=1}^k {\frac {n_i} {C_G(x_i)}}$.
\begin{quote}
\emph{Proof:}
Again let $I= Inv(G)$, $\Omega= x_1^G \times x_2^G$.
$|\Omega|= |x_1^G| |x_2^G|= |G:C_G(x_1)||G:C_G(x_2)|$.
For $(u,v) \in \Omega, u \notin v^G$, there is a unique involution $z(u,v) \in \langle uv \rangle $.
Let $\Omega_z= \{ (u,v): z=z(u,v) \}$.  $\Omega= \bigcup_{z \in I} \Omega_z$ and
$|\Omega_z|= |\Omega_{x_i}|$ for $z \in x_i^G$.  So $\sum_{z \in I} |\Omega_z| = |G:C_G(x_i)| n_i$
and $|\Omega|= \sum_{i=1}^k |G:C_G(x_i)|n_i$.
\end{quote}
{\bf Remark:} $n_i$ can be calculated if $x_i^G \cap C_G(x_i)$ is known so $|G|$ can be
calculated by the fusion of involutions in local subgroups.
\section{Critical subgroup of a $p$-group:}
{\bf Definition 1:}
$H \; char \; G$ is a \emph {critical subgroup} if $\Phi(H) \le {\mathbb Z}(H) \ge [G,H]$.
$C_G(H)=Z(H)$.
\\
\\
{\bf Definition 2:}
$Mod(p^n)= \langle x \rangle \ltimes \langle y \rangle $, $|x|= p^{n-1}$, $|y|=p$.
$D(2^n)= \langle x \rangle \ltimes \langle y \rangle $, $x^y = x^{-1}$.
$SD(2^n)= \langle x \rangle \ltimes \langle y \rangle $, $x^y = x^{2^{n-2}-1}$.
$Q(2^n)= G/ \langle x^{2^{n-2}}, y \rangle $, where $|y|=4$, $x^y= x^{-1}$, note that
${\mathbb Z}(G)= \langle x^{2^{n-2}}, y \rangle $.
\\
\\
{\bf Theorem:}  Let $G$ be a non-abelian group of order $p^n$ with a cyclic normal subgroup
of order $p^{n-1}$
$G \cong Mod(p^{n+1})$,
$G \cong D(2^{n+1})$,
$G \cong SD(2^{n+1})$, or
$G \cong Q(2^{n+1})$.
\begin{quote}
\emph{Proof:} Since $G$ is non-abelian, $n \ge 3$.  Let $X$ be a cyclic subgroup: $|G:X|=p$.
$X=C_G(X)$ and $\exists y \in G \setminus X$ such that $y$ acts non-trivially on $X$.
$y^p \in X$ so $y$ induces an automorphism of order $p$.  $Aut(X)$ has a unique subgroup
of order $p$ (case 1) unless $p=2$ and $n \ge 4$ and in that case $Aut(X)$ has $3$ involutions
(case 2).  In case 1, $x^y=xz$ for some $z$ of order $p$ in $X$.  In case 2,
$x^y=x^{-1} z^{\epsilon}$ where $\epsilon= 0, 1$ and $z \in Inv(X)$.  If $G$ splits over $X$,
$G=X \rtimes \langle y \rangle $ and $G \cong Mod(p^n),  D(2^n), SD(2^n)$.  Otherwise,
$C_X(y)= \langle x^p \rangle $ if $x^y=xz$ while $C_X(y)= \langle z \rangle $ otherwise.
$y^p \in C_X(y)$ and since $G$ does
not split over $X$,  $ \langle y, C_X(y) \rangle $ does not split over
$C_X(y)$ and hence it is abelian and
$C_X(y)= \langle y^p \rangle $ and $y^p = x^p$ if $x^y=xz$ and $y^2 = z$ otherwise.
Suppose $x^y=xz$,
$z=[y,x] \in C( \langle x,y \rangle)$.  So, $y x^{-1})^p= y^p x^{-p} z^{\frac {p(p-1)} {2}}$
but $z^{\frac {p(p-1)} {2}}=1, p \ne 2$, thus $p=2$ and $z=x^{2^{n-2}}$
and if $n \ge 4$ then setting $i= 2^{n-3}-1$ so $(y x^i)^2=1$; if $n=3$, $x^y= x^{-1}$.
We're left with $p=2$, $x^y= x^{-1}z^{\epsilon}$ and $y^2=z$.  If $\epsilon=0$,
$G \cong Q(2^n)$ but $z \in {\mathbb Z}(G)$, $(yx)^2= y^2 x^y x = z x^{-1} z x = 1$ so
the extension does split.
\end{quote}
{\bf Theorem 5:} If $G = \langle x \rangle $, $|x|=q=p^n$, $A=Aut(G)$.
(1) $a \mapsto m(a) \subseteq U(q)$ is an isomorphism on the units of $q$;
(2) the cyclic subgroup of order $p-1$ is faithful on $\Omega_1(G)$; and,
(3) $P \in S_p(A)$ is cyclic and faithful.
\begin{quote}
\emph{Proof:}  Elementary.
\end{quote}
{\bf Theorem 6:}
Let $G$ be a non-abelian group with a cyclic normal subgroup, $U$,
of order $p^{n}$ and $C_G(U)=U$.  Then either
(1)
$G \cong D(2^{n+1})$, $G \cong SD(2^{n+1})$, or $G \cong Q(2^{n+1})$; or,
(2) $M=C_G(\mho^1(U)) \cong Mod(p^{n+1})$ and $E_{p^2}= \Omega_1(M)$ char $G$.
\begin{quote}
\emph{Proof:}
Let ${\overline G}= G/U \rightarrow Aut(U)$.  ${\overline G} \ne 1$ and $n \ge 2$ if
$|G|=p$.  If ${\overline G} > p$ the conclusion holds by the previous result.
$\exists {\overline y} \in {\overline G}$, $|{\overline y}|=p$, $u^y= u^{p^{n-1}+1}$,
$U= \langle u \rangle $.
$M= < \langle y,u \rangle $.
$M=Mod_{p^{n+1}}$, $E= \Omega_1(M)= E_{p^2}$, $E \; char \; G$.  Since
${\overline G}'=1$, ${\overline G}$ is cyclic or $p=2$ and $u^g= u^{-1}$.   In the first case,
$\Omega_1({\overline G})= {\overline M}$, $E= \Omega_1(M)= \Omega_1(G) \; char \; G$.
In second case, $\mho^1(U)= \langle u^2 \rangle = \langle [u,g] \rangle $
and $G' \subseteq U$.  So
$G' = \mho^1(U)$ or $U \; char \; G' \; char \; G$.
Thus $E= \Omega_1(C_G(\Omega^1(U))) \; char \; G$.
\end{quote}
{\bf Definition:}  A \emph{critical} subgroup of $G$ is a characteristic subgroup
$H \; char \; G$ such that $\Phi(H) \le {\mathbb Z}(H) \ge [G, H]$ and $C_G(H)= {\mathbb Z}(H)$
A $p$-group is \emph{special} if $\Phi(G)= {\mathbb Z}(G) = G^{(1)}$, \emph{extra-special}
if the center is cyclic.
\\
\\
{\bf Theorem 7:}
Every $p-$group has a critical subgroup.
\begin{quote}
\emph{Proof:} Let $S$ be the set of characteristic subgroups, $H$, of $G$ with
$\Phi(H) \le {\mathbb Z}(H) \ge [G, H]$ and $C_G(H)= {\mathbb Z}(H)$ and $H$ be a maximal
element.  Claim: $H$ is critical.  If not, set $K= C_G(H)$, $Z= {\mathbb Z}(H)$ and
define $X$ by $X/Z= \Omega_1({\mathbb Z}(G/Z)) \cap K/Z$.  The $K \nleq H$ and
$Z= H \cap K$; since $K \lhd G$, $X \ne Z$ but then $XH \in S$ violating the maximality.
\end{quote}
{\bf Definition:}
A $p-$group $P$ is {\bf special} if $\Phi(G)=Z(G)=G'$ and {\bf extra-special}
if $Z(G)$ is cyclic.
\\
\\
{\bf Theorem 8:}
If $G$ is special, ${\mathbb Z}(G)$ is elementary abelian.
\begin{quote}
\emph{Proof:}
$g^p \in \Phi(G)= {\mathbb Z}(G)$ $1= [g^p,h]= [g,h]^p$ so $G^{(1)}$ is elementary
so ${\mathbb Z}(G)= G^{(1)}$.
\end{quote}
{\bf Theorem 9:}
Let $E$ be an extra-special subgroup of $G$ $[G, E] \le {\mathbb Z}(G)$, then
$G=E C_G(E)$.
\begin{quote}
\emph{Proof:}
$Z=\langle z \rangle= Z(E)$.  $E/Z \leq Aut_G(E) \leq C= C_{Aut(E)}(E/Z)$.  Suffices to show
$E/Z=C$.  Let $\alpha \in C$ and $\langle x_iZ \rangle$ is a basis for $E/Z$.  Then $[x_i , \alpha ]= z^{m_i}$,
$0 \leq m_i <p$ and $E= \langle x_i, 1 \leq i \leq n \rangle$ and thus $|C| \leq p^n =|E/Z|$.
\end{quote}
{\bf Definition:}
A $p$-group is of symplectic type if it has no non-cyclic characteristic abelian subgroups.
\\
\\
{\bf Theorem 10:}
If $G$ is of symplectic type, $G= E*R$ where (1) $E=1$ or is extra-special;
(2) either $R$ is cyclic or $R$ is dihedral;, semi-dihedral or quaternion of order
$\ge 16$.
\begin{quote}
\emph{Proof:}
$G$ has a critical subgroup $H$, $U= {\mathbb H}$, let $Z$ be a cyclic subgroup of $U$ of order $p$.
$G^*= G/Z$.  Put $K^* = \Omega_1(H^*)$ and let $E^*$ be the complement to ${mathbb Z}(K)^*$ in $K^*$.
We can show $K$ is extraspecial.  See Aschbacher p 109 for the rest of the argument.
\end{quote}
{\bf Theorem 11:}
Let $E$ be an extra-special $p$-group with $Z={\mathbb Z}(G)$, ${\overline E}= E/Z$.  Identify
$Z$ with ${\mathbb Z}_p$ and ${\overline E}$ as a vector space over $Z$ then
(1) $f: {\overline E} \times {\overline E} \rightarrow Z$
by $f({\overline x}, {\overline y}) = [x, y]$ is a symplectic form;
(2) $m({\overline E})= 2n$;
(3) if $p=2$, then $Q(x)= x^2$ is the associated quadratic form;
(4) if $Z \le U \le E$,  $U$ is extra-special or abelian iff ${\overline U}$ is
non-degenerate or totally isotropic, respectively.  If $p=2$, then $U$ is elementary abelian
iff ${\overline U}$ is totally singular.
\begin{quote}
\emph{Proof:}
Aschbacher, p 111.
\end{quote}
{\bf Theorem 12:}
$G$ a $p$ group, $A$, a $p'$-group.
Let $A$ be a maximal abelian normal subgroup of $G$, $Z= \Omega_1(A)$ then
(1) $A=C_G(A)$,
(2) $(C_G(A/Z) \cap C(Z))' \le A$,
(3) if $p \ne 2$, $\Omega_1(C_G(Z)) \le C_G(A/Z)$.
\begin{quote}
\emph{Proof:}
Let $C= C_G(A)$ and $a \le C \lhd G$.  If $C \ne A$, $\exists D: |D/A|= p$ and
$D/A \subseteq {\mathbb Z}(G/A) \cap C/A$.  Then $D \lhd G$ and $D$ is abelian
contradicting the maximality of $A$.  $(C_G(A/Z) \cap C(Z)^{(1)} \le C(A)$ so
1 implies 2.  Let $P \ne 2$, $|x|= p$, $x \in C_G(Z)$ and $X= \langle x, A \rangle$
and $Y= \langle x C_A(\langle x, Z \rangle)/Z \rangle$.  $cl(Y) \le 2$ so
$W=\Omega_1(Y)$ is of exponent $p$.  Thus $W= \langle x, Z \rangle$.  But
$W \; char \; Y$ so $N_X(Y) \le N_X(W)=Y$ so $Y= X$ and 3 holds.
\end{quote}
{\bf Theorem 13:}
$G$ a $p$ group.
If $p \ne 2$ and $cl(G) \le 2$ then $\Omega_1(G)$ is of exponent $p$.
\begin{quote}
\emph{Proof:}
Let $x, y$ be elements of order $p$.  $[x, y]= z \in {\mathbb Z}(G)$ so
$(xy)^p = x^p y^p z^{\frac {p(p-1)} 2}= 1$.
\end{quote}
{\bf Theorem 14:}
$G$ a $p$ group, $A$, a $p'$-group.
Let $p \ne 2$ and $Z$ be an elementary abelian normal subgroup of $G$ then $Z= \Omega_1(C_G(Z))$.
\begin{quote}
\emph{Proof:}
Let $X= \Omega_1(C_G(Z))$.  \emph{Claim:} $exp(X)=p$.  If claim is true,
and $X \ne Z$, $\exists D: |D/A|=p$ and $D$ is elementary abelian, contradicting
maximality.  \emph{Proof of claim:}
Let $A$ be a maximal  abelian normal subgroup of $G$ containing $Z$, then $Z= \Omega_1(A)$.
$[X, A] \le Z$ and so $X^{(1)} \le A$.   Choose $U \le X$ of minimal order subject to
$U= \Omega_1(U)$ and $U$ not of exponent $p$.  $\exists x, y \in U: U= \langle x, y \rangle$
$V= \langle x^U \rangle \ne U$ and so $exp(V)=p$.  Hence $z=[x,y]$ has order at most $p$ so
$X^{(1)} \le A, z \in Z$.  As $X \le C(Z)$, $exp(U)=p$ contrary to the choice of $U$.
\end{quote}
{\bf Theorem 15:}
$G$ a $p$ group, $A$, a $p'$-group.
If $G$ is abelian then $A$ is faithful on $\Omega_1(G)$.
\begin{quote}
\emph{Proof:}
WLOG, $A$ centralizes $\Omega_1(G)$.  Let $|X|= p$ in $G$ and ${\overline G}= G/X$.
$A$ is faithful on $\Omega_1({\overline G})$ and so WLOG, ${\overline G}= \Omega_1({\overline G})$.
We may take, $C_{\overline G}(A)=1$ so $X= \Omega_1(G)$ so $G$ is cyclic.  But this contradicts
the known structure of the automorphism group.
\end{quote}
{\bf Theorem 16:}
Let $H$ be a critical subgroup of $G$, then (1) $A$ is faithful on $H$
(2) if $p \ne 2$ then $A$ is faithful on $\Omega_1(H)$ and there is a critical subgroup
of $G$ such that $\Omega_1(H)$ contains each element of order $p$ in
$C_G(\Omega_1(H))$.
\begin{quote}
\emph{Proof:}
$C_G(H) \leq H$ so by the $p \times q$ lemma (with $P=H, Q = C_A(H)$), $C_A(H)=1$,
proving (1).  For (2), see Aschbacher p114.
\end{quote}
\section{More on special $p$-groups}
{\bf Lemma:}
If $M$ is a normal subgroup of a $p$-group, $P$, maximal subject to being
abelian then $M= C_P(M)$.
\begin{quote}
\emph{Proof:}
$M \subseteq H = C_P(M)$ since $M$ is abelian.  Supose $H \supset M$ and set
${\overline P}= P/M$.  ${\overline H} \subset {\overline P}$, $H \lhd P$ and
${\overline H} \ne 1$ so ${\overline H} \cap {\mathbb Z}({\overline P}) \ne 1$.
If ${\overline X}$ is a subgroup of ${\overline H} \cap {\mathbb Z}({\overline P})$,
$X \lhd P$ and $X \subseteq H$.  Since $H$ centralizes $M$, $M \subseteq {\mathbb Z}( X)$.
$X/M$ is cyclic of order $p$ and so $X$ is abelian, this is a contradiction.
\end{quote}
{\bf Theorem 17:}
A $p$-group, $P$, possesses a characteristic subgroup, $C$, with the following properties:
(1) $cl(C) \le 2$;
(2) $[P, C] \subseteq {\mathbb Z}(C)$;
(3) $C_P(C)= {\mathbb Z}(C)$;
(4) Every nontrivial $p'$ automorphism of $P$ induces a non-trivial
automorphism of $C$.
\begin{quote}
\emph{Proof:}
Suppose that such a characteristic subgroup $C$ exists.  Let $\phi$ be a $p'$ automorphism
of $P$ which acts trivially on  $C$ and put $A= \langle \phi \rangle$.
$[C, A] = 1$ so $[C, A, P] =1$ and $[P, C, A]= 1$ so
$[A, P, C] = 1$.  $[A,P] \subseteq C_P(C)$ and $A$ stabilizes
$P \supseteq [A, P] \supseteq 1$ and $A = 1$ so $\phi= 1$ and 3 implies 4.
Let $M$
be a normal subgroup of a $P$, maximal subject to being abelian so $C_P(M)=P$.
If $M \; char \; P$, $C= M$ satisfies the theorem because $C_P(C) \subseteq C$ and
$C$ is of class $1$ further $C/{\mathbb Z}(C)$ is trivial and $[P,C] \subseteq C = {\mathbb Z}(C)$
and so 1 and 2 hold.
\\
\\
Let $D$ be a maximal characteristic abelian subgroup of $P$ containing $D$ so $D \subset M$.
$M \subseteq H=C_P(D)$ and so $D \subset H$ and $H \; char \; P$.  Set ${\overline P}= P/D$
then ${\overline H} \ne 1$ so
${\overline C} = {\overline H} \cap \Omega_1({\mathbb Z}({\overline P}) \ne 1$
We claim the preimage, $C$, has the required properties.  First the inverse image,
$K$ of $\Omega_1({\mathbb Z}({\overline P}))$ is characteristic in $P$ and so
$C = H \cap K \; char \; P$.  Since $C \subseteq H= C_P(D)$, $D \subseteq {\mathbb Z}(C)$ but
this is characteristic in $P$ so ${\mathbb Z}(C)=D$ by maximality of $D$.
But then $C/{\mathbb Z}(C)$ is elementary abelian and $cl(C)=2$.  Further,
since ${\overline C} \subseteq {\mathbb Z}({\overline P})$, $[{\overline C}, {\overline P}]= 1$
whence $[P, C] \subseteq D$ and $C$ satisfies 1 and 2.
Now set $Q= C_P(C)$ and suppose $Q \nsubseteq C$.  $Q \cap C = D$ and $Q \subseteq H$ since
$Q$ centralizes $D$.  Thus
${\overline Q} \subseteq \cap {\overline C} = 1$, ${\overline Q} \lhd {\overline P}$ and
${\overline Q} \ne 1$.
But $1 \ne {\overline Q} \cap \Omega_1({\mathbb Z}({\overline P}))= {\overline C}$ and thus
${\overline Q} \cap {\overline C} \ne 1$, a contradiction.  So $Q \subseteq C$ and
$Q= {\mathbb Z}(C)$ and 3 holds.
\end{quote}
{\bf Theorem 18:} If $P$ is a $p$-group then $\Phi(P)$ is the smallest subgroup, $H$, such that
$G/H$ is elementary abelian.
\begin{quote}
\emph{Proof:}
If $M$ is maximal then $M \lhd G$ and $|G:H|=p$ and $P' \leq M$ so $P' \leq \Phi(P)$ so
$P/ \Phi(P)$ is abelian.  $g^p \in M$ so $g^p \Phi(P)$ hence $P/ \Phi(P)$ is elementary abelian.
\end{quote}
{\bf Theorem 19:}
Let $A$ be a $p'$ group of  automorphisms of a $p$ group $P$ and let $\phi \in A^{\#}$,
then $P$ possesses an $A$-invariant special subgroup $Q$ such that $Q$ acts irreducibly
on $Q/\Phi(Q)$, $\phi$ acts non-trivially on  $Q/\Phi(Q)$ and $\phi$ act trivially on
$\Phi(Q)$.
\begin{quote}
\emph{Proof:}
Suppose $b \in A$, $[b,G/\Phi(G)]=1$.  WTS $b=1$.  If not, there is a power of $b$ that
is a $q$-element.  Put $B= \langle b \rangle$ and $g \in G$.  $B$ acts on the coset
$X= g \Phi(G)$ and the fixed points, $m= |X| \jmod{p}$, $|X|= |\Phi(G)|$ is a power of $p$.
$|X| \neq 0 \jmod{q}$ so $[B,x]=1$ for some $x \in X$ so $B$ centralizes a set, $Y$ of
coset representatives for $\Phi(G)$ in $G$ so $G= \langle Y \rangle \leq C_G(B)$
so $B=1$.
\end{quote}


\documentclass[a4paper]{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{xcolor}
\usepackage{amsthm}
\usepackage[mathcal]{euscript}

\usepackage{url}

\newcommand{\Hcal}{\mathcal{H}}
\newcommand{\real}{\mathbb{R}}
\newcommand{\interior}[1]{%
  {\kern0pt#1}^{\mathrm{o}}%
}
\newcommand{\Tcal}{\mathcal{T}}
\newcommand{\Lcal}{\mathcal{L}}

\title{Notes on Minkowski Functional}
\author{Nazarov Ivan}

\date{\today}

\begin{document}
\maketitle

Consider a Banach space $(\Hcal, \|\cdot\|)$ with the norm $\Tcal^{\|\cdot\|}_\Hcal$
topology on it $\Hcal$. In the following $[C]$ is the closure of a set $C$ in the
topology of $\Hcal$: $[C]$ the smallest closed set covering $C$, $[C] = \bigl[[C]\bigr]$,
and monotone. In contrast, $\interior{C}$ --- the topological interior of $C$ in
$\Hcal$, --- is the largest open set contained within $C$.

For a nonempty $C \subseteq \Hcal$ the {\it Minkowski Functional} $p\colon \Hcal
\to [0, +\infty]$ is
\begin{equation*}
  p(x)
    = \inf \bigl\{ \lambda > 0\,:\, x \in \lambda C\bigr\}
    \,,
\end{equation*}
where $\lambda C = \{\lambda z \,:\, z\in C\}$ is the $\lambda$-inflation of $C$,
$\lambda \in\real$. This functional has many useful properties when $C$ is convex
and the interior of $C$ contains $0$.

\paragraph{Properties of $\lambda$-inflation} % (fold)
\label{par:properties_of_lambda_inflation}

Consider any $C\subseteq \Hcal$, any $t \neq 0$ and any $x\in \Hcal$. Then $x\in t C$
means that there exists $z \in C$ such that $x = t z$. Therefore $\tfrac1t x = z
\in C$, since $\Hcal$ is a vector space. For such $(C, x, t)$ we have the implication
$x \in t C \Rightarrow \tfrac1t x \in C$.

We get the reverse implication by applying the forward one above to the tuple $(C, x, t)
= (\alpha K, \tfrac1\alpha z, \tfrac1\alpha)$, noting that $z = \alpha x$. Therefore
$x\in t C$ iff $\tfrac1t x \in C$ for any $C\subseteq \Hcal$, $x\in \Hcal$ and $t > 0$.
Furthermore, for any $\alpha, \beta \neq 0$ we have
\begin{equation*}
  \alpha x \in \beta C \Leftrightarrow
  \beta^{-1} \alpha x \in C \Leftrightarrow
  \beta^{-1} x \in \alpha^{-1} C \Leftrightarrow
  x \in \beta \alpha^{-1} C
  \,.
\end{equation*}

Suppose $C$ is convex, then $\beta C$ is convex for any $\beta$. Indeed, for $x_1,
x_0 \in \beta C$ and $\theta\in [0, 1]$ there are $z_1, z_0 \in C$ such that $x_i
= \beta z_i$. But then $x_\theta \in \beta C$, since we have $z_\theta = \theta z_1
+ (1-\theta) z_0 \in C$ and
\begin{equation*}
  x_\theta
  = \theta x_1 + (1-\theta) x_0
  = \theta \beta z_1 + (1-\theta) \beta z_0
  = \beta z_\theta
  \,.
\end{equation*}

Suppose $C$ is convex and $0\in C$. Then for any $\theta \in (0, 1)$ and $x\in C$
we have $\theta x = (1 - \theta)\, 0 + \theta x \in C$, hence $x \in \theta^{-1} C$.
Therefore $C \subseteq \lambda C$ for all $\lambda \geq 1$. Next, if $\alpha > \beta$,
then the $\beta$-inflation of $C$ is convex, and $0 \in \beta C$. Therefore $\beta C
\subseteq \tfrac\alpha\beta (\beta C) = \alpha C$.

% paragraph properties_of_lambda_inflation (end)

\paragraph{Zero} % (fold)
\label{par:zero}

The Minkowski functional is zero on $0$ if $0\in C$. Indeed, for any $\lambda > 0$
we have $0 \in \lambda C$, since $0 = \lambda 0$. Therefore, $p(0) \leq \lambda$
for all $\lambda > 0$, whence $p(0) = 0$.

Alternatively, if $p(0) = 0$, then $0\in \lambda C$ for any $\lambda > 0$, which
means that for $\lambda=1$ there is $z\in C$ such that $z = 0$. Hence $0\in C$.

% paragraph zero (end)

\paragraph{Positive homogeneity} % (fold)
\label{par:pos_homogeneity}

Let $t > 0$. If $x\in\Hcal$ is such that $p(x) = +\infty$, then $x\notin \lambda C$
for any $\lambda>0$. In particular $t x\notin t \tfrac\lambda{t} C$, whence $p(tx)
= +\infty$.

If $x \in \Hcal$ such that $p(x) < +\infty$, then for any $U > p(x)$ there exists
$\lambda < U$ with $x\in \lambda C$. Hence $t x \in t \lambda C$ and $p(t x) \leq
t \lambda < t U$. Therefore $p(t x) < +\infty$ and $p(t x) \leq t p(x)$.

The opposite inequality follows from applying the direct one to $(x, t) = (\alpha
z, \alpha^{-1})$ for any $\alpha > 0$ and $z \in \Hcal$. Indeed, since $\alpha^{-1}
x = z$, $p(\alpha^{-1} x) \leq \alpha^{-1} p(x)$ implies $\alpha p(z) \leq p(\alpha z)$.
Therefore $p(t x) = t p(x)$ for any $x \in \Hcal$ and every $t > 0$.

By positive homogeneity we have $p(0) = p(t \cdot 0) = t p(0)$ for any $t > 0$, which
can be satisfied only if $p(0) \in \{0, \infty\}$. Hence, $p(0) = 0$ iff $0\in C$,
and $p(0)\neq 0$ iff $0\notin C$, in which case $p(0) = +\infty$.

% paragraph pos_homogeneity (end)

\paragraph{Homogeneity via balancedness} % (fold)
\label{par:homogeneity_via_balancedness}

If $C$ is balanced then $p(x)$ is homogeneous.

A set is $C$ is balanced if $\beta C \subset C$ for all $\lvert \beta \rvert \leq 1$.
For any balanced $C$ we have $\lambda C \subset C$ in particular for $\lambda = 0$,
whence $\{0\} = 0 C \subset C$. Note that for any $\alpha \neq 0$ the set $\alpha C$
is balanced as well. Indeed, we have $\beta (\alpha C) = \alpha (\beta C) \subset
\alpha C$.

Suppose $\alpha x \in \lambda C$ for $\alpha \neq 0$ and $\lambda > 0$. Then we have
\begin{equation*}
  \lvert \alpha \rvert x
    = \tfrac{\lvert \alpha \rvert}\alpha (\alpha x)
    \in \tfrac{\lvert \alpha \rvert}\alpha (\lambda C)
    = \lambda \Bigl( \tfrac{\lvert \alpha \rvert}\alpha C \Bigr)
    \subset \lambda C
    \subseteq \lambda C
    \,,
\end{equation*}
by definition of the set inflation, vector space $\Hcal$ and from balancedness of
$C$. Conversely $\lvert \alpha \rvert x \in \lambda C$ implies $\alpha x \in \lambda
C$:
\begin{equation*}
  \alpha x
    = \tfrac\alpha{\lvert \alpha \rvert} (\lvert \alpha \rvert x)
    \in \tfrac\alpha{\lvert \alpha \rvert} (\lambda C)
    = \lambda \Bigl( \tfrac\alpha{\lvert \alpha \rvert} C \Bigr)
    \subset \lambda C
    \subseteq \lambda C
    \,.
\end{equation*}
For $t = 0$ we have $0 = p(0 x) = 0 p(x) = 0$ and for $t\neq 0$ we consider the
following:
\begin{equation*}
  p(t x)
    = \inf\{\lambda > 0\colon t x \in \lambda C\}
    = \inf\{\lambda > 0\colon \lvert t \rvert x \in \lambda C\}
    = p\bigl( \lvert t \rvert x \bigr) = \lvert t \rvert p(x)
    \,.
\end{equation*}

% paragraph homogeneity_via_balancedness (end)

\paragraph{Subadditivity} % (fold)
\label{par:subadditivity}

We claim that $p$ is subadditive if $C$ is convex.

Consider $x_1, x_2 \in \Hcal$. If $p(x_i) = +\infty$, then trivially $p\bigl( x_1
+ x_2 \bigr) \leq +\infty =  p(x_1) + p(x_2)$. Suppose $p(x_i) < + \infty$. Then
for any $\varepsilon > 0$ there are $\lambda_i > 0$ with $x_i \in \lambda_i C$ such
that $\lambda_i < p(x_i) + \tfrac12\varepsilon$ for any $i$. We argue that $x_1 + x_2
\in (\lambda_1 + \lambda_2) C$, since $C$ is convex, $\tfrac{x_i}{\lambda_i} \in C$,
and
\begin{equation*}
  \tfrac1{\lambda_1 + \lambda_2} (x_1 + x_2)
    = \tfrac{\lambda_1}{\lambda_1 + \lambda_2} \frac{x_1}{\lambda_1}
      + \tfrac{\lambda_2}{\lambda_1 + \lambda_2} \frac{x_2}{\lambda_2}
    \,.
\end{equation*}
Therefore $p\bigl( x_1 + x_2 \bigr) \leq p(x_1) + p(x_2)$, since for all $\varepsilon
> 0$
\begin{equation*}
  p\bigl( x_1 + x_2 \bigr)
    \leq \lambda_1 + \lambda_2
    < p(x_1) + p(x_2) + \varepsilon
    \,.
\end{equation*}

% paragraph subadditivity (end)

\paragraph{Sublinearity} % (fold)
\label{par:sublinearity}

If $C$ is convex and balanced (or just $0 \in C$), then we have $p(t x) = t p(x)$
for any $t\geq 0$ and $x\in \Hcal$ such that $p(x) < +\infty$. This implies that
$p(-t x)$ is finite when $p(-x)$ is finite. Hence is $p(x), p(-x) < +\infty$ then
for $t \leq 0$
\begin{equation*}
  0 = p(0)
    = p\bigl( t x + (- t) x \bigr)
    \leq p\bigl( t x \bigr) + p\bigl( (- t) x \bigr)
    = p\bigl( t x \bigr) + (- t) p( x )
    \,,
\end{equation*}
by subadditivity. Therefore $t p(x) \leq p(t x)$ for any $t\in \real$.

% paragraph sublinearity (end)

\paragraph{the sufficient condition for finite values} % (fold)
\label{par:the_sufficient_condition_for_finite_values}

We conjecture that $p(\Hcal) \subseteq \real$ requires $0$ to be in the topological
interior of $C$, i.e. the largest open set that fits inside $C$. Indeed, in this
case there would be a $\varepsilon > 0$, such that $B(0, \varepsilon) = \{z\colon
\|z\| < \varepsilon\} \subseteq C$, implying that for a given $\eta \in (0, 1)$ we
have
\begin{equation*}
  \tfrac{\eta}{\|x\|} x \in B(0, 1) = \varepsilon^{-1} B(0, \varepsilon)
  \Leftrightarrow
  \tfrac{\varepsilon \eta}{\|x\|} x \in B(0, \varepsilon)
  \subseteq C
  \Leftrightarrow
  x \in \tfrac{\|x\|}{\eta \varepsilon} C
  \,,
\end{equation*}
for any $x\neq 0$. Therefore $p(x) < +\infty$ for any $x\in \Hcal$ for such $C$.

% paragraph the_sufficient_condition_for_finite_values (end)

\paragraph{Upper bound for continuity} % (fold)
\label{par:upper_bound_for_continuity}

Suppose $C$ is convex and such that $p(\Hcal)\subseteq \real$. Then for any $x, h
\in \Hcal$ we have $p(x) \leq p(x+h) + p(-h)$ and $p(x + h) \leq p(x) + p(h)$ by
subadditivity. Together with positive homogeneity, this implies that for any $x \in
\Hcal$ and $h\neq 0$
\begin{equation*}
  % the rhs is of the form $\|h\| \ldots$, implying that the bound holds for $h=0$
  \bigl\lvert p(x + h) - p(x) \bigr\rvert
    % \leq \max\{p(h), p(- h)\}
    \leq \| h \| \max\Bigl\{
        p\Bigl(\tfrac{h}{\|h\|}\Bigr),
        p\Bigl(- \tfrac{h}{\|h\|}\Bigr)
      \Bigr\}
    \leq \| h \| \sup \{p(u)\colon \|u\|\leq 1\}
    % \Big\vert_{u = \|h\|^{-1} h}
    \,.
\end{equation*}
Since the right-hand side does not depend on $x$, we note that the bound holds
uniformly over $x \in \Hcal$. Therefore in order to show continuity (uniform) it
is enough to prove that $p$ is bounded within $B[0, 1] = \{u\colon \|u\| \leq 1\}$
-- the closed unit ball in $\Hcal$.

% paragraph upper_bound_for_continuity (end)

\paragraph{Preimage inclusion} % (fold)
\label{par:preimage_inclusion}

Consider a convex $C$ with $0\in C$. Then for any $\alpha > 0$ we have the following.
If $x \in \alpha C$ for some $\alpha > 0$, then by definition $p(x) \leq \alpha$ and
thus $\alpha C \subseteq \{p \leq \alpha\}$. Conversely, if $x\in \{p < \alpha\}$,
then $x \in \lambda_x C$ for some $p(x) \leq \lambda_x < \alpha$. Since $C$ is convex
and $0\in C$, it must hold $\lambda_x C \subseteq \alpha C$. Therefore
\begin{equation*}
  \{p < \alpha \}
    \subseteq \alpha C
    \subseteq \{p \leq \alpha \}
    \,,
\end{equation*}
for any $\alpha > 0$. In particular we have $C \subseteq \{p \leq 1\}$ and by positive
homogeneity
\begin{equation*}
  \alpha \{p\leq 1\}
    = \{\alpha x \in \Hcal \colon p(x) \leq 1\}
    = \bigl\{z \in \Hcal \colon \tfrac1{\alpha} p(z) \leq 1\bigr\}
    = \{p \leq \alpha\}
    \,.
\end{equation*}
Consider the scaling map $x\mapsto \sigma_\alpha(x) = \alpha x$ on a vector space.
Its inverse is $\sigma_\alpha^{-1} = \sigma_{\alpha^{-1}}$, and it is easy to see
that $\sigma_\alpha$ is bouded linear map. By positive homogeneity of $p$ the maps
$\sigma_\alpha$ and $p$ commute: $\sigma_\alpha \circ p = p \circ \sigma_\alpha$
for all $\alpha > 0$. Therefore, for any $U \subseteq [0, +\infty)$ and $\alpha > 0$
we get $\{p\in \alpha U\} = \alpha \{ p\in U \}$:
\begin{align*}
    \sigma_\alpha \bigl( \{p \in U\} \bigr)
    &= \bigl\{\sigma_\alpha^{-1} \circ p \in U\bigr\}
    = \bigl\{\sigma_{\alpha^{-1}} \circ p \in U\bigr\}
    \\
    &= \bigl\{p \circ \sigma_{\alpha^{-1}} \in U\bigr\}
    = \bigl\{p \in \sigma_{\alpha^{-1}}^{-1}(U)\bigr\}
    = \bigl\{p \in \sigma_\alpha(U)\bigr\}
    \,,
\end{align*}
because for any maps $f$ and $h$ the preimages of their composition is
\begin{equation*}
  \{f\circ h \in U\}
    = \bigl\{ h \in f^{-1}(U) \bigr\}
    = h^{-1}\bigl(\{f \in U \}\bigr)
    \,.
\end{equation*}

% paragraph preimage_inclusion (end)

\paragraph{Boundedness} % (fold)
\label{par:boundedness}

Consider $C$ that has $0$ in its topological interior. This means that there is $\delta
> 0$, such that $B(0, \delta) \subseteq C$. Thus for any $\eta \in (0, 1)$
\begin{equation*}
  B[0, 1]
    = \{u\colon \|u\| \leq 1\}
    % since [0, ]
    \subseteq B\bigl( 0, \tfrac1\eta \bigr)
    % scaling and translation of balls (continuous)
    = \tfrac1{\delta \eta} B(0, \delta)
    % inflation is a monotone set-automorphism
    \subseteq \tfrac1{\delta \eta} C
    % proven fact that $\alpha C \subseteq \{p \leq \alpha\}$
    \subseteq \bigl\{p \leq \tfrac1{\delta\eta} \bigr\}
    \,,
\end{equation*}
since $[0, 1] \subset [0, \eta^{-1})$. Hence there exists $M \geq 0$ that depends only
on $C$, such that $p(u) \leq M$ for any $u \in B[0, 1]$. It is worth reminding that
the rightmost set inclusion follows from the definition of $p$, and does not require
convexity of $C$.

If $M = 0$, then $p(x) = 0$ for any $x\in \Hcal$, which means that $x\in \lambda C$
for every $\lambda > 0$. Hence $\{t x\colon t > 0\} \subseteq C$ for any $x\in \Hcal$,
and $\Hcal \subseteq \bigcup_{x\in \Hcal} \{t x\colon t > 0\} \subseteq C$. Therefore
$C\subset \Hcal$ guarantees $\sup\{p(u)\colon \|u\|\leq 1\} > 0$.

If a positively homogeneous $p$ is bounded on $\{u\colon \|u\|\leq 1\}$, then it
is finite:
\begin{equation*}
  p(x)
    \leq \|x\| p\Bigl(\tfrac{x}{\|x\|}\Bigr)
    \leq \|x\| \sup\{p(u)\colon \|u\|\leq 1\}
    < +\infty
    \,.
\end{equation*}

% paragraph boundedness (end)

\paragraph{Continuity} % (fold)
\label{par:continuity}

We claim that for $p\colon \Hcal \to [0, +\infty]$ to be continuous, it suffices
for $C$ to have $0\in \interior{C}$ and be convex. Indeed, since $0\in C$ for such
$C$ and $p$ is real-valued, the upper bounds derived earlier hold true. Hence for
any $h \in \Hcal$ with $\|h\| < \tfrac\varepsilon{M}$ and uniformly over $x$ we have
\begin{equation*}
  \bigl\lvert p(x + h) - p(x) \bigr\rvert
    \leq
      \sup_{x\in \Hcal}
        \bigl\lvert p(x + h) - p(x) \bigr\rvert
    \leq M \| h \| < \varepsilon
      \,.
\end{equation*}
Therefore $B(x, \delta) \subseteq \bigl\{ p\in B(p(x), \varepsilon)\bigr\}$ over
all $x\in \Hcal$ for a certain $\delta_\varepsilon > 0$, that depends on $C$ and
$\varepsilon$, but {\bf not on} $x$. Hence $p$ is uniformly continuous on $\Hcal$.

As a reminder, let $U$ be open in $\real_+ = [0, +\infty)$. For any $x\in \{p\in U\}$
there is $\varepsilon_x > 0$, such that $B(p(x), \varepsilon_x) \subseteq U$. In
turn there exists $\delta_x = \delta_{\varepsilon_x} > 0$ with
\begin{equation*}
  x \in B\bigl(x, \delta_x\bigr)
    % continuity at $x$
    \subseteq \bigl\{ p\in B(p(x), \varepsilon_x)\bigr\}
    % preimage is monotone
    \subseteq \{ p \in U \}
    \,.
\end{equation*}
% Assume the norm topology $\Tcal = \Tcal^{\|\cdot\|}_\Hcal$ on $\Hcal$.
Therefore $\{ p \in U \} = \bigcup_{x\in \{ p \in U \}} B(x, \delta_x)$, which
establishes the continuity of $p$.

% paragraph continuity (end)

\paragraph{Various preimages} % (fold)
\label{par:various_preimages}

Let's study how values of $p$ are related to the underlying set $C$, when the set
has {\bf nice} properties: $C$ is convex and has $0\in \interior{C}$, i.e. when
$p(\Hcal) \subseteq \real$, $p$ becomes continuous, and $\alpha \leq \beta$ implies
$\alpha C \subseteq \beta C$. % See \ref{pr01}, \ref{pr03}, and \ref{pr05} in summary.

% paragraph various_preimages (end)

\paragraph{Preimage of $[0, 1]$} % (fold)
\label{par:preimage_of_0_1_closed}

Suppose $C$ is such, that $p$ is continuous. Thus the set $\{p\leq 1\}$ is closed in
$\Hcal$, whence we must have $[C] \subseteq \{p\leq 1\}$, since $C \subseteq \{p\leq 1\}$.

Suppose $x\in \{p\leq 1\}$. By the assumptions on $C$ we have $x = 0 \in C \subseteq [C]$,
so suppose $x\neq 0$. For any $\lambda > 1$ we have $x\in \lambda C$, implying that
$t x \in C$ for all $t \in (0, 1)$. If for an arbitrary open ball $B(x, \delta)$ we
can find $t < 1$, such that $t x \in B(x, \delta)$, then $B(x, \delta) \cap C \neq
\emptyset$, and hence $x \in [C]$. Indeed, for any $\delta > 0$
\begin{equation*}
  t \in\Bigl(
    \max\bigl\{1 - \tfrac\delta{\|x\|}, 0\bigr\}, 1
  \Bigr)
    \Leftrightarrow
      \lvert t - 1\rvert < \tfrac\delta{\|x\|}
      \, \& \, t \in (0, 1)
    \Rightarrow
      t x \in B(x, \delta) \cap C
      \,.
\end{equation*}
Therefore, $[C] = \{p \leq 1\}$.
% Positive homogeneity implies that $\alpha [C] $

% paragraph preimage_of_0_1_closed (end)

\paragraph{Preimage of $[0, 1)$} % (fold)
\label{par:preimage_of_0_1_open}

Suppose $C$ is such, that $p$ is continuous. Since $\{p < 1\}$ is open by continuity
of $p$ and $\{p < 1\} \subseteq C$, we must have $\{p < 1\} \subseteq \interior{C}$.

Conversely, suppose $x\in \{p \geq 1\}$. Then for any for any $\lambda < 1$ we have
$x \notin \lambda C$, or, equivalently, $t x \in \Hcal \setminus C$ for all $t > 1$.
In particular $x\neq 0\in C$. For any $\delta > 0$ we make the following argument:
\begin{equation*}
  t \in\Bigl(1, 1 + \tfrac\delta{\|x\|} \Bigr)
    \Leftrightarrow
      \lvert t - 1\rvert < \tfrac\delta{\|x\|}
      \, \& \, t \in (1, +\infty)
    \Rightarrow
      t x \in B(x, \delta) \cap \Hcal \setminus C
      \,.
\end{equation*}
Thus $x\in \bigl[\Hcal \setminus C \bigr]$. Note that $\Hcal\setminus \interior{C}$
is a closed set covering $\Hcal \setminus C$, which implies that it also covers the
closure. Therefore $\{p \geq 1\} \subseteq \Hcal\setminus \interior{C}$, and $\interior{C}
\subseteq \{p < 1\}$.

% paragraph preimage_of_0_1_open (end)

\paragraph{Preimage of $\{1\}$} % (fold)
\label{par:preimage_of_1}

We claim that for a {\bf nice} $C$, $\partial C = \{p = 1\}$. Indeed, the result
follows immediately from
\begin{equation}
  \{p = 1\}
    = \{p \leq 1\} \setminus \{p < 1\}
    = [C] \setminus \interior{C}
    = \partial C
    \,.
\end{equation}
Positive homogeneity implies, that the preimages of $[0, \alpha)$ and $[0, \alpha]$
for any $\alpha > 0$ are given by $\alpha$-inflations of the interior and the closure
of $C$, respectively:
\begin{equation*}
  \{p \leq \alpha \}
    = \alpha \{p \leq 1\}
    = \alpha [C]
    \,, \text{ and }
  \{p < \alpha \}
    = \alpha \{p < 1\}
    = \alpha \interior{C}
    \,.
\end{equation*}

% paragraph preimage_of_1 (end)

\paragraph{Bounding linear functionals} % (fold)
\label{par:bounding_linear_functionals}

Let $l$ be a linear functional and $p$ be a positively homogeneous function taking
values in $[0, \infty]$. Suppose $l \leq p$ on $\Hcal$. Then for any $x\in \Hcal$ we
have $l(x) \leq p(x)$, whence $- p(x) \leq - l(x) = l(- x)$ by linearity of $l$. At
the same time $- x \in \Hcal$ implies $l(- x) \leq p(- x)$. If $x=0$, then trivially
$l(0) = 0 \leq 0 \cdot p(0)$. However, for $x\neq 0$ we get the following bound
\begin{multline*}
  - p(- x) \leq l(x) \leq p(x)
  \Rightarrow
    \\
    \lvert l(x) \rvert
    % \leq (p(x) \vee p(- x))
      \leq \| x \| \max\Bigl\{
          p\Bigl(\tfrac{x}{\|x\|}\Bigr),
          p\Bigl(- \tfrac{x}{\|x\|}\Bigr)
        \Bigr\}
      \leq \|x\| \, \sup\{p(u)\colon \|u\|\leq 1\}
    \,.
\end{multline*}
% Note that there has been no need for $p(\Hcal)\subseteq \real$ in deriving this bound.
If $p$ is the Minkowski functional of a set $C$ with $0\in \interior{C}$, then $p$
is bounded on $B[0, 1]$ and positively homogeneous. Therefore this upper bound implies
that $l$ is a bounded linear functional. Note that convexity of $C$ is not necessary.

% paragraph bounding_linear_functionals (end)

\paragraph{Discussion} % (fold)
\label{par:discussion}

Obviously, if the set $\{ \lambda > 0 \colon x \in \lambda C \}$ is non-empty for
any $x \in \Hcal$, then $p(x)$ is finite-valued, because every $x$ is covered by
at least one $\lambda$-inflation.

This condition implies that $0 \in C$. Indeed, under it there must be $\lambda > 0$
such that $0 \in \lambda C$, which in turn means that $\exists z\in C$ such that
$0 = \lambda z$. Since $\lambda > 0$, we get $0 = z\in C$.

So $0 \in C$ seems necessary for finiteness. However, it is not sufficient. Consider
a cone $C = \{t z\colon z\in A\} = \bigcup_{t\geq 0} t A$ for $A = \{z\colon \|z - a\|
\leq \|a\|\}$ for a given $a \neq 0$. Since $t A = \{z\colon \|z - t a\| \leq t \|a\| \}$
for any $t\geq 0$, we still have $-a \notin C$: if it were otherwise, then $\tfrac{- a}t
\in A$ for some $t > 0$ with $1 + \tfrac1t \leq 1$ --- a contradiction.

Note that balancedness alone does not imply that $0 \in \interior{C}$, as exemplified
by taking a union of a closed convex cone and its mirrored counterpart.

% paragraph discussion (end)

\paragraph{Summary} % (fold)
\label{par:summary}

List of properties
\begin{enumerate}
  \item \label{pr01}
    $C$ is nonempty
  \item \label{pr02}
    $C$ is closed
  \item \label{pr03}
    $C$ is convex
  \item \label{pr04}
    $0 \in C$
  \item \label{pr05}
    $0$ is in the topological interior of $C$
  \item \label{pr06}
    $C$ is balanced: $\lambda C \subset C$ for all $\lvert \lambda \rvert \leq 1$
  \item \label{pr07}
    $C$ is absorbing at $0$: $\{\lambda>0\colon x \in \lambda C \} \neq \emptyset$
    for all $x\in \Hcal$
  \item \label{pr08}
    $\alpha C \subseteq \beta C$ whenever $\alpha \leq \beta$
  \item \label{pr09}
    $p(x) < +\infty$
  \item \label{pr10}
    $p(tx) = t p(x)$ for all $t > 0$
  \item \label{pr11}
    $p(tx) = \lvert t \rvert p(x)$ for all $t \in \real$
  \item \label{pr12}
    $t p(x) \leq p(t x)$ for all $t \in \real$
  \item \label{pr13}
    $p(x_1 + x_2) \leq p(x_1) + p(x_2)$ for any $x_1, x_2 \in \Hcal$
  \item \label{pr14}
    $p(0) = 0$
  \item \label{pr15}
    $A \subseteq B$ implies $\alpha A \subseteq \alpha B$
  \item \label{pr16}
    $\alpha x \in \lambda C$ iff $\lvert \alpha \rvert x \in \lambda C$ for any
    $\alpha \neq 0$ and $\lambda > 0$
  \item \label{pr17}
    $h \in C$ if and only if $-h \in C$
  \item \label{pr18}
    $p\colon \Hcal \to [0, +\infty)$ is a continuous map
  \item \label{pr19}
    $\sup\{p(u)\colon \|u\|\leq 1\} < +\infty$
\end{enumerate}
All implications tacitly assume $\{\ref{pr01}\}$:
$\{\ref{pr01}\} \Rightarrow \ref{pr10}$,
$\{\ref{pr03}, \ref{pr04}\} \Rightarrow \{\ref{pr08}, \ref{pr12}\}$,
$\{\ref{pr04}\} \Rightarrow \ref{pr14}$,
$\{\ref{pr14}\} \Rightarrow \ref{pr04}$,
$\{\ref{pr06}\} \Rightarrow \{\ref{pr11}, \ref{pr16}\}$,
$\{\ref{pr03}, \ref{pr17}\} \Rightarrow \{\ref{pr04}, \ref{pr06}\}$,
% Shown directly: if $x\in \lambda C$, then $x = \lambda z$ for some $z\in C$.
% if $\lambda > 0$, then $h = z\in C$, if $\lambda = 0$, then $\{\ref{pr17}\}$
% implies $0\in C$. Otherwise, $x = -\lvert \lambda\rvert z$ and $h = -z\in C$
% since $z\in C$. Therefore $x = (1 - \lvert \lambda\rvert) 0 + \lvert \lambda\rvert h$
% for $0, h\in C$, whence $x\in C$.
% for any $h\in C$ we have $0 = \tfrac12 (-h) + \tfrac12 h$.
$\{\ref{pr05}\} \Rightarrow \{\ref{pr04}, \ref{pr07}, \ref{pr09}\}$,
$\{\ref{pr07}\} \Rightarrow \{\ref{pr04}, \ref{pr09}\}$,
$\emptyset \Rightarrow \ref{pr15}$,
$\{\ref{pr11}\} \Rightarrow \{\ref{pr10}, \ref{pr12}\}$,
$\{\ref{pr03}\} \Rightarrow \ref{pr13}$,
$\{\ref{pr05}\} \Rightarrow \ref{pr19}$,
$\{\ref{pr03}, \ref{pr19}\} \Rightarrow \ref{pr18}$.

% paragraph summary (end)

\end{document}


\subsection{Unitary operators}
This section decribes all the functions in the file ``ptwXY\_unitaryOperators.c''.

\subsubsection{ptwXY\_abs}
This function applies the math absolute operation to every y-value in \highlight{ptwXY}.
\CallingC{fnu\_status ptwXY\_abs(}{statusMessageReporting *smr,
    \addArgument{ptwXYPoints *ptwXY );}}
    \argumentBox{smr}{The \highlight{statusMessageReporting} instance to record errors.}
    \argumentBox{ptwXY}{A pointer to the \highlight{ptwXYPoints} object.}

\subsubsection{ptwXY\_neg}
This function applies the math negate operation to every y-value in \highlight{ptwXY}.
\CallingC{fnu\_status ptwXY\_neg(}{statusMessageReporting *smr,
    \addArgument{ptwXYPoints *ptwXY );}}
    \argumentBox{smr}{The \highlight{statusMessageReporting} instance to record errors.}
    \argumentBox{ptwXY}{A pointer to the \highlight{ptwXYPoints} object.}


\input{/Users/alessandromanzotti/Work/preamble.tex}

%%% BEGIN DOCUMENT
\begin{document}
\title{CMB DC Mode}
\author{}
\affiliation{Department of Astronomy \& Astrophysics, University of Chicago, Chicago IL 60637}
\date{\today}

\section{Fisher\_estimate}

In this code I load the CAMB $C_{\ell}$s and I compute the Fisher estimates of the effect we are looking for, given a precise detector precision. The idea is expressed in Wayne's notes.
\begin{equation}
C_l = C_l^{\rm fid} \left[ 1+ \frac{\partial \ln (l^2 C_l^{\rm fid} )}{\partial \ln l} s \right],
\end{equation}
do a Fisher estimate of $\sigma_s^2$ (no other parameters marignalized) and compare it to $\sigma_\kappa^2$.
It means it the code to compute
\begin{equation}
C_l =  C^{\rm fid}\frac{\partial \ln (l^2 C_l^{\rm fid}) }{\partial \ln l},
\end{equation}
using  a spline function.
after that in the fisher formalism
\ben
F_{ss}=\sum_{\ell}\frac{1}{(\delta C_{\ell})^{2}}\left( C^{\rm fid}\frac{\partial \ln (l^2 C_l^{\rm fid} )}{\partial \ln l}\right)^{2}
\een
\ben
F_{ss}=\sum_{\ell}\frac{(2\ell+1)f_{\rm sky}}{2[C_{\ell}+N_{\ell}]^{2}}\left( C^{\rm fid}\frac{\partial \ln (l^2 C_l^{\rm fid} )}{\partial \ln l}\right)^{2}
\een

assuming SPT-pol 4$\mu K$-arcminute noise and a beam of 1-arcmin
\be
N_{\ell}=\exp\{-\ell(\ell+1)\theta_{FMWH}/(8\log 2)\}
\ee

\end{document}


\chapter{Chapter 4. Syntax of Propositional Logic}

\section*{4.7 Self-Study Questions}

	\begin{enumerate}

		\item[4.7.1]

		\begin{enumerate}

			\item Well, the formula could be sentence letter, which is a formula but contains no parentheses.

			\item This is not true: also a formula that is formed from a single sentence letter by means of some negations, such as $\neg p$ or $\neg\neg p$ etc., would not contain any parentheses.

			\item This is the only option which is guaranteed to hold: if a formula contains $\land,\lor,\to,\leftrightarrow$, then it needs to contain parentheses.

			\item This is simply not true: $\neg p$ contains an odd number of negations, but no parentheses.

		\end{enumerate}

		\item[4.7.2] Strategy (a) is the hardest to apply, which we've seen by means of our example. Strategy (c) will always give the right result but may take a long time. Strategy (d) is actually included in strategy (c)---just look at the second step of the algorithm. So, before you employ (c) fully, you just do (d). Having tried strategy (b) is a prerequisite for applying the algorithm (as we say before we describe the algorithm). But note that (b) can fail to tell you that something's not a formula even if it isn't: $(p\land\neg())$ is not a formula, but you actually need to apply the algorithm to see this, not even parentheses checking will help immediately.

		\item[4.7.3] The only correct answer is (d): conventional notation is just that, conventional, and so we need to make clear that we're using it.

		\item[4.7.4] To see why (b) is not correct, consider the formula $\phi=(\neg\neg\neg p\lor \neg p)$. It's easily checked that $c(\phi)=4$, but there are 5 connectives in $\phi$. To see that (f) is correct, we can use the Proposition 4.4.5: the complexity of a formula corresponds to the longest path from the root in its parsing tree. Since each step in path goes from one node to another, we have the starting node, the root, plus at least four other nodes, meaning five nodes. Note that there can be more than five nodes in the tree, as you can check by doing the parsing tree for $\phi$, which we used to explain why (b) is incorrect.

	\end{enumerate}

\section*{4.8 Exercises}

\begin{enumerate}

		\item[4.8.1] Translation key:

				\begin{longtable}{c c c}
				$p$ & : & Alan Turing built the first computer\\
				$q$ & : & Ada Lovelace invented the first computer algorithm\\
				$r$ & : & Today is Monday\\
				$s$ & : & Alan Turing is your favorite computer scientist\\
				$t$ & : & Ada Lovelace is your favorite computer scientist\\
				$u$ & : & Yesterday was Tuesday\\
				$v$ & : & Tomorrow is Saturday\\
			\end{longtable}

		\begin{enumerate}[(a)]

			\item $(p\land q)$

			\item $(r\to p)$

			\item Inclusive reading: $(s\lor t)$; Exclusive reading: $((s\lor t)\land\neg(s\land t))$

			\item $(r\leftrightarrow (u\land v))$.

		\end{enumerate}

		\item (For now, English only)

			\begin{enumerate}[(a)]

				\item It's not the case that I'm not both happy and clapping my hands.

				\item If I'm not happy, then I don't clap my hands.

				\item I'm happy if and only if you're not happy and I clap my hands.

				\item If I clap my hands and you clap your hands, then we both clap our hands.

				\item If I clap my hands and you clap your hands, then either I'm happy or you're happy.

				\item \emph{Either} I'm happy and clap my hands \emph{or} you're happy and clap your hands.
			\end{enumerate}

		\item[4.8.3] The set of all formulas of $\mathcal{L}$ that only contain (symbols from) $p,q,\neg,\land,(,$ and $)$ is the smallest set $X$ such that:

		\begin{itemize}

			\item $p,q\in X$,

			\item if $\phi\in X,$ then $\neg \phi\in X$,

			\item if $\phi,\psi\in X$, then $(\phi\land\psi)\in X$.

		\end{itemize}

	\item[4.8.3]

	\begin{enumerate}[(a)]

			\item $(q\leftrightarrow (p\land (q\lor (r\land \neg s)))$

			\begin{center}

\Tree [.{$(q\leftrightarrow (p\land (q\lor (r\land \neg s)))$} [.{$q$\checkmark} ]  [.$(p\land (q\lor (r\land \neg s))$ [.{$p$\checkmark} ] [.{$(q\lor (r\land \neg s)$} [.{$q$\checkmark} ] [.{$(r\land\neg s$\frownie} ]  ] ] ]\\[2ex]

\emph{Answer}: Not a formula!

\end{center}

			\item $((p\land q)\lor (p\land (q\to\neg q)))$

			\begin{center}

\Tree[.{$((p\land q)\lor (p\land (q\to\neg q)))$} [.{$(p\land q)$} [.{$p$\checkmark} ] [.{$q$\checkmark} ] ] [.{$(p\land (q\to\neg q))$}  [.{$p$\checkmark} ] [.$(q\to\neg q)$ [.{$q$\checkmark} ] [.{$\neg q$} [.{$q$\checkmark} ] ] ] ] ]\\[2ex]

\emph{Answer}: Formula!

\end{center}

			\item $(p\to (p\to ((p\land p)\leftrightarrow p\lor p)))$

			\begin{center}

		\Tree[.$(p\to (p\to ((p\land p)\leftrightarrow p\lor p)))$
		[.{$p$\checkmark} ]
		[.$(p\to ((p\land p)\leftrightarrow p\lor p))$
			[.{$p$\checkmark} ]
			[.$((p\land p)\leftrightarrow p\lor p)$
				[.$(p\land p)$
					[.{$p$\checkmark} ]
					[.{$p$\checkmark} ]
					]
				[.{$p\lor p$\frownie} ]]]] \\[2ex]
				\emph{Answer}: Not a formula!

\end{center}

			\item $\neg\neg (\neg\neg p\land (q\lor q) )$

			\begin{center}
			\Tree[.$\neg\neg (\neg\neg p\land (q\lor q))$
		[.$\neg (\neg\neg p\land (q\lor q))$
			[.$(\neg\neg p\land (q\lor q))$
				[.$\neg\neg p$
					[.$\neg p$
						[.{$p$\checkmark} ]
						]
					]
				[.$(q\lor q)$
					[.{$q$\checkmark} ]
					[.{$q$\checkmark} ]
					]
				]
			]
	] \\[2ex]
	\emph{Answer}: Formula!

			\end{center}

		\end{enumerate}

	\item[4.8.5] \

	\begin{enumerate}[(a)]

		\item $\#_{conn}:\mathcal{L}\to\mathbb{N}$ can be defined by:

			\begin{enumerate}[(i)]

				\item $\#_{conn}(p)=0$ for $p\in\mathcal{P}$

				\item \begin{enumerate}[(a)]

					\item $\#_{conn}(\neg\phi)=\#_{conn}(\phi)+1$

					\item $\#_{conn}((\phi\circ\psi))=\#_{conn}(\phi)+\#_{conn}(\psi)+1$, for $\circ=\land,\lor,\to,\leftrightarrow$.

					\end{enumerate}

			\end{enumerate}

		\item $\#_(:\mathcal{L}\to\mathbb{N}$ can be defined by:

			\begin{enumerate}[(i)]

				\item $\#_{(}(p)=0$ for $p\in\mathcal{P}$

				\item \begin{enumerate}[(a)]

						\item $\#_{(}(\neg\phi)=\#_{(}(\phi)$

						\item $\#_{(}((\phi\circ\psi))=\#_{(}(\phi)+\#_{(}(\psi)+1$, for $\circ=\land,\lor,\to,\leftrightarrow$.

					\end{enumerate}

			\end{enumerate}

	\item  $\#_{\mathcal{P}}:\mathcal{L}\to\mathbb{N}$ can be defined by:

		\begin{enumerate}[(i)]

		\item $\#_{\mathcal{P}}(p)=1$ for $p\in\mathcal{P}$

		\item \begin{enumerate}[(a)]

			\item $\#_{\mathcal{P}}(\neg\phi)=\#_{\mathcal{P}}(\phi)$

			\item $\#_{\mathcal{P}}((\phi\circ\psi))=\#_{\mathcal{P}}(\phi)+\#_{\mathcal{P}}(\psi)$, for $\circ=\land,\lor,\to,\leftrightarrow$.

		\end{enumerate}

		\end{enumerate}

		\item $\mathbf{1}_p:\mathcal{L}\to\{0,1\}$ can be defined by

	\begin{enumerate}[(i)]

		\item $\mathbf{1}_{p}(p)=1$ and $\mathbf{1}_{p}(q)=0$ for all $q\neq p\in\mathcal{P}$

		\item \begin{enumerate}[(a)]

			\item $\mathbf{1}_{p}(\neg\phi)=\mathbf{1}_{p}(\phi)$

			\item $\mathbf{1}_{p}((\phi\circ\psi))=max(\mathbf{1}_{p}(\phi),\mathbf{1}_{p}(\psi))$, for $\circ=\land,\lor,\to,\leftrightarrow$.

		\end{enumerate}

		\end{enumerate}

	\end{enumerate}

	\item[4.8.6]

	\begin{enumerate}[(a)]

		\item This function counts the number of symbols in a formula.

		\item This function counts the number of negations in a formula.

		\item This function assigns one as a value iff the number of negations in the formula is even.

	\end{enumerate}

  \item[4.8.7] We willen laten zien dat boor alle formules $\phi\in\mathcal{L}$,
	het aantal subformules maximaal tweemaal het aantal connectieven plus 1,
	i.e. $|sub(\phi)| \leq 2 \cdot \#_{conn}(\phi) + 1$.

	  We bewijzen dit met inductie op formules.

	  \begin{itemize}
		\item[(i)] Het basisgeval $p$ heeft één subformule, $p$, en bevat geen connectieven.
		  Het aantal subformules is dus niet groter dan $2 \cdot 0 + 1 = 1$.
		\item[(ii)]
		  \begin{itemize}
			\item [a.] Neem een formule $\phi\in\mathcal{L}$.
			  We nemen via de inductiehypothese aan dat het aantal subformules van $\phi$ niet groter is dan $2\cdot \#_{conn}(\phi) + 1$.
			  We bekijken het geval $\neg\phi$.
			  Met de definitie van de subformules (zie 4.4.2) weten we dat
			  $sub(\neg\phi) = sub(\phi) \cup \{\neg\phi\}$ dus $|sub(\neg\phi)| = |sub(\phi)| + 1$.
			  Aangezien we één negatie toevoegen volgt
			  $\#_{conn}(\neg\phi) = \#_{conn}(\phi) + 1$.
			  Neem nu de inductiehypothese:
			  \begin{align*}
				|sub(\phi)| &\leq 2\cdot \#_{conn}(\phi) + 1
			  \end{align*}
			  Substitutie geeft:
			  \begin{align*}
				|sub(\neg\phi)| - 1 &\leq 2\cdot \#_{conn}(\neg\phi) \\
				|sub(\neg\phi)| &\leq 2\cdot \#_{conn}(\neg\phi) + 1
			  \end{align*}
			  Hiermee geldt de claim voor $\neg\phi$.

			\item [b.] Bezie
			  $\phi, \psi \in \mathcal{L}$.
			  We nemen via de inductiehypothese aan dat
			  $|sub(\phi)|\leq 2\cdot \#_{conn}(\phi)+1$
			  en
			  $|sub(\psi)|\leq 2\cdot \#_{conn}(\psi)+1$.
			  We beschouwen het geval $(\phi\circ\psi)$ met
			  $\circ\in\{\vee,\wedge,\to,\leftrightarrow\}$.
			  Met de definitie van de subformules (zie 4.4.2) weten we dat
			  $sub((\phi \circ \psi))=sub(\phi) \, \cup \, sub(\psi) \, \cup \, \{ (\phi\circ\phi)\}$.
			  Omdat er overlap kan zijn tussen de subformules van $\phi$ en $\psi$, moet gelden dat
			  $|sub((\phi \circ \psi))|\leq |sub(\phi)| + sub(\psi)$.
			  Verder
			  $\#_{conn}((\phi \circ \psi)) = \#_{conn}(\phi) + \#_{conn}(\psi) + 1$.
			  Begin als volgt:
			  \begin{align*}
				|sub((\phi \circ \psi))| &\leq |sub(\phi)| + sub(\psi)
			  \end{align*}
			  Substitutie geeft:
			  \begin{align*}
				|sub((\phi \circ \psi))| &\leq 2\cdot \#_{conn}(\phi) + 2\cdot \#_{conn}(\psi) + 2 \\
										 &\leq 2 \cdot (\#_{conn}(\phi) + \#_{conn}(\psi) + 1)\\
										 &\leq 2 \cdot \#_{conn}((\phi \circ \psi)) \\
										 &\leq 2 \cdot \#_{conn}((\phi \circ \psi)) + 1
			  \end{align*}
			  Hiermee geldt de eigenschap ook voor $(\phi \circ \psi)$.
			  We hebben nu via inductie bewezen dat de eigenschap voor alle formules geldt.
		  \end{itemize}
	  \end{itemize}

	\item[4.8.8] We give an informal outline of the argument. This can be made precise using function $\#_($ from 1.8.5 and an analogously defined function $\#_)$.

	\emph{Claim}. The number of $($ and $)$ in a formula $\phi$ is always the same.

	\begin{proof}
	We prove this by induction.

	\begin{enumerate}[(i)]

		\item For the base case, note that the number of both $($'s and $)$' in any sentence letter $p$ is both zero.

		\item \begin{enumerate}[(a)]

			\item Assume the induction hypothesis, that numbers of $($ and $)$ in $\phi$ are the same. Consider $\neg\phi$. Note that the number of $($'s $\neg\phi$ is the same as in $\phi$ and the number of $)$'s in $\neg\phi$ is the same as in $\phi$ (no new parentheses have been added). Hence, the numbers of $($ and $)$ in $\neg\phi$ are also the same.

			\item Assume the induction hypotheses, that numbers of $($ and $)$ in $\phi$ are the same and the numbers of $($ and $)$ in $\psi$ are the same. Denote the number of $($'s in $\phi$ by $n$, the number of $)$'s in $\phi$ by $m$, the number of $($'s in $\psi$ by $k$, and the number of $)$'s in $\psi$ by $l$. We have $n=k$ and $m=l$. Consider $(\phi\circ\psi)$. The number of $($'s in $(\phi\circ\psi)$ is $n+k+1$. The number of $)$'s in $(\phi\circ\psi)$ is $m+l+1$. Since  $n=k$ and $m=l$,  $n+k+1=m+l+1$, as desired.

		\end{enumerate}
		We conclude our claim by induction on formulas.

	\end{enumerate}

	\end{proof}

	\item[4.8.9]

		\begin{enumerate}[(a)]

\item $(\neg p\land q)$

\item $\neg((p\land q)\to (\neg p\lor\neg q))$

\item $((p\lor p)\leftrightarrow \neg p)$

\item $((p\lor q)\land r)$

\item $((p\to p)\leftrightarrow (p\to p))$

\item $(\neg p \land (((q\lor r)\to p)\leftrightarrow q))$

\item $(p\land (p\lor q))$

\item $((p\to (q\lor q))\leftrightarrow r)$

\item $((p\to q)\leftrightarrow (\neg q\to \neg p))$

\item $\neg\neg\neg p$

\item $(({p} \to {p}) \leftrightarrow ({p}\lor \neg {p}))$

\item $((p\lor q)\to (\neg r\land (s\leftrightarrow {p})))$

		\end{enumerate}

		\item[4.8.10] \

		\begin{enumerate}

			\item $p\land q$

			\item $\neg\neg q$

			\item $p\land (r\lor q)$

			\item $p\to (r\lor (p\land (q\leftrightarrow r)))$

			\item $p\lor \neg (p\lor q)$

			\item $p\land q\to r$

			\item $p\lor q\to \neg q\leftrightarrow r$

			\item $p\land q\land r$

			\item $p\land q\land r$

			\item $p\lor q\lor r$

			\item $p\land (q\lor r)$

			\item $p\land (q\to r)$

		\end{enumerate}

\end{enumerate}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "../../logic.tex"
%%% End:


\section{Scene Surveying With Heterogeneous Battery Constraints and Sampling Times}\label{sec:SceneSurveyingBatteryConstraints}
%\note{Keep this very brief - there is not a great research output here. Simply mention that we began looking into using solvers to calculate solutions as is line with a lot of the literature.}

Once we had prototyped the NN algorithm in order to find a suitable solution to the simplified problem, we then considered the more general problem, where RAVs have heterogeneous battery constraints, sampling times and operational speeds, which is mentioned in Section \ref{sec:SceneSurveying}. This can be described by the more general Vehicle Routing Problem (VRP). We decided to formulate the problem as a \textit{linear program} and planned to find solutions using a linear program solver, following the approach outlined in \cite{Toth2002TheProblem}. We subsequently use terminology commonly used in convex optimisation and linear programming. We refer the reader to the text "Convex Optimization" \cite{Boyd2004ConvexOptimization} for information on linear programming and convex optimisation in general. This means that the problem's objective function and constraints must be written as linear expressions.
%A number of code repositories with permissive licences that provide solvers for linear programs exist .S
Specifying the VRP explicitly as a linear program and then passing it to a solver is a time-consuming process, which has led to the development of a number of tools which act as wrappers for software developers to solve well-known problems without having to write excessive amounts of boiler-plate code. We chose to use Google's Apache-licensed \href{https://developers.google.com/optimization/}{\textit{Operations Research}}\footnote{\href {https://developers.google.com/optimization/}{https://developers.google.com/optimization/}} (OR) repository, which contains a routing library with high-level interfaces specifically designed to allow the user to define and solve VRPs. This meant we could focus on defining the salient aspects of the problem rather than the details of how to convert the VRP into a linear program.

We began by following the example outlined in the \href{https://developers.google.com/optimization/routing/vrp}{OR tools documentation}\footnote{\href {https://developers.google.com/optimization/routing/vrp}{https://developers.google.com/optimization/routing/vrp}}. The documentation outlines the steps to solve a linear program using the repo follow the same pattern:
\begin{itemize}
\item Create the variables.
\item Define the constraints.
\item Define the objective function.
\item Declare the solver — the method that implements an algorithm for finding the optimal solution.
\item Invoke the solver and display the results.
\end{itemize}

\subsection{Specifying Variables and Constraints}
We first implemented a vehicle class which records the variables related to routing for each vehicle. Member variables included:
\begin{itemize}
    \item The time taken to record data at each node
    \item The location of the depot, where the charging point is located
    \item The operational speed of the vehicle
    \item The estimated remaining battery life in seconds
\end{itemize}
In order to facilitate recharging, we followed the approach outlined in the documented examples and created "virtual" depot nodes, which are duplicate nodes of the recharge location and have an associated recharge time for each RAV.  We force the RAVs to visit the depot to recharge once its battery level reaches below 5\% by creating a cumulative variable with a range equal to the predicted time taken for the RAV battery to degrade to this level. In effect, this indicates to the solver that it must include a virtual depot node in the solution at this time.

For each RAV, we then created a lookup table of times taken to travel from one node to the next and service the second node, based on the distances between the nodes, the operational speed of the RAV and the service time. In order to communicate to the solver that it should refer to each of these lookup tables to determine the cost of adding a node to a vehicle's route, we created a \textit{dimension} for each vehicle which refers to the lookup table. \textit{Dimensions} are used in the OR Tools interface to represent quantities accumulated at nodes along the routes. We then specified each time dimension to contribute to the objective function by using the $setGlobalSpanCostCoefficient$ method, which notifies the solver to minimise the largest cost among all the time dimensions, which equates to minimising the longest time taken for any vehicle to complete its route. Since the solver is designed to find solutions to mixed-integer linear programs, we took the recommended approach of scaling up distance between nodes and then rounding, in order to minimise error. Once the solution had been computed, we normalised the results to their original scale. We used the default \href{http://google.github.io/or-tools/python/ortools/sat/python/cp\_model.html}{CP-SAT}\footnote{\href {http://google.github.io/or-tools/python/ortools/sat/python/cp\_model.html}{http://google.github.io/or-tools/python/ortools/sat/python/cp\_model.html}} solver to compute a solution, with the cheapest arc heuristic. The cheapest arc heuristic builds a solution by beginning with the start node and connects it to the node which produces the cheapest route segment, then extends the route by iterating on the last node added to the route. %We did not get the chance to evaluate other heuristics due to time constraints.

\subsection{Results of the Solver-Based Method}
We prototyped the OR-Tools solver based method, which meant the results that we generated apply to carefully chosen regions that offer a proof-of-concept that the OR-Tools based method can provide viable solutions. We outline in Section \ref{sec:SurveyingConclusionFutureWork} how we envision the prototype solution could be extended and sufficiently validated. Sample solutions computed for various configurations of the vehicles are shown in Table \ref{table:ORToolsResults}. For each of the solutions shown, we enforced that RAV 1 (red) and RAV 2 (green) have 1200 seconds fly time and that RAV 3 (yellow) has 2400 seconds of flying time. We assumed arbitrarily that the RAVs take 600 seconds to recharge to full capacity and that the RAVs will always recharge to full capacity if they return to the depot node. RAV 1, RAV 2 and RAV 3 begin with 17.5\%, 33.3\% and 100\% of their full battery capacities respectively. RAVs start and finish at the same location.

The configurations and solutions for the individual vehicles used are given in Table \ref{table:ORToolsResults}
\note{Ran with 3 RAVs also, might be worth showing}
\begin{table}[H]
  \centering
  \begin{tabular}{ | c | m{5.2cm} | }
    \hline
    Planned RAV Routes & Solution details \\
    \hline

    %single RAV
    \begin{minipage}[c][53mm][c]{.6\textwidth}
      \includegraphics[width=\linewidth, height=51mm]{Chapters/MultiAgentCoverage/MultipleTravellingSalesman/Figs/ORToolsSolns/Example1.PNG}

    \end{minipage}
    &
    \small
    \begin{tabular}{m{10mm}|m{11mm} m{11mm}}
        & RAV 1 & RAV 2\\
        \hline
        Speed& 4 & 2 \\
        T.T.S & 0.5 & 0.5 \\
        Color & Red & Green \\
        \hline
        Dist.& 1813 & 1813 \\
        Time& 1410 & 1600 \\
    \end{tabular}
    \normalsize
    \\
    \hline
    %single RAV
    \begin{minipage}[c][53mm][c]{.6\textwidth}
      \includegraphics[width=\linewidth, height=51mm]{Chapters/MultiAgentCoverage/MultipleTravellingSalesman/Figs/ORToolsSolns/Example2.PNG}

    \end{minipage}
    &
    \small
    \begin{tabular}{m{10mm}|m{11mm} m{11mm} }
        & RAV 1 & RAV 2\\
        \hline
        Speed& 1 & 1 \\
        T.T.S & 0.5 & 0.5 \\
        Color & Red & Green \\
        \hline
        Dist.& 1961 & 2141 \\
        Time& 3423 & 3423 \\
    \end{tabular}
    \normalsize
    \\
    \hline

    %single RAV
    \begin{minipage}[c][53mm][c]{.6\textwidth}
      \includegraphics[width=\linewidth, height=51mm]{Chapters/MultiAgentCoverage/MultipleTravellingSalesman/Figs/ORToolsSolns/Example3.PNG}

    \end{minipage}
    &
    \small
    \begin{tabular}{m{10mm}|m{11mm} m{11mm}}
        & RAV 1 & RAV 2\\
        \hline
        Speed& 1 & 1 \\
        T.T.S & 2 & 2 \\
        Color & Red & Green \\
        \hline
        Dist.& 2142 & 2150 \\
        Time& 3462 & 3462 \\
    \end{tabular}
    \normalsize
    \\
    \hline

    %single RAV
    \begin{minipage}[c][53mm][c]{.6\textwidth}
      \includegraphics[width=\linewidth, height=51mm]{Chapters/MultiAgentCoverage/MultipleTravellingSalesman/Figs/ORToolsSolns/Example4.PNG}

    \end{minipage}
    &
    \small
    \begin{tabular}{m{10mm}|m{11mm} m{11mm}}
        & RAV 1 & RAV 2\\
        \hline
        Speed& 8 & 1 \\
        T.T.S & 1 & 1 \\
        Color & Red & Green \\
        \hline
        Dist.& 2638 & 870 \\
        Time& 1410 & 1600 \\
    \end{tabular}
    \normalsize
    \\
    \hline

  \end{tabular}
  \caption{Results of applying solution found with OR-Tools solver. T.T.S = Time to sample, Dist. = Distance}\label{table:ORToolsResults}
\end{table}