\section{Understanding ``Out Of Thin Air'' using Temporal Logic}
\label{sec:logic}

A significant challenge for a software memory model is to relax order enough
to allow efficient implementation without admitting anomalous
behaviors---called \emph{out of thin air} (\oota) in the literature
\cite{vacuous,DBLP:conf/esop/BattyMNPS15,BoehmOOTA}.  The most famous example
is \ref{OOTA3} from \textsection\ref{sec:intro}.  Here we inline
initialization in order to fit the format of our proof rules:
\begin{align}
  \label{OOTA3} \tag{\textsc{oota1}}
  \PW{y}{0}\SEMI
  \PW{y}{x}
  \!\PAR\!
  \PW{x}{0}\SEMI
  \PR{y}{r}\SEMI \PW{x}{r}
  &&
  \smash{\hbox{\begin{tikzinline}[node distance=1.2em]
        \event{rx}{\DR{x}{1}}{}
        \event{wy}{\DW{y}{1}}{right=of rx}
        \po{rx}{wy}
        \event{y0}{\DW{y}{0}}{left=of rx}
        \event{x0}{\DW{x}{0}}{right=2em of wy}
        \event{ry}{\DR{y}{1}}{right=2em of x0}
        \event{wx}{\DW{x}{1}}{right=of ry}
        \po{ry}{wx}
        \rf[out=10,in=170]{wy}{ry}
        \rf[out=170,in=10]{wx}{rx}
        \wk[out=-15,in=-165]{y0}{wy}
        \wk[out=-15,in=-165]{x0}{wx}
      \end{tikzinline}}}
\end{align}
Although Java does not allow \oota{} behaviors of \ref{OOTA3},
\citet{DBLP:journals/toplas/Lochbihler13} showed that it does allow \oota\
behaviors of \ref{OOTA1}, also from \textsection\ref{sec:intro}.  In
\cite{DBLP:conf/lics/JeffreyR16}, we described a logic that rules out
\ref{OOTA3} but not \ref{OOTA1} or its variant \ref{OOTA4}.  In this section,
we provide a more accurate test of \oota{} behaviors by enhancing our
previous logic with temporal features.

On first read, we suggest that readers skip to the examples and the
discussion that follows, coming back to the definitions as necessary.
Example~\ref{ex:thin} discusses the canonical \oota{} example \ref{OOTA3};
the analysis is trivial and well-known \cite{DBLP:conf/lics/JeffreyR16,
  DBLP:conf/popl/KangHLVD17}.  Example~\ref{ex:lochb} is more interesting.
There, we discuss \ref{OOTA4}, which is a variant of
\citeauthor{DBLP:journals/toplas/Lochbihler13}'s \ref{OOTA1}.

The logic given here is not meant to be definitive; in
\textsection\ref{sec:limits}, we discuss \oota{} examples that appear to
require non-trivial extensions
\cite{DBLP:conf/esop/SvendsenPDLV18,DBLP:journals/pacmpl/ChakrabortyV19}.

\noparagraph{Definitions}
We adapt past linear temporal logic (\pLTL)
\cite{Lichtenstein:1985:GP:648065.747612} to pomsets by dropping the previous
instant operator and adopting strict versions of the temporal operators.
The atoms of our logic are write and read events.
Given a pomset $\aPS$ and event $\aEv$, define:\nofootnote{Let $\FALSE$, $\lor$,
  $\Rightarrow$ and $\once$ as usual;
  for example,
  $\once\afo = \lnot(\always\lnot\afo)$.}
\begin{displaymath}
  \renewcommand{\arraycolsep}{.2ex}
  \begin{array}{lrll}
    \aPS,\aEv &\models& \DW{\aLoc}{\aVal} &\text{ if } \labelingAct(\aEv) = \DW{\aLoc}{\aVal} \text{ and } \TRUE \text{ implies } \labelingForm(\aEv) \\
    \aPS,\aEv &\models& \DR{\aLoc}{\aVal} &\text{ if } \labelingAct(\aEv) = \DR{\aLoc}{\aVal} \text{ and } \TRUE \text{ implies } \labelingForm(\aEv) \\
    \aPS,\aEv &\models& \afo\land\bfo &\text{ if } \aPS,\aEv \models  \afo \text{ and } \aPS,\aEv \models  \bfo \\
    \aPS,\aEv &\models& \TRUE\\
    \aPS,\aEv &\models& \lnot\afo &\text{ if } \aPS,\aEv \not\models \afo \\
    \aPS,\aEv &\models& \always\afo &\text{ if } \forall \bEv \lt \aEv.\; \aPS,\bEv \models \afo\\
    \aPS,\aEv &\models& \once\afo &\text{ if } \exists \bEv \lt \aEv.\;  \aPS,\bEv \models \afo
  \end{array}
\end{displaymath}

Define $\FALSE$, $\lor$, and $\Rightarrow$ as usual.

Let $\aPS \models \afo$ if
$\aPS,\aEv \models\afo$, for all $\aEv \in \Event$.

Let $\aPSS\models \afo$
if $\aPS \models\afo$, for all $\aPS \in \aPSS$.

Let
\begin{math}
  \afo, \aPSS \models \bfo  \text{ if } \{ \aPS \mid \aPS \models \afo \} \parallel \aPSS \models \bfo.
\end{math}

Let $\afo$ be \emph{downclosed} when
$\{ \aPS \mid \aPS \models \afo \}$ is.

The past operators do not include the current instant, and so
do \emph{not} satisfy
$(\always\afo\Rightarrow\once\afo)$. The order-minimal elements always validate
$\always\afo$ and invalidate
$\once\afo$.
However, we can prove the following:
\begin{align*}
  \tag{Induction}
  \aPS \models& (\always\afo \Rightarrow\afo) \Rightarrow\afo
  \\[-1ex]
  \tag{Coinduction}
  \aPS \models& (\afo \Rightarrow\once{\afo}) \Rightarrow\lnot \afo
  \\[-1ex]
  \tag{Weakening}
  \aPS \models& (\afo \Rightarrow\once{\bfo}) \Rightarrow (\once\afo \Rightarrow\once{\bfo})
\end{align*}

We present two additional proof rules.
The first provides a logical view of \emph{$\aLoc$-closure} (Def.~\ref{def:rf}):
\begin{displaymath}
  \frac{
    \afo \text{ is independent of } \aLoc
    \qquad
    \aPS \models (\DR{\aLoc}{\aVal} \Rightarrow \once \DW{\aLoc}{\aVal}) \Rightarrow \afo
  }{
    \nu \aLoc \DOT \aPS \models \afo
  }
\end{displaymath}

The second rule describes concurrent composition, in the style of~\citet{Abadi:1993:CS:151646.151649}.  To simplify the presentation, we
consider the special case with a single invariant.

\begin{proposition}%[Composition]
  Let $\afo$ be downclosed.  Let $\aPSS_1, \aPSS_2$ be
  augmentation\hyp{}closed. %\footnote{$\aPS'$ is an augmentation of $\aPS$ if
  Then:
  \begin{displaymath}
    \frac{
      \afo, \aPSS_1 \models\afo
      \qquad
      \afo, \aPSS_2 \models\afo
    }{\aPSS_1 \parallel \aPSS_2 \models \afo}
  \end{displaymath}
\end{proposition}
\begin{proof}[Proof sketch]
  We will show that all downsets in the downset closures of
  $\aPSS_1 \parallel \aPSS_2$ satisfy the required property.  Proof proceeds
  by induction on downsets of $\aPS \in \aPSS_1 \parallel \aPSS_2$.
  The case for empty downset  follows from assumption that  $\afo$ is downset closed.
  For the inductive case, consider %$\aPS$ in the downset closure of $\aPSS_1 \parallel \aPSS_2$, i.e.
  $\aPS \in \aPS_1 \parallel \aPS_2$ where
  $\aPS_i \in \aPSS_i$.  Since $\aPSS_1$ and $\aPSS_2$ are augmentation
  closed, we can assume that the restriction of $\aPS$ to the events of
  $\aPS_i$ coincides with $\aPS_i$, for $i=1,2$.
  Consider a downset $\aPS'$ derived by removing a maximal element $\aEv$ from
  $\aPS$.  Suppose $\aEv$ comes from $\aPS_1$ (the other case is
  symmetric). Since $\aPS_2$ is a downset of $\aPS'$ and $\aPS' \models \afo$
  by induction hypothesis, we deduce that $\aPS_2 \models \afo$.
  Since $\aPS_1 \in \aPSS_1$, by assumption $\afo, \aPSS_1 \models\afo$ we
  deduce that $\aPS \models \afo$.
\end{proof}

\begin{example}
  \label{ex:thin}
  \noparagraph{Basic Examples}
  With all variables initialized to $0$, we show that \ref{OOTA3}
  satisfies
  \begin{math}
    \lnot\DW{x}{1}.
  \end{math}

  We start with the invariant:
  \begin{displaymath}
    [\DW{x}{1}\Rightarrow\once\DR{y}{1}]
    \land
    [\DW{y}{1}\Rightarrow\once\DR{x}{1}]
  \end{displaymath}
  This invariant holds for each thread; thus, it holds for the
  aggregate program by composition.  Closing $y$ yields
  \begin{math}
    \DR{y}{1} \Rightarrow \once\DW{y}{1}.
  \end{math}
  Weakening the right conjunct: % yields
  \begin{math}
    \once\DW{y}{1}\Rightarrow\once\DR{x}{1}.
  \end{math}
  Chaining these together: %yields
  \begin{math}
    \DR{y}{1} \Rightarrow \once\DR{x}{1}.
  \end{math}
  Weakening:  %yields
  \begin{math}
    \once\DR{y}{1} \allowbreak\Rightarrow \once\DR{x}{1}.
  \end{math}
  Chaining into the left conjunct:  %yields
  \begin{math}
    \DW{x}{1} \Rightarrow \once\DR{x}{1}.
  \end{math}
  Closing $x$,
  weakening,
  then chaining: %, yields
  \begin{math}
    \DW{x}{1} \Rightarrow \once\DW{x}{1}.
  \end{math}
  By coinduction,
  \begin{math}
    \lnot\DW{x}{1}.
  \end{math}
\end{example}

\begin{example}
  \label{ex:lochb}
  \noparagraph{Lochbihler's Example} %The essential temporal property of
  Because our language lacks object creation, we cannot consider
  \citeauthor{DBLP:journals/toplas/Lochbihler13}'s example (\ref{OOTA1}) directly.  Instead we study \ref{OOTA4}, which has the same
  temporal structure.
  The essential temporal property of
  \ref{OOTA4} is: \emph{A write of $1$ to $y$ must be preceded by a read of
    $1$ from $x$, and if $1$ is written to $z$ then a write of $1$ to $x$
    must be preceded by a read of $1$ from $y$.}
  We show an attempted execution that violates this invariant, eliding
  initialization:
  \begin{gather}
    \label{OOTA4}\tag{\textsc{oota4}}
    \begin{gathered}
      \PW{y}{x}
      \PAR
      \PR{y}{r} \SEMI \IF{b}\THEN  \PW{x}{r} \SEMI \PW{z}{r} \ELSE \PW{x}{1} \FI
      \PAR
      \PW{b}{1}
      \\[-1ex]
      \hbox{\begin{tikzinline}[node distance=1.5em]
          \event{rx}{\DR{x}{1}}{}
          \event{wy}{\DW{y}{1}}{right=of rx}
          \po{rx}{wy}
          \event{ry}{\DR{y}{1}}{right=3em of wy}
          \event{wx}{\DW{x}{1}}{right=of ry}
          \event{wz}{\DW{z}{1}}{right=of wx}
          \event{rb}{\DR{b}{1}}{right=of wz}
          \event{wb1}{\DW{b}{1}}{right=3em of rb}
          \po{ry}{wx}
          \rf{wb1}{rb}
          \rf{wy}{ry}
          \rf[out=-170,in=-10]{wx}{rx}
          \po{rb}{wz}
          \po[out=15,in=165]{ry}{wz}
        \end{tikzinline}}
    \end{gathered}
  \end{gather}
  As we discussed in \textsection\ref{sec:pop} there is a dependency from
  $(\DR{y}{1})$ to $(\DW{x}{1})$; thus, the outcome is disallowed.  This
  outcome is also disallowed by our event structures model
  \citep[\textsection9]{DBLP:journals/lmcs/JeffreyR19}, although the logic
  given in that paper is insufficient to establish this fact.  The outcome is
  \emph{allowed} by \citet{Manson:2005:JMM:1047659.1040336}, \citet{DBLP:conf/esop/JagadeesanPR10},
  \citet{DBLP:conf/popl/KangHLVD17}, and
  \citet{DBLP:journals/pacmpl/ChakrabortyV19}.

  To establish that this outcome is disallowed here, we prove
  \begin{math}
    \lnot\DW{z}{1},
  \end{math}
  starting with invariant:
  \begin{align*}
    [\once\DW{y}{1} \Rightarrow \once\DR{x}{1}]
    \land
    [\notonce\DW{z}{1} \Rightarrow (\once\DR{y}{1} \land \always(\DW{x}{1} \Rightarrow \once\DR{y}{1}))]
  \end{align*}
  Closing $y$ and chaining into the left conjunct:
  \begin{math}
    \once\DR{y}{1} \Rightarrow \once\DR{x}{1}.
  \end{math}
  Chaining into the right conjunct:
  \begin{displaymath}
    \notonce\DW{z}{1} \Rightarrow (\once\DR{x}{1} \land \always(\DW{x}{1} \Rightarrow \once\DR{x}{1}))
  \end{displaymath}
  Closing $x$:
  \begin{math}
    \notonce\DW{z}{1} \Rightarrow (\once\DW{x}{1} \land \always(\DW{x}{1} \Rightarrow \once\DW{x}{1}).
  \end{math}
  Applying coinduction to the right conjunct:
  \begin{displaymath}
    \notonce\DW{z}{1} \Rightarrow (\once\DW{x}{1} \land \always(\lnot \DW{x}{1}))
  \end{displaymath}
  Simplifying:
  \begin{math}
    \notonce\DW{z}{1} \Rightarrow \FALSE,
  \end{math}
  as required.
\end{example}

\noparagraph{RFUB: Register assignment From an Unexecuted Branch}
Many examples are superficially similar, but in fact have fewer dependencies,
such as \eqref{OOTA?} in \textsection\ref{sec:intro}.
\citeauthor{BoehmOOTA}'s [\citeyear{BoehmOOTA}] \ref{RFUB} example presents
another potential form of \oota{} behavior.
Our analysis shows that there is no \oota{} behavior in
\ref{RFUB}, only a false dependency:
\begin{gather*}
  \tag{\textsc{rfub}}\label{RFUB}
  \sem{\PR{y}{r}\SEMI \PW{x}{r}}
  \not\supseteq
  \sem{\PR{y}{r}\SEMI \IF{r \NOTEQ 1} \THEN \PW{z}{1}\SEMI \LET{r}{1}\FI \SEMI \PW{x}{r}}
\end{gather*}
The left command is half of \ref{OOTA3}. %, from \textsection\ref{sec:logic}.
The right command is dubbed \rfub{}, for \emph{Register assignment From an
  Unexecuted Branch}.  \citeauthor{BoehmOOTA} observes that in the context
$\PW{x}{y} \PAR \hole{}$, these programs have different behaviors.  Yet the
\oota{} example on the left never writes $1$.  Why should the unexecuted
branch change that?  Because of the conditional, the write to $x$ in
\ref{RFUB} is independent of the read from $y$.  It useful to considering the
Hoare logic formulas satisfied by the two threads above: we have
$\hoare{\TRUE}{\ref{RFUB}}{x=1}$ for the right thread of \ref{RFUB}, but not
$\hoare{\TRUE}{\ref{OOTA3}}{x=1}$ for the right thread of \ref{OOTA3}.  The
change in the thread from \ref{OOTA3} to \ref{RFUB} is not a valid refinement
under Hoare logic; thus, it is expected that \ref{RFUB} may have additional
behaviors.

Understanding \oota{} behavior is notoriously difficult, even for the
greatest minds in the field!  % We believe that \emph{logic} is the only tool
This example shows the wisdom of using existing tools, such as preconditions
and Hoare logic, to model new problems, such as relaxed memory.

\begin{comment}
  \color{red} Need to sort this out.
  Alan proposes:
\begin{verbatim}
     (W y 2) => <>(R x 1)
     (W y 1) => <>(R x 0)
     (W x 1) => <>(R y 1)
   <>(W x 1) => not(<>(W x 2))  --- which should be???  <>(W x 0) => not(<>(W x 1))
\end{verbatim}

  2020/09/30: This seems to go bad because of initialization...
  The formula
\begin{verbatim}
<>Wx0 => not(<>Wx1)
\end{verbatim}
  does not hold for
\begin{verbatim}
x=0; x=y
\end{verbatim}

  2020/09/10:  I am worried about the compositionality of this predicate:
\begin{verbatim}
I think
   <>(W x 0 => not(<>(W x 1)))
holds for
   x=0; r=y
and
   x=1
but not
   x=0; r=y || x=1
as shown by the execution
   Wx1 < Wx0 < Ry0
\end{verbatim}

  It is impossible to fulfill $(\DR{y}{1})$ in the following
  \cite[RNG]{DBLP:conf/esop/SvendsenPDLV18}:
  \begin{align*}
    \taglabel{OOTA5}
    ( \PW{y}{x{+}1}
    \PAR
    \PW{x}{y} ) && \hbox{\begin{tikzinline}[node distance=1.5em]
        \event{rx}{\DR{x}{1}}{}
        \event{wy}{\DW{y}{2}}{right=of rx}
        \po{rx}{wy}
        \event{ry}{\DR{y}{1}}{right=3em of wy}
        \event{wx}{\DW{x}{1}}{right=of ry}
        \po{ry}{wx}
        \rf[out=170,in=10]{wx}{rx}
      \end{tikzinline}}
  \end{align*}
  The proof proceeds as before, starting with the following invariant:
  \begin{gather*}
    [\DW{y}{2} \Rightarrow \once\DR{x}{1}] \land
    [\once\DW{x}{1} \Rightarrow \once\DR{y}{1}] \land
    [\once\DW{y}{1} \Rightarrow \once\DR{x}{0}] \land
    [\once\DW{x}{0} \Rightarrow \lnot(\once\DW{x}{1})]
  \end{gather*}
\begin{verbatim}
  Wy2 => <>Rx1  /\  <>Wx1 => <>Ry1  /\  <>Wy1 => <>Rx0
close x and y
  Wy2 => <>Wx1  /\  <>Wx1 => <>Wy1  /\  <>Wy1 => <>Wx0
chain
  Wy1 => <>Wx0
chain with <>Wx0 => not(<>Wx1)
\end{verbatim}
\end{comment}


\documentclass[11pt,fleqn]{amsart}
\usepackage{graphicx,amsmath,amssymb,a4wide}
\usepackage[numbers,sort&compress]{natbib}
\usepackage[hang]{subfigure}

\renewcommand{\div}{\ensuremath{\operatorname{div}}}
\newcommand{\vect}[1]{\boldsymbol{#1}}
\newcommand{\mat}[1]{\boldsymbol{#1}}
\newcommand{\tens}[1]{\boldsymbol{\mathsf{#1}}}
\newcommand{\transp}[1]{{#1}^{\ensuremath{\mathsf{T}}}}

\newtheorem{remark}{Remark}

\begin{document}

\title[Local flux mimetic in Matlab]{Implementation of local flux mimetic in Matlab}%
\author[J.~R.~Natvig]{Jostein R. Natvig}%
\address{SINTEF ICT, Applied Mathematics, P.O.~Box 124 Blindern, N--0314 Oslo, Norway}
\email[]{\{Jostein.R.Natvig\}@sintef.no}

%\begin{abstract}
%\end{abstract}

\maketitle

\section{Introduction}
The implementation of the local flux mimetic method in MRST
\citep{MRST} is straightforward.  The most computationally demanding
step is the inversion of the mixed mass matrix which has much higer
diimension than the regular mixed or hybrid mass matrix.  From an
implementation poit of view, the construction of a numbering of the
sub-faces with corresponding mappings to nodes, faces and cells is the
most complex.  Furthermore, the choosing to use this scheme as either
a mimetic method or a multi-point flux scheme puts certain limitations
on its use. In the former case, the scheme is quite coumputationally
demanding to assemble, store and handle, while in the latter case, the
inclusion of gravity and forcings (bc, wells, src) is not solved
(yet).

\section{Reducing mixed hybrid system to cell pressure system}
Consider the elliptic equation for pressure,
\begin{align}
  \label{eq:pressure}
  \vect{v} + \mat{K}\nabla p  &=  0,\\
  \nabla\cdot\vect{v}        &= q,
\end{align}
where $\mat{K}$ is the permeability tensor, $p$ is the fluid pressure
and $\vect{v}$ is the fluid velocity.  To discretise
\eqref{eq:pressure} using a local-flux mimetic method, we start by
decribing the mass matrix $\mat{B}$.  If $\mat{B}$ is exact for linear
pressures, we can expect to get a consistent discretisation of
\eqref{eq:pressure}.  Thus, for any linear pressure $p = p_o +
\vect{c}\cdot\vect{x}$, we get the relation
\begin{equation}
  \label{ep:exactlinear}
  \mat{N}\vect{c} = -\mat{K}\transp{\mat{R}}\vect{c},
\end{equation}
where $\mat{N}$ is the $n\times d$ matrix of face normals and
$\mat{R}$ is the corresponding matrix of vectors from the cell centre,
where the cell pressure is computed, to the face centres, where the
face pressures are computed.  To get a local expression for the face
flux, we make the following choices: We split each $k$-gonal face into
$k$ sub-faces, each with one corner belonging to the face.  For each
sub-face of face $i$ , we use $\mat{N}_i$ and $\mat{R}_i$ as normal
and distance. Then, we require that $\mat{B}$ be block-diagonal with
one block for each corner in the cell.  For a regular grid, each such
corner will be the intersection of $d$ sub-faces, and the
corresponding block in \eqref{eq:exactlinear} will be unique.  Note
that this matrix is not symmetric, and $\langle\vect{F},\vect{G}\rangle =
\transp{\vect{F}}\mat{B}\vect{G}$ is not an inner-product but a
bilinear form on sub-face-fluxes.

To derive a cell-centered scheme from the definition of $\mat{B}$, we
start with the usual mimetic mixed hybrid formulation
\begin{equation}
  \label{eq:hybLinSys}
   \begin{bmatrix}
     \mat{B} & \mat{C} & \mat{D}\\
     \transp{\mat{C}}  & \mat{0} & \mat{0}\\
     \transp{\mat{D}} &  \mat{0} & \mat{0}
   \end{bmatrix}
   \begin{bmatrix}
     \vect{v_H}\\ -\vect{p}\\ \vect{\pi}
   \end{bmatrix}
   =
   \begin{bmatrix}
     \vect{0} \\ \vect{q}\\ \vect{0}
   \end{bmatrix}
\end{equation}
where $\mat{C}$ is block-diagonal with blocks $\vect{e} = (1,1,\ldots,
1)$, that adds up sub-faces, and $\mat{D}$ maps from cell-wise
ordering to global ordering of sub-faces. We introduce $\mat{D_o}$
that maps hybrid velocities to mixed velocities
\begin{equation}
\label {eq:hybrid2mixed}
\vect{v_h} = \mat{D_o}\vect{v_m}.
\end{equation}
Left-multiplying the first equation in \eqref{eq:hybLinSys} by
$\transp{\mat{D_o}}$, substituting \eqref{eq:hybrid2mixed}, we get
\begin{align*}
  &\transp{\mat{D_o}}\mat{B}\mat{D_o}\vect{v_m} -
  \transp{\mat{D_o}}\mat{C}\vect{p} +
  \transp {\mat{D_o}}\vect{\pi}=\vect{0}\\
  &\mat{C}\mat{D_o}\vect{v_m} = \vect{q}.
\end{align*}
If we can invert $\transp{\mat{D_m}}\mat{B}\mat{D_m}$, the resulting
linear system for cell pressures is
%\begin{equation*}
%  \transp{\mat{C}}\mat{D_m}[\transp{\mat{D_m}}\mat{B}\mat{D_m}]^{-1}
%         [\transp{\mat{D_m}}\mat{C}\vect{p}-\transp{\mat{D_m}}\mat{D}\vect{\pi}] = q,
%\end{equation*}
%that reduce to
\begin{equation}
  \transp{\mat{C}}\mat{D_o}[\transp{\mat{D_o}}\mat{B}\mat{D_o}]^{-1}
         [\transp{\mat{D_o}}\mat{C}\vect{p}-\vect{\pi_b}] = q
\end{equation}
where the boundary pressures $\vect{\pi_b}$ are the only nonzero
entries of $\transp{\mat{D_o}}\mat{D}\vect{\pi}$.  To get an
expression for the flux interms of cell-pressures, we introduce
$\mat{C} = \mat{C_2}\mat{C_1}$, where $\mat{C_1}$ is block-diagonal
with as many rows as faces in the grid, and as many columns as
sub-faces in the grid.  $\mat{C}_1\vect{v_H}$ adds the sub-face-fluxes
of each face.  The other matrix $\mat{C}_2$ is the standard mimetic
$\mat{C}$-matrix.  We can then write
\begin{equation*}
  \vect{v} = \transp{\mat{C}_1}\mat{D_o}[\transp{\mat{D_o}}\mat{B}\mat{D_o}]^{-1}
             [\transp{\mat{D_o}}\mat{C}\vect{p}-\vect{\pi_b}]
\end{equation*}
and
\begin{equation*}
  \mat{T} = \transp{\mat{C}_1}\mat{D_o}[\transp{\mat{D_o}}\mat{B}\mat{D_o}]^{-1}
             \begin{bmatrix}\transp{\mat{D_o}}\mat{C}\\-\mat{I}_b\end{bmatrix}
\end{equation*}

\section{Local flux mimetic}
The crucial point in the previous section is the inversion of the
mixed mass matrix $\transp{\mat{D_m}}\mat{B}\mat{D_m}$.  The
construction of the local flux mimetic is based on two ideas that
allow a cheap inversion of this matrix.  First, the number of degrees
of freedom in the face pressures $\vect{\pi}$ and half-face velocities
$\vect{v_h}$ is increased to one pressure and velocity per face per
node. Thus, for a face with $n$ corners, there are $n$ facet pressures
and velocities , one for each facet containing exactly one face
corner.

Second, the mass matrix $\mat{B}$ defining the innerproduct between
discrete facet fluxes chosen to be block-diagonal with one $d$ x $d$
block per node in the cell.  This inner product is uniqly defined if
$d$ facets with linearly independent normals meet in each cell-node.

Inversion of the mixed mass matrix
$\transp{\mat{D_m}}\mat{B}\mat{D_m}$ amounts to inverting the diagonal
blocks corresponding to each node in the grid.  Note that this
corresponds exactly to the simplest multi-point flux approximation
called the O-method [].  However, this derivation yields a simpler
starting point for implementation on general grids.

To get a multi-point flux transmissibility $\mat{T}$, the
contributions from each facet must be added for each face in the grid.

{\bf How much does it matter if facet centriods are inaccurate?}

\bibliographystyle{abbrvnat}
\bibliography{misc}

\end{document}

%{
Copyright 2009-2018 SINTEF ICT, Applied Mathematics.

This file is part of The MATLAB Reservoir Simulation Toolbox (MRST).

MRST is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

MRST is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with MRST.  If not, see <http://www.gnu.org/licenses/>.
%}


\documentclass{article}

% a bunch of useful packages.
\usepackage[inference]{semantic}
\usepackage{amsmath} \allowdisplaybreaks % lets align equations break over pages.
\usepackage{hyperref}
\usepackage[amsmath,hyperref,amsthm]{ntheorem}
\usepackage{thmtools}
\usepackage[capitalize]{cleveref}
\usepackage{mathpartir}
\usepackage{stmaryrd}
\usepackage{amssymb}
\usepackage{latexsym}
\usepackage{color}
\usepackage[usenames,dvipsnames]{xcolor} % the best way to colour text
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{tikz} \usetikzlibrary{positioning,shadows,arrows,calc,backgrounds,fit,shapes,snakes,shapes.multipart,decorations.pathreplacing,shapes.misc,patterns}
\usepackage{xspace}
\usepackage{scalerel}
\usepackage{bm} %bold math. a mess to use.
\usepackage{bussproofs} % for logic-style proofs

\hypersetup{ pdfpagemode=UseOutlines, colorlinks=true, linkcolor=red, citecolor=blue }

% organise your code.
\input{cmds}

\title{
	Typesetting $\lambda$-calculi with \LaTeX
}
\author{
	Marco Patrignani
}
\date{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%							DOCUMENT						  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\maketitle

This document contains a reference of the syntax and semantics for ULC and STLC.

Syntax highlighting is nice way to guide you in visually separating each language; please inform me whether they cause any distraught.

\begin{center}
	\Large
	Please read the latex comments too.
\end{center}
\tableofcontents

\newpage

\section{\ulc: Untyped Lambda Calculus}

\subsection{Syntax}
% all the stuff here is wrapped in \com{}, which is the macro i use to typeset stuff in italics, black.
% removing that macro won't change anything visually (though if later on you want to typeset all ULC in, say, red, it's easier this way)
% unless you want to typeset coloured stuff, do not care for \com{}, \src{} and \oth{} commands

% \mid are vertical separators
% the align* environment will align on &, which are put after the ::=, with an extra \ for space
\begin{align*}
	\com{t} \bnfdef&\
		\com{n} \mid \com{\lam{x}{t}} \mid \com{x} \mid \com{t\ t} \mid \com{t \op t} % the \ is a single space
	\\
	\com{v} \bnfdef&\
		\com{n} \mid \com{\lam{x}{t}}
	\\
	\com{\Omega} \bnfdef&\
		\com{t} \mid \com{\fail}
	\\
	\com{\evalctx} \bnfdef&\
		\com{\hole{\cdot}} \mid \com{\evalctx\ t} \mid \com{(\lam{x}{t})\ \evalctx} \mid \com{\evalctx \op t} \mid \com{n \op \evalctx}
\end{align*}
$\op$ ranges over $+, -, *$.

\subsection{Structural Operational Semantics}

\subsubsection{Small Step, Call by Value (SSV)}
\begin{align*}
	\com{\Omega\red\Omega}
	&&
	\text{ judgement }
\end{align*}
Reductions.
% inference rules are best put centered, with this environment
\begin{center}
	% this command is for generic inference rules.
	% the 4th parameter is the label, which gets referred as    tr:ssv-beta    in the first case, i.e., always add a   tr:   to what is between brackets
	\typerule{SSV-Beta}{}{
		\com{(\lam{x}{t})~v \red t\subst{v}{x}}
	}{ssv-beta}
	\typerule{SSV-Op}{}{
		\com{n\op n' \red n\llbracket\op\rrbracket n'} 	% llbracket rrbracket should be made into a command. try it.
	}{ssv-op}
	\typerule{SSV-App1}{
		\com{t_1\red t_1'}
	}{
		\com{t_1\ t_2 \red t_1' t_2}
	}{ssv-app1}
	\typerule{SSV-App2}{
		\com{t_2\red t_2'}
	}{
		\com{(\lam{x}{t})\ t_2 \red (\lam{x}{t})\ t_2'}
	}{ssv-app2}
	\typerule{SSV-Op1}{
		\com{t_1\red t_1'}
	}{
		\com{t_1\op t_2 \red t_1'\op t_2}
	}{ssv-op1}
	\typerule{SSV-Op2}{
		\com{t_2\red t_2'}
	}{
		\com{n\op t_2 \red n\op t_2'}
	}{ssv-op2}
\end{center}
Fail reductions.
\begin{center}
	\typerule{SSV-Op-fail-l}{}{
		\com{(\lam{x}{t})\op t \red\fail}
	}{ssv-f-opl}
	\typerule{SSV-Op-fail-r}{}{
		\com{n\ \op(\lam{x}{t}) \red\fail}
	}{ssv-f-opr}
	\typerule{SSV-App-fail-fun}{}{
		\com{n\ t\red\fail}
	}{ssv-f-fun}
	\typerule{SSV-App-fail-arg}{
		\com{t_2\red\fail}
	}{
		\com{(\lam{x}{t})\ t_2\red\fail}
	}{ssv-f-arg}
	\typerule{SSV-App-fail-1}{
		\com{t_1\red\fail}
	}{
		\com{t_1\ t_2\red\fail}
	}{ssv-f-app}
	\typerule{SSV-Op-fail-1}{
		\com{t_1\red\fail}
	}{
		\com{t_1\op t_2\red\fail}
	}{ssv-f-op1}
	\typerule{SSV-Op-fail-2}{
		\com{t_2\red\fail}
	}{
		\com{n\op t_2\red\fail}
	}{ssv-f-op2}
\end{center}

\subsubsection{Small Step, Call by Name (SSN)}
Remove \Cref{tr:ssv-app2} and replace \Cref{tr:ssv-beta} with:
\begin{center}
	\typerule{SSN-Beta}{}{
		\com{(\lam{x}{t})~t' \red t\subst{t'}{x}}
	}{ssn-beta}
\end{center}

\subsubsection{Big Step, Call by Value (SBV)}
\begin{align*}
	\com{\Omega\bigs\Omega}
	&&
	\text{ judgement }
\end{align*}
Reductions.
Reductions for failing are omitted.
\begin{center}
	\typerule{SBV-val}{}{
		\com{v \bigs v}
	}{sbv-val}
	\typerule{SBV-op}{
		\com{t \bigs n }
		&
		\com{t' \bigs n'}
	}{
		\com{t \op t' \bigs n \llbracket \op \rrbracket n'}
	}{sbv-op}
	\typerule{SBV-app}{
		\com{t \bigs \lam{x}{t''}}
		&
		\com{t' \bigs v}
		&
		\com{t''\subst{v}{x} \bigs v'}
	}{
		\com{t\ t' \bigs v'}
	}{sbv-app}
\end{center}

\subsection{Contextual Operational Semantics, Call by Value (CSV)}
\begin{align*}
	\com{\Omega\cred\Omega}
	&&
	\text{ judgement }
	\\
	\com{\Omega\credp\Omega}
	&&
	\text{ judgement }
\end{align*}
Reductions.
Reductions for failing are omitted.
\begin{center}
	\typerule{CSV-ctx}{
		\com{t \credp t'}
	}{
		\com{\evalctx\hole{t} \cred \evalctx\hole{t'}}
	}{csv-ctx}
\end{center}
Plus \Cref{tr:ssv-beta,tr:ssv-op}, changing $\red$ with $\credp$.

\section{\stlc: Simply-Typed Lambda Calculus}
\subsection{Syntax}
No changes save for program state.
\begin{align*}
	\src{\Omega} \bnfdef&\
		\src{t}
	\\
	\src{\Gamma} \bnfdef&\
		\srce \mid \src{\Gamma},(\src{x:\tau})
	\\
	\src{\tau} \bnfdef&\
		\src{N} \mid \src{\tau\to\tau}
\end{align*}

\subsection{Static Semantics}
\begin{align*}
	\src{\Gamma}\vdash\src{t}:\src{\tau}
	&&
	\text{ judgement }
\end{align*}
Reductions.
\begin{center}
	\typerule{Type-var}{
		\src{x:\tau}\in\src{\Gamma}
	}{
		\src{\Gamma}\vdash\src{x}:\src{\tau}
	}{t-stlc-var}
	\typerule{Type-lam}{
		\src{\Gamma},\src{x:\tau}\vdash\src{t}:\src{\tau'}
	}{
		\src{\Gamma}\vdash\src{\lam{x:\tau}{t}}:\src{\tau\to\tau'}
	}{t-stlc-lam}
	\typerule{Type-num}{
	}{
		\src{\Gamma}\vdash\src{n}:\src{N}
	}{t-stlc-num}
	\typerule{Type-app}{
		\src{\Gamma}\vdash\src{t}:\src{\tau'\to\tau}
		&
		\src{\Gamma}\vdash\src{t'}:\src{\tau'}
	}{
		\src{\Gamma}\vdash\src{t\ t'}:\src{\tau}
	}{t-stlc-app}
	\typerule{Type-op}{
		\src{\Gamma}\vdash\src{t}:\src{N}
		&
		\src{\Gamma}\vdash\src{t'}:\src{N}
	}{
		\src{\Gamma}\vdash\src{t\ t'}:\src{N}
	}{t-stlc-op}
\end{center}

\subsection{Contextual Operational Semantics, Call by Value (CSV)}
No changes, repeated for clarity.
\begin{align*}
	\src{\Omega\cred\Omega}
	&&
	\text{ judgement }
	\\
	\src{\Omega\credp\Omega}
	&&
	\text{ judgement }
\end{align*}
Reductions.
No reductions for failing.
\begin{center}
	\typerule{CSV-ctx}{
		\src{t \credp t'}
	}{
		\src{\evalctx\hole{t} \cred \evalctx\hole{t'}}
	}{csv-stlc-ctx}
	\typerule{CSV-Beta}{}{
		\src{(\lam{x}{t})~v \credp t\subs{v}{x}}
	}{ssv-stlc-beta}
	\typerule{CSV-Op}{}{
		\src{n\op n' \credp n\llbracket\op\rrbracket n'}
	}{ssv-srlc-op}
\end{center}

\end{document}


\documentclass[11pt, twoside]{article}
\usepackage{holtex}

\makeindex

\begin{document}

\input{HOLsm}

\tableofcontents
\cleardoublepage
\HOLpagestyle

% ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
\section{sm Theory}
\index{sm Theory@\textbf  {sm Theory}}
\begin{flushleft}
\textbf{Built:} \HOLsmDate \\[2pt]
\textbf{Parent Theories:} indexedLists, patternMatches
\end{flushleft}
% ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

\subsection{Datatypes}
\index{sm Theory@\textbf  {sm Theory}!Datatypes}
% .....................................

\HOLsmDatatypes

\subsection{Definitions}
\index{sm Theory@\textbf  {sm Theory}!Definitions}
% .....................................

\HOLsmDefinitions

\subsection{Theorems}
\index{sm Theory@\textbf  {sm Theory}!Theorems}
% .....................................

\HOLsmTheorems

\HOLindex

\end{document}


%!TEX root = ../../dissertation.tex

\section{Tables and Figures}

%
% Tables
%
\subsection{Tables}

  \begin{table}[H]
    \begin{tabular}{lll}
      \toprule
      \textbf{Parameter Name} & \textbf{Value} & \textbf{Source} \\
      \midrule
      $\beta$ & 0.98 & Standard \\
      $r$ & 0.04 & \\
      \midrule
      $T$ & 42 & Retirement at 60 \\
      \midrule
      $\tau, \lambda$ & 0.118, 1.07 & \cite{HeathcoteStoreslettenViolante2017} \\
      \midrule
      $\sigma^{HS, w}, \sigma^{CD, w}, \sigma^{CG, w}$ & $\sqrt{0.011}, \sqrt{0.011}, \sqrt{0.0099}$ & \cite{Guvenen2009}, \cite{CarrollSamwick1997} \\
      $\sigma^{HS, y}, \sigma^{CD, y}, \sigma^{CG, y}$ & $\sqrt{0.052}, \sqrt{0.052}, \sqrt{0.047}$ & \\
      \midrule
      $\phi_{HS}, \phi_{CD}, \phi_{CG}$ & 0.15, 0.15, 0.197 & \cite{HendricksLeukhina2017} \\
      $\mu, w_{\text{coll}}$ & 0.010, 3.55 & \\
      $\gamma_\text{min}, \gamma_1, \gamma_2$ & 0.47, 4.58, 2.10 & \\
      $\alpha_{am}$, $\alpha_{m,GPA}$ & 2.87, 1.2 & \\
      $\alpha_{kq}$, $\alpha_{mq}$, $\alpha_{mz}$, $\alpha_{qz}$ & 0.0, -0.04, 0.46, -0.12 & \\
      $\mu_q$, $\sigma_q$ & 0.53, 0.35 & \\
      $\mu_z$, $\sigma_z$ & 0.32, 0.55 & \\
      \bottomrule
    \end{tabular}
    \caption{Previous Knowledge Parameters}
    \label{table:pk}
  \end{table}

  \begin{table}[H]
    \begin{tabular}{lll}
      \toprule
      \textbf{Parameter Name} & \textbf{Value} & \textbf{Source} \\
      \midrule
      $\bar{\theta}^{HS}$, $\bar{\theta}^{CG}$ & 8.73, 5.06 & \cite{PSID} \\
      $\theta_1^{HS}$, $\theta_2^{HS}$, $\theta_3^{HS}$ & 0.066, -0.088, 0.002 & \\
      $\theta_1^{CG}$, $\theta_2^{CG}$, $\theta_3^{CG}$ & 0.324, -0.624, 0.039 & \\
      \midrule
      $\bar{T}_C$ & 6 & College features \\
      $n_c$ & 6 & \\
      $n_{\text{grad}}$ & 21 & \\
      $\underbar{d}$, $\underbar{D}$ & -0.5, -1.975 & \\
      \bottomrule
    \end{tabular}
    \caption{Externally Calibrated Parameters}
    \label{table:ec}
  \end{table}

  \begin{table}[H]
    \begin{tabular}{lll}
      \toprule
      \textbf{Parameter Name} & \textbf{Value} & \textbf{Target} \\
      \midrule
      $\delta_c$, $\delta_v$ & 0.62, 1.15 & Debt accumulation \\
      $U_{HS}$, $U_{CD}$, $U_{CG}$ & 0.0, -2.97, -6.81 & Enrollment \\
      $\alpha_{km}$, $\mu_k$, $\sigma_k$ & 0.55, 2.57, 3.94 & Fraction with debt \\
      $\pi_e$, $\pi_c$ & 0.30, 1.58 & Enrollment and dropout \\
      \bottomrule
    \end{tabular}
    \caption{Internally Calibrated Parameters}
    \label{table:ic}
  \end{table}

  \begin{table}[H]
    \begin{tabular}{lccll}
      \toprule
      \multicolumn{3}{c}{\textbf{Moment Descriptions}} & \textbf{Data} & \textbf{Model} \\
      \midrule
      \textbf{Name} & \textbf{Year} & \textbf{GPA Quartile} & & \\
      \midrule
      Time to degree & --- & --- & 4.45 & 4.73 \\
      Education Fraction (HS) & --- & --- & 0.52 & 0.53 \\
      Education Fraction (CD) & --- & --- & 0.23 & 0.21 \\
      Education Fraction (CG) & --- & --- & 0.25 & 0.26 \\
      \midrule
      Enrollment & --- & Quartile 1 & 0.22 & 0.18 \\
                 & --- & Quartile 2 & 0.35 & 0.35 \\
                 & --- & Quartile 3 & 0.55 & 0.55 \\
                 & --- & Quartile 4 & 0.81 & 0.81 \\
      \midrule
      Completion & --- & Quartile 1 & 0.02 & 0.03 \\
                 & --- & Quartile 2 & 0.08 & 0.13 \\
                 & --- & Quartile 3 & 0.28 & 0.30 \\
                 & --- & Quartile 4 & 0.60 & 0.60 \\
      \midrule
      College Earnings & --- & Quartile 1 & 0.65 & 0.85 \\
                       & --- & Quartile 2 & 0.58 & 0.70 \\
                       & --- & Quartile 3 & 0.54 & 0.59 \\
                       & --- & Quartile 4 & 0.51 & 0.43 \\
      \midrule
      Average debt & Year 1 & --- & 0.35 & 0.33 \\
                   & Year 2 & --- & 0.59 & 0.50 \\
                   & Year 3 & --- & 0.78 & 0.75 \\
                   & Year 4 & --- & 0.95 & 1.06 \\
      \midrule
      Fraction with debt & Year 1 & --- & 0.26 & 0.11 \\
                         & Year 2 & --- & 0.34 & 0.27 \\
                         & Year 3 & --- & 0.41 & 0.42 \\
                         & Year 4 & --- & 0.48 & 0.52 \\
      \midrule
      Drop out & Year 1 & --- & 0.16 & 0.15 \\
               & Year 2 & --- & 0.14 & 0.10 \\
               & Year 3 & --- & 0.08 & 0.07 \\
               & Year 4 & --- & 0.05 & 0.05 \\
               & Year 5 & --- & 0.02 & 0.03 \\
      \bottomrule
    \end{tabular}
    \caption{Data and model moments}
    \label{table:moments}
  \end{table}

  \begin{table}[H]
    \begin{tabular}{llll}
      \toprule
      & \textbf{AMR} & \textbf{LC} & \textbf{IDR} \\
      \midrule
      Enrollment rate & 0.48 & 0.48 & 0.49 \\
      Completion rate & 0.27 & 0.27 & 0.27 \\
      Graduation rate & 0.56 & 0.56 & 0.56 \\
      \bottomrule
    \end{tabular}
    \caption{Student outcomes under different versions of our economy}
    \label{table:students}
  \end{table}

  \begin{table}[H]
    \begin{tabular}{llll}
      \toprule
      & \textbf{AMR} & \textbf{LC} & \textbf{IDR} \\
      \midrule
      Fraction with debt & 0.46 & 0.46 & 0.70 \\
      Average debt & \$11,750 & \$11,750 & \$13,740 \\
      \bottomrule
    \end{tabular}
    \caption{Student debt decisions under plans}
    \label{table:debt}
  \end{table}

  \begin{table}[H]
    \begin{tabular}{llll}
      \toprule
      & \textbf{AMR} & \textbf{LC} & \textbf{IDR} \\
      \midrule
      Subsidy rate & -0.13 & -0.12 & -0.06 \\
      Government subsidy (per person) & -\$0.085 & -\$0.077 & -\$0.072 \\
      \bottomrule
    \end{tabular}
    \caption{Government subsidy rates and per person subsidy}
    \label{table:cost}
  \end{table}

  \begin{table}[H]
    \begin{tabular}{lll}
      \toprule
      & \textbf{AMR} & \textbf{IDR} \\
      \midrule
      Quartile 1 & -0.13 & 0.11 \\
      Quartile 2 & -0.13 & -0.01 \\
      Quartile 3 & -0.13 & -0.07 \\
      Quartile 4 & -0.13 & -0.11 \\
      \bottomrule
    \end{tabular}
    \caption{Government subsidy rates by HS GPA quartile}
    \label{table:subsidy_gpa}
  \end{table}

\clearpage
\newpage

%
% Figures
%
\subsection{Figures}

  \begin{center}
    \begin{figure}[H]
      \includegraphics[width=\textwidth]{images/StudentLoans/idr_enrollment_ts.pdf}
      \caption{
        This figure shows how the enrollment in IDR has changed over last 4 years
        \tiny{Source: U.S. Department of Education, Federal Student Aid Data Center, Federal Student Loan Portfolio.}
      }
      \label{fig:idr_enrollment}
    \end{figure}
  \end{center}

  \begin{center}
    \begin{figure}[H]
      \includegraphics[width=\textwidth]{images/StudentLoans/example_loan_repayment.pdf}
      \caption{
        This figure shows how the repayment burden and repayment amount differ for the AMR
        and IDR student loan repayment plans. It also plots the history of income for the example
        individual.
      }
      \label{fig:loan_repayment}
    \end{figure}
  \end{center}

  \begin{center}
    \begin{figure}[H]
      \includegraphics[width=\textwidth]{images/StudentLoans/GovSubsidy_Original_v_Revised.pdf}
      \caption{
        This figure shows the original subsidy estimate alongside the 2017 updated estimate.
        \tiny{Source: GAO analysis of the U.S. Department of Educations' 2011-2017 budget estimates}
      }
      \label{fig:subsidy_original_v_revised}
    \end{figure}
  \end{center}

  \begin{center}
    \begin{figure}[H]
      \includegraphics[width=\textwidth]{images/StudentLoans/ep_vs_p.pdf}
      \caption{
        {\small This figure shows the difference between the value function under the IDR and AMR plans for
        a college dropout 3 periods after leaving college. Behind the line is the probability
        distribution over income levels is plotted.}
      }
      \label{fig:scatter_ep_vs_p}
    \end{figure}
  \end{center}

  \begin{center}
    \begin{figure}[H]
      \includegraphics[width=\textwidth]{images/StudentLoans/vf_vs_income_probs.pdf}
      \caption{
        {\small This figure shows the difference between the value function under the IDR and AMR plans for
        a college dropout 3 periods after leaving college. Behind the line is the probability
        distribution over income levels is plotted.}
      }
      \label{fig:vfs_enrollment}
    \end{figure}
  \end{center}

  \begin{center}
    \begin{figure}[H]
      \includegraphics[width=\textwidth]{images/StudentLoans/DebtByGPA.pdf}
      \caption{
        {\small This figure shows the differences in average debt among those who have positive
        student loans and the fraction of college students who borrow for the AMR and IDR plans}
      }
      \label{fig:debt_by_gpa}
    \end{figure}
  \end{center}

  \begin{center}
    \begin{figure}[H]
      \includegraphics[width=\textwidth]{images/StudentLoans/expected_repayment.pdf}
      \caption{
        {\small This figure shows the fraction of a student loan that is expected to be repaid for
        AMR and IDR across different loan sizes.}
      }
      \label{fig:expected_repayment}
    \end{figure}
  \end{center}