%% if you are submitting an initial manuscript then you should have submission as an option here
%% if you are submitting a revised manuscript then you should have revision as an option here
%% otherwise options taken by the article class will be accepted
\documentclass[finalversion]{FPSAC2025}
\articlenumber{33}
%% but DO NOT pass any options (or change anything else anywhere) which alters page size / layout / font size etc
\appto\bibfont{\setlength{\emergencystretch}{.5em}}
%% note that the class file already loads {amsmath, amsthm, amssymb}



\usepackage{amsfonts,amscd,euscript}
\usepackage{enumitem}
\usepackage{tikz}
\usepackage{tikz-cd}
\usepackage{mathrsfs} %for mathscr
\usepackage{thmtools}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{color}
\usepackage{cleveref}
\usepackage{comment}
\usepackage{float}
\usetikzlibrary{shapes}
\usetikzlibrary{tikzmark}
\usepackage{mathtools}
\usepackage{listofitems}
\usepackage{wrapfig}
\usepackage{stmaryrd}
\usepackage{fp}

%--------Theorem Environments--------
%theoremstyle{plain} --- default
\newtheorem{thm}{Theorem}[section]
\newtheorem{cor}[thm]{Corollary}
\newtheorem{prop}[thm]{Proposition}
\newtheorem{lem}[thm]{Lemma}
\newtheorem{conj}[thm]{Conjecture}
\newtheorem{ques}[thm]{Question}
\newtheorem{prob}[thm]{Problem}
\newtheorem{answ}[thm]{Answer}

\theoremstyle{definition}
\newtheorem{defn}[thm]{Definition}
\newtheorem{defns}[thm]{Definitions}
\newtheorem{con}[thm]{Construction}
\newtheorem{exmp}[thm]{Example}
\newtheorem{exmps}[thm]{Examples}
\newtheorem{notn}[thm]{Notation}
\newtheorem{notns}[thm]{Notations}
\newtheorem{addm}[thm]{Addendum}
\newtheorem{fact}[thm]{Fact}
\newtheorem{exer}[thm]{Exercise}

\theoremstyle{remark}
\newtheorem{rem}[thm]{Remark}
\newtheorem{rems}[thm]{Remarks}
\newtheorem{obs}[thm]{Observation}
\newtheorem{warn}[thm]{Warning}
\newtheorem{sch}[thm]{Scholium}



%-------Shortcuts--------------------------
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Hy}{\mathbb{H}}
\newcommand{\calA}{\mathcal{A}}
\newcommand{\calB}{\mathcal{B}}
\newcommand{\calC}{\mathcal{C}}
\newcommand{\calD}{\mathcal{D}}
\newcommand{\calF}{\mathcal{F}}
\newcommand{\calG}{\mathcal{G}}
\newcommand{\calH}{\mathcal{H}}
\newcommand{\calI}{\mathcal{I}}
\newcommand{\calJ}{\mathcal{J}}
\newcommand{\calP}{\mathcal{P}}
\newcommand{\calR}{\mathcal{R}}
\newcommand{\calX}{\mathcal{X}}
\newcommand{\frakd}{\mathfrak{d}}
\newcommand{\frakm}{\mathfrak{m}}
\newcommand{\frakp}{\mathfrak{p}}
\newcommand{\frakD}{\mathfrak{D}}
\renewcommand{\phi}{\varphi}
\renewcommand{\epsilon}{\varepsilon}
\newcommand{\Th}{\text{th}}
\newcommand{\Rot}{Rot}
\newcommand{\tp}{top}
\newcommand{\east}{\mathbf{E}}
\newcommand{\north}{\mathbf{N}}
\DeclareMathOperator{\sh}{sh}
\DeclareMathOperator{\Supp}{Supp}
\DeclareMathOperator{\conv}{conv}
\DeclareMathOperator{\rank}{rank}
\DeclareMathOperator{\Mono}{Mono}
\DeclareMathOperator{\ins}{ins}
\DeclareMathOperator{\cut} { \setminus}
\DeclareMathOperator{\rot}{rot}
\DeclareMathOperator{\rep}{rep}
\DeclareMathOperator{\peak}{peak}
\DeclareMathOperator{\inv}{inv}
\DeclareMathOperator{\CC}{CC}
\DeclareMathOperator{\CG}{CG}
\DeclareMathOperator{\CCO}{CC_\circ}
\DeclareMathOperator{\BL}{BL}
\DeclareMathOperator{\wt}{wt}

%% define your title in the usual way
\title{A combinatorial formula for rank 2 scattering diagrams}

%% define your authors in the usual way
%% use \addressmark{1}, \addressmark{2} etc for the institutions, and use \thanks{} for contact details
%% for more than 3 names, use the Oxford comma: One Author, Two Author, Red Author, \and Blue Author
\author{\texorpdfstring{Amanda Burcroff\thanks{\href{mailto:aburcroff@math.harvard.edu}{aburcroff@math.harvard.edu} Amanda Burcroff was supported by the NSF GRFP (grant DGE 2140743) and the Jack Kent Cooke Foundation.}\addressmark{1}, Kyungyong Lee\thanks{\href{mailto:klee94@ua.edu}{klee94@ua.edu} Kyungyong Lee was supported by the University of Alabama, Korea Institute for Advanced Study, and the NSF grants DMS 2042786 and DMS 2302620.}\addressmark{2}, \and Lang Mou\thanks{\href{langmou@math.uni-koeln.de}{langmou@math.uni-koeln.de} Lang Mou was supported by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) -- Project-ID 281071066 -- TRR 191.}\addressmark{3}}{Amanda Burcroff, Kyungyong Lee, and Lang Mou}}

%% then use \addressmark to match authors to institutions here
\address{\addressmark{1}Department of Mathematics, Harvard University\\ \addressmark{2}Department of Mathematics, University of Alabama \& Korea Institute for Advanced Study\\ \addressmark{3}Mathematical Institute, University of Cologne}

%% put the date of submission here
\received{\today}

%% leave this blank until submitting a revised version
%\revised{}

%% put your English abstract here, or comment this out if you don't have one yet
%% please don't use custom commands in your abstract / resume, as these will be displayed online
%% likewise for citations -- please don't use \cite, and instead write out your citation as something like (author year)
\abstract{Cluster algebras are celebrated for their intriguing positivity properties. Combining two distinct approaches to positivity, we give a directly computable, manifestly positive, and elementary (yet highly nontrivial) formula describing generalized cluster scattering diagrams in rank 2.  This formula enumerates new combinatorial objects called tight gradings on maximal Dyck paths, inspired by the greedy basis construction for cluster algebras.  Using the positivity of rank 2 generalized cluster scattering diagrams, we prove the Laurent positivity of generalized cluster algebras of all ranks, resolving a conjecture of Chekhov--Shapiro from 2014.}

%% put your French abstract here, or comment this out if you don't have one
%\resume{\lipsum[2]}

%% put your keywords here, or comment this out if you don't have them yet
\keywords{scattering diagrams, generalized cluster algebras, positivity}

%% you can include your bibliography however you want, but using an external .bib file is STRONGLY RECOMMENDED and will make the editor's life much easier
%% regardless of how you do it, please use numerical citations; i.e., [xx, yy] in the text

%% this sample uses biblatex, which (among other things) takes care of URLs in a more flexible way than bibtex
%% but you can use bibtex if you want
\usepackage[backend=bibtex, giveninits]{biblatex}
\addbibresource{FPSAC_bibliography.bib}
%% note the \printbibliography command at the end of the file which goes with these biblatex commands

\begin{document}

\maketitle
%% note that you DO NOT have to put your abstract here -- it is generated by \maketitle and the \abstract and \resume commands above
\section{Introduction}
\emph{Scattering diagrams} (or \emph{wall-crossing structures}) emerged from efforts to construct mirror manifolds \cite{KS,GS} growing out of the Strominger--Yau--Zaslow conjecture \cite{SYZ} in mirror symmetry. Since then, this structure has also been utilized to encode enumerative geometric invariants and categorical invariants that count stable objects. These two themes have notably overlapped in the \emph{cluster algebras} discovered by Fomin and Zelevinsky \cite{FZ} and subsequent studies, where the techniques of scattering diagrams are fundamental in solving problems in algebraic combinatorics \cite{GHKK}.



Cluster algebras, originally devised as a combinatorial framework to address total positivity and (dual) canonical bases in Lie theory, have themselves given rise to a wide range of intriguing algebraic and combinatorial questions. Among these, one of the most notable is the \emph{positivity phenomenon}, conjectured by Fomin and Zelevinsky \cite[Section 3]{FZ}. After remaining unsolved for over a decade, this positivity was first proven by Lee and Schiffler \cite{LSpositive} in the generality for all skew-symmetric cluster algebras using an explicit rank-2 formula that sums over compatible pairs on Dyck paths. This breakthrough led to the construction of the \emph{greedy basis} by Lee, Li and Zelevinsky \cite{LLZ}.



In their seminal work \cite{GHKK}, Gross, Hacking, Keel, and Kontsevich introduced ideas and tools from log Calabi--Yau mirror symmetry, including scattering diagrams, broken lines, and theta functions, into the study of cluster algebras. %To a large extent, they constructed the canonical (or theta) basis, whose elements, known as theta functions, are parametrized by the integral tropical points in the dual $\mathcal X$-cluster variety. 
Due to the positivity of the scattering diagram developed in \cite{GHKK}, the theta functions, which contain all cluster monomials, satisfy Laurent positivity. For the same reason, their multiplicative structure constants are also positive, a property referred to as \emph{strong positivity}. We combine and extend the methods of Lee--Schiffler \cite{LS, LSpositive} and Gross--Hacking--Keel--Kontsevich \cite{GHKK} to derive new positivity results for generalized cluster algebras \cite{CS}.


In this extended abstract, a scattering diagram in a real vector space is defined as a collection of codimension-one rational cones, referred to as \emph{walls}, each associated with a formal power series, called a \emph{wall-function}. We first focus on rank-$2$ generalized cluster scattering diagrams in $\mathbb R^2$, defined as the consistent completion of an initial scattering diagram with two coordinate axes having wall-functions respectively polynomials $P_1$ and $P_2$. The wall-function $f_{(a, b)}(P_1, P_2)$ on the ray $\mathbb R_{\leq 0}(a, b)$ for any positive coprime integers $(a, b)$ is notoriously difficult to compute, even when $P_1$ and $P_2$ are binomials of low degrees. Although there are Coxeter-type symmetries and cluster-type discrete structures governing the appearance of some rays \cite{GP}, little is known about the wall-functions in a 2-dimensional sector known as the "Badlands", when $\deg P_1 \cdot \deg P_2 > 4$.




In \Cref{sec: first main thm}, we present a directly computable, manifestly positive, elementary, yet highly nontrivial formula describing all wall-functions $f_{(a,b)}({P}_1,{P}_2)$. We show that each coefficient of the wall-functions enumerates a new class of combinatorial objects that we call \emph{tight gradings} on a maximal Dyck path. The \emph{maximal Dyck path} $\calP(m,n)$ is the lattice path from $(0,0)$ to $(m,n)$ that is closest to the main diagonal, without crossing strictly above it.  A \emph{grading} on $\calP(m,n)$ is an assignment of a nonnegative integer value to each edge of $\calP(m,n)$.  A grading is \emph{tight} if it satisfies a certain combinatorial compatibility
condition (see \Cref{sec: tight grading} for precise details). 

\newcommand{\vrec}[3]{%
  \FPeval{\newz}{trunc(#3,0)-1} 
  \foreach \i in {0,...,\newz} {%
    \fill[cyan] (#1 + 0.2, #2  + 0.2 + 2 * \i) -- (#1 + 0.2, #2 + 1.8 + 2 * \i) -- (#1 + 0.8, #2 + 1.8 + 2 * \i) -- (#1 + 0.8, #2 + 0.2 + 2 * \i) -- (#1 + 0.2, #2 + 0.2 + 2 * \i);%
  }%
}

\newcommand{\hrec}[3]{%
  \FPeval{\newz}{trunc(#3,0)-1} 
  \foreach \i in {0,...,\newz} {%
    \fill[red] (#1 - 0.2 - 3 * \i, #2 + 0.2) -- (#1 - 2.8 - 3 * \i, #2 + 0.2) -- (#1 - 2.8 - 3 * \i, #2 + 0.8) -- (#1 - 0.2 - 3 * \i, #2 + 0.8) -- (#1 - 0.2 - 3 * \i, #2 + 0.2);%
  }%
}




\begin{wrapfigure}{r}{0.27\textwidth}
\centering
\begin{tikzpicture}[scale=.3]
\draw[step=1,color=gray] (0,0) grid (14,9);
\draw[line width=2,color=orange] (0,0)--(2,0)--(2,1)--(3,1)--(3,2)--(5,2)--(5,3)--(6,3)--(6,4)--(8,4)--(8,5)--(10,5)--(10,6)--(11,6)--(11,7)--(13,7)--(13,8)--(14,8)--(14,9);
\vrec{0}{0}{4}
\vrec{1}{0}{2}
\vrec{2}{1}{1}
\vrec{6}{4}{1}
\hrec{13}{7}{4}
\hrec{11}{6}{3}
\hrec{10}{5}{1}
\hrec{6}{3}{1}
\draw[line width=2pt] (0,0)--(2,0);
\draw[line width=2pt] (2,1)--(3,1);
\draw[line width=2pt] (6,4)--(7,4);
\draw[line width=2pt] (6,3)--(6,4);
\draw[line width=2pt] (10,5)--(10,6);
\draw[line width=2pt] (11,6)--(11,7);
\draw[line width=2pt] (13,7)--(13,8);
\end{tikzpicture}
\caption{\emph{A tight grading.}}
\label{fig: intro tight grading}
\end{wrapfigure} 
Pictorially, tight gradings can be represented as "tilings" by rectangles on rotations of the maximal Dyck path, as in the image to the right. The size of the first rectangle extending from each edge corresponds to its value in the grading.  The relatively small space between the (light) blue and (dark) red rectangles encodes the tightness condition, and the fact that the rectangles are disjoint encodes the compatibility condition.

\begin{thm}
In a generalized cluster scattering diagram of rank $2$, each coefficient of the wall-function $f_{(a,b)}({P}_1,{P}_2)$ is equal to the sum of weights of the corresponding tight gradings on some maximal Dyck path. 
\end{thm}


In \cite{GPS}, the coefficients in $\log f_{(a, b)}$ are proven to be interpreted by relative Gromov--Witten invariants on toric surfaces. Therefore the above theorem yields a combinatorial formula for computing these Gromov--Witten invariants in terms of tight gradings.

In \Cref{sec: tight grading}, we define tight gradings.  \Cref{sec: sd} contains preliminaries on rank-2 scattering diagrams, focusing on the generalized cluster case.  We present our explicit formula for wall-function coefficients in terms of tight gradings in \Cref{sec: first main thm}.  We then discuss applications of this formula in \Cref{sec: applications}, including showing that the Badlands wall-functions are all non-trivial and proving the Laurent positivity of generalized cluster algebras of all ranks. Further details can be found in our preprints \cite{BLMshort} and \cite{BLM}.


\section{Tight gradings}\label{sec: tight grading}

In this section, we introduce combinatorial objects called \emph{tight gradings} that are central to our main results.  Tight gradings form a subset of the compatible gradings defined by Rupel \cite{Rupgengreed} and inspired by the compatible pairs of Lee--Li--Zelevinsky \cite{LLZ} (see \Cref{sec: tight grading}).


Fix $m,n \in \N = \Z_{\geq 0}$. Consider a rectangle with vertices $(0,0)$, $(0,n)$, $(m,0)$, and $(m,n)$ with a main diagonal from $(0,0)$ to $(m,n)$.  

\begin{defn}%\label{defn: Dyckpat}
  A \emph{Dyck path} $\calP$ is a lattice path in $(\mathbb{Z}\times \mathbb{R})\cup(\mathbb{R}\times \mathbb{Z})\subset \mathbb{R}^2$ starting at $(0,0)$ and ending at $(m,n)$, proceeding by only unit north and east steps and never passing strictly above the main diagonal. We also view $\mathcal P$ as the set of its unit north and east steps, where we refer to each step as an \emph{edge}. 
  
  Given a set $C$ of edges in $\calP$, we denote the set of horizontal edges (east steps) by $C_\east$ and the set of vertical edges (north steps) by $C_\north$.  We let $|C|$ denote the number of edges in $C$. For edges $e$ and $f$ in $\calP$, let $\overrightarrow{ef}$ denote the subpath proceeding east from $e$ to $f$ (including both $e$ and $f$), continuing cyclically around $\calP$ if $e$ is to the north or east of $f$.
\end{defn}


The Dyck paths from $(0,0)$ to $(m,n)$ form a partially ordered set by comparing the heights at all vertices.  The \emph{maximal Dyck path} $\calP(m,n)$ is the maximal element under this partial order. When $m$ and $n$ are relatively prime,  the maximal Dyck path $\calP(m,n)$ corresponds to the lower Christoffel word of slope $n/m$.  We label the horizontal edges from left to right by $u_1,u_2,\dots,u_m$ and the vertical edges from bottom to top by $v_1,v_2,\dots,v_n$.


\begin{exmp} In \Cref{fig: compatible grading example}, the maximal Dyck path $\calP(6,4)$ is shown in the top left and $\calP(7,4)$ is shown in the top right.
\end{exmp}


Motivated by Lee--Schiffler \cite{LS}, 
Lee, Li, and Zelevinsky \cite{LLZ} introduced combinatorial objects called \emph{compatible pairs} to construct the \emph{greedy basis} for rank-$2$ cluster algebras, consisting of indecomposable positive elements including the cluster monomials. Rupel \cite{Rupgengreed, Rup2} extended this construction to the setting of \emph{generalized} rank-$2$ cluster algebras by defining \emph{compatible gradings}.

A function  from the set of edges on $\mathcal{P}(m,n)$ to $\N$ is called a \emph{grading}.   For any grading $\omega$ and for any set of edges $S \subset \mathcal{P}$, let $\displaystyle \omega(S) \coloneqq \sum_{e\in S} \omega(e)$. 

\begin{defn}
    A grading $\omega:\calP \longrightarrow \N$  is called \emph{compatible} if for every pair of $u\in \calP_\east$ and $v\in \calP_\north$ with $\omega(u)\omega(v)>0$, there exists an edge $e$ along the subpath $\overrightarrow{uv}$ so that at least one of the following holds:
    \begin{equation}\label{0407df:comp}
      \aligned
&    e\in \calP_\north\setminus\{v\} \quad \text{and} \quad |\overrightarrow{ue}_\north|=\omega\left(\overrightarrow{ue}_\east\right);\\
 &   e\in \calP_\east\setminus\{u\} \quad \text{and} \quad |\overrightarrow{ev}_\east|=\omega\left(\overrightarrow{ev}_\north\right).
    \endaligned
    \end{equation}

\end{defn} 
\begin{exmp}\label{main_exmp}
For each $i\in\{1,2,3\}$, let $\omega_i: \calP(i+5,4)\longrightarrow \N$  be the grading given by $\omega_i(u_1)=\omega_i(u_2)=2$, $\omega_i(v_3)=\omega_i(v_4)=3$, and $\omega_i(e)=0$ for every edge $e$ in $\calP(i+5,4)\setminus\{u_1,u_2,v_3,v_4\}$ (see \Cref{fig: compatible grading example} for $i = 1,2$). Then $\omega_1$ is not compatible, but $\omega_2$ and $\omega_3$ are compatible. The main difference between $\omega_1$ and $\omega_2$ is that the edge $e=u_2$ in $\calP(7,4)$ satisfies the second condition in (\ref{0407df:comp}) for $u = u_1$ and $v = v_4$, as both sides of the equation equal $6$.
\end{exmp}  

\begin{figure}[hb]
\centering
\captionsetup{width=.9\linewidth}
\begin{tikzpicture}[scale=.6]
\draw[step=1,color=gray] (0,0) grid (6,4);
\draw[line width=2,color=orange] (0,0)--(2,0)--(2,1)--(3,1)--(3,2)--(5,2)--(5,3)--(6,3)--(6,4);
\draw[line width=2pt] (0,0)--(1,0);
\draw (0.5,0.85) node[anchor=north]  {\small $2$};
\draw[line width=2pt] (1,0)--(2,0);
\draw (1.5,0.85) node[anchor=north]  {\small $2$};
\draw[line width=2pt] (6,4)--(6,3);
\draw (6,3.5) node[anchor=west]  {\small $3$};
\draw[line width=2pt] (5,3)--(5,2);
\draw (5,2.5) node[anchor=west]  {\small $3$};
%\draw (3,-1) node[anchor=north] {Figure 2};
%
%
\begin{scope}[shift={(10,0)}]
\draw[step=1,color=gray] (0,0) grid (7,4);
\draw[line width=2,color=orange] (0,0)--(2,0)--(2,1)--(4,1)--(4,2)--(6,2)--(6,3)--(7,3)--(7,4);
%\draw (0,0) node[anchor=east]  {$E$}; 
%\draw (7,4) node[anchor=south]  {$F$};
%
%\draw (0,0) node[anchor=north east]  {\tiny$0$};
\draw[line width=2pt] (0,0)--(1,0);
\draw (0.5,0.85) node[anchor=north]  {\small $2$};
\draw[line width=2pt] (1,0)--(2,0);
\draw (1.5,0.85) node[anchor=north]  {\small $2$};
\draw[line width=2pt] (7,4)--(7,3);
\draw (7,3.5) node[anchor=west]  {\small $3$};
\draw[line width=2pt] (6,3)--(6,2);
\draw (6,2.5) node[anchor=west]  {\small $3$};
%\draw (3,-1) node[anchor=north] {Figure 3};
%
\end{scope}
\begin{scope}[shift={(0,-4.5)}]
\draw[step=1,color=gray] (0,0) grid (6,4);
\fill[cyan] (0.2,0.2)--(0.2,1.8)--(0.8,1.8)--(0.8,0.2)--(0.2,0.2);
\fill[cyan] (1.2,0.2)--(1.2,1.8)--(1.8,1.8)--(1.8,0.2)--(1.2,0.2);
\fill[cyan] (0.2,2.2)--(0.2,2+1.8)--(0.8,2+1.8)--(0.8,2+0.2)--(0.2,2+0.2);
\fill[red] (3.2-1,3.2-1)--(3.2-1,3.8-1)--(5.8-1,3.8-1)--(5.8-1,3+0.2-1)--(3.2-1,3.2-1);
\fill[red] (3.2+1-1,3.2)--(3.2+1-1,3.8)--(5.8+1-1,3.8)--(5.8+1-1,3+0.2)--(3.2+1-1,3.2);
\fill[red] (3.2+1-3-1,3.2)--(3.2+1-3-1,3.8)--(5.8+1-3-1,3.8)--(5.8+1-3-1,3+0.2)--(3.2+1-3-1,3.2);
\fill[black] (3.2+1-3-1,3.2)--(3.2+1-3-1,3.8)--(3.8+1-3-1,3.8)--(3.8+1-3-1,3+0.2)--(3.2+1-3-1,3.2);
\draw[line width=2,color=orange] (0,0)--(2,0)--(2,1)--(3,1)--(3,2)--(5,2)--(5,3)--(6,3)--(6,4);
%\draw (0,0) node[anchor=east]  {$E$}; 
%\draw (6,4) node[anchor=south]  {$F$};
%
%\draw (0,0) node[anchor=north east]  {\tiny$0$};
\draw[line width=2pt] (0,0)--(1,0);
%\draw (0.5,1) node[anchor=north]  {\tiny$u_1$};
\draw[line width=2pt] (1,0)--(2,0);
%\draw (1.5,1) node[anchor=north]  {\tiny$u_2$};
\draw[line width=2pt] (6,4)--(6,3);
%\draw (6,3.5) node[anchor=west]  {\tiny$v_4$};
\draw[line width=2pt] (5,3)--(5,2);
%\draw (5,2.5) node[anchor=west]  {\tiny$v_3$};
%\draw (3,-1) node[anchor=north] {Figure 2};
%
%
\begin{scope}[shift={(10,0)}]
\draw[step=1,color=gray] (0,0) grid (7,4);
\draw[line width=2,color=orange] (0,0)--(2,0)--(2,1)--(4,1)--(4,2)--(6,2)--(6,3)--(7,3)--(7,4);
%\draw (0,0) node[anchor=east]  {$E$}; 
%\draw (7,4) node[anchor=south]  {$F$};
%
%\draw (0,0) node[anchor=north east]  {\tiny$0$};
\draw[line width=2pt] (0,0)--(1,0);
%\draw (0.5,1) node[anchor=north]  {\tiny$u_1$};
\draw[line width=2pt] (1,0)--(2,0);
%\draw (1.5,1) node[anchor=north]  {\tiny$u_2$};
\draw[line width=2pt] (7,4)--(7,3);
%\draw (7,3.5) node[anchor=west]  {\tiny$v_4$};
\draw[line width=2pt] (6,3)--(6,2);
%\draw (6,2.5) node[anchor=west]  {\tiny$v_3$};
%\draw (3,-1) node[anchor=north] {Figure 3};
%
%\fill[blue!10] (0.1,0.1)--(0.1,1.9)--(0.9,1.9)--(0.9,0.1)--(0.1,0.1);
\fill[cyan] (0.2,0.2)--(0.2,1.8)--(0.8,1.8)--(0.8,0.2)--(0.2,0.2);
\fill[cyan] (1.2,0.2)--(1.2,1.8)--(1.8,1.8)--(1.8,0.2)--(1.2,0.2);
\fill[cyan] (0.2,2.2)--(0.2,2+1.8)--(0.8,2+1.8)--(0.8,2+0.2)--(0.2,2+0.2);
\fill[red] (3.2,3.2-1)--(3.2,3.8-1)--(5.8,3.8-1)--(5.8,3+0.2-1)--(3.2,3.2-1);
\fill[red] (3.2+1,3.2)--(3.2+1,3.8)--(5.8+1,3.8)--(5.8+1,3+0.2)--(3.2+1,3.2);
\fill[red] (3.2+1-3,3.2)--(3.2+1-3,3.8)--(5.8+1-3,3.8)--(5.8+1-3,3+0.2)--(3.2+1-3,3.2);
\end{scope}
\end{scope}
\end{tikzpicture}
\caption{In the top images, we depict gradings $\omega_1$ and $\omega_2$ on the Dyck paths $\calP(6,4)$ and $\calP(7,4)$ from \Cref{main_exmp}. Below, we depict the corresponding rectangular tilings.  The grading $\omega_1$ has overlapping rectangles and hence is not compatible, while the grading $\omega_2$ is.
} 
\label{fig: compatible grading example}
\end{figure}

In their study of compatible pairs, Lee, Li, and Zelevinsky \cite{LLZ} introduced the notion of the "shadow" of a set of edges, which Rupel \cite{Rup2} extended to the setting of gradings. 

\begin{defn}\label{def: shadow}
Fix a maximal $\calP$ and a grading $\omega \colon \calP \rightarrow \N$.
For each edge $e$ in $\calP$, we define its \emph{shadow}, denoted by $\sh(e)$, as follows. 
\begin{itemize}
    \item If $e$ is horizontal, then its shadow is $\overrightarrow{ev}_\north$, where $v \in \calP_\north$ is chosen such that $\overrightarrow{ev}$ has minimal length with $|\overrightarrow{ev}_\north| = \omega(\overrightarrow{ev}_\east)$.  If no such $v$ exists, let $\sh(e) = \calP_\north$.
    \item If $e$ is vertical, then its shadow is $\overrightarrow{ue}_\east$, where $u \in \calP_\east$ is chosen such that $\overrightarrow{ue}$ has minimal length with $|\overrightarrow{ue}_\east| = \omega(\overrightarrow{ue}_\north)$.  If no such $u$ exists, let $\sh(e) = \calP_\east$.
\end{itemize}  
For $S \subset \calP$, let the \emph{shadow} of $S$ be $\displaystyle \sh(S)=\bigcup_{e\in S} \sh(e)$. 
\end{defn}



\begin{exmp}
   Consider $\omega_2$ as in  \Cref{main_exmp}. Then $\sh(v_3)=\{u_4,u_5,u_6\}$ and $\sh(v_4)=\{u_2,u_3,\dots,u_7\}=\sh(\calP_\north)$. 
\end{exmp}


Partially motivated by \cite{BL}, we discovered the following definition.

\begin{defn}\label{main_def} Let $\omega$ be a grading on $\calP = \calP(m,n)$ with $p = \omega(\calP_\north)$ and $q = \omega(\calP_\east)$.  The grading $\omega$ is a \emph{tight grading} if $\omega$ is a compatible grading satisfying $p \leq m$, $q \leq n$,
$$\left|pn - qm\right| = \gcd(p,q)\,,$$
and at least one of
$$S_\east \subseteq\sh(\calP_\north)\text{ or } S_\north \subseteq\sh(\calP_\east)\,,$$
where $S$ is the set of edges $e$ with $\omega(e)>0$.
\end{defn}

We can represent compatible gradings as rectangular tilings as follows. First, rotate (i.e. cyclically shift) the maximal Dyck path so that the shadow of each horizontal (resp. vertical) edge does not extend beyond the left (resp. top) boundary of the rotated path. Such a rotation always exists for tight gradings.  Then draw blue rectangles above each horizontal edge $e$ with total height equal to the size of the shadow of $e$, partitioned into the vertical grading values contributing to the shadow.  Similarly, we draw red rectangles to the left of each edge in $\calP_\north$.  The grading is compatible only if the resulting rectangles are non-overlapping.  The condition on the shadows can be easily read off by seeing if every blue rectangle has a red rectangle above, or if every red rectangle has a blue rectangle to the left.  





\begin{exmp}\label{tight_exmp}
(1) The grading $\omega_2$ as in \Cref{main_exmp} is not tight despite $S_\north \subseteq\sh(\calP_\east)$, because $(m,n)=(7,4)$ does  not satisfy $\beta_1 n - \beta_2 m = \pm\gcd(\beta_1,\beta_2)$ for $(\beta_1,\beta_2)=(6,4)$.



\noindent (2) Let $(\beta_1,\beta_2)=(2,1)$ and $(m,n)=(3,1)$. Consider $\mathcal{P}(3,1)$.
\begin{tikzpicture}[scale=.3]
\draw[step=1,color=gray] (0,0) grid (3,1);
\draw[line width=2,color=orange] (0,0)--(3,0)--(3,1);
\fill[cyan] (0.2,0.2)--(0.2,0.8)--(0.8,0.8)--(0.8,0.2)--(0.2,0.2);
\fill[red] (1.2,0.2)--(1.2,0.8)--(2.8,0.8)--(2.8,0.2)--(1.2,0.2);
\draw[line width=2pt] (0,0)--(1,0);
\draw[line width=2pt] (3,0)--(3,1);
\end{tikzpicture}
Suppose that $\omega(u_1)=1$, $\omega(u_2)=\omega(u_3)=0$, and $\omega(v_1)=2$. Then $\omega$ is tight. 

\noindent (3) Let $(\beta_1,\beta_2)=(4,2)$ and $(m,n)=(5,2)$. Consider $\mathcal{P}(5,2)$.
\begin{tikzpicture}[scale=.3]
\draw[step=1,color=gray] (0,0) grid (5,2);
\draw[line width=2,color=orange] (0,0)--(3,0)--(3,1)--(5,1)--(5,2);
\fill[cyan] (0.2,0.2)--(0.2,0.8)--(0.8,0.8)--(0.8,0.2)--(0.2,0.2);
\fill[cyan] (1+0.2,0.2)--(1+0.2,0.8)--(1+0.8,0.8)--(1+0.8,0.2)--(1+0.2,0.2);
\fill[cyan] (0.2,1+0.2)--(0.2,1+0.8)--(0.8,1+0.8)--(0.8,1+0.2)--(0.2,1+0.2);
\fill[red] (2.2,0.2)--(2.2,0.8)--(2.8,0.8)--(2.8,0.2)--(2.2,0.2);
\fill[red] (2.2-1,1+0.2)--(2.2-1,1+0.8)--(2.8-1,1+0.8)--(2.8-1,1+0.2)--(2.2-1,1+0.2);
\fill[red] (2.2,1+0.2)--(2.2,1+0.8)--(4.8,1+0.8)--(4.8,1+0.2)--(2.2,1+0.2);
\draw[line width=2pt] (0,0)--(2,0);
\draw[line width=2pt] (3,0)--(3,1);
\draw[line width=2pt] (5,1)--(5,2);
\end{tikzpicture}
Suppose that $\omega(u_1)=\omega(u_2)=\omega(v_1)=1$, $\omega(v_2)=3$, and $\omega(u_3)=\omega(u_4)=\omega(u_5)=0$. Then $\omega$ is tight. 

\noindent (4) Let $(\beta_1,\beta_2)=(6,3)$ and $(m,n)=(7,3)$.  Consider $\mathcal{P}(7,3)$.
\begin{tikzpicture}[scale=.3]
\draw[step=1,color=gray] (0,0) grid (7,3);
\draw[line width=2,color=orange] (0,0)--(3,0)--(3,1)--(5,1)--(5,2)--(7,2)--(7,3);
\fill[cyan] (0.2,0.2)--(0.2,0.8)--(0.8,0.8)--(0.8,0.2)--(0.2,0.2);
\fill[cyan] (1+0.2,0.2)--(1+0.2,0.8)--(1+0.8,0.8)--(1+0.8,0.2)--(1+0.2,0.2);
\fill[cyan] (2+0.2,0.2)--(2+0.2,0.8)--(2+0.8,0.8)--(2+0.8,0.2)--(2+0.2,0.2);
\fill[cyan] (0.2,1+0.2)--(0.2,1+0.8)--(0.8,1+0.8)--(0.8,1+0.2)--(0.2,1+0.2);
\fill[cyan] (1+0.2,1+0.2)--(1+0.2,1+0.8)--(1+0.8,1+0.8)--(1+0.8,1+0.2)--(1+0.2,1+0.2);
\fill[cyan] (0.2,2+0.2)--(0.2,2+0.8)--(0.8,2+0.8)--(0.8,2+0.2)--(0.2,2+0.2);
\fill[red] (2.2,1+0.2)--(2.2,1+0.8)--(4.8,1+0.8)--(4.8,1+0.2)--(2.2,1+0.2);
\fill[red] (2.2-1,1+1+0.2)--(2.2-1,1+1+0.8)--(4.8-1,1+1+0.8)--(4.8-1,1+1+0.2)--(2.2-1,1+1+0.2);
\fill[red] (2.2-1+3,1+1+0.2)--(2.2-1+3,1+1+0.8)--(4.8-1+3,1+1+0.8)--(4.8-1+3,1+1+0.2)--(2.2-1+3,1+1+0.2);
\draw[line width=2pt] (0,0)--(3,0);
\draw[line width=2pt] (5,1)--(5,2);
\draw[line width=2pt] (7,2)--(7,3);
\end{tikzpicture}
Suppose that $\omega(v_2)=\omega(v_3)=3$, $\omega(u_1)=\omega(u_2)=\omega(u_3)=1$, and $\omega(v_1)=\omega(u_4)=\omega(u_5)=\omega(u_6)=\omega(u_7)=0$. Then $\omega$ is tight. 

\noindent (5) Let $(\beta_1,\beta_2)=(12,8)$ and $(m,n)=(14,9)$. There are total 14 tight gradings such that $\omega(h)=2$ for exactly four horizontal edges $h$, $\omega(v)=3$ for exactly four vertical edges $v$, and  $\omega(e)=0$ for all other edges  on $\mathcal{P}(14,9)$.  



\newcommand{\vrect}[2]{%
  \FPeval{\newy}{trunc(9/14 * #1, 0)} % Calculate floor(9/14 * y) and store in \newy
  \FPeval{\newz}{trunc(#2,0)-1} 
  \foreach \i in {0,...,\newz} {%
    \fill[cyan] (#1 + 0.2, \newy + 0.2 + 2 * \i) -- (#1 + 0.2, \newy + 1.8 + 2 * \i) -- (#1 + 0.8, \newy + 1.8 + 2 * \i) -- (#1 + 0.8, \newy + 0.2 + 2 * \i) -- (#1 + 0.2, \newy + 0.2 + 2 * \i);%
  }%
}

\newcommand{\hrect}[2]{%
  \FPeval{\newy}{trunc(14/9 * (#1 + 1) + 1, 0)} % Calculate floor(9/14 * y) and store in \newy
  \FPeval{\newz}{trunc(#2,0)-1} 
  \foreach \i in {0,...,\newz} {%
    \fill[red] (\newy - 0.2 - 3 * \i, #1 + 0.2) -- (\newy - 2.8 - 3 * \i, #1 + 0.2) -- ( \newy - 2.8 - 3 * \i, #1 + 0.8) -- (\newy - 0.2 - 3 * \i, #1 + 0.8) -- (\newy - 0.2 - 3 * \i, #1 + 0.2);%
  }%
}







\begin{figure}[ht]
\centering
\captionsetup{width=.9\linewidth}
\begin{tikzpicture}[scale=.23]

\draw[step=1,color=gray] (0,0) grid (14,9);
\draw[line width=2,color=orange] (0,0)--(2,0)--(2,1)--(4,1)--(4,2)--(5,2)--(5,3)--(7,3)--(7,4)--(8,4)--(8,5)--(10,5)--(10,6)--(11,6)--(11,7)--(13,7)--(13,8)--(14,8)--(14,9);
\vrect{0}{4}
\vrect{1}{3}
\vrect{2}{2}
\vrect{3}{1}
\hrect{4}{1}
\hrect{5}{2}
\hrect{6}{3}
\hrect{7}{4}
\draw[line width=2pt] (0,0)--(2,0);
\draw[line width=2pt] (2,1)--(4,1);
\draw[line width=2pt] (8,4)--(8,5);
\draw[line width=2pt] (10,5)--(10,6);
\draw[line width=2pt] (11,6)--(11,7);
\draw[line width=2pt] (13,7)--(13,8);


\begin{scope}[shift={(16,0)}]
\draw[step=1,color=gray] (0,0) grid (14,9);
\draw[line width=2,color=orange] (0,0)--(2,0)--(2,1)--(4,1)--(4,2)--(5,2)--(5,3)--(7,3)--(7,4)--(8,4)--(8,5)--(10,5)--(10,6)--(11,6)--(11,7)--(13,7)--(13,8)--(14,8)--(14,9);
\vrect{0}{4}
\vrect{1}{3}
\vrect{2}{2}
\vrect{4}{1}
\hrect{4}{1}
\hrect{5}{2}
\hrect{6}{3}
\hrect{7}{4}
\draw[line width=2pt] (0,0)--(2,0);
\draw[line width=2pt] (2,1)--(3,1);
\draw[line width=2pt] (4,2)--(5,2);
\draw[line width=2pt] (8,4)--(8,5);
\draw[line width=2pt] (10,5)--(10,6);
\draw[line width=2pt] (11,6)--(11,7);
\draw[line width=2pt] (13,7)--(13,8);
\end{scope}


\begin{scope}[shift={(32,0)}]
\draw[step=1,color=gray] (0,0) grid (14,9);
\draw[line width=2,color=orange] (0,0)--(2,0)--(2,1)--(4,1)--(4,2)--(5,2)--(5,3)--(7,3)--(7,4)--(8,4)--(8,5)--(10,5)--(10,6)--(11,6)--(11,7)--(13,7)--(13,8)--(14,8)--(14,9);
\vrect{0}{4}
\vrect{1}{3}
\vrect{2}{2}
\vrect{3}{1}
\hrect{3}{1}
\hrect{5}{1}
\hrect{6}{3}
\hrect{7}{4}
\draw[line width=2pt] (0,0)--(2,0);
\draw[line width=2pt] (2,1)--(4,1);
\draw[line width=2pt] (7,3)--(7,4);
\draw[line width=2pt] (10,5)--(10,6);
\draw[line width=2pt] (11,6)--(11,7);
\draw[line width=2pt] (13,7)--(13,8);
\end{scope}



\begin{scope}[shift={(48,0)}]
\draw[step=1,color=gray] (0,0) grid (14,9);
\draw[line width=2,color=orange] (0,0)--(2,0)--(2,1)--(4,1)--(4,2)--(5,2)--(5,3)--(7,3)--(7,4)--(8,4)--(8,5)--(10,5)--(10,6)--(11,6)--(11,7)--(13,7)--(13,8)--(14,8)--(14,9);
\vrect{0}{4}
\vrect{1}{3}
\vrect{3}{2}
\vrect{4}{1}
\hrect{4}{1}
\hrect{5}{2}
\hrect{6}{3}
\hrect{7}{4}
\draw[line width=2pt] (0,0)--(2,0);
\draw[line width=2pt] (3,1)--(4,1);
\draw[line width=2pt] (4,2)--(5,2);
\draw[line width=2pt] (8,4)--(8,5);
\draw[line width=2pt] (10,5)--(10,6);
\draw[line width=2pt] (11,6)--(11,7);
\draw[line width=2pt] (13,7)--(13,8);
\end{scope}


\begin{scope}[shift={(0,-11)}]
\draw[step=1,color=gray] (0,0) grid (14,9);
\draw[line width=2,color=orange] (0,0)--(2,0)--(2,1)--(3,1)--(3,2)--(5,2)--(5,3)--(7,3)--(7,4)--(8,4)--(8,5)--(10,5)--(10,6)--(11,6)--(11,7)--(13,7)--(13,8)--(14,8)--(14,9);
\vrec{0}{0}{4}
\vrec{1}{0}{3}
\vrec{2}{1}{2}
\vrec{3}{2}{1}
\hrec{13}{7}{4}
\hrec{11}{6}{3}
\hrec{10}{5}{2}
\hrec{8}{4}{1}
\draw[line width=2pt] (0,0)--(2,0);
\draw[line width=2pt] (2,1)--(3,1);
\draw[line width=2pt] (3,2)--(4,2);
\draw[line width=2pt] (8,4)--(8,5);
\draw[line width=2pt] (10,5)--(10,6);
\draw[line width=2pt] (11,6)--(11,7);
\draw[line width=2pt] (13,7)--(13,8);

%\draw (3,-1) node[anchor=north] {Figure 2};
%
%

\begin{scope}[shift={(16,0)}]
\draw[step=1,color=gray] (0,0) grid (14,9);
\draw[line width=2,color=orange] (0,0)--(2,0)--(2,1)--(3,1)--(3,2)--(5,2)--(5,3)--(7,3)--(7,4)--(8,4)--(8,5)--(10,5)--(10,6)--(11,6)--(11,7)--(13,7)--(13,8)--(14,8)--(14,9);
\vrec{0}{0}{4}
\vrec{1}{0}{3}
\vrec{2}{1}{2}
\vrec{4}{2}{1}
\hrec{13}{7}{4}
\hrec{11}{6}{3}
\hrec{10}{5}{2}
\hrec{8}{4}{1}
\draw[line width=2pt] (0,0)--(2,0);
\draw[line width=2pt] (2,1)--(3,1);
\draw[line width=2pt] (4,2)--(5,2);
\draw[line width=2pt] (8,4)--(8,5);
\draw[line width=2pt] (10,5)--(10,6);
\draw[line width=2pt] (11,6)--(11,7);
\draw[line width=2pt] (13,7)--(13,8);
\end{scope}


\begin{scope}[shift={(32,0)}]
\draw[step=1,color=gray] (0,0) grid (14,9);
\draw[line width=2,color=orange] (0,0)--(2,0)--(2,1)--(3,1)--(3,2)--(5,2)--(5,3)--(7,3)--(7,4)--(8,4)--(8,5)--(10,5)--(10,6)--(11,6)--(11,7)--(13,7)--(13,8)--(14,8)--(14,9);
\vrec{0}{0}{4}
\vrec{1}{0}{3}
\vrec{2}{1}{2}
\vrec{3}{2}{1}
\hrec{13}{7}{4}
\hrec{11}{6}{3}
\hrec{10}{5}{1}
\hrec{7}{3}{1}
\draw[line width=2pt] (0,0)--(2,0);
\draw[line width=2pt] (2,1)--(3,1);
\draw[line width=2pt] (3,2)--(4,2);
\draw[line width=2pt] (7,3)--(7,4);
\draw[line width=2pt] (10,5)--(10,6);
\draw[line width=2pt] (11,6)--(11,7);
\draw[line width=2pt] (13,7)--(13,8);
\end{scope}



\begin{scope}[shift={(48,0)}]
\draw[step=1,color=gray] (0,0) grid (14,9);
\draw[line width=2,color=orange] (0,0)--(2,0)--(2,1)--(3,1)--(3,2)--(5,2)--(5,3)--(7,3)--(7,4)--(8,4)--(8,5)--(10,5)--(10,6)--(11,6)--(11,7)--(13,7)--(13,8)--(14,8)--(14,9);
\vrec{0}{0}{4}
\vrec{1}{0}{1}
\vrec{3}{2}{2}
\vrec{4}{2}{1}
\hrec{13}{7}{4}
\hrec{11}{6}{3}
\hrec{10}{5}{2}
\hrec{8}{4}{1}
\draw[line width=2pt] (0,0)--(2,0);
\draw[line width=2pt] (3,2)--(5,2);
\draw[line width=2pt] (8,4)--(8,5);
\draw[line width=2pt] (10,5)--(10,6);
\draw[line width=2pt] (11,6)--(11,7);
\draw[line width=2pt] (13,7)--(13,8);
\end{scope}
\end{scope}


\begin{scope}[shift={(0,-22)}]
\draw[step=1,color=gray] (0,0) grid (14,9);
\draw[line width=2,color=orange] (0,0)--(2,0)--(2,1)--(3,1)--(3,2)--(5,2)--(5,3)--(6,3)--(6,4)--(8,4)--(8,5)--(10,5)--(10,6)--(11,6)--(11,7)--(13,7)--(13,8)--(14,8)--(14,9);
\vrec{0}{0}{4}
\vrec{1}{0}{3}
\vrec{2}{1}{2}
\vrec{3}{2}{1}
\hrec{13}{7}{4}
\hrec{11}{6}{3}
\hrec{10}{5}{2}
\hrec{8}{4}{1}
\draw[line width=2pt] (0,0)--(2,0);
\draw[line width=2pt] (2,1)--(3,1);
\draw[line width=2pt] (3,2)--(4,2);
\draw[line width=2pt] (8,4)--(8,5);
\draw[line width=2pt] (10,5)--(10,6);
\draw[line width=2pt] (11,6)--(11,7);
\draw[line width=2pt] (13,7)--(13,8);


\begin{scope}[shift={(16,0)}]
\draw[step=1,color=gray] (0,0) grid (14,9);
\draw[line width=2,color=orange] (0,0)--(2,0)--(2,1)--(3,1)--(3,2)--(5,2)--(5,3)--(6,3)--(6,4)--(8,4)--(8,5)--(10,5)--(10,6)--(11,6)--(11,7)--(13,7)--(13,8)--(14,8)--(14,9);
\vrec{0}{0}{4}
\vrec{1}{0}{3}
\vrec{2}{1}{2}
\vrec{4}{2}{1}
\hrec{13}{7}{4}
\hrec{11}{6}{3}
\hrec{10}{5}{2}
\hrec{8}{4}{1}
\draw[line width=2pt] (0,0)--(2,0);
\draw[line width=2pt] (2,1)--(3,1);
\draw[line width=2pt] (4,2)--(5,2);
\draw[line width=2pt] (8,4)--(8,5);
\draw[line width=2pt] (10,5)--(10,6);
\draw[line width=2pt] (11,6)--(11,7);
\draw[line width=2pt] (13,7)--(13,8);
\end{scope}


\begin{scope}[shift={(32,0)}]
\draw[step=1,color=gray] (0,0) grid (14,9);
\draw[line width=2,color=orange] (0,0)--(2,0)--(2,1)--(3,1)--(3,2)--(5,2)--(5,3)--(6,3)--(6,4)--(8,4)--(8,5)--(10,5)--(10,6)--(11,6)--(11,7)--(13,7)--(13,8)--(14,8)--(14,9);
\vrec{0}{0}{4}
\vrec{1}{0}{2}
\vrec{2}{1}{1}
\vrec{6}{4}{1}
\hrec{13}{7}{4}
\hrec{11}{6}{3}
\hrec{10}{5}{1}
\hrec{6}{3}{1}
\draw[line width=2pt] (0,0)--(2,0);
\draw[line width=2pt] (2,1)--(3,1);
\draw[line width=2pt] (6,4)--(7,4);
\draw[line width=2pt] (6,3)--(6,4);
\draw[line width=2pt] (10,5)--(10,6);
\draw[line width=2pt] (11,6)--(11,7);
\draw[line width=2pt] (13,7)--(13,8);
\end{scope}



\begin{scope}[shift={(48,0)}]
\draw[step=1,color=gray] (0,0) grid (14,9);
\draw[line width=2,color=orange] (0,0)--(2,0)--(2,1)--(3,1)--(3,2)--(5,2)--(5,3)--(6,3)--(6,4)--(8,4)--(8,5)--(10,5)--(10,6)--(11,6)--(11,7)--(13,7)--(13,8)--(14,8)--(14,9);
\vrec{0}{0}{4}
\vrec{1}{0}{1}
\vrec{3}{2}{2}
\vrec{4}{2}{1}
\hrec{13}{7}{4}
\hrec{11}{6}{3}
\hrec{10}{5}{2}
\hrec{8}{4}{1}
\draw[line width=2pt] (0,0)--(2,0);
\draw[line width=2pt] (3,2)--(5,2);
\draw[line width=2pt] (8,4)--(8,5);
\draw[line width=2pt] (10,5)--(10,6);
\draw[line width=2pt] (11,6)--(11,7);
\draw[line width=2pt] (13,7)--(13,8);
\end{scope}
\end{scope}


\begin{scope}[shift={(0,-33)}]

\begin{scope}[shift={(0,0)}]
\draw[step=1,color=gray] (0,0) grid (14,9);
\draw[line width=2,color=orange] (0,0)--(2,0)--(2,1)--(3,1)--(3,2)--(5,2)--(5,3)--(6,3)--(6,4)--(8,4)--(8,5)--(9,5)--(9,6)--(11,6)--(11,7)--(13,7)--(13,8)--(14,8)--(14,9);
\vrec{0}{0}{4}
\vrec{1}{0}{3}
\vrec{2}{1}{2}
\vrec{3}{2}{1}
\hrec{13}{7}{4}
\hrec{11}{6}{3}
\hrec{9}{5}{2}
\hrec{8}{4}{1}
\draw[line width=2pt] (0,0)--(2,0);
\draw[line width=2pt] (2,1)--(3,1);
\draw[line width=2pt] (3,2)--(4,2);
\draw[line width=2pt] (8,4)--(8,5);
\draw[line width=2pt] (9,5)--(9,6);
\draw[line width=2pt] (11,6)--(11,7);
\draw[line width=2pt] (13,7)--(13,8);
\end{scope}

\begin{scope}[shift={(16,0)}]
\draw[step=1,color=gray] (0,0) grid (14,9);
\draw[line width=2,color=orange] (0,0)--(2,0)--(2,1)--(3,1)--(3,2)--(5,2)--(5,3)--(6,3)--(6,4)--(8,4)--(8,5)--(9,5)--(9,6)--(11,6)--(11,7)--(13,7)--(13,8)--(14,8)--(14,9);
\vrec{0}{0}{4}
\vrec{1}{0}{3}
\vrec{2}{1}{2}
\vrec{4}{2}{1}
\hrec{13}{7}{4}
\hrec{11}{6}{3}
\hrec{9}{5}{2}
\hrec{8}{4}{1}
\draw[line width=2pt] (0,0)--(2,0);
\draw[line width=2pt] (2,1)--(3,1);
\draw[line width=2pt] (4,2)--(5,2);
\draw[line width=2pt] (8,4)--(8,5);
\draw[line width=2pt] (9,5)--(9,6);
\draw[line width=2pt] (11,6)--(11,7);
\draw[line width=2pt] (13,7)--(13,8);
\end{scope}

\end{scope}
\end{tikzpicture}
\caption{The 14 tight gradings on $\calP(14,9)$ with $(\beta_1,\beta_2) = (12,8)$.  These correspond to a coefficient of the central wall-function, whose sequence of coefficients is the Catalan numbers, in a certain cluster scattering diagram (see \Cref{exmp: Catalan wall}).} 
\label{fig: 14 tight grading example}
\end{figure}
\end{exmp}


\begin{rem}
The word "tight" is inspired by the tight space between blue and red rectangles.
\end{rem}


\section{Rank 2 scattering diagrams}\label{sec: sd}
Fix a rank-$2$ lattice $M \cong \Z^2$ and choose a strictly convex rational cone $\sigma$ in  $M_\mathbb R \coloneqq M \otimes \mathbb R$. We take the monoid $P = \sigma \cap M$ and denote $P^+ \coloneqq P \cut \{0\}$. Set $\widehat {\Bbbk[P]}$ to be the monoid algebra $\Bbbk[P]$ completed at the maximal monomial ideal $\frakm$ generated by $\{x^m \mid m \in P^+\}$.


\begin{defn}
    A \emph{wall} is a pair $(\frakd, f_\frakd)$ consisting of a \emph{support} $\frakd \subseteq M_\R$ and a \emph{wall-function} $f_\frakd \in \widehat{\Bbbk [P]}$, where
    \begin{itemize}
        \item $\frakd$ is either a ray $\R_{\leq 0}w$ or a line $\R w$ for some $w \in P^+$;
        \item $\displaystyle f_\frakd = f_\frakd(x^w) = 1 + \sum_{k \geq 1} c_k x^{kw}$ for $c_k \in \Bbbk$.
    \end{itemize}
\end{defn}


Associated to a wall $(\frakd, f_\frakd)$ and a direction $v\in M_\mathbb R$ transversal to $\frakd$ is an algebra automorphism $\mathfrak p_{v, \frakd}\in \operatorname{Aut}(\widehat{\Bbbk[P]})$ defined by $\mathfrak p_{v, \frakd}(x^m) = x^m f_\frakd^{n(m)}$ for $m\in P$,
where $n\in \operatorname{Hom}(M, \mathbb Z)$ is primitive and orthogonal to $\frakd$ in the direction $n(v)<0$. 

\begin{defn}
A \emph{scattering diagram} $\frakD$ is a collection of walls such that the set
\[
    \mathfrak D_k \coloneqq \{(\frakd, f_\frakd) \in \frakD \mid f_\frakd \not \equiv 1 \ \operatorname{mod}\ \frakm^k\}
\]
is finite for each $k \geq 0$.
%The union of the supports of the walls is the \emph{support} $\Supp(\frakD)$ of the scattering diagram $\frakD$.  
\end{defn}


A path $\gamma \colon [0, 1] \rightarrow M_\mathbb R$ is called \emph{regular} (with respect to $\mathfrak D$) if it is a smooth immersion with endpoints away from the support of any wall and only crosses walls transversally. For each $k\geq 1$, let $0<t_1<\dots<t_s<1$ be the longest sequence such that $\gamma(t_i) \in \mathfrak d_i$ for some wall $(\mathfrak d_i, f_{\mathfrak d_i})\in \mathfrak D_k$. Consider the product $
    \mathfrak p^{(k)}_{\gamma, \mathfrak D} = \mathfrak p_{\dot{\gamma}(t_s), \frakd_s} \circ \cdots \circ\mathfrak p_{\dot{\gamma}(t_1), \frakd_1}
$.
We define the \emph{path-ordered product} of $\gamma$ to be $\mathfrak p_{\gamma, \mathfrak D} = \lim\limits_{k\rightarrow \infty} \mathfrak p^{(k)}_{\gamma, \mathfrak D} \in \operatorname{Aut}(\widehat{\Bbbk[P]})$.


\begin{defn}
    A scattering diagram $\mathfrak D$ is called \emph{consistent} if the path-ordered product $\mathfrak p_{\gamma, \mathfrak D}$ equals the identity for any regular simple loop $\gamma$.
\end{defn}


\begin{thm}[\cite{KS}]\label{thm: consistent sd rank 2}
    Given any initial scattering diagram $\mathfrak D_\mathrm{in}$ of only lines, there is a unique minimal consistent scattering diagram $\operatorname{Scat}(\mathfrak D_\mathrm{in})$ containing $\mathfrak D_\mathrm{in}$ such that $\operatorname{Scat}(\mathfrak D_\mathrm{in}) \cut \mathfrak D_\mathrm{in}$ consists of distinct rays with non-trivial wall-functions.
\end{thm}


While the use of scattering diagrams originated in the study of mirror symmetry, they have since found remarkable applications in cluster algebras by the celebrated work of Gross, Hacking, Keel, and Kontsevich \cite{GHKK}. We exhibit a collection of consistent scattering diagrams devised for (generalized) cluster algebras in rank 2. Let $M = \mathbb Z^2$, $e_1 = (1, 0)$, $e_2 = (0, 1)$. Choose $\sigma$ to be the first quadrant of $M_\mathbb R = \mathbb R^2$. Denote $x = x^{e_1}$ and $y = x^{e_2}$. The initial scattering diagram will be two lines
\begin{equation}\label{eq: initial sd rank 2}
    \mathfrak D_\mathrm{in} = \{(\R e_1, {P}_1(x)), (\R e_2, {P}_2(y))\}
\end{equation}
where $P_i(x^{e_i})\in \Bbbk[x^{e_i}]$ with constant term $1$. Denote $\mathfrak D(P_1, P_2) = \operatorname{Scat}(\mathfrak D_\mathrm{in})$. There are infinitely many rays in $\mathfrak D(P_1, P_2) \cut \mathfrak D_\mathrm{in}$ of the form $(\mathbb R_{\leq 0}(a, b), f_{(a, b)})$ for coprime $(a, b)\in \mathbb Z_{>0}^2$ unless $\deg P_1\cdot \deg P_2 < 4$, when there are finitely many. 


\begin{figure}[H]
\centering
\includegraphics[width=0.9\textwidth]{Figures/Scattering_diagram_examples.pdf}
\caption{From left to right, we depict the scattering diagrams $\frakD(1 + p_{1,1}x + p_{1,2}x^2 + p_{1,3}x^3, 1 + p_{2,1}y)$, $\frakD_{(2,2)}$, and $\frakD_{(3,2)}$.}
\label{fig: scattering diagram examples}
\end{figure}



\begin{exmp}\label{exmp: G2}
    We depict in the left of \Cref{fig: scattering diagram examples} the case $\deg P_1 = 3$ and $\deg P_2 = 1$. The remaining finite cases can be obtained by specializing certain coefficients to zero. In the scattering diagram on the left of \Cref{fig: scattering diagram examples}, the wall-functions on the added rays are
    \begin{align*}
        & f_{(3,1)} = 1 + p_{1,3}p_{2,1} x^3y, \\
        & f_{(2,1)} = 1 + p_{1,2}p_{2,1} x^2y + p_{1,1}p_{1,3}p_{2,1}^2 x^4 y^2 + p_{1,3}^2p_{2,1}^3 x^6y^3 \quad (\text{see \Cref{exmp: G2} f(2,1)}), \\
        & f_{(3,2)} = 1 + p_{1,3}p_{2,1}^2 x^3y^2, \\
        & f_{(1,1)} = 1 + p_{1,1}p_{2,1} xy + p_{1,2}p_{2,1}^2 x^2y^2 + p_{1,3}p_{2,1}^3 x^3 y^3.
    \end{align*}
\end{exmp}

When $P_1(x) = 1 + x^{\ell_1}$ and $P_2(y) = 1 + y^{\ell_2}$, the resulting scattering diagram $\mathfrak D_{(\ell_1, \ell_2)} = \mathfrak D(P_1, P_2)$ \cite{GHKK} is famously responsible for the rank-2 cluster algebra $\mathcal A(\ell_1, \ell_2)$ \cite{FZ}. When $\ell_1 \ell_2<4$, its structure is directly derived from \Cref{exmp: G2} by specializing coefficients. When $\ell_1 \ell_2 \geq 4$, there is a discrete set of rays outside the closed cone spanned by
\[
    \left(-2\ell_1, -\ell_1 \ell_2 - \sqrt{\ell_1^2\ell_2^2 - 4\ell_1 \ell_2} \right) \quad \text{ and } \quad \left(-\ell_1 \ell_2 - \sqrt{\ell_1^2\ell_2^2 - 4\ell_1 \ell_2}, -2\ell_2 \right).
\]
These rays are in bijection with the cluster variables $\{x_n \mid n\in \mathbb Z,\ n\neq 0, 1, 2, 3\} \subset \mathcal A(\ell_1, \ell_2)$, where their directions are opposite to the $d$-vectors of cluster variables. The cone itself, known as the \emph{Badlands}, has a much richer yet more elusive structure. It is known that $\frakD_{(\ell_1, \ell_2)}$ has a ray at every rational slope within the Badlands; see \cite[Section 4.7]{GP} and \cite{GL2023dense}. 
However, the wall-functions there were generally not understood.

\begin{exmp}\label{exmp: Catalan wall}
    The scattering diagram $\frakD_{(2,2)}$, depicted in the center of \Cref{fig: scattering diagram examples}, has only one non-cluster ray, depicted in red.  The scattering diagram $\frakD_{(3,2)}$ is depicted in the right of \Cref{fig: scattering diagram examples}, with the Badlands shown in red. The wall-function on the ray $\mathbb R_{\leq 0}(3, 2)$ is  $1+x^3 y^2 + 2x^6 y^4 + 5x^9 y^6 + 14 x^{12} y^8 + 42 x^{15} y^{10} + \cdots $, where the coefficients are the Catalan numbers. The calculation of the coefficient 14 comes from \Cref{tight_exmp}(5).
\end{exmp}


We can even let the initial wall-functions in (\ref{eq: initial sd rank 2}) be power series
\[
    P_i(x^{e_i}) = 1 + p_{i, 1} x^{e_i} + \dots + p_{i, j} x^{je_i} + \dots \in \Bbbk\llbracket x \rrbracket, \quad i = 1, 2.
\]
In $\mathfrak D(P_1, P_2)$, the functions on the added rays $\mathbb R_{\leq 0}(a, b)$ with coprime $(a, b)\in \mathbb N^2$ are of the form
\begin{equation}\label{eq: wall function}
    f_{(a, b)}(P_1, P_2) = 1 + \sum_{k\geq 1} \lambda(ka, kb)x^{ka}y^{kb}.
\end{equation}


In \Cref{sec: first main thm}, we will give a combinatorial formula for every $\lambda(ka, kb)$ in terms of tight gradings. Since the polynomial case can be obtain from the power series case by letting all but finitely many $p_{i, j}$ be zero, it will become clear that the formula given in \Cref{first_main_thm} also applies to the polynomial case by considering certain subsets of tight gradings.





\section{Combinatorial formula of wall-function coefficients}\label{sec: first main thm}

\begin{defn}
    The \emph{weight} of a grading $\omega:\calP(m,n)\longrightarrow \N$ is defined as 
    \[
        \text{wt}(\omega)=\prod_{i=1}^m p_{2,\omega(u_i)} \prod_{j=1}^n  p_{1,\omega(v_j)}.
    \]
\end{defn}


\begin{exmp}\label{weight_exmp}
%Let $P_1=1+p_{1,1}x + p_{1,2}x^2 + p_{1,3}x^3$ and $P_2=1 + p_{2,1}y$.
If $\omega$ is as in \Cref{tight_exmp}(2), then $\text{wt}(\omega)=p_{1,2}p_{2,1}$. If $\omega$ is as in \Cref{tight_exmp}(3), then $\text{wt}(\omega)=p_{1,1}p_{1,3}p_{2,1}^2$. If $\omega$ is as in \Cref{tight_exmp}(4), then $\text{wt}(\omega)=p_{1,3}^2 p_{2,1}^3$.
\end{exmp}


Our main theorem explicitly computes the elements $f_{(a,b)}$ in terms of tight gradings introduced in \Cref{sec: tight grading}. 


\begin{thm}\label{first_main_thm}
    Fix coprime positive integers $(a,b)$.  For each $k \geq 1$, choose integers $(m_k,n_k)$ such that $\left|an_k - bm_k\right| = 1$, $ka \leq m_k$, and $kb \leq n_k$.  Then
    \begin{equation}\label{eq: tight grading formula intro}
        f_{(a, b)} = 1 + \sum_{k\geq 1}\sum_{\omega} \mathrm{wt}(\omega) x^{ka}y^{kb},  
    \end{equation}
    where the second sum is over all tight gradings $\omega$ on the Dyck path $\mathcal P(m_k, n_k)$ of total horizontal weight $kb$ and total vertical weight $ka$.
\end{thm}


\begin{exmp}\label{ex: G2 f(2,1)}
    Let $\deg P_1 = 3$, $\deg P_2 = 1$, and $(a,b)=(2,1)$. Let $(m_k,n_k)=(ka+1,kb)$ for all $k\ge1$. Then the gradings as in \Cref{tight_exmp}(2)(3)(4) are the only tight gradings of the form $\omega:\calP=\calP(m_k,n_k)\longrightarrow\N$ with $\omega(\calP_\east)=kb$ and $\omega(\calP_\north)=ka$ with nonzero weight.
    Thus,  \Cref{weight_exmp} implies $$f_{(2,1)}(P_1,P_2) = 1 + p_{1,2}p_{2,1} x^2 y + p_{1,1}p_{1,3}p_{2,1}^2 x^4 y^2 + p_{1,3}^2 p_{2,1}^3 x^6 y^3.$$
\end{exmp}


\begin{rem}
    When $\deg P_i = \ell_i$ for $i=1, 2$, Reineke and Weist \cite{RW} showed that the coefficients of $f_{(a, b)}(P_1, P_2)$ can be expressed in terms of Euler characteristics of certain moduli spaces of framed stable representations of the complete bipartite quiver with $\ell_1$ sources and $\ell_2$ sinks. Therefore our tight grading formula \Cref{first_main_thm} provides a manifestly-positive way to compute these Euler characteristics.
\end{rem}



\section{Applications of the tight grading formula}\label{sec: applications}
\subsection{Every wall-function coefficient in the Badlands is non-trivial}
As a direct application of our formula, we can prove that for $\mathfrak D (P_1,P_2)$ with positive coefficients and  $\ell_1\ell_2\geq 4$, every wall-function coefficient of every wall in the Badlands is strictly positive. Together with the known description of cluster rays, we obtain a full description of when $\lambda(ak, bk)$ is non-vanishing.
%This has been suggested in several works, including  \cite[Example 1.15]{GHKK}, \cite[Example 1.6]{GPS}, and \cite[Example 1.4]{GS}.


When $\ell_1 = \ell_2$, Gross and Pandharipande \cite{GP} showed that every rational ray in the Badlands has non-trivial wall-function using a result regarding the existence of stable quiver representations due to Reineke \cite[Proposition 4.15]{GP}. This was extended to the skew-symmetrizable setting by Gr{\" a}nitz and Luo \cite{GL2023dense}.  Davison and Mandel \cite[Example 7.10]{davison2021strong} showed further that every coefficient is non-zero in the skew-symmetric setting. 

\iffalse
\begin{thm}[{\cite[(4.12)]{GP}}]
In the scattering diagram $\frakD_{(\ell,\ell)}$, there are walls of every rational slope within the Badlands.  Moreover, every coefficient of the wall-function is nonzero for every wall within the Badlands.
\end{thm}
\fi


Our approach requires only elementary combinatorics and extends naturally to the generalized cluster setting with positive initial wall-functions.

\begin{thm}
Suppose $P_1$ and $P_2$ have positive coefficients.  In the scattering diagram $\frakD(P_1,P_2)$, for any coprime $(a, b)\in \mathbb Z_{>0}^2$ with $\mathbb R_{\leq 0}(a, b)$ in the Badlands and any $k\geq 1$, there exists a maximal Dyck path $\calP$ at least one tight grading $\omega \colon \calP \longrightarrow \N$
with $\omega(\calP_\east) = kb$, $\omega(\calP_\north) = ka$, and non-zero weight with respect to $P_1$ and $P_2$. 

Therefore, every coefficient $\lambda(ka, kb)$ is strictly positive for every wall within the Badlands.
\end{thm}


\iffalse
The proof involves explicitly constructing a tight grading corresponding to each coefficient of a Badlands wall-function, thus demonstrating that the coefficient is non-zero.
\fi


\subsection{Positivity of generalized cluster algebras}
Built on the rank-2 positivity demonstrated by our tight grading formula, we develop the positivity of higher-rank scattering diagrams towards applications in \emph{generalized cluster algebras}. These algebras, axiomatized by Chekhov and Shapiro \cite{CS}, accommodate polynomial mutation rules, in contrast to binomial exchange relations introduced by Fomin and Zelevinsky \cite{FZ}.
Following \cite{GHKK}, the \emph{generalized cluster scattering diagrams} \cite{Mou, CKM} are constructed to study these algebras. 


Extending the positivity in rank 2 from \Cref{first_main_thm} and using a \emph{change of lattice trick} and a \emph{perturbation trick} adapted from \cite{GPS, GHKK}, we obtain the following positivity result in all ranks. A coefficient is said to be \emph{positive} if it is a polynomial in the coefficients of the initial exchange polynomials with positive integer coefficients.


\begin{thm}[{\cite[Theorem 9.9]{BLM}}]\label{thm: intro scattering diagram positivity}
There exists a representative for (the equivalence class of) a generalized cluster scattering diagram of any rank such that the coefficients of all wall-functions are positive.
\end{thm}

The strategy of the proof of \Cref{thm: intro scattering diagram positivity} is to construct a sequence of finite scattering diagrams $\mathfrak D_k$ so that the limit of $(\mathfrak D_k)_{k\geq 1}$ is equivalent to $\mathfrak D$.  The theorem is proven by showing inductively that each $\mathfrak D_k$ admits positivity where our rank-2 positivity \Cref{first_main_thm} is crucial for the induction.

The positivity of theta function coefficients follows directly from that of the scattering diagram, as in the ordinary cluster case \cite{GHKK}. Since the cluster variables of a generalized cluster algebra are theta functions for the corresponding scattering diagrams \cite{Mou, CKM}, we thus obtain the Laurent positivity of generalized cluster algebras.

\begin{cor}[{\cite[Conjecture 5.1]{CS}}]\label{cor: second_main_thm}
In a generalized cluster algebra of any rank, the Laurent expansion of any generalized cluster variable (in an initial cluster) has positive coefficients.
\end{cor}

The structure constants of the theta functions (see \cite[Section 6]{GHKK} and \cite[Section 5]{CKM}) also directly inherit positivity from the positivity of the generalized cluster scattering diagrams.

\begin{cor}
The theta functions defined in a generalized cluster scattering diagram of any rank have strong positivity, that is, their multiplicative structure constants are positive.
\end{cor}








\acknowledgements{The authors are grateful to Ryota Akagi, H\"ulya Arguz, Ben Davison, Sergey Fomin, Michael Gekhtman, Mark Gross, Sean Keel, Fang Li, Li Li, Siyang Liu, Travis Mandel, Gregg Musiker, Tomoki Nakanishi, Jie Pan, Fan Qin, Markus Reineke, Michael Shapiro, Bernd Siebert, Salvatore Stella, and Lauren Williams for their correspondences and helpful discussions.  The authors would also like to thank the anonymous referees for their thoughtful suggestions. }

%% if you use biblatex then this generates the bibliography
%% if you use some other method then remove this and do it your own way
\printbibliography

\end{document}
