\documentclass[a4paper,leqno]{strayman}
+\errorcontextlines=50
\let\numberwithin=\notdef
\usepackage{amsmath}
\usepackage{mathabx}
\usepackage{mdwlist}
%\usepackage{accents}
+\usepackage{fancyhdr}
+\pagestyle{fancy}
+\rhead[\rightmark]{}
+\lhead[]{\rightmark}
+\rfoot[\thepage]{\input{revid.inc}}
+\lfoot[\input{revid.inc}]{\thepage}
+
+\let\stdsection\section
+\renewcommand\section{\newpage\stdsection}
+
\renewcommand{\ge}{\geqslant}
\renewcommand{\le}{\leqslant}
+\newcommand{\nge}{\ngeqslant}
+\newcommand{\nle}{\nleqslant}
\newcommand{\has}{\sqsupseteq}
\newcommand{\isin}{\sqsubseteq}
-\newcommand{\nothaspatch}{\mathrel{\,\not\!\not\relax\haspatch}}
+\newcommand{\nothaspatch}{\mathrel{\,\!\not\relax\haspatch}}
\newcommand{\notpatchisin}{\mathrel{\,\not\!\not\relax\patchisin}}
\newcommand{\haspatch}{\sqSupset}
\newcommand{\patchisin}{\sqSubset}
+%\newcommand{\zhaspatch}{\mathrel{\underset{\fullmoon}\sqSupset}}
+\newcommand{\zhaspatch}{\mathrel{\sqSupset_\varnothing}}
+
+ \newif\ifhidehack\hidehackfalse
+ \DeclareRobustCommand\hidefromedef[2]{%
+ \hidehacktrue\ifhidehack#1\else#2\fi\hidehackfalse}
+ \newcommand{\pa}[1]{\hidefromedef{\varmathbb{#1}}{#1}}
-\newcommand{\set}[1]{\mathbb #1}
-\newcommand{\pa}[1]{\varmathbb #1}
+\newcommand{\set}[1]{\mathbb{#1}}
\newcommand{\pay}[1]{\pa{#1}^+}
\newcommand{\pan}[1]{\pa{#1}^-}
\newcommand{\py}{\pay{P}}
\newcommand{\pn}{\pan{P}}
+\newcommand{\pl}{\pa{L}}
+\newcommand{\ply}{\pay{L}}
+\newcommand{\pln}{\pan{L}}
+
+\newcommand{\pq}{\pa{Q}}
+\newcommand{\pqy}{\pay{Q}}
+\newcommand{\pqn}{\pan{Q}}
+
+\newcommand{\pr}{\pa{R}}
+\newcommand{\pry}{\pay{R}}
+\newcommand{\prn}{\pan{R}}
+
%\newcommand{\hasparents}{\underaccent{1}{>}}
%\newcommand{\hasparents}{{%
% \declareslashed{}{_{_1}}{0}{-0.8}{>}\slashed{>}}}
\renewcommand{\implies}{\Rightarrow}
\renewcommand{\equiv}{\Leftrightarrow}
+\renewcommand{\nequiv}{\nLeftrightarrow}
\renewcommand{\land}{\wedge}
\renewcommand{\lor}{\vee}
-\newcommand{\pancs}[2]{{\mathcal A} ( #1 , #2 ) }
-\newcommand{\pends}[2]{{\mathcal E} ( #1 , #2 ) }
+\newcommand{\pancs}{{\mathcal A}}
+\newcommand{\pends}{{\mathcal E}}
+
+\newcommand{\pancsof}[2]{\pancs ( #1 , #2 ) }
+\newcommand{\pendsof}[2]{\pends ( #1 , #2 ) }
+
+\newcommand{\merge}{{\mathcal M}}
+\newcommand{\mergeof}[4]{\merge(#1,#2,#3,#4)}
+%\newcommand{\merge}[4]{{#2 {{\frac{ #1 }{ #3 } #4}}}}
-\newcommand{\patchof}[1]{{\mathcal P} ( #1 ) }
-\newcommand{\baseof}[1]{{\mathcal B} ( #1 ) }
+\newcommand{\patch}{{\mathcal P}}
+\newcommand{\base}{{\mathcal B}}
+\newcommand{\patchof}[1]{\patch ( #1 ) }
+\newcommand{\baseof}[1]{\base ( #1 ) }
+
+\newcommand{\eqntag}[2]{ #2 \tag*{\mbox{#1}} }
\newcommand{\eqn}[2]{ #2 \tag*{\mbox{\bf #1}} }
-\newcommand{\corrolary}[1]{ #1 \tag*{\mbox{\it Corrolary.}} }
%\newcommand{\bigforall}{\mathop{\hbox{\huge$\forall$}}}
\newcommand{\bigforall}{%
{\hbox{\scriptsize$\forall$}}}%
}
-\newcommand{\proof}[1]{{\it Proof.} #1 $\square$}
+\newcommand{\Largeexists}{\mathop{\hbox{\Large$\exists$}}}
+\newcommand{\Largenexists}{\mathop{\hbox{\Large$\nexists$}}}
-\begin{document}
+\newcommand{\qed}{\square}
+\newcommand{\proofstarts}{{\it Proof:}}
+\newcommand{\proof}[1]{\proofstarts #1 $\qed$}
-\section{Notation}
+\newcommand{\gathbegin}{\begin{gather} \tag*{}}
+\newcommand{\gathnext}{\\ \tag*{}}
-\begin{basedescript}{
-\desclabelwidth{5em}
-\desclabelstyle{\nextlinelabel}
-}
-\item[ $ C \hasparents \set X $ ]
-The parents of commit $C$ are exactly the set
-$\set X$.
-
-\item[ $ C \ge D $ ]
-$C$ is a descendant of $D$ in the git commit
-graph. This is a partial order, namely the transitive closure of
-$ D \in \set X $ where $ C \hasparents \set X $.
-
-\item[ $ C \has D $ ]
-Informally, the tree at commit $C$ contains the change
-made in commit $D$. Does not take account of deliberate reversions by
-the user or in non-Topbloke-controlled branches; these are considered
-normal, forward, commits. For merges and Topbloke-generated
-anticommits, the ``change made'' is only to be thought of as any
-conflict resolution. This is not a partial order because it is not
-transitive.
-
-\item[ $ \p, \py, \pn $ ]
-A patch $\p$ consists of two sets of commits $\pn$ and $\py$, which
-are respectively the base and tip git branches. $\p$ may be used
-where the context requires a set, in which case the statement
-is to be taken as applying to both $\py$ and $\pn$.
-All these sets are distinct. Hence:
-
-\item[ $ \patchof{ C } $ ]
-Either $\p$ s.t. $ C \in \p $, or $\bot$.
-A function from commits to sets $\p$.
-
-\item[ $ \pancs{C}{\set P} $ ]
-$ \{ A \; | \; A \le C \land A \in \set P \} $
-i.e. all the ancestors of $C$
-which are in $\set P$.
-
-\item[ $ \pends{C}{\set P} $ ]
-$ \{ E \; | \; E \in \pancs{C}{\set P}
- \land \mathop{\not\exists}_{A \in \pancs{C}{\set P}}
- A \neq E \land E \le A \} $
-i.e. all $\le$-maximal commits in $\pancs{C}{\set P}$.
-
-\item[ $ \baseof{C} $ ]
-$ \pends{C}{\pn} = \{ \baseof{C} \} $ where $ C \in \py $.
-A partial function from commits to commits.
-See ``unique base'', below.
-
-\item[ $ C \haspatch \p $ ]
-$\displaystyle \bigforall_{D \in \py} D \isin C \equiv D \le C $.
-~ Informally, $C$ has the contents of $\p$.
-
-\item[ $ C \nothaspatch \p $ ]
-$\displaystyle \bigforall_{D \in \py} D \not\isin C $.
-~ Informally, $C$ has none of the contents of $\p$.
-
-Non-Topbloke commits are $\nothaspatch \p$ for all $\p$; if
-a patch is merged into a non-Topbloke branch and we inherit
-it, we hope that git's merge algorithm will DTRT.
-
-\end{basedescript}
-
-\section{Invariants}
-
-\[ \eqn{No Replay:}{
- C \has D \implies C \ge D
-}\]
-\[\eqn{Unique Base:}{
- \bigforall_{C \in \py} \pends{C}{\pn} = \{ B \}
-}\]
-\[\eqn{Tip Contents:}{
- \bigforall_{C \in \py} D \isin C \equiv
- { D \isin \baseof{C} \lor \atop
- (D \in \py \land D \le C) }
-}\]
-\[\eqn{Base Acyclic:}{
- \bigforall_{B \in \pn} D \isin B \implies D \notin \py
-}\]
-
-\section{Some lemmas}
-
-\[ \eqn{Exclusive Tip Contents:}{
- \bigforall_{C \in \py}
- \neg \left[ D \isin \baseof{C} \land (D \in \py \land D \le C
- \right )]
-}\]
-Ie, the two limbs of the RHS of Tip Contents are mutually exclusive.
-
-\proof{
-Let $B = \baseof{C}$ in $D \isin \baseof{C}$. Now $B \in \pn$.
-So by Base Acyclic $D \isin B \implies D \notin \py$.
-}
-\[ \corrolary{
- \bigforall_{C \in \py} D \isin C \equiv
- \begin{cases}
- D \in \py : & D \le C \\
- D \not\in \py : & D \isin \baseof{C}
- \end{cases}
-}\]
-
-\[ \eqn{Tip Self Inpatch:}{
- \bigforall_{C \in \py} C \haspatch \p
-}\]
-Ie, tip commits contain their own patch.
-
-\proof{
-Apply Exclusive Tip Contents to some $D \in \py$:
-$ \bigforall_{C \in \py}\bigforall_{D \in \py}
- D \isin C \equiv D \le C $
-}
-
-\[ \eqn{Exact Ancestors:}{
- \bigforall_{ C \hasparents \set{R} }
- D \le C \equiv
- ( \mathop{\hbox{\huge{$\vee$}}}_{R \in \set R} D \le R )
- \lor D = C
-}\]
-
-\[ \eqn{Transitive Ancestors:}{
- \left[ \bigforall_{ E \in \pends{C}{\set P} } E \le C \right] \implies
- \left[ \bigforall_{ A \in \pancs{C}{\set P} } A \le C \right]
-}\]
-
-\proof{
-By the definition of $\mathcal E$,
-for every such $A$, either $A \in \pends{C}{\set P}$ which implies
-$A \le C$, or $\exists_{A' \in \pancs{C}{\set P}} \; A' \neq A \land A \le C $
-in which case we repeat for $A'$. Since there are finitely many
-commits, this terminates.
-}
+\newcommand{\true}{t}
+\newcommand{\false}{f}
-\section{Test more symbols}
-
-$ C \haspatch \p $
-
-$ C \nothaspatch \p $
-
-$ \p \patchisin C $
+\begin{document}
-$ \p \notpatchisin C $
+\input{notation.tex}
+\input{invariants.tex}
+\input{lemmas.tex}
+\input{annotations.tex}
-$ \{ B \} \areparents C $
+\input{simple.tex}
+\input{create-base.tex}
+\input{create-tip.tex}
+\input{anticommit.tex}
+\input{merge.tex}
\end{document}