\documentclass[11pt]{article}
% \documentclass[11pt,twoside]{article}

\usepackage{lecnotes}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{comment}
\input{fp-macros}

\newcommand{\lecdate}{January 23, 2012} % e.g. January 12, 2010
\newcommand{\lecnum}{3}           % e.g. 1
\newcommand{\lectitle}{Harmony}         % e.g. Judgments and Propositions
\newcommand{\lecturer}{Frank Pfenning}         % e.g. Frank Pfenning

\begin{document}

\maketitle

\noindent
In the last lecture we started developing the propositional
connectives of linear logic.  Specifically, we introduced simultaneous
conjunction $A \tensor B$ and linear implication $A \lolli B$.  Each
connective is determined by giving left and right rules in the sequent
calculus that specify how to use a resource or prove a goal with that
connective.  We also explicated two tests we apply to determine if the
logical connectives are meaningful: identity expansion and cut
reduction.  If they both hold we say that the left and right rules for
the connectives are \emph{in harmony}.  We continue to develop
additional connectives, and also explore some consequences of a
failure of harmony between left and right rules.

\section{Multiplicative Unit}

Whenever we have a binary operator, $A \tensor B$ in this case, we
should consider if it has a unit.  In this case, the unit is written
$\one$, and has the property that $A \tensor \one$ and $\one \tensor
A$ are equivalent to $A$.  We can try to derive the rules for $\one$
systematically, by thinking of it as a multiplicative conjunction with
zero components.  Below, we show the binary rule first, and the
nullary rule second.
\[
\infer[{\tensor}R]
  {\Delta, \Delta' \seq A \tensor B}
  {\Delta \seq A &
    \Delta' \seq B}
\qquad
\infer[{\one}R]
  {\cdot \seq \one}
  {\mathstrut}
\]
$A \tensor B$ has two components, so ${\tensor}R$ has two premises.
Correspondingly, $\one$ has no components and no premises.  This also
means that we require that there are no resources, indicated above by
writing `$\cdot$'.  In summary, $\one$ holds as a goal if we have
no resources.

Looking at the left rules:
\[
\infer[{\tensor}L]
  {\Delta, A \tensor B \seq C}
  {\Delta, A, B \seq C}
\qquad
\infer[{\one}L]
  {\Delta, \one \seq C}
  {\Delta \seq C}
\]
$A \tensor B$ has two components, so they both appear as new resources
in the premise.  $\one$ has no components, so no new resources appear
in the premise.

The left and right rules for $\one$ are in balance.  First, the local
expansion:
\[
\infer[\m{id}_\one]
  {\one \seq \one}
  {\mathstrut}
\quad \longrightarrow_E \quad
\infer[{\one}L]
  {\one \seq \one}
  {\infer[{\one}R]
    {\cdot \seq \one}
    {\mathstrut}}
\]
and then the reduction
\[
\infer[\m{cut}_\one]
  {\Delta' \seq C}
  {\infer[{\one}R]
    {\cdot \seq \one}
    {\mathstrut} &
   \infer[{\one}L]
    {\Delta', \one \seq C}
    {\Delta' \seq C}}
\quad \longrightarrow_R \quad
\Delta' \seq C
\]

We should verify that $A \tensor \one$ is equivalent to $A$.  But what
does this mean?  We take it to mean that both $A \tensor \one \seq A$
and $A \seq A \tensor \one$.  We just give a short example proof, the
other direction and other versions are similarly easy to prove.
\[
\infer[{\tensor}L]
  {A \tensor \one \seq A}
  {\infer[{\one}L]
    {A, \one \seq A}
    {\infer[\m{id}_A]
      {A \seq A}
      {\mathstrut}}}
\]

The multiplicative unit is useful in specifications to eliminate
resources, using the idiom $A \lolli \one$.

\section{Failure of Harmony}

We investigate the consequences of a failure of harmony in one case.
Let's assume had replaced the left rule for simultaneous conjunction
with the following two rules:
\[
\infer[{\tensor}L_1??]
  {\Delta, A \tensor B \seq C}
  {\Delta, A \seq C}
\qquad
\infer[{\tensor}L_2??]
  {\Delta, A \tensor B \seq C}
  {\Delta, B \seq C}
\]
First we note that identity expansion indeed fails.  We show one
attempt; others fail similarly.
\[
\infer[\m{id}_{A \tensor B}]
  {A \tensor B \seq A \tensor B}
  {\mathstrut}
\qquad
\infer[{\tensor}L_1??]
  {A \tensor B \seq A \tensor B}
  {\infer[{\tensor}R]
    {A \seq A \tensor B}
    {\infer[\m{id}_A]{A \seq A}{\mathstrut} &
     \deduce{\cdot \seq B}{??}}}
\]
It turns out that with these the two incorrect left rules,
\emph{weakening}
\[
\infer[\m{weaken}]
  {\Delta, A \seq C}
  {\Delta \seq C}
\]
becomes a derived rule of inference.  This, of course, violates the
basic principle that ephemeral resources must be used exactly once,
because $A$ is indeed not used.  Before reading on, we suggest you try
to prove this yourself.

\clearpage
\[
\infer[\m{cut}_{A \tensor \one}]
  {\Delta, A \seq C}
  {\infer[{\tensor}R]
    {A \seq A \tensor \one}
    {\infer[\m{id}_A]{A \seq A}{\mathstrut} &
      \infer[{\one}R]{\cdot \seq \one}{\mathstrut}} &
   \infer[{\tensor}L_2??]
     {\Delta, A \tensor \one \seq C}
     {\infer[{\one}L]
       {\Delta, \one \seq C}
       {\Delta \seq C}}}
\]

\section{Alternative Conjunction}

Using our rules for coin exchange, we can prove $\m{q} \seq \m{d}
\tensor \m{d} \tensor \m{n}$ and also $\m{q} \seq \m{q}$.  But clearly
we can \emph{not} prove $\m{q} \seq (\m{d} \tensor \m{d} \tensor
\m{n}) \tensor \m{q}$, because we would have to use $\m{q}$ twice in
the proof.  Still, with the resource $\m{q}$ we can actually prove
both!  To express this situation inside the logic as a connective we
write $A \with B$, pronounced ``\textit{$A$ with $B$}''.  It is
variously called \emph{alternative conjunction} or \emph{additive
  conjunction}.  With this connective we can prove $\m{q} \seq (\m{d}
\tensor \m{d} \tensor \m{n}) \with \m{q}$.  We can achieve this as a
goal from resources $\Delta$ exactly if we can achieve $A$ from
$\Delta$, and also $B$ from $\Delta$.
\[
\infer[{\with}R]
  {\Delta \seq A \with B}
  {\Delta \seq A &
    \Delta \seq B}
\]
This appears to be a violation of linearity: the resources in $\Delta$
seem to be duplicated.  But we are saved, because when we have a
resource $A \with B$ we have to choose between $A$ and $B$.  We cannot
get both.  This means that $\Delta$ is not really duplicated, since
only one of the two premises will ever be used, as we will check
shortly.
\[
\infer[{\with}L_1]
  {\Delta, A \with B \seq C}
  {\Delta, A \seq C}
\qquad
\infer[{\with}L_2]
  {\Delta, A \with B \seq C}
  {\Delta, B \seq C}
\]
The informal reason that the ``duplication'' of $\Delta$ does not
destroy linearity is reflected in the identity expansion and cut
reduction.  It is most clear in the reduction, so we show this first.
\[
\infer[\m{cut}_{A \with B}]
  {\Delta, \Delta' \seq C}
  {\infer[{\with}R]
    {\Delta \seq A \with B}
    {\Delta \seq A &
      \Delta \seq B} &
   \infer[{\with}L_1]
     {\Delta', A \with B \seq C}
     {\Delta', A \seq C}}
\\[1em]
\quad \longrightarrow_R \quad
\\[1em]
\infer[\m{cut}_A]
  {\Delta, \Delta' \seq C}
  {\Delta \seq A &
    \Delta', A \seq C}
\]
In fact, there is another symmetric reduction, when the second premise
of the cut is inferred with the ${\with}L_2$ rule.  The identity
expansion is
\[
\infer[\m{id}_{A \with B}]
   {A \with B \seq A \with B}
   {\mathstrut}
\quad \longrightarrow_E \quad
\infer[{\with}R]
   {A \with B \seq A \with B}
   {\infer[{\with}L_1]
     {A \with B \seq A}
     {\infer[\m{id}_A]{A \seq A}{\mathstrut}} &
    \infer[{\with}L_2]
     {A \with B \seq B}
     {\infer[\m{id}_B]{B \seq B}{\mathstrut}}}
\]

\section{Additive Unit}

As for multiplicative conjunction with unit $\one$, there is a nullary
version of additive conjunction.  The unit is $\top$ (pronounced
``\emph{top}'').  Again, its rules can be derived systematically from
the rules for additive conjunction.  The right rule has zero premises,
propagating the resources $\Delta$ to all of them.  $A \with B$
has two conjuncts and therefore two left rules; $\top$
has zero conjuncts and therefore zero left rules.
\[
\infer[{\top}R]
  {\Delta \seq \top}
  {\mathstrut}
\qquad
\mbox{no ${\top}L$ rule}
\]
Of course, there is now no cut reduction since there is no left rule
for $\top$.  But there is still an identity expansion.
\[
\infer[\m{id}_\top]
  {\top \seq \top}
  {\mathstrut}
\quad \longrightarrow_E \quad
\infer[{\top}R]
  {\top \seq \top}
  {\mathstrut}
\]

\section{Disjunction}

We have seen that alternative conjunction stands for a kind of choice.
If we have a resource $A \with B$ we have a choice wether to use $A$
or $B$ in our proof.  If we have a goal $A \with B$ we have to account
for both uses.

Disjunction is symmetric to this.  If we have a resource $A \oplus B$
the environment must provide either $A$ or $B$, so we have to account
for both possibilities.  Conversely, if we have a goal $A \oplus B$
we can satisfy it by providing $A$ or by providing $B$.
\[
\infer[{\oplus}R_1]
  {\Delta \seq A \oplus B}
  {\Delta \seq A}
\qquad
\infer[{\oplus}R_2]
  {\Delta \seq A \oplus B}
  {\Delta \seq B}
\qquad
\infer[{\oplus}L]
  {\Delta, A \oplus B \seq C}
  {\Delta, A \seq C &
    \Delta, B \seq C}
\]
We leave the identity expansion and cut reduction to Exercise~\ref{exc:disj-harmony}.

\section{Disjunctive Unit}

There is also a unit of disjunction $\zero$, which is a form of
falsehood.  We can obtain its rules as the nullary versions
of disjunction.
\[
\mbox{no ${\zero}R$ rule}
\qquad
\infer[{\zero}L]
  {\Delta, \zero \seq C}
  {\mathstrut}
\]
We leave its properties to Exercise~\ref{exc:zero-harmony}.

\section{Persistent Truth}

The most difficult connective to add is one to internalize persistent
truth as a proposition.  It turns out for many purposes it is
convenient to retain the judgment $A\; \pers$, although this is not
the only possible choice.  This necessitates a judgmental rule,
connection the judgments of ephemeral and persistent truth.
But first, we generalize the sequents themselves by segregating
ephemeral and persistent propositions.  We write
\[
\underbrace{B_1\,\pers, \ldots, B_k\,\pers}_{\displaystyle \Gamma}
\semi \underbrace{A_1\,\eph, \ldots, A_n\,\eph}_{\displaystyle \Delta}
\seq C\,\eph
\]
Now our rules will have to respect the ephemeral nature of the The
persistent and ephemeral resources are separated by a semicolon
``$\semi$'' so that we can tell the status of a resource from its
position in the sequent.

First, we have a judgmental rule that allows us to make an ephemeral
copy of a persistent resource.
\[
\infer[\m{copy}]
  {\Gamma, A\, \pers \semi \Delta \seq C\;\eph}
  {\Gamma, A\, \pers \semi \Delta, A\, \eph \seq C\;\eph}
\]
This rule applies to arbitrary $A$.  One may also wonder if there is a
correspoding structural rule for a goal $C\; \pers$.  If there were
such a rule, it would be:
\[
\left[ \begin{array}{c}
\infer[\m{valid}]
  {\Gamma \semi \cdot \seq A\; \pers}
  {\Gamma \semi \cdot \seq A\; \eph}
\end{array} \right]
\]
It expresses that we judge something to be persistently true if its
proof does not depend on any ephemeral resources.  Since all resources
in $\Gamma$ are persistent, this means we can produce as many copies
of $A$ as we like, thereby satisfying the demain of the $\m{copy}$
rule.  However, as the brackets indicate, we do not have an explicit
rule of this form, but immediately reduce $A\; \pers$ when it appears
on the right-hand side of a sequent to $A\; \eph$.  This is justified
when we view $A\; \pers$ as being defined by the property of being
true without the use of any ephemeral resources: the premise and
conclusion of this are equal by definition, and we therefore always
replace the conclusion by the premise.

Just as before, we should have rules that connect the role of
persistent truth as a resource and goal.  The new identity
rule
\[
\left[ \begin{array}{c}
\infer[\m{id}^!_A]
  {\Gamma, A\, \pers \semi \cdot \seq A\; \eph}
  {\mathstrut}
\end{array} \right]
\]
is immediately derivable from the $\m{copy}$ rule and identity at $A$,
so we do not need this as an explicit rule.  The converse, namely that
proving that $A$ is persistently true allows us to make persistent use
of $A$ is needed, however.
\[
\infer[\m{cut}^!_A]
  {\Gamma \semi \Delta \seq C\; \eph}
  {\Gamma \semi \cdot \seq A\; \eph &
   \Gamma, A\, \pers \semi \Delta \seq C\; \eph}
\]
Note that in both $\m{id}^!_A$ (which we omitted) and $\m{cut}^!_A$, we
have exploited the judgmental definition of persistent truth in the
conclusion, replacing $A\; \pers$ by $A\; \eph$ with an empty collection
of ephemeral resources.

At this point all the rules of linear logic so far have to be
generalize to allow persistent resources.  Just as in the $\m{cut}^!$,
persistent resources in the conclusion and all premises are all the
same in the rules we have discussed so far.  This is correct since
persistent resources may be duplicated and need not be consumed.  We
will also tacitly adjoin an unused persistent resource to a sequent
whenever this turns out to be necessary.

\section{Of Course!}

Having laid down the extension of sequents to encompass persistence,
we can now integrate it into propositions.  We write $\bang A$ (read
``\textit{of course $A$}'' or ``\textit{bang $A$}'') for the
proposition which expresses that $A$ is persistently true.  We also
refer to $\bang A$ as the \emph{exponential modality}.  The left rule
takes an ephemeral resource of $\bang A$ and marks it as persistent.
\[
\infer[{\bang}L]
  {\Gamma \semi \Delta, \bang A\,\eph \seq C\;\eph}
  {\Gamma, A\,\pers \semi \Delta \seq C\;\eph}
\]
The right rule requires that $A$ is persistently true,
which is the same as $A$ being ephemerally true, without
ephemeral resources.
\[
\infer[{\bang}R]
  {\Gamma \semi \cdot \seq \bang A\;\eph}
  {\Gamma \semi \cdot \seq A\;\eph}
\]
Are these in harmony?  Let's check.  We omit the judgments $\eph$ and
$\pers$ now, because we can always tell from the position within the
sequent.  First identity expansion:
\[
\infer[\m{id}_{\bang A}]
  {\cdot \semi \bang A \seq \bang A}
  {\mathstrut}
\quad \longrightarrow_E \quad
\infer[{\bang}L]
  {\cdot \semi \bang A \seq \bang A}
  {\infer[{\bang}R]
    {A \semi \cdot \seq \bang A}
    {\infer[\m{copy}]
      {A \semi \cdot \seq A}
      {\infer[\m{id}_A]{A \semi A \seq A}{\mathstrut}}}}
\]
Second, cut reduction, which reduces a $\m{cut}$ at $\bang A$ by a
$\m{cut}^!$ at $A$, reducing the complexity of the proposition.
\[
\begin{array}{c}
\infer[\m{cut}_{\bang A}]
  {\Gamma \semi \Delta \seq C}
  {\infer[{\bang}R]
    {\Gamma \semi \cdot \seq \bang A}
    {\Gamma \semi \cdot \seq A} &
   \infer[{\bang}L]
    {\Gamma \semi \Delta, \bang A \seq C}
    {\Gamma, A \semi \Delta \seq C}}
\\[1em]
\quad \longrightarrow_R \quad
\\[1em]
\infer[\m{cut}^!_{A}]
   {\Gamma \semi \Delta \seq C}
   {\Gamma \semi \cdot \seq A &
     \Gamma, A \semi \Delta\seq C}
\end{array}
\]

We will talk more about this and the other reductions in future
lectures.  The approach to modeling persistent truth in this manner
goes back to Andreoli's \emph{dyadic system}~\cite{Andreoli92} in
classical linear logic and Hodas and Miller~\cite{Hodas94ic} in
intuitionistic linear logic, which is a fragment of ours.  A
judgmental justification for this system can be found in Chang et
al.~\cite{Chang03tr} which drew its inspiration from Pfenning and
Davies~\cite{Pfenning01mscs}.

\section{Example: Beggars Revisited}

Previously, we could not express the proverb ``\textit{If wishes were
  horses, beggars would ride.}''  Unfortunately, we do not yet have
quantifiers, so let me just say that $\forall x.\, A(x)$ is true if
$A(y)$ is true for an arbitrary parameter $y$.  Similarly, $\exists
x.\, A(x)$ is true, if $A(t)$ is true for some object $t$.  We can
then say:
\[
!(\forall x.\, \m{wish}(x) \lolli \bang\m{horse}(x))
\lolli \forall y.\, \bang\m{beggar}(y) \lolli
\exists z.\, \bang\m{horse}(z) \tensor \m{rides}(y,z)
\]
The whole proposition itself should be considered persistent, which we
could express by wrapping another ``$\bang$'' around it on the
outside.

A few words on operator precedence: ``$\bang$'' binds mostly tightly,
``$\tensor$'' is next followed by ``$\lolli$''.  The quantifiers are a
weak prefix, so their scope extends as far to the right as possible
while remaining consistent with the parentheses that are present.
This means that $\forall x.\, \bang A(x) \tensor B \lolli \bang C
\tensor D$ is interpreted as $\forall x.\, (((\bang A(x)) \tensor B)
\lolli ((\bang C) \tensor D))$.

\section{Example: Two Nickels}
\label{sec:two-nickels}

We transcribe:
\begin{quote}
  \textit{If I had a nickel for every time I had a nickel, I would have two nickels.}
  --- Anonymous
\end{quote}
as the persistent
\[
\bang (\m{n} \lolli \m{n}) \lolli \m{n} \tensor \m{n}
\]
It should be clear that this statement is not particularly true.

\clearpage
\section{Example: Menu}

We go through the exercise of representing a fixed price menu, as
opposed ordering a la carte.  Here is the menu:
\[
\begin{tabular}{c}
\it Onion Soup or Mixed Salad \\[1em]
\it T-Bone Steak or Maine Lobster\\
\it (or both, for \$20 more) \\[1em]
\it Peas and Carrots, or Fennel (according to season) \\[1em]
\it Chocolate Cake (or \$5 off price) \\[1em]
\it Coffee (unlimited refills) with cream (optional) \\[1em]
\it \$50
\end{tabular}
\]
In linear logic:
\[
\begin{array}{lcl}
\$50 & \lolli & (\m{soup} \with \m{salad}) \\
& & \null \tensor (\m{steak} \with \m{lobster} \with (\$20 \lolli
\m{steak} \tensor \m{lobster})) \\
& & \null \tensor ((\m{peas} \tensor \m{carrot}) \oplus \m{fennel}) \\
& & \null \tensor (\m{cake} \with \$5) \\
& & \null \tensor \bang \m{coffee} \tensor (\m{cream} \with \one)
\end{array}
\]
We encourage you to study this carefully to understand the use of each
connective.

\clearpage
\phantomsection
\addcontentsline{toc}{section}{Exercises}
\section*{Exercises}

\begin{exercise}
  \label{exc:tensor-fail}
  Does cut reduction fail for the incorrect ${\tensor}L_1??$ and
  ${\tensor}L_2??$ rules?  Either show the reduction or explain
  informally why it fails.
\end{exercise}

\begin{exercise}
  \label{exc:harmony-fail}
  Explain the consequence of replacing the two left rules
  for alternative conjunction with
  \[
  \infer[{\with}L??]
    {\Delta, A \with B \seq C}
    {\Delta, A, B \seq C}
  \]
  Do identity expansion and cut reduction still hold?  Exhibit a
  derived rule of inference that illustrates the dire consequence of
  this incorrect rule.
\end{exercise}

\begin{exercise}\rm
  \label{exc:equiv}
  We have explained logical equivalence between $A$ and $B$ as $A
  \vdash B$ and $B \vdash A$.  Internalize logical equivalence as a
  connective $A \bilolli B$ in linear logic and show identity
  expansion as well as local reductions.  Briefly discuss alternative
  formulations (if there any) and explain why you chose yours.
\end{exercise}

% \begin{exercise}\rm
%   Stronger notion of equivalence: isomorphism?
% \end{exercise}

\begin{exercise}\rm
  Show that $A \with \top$ is equivalent to $A$.
\end{exercise}

\begin{exercise}\rm
  \label{exc:disj-harmony}
  Show the identity expansion and cut reductions for disjunction $A
  \oplus B$.
\end{exercise}

\begin{exercise}\rm
  \label{exc:zero-harmony}
  Show the identity expansion and cut reductions for the nullary
  disjunction $\zero$.
\end{exercise}

\begin{exercise}\rm
  Show that $A \oplus \zero$ is equivalent to $A$.
\end{exercise}

\begin{exercise}\rm
  With which additional resources can we prove the saying:
  ``\textit{If I had a nickel for every time I had a nickel,
    I would have two nickels.}'' from \autoref{sec:two-nickels}?
\end{exercise}

\begin{exercise}\rm
  \label{exc:laws-mult}
  We can generally examine the interaction of the different
  connectives with each other to develop some logical equivalences.
  When they exist, they generally take the form of associativity or
  distributivity, where (iii) below is a somewhat special case,
  swapping a connective while reassociating.  For example, here are
  some laws connecting $\tensor$ and $\lolli$ with themselves and each
  other.
  \begin{enumerate}
  \item[(i)] $(A \tensor B) \tensor C \lequiv A \tensor (B \tensor C)$
  \item[(ii)] $(A \lolli B) \lolli C$ do not interact.
  \item[(iii)] $A \lolli (B \lolli C) \lequiv (A \tensor B) \lolli C$
  \item[(iv)] $A \lolli (B \tensor C)$ do not interact.
  \end{enumerate}
  Prove (i) and (iii).  We do not yet have the tools to prove
  (ii) and (iv).
\end{exercise}

\begin{exercise}\rm
  \label{exc:laws-add}
  Examine if interaction equivalences like the ones in
  Exercise~\ref{exc:laws-mult} hold in the following cases.  Write
  out and prove those that hold, thereby implicitly conjecturing
  that their are no interaction for the remaining connectives.
  \begin{enumerate}
  \item[(i)] $(A \with B) \lolli C$ and $A \lolli (B \with C)$
  \item[(ii)] $(A \with B) \tensor C$
  \item[(iii)] $(A \with B) \oplus C$
  \item[(iv)] $(A \tensor B) \with C$
  \item[(v)] $(A \tensor B) \oplus C$
  \item[(vi)] $(A \oplus B) \tensor C$
  \item[(vii)] $(A \oplus B) \with C$
  \item[(viii)] $(A \oplus B) \lolli C$ and $A \lolli (B \oplus C)$
 \end{enumerate}
\end{exercise}

\begin{exercise}\rm
  \label{exc:laws-units}
  The multiplicative and additive units satisfy the following
  interaction properties.
  \begin{enumerate}
  \item[(i)] $A \tensor \one \lequiv A$
  \item[(ii)] $A \with \top \lequiv A$
  \item[(iii)] $A \oplus \zero \lequiv A$
  \end{enumerate}
  Examine interactions of the units with other connectives of linear
  logic and write down those equivalences that hold.
\end{exercise}

\begin{exercise}\rm
  \label{exc:laws-exp}
  Investigate which equivalence laws hold for the interaction of
  $\bang$ with all connectives and units, including itself.  You do
  not need to prove if there is no interaction, but give proofs of the
  equivalence where there is one.
\end{exercise}

\clearpage
\phantomsection
\addcontentsline{toc}{section}{References}
\bibliographystyle{alpha}
\bibliography{fp,lfs}

% \cleardoublepage
\end{document}
