\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{color}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{esint}
\usepackage{babel}
\usepackage[round]{natbib}
\usepackage{color,hyperref}
\definecolor{darkblue}{rgb}{0.0,0.0,0.3}
\hypersetup{colorlinks,breaklinks,
linkcolor=darkblue,urlcolor=darkblue,
anchorcolor=darkblue,citecolor=darkblue}
\usepackage[capitalise, noabbrev]{cleveref}

\begin{document}
	\title{Solving PDEs Associated with Economic Models}
	\author{\large{\textsc{Matthieu Gomez \thanks{I thank Valentin Haddad, Ben Moll, and Dejanir Silva for useful discussions.}}}}
	\date{\today}
	\maketitle
	This package \href{https://github.com/matthieugomez/EconPDEs.jl}{EconPDEs.jl} introduces a fast and robust way to solve systems of PDEs + algebraic equations (i.e. DAEs) associated with economic models. This note details the underlying algorithm.
	\paragraph{Difference with \citet{achdou2014heterogeneous}}
	 \citet{achdou2014heterogeneous} focus on quasi-linear PDEs of the form
	\begin{align*}
		0&=f_1(V)  + f_2(x) \partial_x V  + f_3(x) \partial_{xx} V
	\end{align*}
	In contrast, the package solves non-linear PDEs of the form
		\begin{align*}
			0&=f_1(V)  + f_2(x, \partial_x V)  + f_3(x, \partial_x V) \partial_{xx} V
		\end{align*}

	\paragraph{Step 1: Write Finite Difference Scheme}
	The system of PDEs is written on a state space grid and derivatives are substituted by finite difference approximations. As in \citet{achdou2014heterogeneous},  first order derivatives are upwinded. This allows to naturally handle boudnary counditions at the frontiers of the state space. This also tends to make the scheme monotonous.

	\paragraph{Step 2: Solve Finite Difference Scheme}

	Denote $V$  the solution of the PDE and denote $F(V)$ the finite difference scheme corresponding to a model. The goal is to find $V$ such that $F(V) = 0$. The package includes a solver especially written for these finite different schemes. This method is most similar to a method used in the fluid dynamics literature. In this context, it is called the Pseudo-Transient Continuation method, and is denoted $\Psi tc$. Formal conditions for the convergence of the algorithm are given in  \citet{kelley1998convergence}.\par
	To understand the intuition for the method, note that the existing literature in economics solves for $V$ using using one of the two methods:

	\begin{enumerate}
		\item Non-linear solver. The method solves for the non-linear system $F (V ) = 0$. A Newton-Raphson update takes the form
		\begin{align}
			\label{1}
			0 &= F(y_{t}) + J_{F}(v_t) (v_{t+1} - v_t)
		\end{align}
		The issue with this method is that it requires the initial guess to be sufficiently close to the solution.\footnote{This method is usded, for instance, by \citet{garleanu2015young}}
		\item ODE solver . The method solves for the ODE $F(V) = \dot{V}$. The solution of $F(V)=0$ is obtained with $T\rightarrow +\infty$. \footnote{See, for instance, \citet{ditellabalance}, \citet{silva2015risk}.}
		With a simple explicit Euler method, updates take the form
		\begin{align}
			\label{2}
			0&= F(v_t) - \frac{1}{\Delta} (v_{t+1} -y_{t})
		\end{align}
		This method tends to be slow, and does not always converge, depending on the ODE chosen.
	\end{enumerate}
	I propose to solve for $V$ using a fully implicit Euler method.  Updates take the form
	\begin{align*}
		\forall t \leq T \hspace{1cm} 0&= F(v_{t+1}) - \frac{1}{\Delta}(v_{t+1} -y_{t})
	\end{align*}
	Each time step now requires to solve a non-linear equation. I solve this non-linear equation using a Newton-Raphson method. These inner iterations therefore take the form
	\begin{align}
		\label{inner}
		\forall i \leq I \hspace{1cm}	0 &= F(y_{t}^i) - \frac{1}{\Delta}(y_{t}^{i} -y_{t}) + (J_{F}(v_t^i) -  \frac{1}{\Delta})(y^{i+1}_{t} - v_t^i)
	\end{align}
	We know that the Newton-Raphson method converges if the initial guess is close enough to the solution. Since $y_{t}$ converges towards $v_{t+1}$ as $\Delta$ tends to zero, one can always choose $\Delta$ low enough so that the inner steps converge.Therefore, I adjust $\Delta$ as follows. If the inner iterations do not converge, I decrease $\Delta$. When the inner iteration converges, I increase $\Delta$. \par
	The update \cref{inner} can be see as weighted average of the Newton-Raphson step \cref{1} and of the explicit Euler step \cref{2}.  After a few sucessful implicit time steps, $\Delta$ is large and therefore the algorithm becomes like Newton-Rapshon. In particular, the convergence is quadratic around the solution. \par
	The algorithm with $I=1$ and $\Delta$ constant corresponds to \citet{achdou2014heterogeneous}. Allowing $I > 1$ and adjusting $\Delta$  are important to ensure convergence in case on non-linear PDEs.

	\bibliography{bib}
	\bibliographystyle{aer}
\end{document}


\input{setup/preamble.tex}% package inclusion and set up of the document
\input{setup/hyphenations.tex}%
\input{setup/macros.tex}% my new macros

\begin{document}
\DeclareGraphicsExtensions{.png,.jpg,.pdf, eps.}

% \def\bLabel{\renewcommand\@biblabel[1]{[##1]}}
% \def\citeP[#1]{[\hyperref[ch:listOfPublications]{#1}]}
\def\citeP[#1]{[\ref{paper:#1}]}

\def\ctxt{\text{c}} %connection subscript (text)
\def\stxt{\text{s}} %string subscript (text)
\def\ptxt{\text{p}} %plate subscript (text)
\def\mtxt{\text{m}} %mass subscript (text)
\def\itxt{\text{i}} %point of 'interest' subscript (text)
\def\Btxt{\text{B}} %bow subscript (text)
\def\etxt{\text{e}} %excitation subscript (text)
\def\rtxt{\text{r}} %lip reed subscript (text)
\def\ttxt{\text{t}} %tube subscript (text)

\def\sgn{\text{sgn}}
\def\sm{\text{sm}} %string-mass interaction tromba
\def\mp{\text{mp}} %mass-plate interaction tromba

\def\Nfrac{\mathcal{N}}
\def\flip{\leftarrow}
\def\Ucal{\mathbfcal{U}}

% states
\def\uln{u_l^n}
\def\wln{w_l^n}
\def\wmn{w_m^n}
\def\un{u^n}
\def\ulmn{u_{l,m}^n}
\def\ulm{u_{l,m}}
\def\uqn{u_q^n}

\def\wlmn{w_{l,m}^n}
\def\zlmn{z_{l,m}^n}
\def\ubr{u_\text{br}}
\def\zbr{z_\text{br}}

\def\qln{q_l^n}
\def\ulun{u_{l_u}^n}
\def\ulcn{u_{l_\ctxt}^n}
\def\wlwn{w_{l_w}^n}
\def\wmcn{w_{m_\ctxt}^n}

\def\wmn{w_m^n}

\def\Psiln{\Psi_l^n}
\def\Psinp{\Psi_l^{n+1}}
\def\Psinm{\Psi_l^{n-1}}
\def\Psilp{\Psi_{l+1}^n}
\def\Psilm{\Psi_{l-1}^n}

% bold symbols (state vectors and matrices)
\def\u{\mathbf{u}}
\def\w{\mathbf{w}}
\def\I{\mathbf{I}}
\def\A{\mathbf{A}}
\def\B{\mathbf{B}}
\def\C{\mathbf{C}}
\def\Q{\mathbf{Q}}
\def\U{\mathbf{U}}
\def\J{\mathbf{J}}
\def\i{\mathbf{i}}
\def\j{\mathbf{j}}

% interpolators
\def\Iu{I_{l, u}(x_\ctxt)}
\def\Iw{I_{m, w}(\chi_\ctxt)}
\def\Ju{J_{l, u}(x_\ctxt)}
\def\Jw{J_{m, w}(\chi_\ctxt)}
\def\Iq{I_q(\chi_\ctxt)}
\def\Ilm{I_{l,m}(x_\ctxt)}

\def\uStack{\boldsymbol{u}}
% mathfraks
\def\H{\mathfrak{H}}
\def\h{\mathfrak{h}}
\def\t{\mathfrak{t}}
\def\v{\mathfrak{v}}
\def\q{\mathfrak{q}}
\def\b{\mathfrak{b}}
\def\p{\mathfrak{p}}
% continuous operators
\def\ptt{\partial_t^2}
\def\pxx{\partial_x^2}
\def\pxxx{\partial_x^3}
\def\pxxxx{\partial_x^4}

\def\pyy{\partial_y^2}

\def\pt{\partial_t}
\def\px{\partial_x}
\def\py{\partial_y}

% discrete operators
\def\dtt{\delta_{tt}}
\def\dxx{\delta_{xx}}
\def\dxxx{\delta_{xxx}}
\def\dxxxx{\delta_{xxxx}}
\def\dcc{\delta_{\chi\chi}}
\def\dcccc{\delta_{\chi\chi\chi\chi}}

\def\dtd{\delta_{t\cdot}}
\def\dtp{\delta_{t+}}
\def\dtm{\delta_{t-}}

\def\dxd{\delta_{x\cdot}}
\def\dxp{\delta_{x+}}
\def\dxm{\delta_{x-}}
\def\dyd{\delta_{y\cdot}}
\def\dyp{\delta_{y+}}
\def\dym{\delta_{y-}}

\def\mtt{\mu_{tt}}
\def\mtd{\mu_{t\cdot}}
\def\mtp{\mu_{t+}}
\def\mtm{\mu_{t-}}

\def\mxx{\mu_{xx}}
\def\mxd{\mu_{x\cdot}}
\def\mxp{\mu_{x+}}
\def\mxm{\mu_{x-}}

\def\dDelta{\delta_{\Delta}}
% \def\dDbox{\delta_{\Delta\boxplus}}
\def\dyy{\delta_{yy}}

% matrix operators
\def\Dxx{\mathbf{D}_{xx}}
\def\Dxxxx{\mathbf{D}_{xxxx}}
\def\DDeltamat{\mathbf{D}_\Delta}
\def\DDeltaDelta{\mathbf{D}_{\Delta\Delta}}

\def\Dyy{\mathbf{D}_{yy}}

% often-used variables
\def\sz{\sigma_{0}}
\def\so{\sigma_{1}}
\def\vrel{v_\text{rel}}
\def\Sbar{\bar{S}}
\def\Sm{S_{l-1/2}}
\def\Sp{S_{l+1/2}}

\def\szX[#1]{\sigma_{0,{#1}}}
\def\soX[#1]{\sigma_{1,{#1}}}

\def\fs{f_\text{s}}
\def\el{\epsilon_\text{l}}
\def\er{\epsilon_\text{r}}
% mathcals
\def\D{\mathcal{D}}
\def\L{\mathcal{L}}
\def\OO{\mathcal{O}}
\def\S{\mathcal{S}}

% flooring ceiling
\def\floor[#1]{\left\lfloor #1 \right\rfloor}
\def\ceil[#1]{\left\lceil #1 \right\rceil}
\def\ansatz{\ \overset{\mathcal{A}}{\Longrightarrow}\ }
% other
\def\qaq{\quad \text{and} \quad}
\def\qwiq{\quad \text{with} \quad}
\def\qwhq{\quad \text{where} \quad}

\def\mystrut{\rule[-.2\baselineskip]{0pt}{\baselineskip}}

\def\th{\textsuperscript{th} }
\def\thOrder{\textsuperscript{th}-order }

\def\boldPhi{\boldsymbol{\phi}}
\def\boldPsi{\boldsymbol{\Psi}}
\def\eig{\text{eig}}

%frontmatter
\frontmatter
\pagestyle{empty} %disable headers and footers
\pagenumbering{roman} %use roman page numbering in the frontmatter
\input{frontmatter/frontpage}
\input{frontmatter/colophon}
\input{frontmatter/cv}
% \input{frontmatter/acknowledgements}
\input{frontmatter/abstract}
\input{frontmatter/preface}
\input{frontmatter/listOfPublications}
\input{frontmatter/listOfSymbols.tex}
\input{frontmatter/listOfAbbreviations.tex}

\cleardoublepage
\pdfbookmark[0]{Contents}{label:contents}
\pagestyle{fancy} %enable headers and footers again
\tableofcontents
% \listoffigures
% \listoftables

\listoftodos
\cleardoublepage

\def\makeAlph[#1]{\symbol{\numexpr96+#1}}

%mainmatter
\mainmatter

\part{Introduction}\label{part:introduction}
\input{introduction/introduction}

% \part{Resonators}\label{part:resonators}
% \input{resonators/resonators}

% \part{Exciters}\label{part:exciters}
% \input{exciters/exciters}

% \part{Interactions}\label{part:interactions}
% \input{interactions/interactions}

% % \part{Real-Time Implementation and Control}\label{part:realtime}
% % \input{realtime/realtime}

% \part{Contributions}\label{part:contributions}
% \input{contributions/contributions}

<<<<<<< HEAD
% % \part{Complete Instruments}\label{part:instrument}
% % \input{instrument/instrument}
=======
% % % % \part{Complete Instruments}\label{part:instrument}
% % % % \input{instrument/instrument}
>>>>>>> master

% \part{Conclusions and Perspectives}\label{part:conclusion}
% \input{conclusion/conclusion.tex}

\pagebreak

% \nocite{*} %only if you want all references in there
\todo{check whether all references are used}
\makeatletter
\renewenvironment{thebibliography}[1]
     {\chapter*{\bibname}%
      \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
\makeatother

{\bibliographystyle{IEEEtran}\bibliography{bib/mybib}}
\addcontentsline{toc}{chapter}{References}\todo{check whether to sort references or not}

%backmatter
\newif\ifapp
\apptrue % uncomment to include appendices

\newif\ifpapers
% \paperstrue % uncomment to include papers

\ifapp
  \renewcommand\thesection{\thechapter.\arabic{section}}
  \begin{subappendices}
    \begin{appendices}
      \renewcommand\appendixname{Paper}
      \setcounter{chapter}{0} % reset stuff
      \renewcommand\thesection{\arabic{section}}
      \part{Papers}\label{part:papers}
      % \pagestyle{plain}
      \titleformat{%command
      \chapter
      }[%shape
      display%
      ]{%format
      \normalfont\huge
      }{%label
      \begin{center}\color{aaublue}\chaptertitlename\ \thechapter\end{center}
      }{%style
      1cm
      }{%code before title
      \thispagestyle{empty}\begin{center}\Large
        }[%code after title
      \end{center}
      ]

      \input{papers/papers.tex}
      \pagestyle{fancy}
      % \input{papers/paperA/paperA.tex}
    \end{appendices}
    \begin{appendices}
      \renewcommand\appendixname{Appendix}
      \renewcommand\thesection{\thechapter.\arabic{section}}
      \renewcommand{\theequation}{\thechapter.\arabic{equation}}

      \setcounter{chapter}{0} % reset stuff
      \part{Appendix}
      \label{part:appendix}
      \input{appendices/appendices}
    \end{appendices}
  \end{subappendices}
\fi
% \titleformat{%command
%   \chapter
% }[%shape
% display%
% ]{%format
%   \normalfont\huge
% }{%label
%   \begin{center}\color{aaublue}\chaptertitlename\ \thechapter\end{center}
% }{%style
%   1cm
% }{%code before title
%   \thispagestyle{empty}\begin{center}\Large
% [%code after title
% ]
%   \end{center}}
\pagebreak
\pagestyle{empty}
\justify
\todo{format the blurb}Digital versions of musical instruments have been created for several decades, and for good reason! They are more compact, more easy to maintain, and less difficult to play than their real-life counterparts. One way to digitise an instrument is to record it and play back the samples, but this does not capture the entire range of expression of the real instrument. Simulating an instrument based on its physics, including its geometry and material properties, is much more flexible to player control. Although it requires more computational power to generate the sound in real time, the simulation could possibly go beyond what is physically possible. A violin growing into a cello, bowing your trumpet, your imagination is the limit...
% \includepaper{papers/paperA/paperA}
% \includepaper{papers/paperB/paperB}
\end{document}


\XtoCBlock{Average}
\label{block:Average}
\begin{figure}[H]\includegraphics{Average}\end{figure}

\begin{XtoCtabular}{Inports}
In & Input value\tabularnewline
\hline
\end{XtoCtabular}

\begin{XtoCtabular}{Outports}
Out & Averaged value\tabularnewline
\hline
\end{XtoCtabular}

\begin{XtoCtabular}{Mask Parameters}
n & Number of points to be averaged over\tabularnewline
\hline
ts\_fact & Multiplication factor of base sampling time (in integer format)\tabularnewline
\hline
\end{XtoCtabular}

\subsubsection*{Description:}
Calculation of moving average value over n numbers.

% include optional documentation file
\InputIfFileExists{\XcHomePath/Library/Math/Doc/Average_Info.tex}{\vspace{1ex}}{}

\subsubsection*{Implementations:}
\begin{tabular}{l l}
\textbf{FiP8} & 8 Bit Fixed Point Implementation\tabularnewline
\textbf{FiP16} & 16 Bit Fixed Point Implementation\tabularnewline
\textbf{FiP32} & 32 Bit Fixed Point Implementation\tabularnewline
\textbf{Float32} & 32 Bit Floating Point Implementation\tabularnewline
\textbf{Float64} & 64 Bit Floating Point Implementation\tabularnewline
\end{tabular}

\XtoCImplementation{FiP8}
\index{Block ID!5024}
\nopagebreak[0]
% Implementation details
\begin{tabular}{l l}
\textbf{Name} & FiP8 \tabularnewline
\textbf{ID} & 5024 \tabularnewline
\textbf{Revision} & 1 \tabularnewline
\textbf{C filename} & Average\_FiP8.c \tabularnewline
\textbf{H filename} & Average\_FiP8.h \tabularnewline
\end{tabular}
\vspace{1ex}

8 Bit Fixed Point Implementation

\begin{XtoCtabular}{Controller Parameters}
n & Average window size\tabularnewline
\hline
sfrn & Shift factor for computation of average value sfrn = ld(n)\tabularnewline
\hline
sum & Temporary sum\tabularnewline
\hline
count & Index counter\tabularnewline
\hline
avg & Array with data values\tabularnewline
\hline
\end{XtoCtabular}

% Implementation data structure
\XtoCDataStruct{Data Structure:}
\begin{lstlisting}
typedef struct {
     uint16        ID;
     int8          *In;
     int8          Out;
     uint16        n;
     uint8         sfrn;
     int16         sum;
     uint16        count;
     int8          *avg;
} AVERAGE_FIP8;
\end{lstlisting}

\ifdefined \AddTestReports
\InputIfFileExists{\XcHomePath/Library/Math/Doc/Test_Average_FiP8.tex}{}{}
\fi
\XtoCImplementation{FiP16}
\index{Block ID!5025}
\nopagebreak[0]
% Implementation details
\begin{tabular}{l l}
\textbf{Name} & FiP16 \tabularnewline
\textbf{ID} & 5025 \tabularnewline
\textbf{Revision} & 1 \tabularnewline
\textbf{C filename} & Average\_FiP16.c \tabularnewline
\textbf{H filename} & Average\_FiP16.h \tabularnewline
\end{tabular}
\vspace{1ex}

16 Bit Fixed Point Implementation

\begin{XtoCtabular}{Controller Parameters}
n & Average window size\tabularnewline
\hline
sfrn & Shift factor for computation of average value sfrn = ld(n)\tabularnewline
\hline
sum & Temporary sum\tabularnewline
\hline
count & Index counter\tabularnewline
\hline
avg & Array with data values\tabularnewline
\hline
\end{XtoCtabular}

% Implementation data structure
\XtoCDataStruct{Data Structure:}
\begin{lstlisting}
typedef struct {
     uint16        ID;
     int16         *In;
     int16         Out;
     uint16        n;
     uint8         sfrn;
     int32         sum;
     uint16        count;
     int16         *avg;
} AVERAGE_FIP16;
\end{lstlisting}

\ifdefined \AddTestReports
\InputIfFileExists{\XcHomePath/Library/Math/Doc/Test_Average_FiP16.tex}{}{}
\fi
\XtoCImplementation{FiP32}
\index{Block ID!5026}
\nopagebreak[0]
% Implementation details
\begin{tabular}{l l}
\textbf{Name} & FiP32 \tabularnewline
\textbf{ID} & 5026 \tabularnewline
\textbf{Revision} & 1 \tabularnewline
\textbf{C filename} & Average\_FiP32.c \tabularnewline
\textbf{H filename} & Average\_FiP32.h \tabularnewline
\end{tabular}
\vspace{1ex}

32 Bit Fixed Point Implementation

\begin{XtoCtabular}{Controller Parameters}
n & Average window size\tabularnewline
\hline
sfrn & Shift factor for computation of average value sfrn = ld(n)\tabularnewline
\hline
sum & Temporary sum\tabularnewline
\hline
count & Index counter\tabularnewline
\hline
avg & Array with data values\tabularnewline
\hline
\end{XtoCtabular}

% Implementation data structure
\XtoCDataStruct{Data Structure:}
\begin{lstlisting}
typedef struct {
     uint16        ID;
     int32         *In;
     int32         Out;
     uint16        n;
     uint8         sfrn;
     int64         sum;
     uint16        count;
     int32         *avg;
} AVERAGE_FIP32;
\end{lstlisting}

\ifdefined \AddTestReports
\InputIfFileExists{\XcHomePath/Library/Math/Doc/Test_Average_FiP32.tex}{}{}
\fi
\XtoCImplementation{Float32}
\index{Block ID!5027}
\nopagebreak[0]
% Implementation details
\begin{tabular}{l l}
\textbf{Name} & Float32 \tabularnewline
\textbf{ID} & 5027 \tabularnewline
\textbf{Revision} & 0.1 \tabularnewline
\textbf{C filename} & Average\_Float32.c \tabularnewline
\textbf{H filename} & Average\_Float32.h \tabularnewline
\end{tabular}
\vspace{1ex}

32 Bit Floating Point Implementation

\begin{XtoCtabular}{Controller Parameters}
n & Average window size\tabularnewline
\hline
sum & Temporary sum\tabularnewline
\hline
count & Index counter\tabularnewline
\hline
avg & Array with data values\tabularnewline
\hline
\end{XtoCtabular}

% Implementation data structure
\XtoCDataStruct{Data Structure:}
\begin{lstlisting}
typedef struct {
     uint16        ID;
     float32       *In;
     float32       Out;
     uint16        n;
     float32       sum;
     uint16        count;
     float32       *avg;
} AVERAGE_FLOAT32;
\end{lstlisting}

\ifdefined \AddTestReports
\InputIfFileExists{\XcHomePath/Library/Math/Doc/Test_Average_Float32.tex}{}{}
\fi
\XtoCImplementation{Float64}
\index{Block ID!5028}
\nopagebreak[0]
% Implementation details
\begin{tabular}{l l}
\textbf{Name} & Float64 \tabularnewline
\textbf{ID} & 5028 \tabularnewline
\textbf{Revision} & 0.1 \tabularnewline
\textbf{C filename} & Average\_Float64.c \tabularnewline
\textbf{H filename} & Average\_Float64.h \tabularnewline
\end{tabular}
\vspace{1ex}

64 Bit Floating Point Implementation

\begin{XtoCtabular}{Controller Parameters}
n & Average window size\tabularnewline
\hline
sum & Temporary sum\tabularnewline
\hline
count & Index counter\tabularnewline
\hline
avg & Array with data values\tabularnewline
\hline
\end{XtoCtabular}

% Implementation data structure
\XtoCDataStruct{Data Structure:}
\begin{lstlisting}
typedef struct {
     uint16        ID;
     float64       *In;
     float64       Out;
     uint16        n;
     float64       sum;
     uint16        count;
     float64       *avg;
} AVERAGE_FLOAT64;
\end{lstlisting}

\ifdefined \AddTestReports
\InputIfFileExists{\XcHomePath/Library/Math/Doc/Test_Average_Float64.tex}{}{}
\fi


\documentclass[review]{elsarticle}

\usepackage{amsmath}
\usepackage{booktabs}
\usepackage[makeroom]{cancel}
\usepackage[section]{placeins}
\usepackage{subcaption}
\usepackage{tabularx}
\usepackage{nicefrac}
\usepackage[usenames]{xcolor}
\usepackage{lineno,hyperref}
\modulolinenumbers[5]

\journal{Finite Elements in Analysis and Design}

%%%%%%%%%%%%%%%%%%%%%%%
%% Elsevier bibliography styles
%%%%%%%%%%%%%%%%%%%%%%%
%% To change the style, put a % in front of the second line of the current style and
%% remove the % from the second line of the style you would like to use.
%%%%%%%%%%%%%%%%%%%%%%%

%% Numbered
%\bibliographystyle{model1-num-names}

%% Numbered without titles
%\bibliographystyle{model1a-num-names}

%% Harvard
%\bibliographystyle{model2-names.bst}\biboptions{authoryear}

%% Vancouver numbered
%\usepackage{numcompress}\bibliographystyle{model3-num-names}

%% Vancouver name/year
%\usepackage{numcompress}\bibliographystyle{model4-names}\biboptions{authoryear}

%% APA style
%\bibliographystyle{model5-names}\biboptions{authoryear}

%% AMA style
%\usepackage{numcompress}\bibliographystyle{model6-num-names}

%% `Elsevier LaTeX' style
\bibliographystyle{elsarticle-num}
%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\begin{frontmatter}

\title{Eigenbasis of the discrete Energy Release Rate and mode partition for the Virtual Crack Closure Technique (VCCT) in the context of 2D the Finite Element Method (FEM)}
%\tnotetext[mytitlenote]{Fully documented templates are available in the elsarticle package on \href{http://www.ctan.org/tex-archive/macros/latex/contrib/elsarticle}{CTAN}.}

%% Group authors per affiliation:
%\author{Luca Di Stasio\fnref{myfootnote}}
%\address{Radarweg 29, Amsterdam}
%\fntext[myfootnote]{Since 1880.}

%% or include affiliations in footnotes:
\author[lulea]{Luca Di Stasio}
%\author[lulea]{Janis Varna}
%\author[nancy]{Zoubir Ayadi}
%\ead[url]{www.elsevier.com}

%\author[mysecondaryaddress]{Global Customer Service\corref{mycorrespondingauthor}}
%\cortext[mycorrespondingauthor]{Corresponding author}
%\ead{support@elsevier.com}

\address[lulea]{Lule\aa\ University of Technology, University Campus, SE-97187 Lule\aa, Sweden}
%\address[nancy]{Universit\'e de Lorraine, EEIGM, IJL, 6 Rue Bastien Lepage, F-54010 Nancy, France}

\begin{abstract}
\noindent

\end{abstract}

\begin{keyword}
Fiber/matrix interface crack\sep Bi-material interface arc crack\sep Linear Elastic Fracture Mechanics (LEFM)\sep Virtual Crack Closure Technique (VCCT) \sep Mode separation\sep Eigenbasis
\end{keyword}

\end{frontmatter}

\linenumbers

\section{Introduction}\label{sec:intro}

\section{FEM formulation of the fiber-matrix interface crack problem}\label{sec:femmodel}

\section{Vectorial formulation of the Virtual Crack Closure Technique (VCCT)}

In order to express the VCCT formulation of the ERR in terms of FEM variables, we need to introduce a few rotation matrices in order to represent the discretized representation (FE mesh) of a crack along a circular interface. The position of the crack tip is characterized by the angular size of the crack (see Sec.~\ref{sec:femmodel} and Fig.~\ref{fig:modelschem} for reference) and the rotation corresponding to the crack tip reference frame is represented by the matrix $\underline{\underline{R}}_{\Delta\theta}$ defined as

\begin{equation}\label{eq:Rmatrix}
\underline{\underline{R}}_{\Delta\theta}=\begin{bmatrix}
\cos\left(\Delta\theta\right) & \sin\left(\Delta\theta\right) \\
-\sin\left(\Delta\theta\right) & \cos\left(\Delta\theta\right)
\end{bmatrix}.
\end{equation}

Nodes belonging to the elements sharing the crack tip are involved in the VCCT estimation of the ERR and it is assumed that, given a sufficiently fine discretization, they are aligned with the crack propagation direction defined at the crack tip. However, irrespectively of how small the elements in the crack tip neighborhood are, a misalignment always exists with respect to the assumed crack propagation direction (in the crack tip reference frame). This is measured by the matrices $\underline{\underline{P}}_{\delta}\left(p\right)$, defined as

\begin{equation}\label{eq:Pmatrix}
\underline{\underline{P}}_{\delta}\left(p\right)=\begin{bmatrix}
\cos\left(\left(1+\frac{1-p}{m}\right)\delta\right) & \sin\left(\left(1+\frac{1-p}{m}\right)\delta\right) \\
-\sin\left(\left(1+\frac{1-p}{m}\right)\delta\right) & \cos\left(\left(1+\frac{1-p}{m}\right)\delta\right)
\end{bmatrix}
\end{equation}

 and $\underline{\underline{Q}}_{\delta}\left(q\right)$, equal to

\begin{equation}\label{eq:Qmatrix}
\underline{\underline{Q}}_{\delta}\left(q\right)=\begin{bmatrix}
\cos\left(\frac{q-1}{m}\delta\right) & \sin\left(\frac{q-1}{m}\delta\right) \\
-\sin\left(\frac{q-1}{m}\delta\right) & \cos\left(\frac{q-1}{m}\delta\right)
\end{bmatrix},
\end{equation}

respectively for the free and bonded nodes involved in the VCCT estimation. In Eqs.~\ref{eq:Pmatrix} and~\ref{eq:Qmatrix}, $\delta$ is the angular size of an element in the crack tip neighborhood (see Sec.~\ref{sec:femmodel} and Fig.~\ref{fig:modelschem}), $m$ is the order of the element shape functions and $p,q$ are indices referring to the nodes belonging respectively to free and bonded elements sharing the crack tip. Introducing the permutation matrix

\begin{equation}
\underline{\underline{P}}_{\pi}=\begin{bmatrix}
0 & 1\\
-1& 0
\end{bmatrix},
\end{equation}

it is possible to express the derivatives of rotation matrices $\underline{\underline{R}}_{\Delta\theta}$, $\underline{\underline{P}}_{\delta}$ and $\underline{\underline{Q}}_{\delta}$ with respect to their argument:

\begin{equation}\label{eq:rotmatdev}
\frac{\partial \underline{\underline{R}}_{\Delta\theta}}{\partial \Delta\theta}=\underline{\underline{D}}\cdot\underline{\underline{R}}_{\Delta\theta},\quad\frac{\partial \underline{\underline{P}}_{\delta}}{\partial \delta}=\left(1+\frac{1-p}{m}\right)\underline{\underline{D}}\cdot\underline{\underline{P}}_{\delta},\quad\frac{\partial \underline{\underline{Q}}_{\delta}}{\partial \delta}=\frac{q-1}{m}\underline{\underline{D}}\cdot\underline{\underline{Q}}_{\delta}.
\end{equation}

By means of Eqs.~\ref{eq:Pmatrix} and~\ref{eq:Qmatrix}, we can express the crack tip forces $
\underline{F}_{xy}=\begin{bmatrix}
F_{x} \\
F_{y}
\end{bmatrix}$ and crack displacements  $
\underline{u}_{xy}=\begin{bmatrix}
u_{x} \\
u_{y}
\end{bmatrix}$ in the crack tip reference frame (where the tangential direction $\theta$ correspond to the direction of crack propagation) while taking into account the misalignment to the finite  discretization as

\begin{equation}\label{eq:FUrot}
\underline{F}_{r\theta}=\underline{\underline{Q}}_{\delta}\underline{\underline{R}}_{\Delta\theta}\underline{F}_{xy}\qquad\underline{u}_{r\theta}=\underline{\underline{P}}_{\delta}\underline{\underline{R}}_{\Delta\theta}\underline{u}_{xy}
\end{equation}

where $\underline{F}_{r\theta}=\begin{bmatrix}
F_{r} \\
F_{\theta}
\end{bmatrix}$ and $\underline{u}_{r\theta}=\begin{bmatrix}
u_{r} \\
u_{\theta}
\end{bmatrix}$.

The crack tip forces can be expressed as a function of the crack opening displacement as

\begin{equation}\label{eq:ctforce1}
\underline{F}_{xy}=\underline{\underline{K}}_{xy}\underline{u}_{xy}+\underline{\widetilde{F}}_{xy},
\end{equation}

where $\underline{\underline{K}}_{xy}$ is in general a full matrix of the form $\underline{\underline{K}}_{xy}=\begin{bmatrix}
K_{xx}  K_{xy}\\
K_{yx}  K_{yy}
\end{bmatrix}$ and $\underline{\widetilde{F}}_{xy}$ represents the effect of the rest of the FE solution through the remaining nodes of the elements attached to the crack tip. As such, the term $\underline{\widetilde{F}}_{xy}$ can be expressed as a linear combination of the solution vector $\underline{u}_{N}$ of nodal displacements of the form $\underline{\underline{\widetilde{K}}}_{N}\underline{u}_{N}$. Equation~\ref{eq:ctforce1} thus become

\begin{equation}\label{eq:ctforce2}
\underline{F}_{xy}=\underline{\underline{K}}_{xy}\underline{u}_{xy}+\underline{\underline{\widetilde{K}}}_{N}\underline{u}_{N}.
\end{equation}

An exemplifying derivation of the relationships expressed in Equations~\ref{eq:ctforce1} and~\ref{eq:ctforce2} can be found in \ref{app:ctforcesexample}. It is worthwhile to observe that another author~\cite{Valvo2011} proposed a relationship of the form $\underline{F}_{xy}=\underline{\underline{K}}_{xy}\underline{u}_{xy}$. However, in~\cite{Valvo2011}, this relationship is assumed \emph{a priori} and manipulated to propose a revised version of the VCCT, based on the assumption that the matrix $\underline{\underline{K}}_{xy}$ should be diagonal to provide physically-consistent fracture mode partitioning. On the other hand, in the present work we derive the relationships of Eqs.~\ref{eq:ctforce1} and~\ref{eq:ctforce2} from the formulation of the Finite Element Method. According to our derivation, it seems correct that the matrix $\underline{\underline{K}}_{xy}$ should not in general be diagonal in order to take into account Poisson's effect. In fact, a positive crack opening displacement would cause a transverse displacement in the neighborhood of the crack tip. Given that material properties are different on the two sides of a bi-material interface, a net shear would be applied to the crack tip which would correspond to a net contribution to the crack tip force related to crack shear displacement. The analytical derivations presented in \ref{app:ctforcesexample} confirm these physical considerations.\\
Based upon the work of Raju~\cite{Raju1987}, we introduce the matrix $\underline{\underline{T}}_{pq}$ to represent the weights needed in the VCCT to account for the use of singular elements. As already done previously, indices $p$ and $q$ refer to nodes placed respectively on the free (crack face) and bonded side of the crack tip. Nodes are enumerated so that the crack tip has always index $1$, i.e. the higher the index the further the node is from the crack tip. Matrix $\underline{\underline{T}}_{pq}$ has always a size of $d\times d$, where $d=2$ for a $2D$ problem and $d=3$ for a $3D$ problem. An element $\underline{\underline{T}}_{pq}\left(i,j\right)$ with $i,j=1,\dots,d$ represents the weight to be assigned to the product of component $i$ of the displacement extracted at node $p$ with component $j$ of the force extracted at node $q$. The expression of $\underline{\underline{T}}_{pq}$ for quadrilateral elements with or without singularity is reported in \ref{app:Tpq}. Notice that, given $m$ is the order of the element shape functions, the element side has $m+1$ nodes and this represents the upper limit of indices $p$ and $q$.\\
By using matrix $\underline{\underline{T}}_{pq}$, it is possible to express the total ERR $G$ evaluated with the VCCT as

\begin{equation}\label{eq:gtot}
G_{TOT} = \frac{1}{2R_{f}\delta}\sum_{p=1}^{m+1}\sum_{q=1}^{m+1}Tr\left(\underline{u}_{r\theta,p}^{T}\underline{\underline{T}}_{pq}^{T}\underline{F}_{r\theta,q}\right).
\end{equation}

Introducing the vector $\underline{G}=\begin{bmatrix}
G_{I} \\
G_{II}
\end{bmatrix}$ of fracture mode ERRs, Mode I and Mode II ERR evaluated with the VCCT can be expressed as

\begin{equation}\label{eq:g}
\underline{G} =\frac{1}{2R_{f}\delta}\sum_{p=1}^{m+1}\sum_{q=1}^{m+1}Diag\left(\underline{F}_{r\theta,q}\underline{u}_{r\theta,p}^{T}\underline{\underline{T}}_{pq}^{T}\right),
\end{equation}

where $Diag\left(\right)$ is the function that extracts the main diagonal of the input matrix as a column vector. Substituting Equations~\ref{eq:FUrot} and~\ref{eq:ctforce2} in Equations~\ref{eq:gtot} and~\ref{eq:g}, we can express the Mode I, Mode II and total Energy Release Rate as a function of the crack displacements and the FE solution (more details in \ref{app:ctforcesexample}) as

\begin{equation}\label{eq:gtotlong}
\begin{split}
G_{TOT} =&\frac{1}{2R_{f}\delta}\sum_{p=1}^{m+1}\sum_{q=1}^{m+1}Tr\left(\underline{\underline{Q}}_{\delta}\underline{\underline{R}}_{\Delta\theta}\underline{\underline{K}}_{xy,q}\underline{u}_{xy,q}\underline{u}_{xy,p}^{T}\underline{\underline{R}}_{\Delta\theta}^{T}\underline{\underline{P}}_{\delta}^{T}\underline{\underline{T}}_{pq}^{T}\right)+\\&+\frac{1}{2R_{f}\delta}\sum_{p=1}^{m+1}\sum_{q=1}^{m+1}Tr\left(\underline{\underline{Q}}_{\delta}\underline{\underline{R}}_{\Delta\theta}\underline{\widetilde{F}}_{xy,q}\underline{u}_{xy,p}^{T}\underline{\underline{R}}_{\Delta\theta}^{T}\underline{\underline{P}}_{\delta}^{T}\underline{\underline{T}}_{pq}^{T}\right)
\end{split}
\end{equation}

and

\begin{equation}
\begin{split}
\underline{G}=\begin{bmatrix}
G_{I} \\
G_{II}
\end{bmatrix}=&\frac{1}{2R_{f}\delta}\sum_{p=1}^{m+1}\sum_{q=1}^{m+1}Diag\left(\underline{\underline{Q}}_{\delta}\underline{\underline{R}}_{\Delta\theta}\underline{\underline{K}}_{xy,q}\underline{u}_{xy,q}\underline{u}_{xy,p}^{T}\underline{\underline{R}}_{\Delta\theta}^{T}\underline{\underline{P}}_{\delta}^{T}\underline{\underline{T}}_{pq}^{T}\right)+\\
&+\frac{1}{2R_{f}\delta}\sum_{p=1}^{m+1}\sum_{q=1}^{m+1}Diag\left(\underline{\underline{Q}}_{\delta}\underline{\underline{R}}_{\Delta\theta}\underline{\underline{\widetilde{K}}}_{N,q}\underline{u}_{N}\underline{u}_{xy,p}^{T}\underline{\underline{R}}_{\Delta\theta}^{T}\underline{\underline{P}}_{\delta}^{T}\underline{\underline{T}}_{pq}^{T}\right)
\end{split}
\end{equation}

\begin{equation}
\underline{\underline{A}}=\underline{\underline{Q}}_{\delta}\underline{\underline{R}}_{\Delta\theta}\left(\underline{\underline{K}}_{xy,q}\underline{u}_{xy,q}+\underline{\underline{\widetilde{K}}}_{N,q}\underline{u}_{N}\right)\underline{u}_{xy,p}^{T}\underline{\underline{R}}_{\Delta\theta}^{T}\underline{\underline{P}}_{\delta}^{T}\underline{\underline{T}}_{pq}^{T}
\end{equation}

\begin{equation}
\det\left(\underline{\underline{A}}-\lambda\underline{\underline{I}}\right)=\det\left(\underline{\underline{Q}}_{\delta}\underline{\underline{R}}_{\Delta\theta}\left(\underline{\underline{K}}_{xy,q}\underline{u}_{xy,q}+\underline{\underline{\widetilde{K}}}_{N,q}\underline{u}_{N}\right)\underline{u}_{xy,p}^{T}\underline{\underline{R}}_{\Delta\theta}^{T}\underline{\underline{P}}_{\delta}^{T}\underline{\underline{T}}_{pq}^{T}-\lambda\underline{\underline{I}}\right)=0
\end{equation}

\begin{equation}
\det\left(\underline{\underline{A}}-\lambda\underline{\underline{I}}\right)=\det\left(\begin{bmatrix}
A_{11}-\lambda&A_{12} \\
A_{21}&A_{22}-\lambda
\end{bmatrix}\right)=0
\end{equation}

\begin{equation}
\lambda^{2}-\left(A_{11}+A_{22}\right)\lambda+\left(A_{11}A_{22}-A_{12}A_{21}\right)=0
\end{equation}

\begin{equation}
\lambda_{1,2}=\frac{1}{2}\left(-\left(A_{11}+A_{22}\right)\pm\sqrt{\left(A_{11}+A_{22}\right)^{2}-4\left(A_{11}A_{22}-A_{12}A_{21}\right)}\right)
\end{equation}

\section{Conclusions \& Outlook}

\FloatBarrier

\section*{Acknowledgements}

\bibliography{refs}

\appendix
\section{Derivation of the relationship between crack tip forces and displacements for first order quadrilateral elements}\label{app:ctforcesexample}

\subsection{Foundational relations}

In the isoparametric formulation of the Finite Element Method, the element Jacobian $J$ and its inverse $J^{-1}$ can be expressed in general as

\begin{equation}
\underline{\underline{J}}=\begin{bmatrix}
\underline{e}_{\xi}|\underline{e}_{\eta}
\end{bmatrix}=\begin{bmatrix}
\frac{\partial x}{\partial\xi}&\frac{\partial x}{\partial\eta}\\\frac{\partial y}{\partial\xi}&\frac{\partial y}{\partial\eta}
\end{bmatrix}\qquad\underline{\underline{J}}^{-1}=\begin{bmatrix}
\underline{e}^{x}|\underline{e}^{y}
\end{bmatrix}=\begin{bmatrix}
\frac{\partial \xi}{\partial x}&\frac{\partial \xi}{\partial y}\\\frac{\partial \eta}{\partial x}&\frac{\partial \eta}{\partial y}
\end{bmatrix}
\end{equation}

where $\left\{e_{\xi}, e_{\eta}\right\}$ and $\left\{e^{x}, e^{y}\right\}$ are respectively the covariant and contravariant basis vectors of the mapping between global $\left\{x, y\right\}$ and local element $\left\{\xi, \eta\right\}$ coordinates:

\begin{equation}
\underline{e}_{\xi}=\begin{bmatrix}
\frac{\partial x}{\partial\xi}\\\frac{\partial y}{\partial\xi}
\end{bmatrix}\quad\underline{e}_{\eta}=\begin{bmatrix}
\frac{\partial x}{\partial\eta}\\\frac{\partial y}{\partial\eta}
\end{bmatrix},
\end{equation}

\begin{equation}
\underline{e}_{x}=\begin{bmatrix}
\frac{\partial \xi}{\partial x}\\\frac{\partial \eta}{\partial x}
\end{bmatrix}\quad\underline{e}_{y}=\begin{bmatrix}
\frac{\partial \xi}{\partial y}\\\frac{\partial \eta}{\partial y}
\end{bmatrix}.
\end{equation}

Denoting by $d$ the number of geometrical dimensions of the problem ($d=2$ in the present work) and by $\underline{p}$ the $d\times 1$ position vector in global coordinates, we can formally introduce the $3\left(d-1\right)\times d$ matrix operator of partial differentiation $\underline{\underline{\widetilde{B}}}$ such that

\begin{equation}\label{eq:introB}
\underline{\varepsilon}\left(\underline{p}\right)=\underline{\underline{\widetilde{B}}}\cdot\underline{u}\left(\underline{p}\right),
\end{equation}

where $\underline{u}$ and $\underline{\varepsilon}$ are respectively the $d\times 1$ displacement vector and the $3\left(d-1\right)\times 1$ strain vector in Voigt notation. Denoting by $n$ the number of nodes of a generic element ($n=s\times m$ where $s$ represents the number of sides of the element and $m$ the order of the shape functions), we can furthermore introduce the $d\times d\cdot n$ matrix \underline{\underline{N}} of shape functions such that

\begin{equation}\label{eq:introN}
\underline{u}=\underline{\underline{N}}\cdot\underline{u}_{N},
\end{equation}

where $\underline{u}_{N}$ is the $d\cdot n\times 1$ vector of element nodal variables. Having introduced $\underline{\underline{\widetilde{B}}}$ and $\underline{\underline{N}}$ in Equations~\ref{eq:introB} and~\ref{eq:introN} respectively, it is possible to define the $3\left(d-1\right)\times d\cdot n$ matrix $\underline{\underline{B}}$ of derivatives (with respect to global coordinates) of shape functions as

\begin{equation}
\underline{\underline{B}}=\underline{\underline{\widetilde{B}}}\cdot\underline{\underline{N}}.
\end{equation}

We introduce the linear elastic material behavior in the form of the $3\left(d-1\right)\times 3\left(d-1\right)$ rigidity matrix $\underline{\underline{D}}$ such that

\begin{equation}
\underline{\sigma}=\underline{\underline{D}}\cdot\underline{\varepsilon},
\end{equation}

where $\underline{\sigma}$ the $3\left(d-1\right)\times 1$ stress vector in Voigt notation. It is finally possible to define the $n\times n$ element stiffness matrix $\underline{\underline{k_{e}}}$ as

\begin{equation}\label{eq:elestiff}
\underline{\underline{k_{e}}}=\int_{V_{e}\left(x,y\right)}\left(\underline{\underline{B}}^{T}\underline{\underline{D}}\cdot\underline{\underline{B}}\right)dV_{e}\left(x,\dots,y\right)=\int_{V_{e}\left(\xi,\eta\right)}\left(\underline{\underline{B}}^{T}\underline{\underline{D}}\cdot\underline{\underline{B}}\right)\sqrt{g}dV_{e}\left(\xi,\dots,\eta\right),
\end{equation}

where $g=det\left(\underline{\underline{J}}^{T}\underline{\underline{J}}\right)$ and $V_{e}$ is the element volume. Given that isoparametric elements are always defined between $-1$ and $1$ in each dimension, Equation~\ref{eq:elestiff} can simplified to

\begin{equation}
\underline{\underline{k_{e}}}=\int_{-1}^{1}\dots\int_{-1}^{1}\left(\underline{\underline{B}}^{T}\underline{\underline{D}}\cdot\underline{\underline{B}}\right)\sqrt{g}d\xi,\dots, d\eta,
\end{equation}

which is amenable to numerical integration by means of a Gaussian quadrature of the form

\begin{equation}\label{eq:elstiffnum}
\underline{\underline{k_{e}}}\approx \sum_{i=1}^{N}\dots\sum_{j=1}^{N}w_{i}\dots w_{j}\left(\underline{\underline{B}}^{T}\left(\xi_{i}, \dots,\eta_{j}\right)\cdot\underline{\underline{D}}\cdot\underline{\underline{B}}\left(\xi_{i}, \dots,\eta_{j}\right)\sqrt{g}\right),
\end{equation}

where $\left(\xi_{i}, \dots,\eta_{j}\right)$ are the coordinates of the $N$ Gaussian quadrature points. The element stiffness matrix as evaluated in Eq.~\ref{eq:elstiffnum} is in general a full symmetric (in the case of linear elasticity) matrix of the form

\begin{equation}\label{eq:elstiffmatrix}
k_{e}=\begin{bmatrix}
k_{e|11}&k_{e|12}&k_{e|13}&k_{e|14}&k_{e|15}&k_{e|16}&k_{e|17}&k_{e|18}\\
k_{e|12}&k_{e|22}&k_{e|23}&k_{e|24}&k_{e|25}&k_{e|26}&k_{e|27}&k_{e|28}\\
k_{e|13}&k_{e|23}&k_{e|33}&k_{e|34}&k_{e|35}&k_{e|36}&k_{e|37}&k_{e|38}\\
k_{e|14}&k_{e|24}&k_{e|34}&k_{e|44}&k_{e|45}&k_{e|46}&k_{e|47}&k_{e|48}\\
k_{e|15}&k_{e|25}&k_{e|35}&k_{e|45}&k_{e|55}&k_{e|56}&k_{e|57}&k_{e|58}\\
k_{e|16}&k_{e|26}&k_{e|36}&k_{e|46}&k_{e|56}&k_{e|66}&k_{e|67}&k_{e|68}\\
k_{e|17}&k_{e|27}&k_{e|37}&k_{e|47}&k_{e|57}&k_{e|67}&k_{e|77}&k_{e|78}\\
k_{e|18}&k_{e|28}&k_{e|38}&k_{e|48}&k_{e|58}&k_{e|68}&k_{e|78}&k_{e|88}\\
\end{bmatrix}.
\end{equation}

\subsection{Calculation of displacements and reaction forces}

With reference to Fig.~\ref{fig:vcctlinear}, we define:

\begin{description}
\item[$u_{x,M}$, $u_{x,F}$] the $x$-displacement of the nodes belonging to the free side of the first element belonging to the crack, respectively on the matrix (bulk) and fiber (inclusion) side;
\item[$u_{y,M}$, $u_{y,F}$] the $y$-displacement of the nodes belonging to the free side of the first element belonging to the crack, respectively on the matrix (bulk) and fiber (inclusion) side;
\item[$u_{r,M}$, $u_{r,F}$] the $x$-displacement of the nodes belonging to the free side of the first element belonging to the crack, respectively on the matrix (bulk) and fiber (inclusion) side;
\item[$u_{\theta,M}$, $u_{\theta,F}$] the $y$-displacement of the nodes belonging to the free side of the first element belonging to the crack, respectively on the matrix (bulk) and fiber (inclusion) side;
\item[$F_{x,CT}$, $F_{y,CT}$] respectively the $x$- and $y$-component of the reaction force at the crack tip;
\item[$F_{r,CT}$, $F_{\theta,CT}$] respectively the $r$- and $\theta$-component of the reaction force at the crack tip.
\end{description}

The $x-y$ reference frame is the global reference frame, while the $r-\theta$ reference frame is such that the $\theta$ direction coincides with the crack propagation direction at the crack tip and $r$ the in-plane normal to the propagation direction. For an arc-crack as the present one, the $r$-direction coincides with the radial direction of the inclusion.

%\begin{figure}[!h]
%\includegraphics[width=\textwidth]{VCCT-linear.pdf}
%\caption{Schematic representation of the discretized crack tip geometry for  $1^{st}$ order quadrilateral elements.}\label{fig:vcctlinear}
%\end{figure}

The crack opening displacement $u_{r}$ and the crack shear displacement $u_{\theta}$ at the crack tip can thus be written as

\begin{equation}
u_{r}=\cos\left(\Delta\theta\right) u_{x}+\sin\left(\Delta\theta\right) u_{y}\qquad u_{\theta}=-\sin\left(\Delta\theta\right) u_{x}+\cos\left(\Delta\theta\right) u_{y},
\end{equation}

where $u_{x}$ and $u_{y}$ are defined as

\begin{equation}\label{eq:uxuy}
u_{x}=u_{x,M}-u_{x,F}\qquad u_{y}=u_{y,M}-u_{y,F}
\end{equation}

and $2\Delta\theta$ is total angular size of the debond. The corresponding forces at the crack tip are

\begin{equation}
F_{r}=\cos\left(\Delta\theta\right) F_{x,CT}+\sin\left(\Delta\theta\right) F_{y,CT}\qquad F_{\theta}=-\sin\left(\Delta\theta\right) F_{x,CT}+\cos\left(\Delta\theta\right) F_{y,CT}.
\end{equation}

At the crack tip, the FE mesh possesses two coincident points, labeled $FCT$ and $MCT$. Continuity of the displacements at the crack tip must be ensured. Furthermore, in order to measure the force at the crack tip, a fully-constraint dummy node needs to be created and formally linked to the two nodes at the crack tip by the conditions

\begin{equation}
\begin{cases}
&u_{x,FCT}-u_{x,MCT}-u_{x,DUMMY}=0\\
&u_{y,FCT}-u_{y,MCT}-u_{y,DUMMY}=0\\[10pt]
&u_{x,DUMMY}=0\\
&u_{y,DUMMY}=0\\
\end{cases},
\end{equation}

which can be simplified to

\begin{equation}
\begin{cases}
&u_{x,FCT}=u_{x,MCT}\\
&u_{y,FCT}=u_{y,MCT}\\[10pt]
&R_{x,DUMMY}=R_{x,FCT}=-R_{x,MCT}=F_{x,CT}\\
&R_{y,DUMMY}=R_{y,FCT}=-R_{y,MCT}=F_{y,CT}\\
\end{cases}.
\end{equation}

Making use of Eq.~\ref{eq:elstiffmatrix}, four equations can be written in the four displacement $u_{x,FCT}$, $u_{x,MCT}$, $u_{y,FCT}$ and $u_{y,MCT}$:

\begin{equation}\label{eq:syseqs01}
\begin{cases}
&\left(k_{e,M|11}+k_{e,M|33}\right)u_{x,MCT}+\left(k_{e,M|12}+k_{e,M|34}\right)u_{y,MCT}+\\&+k_{e,M|13}u_{x,M}+k_{e,M|14}u_{y,M}+\left(k_{M|17}+k_{M|35}\right)u_{N,MC|7}+\left(k_{M|18}+k_{M|36}\right)u_{N,MC|8}+\\&+\sum_{i=5}^{6}k_{M|1i}u_{N,MC|i}+\sum_{i=7}^{8}k_{M|3i}u_{N,MB|i}+k_{M|31}u_{x,NCOI}+k_{M|32}u_{y,NCOI}=0\\[10pt]
&\left(k_{e,M|21}+k_{e,M|43}\right)u_{x,MCT}+\left(k_{e,M|22}+k_{e,M|44}\right)u_{y,MCT}+\\&+k_{e,M|23}u_{x,M}+k_{e,M|24}u_{y,M}+\left(k_{M|27}+k_{M|45}\right)u_{N,MC|7}+\left(k_{M|28}+k_{M|46}\right)u_{N,MC|8}+\\&+\sum_{i=5}^{6}k_{M|2i}u_{N,MC|i}+\sum_{i=7}^{8}k_{M|4i}u_{N,MB|i}+k_{M|41}u_{x,NCOI}+k_{M|42}u_{y,NCOI}=0\\[10pt]
&\left(k_{e,F|77}+k_{e,F|55}\right)u_{x,FCT}+\left(k_{e,F|78}+k_{e,F|56}\right)u_{y,FCT}+\\&+k_{e,F|75}u_{x,F}+k_{e,F|76}u_{y,F}+\left(k_{F|71}+k_{F|53}\right)u_{N,FC|1}+\left(k_{F|72}+k_{F|54}\right)u_{N,FC|2}+\\&+\sum_{i=2}^{3}k_{F|7i}u_{N,FC|i}+\sum_{i=1}^{2}k_{F|5i}u_{N,FB|i}+k_{F|57}u_{x,NCOI}+k_{F|58}u_{y,NCOI}=0\\[10pt]
&\left(k_{e,F|87}+k_{e,F|65}\right)u_{x,FCT}+\left(k_{e,F|88}+k_{e,F|66}\right)u_{y,FCT}+\\&+k_{e,F|85}u_{x,F}+k_{e,F|86}u_{y,F}+\left(k_{F|81}+k_{F|63}\right)u_{N,FC|1}+\left(k_{F|82}+k_{F|64}\right)u_{N,FC|2}+\\&+\sum_{i=2}^{3}k_{F|8i}u_{N,FC|i}+\sum_{i=1}^{2}k_{F|6i}u_{N,FB|i}+k_{F|67}u_{x,NCOI}+k_{F|68}u_{y,NCOI}=0\\[10pt]
\end{cases}.
\end{equation}

Solving for $u_{y,FCT}$ and $u_{y,MCT}$ the third and fourth relations in Eq.~\ref{eq:syseqs01} and substituting in the first two expressions of Eq.~\ref{eq:syseqs01}, we get

\begin{equation}\label{eq:syseqs02}
\footnotesize
\begin{cases}
&\left(k_{e,M|11}+k_{e,M|33}+k_{e,F|77}+k_{e,F|55}\right)u_{x,MCT}+\left(k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}\right)u_{y,MCT}+\\&+k_{e,M|13}u_{x,M}+k_{e,M|14}u_{y,M}+k_{e,F|75}u_{x,F}+k_{e,F|76}u_{y,F}+\\&+\left(k_{M|31}+k_{F|57}\right)u_{x,NCOI}+\left(k_{M|32}+k_{F|58}\right)u_{y,NCOI}+\\&+\left(k_{M|17}+k_{M|35}\right)u_{N,MC|7}+\left(k_{M|18}+k_{M|36}\right)u_{N,MC|8}+\left(k_{F|71}+k_{F|53}\right)u_{N,FC|1}+\left(k_{F|72}+k_{F|54}\right)u_{N,FC|2}+\\&+\sum_{i=5}^{6}k_{M|1i}u_{N,MC|i}+\sum_{i=7}^{8}k_{M|3i}u_{N,MB|i}+\sum_{i=2}^{3}k_{F|7i}u_{N,FC|i}+\sum_{i=1}^{2}k_{F|5i}u_{N,FB|i}=0\\[10pt]
&\left(k_{e,M|21}+k_{e,M|43}+k_{e,F|87}+k_{e,F|65}\right)u_{x,MCT}+\left(k_{e,M|22}+k_{e,M|44}+k_{e,F|88}+k_{e,F|66}\right)u_{y,MCT}+\\&+k_{e,M|23}u_{x,M}+k_{e,M|24}u_{y,M}+k_{e,F|85}u_{x,F}+k_{e,F|86}u_{y,F}+\\&+\left(k_{M|41}+k_{F|67}\right)u_{x,NCOI}+\left(k_{M|42}+k_{F|68}\right)u_{y,NCOI}+\\&+\left(k_{M|27}+k_{M|45}\right)u_{N,MC|7}+\left(k_{M|28}+k_{M|46}\right)u_{N,MC|8}+\left(k_{F|81}+k_{F|63}\right)u_{N,FC|1}+\left(k_{F|82}+k_{F|64}\right)u_{N,FC|2}+\\&+\sum_{i=2}^{3}k_{F|8i}u_{N,FC|i}+\sum_{i=1}^{2}k_{F|6i}u_{N,FB|i}+\sum_{i=5}^{6}k_{M|2i}u_{N,MC|i}+\sum_{i=7}^{8}k_{M|4i}u_{N,MB|i}=0\\[10pt]
\end{cases}
\end{equation}

%\begin{equation}
%\scriptsize
%\begin{cases}
%&u_{y,MCT}=-\frac{k_{e,M|11}+k_{e,M|33}+k_{e,F|77}+k_{e,F|55}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}u_{x,MCT}+\\
%&-\frac{k_{e,M|13}u_{x,M}+k_{e,M|14}u_{y,M}+k_{e,F|75}u_{x,F}+k_{e,F|76}u_{y,F}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}+\\
%&-\frac{\left(k_{M|31}+k_{F|57}\right)u_{x,NCOI}+\left(k_{M|32}+k_{F|58}\right)u_{y,NCOI}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}+\\
%&-\frac{\left(k_{M|17}+k_{M|35}\right)u_{N,MC|7}+\left(k_{M|18}+k_{M|36}\right)u_{N,MC|8}+\left(k_{F|71}+k_{F|53}\right)u_{N,FC|1}+\left(k_{F|72}+k_{F|54}\right)u_{N,FC|2}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}+\\
%&-\frac{\sum_{i=5}^{6}k_{M|1i}u_{N,MC|i}+\sum_{i=7}^{8}k_{M|3i}u_{N,MB|i}+\sum_{i=2}^{3}k_{F|7i}u_{N,FC|i}+\sum_{i=1}^{2}k_{F|5i}u_{N,FB|i}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}\\[10pt]
%
%&\left[\left(k_{e,M|21}+k_{e,M|43}+k_{e,F|87}+k_{e,F|65}\right)+\frac{k_{e,M|11}+k_{e,M|33}+k_{e,F|77}+k_{e,F|55}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}\left(k_{e,M|22}+k_{e,M|44}+k_{e,F|88}+k_{e,F|66}\right)\right]u_{x,MCT}+\\
%&+\left(k_{e,M|23}-\frac{k_{e,M|22}+k_{e,M|44}+k_{e,F|88}+k_{e,F|66}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}k_{e,M|13}\right)u_{x,M}+\\
%&+\left(k_{e,M|24}-\frac{k_{e,M|22}+k_{e,M|44}+k_{e,F|88}+k_{e,F|66}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}k_{e,M|14}\right)u_{y,M}+\\
%&+\left(k_{e,F|85}-\frac{k_{e,M|22}+k_{e,M|44}+k_{e,F|88}+k_{e,F|66}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}k_{e,M|75}\right)u_{x,F}+\\
%&+\left(k_{e,F|86}-\frac{k_{e,M|22}+k_{e,M|44}+k_{e,F|88}+k_{e,F|66}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}k_{e,M|76}\right)u_{y,F}+\\
%&+\left[\left(k_{M|41}+k_{F|67}\right)-\frac{k_{e,M|22}+k_{e,M|44}+k_{e,F|88}+k_{e,F|66}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}\left(k_{M|31}+k_{F|57}\right)\right]u_{x,NCOI}+\\
%&+\left[\left(k_{M|42}+k_{F|68}\right)-\frac{k_{e,M|22}+k_{e,M|44}+k_{e,F|88}+k_{e,F|66}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}\left(k_{M|32}+k_{F|58}\right)\right]u_{y,NCOI}+\\
%&+\left(k_{M|27}+k_{M|45}\right)u_{N,MC|7}+\left(k_{M|28}+k_{M|46}\right)u_{N,MC|8}+\left(k_{F|81}+k_{F|63}\right)u_{N,FC|1}+\left(k_{F|82}+k_{F|64}\right)u_{N,FC|2}+\\
%&-\frac{k_{e,M|22}+k_{e,M|44}+k_{e,F|88}+k_{e,F|66}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}\left[\left(k_{M|17}+k_{M|35}\right)u_{N,MC|7}+\left(k_{M|18}+k_{M|36}\right)u_{N,MC|8}\right]+\\&
%-\frac{k_{e,M|22}+k_{e,M|44}+k_{e,F|88}+k_{e,F|66}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}\left[\left(k_{F|71}+k_{F|53}\right)u_{N,FC|1}+\left(k_{F|72}+k_{F|54}\right)u_{N,FC|2}\right]\\
%&+\sum_{i=2}^{3}k_{F|8i}u_{N,FC|i}+\sum_{i=1}^{2}k_{F|6i}u_{N,FB|i}+\sum_{i=5}^{6}k_{M|2i}u_{N,MC|i}+\sum_{i=7}^{8}k_{M|4i}u_{N,MB|i}+\\
%&-\frac{\sum_{i=5}^{6}k_{M|1i}u_{N,MC|i}+\sum_{i=7}^{8}k_{M|3i}u_{N,MB|i}+\sum_{i=2}^{3}k_{F|7i}u_{N,FC|i}+\sum_{i=1}^{2}k_{F|5i}u_{N,FB|i}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}=0\\[10pt]
%
%&u_{x,FCT}=u_{x,MCT}\\
%&u_{y,FCT}=u_{y,MCT}\\[10pt]
%&R_{x,DUMMY}=R_{x,FCT}=-R_{x,MCT}=F_{x,CT}\\
%&R_{y,DUMMY}=R_{y,FCT}=-R_{y,MCT}=F_{y,CT}\\
%\end{cases}
%\end{equation}

Solving the system of two equations and observing that $u_{x,F},u_{y,F}\sim0$ for a stiffer inclusion as a fiber in a polymeric composite, we can express $u_{x,MCT}$ as a function of $u_{x}$ and $u_{y}$ (see Eq.~\ref{eq:uxuy}) as

\begin{equation}\label{eq:syseqs03}
\scriptsize
\begin{split}
%&u_{y,MCT}=-\frac{k_{e,M|11}+k_{e,M|33}+k_{e,F|77}+k_{e,F|55}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}u_{x,MCT}+\\
%&-\frac{k_{e,M|13}u_{x,M}+k_{e,M|14}u_{y,M}+k_{e,F|75}u_{x,F}+k_{e,F|76}u_{y,F}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}+\\
%&-\frac{\left(k_{M|31}+k_{F|57}\right)u_{x,NCOI}+\left(k_{M|32}+k_{F|58}\right)u_{y,NCOI}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}+\\
%&-\frac{\left(k_{M|17}+k_{M|35}\right)u_{N,MC|7}+\left(k_{M|18}+k_{M|36}\right)u_{N,MC|8}+\left(k_{F|71}+k_{F|53}\right)u_{N,FC|1}+\left(k_{F|72}+k_{F|54}\right)u_{N,FC|2}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}+\\
%&-\frac{\sum_{i=5}^{6}k_{M|1i}u_{N,MC|i}+\sum_{i=7}^{8}k_{M|3i}u_{N,MB|i}+\sum_{i=2}^{3}k_{F|7i}u_{N,FC|i}+\sum_{i=1}^{2}k_{F|5i}u_{N,FB|i}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}\\[10pt]
&\left[\left(k_{e,M|21}+k_{e,M|43}+k_{e,F|87}+k_{e,F|65}\right)+\frac{k_{e,M|11}+k_{e,M|33}+k_{e,F|77}+k_{e,F|55}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}\left(k_{e,M|22}+k_{e,M|44}+k_{e,F|88}+k_{e,F|66}\right)\right]u_{x,MCT}+\\
&+\left(k_{e,M|23}-\frac{k_{e,M|22}+k_{e,M|44}+k_{e,F|88}+k_{e,F|66}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}k_{e,M|13}\right)u_{x}+\\
&+\left(k_{e,M|24}-\frac{k_{e,M|22}+k_{e,M|44}+k_{e,F|88}+k_{e,F|66}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}k_{e,M|14}\right)u_{y}+\\
&+\left(k_{e,M|23}+k_{e,F|85}-\frac{k_{e,M|22}+k_{e,M|44}+k_{e,F|88}+k_{e,F|66}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}\left(k_{e,M|13}+k_{e,M|75}\right)\right)\cancelto{\approx 0}{u_{x,F}}+\\
&+\left(k_{e,M|24}+k_{e,F|86}-\frac{k_{e,M|22}+k_{e,M|44}+k_{e,F|88}+k_{e,F|66}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}\left(k_{e,M|14}+k_{e,M|76}\right)\right)\cancelto{\approx 0}{u_{y,F}}+\\
&+\left[\left(k_{M|41}+k_{F|67}\right)-\frac{k_{e,M|22}+k_{e,M|44}+k_{e,F|88}+k_{e,F|66}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}\left(k_{M|31}+k_{F|57}\right)\right]u_{x,NCOI}+\\
&+\left[\left(k_{M|42}+k_{F|68}\right)-\frac{k_{e,M|22}+k_{e,M|44}+k_{e,F|88}+k_{e,F|66}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}\left(k_{M|32}+k_{F|58}\right)\right]u_{y,NCOI}+\\
&+\left(k_{M|27}+k_{M|45}\right)u_{N,MC|7}+\left(k_{M|28}+k_{M|46}\right)u_{N,MC|8}+\left(k_{F|81}+k_{F|63}\right)u_{N,FC|1}+\left(k_{F|82}+k_{F|64}\right)u_{N,FC|2}+\\
&-\frac{k_{e,M|22}+k_{e,M|44}+k_{e,F|88}+k_{e,F|66}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}\left[\left(k_{M|17}+k_{M|35}\right)u_{N,MC|7}+\left(k_{M|18}+k_{M|36}\right)u_{N,MC|8}\right]+\\&
-\frac{k_{e,M|22}+k_{e,M|44}+k_{e,F|88}+k_{e,F|66}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}\left[\left(k_{F|71}+k_{F|53}\right)u_{N,FC|1}+\left(k_{F|72}+k_{F|54}\right)u_{N,FC|2}\right]\\
&+\sum_{i=2}^{3}k_{F|8i}u_{N,FC|i}+\sum_{i=1}^{2}k_{F|6i}u_{N,FB|i}+\sum_{i=5}^{6}k_{M|2i}u_{N,MC|i}+\sum_{i=7}^{8}k_{M|4i}u_{N,MB|i}+\\
&-\frac{\sum_{i=5}^{6}k_{M|1i}u_{N,MC|i}+\sum_{i=7}^{8}k_{M|3i}u_{N,MB|i}+\sum_{i=2}^{3}k_{F|7i}u_{N,FC|i}+\sum_{i=1}^{2}k_{F|5i}u_{N,FB|i}}{k_{e,M|12}+k_{e,M|34}+k_{e,F|78}+k_{e,F|56}}=0,
\end{split}
\end{equation}

while the reaction forces at the crack tip can be expressed as

\begin{equation}\label{eq:forcesreform}
\begin{cases}
F_{x,CT}&=R_{x,FCT}=\\&=\left(k_{e,F|77}+k_{e,F|55}\right)u_{x,FCT}+\left(k_{e,F|78}+k_{e,F|56}\right)u_{y,FCT}+\\
&+k_{e,F|75}\cancelto{\approx 0}{u_{x,F}}+k_{e,F|76}\cancelto{\approx 0}{u_{y,F}}+\\
&+\sum_{i=1}^{4}k_{e,F|7i}u_{N,FC|i}+\sum_{i=1,i\neq\left(5,6\right)}^{8}k_{e,F|5i}u_{N,FB|i}\\
F_{y,CT}&=R_{y,FCT}=\\&=\left(k_{e,F|87}+k_{e,F|65}\right)u_{x,FCT}+\left(k_{e,F|88}+k_{e,F|66}\right)u_{y,FCT}+\\
&+k_{e,F|85}\cancelto{\approx 0}{u_{x,F}}+k_{e,F|86}\cancelto{\approx 0}{u_{y,F}}+\\
&+\sum_{i=1}^{4}k_{e,F|8i}u_{N,FC|i}+\sum_{i=1,i\neq\left(5,6\right)}^{8}k_{e,F|6i}u_{N,FB|i}\\
\end{cases}.
\end{equation}

Substituting Eq.~\ref{eq:syseqs01} in Eq.~\ref{eq:syseqs02}, Eq.~\ref{eq:syseqs03} and Eq.~\ref{eq:forcesreform} and solving, we obtain an expression of the form

\begin{equation}
\begin{cases}
F_{x,CT}&= K_{xx}u_{x}+K_{xy}u_{y}+\\
&+\sum_{i=1}^{4}K_{FC,x|i}u_{N,FC|i}+\sum_{i=1,i\neq\left(3,4,5,6\right)}^{8}K_{FB,x|i}u_{N,FB|i}+\\
&+\sum_{i=5}^{8}K_{FC,x|i}u_{N,MC|i}+\sum_{i=7}^{8}K_{MB,x|i}u_{N,FB|i}\\
F_{y,CT}&= K_{yx}u_{x}+K_{yy}u_{y}+\\
&+\sum_{i=1}^{4}K_{FC,y|i}u_{N,FC|i}+\sum_{i=1,i\neq\left(3,4,5,6\right)}^{8}K_{FB,y|i}u_{N,FB|i}+\\
&+\sum_{i=5}^{8}K_{FC,y|i}u_{N,MC|i}+\sum_{i=7}^{8}K_{MB,y|i}u_{N,FB|i}\\
\end{cases},
\end{equation}

which can be reformulated synthetically as

\begin{equation}
\begin{cases}
F_{x,CT}&= K_{xx}u_{x}+K_{xy}u_{y}+\widetilde{F}_{x}\\
F_{y,CT}&= K_{yx}u_{x}+K_{yy}u_{y}+\widetilde{F}_{y}\\
\end{cases},
\end{equation}

where $\widetilde{F}_{x}$ and $\widetilde{F}_{y}$ represent the influence of the FE solution through the nodes of the elements sharing the crack tip that do not belong to any of the phase interfaces, i.e. the nodes of the elements sharing the crack tip that belong to the bulk of each phase.

\section{Expression of $\underline{\underline{T}}_{pq}$ for quadrilateral elements with or without singularity}\label{app:Tpq}

The expression of $\underline{\underline{T}}_{pq}$ for quadrilateral elements with or without singularity is

\begin{equation}\label{eq:Tpq}
\scriptsize
\begin{split}
\underline{\underline{T}}_{pq}&=\begin{cases}
\underline{\underline{I}}\ for\ p=q<2\\
\underline{\underline{0}}\ otherwise
\end{cases}\quad \text{for $1^{st}$ order quadrilateral elements}\\
&=\begin{cases}
\underline{\underline{I}}\ for\ p=q<3\\
\underline{\underline{0}}\ otherwise
\end{cases}\quad \text{for $2^{nd}$ order quadrilateral elements}\\
&=\begin{cases}
\underline{\underline{I}}\ for\ p=q<4\\
\underline{\underline{0}}\ otherwise
\end{cases}\quad \text{for $3^{rd}$ order quadrilateral elements}\\
&=\begin{cases}
\left(14-\frac{33\pi}{8}\right)\underline{\underline{I}}\ for\ p=1,q=1\\
\left(-52+\frac{33\pi}{2}\right)\underline{\underline{I}}\ for\ p=1,q=2\\
\left(17-\frac{21\pi}{4}\right)\underline{\underline{I}}\ for\ p=2,q=1\\
\left(-\frac{7}{2}+\frac{21\pi}{16}\right)\underline{\underline{I}}\ for\ p=2,q=2\\
\left(8-\frac{21\pi}{8}\right)\underline{\underline{I}}\ for\ p=1,q=3\\
\left(-32+\frac{21\pi}{2}\right)\underline{\underline{I}}\ for\ p=2,q=3\\
\underline{\underline{0}}\ otherwise
\end{cases}\quad \text{for $2^{nd}$ order quarter-point quadrilateral elements}\\
&=\begin{cases}
\left(-11187+\frac{7155\pi}{2}\right)\underline{\underline{I}}\ for\ p=1,q=1\\
\left(38556-\frac{24543\pi}{2}\right)\underline{\underline{I}}\ for\ p=1,q=2\\
\left(-53055+\frac{33777\pi}{2}\right)\underline{\underline{I}}\ for\ p=1,q=3\\
\left(\frac{11396}{3}-\frac{9575\pi}{8}\right)\underline{\underline{I}}\ for\ p=2,q=1\\
\left(-12936+\frac{33003\pi}{8}\right)\underline{\underline{I}}\ for\ p=2,q=2\\
\left(17988-\frac{45837\pi}{8}\right)\underline{\underline{I}}\ for\ p=2,q=3\\
\left(-\frac{8453}{3}+\frac{3595\pi}{4}\right)\underline{\underline{I}}\ for\ p=3,q=1\\
\left(9804-\frac{12411\pi}{4}\right)\underline{\underline{I}}\ for\ p=3,q=2\\
\left(-13587+\frac{17289\pi}{4}\right)\underline{\underline{I}}\ for\ p=3,q=3\\
\left(6948-\frac{17685\pi}{8}\right)\underline{\underline{I}}\ for\ p=1,q=4\\
\left(-23976+\frac{60993\pi}{8}\right)\underline{\underline{I}}\ for\ p=2,q=4\\
\left(33372-\frac{84807\pi}{8}\right)\underline{\underline{I}}\ for\ p=3,q=4\\
\underline{\underline{0}}\ otherwise
\end{cases}\quad \text{for $3^{rd}$ order quarter-point quadrilateral elements}\\
\end{split}
\end{equation}

where $\underline{\underline{I}}$ is the identity matrix.

%\section{Derivation of the vectorial formulation of the ERR}\label{app:errvecfor}
%
%\begin{equation}
%\begin{split}
%G_{TOT} &= \frac{1}{2R_{f}\delta}\sum_{p=1}^{m+1}\sum_{q=1}^{m+1}\underline{u}_{r\theta,p}^{T}\underline{\underline{T}}_{pq}^{T}\underline{F}_{r\theta,q}=\\
%&=\frac{1}{2R_{f}\delta}\sum_{p=1}^{m+1}\sum_{q=1}^{m+1}Tr\left(\underline{F}_{r\theta,q}\underline{u}_{r\theta,p}^{T}\underline{\underline{T}}_{pq}^{T}\right)=\\&=\frac{1}{2R_{f}\delta}\sum_{p=1}^{m+1}\sum_{q=1}^{m+1}Tr\left(\begin{bmatrix}
%t_{pq|11}F_{r,q}u_{r,p}&t_{pq|12}F_{r,q}u_{\theta,p}\\
%t_{pq|21}F_{\theta,q}u_{r,p}&t_{pq|22}F_{\theta,q}u_{\theta,p}\\
%\end{bmatrix}\right)=\\
%&=\frac{1}{2R_{f}\delta}\sum_{p=1}^{m+1}\sum_{q=1}^{m+1}Tr\left(\underline{\underline{Q}}_{\delta}\underline{\underline{R}}_{\Delta\theta}\underline{F}_{xy,q}\underline{u}_{xy,p}^{T}\underline{\underline{R}}_{\Delta\theta}^{T}\underline{\underline{P}}_{\delta}^{T}\underline{\underline{T}}_{pq}^{T}\right)
%\end{split}
%\end{equation}
%
%\begin{equation}
%\underline{G}=\begin{bmatrix}
%G_{I} \\
%G_{II}
%\end{bmatrix}=\frac{1}{2R_{f}\delta}\sum_{p=1}^{m+1}\sum_{q=1}^{m+1}Diag\left(\underline{\underline{Q}}_{\delta}\underline{\underline{R}}_{\Delta\theta}\underline{F}_{xy,q}\underline{u}_{xy,p}^{T}\underline{\underline{R}}_{\Delta\theta}^{T}\underline{\underline{P}}_{\delta}^{T}\underline{\underline{T}}_{pq}^{T}\right)
%\end{equation}
%
%\begin{equation}
%\begin{split}
%\underline{G}=\begin{bmatrix}
%G_{I} \\
%G_{II}
%\end{bmatrix}=&\frac{1}{2R_{f}\delta}\sum_{p=1}^{m+1}\sum_{q=1}^{m+1}Diag\left(\underline{\underline{Q}}_{\delta}\underline{\underline{R}}_{\Delta\theta}\underline{\underline{K}}_{xy}\underline{u}_{xy}\underline{u}_{xy}^{T}\underline{\underline{R}}_{\Delta\theta}^{T}\underline{\underline{P}}_{\delta}^{T}\underline{\underline{T}}_{pq}^{T}\right)+\\
%&+\frac{1}{2R_{f}\delta}\sum_{p=1}^{m+1}\sum_{q=1}^{m+1}Diag\left(\underline{\underline{Q}}_{\delta}\underline{\underline{R}}_{\Delta\theta}\underline{\widetilde{F}}_{xy}\underline{u}_{xy}^{T}\underline{\underline{R}}_{\Delta\theta}^{T}\underline{\underline{P}}_{\delta}^{T}\underline{\underline{T}}_{pq}^{T}\right)=\\
%=&\frac{1}{2R_{f}\delta}\sum_{p=1}^{m+1}\sum_{q=1}^{m+1}Diag\left(\underline{\underline{Q}}_{\delta}\underline{\underline{R}}_{\Delta\theta}\underline{\underline{K}}_{xy}\underline{u}_{xy}\underline{u}_{xy}^{T}\underline{\underline{R}}_{\Delta\theta}^{T}\underline{\underline{P}}_{\delta}^{T}\underline{\underline{T}}_{pq}^{T}\right)+\\
%&+\frac{1}{2R_{f}\delta}\sum_{p=1}^{m+1}\sum_{q=1}^{m+1}Diag\left(\underline{\underline{Q}}_{\delta}\underline{\underline{R}}_{\Delta\theta}\underline{\underline{\widetilde{K}}}_{N}\underline{u}_{N}\underline{u}_{xy}^{T}\underline{\underline{R}}_{\Delta\theta}^{T}\underline{\underline{P}}_{\delta}^{T}\underline{\underline{T}}_{pq}^{T}\right)
%\end{split}
%\end{equation}

\end{document}


\chapter{Micro Tasks}\label{Chapter:datasets}
In chapter \ref{Chapter:proposals} we saw that AG exhibits compositional learning and can learn PCFG rules when explicitly asked to do so. We can now test if it can infer the rules of the grammar behind a formal language from the dataset and then generalize to unseen strings generated using the grammar in a zero-shot fashion. Since it has already been seen in chapter \ref{Chpater:intro} that \cite{Lake2017} introduced the SCAN domain which is essentially a context free language and showed that vanilla seq2seq models can't learn the rules governing this dataset in a systematic fashion, it stands to reason that instead of directly testing the compositional abilities of my method on a context free language which is still higher up in the Chomsky Hierarchy, I start with the much simpler domain of sub-regular languages.

CommAI mini tasks \citep{Baroni2017} are a set of strictly local and locally testable (please refer to section \ref{flt:sh}) languages designed to test the generalization capabilities of a compositional learner. Based on the mini tasks I propose a new dataset of sub-regular languages which I call the Micro Tasks. While the CommAI mini task position themselves as strictly local and locally testable tasks of progressive difficulty we add another layer of difficulty to the tasks by setting them up as either a decision problem (verify) or search problem (produce) in the same training domain.

\textbf{Search vs Decision} - It has been shown that for a general language $L \in NP$ search is more difficult than decision \cite{Bellare1994}. The \textit{verification} task is clearly a decision problem while the \textit{production} task is a search problem. Since Micro tasks fall into the domain of sub-regular languages they can be decided at-most in the linear time of length of string by a finite state automaton (section \ref{flt:ch}), they clearly are $\notin NP$. However it still makes sense to analyze whether for a prover (seq2seq network, lstm etc.) is the task of computing the witness for the membership in a $L \notin NP$ more difficult than establishing the existence of such a witness.

The \textbf{verify} task input is of the form \lq $\langle$ string of k-factors $\rangle$ verify $\langle$ witness $\rangle${}\rq\ with the output being a standard classification token \lq yes/no\rq{}. The witness string is of length $\geq$ the given k-factor string, and a model must verify if the k-factors exist in the witness. The \textbf{production} task consists of an input of the form \lq $\langle$ string of k-factors $\rangle$ produce\rq{} with the output being a satisfying assignment (equal to the length of the given string) to the criteria laid out in the input string.

Any given $\langle$ k-factor string $\rangle$ in either of the verify or produce tasks can be one out of the following four types:
\begin{itemize}
	\item \textbf{atomic}\footnote{This is present only in the verify task, since in produce it just becomes a unary k-factor without any operator and produces an output which is a copy of itself. It is like the \lq and\rq{} task without any operator or additional symbols in the input.} - consists of a single word/k-factor/n-gram from the vocabulary and task of a learner is to check the existence of this k-factor in the witness (verify task). In the verification setting this task is strictly local in its description (section \ref{flt:sh}) and can be solved by a scanner with an access to the witness/lookup-table.
	\item \textbf{or} - consists of k-factors joined by the boolean operator \lq or\rq{}. This task is again strictly local in its description albeit more memory intensive than the atomic task because it requires storage of multiple k-factors in memory.
	\item \textbf{and} - consists of k-factors joined by the boolean operator \lq and\rq{}. Now a learner doesn't simply have to verify the existence of a single k-factor in the witness, instead for each k-factor it has to maintain a record of it's occurence/non-occurence in the witness, and thus requires store of all k-factors in memory. This task is therefore locally k-testable.
	\item \textbf{not} - consists of k-factors acted upon by both \lq and \rq{} as well as \lq not \rq{} operators. While the \textit{conjunction} acts upon two k-factors, the \textit{negation} only acts upon one. This task also has a locally k-testable description.
\end{itemize}

\section{Data  Structure}
Out of the 128 ASCII characters, only 100 are printable and of those 100, 6 refer to newline, space, tab etc. which are not directly observable and therefore our vocabulary $\Sigma$ consists of 94 printable ascii characters and two binary output tokens \lq yes\rq{} and \lq no\rq{}. The vocabulary is split into two equal disjoint subsets. The train and various test sets constructed from this vocabulary are as follows:
\begin{enumerate}
	\item \textbf{train} consists of 120000 pairs of input output symbols with input composition length (vocabulary symbols excluding operators) ranging between $\langle$ 2 and 4 $\rangle$ (limits inclusive). $10\%$ of this data is used to create the validation set. Any particular input composition is constructed using words from only one of the subsets.
	\item \textbf{unseen test} consists of 12000 i/o pairs with input composition length ranging between $\langle$ 2 and 4 $\rangle$. The compositions are created by randomly sampling words from both subsets of the vocabulary i.e cross-composition between subsets is allowed
	\item \textbf{longer test} consists of i/o pairs such that input composition length is between $\langle$ 5 and 7 $\rangle$ (limits inclusive). cross-composition of words from two different subsets isn't allowed.
	\item \textbf{unseen longer test} consist of i/o pairs such that input composition length is between $\langle$ 5 and 7 $\rangle$ and cross-composition is allowed.
\end{enumerate}

The distribution of the boolean operators (i.e. the number of tasks per operator) in the train and unseen test set (the distribution is same for every test set) can be seen in figures \ref{micro_train} and \ref{micro_test} respectively.

\begin{figure}[ht]
	\begin{subfigure}[b]{0.5\linewidth}
		\centering
		\ifpdf
		\includegraphics[width=0.95\linewidth]{./figs/micro/train_verify-pdf}
		\else
		\includegraphics[width=0.95\linewidth]{./figs/micro/train_verify-eps}
		\fi
		\caption{Verification Task}
		\label{tr_ver}
		\vspace{2ex}
	\end{subfigure}%%
	\begin{subfigure}[b]{0.5\linewidth}
		\centering
		\ifpdf
		\includegraphics[width=0.95\linewidth]{./figs/micro/train_produce-pdf}
		\else
		\includegraphics[width=0.95\linewidth]{./figs/micro/train_produce-eps}
		\fi
		\caption{Production Task}
		\label{tr_prd}
		\vspace{2ex}
	\end{subfigure}
	\caption{Micro Tasks - Training Data}
	\label{micro_train}
\end{figure}

\begin{figure}[ht]
	\begin{subfigure}[b]{0.5\linewidth}
		\centering
		\ifpdf
		\includegraphics[width=0.95\linewidth]{./figs/micro/unseen_verify-pdf}
		\else
		\includegraphics[width=0.95\linewidth]{./figs/micro/unseen_verify-eps}
		\fi
		\caption{Verification Task}
		\label{un_ver}
		\vspace{2ex}
	\end{subfigure}%%
	\begin{subfigure}[b]{0.5\linewidth}
		\centering
		\ifpdf
		\includegraphics[width=0.95\linewidth]{./figs/micro/unseen_produce-pdf}
		\else
		\includegraphics[width=0.95\linewidth]{./figs/micro/unseen_produce-eps}
		\fi
		\caption{Production Task}
		\label{un_prd}
		\vspace{2ex}
	\end{subfigure}
	\caption{Micro Tasks - Unseen Data}
	\label{micro_test}
\end{figure}

% Examples of verify and produce tasks in each of the data-split is presented in tables \ref{mt:stats:ver} and \ref{mt:stats:prod}.
%\begin{table}[ht]
%	\centering
%	\begin{tabular}{l|lc}
%		& Example & Size\\
%		\hline
%		train & \ and K verify y  & 54000 \\
%		unseen test & b or X or D or a verify < D f & 6000 \\
%		longer test & E or H or E or ] or ! verify & E d ] !  & 6000 \\
%		unseen longer test & ^ and U and T and . and X and D and S verify D S s ^ # T . U X & 6000 \\
%	\end{tabular}
%	\caption{Micro Tasks Verify Splits}
%	\label{mt:stats:ver}
%\end{table}
%
%\begin{table}[ht]
%	\centering
%	\begin{tabular}{l|lc}
%		& Example & Size\\
%		\hline
%		train & r and not G and W produce  & 54000 \\
%		unseen test & N and X produce & 6000 \\
%		longer test & y or n or t or y or [ produce & 6000 \\
%		unseen longer test & ] and z and } and I and 5 and not f produce & 6000 \\
%	\end{tabular}
%	\caption{Micro Tasks Produce Splits}
%	\label{mt:stats:prod}
%\end{table}

\section{Experimental Setup}

\subsection{AG Trace}\label{mt:ponder}
The trace for the hard guidance of micro-tasks is different for verify and produce cases owing to the fact that verify has a single emission (yes/no token) while produce has multiple emissions. Furthermore pondering is explicitly mocked here by augmenting the output with a ponder token. The ponder token helps the network in focusing on the summarization of the entire string and the meta-information i.e. verify/produce, before moving on to the emission of the actual targets. The details of the trace are as follows:

\textbf{Verify}. Here we have a trace of length 3 with the focus at end of string, meta-information and end of witness respectively. While the first two indices of the trace correspond to the ponder tokens in the output, the last index corresponds to the decision token which is the actual target. The trace is visualized in figure \ref{ag_ver}.

\textbf{Produce}.In the case of produce while the ponder tokens and the trace corresponding to them remain the same as in the case of verify the trace corresponding to the emissions changes. The trace corresponds to the index in input string for an emission in output string. In the case of not, every emission in target which isn't in input is traced in ascending order of index of the words in input which are acted upon by a not operator. The trace is visualized in figure \ref{ag_prd}

\begin{figure}[ht]
	\begin{subfigure}[b]{0.5\linewidth}
		\centering
		\ifpdf
		\includegraphics[width=0.95\linewidth]{./figs/micro/ver-pdf}
		\else
		\includegraphics[width=0.95\linewidth]{./figs/micro/ver-eps}
		\fi
		\caption{AG Trace for Verification Task}
		\label{ag_ver}
		\vspace{2ex}
	\end{subfigure}%%
	\begin{subfigure}[b]{0.5\linewidth}
		\centering
		\ifpdf
		\includegraphics[width=0.95\linewidth]{./figs/micro/prof-pdf}
		\else
		\includegraphics[width=0.95\linewidth]{./figs/micro/prod-eps}
		\fi
		\caption{AG Trace for Production Task}
		\label{ag_prd}
		\vspace{2ex}
	\end{subfigure}
	\caption{Micro Tasks - Attentive Guidance Trace}
	\label{mt_trace}
\end{figure}

\subsection{Micro task Accuracy}
Similar to the symbol rewriting dataset (section \ref{datasets:sr}) micro tasks is a probabilistic dataset in both the number and order of emissions. Therefore, just as we had to define a symbol rewriting metric in section \ref{sr:acc_desc} we need to define a new accuracy measure for microtasks. While the microtask accuracy for verify task is simply contingent on the final emission, which is binary, the accuracy for \lq or \rq{}, \lq and \rq{}, \lq not \rq{}, tasks are separately defined as follows:

\begin{itemize}
	\item \textbf{or} - by checking the presence of any of the input token in predicted sequence.
	\item \textbf{and} - by checking the presence of all of the input tokens in predicted sequence.
	\item \textbf{not} - by ensuring that the set of all the input tokens preceded by negation and the predicted sequence are disjoint. This is followed by the same test as above for all the tokens not preceded by negation.
\end{itemize}

\subparagraph{Hyperparameters} Three different kindof models- baseline(vanila seq2seq), learned guidance(attentive guidance) and hard guidance (attention vectors explicitly provided at decoding) were trained on this dataset using same hyperparameters. The hyperparameters used for the experiments were: rnn cell = lstm, hidden layer size = embedding size = 128, attention =pre-rnn \citep{Bahdanau2014}, alignment measure = mlp, optimizer=Adam \citep{KingmaB14}, learning rate = 0.001.

\section{Micro Tasks - Results}
Since the dataset is probabilistic in nature, it is reasonable to create multiple splits of the data and train different models on each split. I generated 5 different train and test splits of the data and trained separate baselines, learned and hard guided models on each of these splits. Each of these trained models were then used to get the accuracies on the 5 test splits. The mean of these accuracy values along with the error bars (max, min) values is presented for each operation individually in for both verify and produce tasks.

\begin{figure}[ht]
	\begin{subfigure}[b]{0.5\linewidth}
		\centering
		\includegraphics[width=0.95\linewidth]{./figs/micro/unseen_verify}
		\caption{Accuracies for verify task }
		\label{mtu1}
		\vspace{2ex}
	\end{subfigure}%%
	\begin{subfigure}[b]{0.5\linewidth}
		\centering
		\includegraphics[width=0.95\linewidth]{./figs/micro/unseen_produce}
		\caption{Accuracies for produce task }
		\label{mtu2}
		\vspace{2ex}
	\end{subfigure}
	\caption{Micro Task accuracies per operation for unseen test }
	\label{mtu}
\end{figure}
A general observation from these results is that on the verify task all the models have similar optimum values, for each of the operations. The best results are for the \lq and\rq{} \& \lq copy/atomic\rq{} tasks. It can be argued that these two operations exhibit lower stochasticity than the remaining two operations in the sense that the symbols/morphemes that the model is expected to look for remain fixed in the witness string. This isn't the case for the \lq or\rq{} \& \lq not\rq{} tasks and thus for a verifier \lq not\rq{} is arguably the most difficult operation in the verification task. The results on each of the test splits (figures \ref{mtu1},\ref{mtl1} and \ref{mtul1}) expectedly concur with this hypothesis.
\begin{figure}[ht]
	\begin{subfigure}[b]{0.5\linewidth}
		\centering
		\includegraphics[width=0.95\linewidth]{./figs/micro/longer_verify}
		\caption{Accuracies for verify task }
		\label{mtl1}
		\vspace{2ex}
	\end{subfigure}%%
	\begin{subfigure}[b]{0.5\linewidth}
		\centering
		\includegraphics[width=0.95\linewidth]{./figs/micro/longer_produce}
		\caption{Accuracies for produce task }
		\label{mtl2}
		\vspace{2ex}
	\end{subfigure}
	\caption{Micro Task accuracies per operation for longer test }
	\label{mtl}
\end{figure}

\begin{figure}[ht]
	\begin{subfigure}[b]{0.5\linewidth}
		\centering
		\includegraphics[width=0.95\linewidth]{./figs/micro/unseen_longer_verify}
		\caption{Accuracies for verify task }
		\label{mtul1}
		\vspace{2ex}
	\end{subfigure}%%
	\begin{subfigure}[b]{0.5\linewidth}
		\centering
		\includegraphics[width=0.95\linewidth]{./figs/micro/unseen_longer_produce}
		\caption{Accuracies for produce task }
		\label{mtul2}
		\vspace{2ex}
	\end{subfigure}
	\caption{Micro Task accuracies per operation for unseen longer test }
	\label{mtul}
\end{figure}

\begin{figure}[ht]
	\begin{subfigure}[b]{0.5\linewidth}
		\centering
		\includegraphics[width=0.95\linewidth]{./figs/micro/base-verify-eps}
		\caption{Verify}
		\label{base-ver}
		\vspace{2ex}
	\end{subfigure}%%
	\begin{subfigure}[b]{0.5\linewidth}
		\centering
		\includegraphics[width=0.95\linewidth]{./figs/micro/base-prod-eps}
		\caption{Produce}
		\label{base-prod}
		\vspace{2ex}
	\end{subfigure}
	\caption{Attention plots for baseline on both verify and produce tasks. }
	\label{base-attn}
\end{figure}
The baseline clearly fails on the production tasks, as does the learned guidance. Unsurprisingly \lq or\rq{} is the easiest operation production task even for longer and unseen-longer test splits. (figures \ref{mtu2}, \ref{mtl2} and \ref{mtul2}). A probable explanation for this the fact that a model can solve an \lq or\rq{} task just by emitting a subsection of the longer string and thus increasing the length is inconsequential. The reason(s) behind the models performing worse on \lq and\rq{} as compared to \lq not\rq{} is not clear and is left as future work.

\begin{figure}[H]
	\begin{subfigure}[b]{0.5\linewidth}
		\centering
		\includegraphics[width=0.95\linewidth]{./figs/micro/learn-ver-eps}
		\caption{Verify}
		\label{learn-ver}
		\vspace{2ex}
	\end{subfigure}%%
	\begin{subfigure}[b]{0.5\linewidth}
		\centering
		\includegraphics[width=0.95\linewidth]{./figs/micro/learn-prod-eps}
		\caption{Produce}
		\label{learn-prod}
		\vspace{2ex}
	\end{subfigure}
	\caption{Attention plots for AG model on both verify and produce tasks. }
	\label{learn-attn}
\end{figure}

\section{Discussion}\label{mt:disc}
The huge chasm between the performance of the models with attentive guidance and hard guided models again brings to fore the argument I raised in section \ref{pm:disc}, that the current architectural setting is not optimal for learning the correct trace. This is substantiated by the attention plot for learned model in figure \ref{learn-prod}. The model's attention is diffused over the three target emissions and it leads to one wrong emission in the sequence. One striking observation from the attention plot of baseline for verification task (figure \ref{base-ver}) is that it utilizes only the witness string to make its decision.

It has already been discussed in the introduction to this chapter that the language $L$ proposed in this dataset $\notin NP$. However even for this language the results indicate that search (production) is more difficult than decision (verification) for a prover (a vanilla seq2seq model in our case). But the same vanilla seq2seq with additional hardcoded attention vectors can solve the search problem to a reasonable degree.


\chapter{Information Flow}
\label{ch:flow}

This chapter focuses on analyzing how the flow of data in \TMmodelName{} is related to \TMpotAcc{}.
As previously mentioned, the model does not directly capture application data; the transfer of application data is abstracted using the \NMreadFrom{} and \NMwroteTo{} definitions.
From these definitions, \TMmodelName{} defines what is \term{\TMmutated{}} through a sequence of operations.
It also supplies the \term{\TMmutable{}} judgment: a simple, permission-based definition of mutability by directly examining an access graph.
The remainder of the chapter examines how what is mutated through a sequence of operations is a subset of what is considered potentially mutable.
Naively, this is demonstrated by observing that all information flow occurs by the existence of a capability and that, for each operation, what is mutated is a subset of what is mutable in the direct access.
By capturing all potential capabilities, the computation of potential access has also captured all potential information flow.

\section{Mutation}

The semantics of \TMmodelName{} do not incorporate data values directly.
Instead, they define how data may flow during each operation through the use of the \COQreadFromSpec{} and \COQwroteToSpec{} relations.
As their names imply, the \COQreadFromSpec{} judgment indicates the potential information flow sources during an operation, and \COQwroteToSpec{} indicates the potential destinations.
A complete system implementation must demonstrate that its operations do not violate these judgments, providing implementations of \COQreadFrom{} and \COQwroteTo{} satisfying those specifications.

For review, the definition of \COQreadFromSpec{} and \COQwroteToSpec{} capture potential flows of both data and \TMcaps{}.
The simple \NMread{} and \NMwrite{} operations that have no impact on the \TMsystemState{} indicate data-only data motion.
Because \emph{it is possible to encode data using \TMcaps{}}, their potential transfers are considered as information flow.
While necessary for correctness, this is not the case for all models and many incorrectly label such flow as \emph{covert}.
Thus, the \TMfetch{} and \TMstore{} operations admit the same mutability as \COQread{} and \COQwrite{}.
\xmakefirstuc{\TMsending{}} a message may contain both data and \TMcaps{}, and has the same mutation as \COQwrite{}.
Like the \COQsend{} \TMop{}, \TMcreate{} is able to pass multiple \TMcaps{} and arbitrary data along for \TMobj{} instantiation.
The \COQrevoke{} \TMop{} has the same flow potential as \COQwrite{}.  In many systems the \TMrevoke{} command is performed by a \COQwrite{} of a trivially non-mutating \TMcap{}.
Though it alters the state of an \TMobj{}, the \COQdestroy{} \TMop{} is not modeled as effecting mutation upon that \TMobj{}.
When an \TMobj{} is destroyed, subsequent \TMops{} on that \TMobj{} do not admit any outward information flow, not even the state of the \TMobj{}.\footnote{This is hiding a subtle issue and is addressed in \Cref{ch:future}.}

\begin{figure}
  \COQDOCmutatedOpDef{}
  \COQDOCmutatedDef{}
  \caption{Definition of \COQmutated{}. \label{def:flow:mutated}}
\end{figure}

The \COQmutatedDef{} inductive models where information might flow during a sequence of operations.
Specifically, \COQmutatedDef{} considers the \TMobjs{} reachable by an initial subsystem in an initial \TMsystemState{}.
As a precondition, the initial subsystem must contain \TMobjs{} that are \TMalive{} or \TMdead{}.
The algorithm is initialized with the initial subsystem being the reachable subsystem, as all \TMobjs{} are considered self-mutating.
Each time an \TMop{} is performed the reachable subsystem is expanded to include the \COQwroteTo{} set if an element of the subsystem is present in the \COQreadFrom{} set.
After all \TMops{} have been executed, the resulting reachable subsystem contains all locations information in the initial subsystem could have reached as a result of that \TMop{} sequence.

\section{Mutability}

\begin{figure}
\COQDOCmutableSpec{}
\caption{Definition of \TMmutable{}. \label{def:flow:mutable}}
\end{figure}

In contrast to the flows that occur over operations, the abstract concept of possible mutation as authorized by \TMaccessRights{} is captured by the \COQmutable{} judgment.
Intuitively, most developers expect the potential for information transfer to be expressed using system permissions.
A definition of \COQmutable{} that relies on \COQmutated{} would defeat such intuitions as they have been captured by \TMpotAcc{} and the safety property.
Therefore, \COQmutable{} is defined simply by inspecting the permissions of an access graph, without considering possible operations.
If any \TMobj{} in the initial \TMsubsystem{} is the \TMedgeSource{} of a \NMwr{} or \NMtx{} \TMaccessEdge{}, the \TMedgeTarget{} is \TMmutable{} by the \TMsubsystem{}.
Additionally, if the \TMedgeTarget{} of a \NMrd{} or \NMwk{} \TMaccessEdge{} is in the initial \TMsubsystem{}, then \TMedgeSource{} is \TMmutable{} by the \TMsubsystem{}.

\begin{figure}
  \COQDOCmutableSpecSubset{}
  \COQDOCproperMutableSpec{}
  \caption{Properties of \TMmutable{}. \label{fig:flow:mutableProperties}}
\end{figure}

This definition of \TMmutable{} capturing the instantaneous information flow of each \TMaccessRight{} within any \TMaccessGraph{}.
\xmakefirstuc{\TMmutable{}} is monotonic over the \TMaccessGraph{}, following from the intuition that increasing \TMaccessRights{} increases \TMmutability{}.
This allows all proofs describing approximations over \TMaccessGraphs{} to be lifted to approximate \TMmutability{}.
The fact that a \TMsubsystem{} can self-mutate is captured directly.
\xmakefirstuc{\COQmutable{}} is also monotonic over the initial \TMsubsystem{}, causing it to be non-decreasing.
Applying \TMmutable{} to a \TMdirAccAG{} is called \TMdirAccMutability{} while applying it to \TMpotAccAG{} is called \TMpotAccMutability{}.
Because \TMdirAcc{} is a subset of \TMpotAcc{}, \TMdirAccMutability{} is a subset of \TMpotAccMutability{}.

\section{Operational Mutability}

The hypothesis that all direct mutation is captured by direct mutability and all potential mutation by potential mutability does not match the definition of \TMmutable{} because it does not capture any transitivity of information flow.
For \TMaccessGraph{} approximations to successfully capture \TMmutation{}, the opportunity to capture the transitivity of flow must occur when approximating \TMpotAcc{}.
Naively applying \COQmutable{} after each \TMpotAcc{} approximating operation produces an induction strategy based on \TMpotTransfer{}.
However, the induction strategy of \TMpotTransfer{} is insufficient to describe how \TMmutability{} grows from the initial \TMsubsystem{}.
Because \COQmutable{} is a static definition and does not describe how \TMmutability{} changes over \TMops{}, it cannot approximate \COQmutated{}.
A definition of \TMmutability{} that follows the induction strategy of \COQmutated{} is needed.

\begin{figure}
  \begin{center}
    \FIGgeneralApproxDirAccDep{}
  \end{center}

  \COQDOCgeneralMDirAccDep{}
  \COQDOCapproxDirAccDep{}
\caption{Figure and definition for \COQgeneralApproxDirAccDep{}. \label{fig:flow:generalApproxDirAccDep}}
\end{figure}

\Term{\TMmutableExecute} is the concept of folding \COQmutable{} over an \TMop{} sequence in the same manner as \COQmutated{}.
However, because \TMmutableExecute{} must be general enough to extend to all partial \TMpotTransfers{} approximating \COQdirAccExecute{}, it has a slightly complicated structure.
\COQgeneralApproxDirAccDep{} is constructed as a generalized form of \COQpotAccApproxDirAccDep{} that relates two \TMaccessGraph{} transformations by the function \coqvar{Fg}.
\COQpotAccApproxDirAccDep{} becomes the special case where \coqvar{Fg} is \COQpotAccFun{} and the related transformations are \COQdirAccExecute{} and \COQpotAccExecute{}.
\COQapproxDirAccDep{} places additional constraints on \COQgeneralApproxDirAccDep{}.
It requires all functions to be equivalence preserving and restricts \coqvar{Fg} to also be non-decreasing; these conditions are satisfied by all \TMpotTransfers{} and approximating functions.

\begin{figure}
  \COQDOCindexed
  \COQDOCmutableExecute
  \caption{Operational mutability. \label{fig:flow:mutableExecute}}
\end{figure}

\Term{\TMmutableExecute}, defined by \COQmutableExecute{} in \Cref{fig:flow:mutableExecute}, folds \COQmutable{} over each \TMop{} to aligns with the induction strategy of \TMmutated{}.
Unlike the static definition of \TMmutable{}, operational mutability is defined inductively over a list of \TMops{}.
Like \COQmutated{}, it starts with an initial system state and subsystem, and grows these based on what is statically \TMmutable{} after each step.
However, rather than determining what was \TMmutated{}, it is parameterized over a specification for approximating \COQdirAccExecute{} and a function relating this specification to \COQdirAccExecute{}, using \COQapproxDirAccDep{}.
Because the executable specification is a relation between \TMop{} lists and functions, the \COQindexed{} constraint ensures that all equivalent lists are related to equivalent functions.
As will all other general properties, this is a fairly trivial property for all relevant functions.

\begin{figure}
  \COQDOCProperMutableExecute{}
  \COQDOCmutableExecuteSubset{}
  \caption{Properties of operational mutability. \label{fig:flow:properMutableExecute}\label{fig:flow:mutatedExecute}}
\end{figure}

Operational Mutability has two very useful properties: it preserves \TMaccessGraph{} equivalence and subset relationships.
This generalization applies to any execution sequence in a step-wise approximating relationship with \COQdirAccExecute{}, including all \TMpotTransfer{} approximations including \COQpotAccExecute{}.
The proof that the operational mutability of \TMdirAcc{} approximations must be bounded by the operational mutability of \TMpotAcc{} approximations involves specializing these theorems correctly.
This result forms the foundation of information flow analysis for the remainder of this chapter.

\begin{figure}
  \COQDOCmutableDirAccExecute
  \COQDOCmutablePotAccExecute
  \COQDOCexistsMutableDirAccExecute
  \COQDOCexistsMutablePotAccExecute
  \COQDOCmutableExecuteDirAccSubsetPotAcc{}
  \caption{Specialized forms of \COQmutableExecute{}. \label{fig:flow:mutableExecuteSpecializations}}
\end{figure}

Operational mutability is specialized for \TMdirAcc{} approximations using the identity function and for \TMpotAcc{} approximations using \COQcomputePotAcc{}.
Specialized forms are constructed by simple instantiation and checking completeness.
For completeness, the proof that the \TMmutability{} of \COQpotAccExecute{} approximates the \TMmutability{} of \COQdirAccExecute{} is also instantiated.

\pagebreak[4]
\begin{figure}
  \centering
  \FIGmutableExecute{}
  \caption{Relationships between mutated and operational mutability. \label{fig:flow:mutatedMutable}}
\end{figure}

\section{Mutation is always Mutable}

\Cref{fig:flow:mutatedMutable} illustrates the relationship between \TMmutated{} and operational mutability as one induction strategy.
This diagram introduces some additional notation.
Sets of \TMrefs{} are depicted with drop-shadow diamonds for both \TMmutated{} and \TMmutable{} sets.
Also, the figure contains dashed lines to indicate portions of \TMmutableExecute{} that are not part of its definition, but are intended to connect to the definition.
The diagram has been flattened to appear sequential when this is not actually the case.
All functions are actually parameterized over the initial \TMsystemState{} and \TMdirAccAG{} and capture all possible functions approximating the whole \TMop{} sequence.
Though slightly overspecialized, the resulting diagram is more intuitive and more closely aligns with other diagrams in this document.

\xmakefirstuc{\TMmutablePotAccExecute} approximates \TMmutableDirAccExecute{}.
To show that \TMmutablePotAccExecute{} approximates what is \TMmutated{}, it is sufficient to show that \TMmutableDirAccExecute{} approximates what is \TMmutated{}.

\begin{figure}
\COQDOCmutableDirAccExecuteMutatedApprox{}
\COQDOCmutatedApproxMutablePotAccExecute{}
\caption{Approximations of Mutated \label{fig:flow:mutatedapprox}}
\end{figure}

It must be the case that \TMmutableDirAccExecute{} approximates \TMmutated{} by induction on \TMops{}.
Presume the \TMsubsystem{} analyzed for \TMmutableDirAccExecute{} is a superset of that analyzed for \TMmutation{}.
The prerequisite \TMcap{} for each \TMop{} is represented as a collection of \TMaccessEdges{} in the \TMdirAccAG{}.
By case analysis, the \TMmutability{} of these \TMaccessEdges{} directly capture the information flow possible for this \TMop{}.
However, \TMmutableDirAccExecute{} grows its subsystem by all possible \TMmutations{}, producing a superset of what was \TMmutated{}.
In the base case, nothing is \TMmutated{} and the \TMmutableDirAccExecute{} is simply direct \TMmutability{}, which is a superset of the initial \TMsubsystem{}.
Therefore, \TMmutableDirAccExecute{} approximates \TMmutated{}, and this result must extend to \TMmutablePotAccExecute{} using previous results.

\begin{figure}
\COQDOCAGProjectMaximal{} %  - AG\_project on a maximal accessgraph is also maximal.
\COQDOCmutableMaximal % - mutable on a maximal access graph does not change.
\COQDOCmutableProjectNotInEq % - operational mutability on maximal accessgraphs does not change through a projection where the allocator is not in the mutable set.
\COQDOCmutableProjectInEq % - operational mutability on maximal accessgraphs grows precicely by the allocated node when the allocator is within the mutable set.
\caption{Relationships of mutable in potential access approximations. \label{fig:flow:AGProjectMaximal}\label{fig:flow:mutableExecuteProp}}
\end{figure}

The remainder of this section describes how initial potential \TMmutability{} and \TMmutablePotAccExecute{} are related.
Specifically, the goal is to demonstrate that initial potential \TMmutability{} for existing \TMobjs{} will never change and subsumes all \TMmutablePotAccExecute{}.
This analysis begins by examining the relationships of \TMpotAcc{} approximations, as shown in \Cref{fig:flow:mutableExecuteProp}.
First, \COQmutable{} is a \TMmaximal{} result when applied to a \TMmaximal{} \TMaccessGraph{}, as shown in \COQmutableMaximal{}.
That is, each \TMpotAccAG{} has captured all potential information flow for existing objects and operational mutability does not grow for operations that do not alter \TMpotAcc{}.
Since \COQmutable{} preserves subset, it also can't be any smaller and must therefore be equal.
Second, operational mutability grows precisely with each \TMAGprojection{}, which occurs with each \TMallocation{}.
After a \TMAGprojection{}, \TMmutableExecute{} grows only by the allocated \TMobj{} exactly when the allocator is in the previous mutable set, otherwise it is unchanged.
That is, in the case of \COQallocate{}, operational mutability must only grow by precisely the allocated object when the allocator is \TMmutable{}.

These definitions rely upon the \COQobjExisted{} judgment that identifies those \TMobjs{} either \TMalive{} or \TMdead{} in a \TMsystemState{}.
\xmakefirstuc{\TMobjs} that existed must be kept disjoint from \TMobjs{} that are valid in a \TMAGprojection{}, as \TMAGprojecting{} to a previously existing \TMobj{} violates existing information flows.
In theorems not involving a \TMsystemState{}, the set of \TMobjs{} that existed is a free variable and \TMAGprojections{} are stated targeting references outside this set.
Although this pattern obliges the reader to remember hypotheses not present in the theorem definition, the theorems are more general and easier to apply.

\begin{figure}
\COQDOCmutablePotAccExecuteApprox % - potential operational mutability restricted to initially existing objects is bounded by initial potential mutability.
\COQDOCmutableApproxMutated % - mutated restricted to initially existing objects is bounded by initial potential mutability.
\caption{Initial \TMpotAccMutability{} and Initial \TMmutability{} are upper bounds on \TMmutation{} for existing \TMobjs{}. \label{fig:flow:mutableApproxMutated}}
\end{figure}

Both potential \TMmutability{}, and \TMmutablePotAccExecute{} only place an upper bound on the information flow between existing \TMobjs{}, and cannot describe what information flows will come to exist to new \TMobjs{}.
\xmakefirstuc{\TMmutablePotAccExecute} can only grow by the allocated \TMobj{}, such with the case of all \TMpotAcc{} approximating \TMops{}.
Therefore, the \TMmutablePotAccExecute{} between new \TMobjs{} cannot escalate the existing \TMmutablePotAccExecute{}, when restricted to existing \TMobjs{}, because these sets are disjoint.
At each step, the \TMmutablePotAccExecute{} restricted to the existing \TMobjs{} must remain constant.
In the base case, the \TMmutablePotAccExecute{} is identical to the potential \TMmutability{}.
Finally, by transitivity, what is initially potentially \TMmutable{} is an upper bound on all \TMmutation{} between existing \TMobjs{}.

This result enables analysis of a \TMsystemState{} to statically determine an upper bound on the future \TMmutability{} of all \TMsubsystems{} present by simply examining the initial potential \TMmutability{}.
Not only is \TMpotAcc{} relevant to solving the safety problem, but it also directly approximates potential \TMmutation{} through the \COQmutable{} judgment.
Both definitions are computable and decidable leading to a fully computable and decidable result that can be applied to reason about security policies.

The ability to successfully implement a security policy is dependent on the ability to model how changes in behavior impact the potential for information flow within a system.
The definition of \COQmutable{} is simple and follows directly from permission-based reasoning, yet its results form a persistent upper-bound on mutation through the life of the system.
By examining how restricting capabilities can restrict potential mutability, it is possible to model the behavior of application-based security policies such as confinement.


% This is part of the TFTB Reference Manual.
% Copyright (C) 1996 CNRS (France) and Rice University (US).
% See the file refguide.tex for copying conditions.

\markright{tfrsave}
\section*{\hspace*{-1.6cm} tfrsave}

\vspace*{-.4cm}
\hspace*{-1.6cm}\rule[0in]{16.5cm}{.02cm}
\vspace*{.2cm}

{\bf \large \sf Purpose}\\
\hspace*{1.5cm}
\begin{minipage}[t]{13.5cm}
Save the parameters of a time-frequency representation.
\end{minipage}
\vspace*{.3cm}

{\bf \large \sf Synopsis}\\
\hspace*{1.5cm}
\begin{minipage}[t]{13.5cm}
\begin{verbatim}
tfrsave(name,tfr,method,sig)
tfrsave(name,tfr,method,sig,t)
tfrsave(name,tfr,method,sig,t,f)
tfrsave(name,tfr,method,sig,t,f,p1)
tfrsave(name,tfr,method,sig,t,f,p1,p2)
tfrsave(name,tfr,method,sig,t,f,p1,p2,p3)
tfrsave(name,tfr,method,sig,t,f,p1,p2,p3,p4)
tfrsave(name,tfr,method,sig,t,f,p1,p2,p3,p4,p5)
\end{verbatim}
\end{minipage}
\vspace*{.4cm}

{\bf \large \sf Description}\\
\hspace*{1.5cm}
\begin{minipage}[t]{13.5cm}
        {\ty tfrsave} saves the parameters of a time-frequency
        representation in the file {\ty name.mat}. Two additional
        parameters are saved : {\ty TfrQView} and {\ty TfrView}. If you
        load the file {\ty name.mat} and do {\ty eval(TfrQView)}, you will
        restart the display session under {\ty tfrqview} ; if you do {\ty
        eval(TfrView)}, you will display the representation by means of
        {\ty tfrview}.\\

\hspace*{-.5cm}\begin{tabular*}{14cm}{p{1.5cm} p{8.5cm} c}
Name & Description & Default value\\
\hline
        {\ty name}   & name of the mat-file (less than 8 characters)\\
        {\ty tfr}    & time-frequency representation {\ty (M,N)}\\
        {\ty method} & chosen representation\\
        {\ty sig}    & signal from which the {\ty tfr} was obtained\\
        {\ty t}      & time instant(s)           & {\ty (1:N)}\\
        {\ty f}      & frequency bins            & {\ty 0.5*(0:M-1)/M}\\
        {\ty p1..p5} & optional parameters : run {\ty tfrparam(method)}
                 to know the meaning of {\ty p1..p5} for your method\\

\hline
\end{tabular*}

\end{minipage}
\vspace*{.5cm}

{\bf \large \sf Example}
\begin{verbatim}
         sig=fmlin(64); tfr=tfrwv(sig);
         tfrsave('wigner',tfr,'TFRWV',sig,1:64);
         clear; load wigner; eval(TfrQView);
\end{verbatim}
\vspace*{.5cm}

{\bf \large \sf See Also}\\
\hspace*{1.5cm}
\begin{minipage}[t]{13.5cm}
\begin{verbatim}
tfrqview, tfrview, tfrparam.
\end{verbatim}
\end{minipage}