% FraGoLi v. 1.3.4 y. 2026
% 
% Copyright (C) 2026 Paul Eduard Koenig
% pauleduardkoenig (at) gmail [dot] com
% Goethe University Frankfurt, Institute of Linguistics
%
% --------------------------------
% 
% O))))))))                    O))))             O))
% O))                        O)    O))           O))       O)
% O))      O) O)))   O))    O))           O))    O))
% O))))))   O))    O))  O)) O))         O))  O)) O))      O))
% O))       O))   O))   O)) O))   O))))O))    O))O))      O))
% O))       O))   O))   O))  O))    O)  O))  O)) O))      O))
% O))      O)))     O)) O)))  O)))))      O))    O))))))))O))
%
% --------------------------------
% 
% The package is mainly designed for the semantics department and focuses on providing a minimal syntax for fast formula derivation.
% Formula-Style is losely based on the accompanying material to an introductory course to linguistic semantics by Thomas Ede Zimmermann
% 
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c of this license or (at your option) any later
% version. The latest version of this license is in:
% http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of
% LaTeX version 2008-05-04 or later.
% 
% This work has the LPPL maintenance status `maintained'.
% The Current Maintainer of this work is Paul Eduard Koenig.
% This work consists of the files fragoli.sty and fragoli_doc.tex
%
% ------------------------------------------------------------ 
% header
% ------------------------------------------------------------ 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{fragoli}[2026-05-30 v. 1.3.4 LaTeX package for the institute of linguistics at Goethe University Frankfurt]
\RequirePackage{xparse, xcolor, enumitem, nicefrac, bm, amsmath, amssymb, amsfonts, xstring, expl3, pdftexcmds, etoolbox, kvoptions, varwidth, rainbowbrackets}
\RequirePackage[normalem]{ulem}


% ------------------------------------------------------------ 
% options
% ------------------------------------------------------------ 
\SetupKeyvalOptions{
	family=FGL,
	prefix=FGL@
}
\DeclareStringOption[english]{language}
\DeclareStringOption[textcomp]{semanticbracketdirectstyle}
\DeclareStringOption[normal]{typestyle}
\DeclareStringOption[normal]{typenestingstyle}
\DeclareStringOption[mid]{typespacing}
\DeclareStringOption[normal]{lambdaheadstyle}
\DeclareStringOption[narrow]{lambdaheadspacing}
\DeclareStringOption[mid]{tracespacing}
\DeclareStringOption[\sblank]{rulesituation}
\DeclareStringOption[\sstar]{situation}
\DeclareStringOption[narrow]{situationspacing}
\DeclareStringOption[mid]{semanticsuperscriptspacing}
\DeclareStringOption[mid]{assignmentspacing}
\DeclareBoolOption[false]{alternativecommands}
\DeclareBoolOption[true]{usetypes}
\DeclareBoolOption[false]{debug}
\DeclareBoolOption[true]{userainbow}
\DeclareBoolOption[false]{showanswer}
\DeclareBoolOption[true]{usedscount}
\ProcessKeyvalOptions*

% ------------------------------
% option actions
% ------------------------------
\let\ifempty\@fglsundefined
\newcommand{\ifempty}[1]{\ifnum\pdf@strcmp{#1}{}=\z@}

\long\def\@ifempty#1{\@xifempty#1@@..\@nil}
\long\def\@xifempty#1#2@#3#4#5\@nil{%
	\ifx#3#4\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}

\ifFGL@userainbow\else\disablerb\fi

\ifFGL@usedscount
\definecolor{fgldeivationrowcountcolor}{rgb}{255,255,255}
\fi

\let\fgslisinfgls\@fglsundefined
\newcommand{\fglsisinfgls}{}
\let\fglsisinderivation\@fglsundefined
\newcommand{\fglsisinderivation}{}

\def\fgl@internalsrdesituation{\FGL@rulesituation}


% ------------------------------
% Internal helpers
% ------------------------------

% Custom newcommand command for faster optional commands in environments
\def\fgl@defopt#1#2{%
  \expandafter\def\csname #1\endcsname{%
    \@ifnextchar[%
      {\csname fgl@opt@#1\endcsname}%
      {\csname fgl@opt@#1\endcsname[]}%
  }%
  \expandafter\def\csname fgl@opt@#1\endcsname[##1]{#2}%
}


% ------------------------------
% counter
% ------------------------------
\newcounter{@fglsderivationcounter}
\setcounter{@fglsderivationcounter}{0}
\newcounter{@fglscalcitemcounter}

% ------------------------------
% define internal types
% ------------------------------

\def\FraGoLi{{\Large F}\!\textsubscript{{\Large r}}\!{\Large a}{\large G}\!\textsubscript{{\large o}}\!{\large L}{\Large i}}

\def\@typed{}
\def\@typet{}
\def\@typee{}
\def\@types{}
\def\@typeet{}
\def\@typest{}
\def\@typeeet{}
\ifFGL@usetypes
\def\@typed{\type{d}}
\def\@typet{\type{t}}
\def\@typee{\type{e}}
\def\@types{\type{s}}
\def\@typeet{\type{et}}
\def\@typest{\type{st}}
\def\@typeeet{\type{e\t{et}}}
\fi

% ------------------------------
% define language specific labels:
% ------------------------------
% - labels are defined separate for each language
% - if language is not set, English is used
% ------------------------------
\newcommand{\@fragolivarlexicon}{Lexicon}
\newcommand{\@fragolivarrules}{Rules}
\newcommand{\@fragolivarrulessyn}{Rules (syntax)}
\newcommand{\@fragolivarderivation}{Derivation}
\newcommand{\@fragolivartree}{Tree}
\newcommand{\@fragolivartreesem}{Tree (semantic)}
\newcommand{\@fragolivartreesyn}{Tree (syntax)}
\newcommand{\@fragolivarlanguage}{Language}
\newcommand{\@fragolivarconversion}{conv.}
\newcommand{\@fragolivarreduction}{red.}
\newcommand{\@fragolivarnotationconvention}{not. conv.}
\newcommand{\@fragolivarand}{and}
\newcommand{\@fragolivaror}{or}
\newcommand{\@fragolivarno}{no-}
\newcommand{\@fragolivaroneindef}{one-\textsubscript{\textit{ind}}}
\newcommand{\@fragolivaronenum}{one-\textsubscript{\textit{num}}}
\newcommand{\@fragolivarevery}{every-}
\newcommand{\@fragolivardefarticle}{the\textsubscript{\textit{\text{R.}}}}
\newcommand{\@fragolivarmost}{the most}
\newcommand{\@fragolivarlis}{is}
\newcommand{\@fragolivarlof}{of}
\newcommand{\@fragolivarlarticle}{a}
\newcommand{\@fragolivarlarticlen}{an}
\newcommand{\@fragolivarlarticlegermanswitch}{\@fragolivarlarticle}
\newcommand{\@fragolivarlarticlegermanswitchn}{\@fragolivarlarticlen}
\newcommand{\@fragolivarlexbool}[2][\@fragolivarlarticle]{is #1 \MakeLowercase{#2} in}
\newcommand{\@fragolivarlexwoman}{Woman}
\newcommand{\@fragolivarlexman}{Man}
\newcommand{\@fragolivarlexdog}{Dog}
\newcommand{\@fragolivarlexcat}{Cat}
\newcommand{\@fragolivarlexdonkey}{Donkey}
\newcommand{\@fragolivarlexanimal}{Animal}
\newcommand{\@fragolivarlexchild}{Child}
\newcommand{\@fragolivarlexhouse}{House}
\newcommand{\@fragolivarlexattdox}{thinks}
\newcommand{\@fragolivarlexattepi}{knows}
\newcommand{\@fragolivarlexattbou}{wants}
\newcommand{\@fragolivarlexattdoxterm}{doxastic}
\newcommand{\@fragolivarlexattepiterm}{epistemic}
\newcommand{\@fragolivarlexattbouterm}{bouletic}

% set those labels according to the set language (if different than english)
\def\@fragoliconstlgerman{german}
\ifx\FGL@language\@fragoliconstlgerman
\renewcommand{\@fragolivarlexicon}{Lexikon}
\renewcommand{\@fragolivarrules}{Regeln}
\renewcommand{\@fragolivarrulessyn}{Regeln (Syntax)}
\renewcommand{\@fragolivarderivation}{Ableitung}
\renewcommand{\@fragolivartree}{Baum}
\renewcommand{\@fragolivartreesem}{Baum (Semantik)}
\renewcommand{\@fragolivartreesyn}{Baum (Syntax)}
\renewcommand{\@fragolivarlanguage}{Sprache}
\renewcommand{\@fragolivarconversion}{Konv.}
\renewcommand{\@fragolivarreduction}{Konv.}
\renewcommand{\@fragolivarnotationconvention}{Not.}
\renewcommand{\@fragolivarand}{und}
\renewcommand{\@fragolivaror}{oder}
\renewcommand{\@fragolivarno}{kein-}
\renewcommand{\@fragolivaroneindef}{ein-\textsubscript{\textit{ind}}}
\renewcommand{\@fragolivaronenum}{ein-\textsubscript{\textit{num}}}
\renewcommand{\@fragolivarevery}{jed-}
\renewcommand{\@fragolivarmost}{die meisten}
\renewcommand{\@fragolivardefarticle}{d-\textsubscript{\textit{\text{R.}}}}
\renewcommand{\@fragolivarlof}{von}
\renewcommand{\@fragolivarlis}{ist}
\renewcommand{\@fragolivarlarticle}{ein}
\renewcommand{\@fragolivarlarticlen}{eine}
\renewcommand{\@fragolivarlarticlegermanswitch}{\@fragolivarlarticlen}
\renewcommand{\@fragolivarlarticlegermanswitchn}{\@fragolivarlarticle}
\renewcommand{\@fragolivarlexbool}[2][\@fragolivarlarticle]{ist #1 #2 in}
\renewcommand{\@fragolivarlexwoman}{Frau}
\renewcommand{\@fragolivarlexman}{Mann}
\renewcommand{\@fragolivarlexdog}{Hund}
\renewcommand{\@fragolivarlexcat}{Katze}
\renewcommand{\@fragolivarlexdonkey}{Esel}
\renewcommand{\@fragolivarlexhouse}{Haus}
\renewcommand{\@fragolivarlexanimal}{Tier}
\renewcommand{\@fragolivarlexchild}{Kind}
\renewcommand{\@fragolivarlexattdox}{meint}
\renewcommand{\@fragolivarlexattepi}{wei\sss}
\renewcommand{\@fragolivarlexattbou}{will}
\renewcommand{\@fragolivarlexattdoxterm}{doxastische}
\renewcommand{\@fragolivarlexattepiterm}{epistemische}
\renewcommand{\@fragolivarlexattbouterm}{bouletische}
\fi

% ------------------------------
% define semantic bracket styles
% ------------------------------

% direct interpretation
\def\@fglsembracketl{}
\def\@fglsembracketr{}
\def\@fglsembracketL{}
\def\@fglsembracketR{}

\DeclareDocumentCommand{\fglsetdirectdelimitertextcomp}{}{\renewcommand{\@fglsembracketl}{\text{\textlbrackdbl}}\renewcommand{\@fglsembracketr}{\text{\textrbrackdbl}}\renewcommand{\@fglsembracketL}{\text{\textbf{\textlbrackdbl}}}\renewcommand{\@fglsembracketR}{\text{\textbf{\textrbrackdbl}}}}

\def\@semanticbracketdirectstyletextcomp{textcomp}
\ifx\FGL@semanticbracketdirectstyle\@semanticbracketdirectstyletextcomp
	\def\@fglreqtexversionforbrackets{2023/01/01}
	\@ifpackagelater{latex}{\@fglreqtexversionforbrackets}{}{\RequirePackage{textcomp}}
	\@ifundefined{textrbrackdbl}{
	\PackageWarning{fragoli}{The textcomp package is NOT loaded correctly! Some symbols might be missing. Load textcomp or switch bracket style for direct interpretation.}
	}{
	\fglsetdirectdelimitertextcomp
	}
\fi


\DeclareDocumentCommand{\fglsetdirectdelimitermixed}{}{\renewcommand{\@fglsembracketl}{\ensuremath{\llbracket}}\renewcommand{\@fglsembracketr}{\ensuremath{\rrbracket}}\renewcommand{\@fglsembracketL}{\text{\textbf{\textlbrackdbl}}}\renewcommand{\@fglsembracketR}{\text{\textbf{\textrbrackdbl}}}}

\def\@semanticbracketdirectstylemixed{mixed}
\ifx\FGL@semanticbracketdirectstyle\@semanticbracketdirectstylemixed
	\def\@fglreqtexversionforbrackets{2023/01/01}
	\@ifpackagelater{latex}{\@fglreqtexversionforbrackets}{}{\RequirePackage{textcomp}}
	\RequirePackage{stmaryrd}
	\@ifundefined{textrbrackdbl}{
	\PackageWarning{fragoli}{The textcomp package is NOT loaded correctly! Some symbols might be missing. Load textcomp or switch bracket style for direct interpretation.}
	}{
	\@ifundefined{llbracket}{
	\PackageWarning{fragoli}{The stmaryrd package is NOT loaded correctly! Some symbols might be missing. Load stmaryrd or switch bracket style for direct interpretation.}
	}{
	\fglsetdirectdelimitermixed
	}
	}
\fi

\DeclareDocumentCommand{\fglsetdirectdelimiterstmaryrd}{}{\renewcommand{\@fglsembracketl}{\ensuremath{\llbracket}}\renewcommand{\@fglsembracketr}{\ensuremath{\rrbracket}}\renewcommand{\@fglsembracketL}{\pmb{\ensuremath{\llbracket}}}\renewcommand{\@fglsembracketR}{\pmb{\ensuremath{\rrbracket}}}}

\def\@semanticbracketdirectstylestmaryrd{stmaryrd}
\ifx\FGL@semanticbracketdirectstyle\@semanticbracketdirectstylestmaryrd
	\RequirePackage{stmaryrd}
	\@ifundefined{llbracket}{
	\PackageWarning{fragoli}{The stmaryrd package is NOT loaded correctly! Some symbols might be missing. Load stmaryrd or switch bracket style for direct interpretation.}
	}{
	\fglsetdirectdelimiterstmaryrd
	}
\fi

\DeclareDocumentCommand{\fglsetdirectdelimitermathabx}{}{\renewcommand{\@fglsembracketl}{\ensuremath{\ldbrack}}\renewcommand{\@fglsembracketr}{\ensuremath{\rdbrack}}\renewcommand{\@fglsembracketL}{\pmb{\ensuremath{\ldbrack}}}\renewcommand{\@fglsembracketR}{\pmb{\ensuremath{\rdbrack}}}}

\def\@semanticbracketdirectstylemathabx{mathabx}
\ifx\FGL@semanticbracketdirectstyle\@semanticbracketdirectstylemathabx
	\RequirePackage[mathx10]{mathabx}
	\@ifundefined{ldbrack}{
	\PackageWarning{fragoli}{The mathabx package is NOT loaded correctly! Some symbols might be missing. Load mathabx or switch bracket style for direct interpretation.}
	}{
	\fglsetdirectdelimitermathabx
	}
\fi

\DeclareDocumentCommand{\fglsetdirectdelimitermnsymbol}{}{\renewcommand{\@fglsembracketl}{\ensuremath{\lsem}}\renewcommand{\@fglsembracketr}{\ensuremath{\rsem}}\renewcommand{\@fglsembracketL}{\pmb{\ensuremath{\lsem}}}\renewcommand{\@fglsembracketR}{\pmb{\ensuremath{\rsem}}}}

\def\@semanticbracketdirectstylemnsymbol{MnSymbol}
\ifx\FGL@semanticbracketdirectstyle\@semanticbracketdirectstylemnsymbol
	\RequirePackage{MnSymbol}
	\@ifundefined{lsem}{
	\PackageWarning{fragoli}{The MnSymbol package is NOT loaded correctly! Some symbols might be missing. Load MnSymbol or switch bracket style for direct interpretation.}
	}{
	\fglsetdirectdelimitermnsymbol
	}
\fi

\def\@fglsembracketlbackup{\@fglsembracketl}
\def\@fglsembracketrbackup{\@fglsembracketr}
\def\@fglsembracketLbackup{\@fglsembracketL}
\def\@fglsembracketRbackup{\@fglsembracketR}

\def\fglsetdirectdelimiterl#1{\def\@fglsembracketl{#1}}
\def\fglsetdirectdelimiterr#1{\def\@fglsembracketr{#1}}
\def\fglsetdirectdelimiterL#1{\def\@fglsembracketL{#1}}
\def\fglsetdirectdelimiterR#1{\def\@fglsembracketR{#1}}

\def\fglresetdirectdelimiterl{\def\@fglsembracketl{\@fglsembracketlbackup}}
\def\fglresetdirectdelimiterr{\def\@fglsembracketr{\@fglsembracketrbackup}}
\def\fglresetdirectdelimiterL{\def\@fglsembracketL{\@fglsembracketLbackup}}
\def\fglresetdirectdelimiterR{\def\@fglsembracketR{\@fglsembracketRbackup}}
\def\fglresetdirectdelimiter{\fglresetdirectdelimiterl\fglresetdirectdelimiterr\fglresetdirectdelimiterL\fglresetdirectdelimiterR}

% indirect interpretation translation
\def\@fglsembracketitl{\ensuremath{\lvert}}
\def\@fglsembracketitr{\ensuremath{\rvert}}
\def\@fglsembracketitL{\ensuremath{\bm{\lvert}}}
\def\@fglsembracketitR{\ensuremath{\bm{\rvert}}}

\def\@fglsembracketitlbackup{\@fglsembracketitl}
\def\@fglsembracketitrbackup{\@fglsembracketitr}
\def\@fglsembracketitLbackup{\@fglsembracketitL}
\def\@fglsembracketitRbackup{\@fglsembracketitR}

\def\fglsetindirecttranslationdelimiterl#1{\def\@fglsembracketitl{#1}}
\def\fglsetindirecttranslationdelimiterr#1{\def\@fglsembracketitr{#1}}
\def\fglsetindirecttranslationdelimiterL#1{\def\@fglsembracketitL{#1}}
\def\fglsetindirecttranslationdelimiterR#1{\def\@fglsembracketitR{#1}}

\def\fglresetindirecttranslationdelimiterl{\def\@fglsembracketitl{\@fglsembracketitlbackup}}
\def\fglresetindirecttranslationdelimiterr{\def\@fglsembracketitr{\@fglsembracketitrbackup}}
\def\fglresetindirecttranslationdelimiterL{\def\@fglsembracketitL{\@fglsembracketitLbackup}}
\def\fglresetindirecttranslationdelimiterR{\def\@fglsembracketitR{\@fglsembracketitRbackup}}
\def\fglresetindirecttranslationdelimiter{\fglresetindirecttranslationdelimiterl\fglresetindirecttranslationdelimiterr\fglresetindirecttranslationdelimiterL\fglresetindirecttranslationdelimiterR}

% indirect interpretation denotation
\def\@fglsembracketidl{\ensuremath{\parallel}}
\def\@fglsembracketidr{\ensuremath{\parallel}}
\def\@fglsembracketidL{\ensuremath{\bm{\parallel}}}
\def\@fglsembracketidR{\ensuremath{\bm{\parallel}}}

\def\@fglsembracketidlbackup{\@fglsembracketidl}
\def\@fglsembracketidrbackup{\@fglsembracketidr}
\def\@fglsembracketidLbackup{\@fglsembracketidL}
\def\@fglsembracketidRbackup{\@fglsembracketidR}

\def\fglsetindirectdenotatiodelimiterl#1{\def\@fglsembracketidl{#1}}
\def\fglsetindirectdenotatiodelimiterr#1{\def\@fglsembracketidr{#1}}
\def\fglsetindirectdenotatiodelimiterL#1{\def\@fglsembracketidL{#1}}
\def\fglsetindirectdenotatiodelimiterR#1{\def\@fglsembracketidR{#1}}

\def\fglresetindirectdenotationdelimiterl{\renewcommand{\@fglsembracketidl}{\@fglsembracketidlbackup}}
\def\fglresetindirectdenotationdelimiterr{\renewcommand{\@fglsembracketidr}{\@fglsembracketidrbackup}}
\def\fglresetindirectdenotationdelimiterL{\renewcommand{\@fglsembracketidL}{\@fglsembracketidLbackup}}
\def\fglresetindirectdenotationdelimiterR{\renewcommand{\@fglsembracketidR}{\@fglsembracketidRbackup}}
\def\fglresetindirectdenotationdelimiter{\fglresetindirectdenotationdelimiterl\fglresetindirectdenotationdelimiterr\fglresetindirectdenotationdelimiterL\fglresetindirectdenotationdelimiterR}



% ------------------------------
% define types style:
% ------------------------------
% - labels are defined separate for each style
% - if language is not set, normal is used
% ------------------------------
\def\@fragolitpnl{\ensuremath{\langle}}
\def\@fragolitpnr{\ensuremath{\rangle}}
\def\@fglstspacer{\!}
\def\@fglstspaceR{\kern-1pt}
\def\@fragolitypespacingwide{wide}
\ifx\FGL@typespacing\@fragolitypespacingwide
\def\@fglstspacer{}
\def\@fglstspaceR{}
\fi

\def\@fragolitypespacingmid{mid}
\ifx\FGL@typespacing\@fragolitypespacingmid
\def\@fglstspacer{\!}
\def\@fglstspaceR{}
\fi

\def\fglsettypespaceinner#1{\def\@fglstspacer{#1}}
\def\fglsettypespaceouter#1{\def\@fglstspaceR{#1}}
\def\fglresettypespaceinner{\def\@fglstspacer{\@fglstspacerbackup}}
\def\fglresettypespaceouter{\def\@fglstspaceR{\@fglstspaceRbackup}}

\DeclareDocumentCommand{\type}{O{\@fglstspacer} O{\@fglstspaceR} m O{\@fragolitpnl} O{\@fragolitpnr}}{#4#1\ensuremath{{\fglstypeprinter[#1][#2][#4][#5] #3}}#1#5}
\DeclareDocumentCommand{\@fgltype}{O{\@fglstspacer} O{\@fglstspaceR} m O{\@fragolitpnl} O{\@fragolitpnr}}{#4#1\ensuremath{#3}#1#5}

\def\@fragolinestedtypestyle{classic}
\ifx\FGL@typenestingstyle\@fragolinestedtypestyle
\def\type#1{\ensuremath{{\fglstypeprinter #1}}}
\fi

\def\@fragoliparatypestyleclassic{classic}
\ifx\FGL@typestyle\@fragoliparatypestyleclassic
\def\@fragolitpnl{(}
\def\@fragolitpnr{)}
\fi
\def\@fragoliparatypestylealternative{alternative}
\ifx\FGL@typestyle\@fragoliparatypestylealternative
\def\@fragolitpnl{\ensuremath{<}}
\def\@fragolitpnr{\ensuremath{>}}
\fi

\def\fglsetparleft#1{\def\@fragolitpnl{#1}}
\def\fglsetparright#1{\def\@fragolitpnr{#1}}
\def\fglresetparleft{\def\@fragolitpnl{\@fragolitpnlbackup}}
\def\fglresetparright{\def\@fragolitpnr{\@fragolitpnrbackup}}

\DeclareDocumentEnvironment{fglstypeprinter}{O{\@fglstspacer} O{\@fglstspaceR} O{\@fragolitpnl} O{\@fragolitpnr}}{%
	\DeclareDocumentCommand{\type}{O{#1} O{#2} m O{#3} O{#4}}{##2##4##1\ensuremath{{\fglstypeprinter[##1][##2][##4][##5] ##3}}##1##5##2}%
	\let\t\type%
    \let\te\typee%
    \let\td\typed%
    \let\tet\typeet%
    \let\teET\typeeET%
    \let\tt\typet%
    \let\ttt\typett%
    \let\ts\types%
    \let\tst\typest%
    \let\tse\typese%
	}{}

% ------------------------------------------------------------ 
% Object Builder
% ------------------------------------------------------------ 
\def\@fglsobjspace{\!}

\DeclareDocumentCommand{\sobj}{m m O{\@fglsobjspace}}{\meli{#1}#3\textsubscript{\meli{#2}}}
\DeclareDocumentCommand{\sobJ}{m m O{\@fglsobjspace}}{\obli{#1}#3\textsubscript{\obli{#2}}}
\DeclareDocumentCommand{\soBj}{m m O{\@fglsobjspace}}{\meli{#1}#3\textsuperscript{\meli{#2}}}
\DeclareDocumentCommand{\soBJ}{m m O{\@fglsobjspace}}{\obli{#1}#3\textsuperscript{\obli{#2}}}
\DeclareDocumentCommand{\sObj}{m m O{\@fglsobjspace}}{\text{#1}#3\textsubscript{#2}}
\DeclareDocumentCommand{\sObJ}{m m O{\@fglsobjspace}}{\text{\textbf{#1}}#3\textsubscript{\textbf{#1}}}
\DeclareDocumentCommand{\sOBj}{m m O{\@fglsobjspace}}{\text{#1}#3\textsuperscript{#2}}
\DeclareDocumentCommand{\sOBJ}{m m O{\@fglsobjspace}}{\text{\textbf{#1}}#3\textsuperscript{\textbf{#1}}}



% ------------------------------------------------------------ 
% constants
% ------------------------------------------------------------ 



\newcommand{\@fglsetspacer}{:}

% ------------------------------
% traces
% ------------------------------
\newcommand{\@fglstracespacing}{\kern-0.3pt}

\def\@fragolitracespacingwide{wide}
\ifx\FGL@tracespacing\@fragolitracespacingwide
	\def\@fglstracespacing{}
\fi

\def\@fragolitracespacingnarrow{narrow}
\ifx\FGL@tracespacing\@fragolitracespacingnarrow
	\def\@fglstracespacing{\kern-0.8pt}
\fi

\let\@fglstracespacingbackup\@fglstracespacing
\def\fglsettracespacing#1{\def\@fglstracespacing{#1}}
\def\fglresettracespacing{\def\@fglstracespacing{\@fglstracespacingbackup}}

\DeclareDocumentCommand{\trace}{m O{t} O{\@fglstracespacing}}{\sobj{#2}{#1}[#3]}
\DeclareDocumentCommand{\tracE}{m O{t} O{\@fglstracespacing}}{\sobJ{#2}{#1}[#3]}
\DeclareDocumentCommand{\tracex}{O{t}}{\trace{x}[#1]}
\DeclareDocumentCommand{\tracEx}{O{t}}{\tracE{x}[#1]}
\DeclareDocumentCommand{\traceX}{O{t}}{\trace{X}[#1]}
\DeclareDocumentCommand{\tracEX}{O{t}}{\tracE{X}[#1]}
\DeclareDocumentCommand{\tracey}{O{t}}{\trace{y}[#1]}
\DeclareDocumentCommand{\tracEy}{O{t}}{\tracE{y}[#1]}
\DeclareDocumentCommand{\traceY}{O{t}}{\trace{Y}[#1]}
\DeclareDocumentCommand{\tracEY}{O{t}}{\tracE{Y}[#1]}
\DeclareDocumentCommand{\tracez}{O{t}}{\trace{z}[#1]}
\DeclareDocumentCommand{\tracEz}{O{t}}{\tracE{z}[#1]}
\DeclareDocumentCommand{\traceZ}{O{t}}{\trace{Z}[#1]}
\DeclareDocumentCommand{\tracEZ}{O{t}}{\tracE{Z}[#1]}


% ------------------------------
% situations
% ------------------------------
\newcommand{\@fglssituationspacing}{\kern-0.8pt}

\def\@fragolisituationspacingwide{wide}
\ifx\FGL@situationspacing\@fragolisituationspacingwide
	\def\@fglssituationspacing{}
\fi

\def\@fragolisituationspacingmid{mid}
\ifx\FGL@situationspacing\@fragolisituationspacingmid
	\def\@fglssituationspacing{\kern-0.3pt}
\fi

\let\@fglssituationspacingbackup\@fglssituationspacing
\def\fglsetsituationspacing#1{\def\@fglssituationspacing{#1}}
\def\fglresetsituationspacing{\def\@fglssituationspacing{\@fglssituationspacingbackup}}

\def\sarg#1{\sobj{s}{#1}[\@fglssituationspacing]}
\def\sarG#1{\sobJ{s}{#1}[\@fglssituationspacing]}
\def\saRg#1{\soBj{s}{#1}[\@fglssituationspacing]}
\def\saRG#1{\soBJ{s}{#1}[\@fglssituationspacing]}


\def\sblank{\text{\textit{s}}}
\def\sblanK{\text{\textit{\textbf{s}}}}
\def\sstar{\saRg{\ensuremath{\ast}}}
\def\sstaR{\saRG{\ensuremath{\ast}}}
\def\szero{\sarg{0}}
\def\szerO{\sarG{0}}
\def\sone{\sarg{1}}
\def\sonE{\sarG{1}}
\def\stwo{\sarg{2}}
\def\stwO{\sarG{2}}
\def\sthree{\sarg{3}}
\def\sthreE{\sarG{3}}
\def\sfour{\sarg{4}}
\def\sfouR{\sarG{4}}
\def\sfive{\sarg{5}}
\def\sfivE{\sarG{5}}
\def\ssix{\sarg{6}}
\def\ssiX{\sarG{6}}
\def\sseven{\sarg{7}}
\def\sseveN{\sarG{7}}
\def\seight{\sarg{8}}
\def\seighT{\sarG{8}}
\def\snine{\sarg{9}}
\def\sninE{\sarG{9}}
\def\sten{\sarg{10}}
\def\steN{\sarG{10}}


% ------------------------------
% types
% ------------------------------

\def\typed{\@fgltype{d}}
\def\typet{\@fgltype{t}}
\def\typee{\@fgltype{e}}
\def\types{\@fgltype{s}}
\def\typedt{\@fgltype{dt}}
\def\typeee{\@fgltype{ee}}
\def\typeet{\@fgltype{et}}
\def\typees{\@fgltype{es}}
\def\typess{\@fgltype{ss}}
\def\typest{\@fgltype{st}}
\def\typese{\@fgltype{se}}
\def\typett{\@fgltype{tt}}
\def\typete{\@fgltype{te}}
\def\typets{\@fgltype{ts}}

\def\typesSS{\@fgltype{s\@fgltype{ss}}}
\def\typesST{\@fgltype{s\@fgltype{st}}}
\def\typesSE{\@fgltype{s\@fgltype{se}}}
\def\typesTS{\@fgltype{s\@fgltype{ts}}}
\def\typesTE{\@fgltype{s\@fgltype{te}}}
\def\typesTT{\@fgltype{s\@fgltype{tt}}}
\def\typesES{\@fgltype{s\@fgltype{es}}}
\def\typesET{\@fgltype{s\@fgltype{et}}}
\def\typesEE{\@fgltype{s\@fgltype{ee}}}
\def\typeSSs{\@fgltype{\@fgltype{ss}s}}
\def\typeSSt{\@fgltype{\@fgltype{ss}t}}
\def\typeSSe{\@fgltype{\@fgltype{ss}e}}
\def\typeSTs{\@fgltype{\@fgltype{st}s}}
\def\typeSTe{\@fgltype{\@fgltype{st}e}}
\def\typeSTt{\@fgltype{\@fgltype{st}t}}
\def\typeSEs{\@fgltype{\@fgltype{se}s}}
\def\typeSEt{\@fgltype{\@fgltype{se}t}}
\def\typeSEe{\@fgltype{\@fgltype{se}e}}

\def\typeeEE{\@fgltype{e\@fgltype{ee}}}
\def\typeeES{\@fgltype{e\@fgltype{es}}}
\def\typeeET{\@fgltype{e\@fgltype{et}}}
\def\typeeSS{\@fgltype{e\@fgltype{ss}}}
\def\typeeSE{\@fgltype{e\@fgltype{se}}}
\def\typeeST{\@fgltype{e\@fgltype{st}}}
\def\typeeTT{\@fgltype{e\@fgltype{tt}}}
\def\typeeTE{\@fgltype{e\@fgltype{te}}}
\def\typeeTS{\@fgltype{e\@fgltype{ts}}}
\def\typeEEe{\@fgltype{\@fgltype{ee}e}}
\def\typeEEs{\@fgltype{\@fgltype{ee}s}}
\def\typeEEt{\@fgltype{\@fgltype{ee}t}}
\def\typeESs{\@fgltype{\@fgltype{es}s}}
\def\typeESe{\@fgltype{\@fgltype{es}e}}
\def\typeESt{\@fgltype{\@fgltype{es}t}}
\def\typeETt{\@fgltype{\@fgltype{et}t}}
\def\typeETe{\@fgltype{\@fgltype{et}e}}
\def\typeETs{\@fgltype{\@fgltype{et}s}}

\def\typetTT{\@fgltype{t\@fgltype{tt}}}
\def\typetTS{\@fgltype{t\@fgltype{ts}}}
\def\typetTE{\@fgltype{t\@fgltype{te}}}
\def\typetEE{\@fgltype{t\@fgltype{ee}}}
\def\typetET{\@fgltype{t\@fgltype{et}}}
\def\typetES{\@fgltype{t\@fgltype{es}}}
\def\typetSS{\@fgltype{t\@fgltype{ss}}}
\def\typetSE{\@fgltype{t\@fgltype{se}}}
\def\typetST{\@fgltype{t\@fgltype{st}}}
\def\typeTTt{\@fgltype{\@fgltype{tt}t}}
\def\typeTTs{\@fgltype{\@fgltype{tt}s}}
\def\typeTTe{\@fgltype{\@fgltype{tt}e}}
\def\typeTEe{\@fgltype{\@fgltype{te}e}}
\def\typeTEt{\@fgltype{\@fgltype{te}t}}
\def\typeTEs{\@fgltype{\@fgltype{te}s}}
\def\typeTSs{\@fgltype{\@fgltype{ts}s}}
\def\typeTSe{\@fgltype{\@fgltype{ts}e}}
\def\typeTSt{\@fgltype{\@fgltype{ts}t}}

\def\typesleETr{\@fgltype{s\@fgltype{e\@fgltype{et}}}}
\def\typeretETlt{\@fgltype{\@fgltype{\@fgltype{et}\@fgltype{et}}t}}
\def\typeetrETtl{\@fgltype{\@fgltype{et}\@fgltype{\@fgltype{et}t}}}



% ------------------------------
% colors
% ------------------------------

\definecolor{grau}{rgb}{0.85,0.85,0.85}
\definecolor{hellgrau}{rgb}{0.95,0.95,0.95}
\definecolor{fgldeivationrowcountcolor}{rgb}{0.72,0.72,0.72}

% ------------------------------------------------------------ 
% internal variables
% ------------------------------------------------------------ 
\def\setvar{\ensuremath{\IfSubStr{\!\romannumeral-`\0\@fglssetvariable}{ }{\StrBefore{\romannumeral-`\0\@fglssetvariable}{ }}{\romannumeral-`\0\@fglssetvariable}}}
\def\Setvar{\setvar\ }

% ------------------------------------------------------------
% Commands
% ------------------------------------------------------------
% ------------------------------
% Text
% ------------------------------
\newlength{\@fglULdepthbackup}
\setlength{\@fglULdepthbackup}{\ULdepth}
\def\oO#1{\setlength{\ULdepth}{-2.5ex}\uuline{#1}\setlength{\ULdepth}{\@fglULdepthbackup}}
\DeclareDocumentCommand{\oo}{m O{-2ex}}{\setlength{\ULdepth}{#2}\uuline{#1}\setlength{\ULdepth}{\@fglULdepthbackup}}

\def\obl#1{\textbf{#1}}
\def\obli#1{\textit{\textbf{#1}}}
\DeclareDocumentCommand{\obla}{m O{} O{} O{} O{} O{} O{} O{} O{}}{(\textbf{#1})\@ifempty{#2}{}{(\textbf{#2})}\@ifempty{#3}{}{(\textbf{#3})}\@ifempty{#4}{}{(\textbf{#4})}\@ifempty{#5}{}{(\textbf{#5})}\@ifempty{#6}{}{(\textbf{#6})}\@ifempty{#7}{}{(\textbf{#7})}\@ifempty{#8}{}{(\textbf{#8})}\@ifempty{#9}{}{(\textbf{#9})}}

\DeclareDocumentCommand{\oblA}{m O{} O{} O{} O{} O{} O{} O{} O{}}{\obl{(}\textbf{#1}\obl{)}\ifempty{#2}\else\obl{(}\textbf{#2}\obl{)}\fi\ifempty{#3}\else\obl{(}\textbf{#3}\obl{)}\fi\ifempty{#4}\else\obl{(}\textbf{#4}\obl{)}\fi\ifempty{#5}\else\obl{(}\textbf{#5}\obl{)}\fi\ifempty{#6}\else\obl{(}\textbf{#6}\obl{)}\fi\ifempty{#7}\else\obl{(}\textbf{#7}\obl{)}\fi\ifempty{#8}\else\obl{(}\textbf{#8}\obl{)}\fi\ifempty{#9}\else\obl{(}\textbf{#9}\obl{)}\fi}

\DeclareDocumentCommand{\oblia}{m O{} O{} O{} O{} O{} O{} O{} O{}}{\obl{(}\obli{#1}\obl{)}\ifempty{#2}\else\obl{(}\obli{#2}\obl{)}\fi\ifempty{#3}\else\obl{(}\obli{#3}\obl{)}\fi\ifempty{#4}\else\obl{(}\obli{#4}\obl{)}\fi\ifempty{#5}\else\obl{(}\obli{#5}\obl{)}\fi\ifempty{#6}\else\obl{(}\obli{#6}\obl{)}\fi\ifempty{#7}\else\obl{(}\obli{#7}\obl{)}\fi\ifempty{#8}\else\obl{(}\obli{#8}\obl{)}\fi\ifempty{#9}\else\obl{(}\obli{#9}\obl{)}\fi}
\def\mel#1{\text{#1}}
\def\meli#1{\text{\textit{#1}}}

\DeclareDocumentCommand{\mela}{m O{} O{} O{} O{} O{} O{} O{} O{}}{(\mel{#1})\@ifempty{#2}{}{(\mel{#2})}\@ifempty{#3}{}{(\mel{#3})}\@ifempty{#4}{}{(\mel{#4})}\@ifempty{#5}{}{(\mel{#5})}\@ifempty{#6}{}{(\mel{#6})}\@ifempty{#7}{}{(\mel{#7})}\@ifempty{#8}{}{(\mel{#8})}\@ifempty{#9}{}{(\mel{#9})}}

\DeclareDocumentCommand{\melA}{m O{} O{} O{} O{} O{} O{} O{} O{}}{\obl{(}\mel{#1}\obl{)}\ifempty{#2}\else\obl{(}\mel{#2}\obl{)}\fi\ifempty{#3}\else\obl{(}\mel{#3}\obl{)}\fi\ifempty{#4}\else\obl{(}\mel{#4}\obl{)}\fi\ifempty{#5}\else\obl{(}\mel{#5}\obl{)}\fi\ifempty{#6}\else\obl{(}\mel{#6}\obl{)}\fi\ifempty{#7}\else\obl{(}\mel{#7}\obl{)}\fi\ifempty{#8}\else\obl{(}\mel{#8}\obl{)}\fi\ifempty{#9}\else\obl{(}\mel{#9}\obl{)}\fi}

\DeclareDocumentCommand{\melia}{m O{} O{} O{} O{} O{} O{} O{} O{}}{\obl{(}\meli{#1}\obl{)}\ifempty{#2}\else\obl{(}\meli{#2}\obl{)}\fi\ifempty{#3}\else\obl{(}\meli{#3}\obl{)}\fi\ifempty{#4}\else\obl{(}\meli{#4}\obl{)}\fi\ifempty{#5}\else\obl{(}\meli{#5}\obl{)}\fi\ifempty{#6}\else\obl{(}\meli{#6}\obl{)}\fi\ifempty{#7}\else\obl{(}\meli{#7}\obl{)}\fi\ifempty{#8}\else\obl{(}\meli{#8}\obl{)}\fi\ifempty{#9}\else\obl{(}\meli{#9}\obl{)}\fi}

\DeclareDocumentCommand{\meliA}{m O{} O{} O{} O{} O{} O{} O{} O{}}{(\meli{#1})\ifempty{#2}\else(\meli{#2})\fi\ifempty{#3}\else(\meli{#3})\fi\ifempty{#4}\else(\meli{#4})\fi\ifempty{#5}\else(\meli{#5})\fi\ifempty{#6}\else(\meli{#6})\fi\ifempty{#7}\else(\meli{#7})\fi\ifempty{#8}\else(\meli{#8})\fi\ifempty{#9}\else(\meli{#9})\fi}

% ------------------------------
% Encapsulation
% ------------------------------

\def\zit#1{``#1''}				
\def\ziT#1{\textbf{``}#1\textbf{''}}				
\def\her#1{`#1'}	
\def\heR#1{\textbf{`}#1\textbf{'}}			


%% Brackets
\DeclareDocumentCommand{\set}{O{x} m O{}}{\DeclareDocumentCommand{\@fglssetvariable}{}{#1}\@ifempty{#3}{}{#3\ =\ }\{\ensuremath{#1} \@fglsetspacer\ #2\}}
\DeclareDocumentCommand{\seT}{O{x} m O{}}{\DeclareDocumentCommand{\@fglssetvariable}{}{#1}\@ifempty{#3}{}{\obl{#3}\ \obl{=}\ }\obl{\{}\ensuremath{#1} \obl{\@fglsetspacer}\ #2\obl{\}}}
\DeclareDocumentCommand{\cset}{m O{} O{\sstar}}{\ensuremath{#1_\text{#3}^\text{#2}}}
\def\bool#1{\ensuremath{\vdash}#1\ensuremath{\dashv}}
\def\booL#1{\ensuremath{\bm{\vdash}}#1\ensuremath{\bm{\dashv}}}
\DeclareDocumentCommand{\lambby}{O{} O{} m}{\ensuremath{[_{#1}}\@ifempty{#1}{}{\ }#3\ensuremath{]_{#2}}}
\DeclareDocumentCommand{\lambbY}{O{} O{} m}{\textbf{[}\ensuremath{_{#1}}\@ifempty{#1}{}{\ }#3\textbf{]}\ensuremath{_{#2}}}

% ------------------------------
% Logic (nc = no notational convention)
% ------------------------------

\def\sneg{\ensuremath{\neg}}
\def\sneG{\ensuremath{\boldsymbol{\neg}}}

\def\strue{\ensuremath{\top}}
\def\struE{\ensuremath{\bm{\top}}}

\def\sfalse{\ensuremath{\bot}}
\def\sfalsE{\ensuremath{\bm{\bot}}}

\def\snec{\ensuremath{\Box}}
\def\sneC{\ensuremath{\bm{\Box}}}

\def\sposs{\ensuremath{\Diamond}}
\def\sposS{\ensuremath{\bm{\Diamond}}}

\def\simp#1#2{#1 \ensuremath{\rightarrow} #2}
\def\simP#1#2{#1 \ensuremath{\bm{\rightarrow}} #2}
\def\simpnc#1#2{\ensuremath{\rightarrow}(#1)(#2)}
\def\simpnC#1#2{\ensuremath{\bm{\rightarrow}}\obl{(}#1\obl{)}\obl{(}#2\obl{)}}

\DeclareDocumentCommand{\sanD}{m m O{} O{} O{} O{} O{} O{} O{}}{#1 \ensuremath{\bm{\land}} #2\ifempty{#3}\else\ \ensuremath{\bm{\land}} #3\fi\ifempty{#4}\else\ \ensuremath{\bm{\land}} #4\fi\ifempty{#5}\else\ \ensuremath{\bm{\land}} #5\fi\ifempty{#6}\else\ \ensuremath{\bm{\land}} #6\fi\ifempty{#7}\else\ \ensuremath{\bm{\land}} #7\fi\ifempty{#8}\else\ \ensuremath{\bm{\land}} #8\fi\ifempty{#9}\else\ \ensuremath{\bm{\land}} #9\fi}
\DeclareDocumentCommand{\sand}{m m O{} O{} O{} O{} O{} O{} O{}}{#1 \ensuremath{\land} #2\ifempty{#3}\else\ \ensuremath{\land} #3\fi\ifempty{#4}\else\ \ensuremath{\land} #4\fi\ifempty{#5}\else\ \ensuremath{\land} #5\fi\ifempty{#6}\else\ \ensuremath{\land} #6\fi\ifempty{#7}\else\ \ensuremath{\land} #7\fi\ifempty{#8}\else\ \ensuremath{\land}#8\fi\ifempty{#9}\else\ \ensuremath{\land} #9\fi}
\DeclareDocumentCommand{\sandnc}{m m O{} O{} O{} O{} O{} O{} O{}}{\ensuremath{\land}\mela{#1}[#2][#3][#4][#5][#6][#7][#8][#9]}
\DeclareDocumentCommand{\sandnC}{m m O{} O{} O{} O{} O{} O{} O{}}{\ensuremath{\bm{\land}}\oblA{#1}[#2][#3][#4][#5][#6][#7][#8][#9]}

\DeclareDocumentCommand{\sornc}{m m O{} O{} O{} O{} O{} O{} O{}}{\ensuremath{\lor}\mela{#1}[#2][#3][#4][#5][#6][#7][#8][#9]}
\DeclareDocumentCommand{\sornC}{m m O{} O{} O{} O{} O{} O{} O{}}{\ensuremath{\bm{\lor}}\obla{#1}[#2][#3][#4][#5][#6][#7][#8][#9]}



\DeclareDocumentCommand{\soR}{m m O{} O{} O{} O{} O{} O{} O{}}{#1 \ensuremath{\bm{\lor}} #2\ifempty{#3}\else\ \ensuremath{\bm{\lor}} #3\fi\ifempty{#4}\else\ \ensuremath{\bm{\lor}} #4\fi\ifempty{#5}\else\ \ensuremath{\bm{\lor}} #5\fi\ifempty{#6}\else\ \ensuremath{\bm{\lor}} #6\fi\ifempty{#7}\else\ \ensuremath{\bm{\lor}} #7\fi\ifempty{#8}\else\ \ensuremath{\bm{\lor}} #8\fi\ifempty{#9}\else\ \ensuremath{\bm{\lor}} #9\fi}
\DeclareDocumentCommand{\sor}{m m O{} O{} O{} O{} O{} O{} O{}}{#1 \ensuremath{\lor} #2\ifempty{#3}\else\ \ensuremath{\lor} #3\fi\ifempty{#4}\else\ \ensuremath{\lor} #4\fi\ifempty{#5}\else\ \ensuremath{\lor} #5\fi\ifempty{#6}\else\ \ensuremath{\lor} #6\fi\ifempty{#7}\else\ \ensuremath{\lor} #7\fi\ifempty{#8}\else\ \ensuremath{\lor} #8\fi\ifempty{#9}\else\ \ensuremath{\lor} #9\fi}

%% exclusive disjunction
\DeclareDocumentCommand{\sxornc}{m m O{} O{} O{} O{} O{} O{} O{}}{\ensuremath{\veebar}\mela{#1}[#2][#3][#4][#5][#6][#7][#8][#9]}
\DeclareDocumentCommand{\sxornC}{m m O{} O{} O{} O{} O{} O{} O{}}{\ensuremath{\bm{\veebar}}\obla{#1}[#2][#3][#4][#5][#6][#7][#8][#9]}

\DeclareDocumentCommand{\sxoR}{m m O{} O{} O{} O{} O{} O{} O{}}{#1 \ensuremath{\bm{\veebar}} #2\ifempty{#3}\else\ \ensuremath{\bm{\veebar}} #3\fi\ifempty{#4}\else\ \ensuremath{\bm{\veebar}} #4\fi\ifempty{#5}\else\ \ensuremath{\bm{\veebar}} #5\fi\ifempty{#6}\else\ \ensuremath{\bm{\veebar}} #6\fi\ifempty{#7}\else\ \ensuremath{\bm{\veebar}} #7\fi\ifempty{#8}\else\ \ensuremath{\bm{\veebar}} #8\fi\ifempty{#9}\else\ \ensuremath{\bm{\veebar}} #9\fi}
\DeclareDocumentCommand{\sxor}{m m O{} O{} O{} O{} O{} O{} O{}}{#1 \ensuremath{\veebar} #2\ifempty{#3}\else\ \ensuremath{\veebar} #3\fi\ifempty{#4}\else\ \ensuremath{\veebar} #4\fi\ifempty{#5}\else\ \ensuremath{\veebar} #5\fi\ifempty{#6}\else\ \ensuremath{\veebar} #6\fi\ifempty{#7}\else\ \ensuremath{\veebar} #7\fi\ifempty{#8}\else\ \ensuremath{\veebar} #8\fi\ifempty{#9}\else\ \ensuremath{\veebar} #9\fi}

%% genral junctor builder
\DeclareDocumentCommand{\slogic}{m m m O{} O{} O{} O{} O{} O{}}{#2 \ensuremath{#1} #3\ifempty{#4}\else\ \ensuremath{#3} #4\fi\ifempty{#5}\else\ \ensuremath{#3} #5\fi\ifempty{#6}\else\ \ensuremath{#3} #6\fi\ifempty{#7}\else\ \ensuremath{#3} #7\fi\ifempty{#8}\else\ \ensuremath{#3} #8\fi\ifempty{#9}\else\ \ensuremath{#3} #9\fi}

\DeclareDocumentCommand{\slogiC}{m m m O{} O{} O{} O{} O{} O{}}{#2 \ensuremath{\bm{#1}} #3\ifempty{#4}\else\ \ensuremath{\bm{#3}} #4\fi\ifempty{#5}\else\ \ensuremath{\bm{#3}} #5\fi\ifempty{#6}\else\ \ensuremath{\bm{#3}} #6\fi\ifempty{#7}\else\ \ensuremath{\bm{#3}} #7\fi\ifempty{#8}\else\ \ensuremath{\bm{#3}} #8\fi\ifempty{#9}\else\ \ensuremath{\bm{#3}} #9\fi}

\DeclareDocumentCommand{\slogicnc}{m m m O{} O{} O{} O{} O{} O{}}{\ensuremath{#1}\mela{#2}[#3][#4][#5][#6][#7][#8][#9]}
\DeclareDocumentCommand{\slogicnC}{m m m O{} O{} O{} O{} O{} O{}}{\ensuremath{\bm{#1}}\obla{#2}[#3][#4][#5][#6][#7][#8][#9]}

% ------------------------------
% Lambda
% ------------------------------

% General Lambda Functions

%% Extension
\DeclareDocumentCommand{\lambfx}{m O{x} O{}}{\lambh{#2}[#3]\bool{#1}}
\DeclareDocumentCommand{\lambfX}{m O{x} O{}}{\lambH{#2}[#3]\booL{#1}}
\DeclareDocumentCommand{\lambfyx}{m O{y} O{x} O{} O{}}{\lambh{#2}[#4]\lambh{#3}[#5]\bool{#1}}
\DeclareDocumentCommand{\lambfyX}{m O{y} O{x} O{} O{}}{\lambH{#2}[#4]\lambH{#3}[#5]\booL{#1}}
\DeclareDocumentCommand{\lambfzyx}{m O{z} O{y} O{x} O{} O{} O{}}{\lambh{#2}[#5]\lambh{#3}[#6]\lambh{#4}[#7]\bool{#1}}
\DeclareDocumentCommand{\lambfzyX}{m O{z} O{y} O{x} O{} O{} O{}}{\lambH{#2}[#5]\lambH{#3}[#6]\lambH{#4}[#7]\booL{#1}}

%% Intension
\DeclareDocumentCommand{\lambfsx}{m O{x} O{s} O{} O{}}{\lambh{#3}[#5]\lambh{#2}[#4]\bool{#1}}
\DeclareDocumentCommand{\lambfsX}{m O{x} O{s} O{} O{}}{\lambH{#3}[#4]\lambH{#2}[#4]\booL{#1}}
\DeclareDocumentCommand{\lambfsyx}{m O{y} O{x} O{s} O{} O{} O{}}{\lambh{#4}[#7]\lambh{#2}[#5]\lambh{#3}[#6]\bool{#1}}
\DeclareDocumentCommand{\lambfsyX}{m O{y} O{x} O{s} O{} O{} O{}}{\lambH{#4}[#7]\lambh{#2}[#5]\lambH{#3}[#6]\booL{#1}}
\DeclareDocumentCommand{\lambfszyx}{m O{z} O{y} O{x} O{s} O{} O{} O{} O{}}{\lambh{#5}[#9]\lambh{#2}[#6]\lambh{#3}[#7]\lambh{#4}[#8]\bool{#1}}
\DeclareDocumentCommand{\lambfszyX}{m O{z} O{y} O{x} O{s} O{} O{} O{} O{}}{\lambH{#5}[#9]\lambh{#2}[#6]\lambH{#3}[#7]\lambH{#4}[#8]\booL{#1}}

%% Lambda Heads
\def\@fglslhspacer{\!}

\def\@fragolilheadspacingmid{mid}
\ifx\FGL@lambdaheadspacing\@fragolilheadspacingmid
\def\@fglslhspacer{\kern-1pt}
\fi

\def\@fragolilheadspacingwide{wide}
\ifx\FGL@lambdaheadspacing\@fragolilheadspacingwide
\def\@fglslhspacer{}
\fi

\let\@fglslhspacerbackup\@fglslhspacer
\def\fglsetlambdaheadspacing#1{\def\@fglslhspacer{#1}}
\def\fglresetlambdaheadspacing{\def\@fglslhspacer{\@fglslhspacerbackup}}

\DeclareDocumentCommand{\lambh}{m O{} O{\@fglslhspacer}}{\ensuremath{\lambda\textit{#1}}\@ifempty{#2}{}{\textsubscript{#2}#3}.}
\DeclareDocumentCommand{\lambH}{m O{} O{\@fglslhspacer}}{\ensuremath{\boldsymbol{\lambda}}\obli{#1}\@ifempty{#2}{}{#3\textsubscript{#2}#3}\obl{.}}
\DeclareDocumentCommand{\@lambhquantorbuilder}{m m m O{\@fglslhspacer}}{\mel{(}\ensuremath{#1}\textit{#2}\@ifempty{#3}{}{#4}\textsubscript{#3}#4\mel{)}}
\DeclareDocumentCommand{\@lambhquantorbuildeR}{m m m O{\@fglslhspacer}}{\obl{(}\ensuremath{\bm{#1}}\obli{#2}\@ifempty{#3}{}{#4}\textsubscript{#3}#4\obl{)}}

%% Override lambda heads to domain style if package parameter is set to domain
\def\@fragoliconsttsdomain{domain}
\IfStrEq{\FGL@lambdaheadstyle}{\@fragoliconsttsdomain}{
	\DeclareDocumentCommand{\lambh}{m O{} O{\@fglslhspacer}}{\ensuremath{\lambda\textit{#1}}\@ifempty{#2}{}{\text{ }\ensuremath{\in}\text{ D\textsubscript{#2}}#3}.}
	\DeclareDocumentCommand{\lambH}{m O{} O{\@fglslhspacer}}{\ensuremath{\boldsymbol{\lambda}}\obli{#1}\@ifempty{#2}{}{\text{ }\ensuremath{\bm{\in}}\text{ D\textsubscript{#2}}#3}.}
	\DeclareDocumentCommand{\@lambhquantorbuilder}{m m m O{\@fglslhspacer}}{\mel{(}\ensuremath{#1}\textit{#2}\@ifempty{#3}{}{\text{ }\ensuremath{\in}\text{ D\textsubscript{#3}}}#4\mel{)}}
	\DeclareDocumentCommand{\@lambhquantorbuildeR}{m m m O{\@fglslhspacer}}{\obl{(}\ensuremath{\bm{#1}}\obli{#2}\@ifempty{#3}{}{\text{ }\ensuremath{\bm{\in}}\text{ D\textsubscript{#3}}}#4\obl{)}}
}{}

%% Override lambda heads to upper style if package parameter is set to domain
\def\@fragoliconsttsupper{upper}
\IfStrEq{\FGL@lambdaheadstyle}{\@fragoliconsttsupper}{
	\DeclareDocumentCommand{\lambh}{m O{} O{\@fglslhspacer}}{\ensuremath{\lambda\textit{#1}}\@ifempty{#2}{}{\textsuperscript{#2}#3}.}
	\DeclareDocumentCommand{\lambH}{m O{} O{\@fglslhspacer}}{\ensuremath{\boldsymbol{\lambda}}\obli{#1}\@ifempty{#2}{}{#3\textsuperscript{#2}#3}\obl{.}}
	\DeclareDocumentCommand{\@lambhquantorbuilder}{m m m O{\@fglslhspacer}}{\mel{(}\ensuremath{#1}\textit{#2}\@ifempty{#3}{}{#4}\textsuperscript{#3}#4\mel{)}}
	\DeclareDocumentCommand{\@lambhquantorbuildeR}{m m m O{\@fglslhspacer}}{\obl{(}\ensuremath{\bm{#1}}\obli{#2}\@ifempty{#3}{}{#4}\textsuperscript{#3}#4\obl{)}}
}{}

\DeclareDocumentCommand{\lambhe}{O{x} O{\@typee}}{\@lambhquantorbuilder{\exists}{#1}{#2}}
\DeclareDocumentCommand{\lambhE}{O{x} O{\@typee}}{\@lambhquantorbuildeR{\exists}{#1}{#2}}
\DeclareDocumentCommand{\lambhu}{O{x} O{\@typee}}{\@lambhquantorbuilder{\exists!}{#1}{#2}}
\DeclareDocumentCommand{\lambhU}{O{x} O{\@typee}}{\@lambhquantorbuildeR{\exists!}{#1}{#2}}
\DeclareDocumentCommand{\lambha}{O{x} O{\@typee}}{\@lambhquantorbuilder{\forall}{#1}{#2}}
\DeclareDocumentCommand{\lambhA}{O{x} O{\@typee}}{\@lambhquantorbuildeR{\forall}{#1}{#2}}
\DeclareDocumentCommand{\lambhen}{O{x} O{\@typee}}{\ensuremath{\neg}\lambhe[#1][#2]}
\DeclareDocumentCommand{\lambheN}{O{x} O{\@typee}}{\ensuremath{\boldsymbol{\neg}}\lambhE[#1][#2]}
\DeclareDocumentCommand{\lambhan}{O{x} O{\@typee}}{\ensuremath{\neg}\lambha[#1][#2]}
\DeclareDocumentCommand{\lambhaN}{O{x} O{\@typee}}{\ensuremath{\boldsymbol{\neg}}\lambhA[#1][#2]}
\DeclareDocumentCommand{\lambhun}{O{x} O{\@typee}}{\ensuremath{\neg}\lambhu[#1][#2]}
\DeclareDocumentCommand{\lambhuN}{O{x} O{\@typee}}{\ensuremath{\boldsymbol{\neg}}\lambhU[#1][#2]}

%% Lambda Heads Basics
\fgl@defopt{lmda}{\lambh{a}[#1]}
\fgl@defopt{lmDa}{\lambH{a}[#1]}
\fgl@defopt{lmdA}{\lambh{A}[#1]}
\fgl@defopt{lmDA}{\lambH{A}[#1]}
\fgl@defopt{lmdb}{\lambh{b}[#1]}
\fgl@defopt{lmDb}{\lambH{b}[#1]}
\fgl@defopt{lmdB}{\lambh{B}[#1]}
\fgl@defopt{lmDB}{\lambH{B}[#1]}
\fgl@defopt{lmdc}{\lambh{c}[#1]}
\fgl@defopt{lmDc}{\lambH{c}[#1]}
\fgl@defopt{lmdC}{\lambh{C}[#1]}
\fgl@defopt{lmDC}{\lambH{C}[#1]}
\fgl@defopt{lmdd}{\lambh{d}[#1]}
\fgl@defopt{lmDd}{\lambH{d}[#1]}
\fgl@defopt{lmdD}{\lambh{D}[#1]}
\fgl@defopt{lmDD}{\lambH{D}[#1]}
\fgl@defopt{lmde}{\lambh{e}[#1]}
\fgl@defopt{lmDe}{\lambH{e}[#1]}
\fgl@defopt{lmdE}{\lambh{E}[#1]}
\fgl@defopt{lmDE}{\lambH{E}[#1]}
\fgl@defopt{lmdf}{\lambh{f}[#1]}
\fgl@defopt{lmDf}{\lambH{f}[#1]}
\fgl@defopt{lmdF}{\lambh{F}[#1]}
\fgl@defopt{lmDF}{\lambH{F}[#1]}
\fgl@defopt{lmdg}{\lambh{g}[#1]}
\fgl@defopt{lmDg}{\lambH{g}[#1]}
\fgl@defopt{lmdG}{\lambh{G}[#1]}
\fgl@defopt{lmDG}{\lambH{G}[#1]}
\fgl@defopt{lmdh}{\lambh{h}[#1]}
\fgl@defopt{lmDh}{\lambH{h}[#1]}
\fgl@defopt{lmdH}{\lambh{H}[#1]}
\fgl@defopt{lmDH}{\lambH{H}[#1]}
\fgl@defopt{lmdi}{\lambh{i}[#1]}
\fgl@defopt{lmDi}{\lambH{i}[#1]}
\fgl@defopt{lmdI}{\lambh{I}[#1]}
\fgl@defopt{lmDI}{\lambH{I}[#1]}
\fgl@defopt{lmdj}{\lambh{j}[#1]}
\fgl@defopt{lmDj}{\lambH{j}[#1]}
\fgl@defopt{lmdJ}{\lambh{J}[#1]}
\fgl@defopt{lmDJ}{\lambH{J}[#1]}
\fgl@defopt{lmdk}{\lambh{k}[#1]}
\fgl@defopt{lmDk}{\lambH{k}[#1]}
\fgl@defopt{lmdK}{\lambh{K}[#1]}
\fgl@defopt{lmDK}{\lambH{K}[#1]}
\fgl@defopt{lmdl}{\lambh{l}[#1]}
\fgl@defopt{lmDl}{\lambH{l}[#1]}
\fgl@defopt{lmdL}{\lambh{L}[#1]}
\fgl@defopt{lmDL}{\lambH{L}[#1]}
\fgl@defopt{lmdm}{\lambh{m}[#1]}
\fgl@defopt{lmDm}{\lambH{m}[#1]}
\fgl@defopt{lmdM}{\lambh{M}[#1]}
\fgl@defopt{lmDM}{\lambH{M}[#1]}
\fgl@defopt{lmdn}{\lambh{n}[#1]}
\fgl@defopt{lmDn}{\lambH{n}[#1]}
\fgl@defopt{lmdN}{\lambh{N}[#1]}
\fgl@defopt{lmDN}{\lambH{N}[#1]}
\fgl@defopt{lmdo}{\lambh{o}[#1]}
\fgl@defopt{lmDo}{\lambH{o}[#1]}
\fgl@defopt{lmdO}{\lambh{O}[#1]}
\fgl@defopt{lmDO}{\lambH{O}[#1]}
\fgl@defopt{lmdp}{\lambh{p}[#1]}
\fgl@defopt{lmDp}{\lambH{p}[#1]}
\fgl@defopt{lmdP}{\lambh{P}[#1]}
\fgl@defopt{lmDP}{\lambH{P}[#1]}
\fgl@defopt{lmdq}{\lambh{q}[#1]}
\fgl@defopt{lmDq}{\lambH{q}[#1]}
\fgl@defopt{lmdQ}{\lambh{Q}[#1]}
\fgl@defopt{lmDQ}{\lambH{Q}[#1]}
\fgl@defopt{lmdr}{\lambh{r}[#1]}
\fgl@defopt{lmDr}{\lambH{r}[#1]}
\fgl@defopt{lmdR}{\lambh{R}[#1]}
\fgl@defopt{lmDR}{\lambH{R}[#1]}
\fgl@defopt{lmds}{\lambh{s}[#1]}
\fgl@defopt{lmDs}{\lambH{s}[#1]}
\fgl@defopt{lmdS}{\lambh{S}[#1]}
\fgl@defopt{lmDS}{\lambH{S}[#1]}
\fgl@defopt{lmdt}{\lambh{t}[#1]}
\fgl@defopt{lmDt}{\lambH{t}[#1]}
\fgl@defopt{lmdT}{\lambh{T}[#1]}
\fgl@defopt{lmDT}{\lambH{T}[#1]}
\fgl@defopt{lmdd}{\lambh{d}[#1]}
\fgl@defopt{lmDd}{\lambH{d}[#1]}
\fgl@defopt{lmdD}{\lambh{D}[#1]}
\fgl@defopt{lmDD}{\lambH{D}[#1]}
\fgl@defopt{lmdu}{\lambh{u}[#1]}
\fgl@defopt{lmDu}{\lambH{u}[#1]}
\fgl@defopt{lmdU}{\lambh{U}[#1]}
\fgl@defopt{lmDU}{\lambH{U}[#1]}
\fgl@defopt{lmdv}{\lambh{v}[#1]}
\fgl@defopt{lmDv}{\lambH{v}[#1]}
\fgl@defopt{lmdV}{\lambh{V}[#1]}
\fgl@defopt{lmDV}{\lambH{V}[#1]}
\fgl@defopt{lmdw}{\lambh{w}[#1]}
\fgl@defopt{lmDw}{\lambH{w}[#1]}
\fgl@defopt{lmdW}{\lambh{W}[#1]}
\fgl@defopt{lmDW}{\lambH{W}[#1]}
\fgl@defopt{lmdx}{\lambh{x}[#1]}
\fgl@defopt{lmDx}{\lambH{x}[#1]}
\fgl@defopt{lmdX}{\lambh{X}[#1]}
\fgl@defopt{lmDX}{\lambH{X}[#1]}
\fgl@defopt{lmdy}{\lambh{y}[#1]}
\fgl@defopt{lmDy}{\lambH{y}[#1]}
\fgl@defopt{lmdY}{\lambh{Y}[#1]}
\fgl@defopt{lmDY}{\lambH{Y}[#1]}
\fgl@defopt{lmdz}{\lambh{z}[#1]}
\fgl@defopt{lmDz}{\lambH{z}[#1]}
\fgl@defopt{lmdZ}{\lambh{Z}[#1]}
\fgl@defopt{lmDZ}{\lambH{Z}[#1]}

% ------------------------------
% Functions
% ------------------------------


% Inspired by Andrew McKenzie from ling-macros package
\DeclareDocumentEnvironment{fglfunc}{O{} O{10} O{n}}{\let\l\@fglsundefined\let\r\@fglsundefined\DeclareDocumentCommand{\d}{O{\vdots} O{} O{}}{{##1} & ##2 & {##3}\\}\newcommand{\l}{\ifmmode\else$\fi\left[\begin{array}{ccr@{\rule{0pt}{#2pt}}}}\newcommand{\r}{\end{array}\right]\ifmmode$\else\fi}\DeclareDocumentCommand{\b}{m O{}}{\@ifempty{##2}{}{##2 = }\l##1\r}\DeclareDocumentCommand{\f}{m m}{{\textrm{\IfEq{#3}{m}{\ensuremath{##1}}{}\IfEq{#3}{b}{\textbf{##1}}{}\IfEq{#3}{n}{##1}{}}} & \mapsto & {\textrm{##2}}\\}\@ifempty{#1}{}{#1 = }\l}{\r}

\DeclareDocumentCommand{\func}{O{} m m O{} O{} O{} O{} O{} O{}}{\begin{varwidth}{\linewidth}\begin{fglfunc}[#1]\f{#2}{#3}\@ifempty{#4}{}{\f{#4}{#5}}\@ifempty{#6}{}{\f{#6}{#7}}\@ifempty{#8}{}{\f{#8}{#9}}\end{fglfunc}\end{varwidth}}

% ------------------------------
% Semantics
% ------------------------------
\newcommand{\@fglsssuperscriptspacing}{\!}

\def\@fragolilssupercsriptspacingmid{mid}
\ifx\FGL@semanticsuperscriptspacing\@fragolilssupercsriptspacingmid
\renewcommand{\@fglsssuperscriptspacing}{\kern-1pt}
\fi

\def\@fragolilssupercsriptspacingwide{wide}
\ifx\FGL@semanticsuperscriptspacing\@fragolilssupercsriptspacingwide
\def\@fglsssuperscriptspacing{}
\fi

\let\@fglsssuperscriptspacingbackup\@fglsssuperscriptspacing
\def\fglsetsuperscriptspacing#1{\renewcommand{\@fglsssuperscriptspacing}{#1}}
\def\fglresetsuperscriptspacing{\renewcommand{\@fglsssuperscriptspacing}{\@fglsssuperscriptspacingbackup}}

\def\@fglssasmodspacing{\!}

\def\@fragolilsasmodspacingmid{mid}
\ifx\FGL@assignmentspacing\@fragolilsasmodspacingmid
\def\@fglssasmodspacing{\kern-1pt}
\fi

\def\@fragolilsasmodspacingwide{wide}
\ifx\FGL@assignmentspacing\@fragolilsasmodspacingwide
\def\@fglssasmodspacing{}
\fi

\let\@fglssasmodspacingbackup\@fglssasmodspacing
\def\fglsetassignmentspacing#1{\renewcommand{\@fglssasmodspacing}{#1}}
\def\fglresetassignmentspacing{\renewcommand{\@fglssasmodspacing}{\@fglssasmodspacingbackup}}

\def\sarrow#1{\ensuremath{\downarrow}#1}
\def\sarroW#1{\ensuremath{\downarrow}\lambby{#1}}

%%% Indirekt
\DeclareDocumentCommand{\sic}{O{\obli{i}} m}{\text{\obl{#2}\textsubscript{#1}}}
\DeclareDocumentCommand{\siC}{O{\obli{i}} m}{\text{\obl{#2}\obl{(}#1\obl{)}}}
\DeclareDocumentCommand{\sicn}{O{\obli{i}} m}{\ensuremath{\boldsymbol{\neg}}\obl{#2}\textsubscript{#1}}
\DeclareDocumentCommand{\siCn}{O{\obli{i}} m}{\ensuremath{\boldsymbol{\neg}}\obl{#2}\obl{(}#1\obl{)}}

\DeclareDocumentCommand{\sit}{O{} O{\@fglsssuperscriptspacing} m}{\@fglsembracketitl\obl{#3}\@fglsembracketitr\textsuperscript{#2\ensuremath{#1}}}
\DeclareDocumentCommand{\siT}{O{} O{\@fglsssuperscriptspacing} m}{\@fglsembracketitL\obl{#3}\@fglsembracketitR\textsuperscript{#2\ensuremath{#1}}}

\def\sitnobf#1{\@fglsembracketitl#1\@fglsembracketitr}
\def\sitnobF#1{\@fglsembracketitL#1\@fglsembracketitR}
\def\sitnobfi#1{\@fglsembracketitl\textit{#1}\@fglsembracketitr}
\def\sitnobfI#1{\@fglsembracketitL\textit{#1}\@fglsembracketitR}

\DeclareDocumentCommand{\sid}{O{} O{\@fglsssuperscriptspacing} m}{\ensuremath{\parallel}\obl{#3}\ensuremath{\parallel}\textsuperscript{#2\ensuremath{#1}}}
\DeclareDocumentCommand{\siD}{O{} O{\@fglsssuperscriptspacing} m}{\ensuremath{\bm{\parallel}}\obl{#3}\ensuremath{\bm{\parallel}}\textsuperscript{#2\ensuremath{#1}}}
\DeclareDocumentCommand{\sidg}{O{} O{\@fglsssuperscriptspacing} O{\@fglssasmodspacing} m}{\ensuremath{\parallel}\obl{#4}\ensuremath{\parallel}\textsuperscript{#2\ensuremath{g#3#1}}}
\DeclareDocumentCommand{\sidG}{O{} O{\@fglsssuperscriptspacing} O{\@fglssasmodspacing} m}{\ensuremath{\bm{\parallel}}\obl{#4}\ensuremath{\bm{\parallel}}\textsuperscript{#2\ensuremath{g#3#1}}}

\DeclareDocumentCommand{\asmod}{m O{x} O{\@fglssasmodspacing}}{\ensuremath{\lbrack\nicefrac{#2}{#3#1}\rbrack}}
\DeclareDocumentCommand{\asmoD}{m O{x} O{\@fglssasmodspacing}}{\ensuremath{\lbrack\nicefrac{\obli{#2}}{#3#1}\rbrack}}

\DeclareDocumentCommand{\asf}{m O{} O{x} O{} O{y} O{} O{z} O{g}}{\ensuremath{#8}\@ifempty{#2}{}{\asmod{#2}[#3]}\@ifempty{#4}{}{\asmod{#4}[#5]}\@ifempty{#6}{}{\asmod{#6}[#7]}\mel{(}#1\mel{)}}
\DeclareDocumentCommand{\asF}{m O{} O{x} O{} O{y} O{} O{z} O{g}}{\ensuremath{#8}\@ifempty{#2}{}{\asmoD{#2}[#3]}\@ifempty{#4}{}{\asmoD{#4}[#5]}\@ifempty{#6}{}{\asmoD{#6}[#7]}\obl{(}#1\obl{)}}

\def\@fglAssRep#1#2{\ensuremath{\lbrack\nicefrac{#1}{\@fglssasmodspacing#2}\rbrack}}
\def\@fglAssReP#1#2{\@fglAssRep{\obli{#1}}{#2}}
\def\@fglSidModCheck#1#2{\@ifempty{#1}{}{\@fglssasmodspacing\@fglAssRep{#1}{#2}}}
\def\@fglSidModChecK#1#2{\@ifempty{#1}{}{\@fglssasmodspacing\@fglAssReP{#1}{#2}}}

\DeclareDocumentCommand{\sidmod}{m m O{x} O{} O{y} O{} O{z} O{g}}{\sid[#8\@fglssasmodspacing\@fglAssRep{#3}{#2}\@fglSidModCheck{#5}{#4}\@fglSidModCheck{#7}{#6}]{#1}}
\DeclareDocumentCommand{\sidmoD}{m m O{x} O{} O{y} O{} O{z} O{g}}{\sid[#8\@fglssasmodspacing\@fglAssReP{#3}{#2}\@fglSidModChecK{#5}{#4}\@fglSidModChecK{#7}{#6}]{#1}}
\DeclareDocumentCommand{\sidmOd}{m m O{x} O{} O{y} O{} O{z} O{g}}{\siD[#8\@fglssasmodspacing\@fglAssRep{#3}{#2}\@fglSidModCheck{#5}{#4}\@fglSidModCheck{#7}{#6}]{#1}}
\DeclareDocumentCommand{\sidmOD}{m m O{x} O{} O{y} O{} O{z} O{g}}{\siD[#8\@fglssasmodspacing\@fglAssReP{#3}{#2}\@fglSidModChecK{#5}{#4}\@fglSidModChecK{#7}{#6}]{#1}}

\DeclareDocumentCommand{\sidr}{m m O{x} O{g} O{\@fglssasmodspacing}}{\sid[#4#5\@fglAssRep{#3}{#2}]{#1}}
\DeclareDocumentCommand{\sidR}{m m O{x} O{g} O{\@fglssasmodspacing}}{\sid[#4#5\@fglAssReP{#3}{#2}]{#1}}
\DeclareDocumentCommand{\siDr}{m m O{x} O{g} O{\@fglssasmodspacing}}{\siD[#4#5\@fglAssRep{#3}{#2}]{#1}}
\DeclareDocumentCommand{\siDR}{m m O{x} O{g} O{\@fglssasmodspacing}}{\siD[#4#5\@fglAssReP{#3}{#2}]{#1}}
\DeclareDocumentCommand{\sidrr}{m m m O{x} O{y} O{g} O{\@fglssasmodspacing}}{\sid[#6#7\@fglAssRep{#4}{#2}#7\@fglAssRep{#5}{#3}]{#1}}
\DeclareDocumentCommand{\sidRR}{m m m O{x} O{y} O{g} O{\@fglssasmodspacing}}{\sid[#6#7\@fglAssReP{#4}{#2}#7\@fglAssReP{#5}{#3}]{#1}}
\DeclareDocumentCommand{\siDrr}{m m m O{x} O{y} O{g} O{\@fglssasmodspacing}}{\siD[#6#7\@fglAssRep{#4}{#2}#7\@fglAssRep{#5}{#3}]{#1}}
\DeclareDocumentCommand{\siDRR}{m m m O{x} O{y} O{g} O{\@fglssasmodspacing}}{\siD[#6#7\@fglAssReP{#4}{#2}#7\@fglAssReP{#5}{#3}]{#1}}
\DeclareDocumentCommand{\sidrrr}{m m m m O{x} O{y} O{z} O{g} O{\@fglssasmodspacing}}{\sid[#8#9\@fglAssRep{#5}{#2}#9\@fglAssRep{#6}{#3}#9\@fglAssRep{#7}{#4}]{#1}}
\DeclareDocumentCommand{\sidRRR}{m m m m O{x} O{y} O{z} O{g} O{\@fglssasmodspacing}}{\sid[#8#9\@fglAssReP{#5}{#2}#9\@fglAssReP{#6}{#3}#9\@fglAssReP{#7}{#4}]{#1}}
\DeclareDocumentCommand{\siDrrr}{m m m m O{x} O{y} O{z} O{g} O{\@fglssasmodspacing}}{\siD[#8#9\@fglAssRep{#5}{#2}#9\@fglAssRep{#6}{#3}#9\@fglAssRep{#7}{#4}]{#1}}
\DeclareDocumentCommand{\siDRRR}{m m m m O{x} O{y} O{z} O{g} O{\@fglssasmodspacing}}{\siD[#8#9\@fglAssReP{#5}{#2}#9\@fglAssReP{#6}{#3}#9\@fglAssReP{#7}{#4}]{#1}}

%%% Direkt
\def\sdi#1{\@fglsembracketl\obl{#1}\@fglsembracketr}
\def\sdI#1{\@fglsembracketL\obl{#1}\@fglsembracketR}
\def\sdim#1{\@fglsembracketl\mel{#1}\@fglsembracketr}
\def\sdiM#1{\@fglsembracketL\mel{#1}\@fglsembracketR}
\DeclareDocumentCommand{\sde}{O{\FGL@situation} O{\@fglsssuperscriptspacing} m}{\@fglsembracketl\obl{#3}\@fglsembracketr\textsuperscript{#2\ensuremath{#1}}\!}
\DeclareDocumentCommand{\sdE}{O{\FGL@situation} O{\@fglsssuperscriptspacing} m}{\@fglsembracketL\obl{#3}\@fglsembracketR\textsuperscript{#2\ensuremath{#1}}}
\DeclareDocumentCommand{\sdem}{O{\FGL@situation} O{\@fglsssuperscriptspacing} m}{\@fglsembracketl\mel{#3}\@fglsembracketr\textsuperscript{#2\ensuremath{#1}}\!}
\DeclareDocumentCommand{\sdeM}{O{\FGL@situation} O{\@fglsssuperscriptspacing} m}{\@fglsembracketL\mel{#3}\@fglsembracketR\textsuperscript{#2\ensuremath{#1}}}

%%% Rules
\let\@srdesituation\FGL@rulesituation
%%%% General
\DeclareDocumentCommand{\srgarrow}{O{\ensuremath{x}} O{\ensuremath{f}}}{\sarrow{#2} = \set[#1]{#2(#1)\ =\ 1}}
%%%% Direkt
\DeclareDocumentCommand{\srde}{m m O{\@srdesituation}}{\sde[#3]{#1}\ =\ #2}
\DeclareDocumentCommand{\srdE}{m m O{\@srdesituation}}{\sdE[#3]{#1}\ =\ #2}
\def\srdi#1#2{\sdi{#1}\ = #2}
%%%%% Basic	
\DeclareDocumentCommand{\srdesbjpred}{O{\@srdesituation} O{\text{\ensuremath{S}}} O{\text{\ensuremath{NN}}} O{\text{\ensuremath{P}}}}{\srde{#2}{\sde[#1]{#4}(\sde[#1]{#3})}[#1]}
\DeclareDocumentCommand{\srdeobjpred}{O{\@srdesituation} O{\text{\ensuremath{P}}} O{\text{\ensuremath{NN}}} O{\text{\ensuremath{V}}}}{\srdesbjpred[#1][#2][#3][#4]}
\DeclareDocumentCommand{\srdesbjquant}{O{\@srdesituation} O{\text{\ensuremath{S}}} O{\text{\ensuremath{P}}} O{\text{\ensuremath{QN}}}}{\srdesbjpred[#1][#2][#3][#4]}
\DeclareDocumentCommand{\srdequant}{O{\@srdesituation} O{\text{\ensuremath{QN}}} O{\text{\ensuremath{N}}} O{\text{\ensuremath{D}}}}{\srdesbjpred[#1][#2][#3][#4]}
\DeclareDocumentCommand{\srdeobjquant}{O{x} O{y} O{\@srdesituation} O{\text{\ensuremath{P}}} O{\text{\ensuremath{V}}} O{\text{\ensuremath{QN}}} O{\@typee} O{\@typee}}{\srde{#4}{\lambh{#1}[#7]\sde[#3]{#6}(\lambh{#2}[#8]\sde[#3]{#5}(\textit{#2})(\textit{#1}))}[#3]}
%%%%% Quantorenanhebung
\DeclareDocumentCommand{\srdeqrsemvar}{O{\phi} O{\ensuremath{x}} O{\sblank} O{\textit{g}}}{\srde{\ensuremath{#1}}{\ensuremath{#4}(#2)}[\ensuremath{#4},\!\ensuremath{#3}]}
\DeclareDocumentCommand{\srdeqrabs}{O{\phi} O{\textit{x}} O{\sblank} O{\textit{g}} O{\textit{f}} O{\ensuremath{\delta}}}{#5(#2)\ =\ \sde[#4\ensuremath{\lbrack\nicefrac{#6}{\!#2}\rbrack},\!#3]{\ensuremath{#1}}\ }
\DeclareDocumentCommand{\srdeqrlex}{O{\ensuremath{\alpha}} O{\ensuremath{\beta}} O{\sblank} O{\text{\textit{g}}}}{\srde{#1}{\sde[#3]{#2}}[#4,\!#3]}
\DeclareDocumentCommand{\srdeqrfa}{O{\ensuremath{\alpha}} O{\ensuremath{\beta}} O{\ensuremath{\gamma}} O{\sblank} O{\text{\textit{g}}}}{\srde{#1}{\sde[#5,\!#4]{#2}(\sde[#5,\!#4]{#3})}[#5,\!#4]}
\DeclareDocumentCommand{\srdeqrtree}{O{x} O{\ensuremath{\psi}} O{\ensuremath{\phi}} O{\ensuremath{\xi}} O{\sblank} O{\text{\textit{g}}} O{\@typee}}{\srde{#2}{\lambh{#1}[#7]\sde[#6\ensuremath{\lbrack\nicefrac{#4}{\!#1}\rbrack},\!#5]{#3}}[#6,\!#5]}

% ------------------------------------------------------------ 
% Alternative commands for backwards compatibility within the institute
% ------------------------------------------------------------  

\ifFGL@alternativecommands
	\def\Typ#1{\textbf{\textit{#1}}}
	\def\typ#1{\textbf{\textit{#1}}}
	\def\Bsp#1{\textbf{#1}}
	\def\bsp#1{\textbf{#1}}
	\DeclareDocumentCommand{\Tran}{O{} m}{\ensuremath{\lvert{#2}\rvert}^{#1}}
	\DeclareDocumentCommand{\tran}{O{} m}{\ensuremath{\lvert{#2}\rvert}^{#1}}
	\DeclareDocumentCommand{\Char}{O{} m}{\ensuremath{\lVert{#2}\rVert^{#1}}}
	\DeclareDocumentCommand{\char}{O{} m}{\ensuremath{\lVert{#2}\rVert^{#1}}}
	\DeclareDocumentCommand{\Wert}{O{} m}{\@fglsembracketl\ensuremath{{#2}\@fglsembracketr^{#1}}}
	\DeclareDocumentCommand{\wert}{O{} m}{\@fglsembracketl\ensuremath{{#2}\@fglsembracketr^{#1}}}
	\def\WW#1{\ensuremath{{\vdash}#1{\dashv}}}
	\def\ww#1{\ensuremath{{\vdash}#1{\dashv}}}
	\def\oP#1{\ensuremath{\langle#1\rangle}}
	\def\op#1{\ensuremath{\downarrow}\textit{#1}}
	\def\Menge#1#2{\{\textit{#1}\ensuremath{\vert}\ #2\}}
	\def\menge#1#2{\{\textit{#1}\ensuremath{\vert}\ #2\}}
	\def\lam#1{\ensuremath{\lambda}\textit{#1}.}
	\def\FA{\emph{(App)}}
	\def\LA{\emph{(Abs)}}
	\def\VAR{\emph{(Var)}}
	\def\CON{\emph{(Con)}}
	\def\ID{\emph{(Id)}}
\fi

% ------------------------------------------------------------ 
% Environments
% ------------------------------------------------------------  


% ------------------------------
% Semantics
% ------------------------------

% fgls constants
% Constants
%% Object Language	
\def\fgl@inside@ox{\v{x}}%
\def\fgl@inside@oX{\v{X}}%
\def\fgl@inside@oy{\v{y}}%
\def\fgl@inside@oY{\v{Y}}%
\def\fgl@inside@oz{\v{z}}%
\def\fgl@inside@oZ{\v{Z}}%
\def\fgl@inside@oi{\v{i}}%
\def\fgl@inside@oI{\v{I}}%
\def\fgl@inside@oj{\v{j}}%
\def\fgl@inside@oJ{\v{J}}%
\def\fgl@inside@os{\v{s}}%
\def\fgl@inside@oS{\v{S}}%
\def\fgl@inside@ot{\v{t}}%
\def\fgl@inside@oT{\v{T}}%
\def\fgl@inside@og{\v{g}}%
\def\fgl@inside@oG{\v{G}}%
\def\fgl@inside@od{\v{d}}%
\def\fgl@inside@oD{\v{D}}%
\def\fgl@inside@oq{\v{q}}%
\def\fgl@inside@oQ{\v{Q}}%
\def\fgl@inside@op{\v{p}}%
\def\fgl@inside@oP{\v{P}}%
\def\fgl@inside@oR{\v{R}}%
\def\fgl@inside@x{\v{x}}%
\def\fgl@inside@X{\v{X}}%
\def\fgl@inside@y{\v{y}}%
\def\fgl@inside@Y{\v{Y}}%
\def\fgl@inside@z{\v{z}}%
\def\fgl@inside@Z{\v{Z}}%

\def\fgl@inside@Ox{\ox\ }%
\def\fgl@inside@OX{\oX\ }%
\def\fgl@inside@Oy{\oy\ }%
\def\fgl@inside@OY{\oY\ }%
\def\fgl@inside@Oz{\oz\ }%
\def\fgl@inside@OZ{\oZ\ }%
\def\fgl@inside@Oi{\oi\ }%
\def\fgl@inside@OI{\oI\ }%
\def\fgl@inside@Oj{\oj\ }%
\def\fgl@inside@OJ{\oJ\ }%
\def\fgl@inside@Os{\os\ }%
\def\fgl@inside@OS{\oS\ }%
\def\fgl@inside@Ot{\ot\ }%
\def\fgl@inside@OT{\oT\ }%
\def\fgl@inside@Og{\og\ }%
\def\fgl@inside@OG{\oG\ }%
\def\fgl@inside@Od{\od\ }%
\def\fgl@inside@OD{\oD\ }%
\def\fgl@inside@Oq{\oq\ }%
\def\fgl@inside@OQ{\oQ\ }%
\def\fgl@inside@Op{\op\ }%
\def\fgl@inside@OP{\oP\ }%
\def\fgl@inside@OR{\oR\ }%

\let\greekmu\mu

%% Meta Language
\def\fgl@inside@mx{\text{\textit{x}}}%
\def\fgl@inside@mX{\text{\textit{X}}}%
\def\fgl@inside@my{\text{\textit{y}}}%
\def\fgl@inside@mY{\text{\textit{Y}}}%
\def\fgl@inside@mz{\text{\textit{z}}}%
\def\fgl@inside@mZ{\text{\textit{Z}}}%
\def\fgl@inside@mi{\text{\textit{i}}}%
\def\fgl@inside@mI{\text{\textit{I}}}%
\def\fgl@inside@mj{\text{\textit{j}}}%
\def\fgl@inside@mJ{\text{\textit{J}}}%
\def\fgl@inside@ms{\text{\textit{s}}}%
\def\fgl@inside@mS{\text{\textit{S}}}%
\def\fgl@inside@mt{\text{\textit{t}}}%
\def\fgl@inside@mT{\text{\textit{T}}}%
\def\fgl@inside@mg{\text{\textit{g}}}%
\def\fgl@inside@mG{\text{\textit{G}}}%
\def\fgl@inside@md{\text{\textit{d}}}%
\def\fgl@inside@mD{\text{\textit{D}}}%
\def\fgl@inside@mp{\text{\textit{p}}}%
\def\fgl@inside@mP{\text{\textit{P}}}%
\def\fgl@inside@mq{\text{\textit{q}}}%
\def\fgl@inside@mQ{\text{\textit{Q}}}%
\def\fgl@inside@mr{\text{\textit{r}}}%
\def\fgl@inside@mR{\text{\textit{R}}}%
\def\fgl@inside@mu{\text{\textit{u}}}%
\def\fgl@inside@mU{\text{\textit{U}}}%
\def\fgl@inside@mv{\text{\textit{v}}}%
\def\fgl@inside@mV{\text{\textit{V}}}%

\def\fgl@inside@Mx{\mx\ }
\def\fgl@inside@MX{\mX\ }
\def\fgl@inside@My{\my\ }
\def\fgl@inside@MY{\mY\ }
\def\fgl@inside@Mz{\mz\ }
\def\fgl@inside@MZ{\mZ\ }
\def\fgl@inside@Mi{\mi\ }
\def\fgl@inside@MI{\mI\ }
\def\fgl@inside@Mj{\mj\ }
\def\fgl@inside@MJ{\mJ\ }
\def\fgl@inside@Ms{\ms\ }
\def\fgl@inside@MS{\mS\ }
\def\fgl@inside@Md{\md\ }
\def\fgl@inside@MD{\mD\ }
\def\fgl@inside@Mt{\mt\ }
\def\fgl@inside@MT{\mT\ }
\def\fgl@inside@Mg{\mg\ }
\def\fgl@inside@MG{\mG\ }
\def\fgl@inside@Mp{\mp\ }
\def\fgl@inside@MP{\mP\ }
\def\fgl@inside@Mq{\mq\ }
\def\fgl@inside@MQ{\mQ\ }
\def\fgl@inside@Mr{\mr\ }
\def\fgl@inside@MR{\mR\ }
\def\fgl@inside@Mu{\mu\ }
\def\fgl@inside@MU{\mU\ }
\def\fgl@inside@Mv{\mv\ }
\def\fgl@inside@MV{\mV\ }

%% Logic
\def\fgl@inside@qa{\ensuremath{\forall}}
\def\fgl@inside@qA{\ensuremath{\bm{\forall}}}
\def\fgl@inside@Qa{\qa\ }
\def\fgl@inside@QA{\qA\ }



\def\fgl@inside@qu{\qe!}
\def\fgl@inside@qU{\qE!}
\def\fgl@inside@Qu{\qu\ }
\def\fgl@inside@QU{\qU\ }



\def\fgl@inside@jn{\ensuremath{\neg}}
\def\fgl@inside@jN{\ensuremath{\boldsymbol{\neg}}}
\def\fgl@inside@jc{\ensuremath{\land}}
\def\fgl@inside@jC{\ensuremath{\bm{\land}}}
\def\fgl@inside@jd{\ensuremath{\lor}}
\def\fgl@inside@jD{\ensuremath{\bm{\lor}}}
\def\fgl@inside@ji{\ensuremath{\rightarrow}}
\def\fgl@inside@jI{\ensuremath{\bm{\rightarrow}}}
\def\fgl@inside@jj{\ensuremath{\leftrightarrow}}
\def\fgl@inside@jJ{\ensuremath{\bm{\leftrightarrow}}}
\def\fgl@inside@jx{\ensuremath{\veebar}}
\def\fgl@inside@jX{\ensuremath{\bm{\veebar}}}
\def\fgl@inside@jb{\ensuremath{\Box}}
\def\fgl@inside@jB{\ensuremath{\bm{\Box}}}
\def\fgl@inside@jp{\ensuremath{\Diamond}}
\def\fgl@inside@jP{\ensuremath{\bm{\Diamond}}}
\def\fgl@inside@jt{\ensuremath{\top}}
\def\fgl@inside@jT{\ensuremath{\bm{\top}}}
\def\fgl@inside@jf{\ensuremath{\bot}}
\def\fgl@inside@jF{\ensuremath{\bm{\bot}}}
\def\fgl@inside@je{\ensuremath{\equiv}}
\def\fgl@inside@jE{\ensuremath{\bm{\equiv}}}
\def\fgl@inside@jo{\ensuremath{\oplus}}
\def\fgl@inside@jO{\ensuremath{\bm{\oplus}}}

\def\fgl@inside@Jn{\ \jn}
\def\fgl@inside@JN{\ \jN}
\def\fgl@inside@Jc{\ \jc\ }
\def\fgl@inside@JC{\ \jC\ }
\def\fgl@inside@Jd{\ \jd\ }
\def\fgl@inside@JD{\ \jD\ }
\def\fgl@inside@Ji{\ \ji\ }
\def\fgl@inside@JI{\ \jI\ }
\def\fgl@inside@Jj{\ \jj\ }
\def\fgl@inside@JJ{\ \jJ\ }
\def\fgl@inside@Jx{\ \jx\ }
\def\fgl@inside@JX{\ \jX\ }
\def\fgl@inside@Jb{\ \jb}
\def\fgl@inside@JB{\ \jB}
\def\fgl@inside@Jp{\ \jp}
\def\fgl@inside@JP{\ \jP}
\def\fgl@inside@Jt{\jt\ }
\def\fgl@inside@JT{\jT\ }
\def\fgl@inside@Jf{\jf\ }
\def\fgl@inside@JF{\jF\ }
\def\fgl@inside@Je{\ \je\ }
\def\fgl@inside@JE{\ \jE\ }
\def\fgl@inside@Jo{\ \jo\ }
\def\fgl@inside@JO{\ \jO\ }

%% Set theory
\def\fgl@inside@ci{\ensuremath{\in}}
\def\fgl@inside@cI{\ensuremath{\bm{\in}}}
\def\fgl@inside@cd{\ensuremath{\downarrow}}
\def\fgl@inside@cD{\ensuremath{\bm{\downarrow}}}
\def\fgl@inside@ce{\ensuremath{\emptyset}}
\def\fgl@inside@cE{\ensuremath{\bm{\emptyset}}}
\def\fgl@inside@cb{\ensuremath{\subset}}
\def\fgl@inside@cB{\ensuremath{\bm{\subset}}}
\def\fgl@inside@cq{\ensuremath{\subseteq}}
\def\fgl@inside@cQ{\ensuremath{\bm{\subseteq}}}
\def\fgl@inside@ca{\ensuremath{\cap}}
\def\fgl@inside@cA{\ensuremath{\bm{\cap}}}
\def\fgl@inside@cu{\ensuremath{\cup}}
\def\fgl@inside@cU{\ensuremath{\bm{\cup}}}

\def\fgl@inside@Ci{\ \ci\ }
\def\fgl@inside@CI{\ \cI\ }
\def\fgl@inside@Cd{\cd\ }
\def\fgl@inside@CD{\cD\ }
\def\fgl@inside@Ce{\ce\ }
\def\fgl@inside@CE{\cE\ }
\def\fgl@inside@Cb{\ \cb\ }
\def\fgl@inside@CB{\ \cB\ }
\def\fgl@inside@Cq{\ \cq\ }
\def\fgl@inside@CQ{\ \cQ\ }
\def\fgl@inside@Ca{\ \ca\ }
\def\fgl@inside@CA{\ \cA\ }
\def\fgl@inside@Cu{\ \cu\ }
\def\fgl@inside@CU{\ \cU\ }

%% Relation Constants
\def\fgl@inside@rn{\ensuremath{\neq}}
\def\fgl@inside@rN{\ensuremath{\bm{\neq}}}
\def\fgl@inside@rg{\ensuremath{\geq}}
\def\fgl@inside@rG{\ensuremath{\bm{\geq}}}
\def\fgl@inside@rs{\ensuremath{\leq}}
\def\fgl@inside@rS{\ensuremath{\bm{\leq}}}
\def\fgl@inside@rp{\ensuremath{\prec}}
\def\fgl@inside@rP{\ensuremath{\bm{\prec}}}
\def\fgl@inside@rpe{\ensuremath{\preceq}}
\def\fgl@inside@rpE{\ensuremath{\bm{\preceq}}}
\def\fgl@inside@rq{\ensuremath{\succ}}
\def\fgl@inside@rQ{\ensuremath{\bm{\succ}}}
\def\fgl@inside@rqe{\ensuremath{\succeq}}
\def\fgl@inside@rqE{\ensuremath{\bm{\succeq}}}

\def\fgl@inside@Rn{\ \rn\ }
\def\fgl@inside@RN{\ \rN\ }
\def\fgl@inside@Rg{\ \rg\ }
\def\fgl@inside@RG{\ \rG\ }
\def\fgl@inside@Rs{\ \rs\ }
\def\fgl@inside@RS{\ \rS\ }
\def\fgl@inside@Rp{\ \rp\ }
\def\fgl@inside@RP{\ \rP\ }
\def\fgl@inside@Rpe{\ \rpe\ }
\def\fgl@inside@RpE{\ \rpE\ }
\def\fgl@inside@Rq{\ \rq\ }
\def\fgl@inside@RQ{\ \rQ\ }
\def\fgl@inside@Rqe{\ \rqe\ }
\def\fgl@inside@RqE{\ \rqE\ }

%% Arguments Variables
\def\fgl@inside@ax{\a{x}}
\def\fgl@inside@aX{\a{X}}
\def\fgl@inside@ay{\a{y}}
\def\fgl@inside@aY{\a{Y}}
\def\fgl@inside@az{\a{z}}
\def\fgl@inside@aZ{\a{Z}}
\def\fgl@inside@ai{\a{i}}
\def\fgl@inside@aI{\a{I}}
\def\fgl@inside@as{\a{s}}
\def\fgl@inside@aS{\a{S}}
\def\fgl@inside@ad{\a{d}}
\def\fgl@inside@aD{\a{D}}
\def\fgl@inside@ar{\a{r}}
\def\fgl@inside@aR{\a{R}}
\def\fgl@inside@ap{\a{p}}
\def\fgl@inside@aP{\a{P}}
\def\fgl@inside@aq{\a{q}}
\def\fgl@inside@aQ{\a{Q}}
\def\fgl@inside@ae{\a{e}}
\def\fgl@inside@aE{\a{E}}

\def\fgl@inside@abx{\ab{x}}
\def\fgl@inside@abX{\ab{X}}
\def\fgl@inside@aby{\ab{y}}
\def\fgl@inside@abY{\ab{Y}}
\def\fgl@inside@abz{\ab{z}}
\def\fgl@inside@abZ{\ab{Z}}
\def\fgl@inside@abi{\ab{i}}
\def\fgl@inside@abI{\ab{I}}
\def\fgl@inside@abs{\ab{s}}
\def\fgl@inside@abS{\ab{S}}
\def\fgl@inside@abd{\ab{d}}
\def\fgl@inside@abD{\ab{D}}
\def\fgl@inside@abr{\ab{r}}
\def\fgl@inside@abR{\ab{R}}
\def\fgl@inside@abp{\ab{p}}
\def\fgl@inside@abP{\ab{P}}
\def\fgl@inside@abq{\ab{q}}
\def\fgl@inside@abQ{\ab{Q}}
\def\fgl@inside@abe{\ab{e}}
\def\fgl@inside@abE{\ab{E}}

%% Arguments Variables Meta
\def\fgl@inside@bx{(\j{x})}
\def\fgl@inside@bX{(\j{X})}
\def\fgl@inside@by{(\j{y})}
\def\fgl@inside@bY{(\j{Y})}
\def\fgl@inside@bz{(\j{z})}
\def\fgl@inside@bZ{(\j{Z})}
\def\fgl@inside@bi{(\j{i})}
\def\fgl@inside@bI{(\j{I})}
\def\fgl@inside@bs{(\j{s})}
\def\fgl@inside@bS{(\j{S})}
\def\fgl@inside@bd{(\j{d})}
\def\fgl@inside@bD{(\j{D})}
\def\fgl@inside@br{(\j{r})}
\def\fgl@inside@bR{(\j{R})}
\def\fgl@inside@bp{(\j{p})}
\def\fgl@inside@bP{(\j{P})}
\def\fgl@inside@bq{(\j{q})}
\def\fgl@inside@bQ{(\j{Q})}
\def\fgl@inside@be{(\j{e})}
\def\fgl@inside@bE{(\j{E})}

\def\fgl@inside@Ax{\A{x}}
\def\fgl@inside@AX{\A{X}}
\def\fgl@inside@Ay{\A{y}}
\def\fgl@inside@AY{\A{Y}}
\def\fgl@inside@Az{\A{z}}
\def\fgl@inside@AZ{\A{Z}}
\def\fgl@inside@Ai{\A{i}}
\def\fgl@inside@AI{\A{I}}
\def\fgl@inside@As{\A{s}}
\def\fgl@inside@AS{\A{S}}
\def\fgl@inside@Ad{\A{d}}
\def\fgl@inside@AD{\A{D}}
\def\fgl@inside@Ar{\A{r}}
\def\fgl@inside@AR{\A{R}}
\def\fgl@inside@Ap{\A{p}}
\def\fgl@inside@AP{\A{P}}
\def\fgl@inside@Aq{\A{q}}
\def\fgl@inside@AQ{\A{Q}}
\def\fgl@inside@Ae{\A{e}}
\def\fgl@inside@AE{\A{E}}

\def\fgl@inside@aBx{\aB{x}}
\def\fgl@inside@aBX{\aB{X}}
\def\fgl@inside@aBy{\aB{y}}
\def\fgl@inside@aBY{\aB{Y}}
\def\fgl@inside@aBz{\aB{z}}
\def\fgl@inside@aBZ{\aB{Z}}
\def\fgl@inside@aBi{\aB{i}}
\def\fgl@inside@aBI{\aB{I}}
\def\fgl@inside@aBs{\aB{s}}
\def\fgl@inside@aBS{\aB{S}}
\def\fgl@inside@aBd{\aB{d}}
\def\fgl@inside@aBD{\aB{D}}
\def\fgl@inside@aBr{\aB{r}}
\def\fgl@inside@aBR{\aB{R}}
\def\fgl@inside@aBp{\aB{p}}
\def\fgl@inside@aBP{\aB{P}}
\def\fgl@inside@aBq{\aB{q}}
\def\fgl@inside@aBQ{\aB{Q}}
\def\fgl@inside@aBe{\aB{e}}
\def\fgl@inside@aBE{\aB{E}}

\let\sss\ss

%% Situations
\def\fgl@inside@ss{\sstar}
\def\fgl@inside@sS{\sstaR}
\def\fgl@inside@sz{\szero}
\def\fgl@inside@sZ{\szerO}
\def\fgl@inside@so{\sone}
\def\fgl@inside@sO{\sonE}
\def\fgl@inside@st{\stwo}
\def\fgl@inside@sT{\stwO}
\def\fgl@inside@si{\textsubscript{\ensuremath{i}}}
\def\fgl@inside@sI{\textsubscript{\ensuremath{\obl{i}}}}

\def\fgl@inside@Ss{\ss\ }
\def\fgl@inside@SS{\sS\ }
\def\fgl@inside@Sz{\sz\ }
\def\fgl@inside@SZ{\sZ\ }
\def\fgl@inside@So{\so\ }
\def\fgl@inside@SO{\sO\ }
\def\fgl@inside@St{\st\ }
\def\fgl@inside@ST{\sT\ }
\def\fgl@inside@Si{\meli{i}\ }
\def\fgl@inside@SI{\obli{i}\ }

%% Traces		
\def\fgl@inside@tx{\tracex}
\def\fgl@inside@tX{\traceX}
\def\fgl@inside@Tx{\tracEx}
\def\fgl@inside@TX{\tracEX}
\def\fgl@inside@ty{\tracey}
\def\fgl@inside@tY{\traceY}
\def\fgl@inside@Ty{\tracEy}
\def\fgl@inside@TY{\tracEY}
\def\fgl@inside@tz{\tracez}
\def\fgl@inside@tZ{\traceZ}
\def\fgl@inside@Tz{\tracEz}
\def\fgl@inside@TZ{\tracEZ}

\def\fgl@inside@txs{\tx\ }
\def\fgl@inside@tXs{\tX\ }
\def\fgl@inside@Txs{\Tx\ }
\def\fgl@inside@TXs{\TX\ }
\def\fgl@inside@tys{\ty\ }
\def\fgl@inside@tYs{\tY\ }
\def\fgl@inside@Tys{\Ty\ }
\def\fgl@inside@TYs{\TY\ }
\def\fgl@inside@tzs{\tz\ }
\def\fgl@inside@tZs{\tZ\ }
\def\fgl@inside@Tzs{\Tz\ }
\def\fgl@inside@TZs{\TZ\ }

\def\fgl@inside@te{\typee}
\def\fgl@inside@td{\typed}
\def\fgl@inside@tet{\typeet}
\def\fgl@inside@teET{\typeeET}
\def\fgl@inside@tt{\typet}
\def\fgl@inside@ttt{\typett}
\def\fgl@inside@ts{\types}
\def\fgl@inside@tst{\typest}
\def\fgl@inside@tse{\typese}

\def\fgl@inside@fgslisinfgls{true}

\DeclareDocumentCommand{\fgl@inside@l}{m O{}}{\lambh{#1}[#2]}
\DeclareDocumentCommand{\fgl@inside@L}{m O{}}{\lambH{#1}[#2]}

\DeclareDocumentCommand{\fgl@inside@qe}{O{} O{}}{\ensuremath{\exists}\@ifempty{#1}{}{\textsuperscript{{\tiny \ensuremath{#1}}}}\@ifempty{#2}{}{\textsuperscript{{\tiny \ensuremath{#2}}}}}
\DeclareDocumentCommand{\fgl@inside@qE}{O{} O{}}{\ensuremath{\bm{\exists}}\@ifempty{#1}{}{\textsuperscript{{\tiny \ensuremath{#1}}}}\@ifempty{#2}{}{\textsuperscript{{\tiny \ensuremath{#2}}}}}
\DeclareDocumentCommand{\fgl@inside@Qe}{O{} O{}}{\qe[#1][#2]\ }
\DeclareDocumentCommand{\fgl@inside@QE}{O{} O{}}{\qE[#1][#2]\ }
\DeclareDocumentCommand{\fgl@inside@qeg}{O{2}}{\qe[\geq][#1]}
\DeclareDocumentCommand{\fgl@inside@qeG}{O{2}}{\qE[\geq][#1]}
\DeclareDocumentCommand{\fgl@inside@Qeg}{O{2}}{\Qe[\geq][#1]}
\DeclareDocumentCommand{\fgl@inside@QeG}{O{2}}{\QE[\geq][#1]}
\DeclareDocumentCommand{\fgl@inside@qes}{O{2}}{\qe[\leq][#1]}
\DeclareDocumentCommand{\fgl@inside@qeS}{O{2}}{\qE[\leq][#1]}
\DeclareDocumentCommand{\fgl@inside@Qes}{O{2}}{\Qe[\leq][#1]}
\DeclareDocumentCommand{\fgl@inside@QeS}{O{2}}{\QE[\leq][#1]}
\DeclareDocumentCommand{\fgl@inside@qee}{O{2}}{\qe[=][#1]}
\DeclareDocumentCommand{\fgl@inside@qeE}{O{2}}{\qE[=][#1]}
\DeclareDocumentCommand{\fgl@inside@Qee}{O{2}}{\Qe[=][#1]}
\DeclareDocumentCommand{\fgl@inside@QeE}{O{2}}{\QE[=][#1]}

%
\fgl@defopt{fgl@inside@lx}{\lmdx[#1]}
\fgl@defopt{fgl@inside@lX}{\lmdX[#1]}
\fgl@defopt{fgl@inside@Lx}{\lmDx[#1]}
\fgl@defopt{fgl@inside@LX}{\lmDX[#1]}
\fgl@defopt{fgl@inside@ly}{\lmdy[#1]}
\fgl@defopt{fgl@inside@lY}{\lmdY[#1]}
\fgl@defopt{fgl@inside@Ly}{\lmDy[#1]}
\fgl@defopt{fgl@inside@LY}{\lmDY[#1]}
\fgl@defopt{fgl@inside@lz}{\lmdz[#1]}
\fgl@defopt{fgl@inside@lZ}{\lmdZ[#1]}
\fgl@defopt{fgl@inside@Lz}{\lmDz[#1]}
\fgl@defopt{fgl@inside@LZ}{\lmDZ[#1]}
\fgl@defopt{fgl@inside@lp}{\lmdp[#1]}
\fgl@defopt{fgl@inside@lP}{\lmdP[#1]}
\fgl@defopt{fgl@inside@Lp}{\lmDp[#1]}
\fgl@defopt{fgl@inside@LP}{\lmDP[#1]}
\fgl@defopt{fgl@inside@lq}{\lmdq[#1]}
\fgl@defopt{fgl@inside@lQ}{\lmdQ[#1]}
\fgl@defopt{fgl@inside@Lq}{\lmDq[#1]}
\fgl@defopt{fgl@inside@LQ}{\lmDQ[#1]}
\fgl@defopt{fgl@inside@ls}{\lmds[#1]}
\fgl@defopt{fgl@inside@lS}{\lmdS[#1]}
\fgl@defopt{fgl@inside@Ls}{\lmDs[#1]}
\fgl@defopt{fgl@inside@LS}{\lmDS[#1]}
\fgl@defopt{fgl@inside@lt}{\lmdt[#1]}
\fgl@defopt{fgl@inside@lT}{\lmdT[#1]}
\fgl@defopt{fgl@inside@Lt}{\lmDt[#1]}
\fgl@defopt{fgl@inside@LT}{\lmDT[#1]}
\fgl@defopt{fgl@inside@ld}{\lmdd[#1]}
\fgl@defopt{fgl@inside@lD}{\lmdD[#1]}
\fgl@defopt{fgl@inside@Ld}{\lmDd[#1]}
\fgl@defopt{fgl@inside@LD}{\lmDD[#1]}
\fgl@defopt{fgl@inside@li}{\lmdi[#1]}
\fgl@defopt{fgl@inside@lI}{\lmdI[#1]}
\fgl@defopt{fgl@inside@Li}{\lmDi[#1]}
\fgl@defopt{fgl@inside@LI}{\lmDI[#1]}
\fgl@defopt{fgl@inside@lr}{\lmdr[#1]}
\fgl@defopt{fgl@inside@lR}{\lmdR[#1]}
\fgl@defopt{fgl@inside@Lr}{\lmDr[#1]}
\fgl@defopt{fgl@inside@LR}{\lmDR[#1]}
\fgl@defopt{fgl@inside@lu}{\lmdu[#1]}
\fgl@defopt{fgl@inside@lU}{\lmdU[#1]}
\fgl@defopt{fgl@inside@Lu}{\lmDu[#1]}
\fgl@defopt{fgl@inside@LU}{\lmDU[#1]}
\fgl@defopt{fgl@inside@lv}{\lmdv[#1]}
\fgl@defopt{fgl@inside@lV}{\lmdV[#1]}
\fgl@defopt{fgl@inside@Lv}{\lmDv[#1]}
\fgl@defopt{fgl@inside@LV}{\lmDV[#1]}

\DeclareDocumentCommand{\fgl@inside@lha}{O{x} O{\@typee}}{\lambha[#1][#2]}
\DeclareDocumentCommand{\fgl@inside@lhA}{O{x} O{\@typee}}{\lambhA[#1][#2]}
\DeclareDocumentCommand{\fgl@inside@lhan}{O{x} O{\@typee}}{\lambhan[#1][#2]}
\DeclareDocumentCommand{\fgl@inside@lhaN}{O{x} O{\@typee}}{\lambhaN[#1][#2]}
\DeclareDocumentCommand{\fgl@inside@lhe}{O{x} O{\@typee}}{\lambhe[#1][#2]}
\DeclareDocumentCommand{\fgl@inside@lhE}{O{x} O{\@typee}}{\lambhE[#1][#2]}
\DeclareDocumentCommand{\fgl@inside@lhen}{O{x} O{\@typee}}{\lambhen[#1][#2]}
\DeclareDocumentCommand{\fgl@inside@lheN}{O{x} O{\@typee}}{\lambheN[#1][#2]}


\DeclareDocumentCommand{\fgl@inside@d}{O{g} m}{\sid[#1]{#2}}
\DeclareDocumentCommand{\fgl@inside@D}{O{g} m}{\siD[#1]{#2}}

\DeclareDocumentCommand{\fgl@inside@dr}{m O{r} O{g} O{x}}{\sidr{#1}{#2}[#4][#3]}
\DeclareDocumentCommand{\fgl@inside@dR}{m O{r} O{g} O{x}}{\sidR{#1}{#2}[#4][#3]}
\DeclareDocumentCommand{\fgl@inside@drr}{m O{r} O{d} O{g} O{x} O{y}}{\sidrr{#1}{#2}{#3}[#5][#6][#4]}
\DeclareDocumentCommand{\fgl@inside@dRR}{m O{r} O{d} O{g} O{x} O{y}}{\sidRR{#1}{##}{#3}[#5][#6][#4]}
\DeclareDocumentCommand{\fgl@inside@drrr}{m O{r} O{d} O{t} O{g} O{x} O{y} O{z}}{\sidrrr{#1}{#2}{#3}{#4}[#6][#7][#8][#5]}
\DeclareDocumentCommand{\fgl@inside@dRRR}{m O{r} O{d} O{t} O{g} O{x} O{y} O{z}}{\sidRRR{#1}{#2}{#3}{#4}[#6][#7][#8][#5]}



\DeclareDocumentCommand{\fgl@inside@lfsx}{m O{} O{\sblank} O{x} O{} O{}}{\lambh{#3}[#5]\lambh{#4}[#6]\ifempty{#2}\bool{\j{#4} #1 in #3}\else\bool{#2}\fi}
\DeclareDocumentCommand{\fgl@inside@lfsX}{m O{} O{\sblank} O{x} O{} O{}}{\lambH{#3}[#5]\lambH{#4}[#6]\ifempty{#2}\booL{\j{#4} #1 in #3}\else\booL{#2}\fi}
\DeclareDocumentCommand{\fgl@inside@lfsy}{m O{} O{\sblank} O{y} O{x} O{} O{} O{}}{\lambh{#3}[#6]\lambh{#4}[#7]\lambh{#5}[#8]\ifempty{#2}\bool{\j{#5} #1 \j{#4} in #3}\else\bool{#2}\fi}
\DeclareDocumentCommand{\fgl@inside@lfsY}{m O{} O{\sblank} O{y} O{x} O{} O{} O{}}{\lambH{#3}[#6]\lambH{#4}[#7]\lambH{#5}[#8]\ifempty{#2}\booL{\j{#5} #1 \j{#4} in #3}\else\booL{#2}\fi}
\DeclareDocumentCommand{\fgl@inside@lfsz}{m O{} O{\sblank} O{z} O{y} O{x} O{} O{} O{}}{\lambh{#3}[#7]\lambh{#4}[#8]\lambh{#5}[#9]\lambh{#6}[#9]\ifempty{#2}\bool{\j{#6} #1 \j{#5}\ \j{#4} in #3}\else\bool{#2}\fi}
\DeclareDocumentCommand{\fgl@inside@lfsZ}{m O{} O{\sblank} O{z} O{y} O{x} O{} O{} O{}}{\lambH{#3}[#7]\lambH{#4}[#8]\lambH{#5}[#9]\lambH{#6}[#9]\ifempty{#2}\booL{\j{#6} #1 \j{#5}\ \j{#4} in #3}\else\booL{#2}\fi}

\DeclareDocumentCommand{\fgl@inside@c}{O{\obli{i}} m}{\sic[#1]{#2}}
\DeclareDocumentCommand{\fgl@inside@C}{O{\obli{i}} m}{\siC[#1]{#2}}

\def\fgl@inside@t#1{\sit{#1}}
\def\fgl@inside@T#1{\siT{#1}}
\def\fgl@inside@ti#1{\sit{\textit{#1}}}
\def\fgl@inside@tI#1{\siT{\textit{#1}}}
\def\fgl@inside@tb#1{\sitnobf{#1}}
\def\fgl@inside@tB#1{\sitnobF{#1}}
\def\fgl@inside@tbi#1{\sitnobfi{#1}}
\def\fgl@inside@tbI#1{\sitnobfI{#1}}

\def\fgl@inside@sub#1{\ensuremath{_{#1}}}
\def\fgl@inside@suB#1{\ensuremath{_{\bm{#1}}}}
\def\fgl@inside@sup#1{\ensuremath{^{#1}}}
\def\fgl@inside@suP#1{\ensuremath{^{\bm{#1}}}}
\DeclareDocumentCommand{\fgl@inside@r}{O{} O{} m}{\lambby[#1][#2]{#3}}
\DeclareDocumentCommand{\fgl@inside@R}{O{} O{} m}{\lambbY[#1][#2]{#3}}
\def\fgl@inside@n#1{\bool{#1}}
\def\fgl@inside@N#1{\booL{#1}}
\DeclareDocumentCommand{\fgl@inside@s}{O{x} m}{\set[#1]{#2}}
\DeclareDocumentCommand{\fgl@inside@S}{O{x} m}{\seT[#1]{#2}}


\DeclareDocumentCommand{\fgl@inside@c}{O{\obli{i}} m}{\sic[#1]{#2}}
\DeclareDocumentCommand{\fgl@inside@C}{O{\obli{i}} m}{\siC[#1]{#2}}

\def\fgl@inside@i#1{\sdi{#1}}
\def\fgl@inside@I#1{\sdI{#1}}


\def\fgl@inside@b#1{\ensuremath{(}#1\ensuremath{)}}
\def\fgl@inside@B#1{\obl{(}#1\obl{)}}

\def\fgl@inside@o#1{\obl{#1}}
\def\fgl@inside@v#1{\obli{#1}}
\def\fgl@inside@m#1{\mel{#1}}
\def\fgl@inside@j#1{\meli{#1}}

\def\fgl@inside@h#1{\type{#1}}

\def\fgl@inside@t#1{\sit{#1}}
\def\fgl@inside@T#1{\siT{#1}}
\def\fgl@inside@ti#1{\sit{\textit{#1}}}
\def\fgl@inside@tI#1{\siT{\textit{#1}}}
\def\fgl@inside@tb#1{\sitnobf{#1}}
\def\fgl@inside@tB#1{\sitnobF{#1}}
\def\fgl@inside@tbi#1{\sitnobfi{#1}}
\def\fgl@inside@tbI#1{\sitnobfI{#1}}

\def\fgl@inside@a#1{\obl{(}\obli{#1}\obl{)}}
\def\fgl@inside@ab#1{\obl{(}\obli{#1}\obl{)}}
\def\fgl@inside@A#1{\obl{(#1)}}
\def\fgl@inside@aB#1{\obl{(}\obl{#1}\obl{)}}
\def\fgl@inside@sa#1{\sarrow{#1}}
\def\fgl@inside@sA#1{\sarroW{#1}}

\DeclareDocumentCommand{\fgl@inside@cset}{m O{} O{\cs}}{\ensuremath{#1_\text{#3}^\text{#2}}}

%% Lambda Functions
\DeclareDocumentCommand{\fgl@inside@lfx}{m O{} O{x} O{\fgl@internalsrdesituation} O{}}{\lambh{#3}[#5]\@ifempty{#2}{\bool{\j{#3} #1 in #4}}{\bool{#2}}}
\DeclareDocumentCommand{\fgl@inside@lfX}{m O{} O{x} O{\fgl@internalsrdesituation} O{}}{\lambH{#3}[#5]\@ifempty{#2}{\booL{\j{#3} #1 in #4}}{\booL{#2}}}
\DeclareDocumentCommand{\fgl@inside@lfy}{m O{} O{y} O{x} O{\fgl@internalsrdesituation} O{} O{}}{\lambh{#3}[#6]\lambh{#4}[#7]\@ifempty{#2}{\bool{\j{#4} #1 \j{#3} in #5}}{\bool{#2}}}
\DeclareDocumentCommand{\fgl@inside@lfY}{m O{} O{y} O{x} O{\fgl@internalsrdesituation} O{} O{}}{\lambH{#3}[#6]\lambH{#4}[#7]\@ifempty{#2}{\booL{\j{#4} #1 \j{#3} in #5}}{\booL{#2}}}
\DeclareDocumentCommand{\fgl@inside@lfz}{m O{} O{z} O{y} O{x} O{\fgl@internalsrdesituation} O{} O{} O{}}{\lambh{#3}[#7]\lambh{#4}[#8]\lambh{#5}[#9]\@ifempty{#2}{\bool{\j{#5} #1 \j{#4}\ \j{#3} in #6}}{\bool{#2}}}
\DeclareDocumentCommand{\fgl@inside@lfZ}{m O{} O{z} O{y} O{x} O{\fgl@internalsrdesituation} O{} O{} O{}}{\lambH{#3}[#7]\lambH{#4}[#8]\lambH{#5}[#9]\@ifempty{#2}{\booL{\j{#5} #1 \j{#4}\ \j{#3} in #6}}{\booL{#2}}}

\DeclareDocumentCommand{\fgl@inside@e}{O{\fgl@internalsrdesituation} m}{\sde[#1]{#2}}
\DeclareDocumentCommand{\fgl@inside@E}{O{\fgl@internalsrdesituation} m}{\sdE[#1]{#2}}

\DeclareDocumentEnvironment{fgls}{O{\FGL@situation}}{%
	\let\fgslisinfgls\fgl@inside@fgslisinfgls%
	\def\fgl@internalsrdesituation{#1}%
	% Commands
	\def\cs{#1}%
	\def\cS{\o{#1}}%
	\def\Cs{#1\ }%
	\def\CS{\o{#1}\ }%
%
	\def\sv{\setvar}%
	\def\Sv{\Setvar}%
%
	%% Text shortcuts
	\let\o\fgl@inside@o%
	\let\v\fgl@inside@v%
	\let\m\fgl@inside@m%
	\let\j\fgl@inside@j%
%
	\let\l\fgl@inside@l%
	\let\L\fgl@inside@L%
%
	\let\h\fgl@inside@h%
%
	% Constants
	%% Object Language	
	\let\ox\fgl@inside@ox%
	\let\oX\fgl@inside@oX%
	\let\oy\fgl@inside@oy%
	\let\oY\fgl@inside@oY%
	\let\oz\fgl@inside@oz%
	\let\oZ\fgl@inside@oZ%
	\let\oi\fgl@inside@oi%
	\let\oI\fgl@inside@oI%
	\let\oj\fgl@inside@oj%
	\let\oJ\fgl@inside@oJ%
	\let\os\fgl@inside@os%
	\let\oS\fgl@inside@oS%
	\let\ot\fgl@inside@ot%
	\let\oT\fgl@inside@oT%
	\let\og\fgl@inside@og%
	\let\oG\fgl@inside@oG%
	\let\od\fgl@inside@od%
	\let\oD\fgl@inside@oD%
	\let\oq\fgl@inside@oq%
	\let\oQ\fgl@inside@oQ%
	\let\op\fgl@inside@op%
	\let\oP\fgl@inside@oP%
	\let\oR\fgl@inside@oR%
	\let\x\fgl@inside@x%
	\let\X\fgl@inside@X%
	\let\y\fgl@inside@y%
	\let\Y\fgl@inside@Y%
	\let\z\fgl@inside@z%
	\let\Z\fgl@inside@Z%
%
	\let\Ox\fgl@inside@Ox%
	\let\OX\fgl@inside@OX%
	\let\Oy\fgl@inside@Oy%
	\let\OY\fgl@inside@OY%
	\let\Oz\fgl@inside@Oz%
	\let\OZ\fgl@inside@OZ%
	\let\Oi\fgl@inside@Oi%
	\let\OI\fgl@inside@OI%
	\let\Oj\fgl@inside@Oj%
	\let\OJ\fgl@inside@OJ%
	\let\Os\fgl@inside@Os%
	\let\OS\fgl@inside@OS%
	\let\Ot\fgl@inside@Ot%
	\let\OT\fgl@inside@OT%
	\let\Og\fgl@inside@Og%
	\let\OG\fgl@inside@OG%
	\let\Od\fgl@inside@Od%
	\let\OD\fgl@inside@OD%
	\let\Oq\fgl@inside@Oq%
	\let\OQ\fgl@inside@OQ%
	\let\Op\fgl@inside@Op%
	\let\OP\fgl@inside@OP%
	\let\OR\fgl@inside@OR%
%
	\let\greekmu\mu%
%
	%% Meta Language
	\let\mx\fgl@inside@mx%
	\let\mX\fgl@inside@mX%
	\let\my\fgl@inside@my%
	\let\mY\fgl@inside@mY%
	\let\c\fgl@inside@c%
	\let\C\fgl@inside@C%
%
	\let\t\fgl@inside@t%
	\let\T\fgl@inside@T%
	\let\ti\fgl@inside@ti%
	\let\tI\fgl@inside@tI%
	\let\tb\fgl@inside@tb%
	\let\tB\fgl@inside@tB%
	\let\tbi\fgl@inside@tbi%
	\let\tbI\fgl@inside@tbI%
	\let\mz\fgl@inside@mz%
	\let\mZ\fgl@inside@mZ%
	\let\mi\fgl@inside@mi%
	\let\mI\fgl@inside@mI%
	\let\mj\fgl@inside@mj%
	\let\mJ\fgl@inside@mJ%
	\let\ms\fgl@inside@ms%
	\let\mS\fgl@inside@mS%
	\let\mt\fgl@inside@mt%
	\let\mT\fgl@inside@mT%
	\let\mg\fgl@inside@mg%
	\let\mG\fgl@inside@mG%
	\let\md\fgl@inside@md%
	\let\mD\fgl@inside@mD%
	\let\mp\fgl@inside@mp%
	\let\mP\fgl@inside@mP%
	\let\mq\fgl@inside@mq%
	\let\mQ\fgl@inside@mQ%
	\let\mr\fgl@inside@mr%
	\let\mR\fgl@inside@mR%
	\let\mu\fgl@inside@mu%
	\let\mU\fgl@inside@mU%
	\let\mv\fgl@inside@mv%
	\let\mV\fgl@inside@mV%
%
	\let\Mx\fgl@inside@Mx%
	\let\MX\fgl@inside@MX%
	\let\My\fgl@inside@My%
	\let\MY\fgl@inside@MY%
	\let\Mz\fgl@inside@Mz%
	\let\MZ\fgl@inside@MZ%
	\let\Mi\fgl@inside@Mi%
	\let\MI\fgl@inside@MI%
	\let\Mj\fgl@inside@Mj%
	\let\MJ\fgl@inside@MJ%
	\let\Ms\fgl@inside@Ms%
	\let\MS\fgl@inside@MS%
	\let\Md\fgl@inside@Md%
	\let\MD\fgl@inside@MD%
	\let\Mt\fgl@inside@Mt%
	\let\MT\fgl@inside@MT%
	\let\Mg\fgl@inside@Mg%
	\let\MG\fgl@inside@MG%
	\let\Mp\fgl@inside@Mp%
	\let\MP\fgl@inside@MP%
	\let\Mq\fgl@inside@Mq%
	\let\MQ\fgl@inside@MQ%
	\let\Mr\fgl@inside@Mr%
	\let\MR\fgl@inside@MR%
	\let\Mu\fgl@inside@Mu%
	\let\MU\fgl@inside@MU%
	\let\Mv\fgl@inside@Mv%
	\let\MV\fgl@inside@MV%
%
	%% Logic
	\let\qa\fgl@inside@qa%
	\let\qA\fgl@inside@qA%
	\let\Qa\fgl@inside@Qa%
	\let\QA\fgl@inside@QA%
%
	\let\qu\fgl@inside@qu%
	\let\qU\fgl@inside@qU%
	\let\Qu\fgl@inside@Qu%
	\let\QU\fgl@inside@QU%
%
	\let\jn\fgl@inside@jn%
	\let\jN\fgl@inside@jN%
	\let\jc\fgl@inside@jc%
	\let\jC\fgl@inside@jC%
	\let\jd\fgl@inside@jd%
	\let\jD\fgl@inside@jD%
	\let\ji\fgl@inside@ji%
	\let\jI\fgl@inside@jI%
	\let\jj\fgl@inside@jj%
	\let\jJ\fgl@inside@jJ%
	\let\jx\fgl@inside@jx%
	\let\jX\fgl@inside@jX%
	\let\jb\fgl@inside@jb%
	\let\jB\fgl@inside@jB%
	\let\jp\fgl@inside@jp%
	\let\jP\fgl@inside@jP%
	\let\jt\fgl@inside@jt%
	\let\jT\fgl@inside@jT%
	\let\jf\fgl@inside@jf%
	\let\jF\fgl@inside@jF%
	\let\je\fgl@inside@je%
	\let\jE\fgl@inside@jE%
	\let\jo\fgl@inside@jo%
	\let\jO\fgl@inside@jO%
%
	\let\Jn\fgl@inside@Jn%
	\let\JN\fgl@inside@JN%
	\let\Jc\fgl@inside@Jc%
	\let\JC\fgl@inside@JC%
	\let\Jd\fgl@inside@Jd%
	\let\JD\fgl@inside@JD%
	\let\Ji\fgl@inside@Ji%
	\let\JI\fgl@inside@JI%
	\let\Jj\fgl@inside@Jj%
	\let\JJ\fgl@inside@JJ%
	\let\Jx\fgl@inside@Jx%
	\let\JX\fgl@inside@JX%
	\let\Jb\fgl@inside@Jb%
	\let\JB\fgl@inside@JB%
	\let\Jp\fgl@inside@Jp%
	\let\JP\fgl@inside@JP%
	\let\Jt\fgl@inside@Jt%
	\let\JT\fgl@inside@JT%
	\let\Jf\fgl@inside@Jf%
	\let\JF\fgl@inside@JF%
	\let\Je\fgl@inside@Je%
	\let\JE\fgl@inside@JE%
	\let\Jo\fgl@inside@Jo%
	\let\JO\fgl@inside@JO%
%
	%% Set theory
	\let\ci\fgl@inside@ci%
	\let\cI\fgl@inside@cI%
	\let\cd\fgl@inside@cd%
	\let\cD\fgl@inside@cD%
	\let\ce\fgl@inside@ce%
	\let\cE\fgl@inside@cE%
	\let\cb\fgl@inside@cb%
	\let\cB\fgl@inside@cB%
	\let\cq\fgl@inside@cq%
	\let\cQ\fgl@inside@cQ%
	\let\ca\fgl@inside@ca%
	\let\cA\fgl@inside@cA%
	\let\cu\fgl@inside@cu%
	\let\cU\fgl@inside@cU%
%
	\let\Ci\fgl@inside@Ci%
	\let\CI\fgl@inside@CI%
	\let\Cd\fgl@inside@Cd%
	\let\CD\fgl@inside@CD%
	\let\Ce\fgl@inside@Ce%
	\let\CE\fgl@inside@CE%
	\let\Cb\fgl@inside@Cb%
	\let\CB\fgl@inside@CB%
	\let\Cq\fgl@inside@Cq%
	\let\CQ\fgl@inside@CQ%
	\let\Ca\fgl@inside@Ca%
	\let\CA\fgl@inside@CA%
	\let\Cu\fgl@inside@Cu%
	\let\CU\fgl@inside@CU%
%
	%% Relation Constants
	\let\rn\fgl@inside@rn%
	\let\rN\fgl@inside@rN%
	\let\rg\fgl@inside@rg%
	\let\rG\fgl@inside@rG%
	\let\rs\fgl@inside@rs%
	\let\rS\fgl@inside@rS%
	\let\rp\fgl@inside@rp%
	\let\rP\fgl@inside@rP%
	\let\rpe\fgl@inside@rpe%
	\let\rpE\fgl@inside@rpE%
	\let\rq\fgl@inside@rq%
	\let\rQ\fgl@inside@rQ%
	\let\rqe\fgl@inside@rqe%
	\let\rqE\fgl@inside@rqE%
%
	\let\Rn\fgl@inside@Rn%
	\let\RN\fgl@inside@RN%
	\let\Rg\fgl@inside@Rg%
	\let\RG\fgl@inside@RG%
	\let\Rs\fgl@inside@Rs%
	\let\RS\fgl@inside@RS%
	\let\Rp\fgl@inside@Rp%
	\let\RP\fgl@inside@RP%
	\let\Rpe\fgl@inside@Rpe%
	\let\RpE\fgl@inside@RpE%
	\let\Rq\fgl@inside@Rq%
	\let\RQ\fgl@inside@RQ%
	\let\Rqe\fgl@inside@Rqe%
	\let\RqE\fgl@inside@RqE%
%
	%% Arguments Variables
	\let\ax\fgl@inside@ax%
	\let\aX\fgl@inside@aX%
	\let\ay\fgl@inside@ay%
	\let\aY\fgl@inside@aY%
	\let\az\fgl@inside@az%
	\let\aZ\fgl@inside@aZ%
	\let\ai\fgl@inside@ai%
	\let\aI\fgl@inside@aI%
	\let\as\fgl@inside@as%
	\let\aS\fgl@inside@aS%
	\let\ad\fgl@inside@ad%
	\let\aD\fgl@inside@aD%
	\let\ar\fgl@inside@ar%
	\let\aR\fgl@inside@aR%
	\let\ap\fgl@inside@ap%
	\let\aP\fgl@inside@aP%
	\let\aq\fgl@inside@aq%
	\let\aQ\fgl@inside@aQ%
	\let\ae\fgl@inside@ae%
	\let\aE\fgl@inside@aE%
%
	\let\abx\fgl@inside@abx%
	\let\abX\fgl@inside@abX%
	\let\aby\fgl@inside@aby%
	\let\abY\fgl@inside@abY%
	\let\abz\fgl@inside@abz%
	\let\abZ\fgl@inside@abZ%
	\let\abi\fgl@inside@abi%
	\let\abI\fgl@inside@abI%
	\let\abs\fgl@inside@abs%
	\let\abS\fgl@inside@abS%
	\let\abd\fgl@inside@abd%
	\let\abD\fgl@inside@abD%
	\let\abr\fgl@inside@abr%
	\let\abR\fgl@inside@abR%
	\let\abp\fgl@inside@abp%
	\let\abP\fgl@inside@abP%
	\let\abq\fgl@inside@abq%
	\let\abQ\fgl@inside@abQ%
	\let\abe\fgl@inside@abe%
	\let\abE\fgl@inside@abE%
%
	%% Arguments Variables Meta
	\let\bx\fgl@inside@bx%
	\let\bX\fgl@inside@bX%
	\let\by\fgl@inside@by%
	\let\bY\fgl@inside@bY%
	\let\bz\fgl@inside@bz%
	\let\bZ\fgl@inside@bZ%
	\let\bi\fgl@inside@bi%
	\let\bI\fgl@inside@bI%
	\let\bs\fgl@inside@bs%
	\let\bS\fgl@inside@bS%
	\let\bd\fgl@inside@bd%
	\let\bD\fgl@inside@bD%
	\let\br\fgl@inside@br%
	\let\bR\fgl@inside@bR%
	\let\bp\fgl@inside@bp%
	\let\bP\fgl@inside@bP%
	\let\bq\fgl@inside@bq%
	\let\bQ\fgl@inside@bQ%
	\let\be\fgl@inside@be%
	\let\bE\fgl@inside@bE%
%
	\let\Ax\fgl@inside@Ax%
	\let\AX\fgl@inside@AX%
	\let\Ay\fgl@inside@Ay%
	\let\AY\fgl@inside@AY%
	\let\Az\fgl@inside@Az%
	\let\AZ\fgl@inside@AZ%
	\let\Ai\fgl@inside@Ai%
	\let\AI\fgl@inside@AI%
	\let\As\fgl@inside@As%
	\let\AS\fgl@inside@AS%
	\let\Ad\fgl@inside@Ad%
	\let\AD\fgl@inside@AD%
	\let\Ar\fgl@inside@Ar%
	\let\AR\fgl@inside@AR%
	\let\Ap\fgl@inside@Ap%
	\let\AP\fgl@inside@AP%
	\let\Aq\fgl@inside@Aq%
	\let\AQ\fgl@inside@AQ%
	\let\Ae\fgl@inside@Ae%
	\let\AE\fgl@inside@AE%
%
	\let\aBx\fgl@inside@aBx%
	\let\aBX\fgl@inside@aBX%
	\let\aBy\fgl@inside@aBy%
	\let\aBY\fgl@inside@aBY%
	\let\aBz\fgl@inside@aBz%
	\let\aBZ\fgl@inside@aBZ%
	\let\aBi\fgl@inside@aBi%
	\let\aBI\fgl@inside@aBI%
	\let\aBs\fgl@inside@aBs%
	\let\aBS\fgl@inside@aBS%
	\let\aBd\fgl@inside@aBd%
	\let\aBD\fgl@inside@aBD%
	\let\aBr\fgl@inside@aBr%
	\let\aBR\fgl@inside@aBR%
	\let\aBp\fgl@inside@aBp%
	\let\aBP\fgl@inside@aBP%
	\let\aBq\fgl@inside@aBq%
	\let\aBQ\fgl@inside@aBQ%
	\let\aBe\fgl@inside@aBe%
	\let\aBE\fgl@inside@aBE%
%
	\let\sss\ss%
%
	%% Situations
	\let\ss\fgl@inside@ss%
	\let\sS\fgl@inside@sS%
	\let\sz\fgl@inside@sz%
	\let\sZ\fgl@inside@sZ%
	\let\so\fgl@inside@so%
	\let\sO\fgl@inside@sO%
	\let\st\fgl@inside@st%
	\let\sT\fgl@inside@sT%
	\let\si\fgl@inside@si%
	\let\sI\fgl@inside@sI%
%
	\let\Ss\fgl@inside@Ss%
	\let\SS\fgl@inside@SS%
	\let\Sz\fgl@inside@Sz%
	\let\SZ\fgl@inside@SZ%
	\let\So\fgl@inside@So%
	\let\SO\fgl@inside@SO%
	\let\St\fgl@inside@St%
	\let\ST\fgl@inside@ST%
	\let\Si\fgl@inside@Si%
	\let\SI\fgl@inside@SI%
%
	%% Traces		
	\let\tx\fgl@inside@tx%
	\let\tX\fgl@inside@tX%
	\let\Tx\fgl@inside@Tx%
	\let\TX\fgl@inside@TX%
	\let\ty\fgl@inside@ty%
	\let\tY\fgl@inside@tY%
	\let\Ty\fgl@inside@Ty%
	\let\TY\fgl@inside@TY%
	\let\tz\fgl@inside@tz%
	\let\tZ\fgl@inside@tZ%
	\let\Tz\fgl@inside@Tz%
	\let\TZ\fgl@inside@TZ%
%
	\let\txs\fgl@inside@txs%
	\let\tXs\fgl@inside@tXs%
	\let\Txs\fgl@inside@Txs%
	\let\TXs\fgl@inside@TXs%
	\let\tys\fgl@inside@tys%
	\let\tYs\fgl@inside@tYs%
	\let\Tys\fgl@inside@Tys%
	\let\TYs\fgl@inside@TYs%
	\let\tzs\fgl@inside@tzs%
	\let\tZs\fgl@inside@tZs%
	\let\Tzs\fgl@inside@Tzs%
	\let\TZs\fgl@inside@TZs%
%
	\let\te\fgl@inside@te%
	\let\td\fgl@inside@td%
	\let\tet\fgl@inside@tet%
	\let\teET\fgl@inside@teET%
	\let\tt\fgl@inside@tt%
	\let\ttt\fgl@inside@ttt%
	\let\ts\fgl@inside@ts%
	\let\tst\fgl@inside@tst%
	\let\tse\fgl@inside@tse%
%
	\let\qe\fgl@inside@qe%
	\let\qE\fgl@inside@qE%
	\let\Qe\fgl@inside@Qe%
	\let\QE\fgl@inside@QE%
	\let\qeg\fgl@inside@qeg%
	\let\qeG\fgl@inside@qeG%
	\let\Qeg\fgl@inside@Qeg%
	\let\QeG\fgl@inside@QeG%
	\let\qes\fgl@inside@qes%
	\let\qeS\fgl@inside@qeS%
	\let\Qes\fgl@inside@Qes%
	\let\QeS\fgl@inside@QeS%
	\let\qee\fgl@inside@qee%
	\let\qeE\fgl@inside@qeE%
	\let\Qee\fgl@inside@Qee%
	\let\QeE\fgl@inside@QeE%
%
	% Commands
	%% Text shortcuts
	%% Arguments
	\let\a\fgl@inside@a%
	\let\ab\fgl@inside@ab%
	\let\A\fgl@inside@A%
	\let\aB\fgl@inside@aB%
	\let\sa\fgl@inside@sa%
	\let\sA\fgl@inside@sA%
%
	%% Lambdas
	\let\lx\fgl@inside@lx%
	\let\lX\fgl@inside@lX%
	\let\Lx\fgl@inside@Lx%
	\let\LX\fgl@inside@LX%
	\let\ly\fgl@inside@ly%
	\let\lY\fgl@inside@lY%
	\let\Ly\fgl@inside@Ly%
	\let\LY\fgl@inside@LY%
	\let\lz\fgl@inside@lz%
	\let\lZ\fgl@inside@lZ%
	\let\Lz\fgl@inside@Lz%
	\let\LZ\fgl@inside@LZ%
	\let\lp\fgl@inside@lp%
	\let\lP\fgl@inside@lP%
	\let\Lp\fgl@inside@Lp%
	\let\LP\fgl@inside@LP%
	\let\lq\fgl@inside@lq%
	\let\lQ\fgl@inside@lQ%
	\let\Lq\fgl@inside@Lq%
	\let\LQ\fgl@inside@LQ%
	\let\ls\fgl@inside@ls%
	\let\lS\fgl@inside@lS%
	\let\Ls\fgl@inside@Ls%
	\let\LS\fgl@inside@LS%
	\let\lt\fgl@inside@lt%
	\let\lT\fgl@inside@lT%
	\let\Lt\fgl@inside@Lt%
	\let\LT\fgl@inside@LT%
	\let\ld\fgl@inside@ld%
	\let\lD\fgl@inside@lD%
	\let\Ld\fgl@inside@Ld%
	\let\LD\fgl@inside@LD%
	\let\li\fgl@inside@li%
	\let\lI\fgl@inside@lI%
	\let\Li\fgl@inside@Li%
	\let\LI\fgl@inside@LI%
	\let\lr\fgl@inside@lr%
	\let\lR\fgl@inside@lR%
	\let\Lr\fgl@inside@Lr%
	\let\LR\fgl@inside@LR%
	\let\lu\fgl@inside@lu%
	\let\lU\fgl@inside@lU%
	\let\Lu\fgl@inside@Lu%
	\let\LU\fgl@inside@LU%
	\let\lv\fgl@inside@lv%
	\let\lV\fgl@inside@lV%
	\let\Lv\fgl@inside@Lv%
	\let\LV\fgl@inside@LV%
%
	%% Lambda Heads todo
	\let\lha\fgl@inside@lha%
	\let\lhA\fgl@inside@lhA%
	\let\lhan\fgl@inside@lhan%
	\let\lhaN\fgl@inside@lhaN%
	\let\lhe\fgl@inside@lhe%
	\let\lhE\fgl@inside@lhE%
	\let\lhen\fgl@inside@lhen%
	\let\lheN\fgl@inside@lheN%
%
	%% Lambda Functions
	\let\lfx\fgl@inside@lfx%
	\let\lfX\fgl@inside@lfX%
	\let\lfy\fgl@inside@lfy%
	\let\lfY\fgl@inside@lfY%
	\let\lfz\fgl@inside@lfz%
	\let\lfZ\fgl@inside@lfZ%
%
	\let\lfsx\fgl@inside@lfsx%
	\let\lfsX\fgl@inside@lfsX%
	\let\lfsy\fgl@inside@lfsy%
	\let\lfsY\fgl@inside@lfsY%
	\let\lfsz\fgl@inside@lfsz%
	\let\lfsZ\fgl@inside@lfsZ%
%
	%% fast derivation calc commands
	\let\sub\fgl@inside@sub%
	\let\suB\fgl@inside@suB%
	\let\sup\fgl@inside@sup%
	\let\suP\fgl@inside@suP%
	\let\r\fgl@inside@r%
	\let\R\fgl@inside@R%
	\let\n\fgl@inside@n%
	\let\N\fgl@inside@N%
	\let\s\fgl@inside@s%
	\let\S\fgl@inside@S%
	\let\cset\fgl@inside@cset%
%
	\let\i\fgl@inside@i%
	\let\I\fgl@inside@I%
%
	\let\e\fgl@inside@e%
	\let\E\fgl@inside@E%
%
	\let\b\fgl@inside@b%
	\let\B\fgl@inside@B%
%
	\let\c\fgl@inside@c%
	\let\C\fgl@inside@C%
%
	\let\t\fgl@inside@t%
	\let\T\fgl@inside@T%
	\let\ti\fgl@inside@ti%
	\let\tI\fgl@inside@tI%
	\let\tb\fgl@inside@tb%
	\let\tB\fgl@inside@tB%
	\let\tbi\fgl@inside@tbi%
	\let\tbI\fgl@inside@tbI%
%
	\let\d\fgl@inside@d%
	\let\D\fgl@inside@D%
	\let\dr\fgl@inside@dr%
	\let\dR\fgl@inside@dR%
	\let\drr\fgl@inside@drr%
	\let\dRR\fgl@inside@dRR%
	\let\drrr\fgl@inside@drrr
	\let\dRRR\fgl@inside@dRRR
%
	\noindent}%
{%
\let\fgslisinfgls\@fglsundefined%
}

\DeclareDocumentCommand{\fglsem}{O{\FGL@situation} m O{\linewidth} O{}}{\begin{varwidth}[#4]{#3}\begin{fgls}[#1]#2\end{fgls}\end{varwidth}}
\DeclareDocumentCommand{\fglsemc}{O{\FGL@situation} m O{\linewidth} O{}}{\begin{varwidth}[#4]{#3}\begin{fgls}[#1]\begin{rb}#2\end{rb}\end{fgls}\end{varwidth}}
\DeclareDocumentCommand{\fglsemC}{O{\FGL@situation} m O{\linewidth} O{}}{\begin{varwidth}[#4]{#3}\begin{fgls}[#1]\begin{rbb}#2\end{rbb}\end{fgls}\end{varwidth}}


\def\fgl@inside@rbb{\rbsetboldmode}
\def\fgl@inside@rbr{\rbresetmode}
\def\fgl@inside@rbn{\rbsetnormalmode}
\def\fgl@inside@rbi{\rbsetitalicmode}
\def\fgl@inside@fa{App}
\def\fgl@inside@bta{\ensuremath{\beta}-\@fragolivarreduction}
\def\fgl@inside@alp{\ensuremath{\alpha}-\@fragolivarconversion}
\def\fgl@inside@abs{Abs}
\def\fgl@inside@mod{Mod}
\def\fgl@inside@var{Var}
\def\fgl@inside@con{Con}
\def\fgl@inside@id{Id}
\def\fgl@inside@lex{Lex}
\def\fgl@inside@lc{\ensuremath{\lambda}-\@fragolivarconversion}
\def\fgl@inside@nc{\@fragolivarnotationconvention}

%% Derivation

\DeclareDocumentCommand{\fgl@inside@ds}{O{} m O{}}{\@fglsrbmodeselect\stepcounter{@fglscalcitemcounter}\item[\@ifempty{#3}{\ensuremath{\stackrel{\color{fgldeivationrowcountcolor}\the@fglscalcitemcounter\kern-0.5pt.\color{black}}{=}\ }}{#3}]\edef\@currentlabel{\the@fglscalcitemcounter}\label{sem:deri:\@fglsinterladeriref:ds:\the@fglscalcitemcounter} #2 \@snote{#1}\rbr}%
\DeclareDocumentCommand{\fgl@inside@dS}{O{} m O{}}{\@fglsrbmodeselect\stepcounter{@fglscalcitemcounter}\item[#3]\edef\@currentlabel{\the@fglscalcitemcounter}\label{sem:deri:\@fglsinterladeriref:ds:\the@fglscalcitemcounter} #2 \@snote{#1}\rbr}%

\DeclareDocumentEnvironment{semderivation}{O{\FGL@situation} O{} O{n}}{%
	\def\@fglsinterladeriref{\@ifempty{#2}{\the@fglsderivationcounter}{#2}}%
	\setcounter{@fglscalcitemcounter}{0}%
	\@ifempty{\fglsisinderivation}{\stepcounter{@fglsderivationcounter}}{}%
	\let\@snote\@fglsundefined%
	\def\@snote##1{\strut\hfill \raisebox{.22ex}{\tiny ##1}}%
	\let\rbb\fgl@inside@rbb%
	\let\rbr\fgl@inside@rbr%
	\let\rbn\fgl@inside@rbn%
	\let\rbi\fgl@inside@rbi%
	\let\fa\fgl@inside@fa%
	\let\bta\fgl@inside@bta%
	\let\alp\fgl@inside@alp%
	\let\abs\fgl@inside@abs%
	\let\mod\fgl@inside@mod%
	\let\var\fgl@inside@var%
	\let\con\fgl@inside@con%
	\let\id\fgl@inside@id%
	\let\lex\fgl@inside@lex%
	\let\lc\fgl@inside@lc%
	\let\nc\fgl@inside@nc%
	\def\@fglsrbmodeselect{\IfStrEq{#3}{i}{\rbi}{}\IfStrEq{#3}{b}{\rbb}{}}%
	\def\cdr{sem:deri:\@ifempty{#2}{\the@fglsderivationcounter}{#2}}%
	\let\ds\fgl@inside@ds%
	\let\dS\fgl@inside@dS%
	\let\@fglsopenedfglsderi\@fglsundefined%
	\ifempty{\fglsisinderivation}\begin{fgls}[#1]\fi%
	\begin{rb}%
	\@ifempty{\fglsisinderivation}{\begin{itemize}[leftmargin=*,noitemsep]\edef\@currentlabel{\the@fglsderivationcounter}\label{sem:deri:\@fglsinterladeriref}}{\begin{itemize}}%
}
{\end{itemize}\end{rb}\ifempty{\fglsisinderivation}\end{fgls}\fi%
}

\DeclareDocumentEnvironment{semderivatioN}{O{\FGL@situation} O{}}{\begin{semderivation}[#1][#2][b]}{\end{semderivation}}
\def\fgl@inside@fglsisinderivation{true}
\DeclareDocumentCommand{\fgl@inside@rentry}{O{} m O{}}{\stepcounter{@fglscalcitemcounter}\item[\@ifempty{##3}{\text{\@rentrylabel}\the@fglscalcitemcounter:}{#3}]\edef\@currentlabel{\@rentrylabel\the@fglscalcitemcounter}\label{sem:deri:\@fglsinterladeriref:\@rentrylabellower:\the@fglscalcitemcounter}#2 \@snote{#1}}
\DeclareDocumentEnvironment{semcalc}{O{\FGL@situation} O{}}{%
	\let\fglsisinderivation\fgl@inside@fglsisinderivation%
	\def\@fglscurrentdersit{#1}%
	\def\@fglsrefname{#2}%
	\def\@fglsinterladeriref{\@ifempty{\@fglsrefname}{\the@fglsderivationcounter}{\@fglsrefname}}%
	\def\@rentrylabel{R}%
	\def\@rentrylabellower{r}%
	\stepcounter{@fglscalcitemcounter}%
	\stepcounter{@fglsderivationcounter}%
	\def\cdr{sem:deri:\@fglsinterladeriref}%
	\def\rr##1{\ref{\cdr:r:##1}}%
	\def\rrs##1{\ref{\cdr:rs:##1}}%
	\def\rl##1{\ref{\cdr:l:##1}}%
	\def\rla##1{\ref{\cdr:la:##1}}%
	\let\@snote\@fglsundefined%
	\let\rentrysub\@fglsundefined%
	\newcommand{\rentrysub}[2][]{\begin{itemize}\item[##1] {\footnotesize ##2}\end{itemize}}%
	\def\@snote##1{\strut\hfill \raisebox{.22ex}{\tiny ##1}}%
	\let\rentry\fgl@inside@rentry%
	\edef\@currentlabel{\the@fglsderivationcounter}\label{sem:deri:\@fglsinterladeriref}%
	\begin{fgls}[#1]%
	\begin{enumerate}[label=(\roman*), noitemsep]%
	}
{\end{enumerate}\end{fgls}%
\let\fglsisinderivation\@fglsundefined%
\let\@fglscurrentdersit\@fglsundefined%
}

\DeclareDocumentCommand{\fgl@inside@rlang}{m O{} O{} O{} O{} O{} O{} O{} O{L}}{\rentry[]{= \ifempty{#2}\else\text{L\textsubscript{#2}}\fi \ifempty{#3}\else\ $\cup$\ \text{L\textsubscript{#3}}\fi\ifempty{#4}\else\ $\cup$\ \text{L\textsubscript{#4}}\fi\ifempty{#5}\else\ $\cup$\ \text{L\textsubscript{#5}}\fi\ifempty{#6}\else\ $\cup$\ \text{L\textsubscript{#6}}\fi\ifempty{#7}\else\ $\cup$\ \text{L\textsubscript{#7}}\fi\ifempty{#8}\else\ $\cup$\ \text{L\textsubscript{#8}}\fi\ifempty{#2}\else\text{\ =\ }\fi$\{$#1$\}$}[#9]}
\newenvironment{semlang}[1][]{%
	\setcounter{@fglscalcitemcounter}{0}%
	\let\rlang\fgl@inside@rlang%
	\def\@rentrylabel{LA}%
	\def\@rentrylabellower{la}%
	\@ifempty{#1}{\item\textit{\@fragolivarlanguage}:}{\item[#1]}%
	\begin{rb}%
	\begin{itemize}%
}
{\end{itemize}\end{rb}%
}

\newenvironment{semtreesem}[1][]{%
	\setcounter{@fglscalcitemcounter}{0}%
	\@ifempty{#1}{\item\textit{\@fragolivartreesem}:}{\item[#1]}%
}
{}

\newenvironment{semtreesyn}[1][]{%
	\setcounter{@fglscalcitemcounter}{0}%
	\@ifempty{#1}{\item\textit{\@fragolivartreesyn}:}{\item[#1]}%
}
{}

\newenvironment{semtree}[1][]{%
	\setcounter{@fglscalcitemcounter}{0}%
	\@ifempty{#1}{\item\textit{\@fragolivartree}:}{\item[#1]}%
}
{}

\DeclareDocumentEnvironment{semderi}{O{}}{%
	\@ifempty{#1}{\item\textit{\@fragolivarderivation}:}{\item[#1]}%
	\begin{semderivation}[\@fglscurrentdersit][\@fglsrefname]%
}
{\end{semderivation}%
}

%%%% General
\DeclareDocumentCommand{\fgl@inside@slde}{m m O{} O{\cs} O{}}{\rentry[#3]{\e[#4]{#1} = #2}[#5]}%
\DeclareDocumentCommand{\fgl@inside@sldei}{m O{} O{\cs} O{}}{\rentry[#2]{\e[#3]{#1} = #1}[#4]}%
\DeclareDocumentCommand{\fgl@inside@sldex}{m O{} O{} O{x} O{\cs} O{\@typee} O{}}{\rentry[#3]{\e[#5]{#1} = \l{#4}[#6]\@ifempty{#2}{\n{\j{#4} #1 in #5}}{\n{#2}}}[#7]}%
\DeclareDocumentCommand{\fgl@inside@sldey}{m O{} O{} O{x} O{y} O{\cs} O{\@typee} O{\@typee} O{}}{\rentry[#3]{\sde[#6]{#1} = \lambh{#5}[#8]\lambh{#4}[#7]\@ifempty{#2}{\bool{\j{#4} #1 \j{#5} in #6}}{\bool{#2}}}[#9]}%
\DeclareDocumentCommand{\fgl@inside@sldez}{m O{} O{} O{x} O{y} O{z} O{\cs} O{\@typee} O{\@typee}}{\rentry[#3]{\sde[#7]{#1} = \lambh{#6}[#9]\lambh{#5}[#9]\lambh{#4}[#8]\@ifempty{#2}{\bool{\j{#4} #1 \j{#5} \j{#6} in #7}}{\bool{#2}}}}%
%%%% Proper Names        
\DeclareDocumentCommand{\fgl@inside@sldenn}{m O{} O{\cs} O{}}{\rentry[#2]{\sde[#3]{#1} = #1}[#4]}%
\DeclareDocumentCommand{\fgl@inside@sldennpeter}{O{} O{\cs} O{}}{\rentry[#1]{\sde[#2]{Peter} = Peter}[#3]}%
\DeclareDocumentCommand{\fgl@inside@sldennmaria}{O{} O{\cs} O{}}{\rentry[#1]{\sde[#2]{Maria} = Maria}[#3]}%
\DeclareDocumentCommand{\fgl@inside@sldennanna}{O{} O{\cs} O{}}{\rentry[#1]{\sde[#2]{Anna} = Anna}[#3]}%
\DeclareDocumentCommand{\fgl@inside@sldennalina}{O{} O{\cs} O{}}{\rentry[#1]{\sde[#2]{Alina} = Alina}[#3]}%
\DeclareDocumentCommand{\fgl@inside@sldennmarta}{O{} O{\cs} O{}}{\rentry[#1]{\sde[#2]{Marta} = Marta}[#3]}%
\DeclareDocumentCommand{\fgl@inside@sldennpaul}{O{} O{\cs} O{}}{\rentry[#1]{\sde[#2]{Paul} = Paul}[#3]}%
\DeclareDocumentCommand{\fgl@inside@sldenneike}{O{} O{\cs} O{}}{\rentry[#1]{\sde[#2]{Eike} = Eike}[#3]}%
\DeclareDocumentCommand{\fgl@inside@sldennida}{O{} O{\cs} O{}}{\rentry[#1]{\sde[#2]{Ida} = Ida}[#3]}%
\DeclareDocumentCommand{\fgl@inside@sldenolaf}{O{} O{\cs} O{}}{\rentry[#1]{\sde[#2]{Olaf} = Olaf}[#3]}%
\DeclareDocumentCommand{\fgl@inside@sldenmichael}{O{} O{\cs} O{}}{\rentry[#1]{\sde[#2]{Michael} = Michael}[#3]}%
%%%% Nominals            
\DeclareDocumentCommand{\fgl@inside@fglssldenbuilder}{m m m m}{\ensuremath{#1} \@fragolivarlexbool[#2]{#3} #4}%
\DeclareDocumentCommand{\fgl@inside@slden}{m O{\@fragolivarlarticle} O{} O{x} O{\cs} O{\@typee} O{}}{\sldex{#1}[\@fglssldenbuilder{#4}{\@ifempty{#2}{\@fragolivarlarticle}{#2}}{#1}{#5}][#3][#4][#5][#6][#7]}%
\DeclareDocumentCommand{\fgl@inside@sldenman}{O{} O{x} O{\cs} O{\@typee} O{}}{\slden{\@fragolivarlexman}[\@fragolivarlarticle][#1][#2][#3][#4][#5]}%
\DeclareDocumentCommand{\fgl@inside@sldenwoman}{O{} O{x} O{\cs} O{\@typee} O{}}{\slden{\@fragolivarlexwoman}[\@fragolivarlarticlegermanswitch][#1][#2][#3][#4][#5]}%
\DeclareDocumentCommand{\fgl@inside@sldenchild}{O{} O{x} O{\cs} O{\@typee} O{}}{\slden{\@fragolivarlexchild}[\@fragolivarlarticle][#1][#2][#3][#4][#5]}%
\DeclareDocumentCommand{\fgl@inside@sldendog}{O{} O{x} O{\cs} O{\@typee} O{}}{\slden{\@fragolivarlexdog}[\@fragolivarlarticle][#1][#2][#3][#4][#5]}%
\DeclareDocumentCommand{\fgl@inside@sldencat}{O{} O{x} O{\cs} O{\@typee} O{}}{\slden{\@fragolivarlexcat}[\@fragolivarlarticle][#1][#2][#3][#4][#5]}%
\DeclareDocumentCommand{\fgl@inside@sldendonkey}{O{} O{x} O{\cs} O{\@typee} O{}}{\slden{\@fragolivarlexdonkey}[\@fragolivarlarticle][#1][#2][#3][#4][#5]}%
\DeclareDocumentCommand{\fgl@inside@sldenhouse}{O{} O{x} O{\cs} O{\@typee} O{}}{\slden{\@fragolivarlexhouse}[\@fragolivarlarticle][#1][#2][#3][#4][#5]}%
\DeclareDocumentCommand{\fgl@inside@sldenanimal}{O{} O{x} O{\cs} O{\@typee} O{}}{\slden{\@fragolivarlexanimal}[\@fragolivarlarticlegermanswitchn][#1][#2][#3][#4][#5]}%
%%%% General
\DeclareDocumentCommand{\fgl@inside@sldi}{m m O{} O{}}{\rentry[#3]{\i{#1} = #2}[#4]}%
\DeclareDocumentCommand{\fgl@inside@sldii}{m O{} O{}}{\rentry[#2]{\i{#1} = #1}[#3]}%
\DeclareDocumentCommand{\fgl@inside@sldix}{m O{} O{} O{x} O{\sblank} O{\@typee} O{\@types} O{}}{\rentry[#3]{\i{#1} = \l{#5}[#7]\l{#4}[#6]\@ifempty{#2}{\n{\j{#4} #1 in #5}}{\n{#2}}}[#8]}%
\DeclareDocumentCommand{\fgl@inside@sldiy}{m O{} O{} O{x} O{y} O{\sblank} O{\@typee} O{\@typee} O{\@types}}{\rentry[#3]{\i{#1} = \l{#6}[#9]\l{#5}[#8]\l{#4}[#7]\@ifempty{#2}{\n{\j{#4} #1 \j{#5} in #6}}{\n{#2}}}}%
\DeclareDocumentCommand{\fgl@inside@sldiz}{m O{} O{} O{x} O{y} O{z} O{\sblank} O{\@typee} O{\@types}}{\rentry[#3]{\i{#1} = \l{#7}[#9]\l{#6}[#8]\l{#5}[#8]\l{#4}[#8]\@ifempty{#2}{\n{\j{#4} #1 \j{#5} \j{#6} in #7}}{\n{#2}}}}%
%%%% Proper Names
\DeclareDocumentCommand{\fgl@inside@sldinn}{m O{} O{\sblank} O{\@types} O{}}{\rentry[#2]{\sdi{#1} = \lambh{#3}[#4]#1}[#5]}%
%%% Translation
\DeclareDocumentCommand{\fgl@inside@slit}{m m O{} O{}}{\rentry[#3]{\sit{#1} = #2}[#4]}%
%%%% General
\DeclareDocumentCommand{\fgl@inside@slitnn}{m O{} O{}}{\slit{#1}{\obl{\lowercase{\StrMid{#1}{1}{1}}}}[#2][#3]}%
\DeclareDocumentCommand{\fgl@inside@slitnnpeter}{O{} O{}}{\slitnn{Peter}[#1][#2]}%
\DeclareDocumentCommand{\fgl@inside@slitnnmaria}{O{} O{}}{\slitnn{Maria}[#1][#2]}%
\DeclareDocumentCommand{\fgl@inside@slitnnmarta}{O{} O{}}{\slitnn{Marta}[#1][#2]}%
\DeclareDocumentCommand{\fgl@inside@slitnnalina}{O{} O{}}{\slitnn{Alina}[#1][#2]}%
\DeclareDocumentCommand{\fgl@inside@slitnnanna}{O{} O{}}{\slitnn{Anna}[#1][#2]}%
\DeclareDocumentCommand{\fgl@inside@slitnnpaul}{O{} O{}}{\slitnn{Paul}[#1][#2]}%
\DeclareDocumentCommand{\fgl@inside@slitnneike}{O{} O{}}{\slitnn{Eike}[#1][#2]}%
\DeclareDocumentCommand{\fgl@inside@slitnnida}{O{} O{}}{\slitnn{Ida}[#1][#2]}%
\DeclareDocumentCommand{\fgl@inside@slitnnolaf}{O{} O{}}{\slitnn{Olaf}[#1][#2]}%
\DeclareDocumentCommand{\fgl@inside@slitnnmichael}{O{} O{}}{\slitnn{Michael}[#1][#2]}%
\DeclareDocumentCommand{\fgl@inside@slitf}{m O{\obli{i}} O{} O{}}{\slit{#1}{\sic[#2]{\uppercase{\StrMid{#1}{1}{1}}}}[#3][#4]}%
%%%% Logic
\DeclareDocumentCommand{\fgl@inside@slitland}{O{} O{}}{\slit{\@fragolivarand}{\jC}[#1][#2]}%
\DeclareDocumentCommand{\fgl@inside@slitlor}{O{} O{q} O{p} O{\@typet} O{\@typet} O{}}{\slit{\@fragolivaror}{\l{#2}[#4]\l{#3}[#5]\jN\R{\jn\ensuremath{#3}\jC\jN\ensuremath{#2}}}[#1][#6]}%
%%%% Quantifier
\DeclareDocumentCommand{\fgl@inside@slitlmost}{O{} O{}}{\rentry[#1]{\sit{\@fragolivarmost} = \obl{MOST}}[#2]}%
\DeclareDocumentCommand{\fgl@inside@slitlno}{O{} O{Q} O{P} O{x} O{\@typeet} O{\@typeet} O{\@typee} O{}}{\rentry[#1]{\t{\@fragolivarno} = \L{#2}[#5]\o{(}\L{#3}[#6]\lambheN[#4][#7]\R{\sanD{\v{#2}\a{#4}}{\v{#3}\a{#4}}}\o{)}}[#8]}%
\DeclareDocumentCommand{\fgl@inside@slitlevery}{O{} O{Q} O{P} O{x} O{\@typeet} O{\@typeet} O{\@typee} O{}}{\rentry[#1]{\t{\@fragolivarevery} = \L{#2}[#5]\obl{(}\L{#3}[#6]\lambheN[#4][#7]\R{\sanD{\v{#2}\a{#4}}{\sneg\v{#3}\a{#4}}}\o{)}}[#8]}%
\DeclareDocumentCommand{\fgl@inside@slitloneindef}{O{} O{Q} O{P} O{x}  O{\@typeet} O{\@typeet} O{\@typee} O{}}{\rentry[#1]{\t{\@fragolivaroneindef} = \L{#2}[#5]\o{(}\L{#3}[#6]\lambhE[#4][#7]\R{\sanD{\v{#2}\a{#4}}{\v{#3}\a{#4}}}\o{)}}[#8]}%
\DeclareDocumentCommand{\fgl@inside@slitlonenum} {O{} O{Q} O{P} O{x} O{y} O{\@typeet} O{\@typeet} O{\@typee} O{\@typee}} {\rentry[#1]{ \t{\@fragolivaronenum} = \L{#2}[#6]\obl{(}\L{#3}[#7]\lambhE[#4][#8]\R{\sanD{ \sanD{\v{#2}\a{#4}}{\v{#3}\a{#4}}}{\lambheN[#5][#9]\R{\sanD{\sanD{\sneg\a{#4 = #5} }{\v{#2}\a{#5}}}{\v{#3}\a{#5}}}}}\obl{)}}}%
\DeclareDocumentCommand{\fgl@inside@slitldefarticle}{O{} O{Q} O{P} O{x} O{y} O{\@typeet} O{\@typeet} O{\@typee} O{\@typee}}{\rentry[#1]{\t{\@fragolivardefarticle} = \L{#2}[#6]\o{(}\L{#3}[#7]\lambhE[#4][#8]\R{\sanD{\v{#2}\a{#4}}{\lambheN[#5][#9]\sanD{\R{\sanD{\sneg\a{#4 = #5}}{\v{#2}\a{#5}}}}{\v{#3}\a{#4}}}}\o{)}}}%
%%%% Attitude
\DeclareDocumentCommand{\fgl@inside@slitAttitudeBuilder}{m m O{p} O{x} O{j} O{i} O{\@typest} O{\@typee} O{\@types}}{\sit{#1} = \lambH{#3}[#7]\obl{(}\lambH{#4}[#8]\lambhA[#5][#9]\R{\simP{\o{#2}\a{#4}\a{#6}\a{#5}}{\c{\obli{#3}}}}\obl{)}}%
\DeclareDocumentCommand{\fgl@inside@slitadox}{O{} O{p} O{x} O{j} O{i} O{\@typest} O{\@typee} O{\@types} O{}}{\rentry[#1]{\slitAttitudeBuilder{\@fragolivarlexattdox}{DOX}[#2][#3][#4][#5][#6][#7][#8]}[#9]}%
\DeclareDocumentCommand{\fgl@inside@slitaepi}{O{} O{p} O{x} O{j} O{i} O{\@typest} O{\@typee} O{\@types} O{}}{\rentry[#1]{\slitAttitudeBuilder{\@fragolivarlexattepi}{EPI}[#2][#3][#4][#5][#6][#7][#8]}[#9]}%
\DeclareDocumentCommand{\fgl@inside@slitabou}{O{} O{p} O{x} O{j} O{i} O{\@typest} O{\@typee} O{\@types} O{}}{\rentry[#1]{\slitAttitudeBuilder{\@fragolivarlexattbou}{BOU}[#2][#3][#4][#5][#6][#7][#8]}[#9]}%
%%%% General
\DeclareDocumentCommand{\fgl@inside@slid}{m m O{} O{} O{}}{\rentry[#3]{\sid[#4]{#1} = #2}[#5]}%
%%%% Proper Names
\DeclareDocumentCommand{\fgl@inside@slidnn}{m O{} O{} O{}}{\slid{\obl{\lowercase{\StrMid{#1}{1}{1}}}}{#1}[#2][#3][#4]}%
\DeclareDocumentCommand{\fgl@inside@slidnnpeter}{O{} O{} O{}}{\slidnn{Peter}[#1][#2][#3]}%
\DeclareDocumentCommand{\fgl@inside@slidnnmaria}{O{} O{} O{}}{\slidnn{Maria}[#1][#2][#3]}%
\DeclareDocumentCommand{\fgl@inside@slidnnmarta}{O{} O{} O{}}{\slidnn{Marta}[#1][#2][#3]}%
\DeclareDocumentCommand{\fgl@inside@slidnnalina}{O{} O{} O{}}{\slidnn{Alina}[#1][#2][#3]}%
\DeclareDocumentCommand{\fgl@inside@slidnnanna}{O{} O{} O{}}{\slidnn{Anna}[#1][#2][#3]}%
\DeclareDocumentCommand{\fgl@inside@slidnnpaul}{O{} O{} O{}}{\slidnn{Paul}[#1][#2][#3]}%
\DeclareDocumentCommand{\fgl@inside@slidnneike}{O{} O{} O{}}{\slidnn{Eike}[#1][#2][#3]}%
\DeclareDocumentCommand{\fgl@inside@slidnnida}{O{} O{} O{}}{\slidnn{Ida}[#1][#2][#3]}%
\DeclareDocumentCommand{\fgl@inside@slidnnolaf}{O{} O{} O{}}{\slidnn{Olaf}[#1][#2][#3]}%
\DeclareDocumentCommand{\fgl@inside@slidnnmichael}{O{} O{} O{}}{\slidnn{Michael}[#1][#2][#3]}%
%%%% Logic
\DeclareDocumentCommand{\fgl@inside@slidland}{O{} O{v} O{u} O{} O{\@typet} O{\@typet} O{}}{\slid{\ensuremath{\land}}{\lambh{#2}[#5]\lambh{#3}[#6]\r{\meli{#2} \ensuremath{\cdot} \meli{#3}}}[#1][#4][#7]}%
\DeclareDocumentCommand{\fgl@inside@slidlequal}{O{} O{y} O{x} O{} O{\@typet} O{\@typet} O{}}{\slid{=}{\lambh{#2}[#5]\lambh{#3}[#6]\n{\meli{#2} = \meli{#3}}}[#1][#4][#7]}%
\DeclareDocumentCommand{\fgl@inside@slidlneg}{O{} O{u} O{} O{\@typet} O{}}{\slid{\ensuremath{\neg}}{\lambh{#2}[#4]\r{1 - \meli{#2}}}[#1][#3][#5]}%
\DeclareDocumentCommand{\fgl@inside@slidlexists}{O{} O{P} O{} O{\@typeet} O{}}{\slid{\ensuremath{\exists}}{\lambh{#2}[#4]\n{\ensuremath{\downarrow}\meli{#2} \ensuremath{\neq} \ensuremath{\emptyset}}}[#1][#3][#5]}%
%%%% Attitude
\DeclareDocumentCommand{\fgl@inside@slidAttitudeBuilder}{m m O{x} O{\sz} O{\so} O{\@typee} O{\@types} O{\@types} O{}}{\slid{#1}{\lambh{#3}[#6]\lambh{#4}[#7]\lambh{#5}[#8]\n{#5 \@fragolivarlis\ \@fragolivarlarticlegermanswitch\ #2 alternative\  \@fragolivarlof\ \meli{#3} in #4}}[#9]}%
\DeclareDocumentCommand{\fgl@inside@slidadox}{O{x} O{\sz} O{\so} O{\@typee} O{\@types} O{\@types} O{}}{\slidAttitudeBuilder{DOX}{\@fragolivarlexattdoxterm}[#1][#2][#3][#4][#5][#6][#7]}%
\DeclareDocumentCommand{\fgl@inside@slidaepi}{O{x} O{\sz} O{\so} O{\@typee} O{\@types} O{\@types} O{}}{\slidAttitudeBuilder{EPI}{\@fragolivarlexattepiterm}[#1][#2][#3][#4][#5][#6][#7]}%
\DeclareDocumentCommand{\fgl@inside@slidabou}{O{x} O{\sz} O{\so} O{\@typee} O{\@types} O{\@types} O{}}{\slidAttitudeBuilder{BOU}{\@fragolivarlexattbouterm}[#1][#2][#3][#4][#5][#6][#7]}%

\newenvironment{semlex}[1][]{%
	\setcounter{@fglscalcitemcounter}{0}%
	\def\@rentrylabel{L}%
	\def\@rentrylabellower{l}%
	% Lexicon entries
	%% Direct
	%%% Extension
	%%%% General
	\let\slde\fgl@inside@slde
	\let\sldei\fgl@inside@sldei
	\let\sldex\fgl@inside@sldex
	\let\sldey\fgl@inside@sldey
	\let\sldez\fgl@inside@sldez
	%%%% Proper Names
	\let\sldenn\fgl@inside@sldenn
	\let\sldennpeter\fgl@inside@sldennpeter
	\let\sldennmaria\fgl@inside@sldennmaria
	\let\sldennanna\fgl@inside@sldennanna
	\let\sldennalina\fgl@inside@sldennalina
	\let\sldennmarta\fgl@inside@sldennmarta
	\let\sldennpaul\fgl@inside@sldennpaul
	\let\sldenneike\fgl@inside@sldenneike
	\let\sldennida\fgl@inside@sldennida
	\let\sldenolaf\fgl@inside@sldenolaf
	\let\sldenmichael\fgl@inside@sldenmichael
	%%%% Nominals
	\let\@fglssldenbuilder\fgl@inside@fglssldenbuilder
	\let\slden\fgl@inside@slden
	\let\sldenman\fgl@inside@sldenman
	\let\sldenwoman\fgl@inside@sldenwoman
	\let\sldenchild\fgl@inside@sldenchild
	\let\sldendog\fgl@inside@sldendog
	\let\sldencat\fgl@inside@sldencat
	\let\sldendonkey\fgl@inside@sldendonkey
	\let\sldenhouse\fgl@inside@sldenhouse
	\let\sldenanimal\fgl@inside@sldenanimal
	%%% Intension
	%%%% General
	\let\sldi\fgl@inside@sldi%
	\let\sldii\fgl@inside@sldii%
	\let\sldix\fgl@inside@sldix%
	\let\sldiy\fgl@inside@sldiy%
	\let\sldiz\fgl@inside@sldiz%
	%%%% Proper Names
	\let\sldinn\fgl@inside@sldinn%
	%% Indirect
	%%% Translation
	\let\slit\fgl@inside@slit%
	%%%% General
	\let\slitnn\fgl@inside@slitnn%
	\let\slitnnpeter\fgl@inside@slitnnpeter%
	\let\slitnnmaria\fgl@inside@slitnnmaria%
	\let\slitnnmarta\fgl@inside@slitnnmarta%
	\let\slitnnalina\fgl@inside@slitnnalina%
	\let\slitnnanna\fgl@inside@slitnnanna%
	\let\slitnnpaul\fgl@inside@slitnnpaul%
	\let\slitnneike\fgl@inside@slitnneike%
	\let\slitnnida\fgl@inside@slitnnida%
	\let\slitnnolaf\fgl@inside@slitnnolaf%
	\let\slitnnmichael\fgl@inside@slitnnmichael%
	\let\slitf\fgl@inside@slitf%
	%%%% Logic
	\let\slitland\fgl@inside@slitland%
	\let\slitlor\fgl@inside@slitlor%
	%%%% Quantifier
	\let\slitlmost\fgl@inside@slitlmost%
	\let\slitlno\fgl@inside@slitlno%
	\let\slitlevery\fgl@inside@slitlevery%
	\let\slitloneindef\fgl@inside@slitloneindef%
	\let\slitlonenum\fgl@inside@slitlonenum%
	\let\slitldefarticle\fgl@inside@slitldefarticle%
	%%%% Attitude
	\let\slitAttitudeBuilder\fgl@inside@slitAttitudeBuilder%
	\let\slitadox\fgl@inside@slitadox%
	\let\slitaepi\fgl@inside@slitaepi%
	\let\slitabou\fgl@inside@slitabou%
	%%% Denotation
	%%%% General
	\let\slid\fgl@inside@slid%
	%%%% Proper Names
	\let\slidnn\fgl@inside@slidnn%
	\let\slidnnpeter\fgl@inside@slidnnpeter%
	\let\slidnnmaria\fgl@inside@slidnnmaria%
	\let\slidnnmarta\fgl@inside@slidnnmarta%
	\let\slidnnalina\fgl@inside@slidnnalina%
	\let\slidnnanna\fgl@inside@slidnnanna%
	\let\slidnnpaul\fgl@inside@slidnnpaul%
	\let\slidnneike\fgl@inside@slidnneike%
	\let\slidnnida\fgl@inside@slidnnida%
	\let\slidnnolaf\fgl@inside@slidnnolaf%
	\let\slidnnmichael\fgl@inside@slidnnmichael%
	%%%% Logic
	\let\slidland\fgl@inside@slidland%
	\let\slidlequal\fgl@inside@slidlequal%
	\let\slidlneg\fgl@inside@slidlneg%
	\let\slidlexists\fgl@inside@slidlexists%
	%%%% Attitude
	\let\slidAttitudeBuilder\fgl@inside@slidAttitudeBuilder%
	\let\slidadox\fgl@inside@slidadox%
	\let\slidaepi\fgl@inside@slidaepi%
	\let\slidabou\fgl@inside@slidabou%
	\@ifempty{#1}{\item\textit{\@fragolivarlexicon}:}{\item[#1]}%
	\begin{itemize}%
	}
{\end{itemize}%
}


\DeclareDocumentCommand{\fgl@inside@rsrgarrow}{O{} O{\ensuremath{x}} O{\ensuremath{f}} O{}}{\rentry[#1]{\srgarrow[#2][#3]}[#4]}%

\newenvironment{semrulesyn}[1][]{
	\setcounter{@fglscalcitemcounter}{0}%
	\def\@rentrylabel{r}%
	\def\@rentrylabellower{rs}%
	% Rules
	%% General
	\let\rsrgarrow\fgl@inside@rsrgarrow
	\@ifempty{#1}{\item\textit{\@fragolivarrulessyn}:}{\item[#1]}%
	\begin{itemize}%
	}
{\end{itemize}%
}

%% Direkt
\DeclareDocumentCommand{\fgl@inside@rsrdi}{m m O{} O{}}{\rentry[#3]{\sdi{#1}\ = #2}[#4]}%
\DeclareDocumentCommand{\fgl@inside@rsrde}{m m O{} O{\fgl@internalsrdesituation} O{}}{\rentry[#3]{\e[#4]{#1} = #2}[#5]}%
%%% Logic
\DeclareDocumentCommand{\fgl@inside@rsrdiconva}{O{} O{s} O{\@types} O{}}{\rsrdi{\v{A}}{\lambh{#2}[#3]\e[#2]{\v{A}}}[#1][#4]}%
\DeclareDocumentCommand{\fgl@inside@rsrdiconvb}{O{} O{s} O{\@types} O{}}{\rentry[#1]{\sdi{\v{A}}\obl{(}\textit{#2}\obl{)} = \e[\meli{#2}]{\v{A}}}[#4]}%
\DeclareDocumentCommand{\fgl@inside@rsrdeattitude}{O{} O{\fgl@internalsrdesituation} O{}}{\rsrde{\v{P}}{\e[#2]{\v{V}}\a{\sdi{S}}}[#1][#2][#3]}%
%%% Common Zimmerman
\DeclareDocumentCommand{\fgl@inside@rsrdesbjpred}{O{} O{\fgl@internalsrdesituation} O{\text{\ensuremath{S}}} O{\text{\ensuremath{NN}}} O{\text{\ensuremath{P}}} O{}}{\rentry[#1]{\srdesbjpred[#2][#3][#4][#5]}[#6]}%
\DeclareDocumentCommand{\fgl@inside@rsrdesbjquant}{O{} O{\fgl@internalsrdesituation} O{\text{\ensuremath{S}}} O{\text{\ensuremath{P}}} O{\text{\ensuremath{QN}}} O{}}{\rsrdesbjpred[#1][#2][#3][#4][#5][#6]}%
\DeclareDocumentCommand{\fgl@inside@rsrdeobjpred}{O{} O{\fgl@internalsrdesituation} O{\text{\ensuremath{P}}} O{\text{\ensuremath{NN}}} O{\text{\ensuremath{V}}} O{}}{\rsrdesbjpred[#1][#2][#3][#4][#5][#6]}%
\DeclareDocumentCommand{\fgl@inside@rsrdeobjquant}{O{} O{x} O{y} O{\fgl@internalsrdesituation} O{\text{\ensuremath{P}}} O{\text{\ensuremath{V}}} O{\text{\ensuremath{QN}}} O{\@typee} O{}}{\rentry[#1]{\srdeobjquant[#2][#3][#4][#5][#6][#7][#8][#8]}[#9]}%
\DeclareDocumentCommand{\fgl@inside@rsrdequant}{O{} O{\fgl@internalsrdesituation} O{\text{\ensuremath{QN}}} O{\text{\ensuremath{N}}} O{\text{\ensuremath{D}}} O{}}{\rsrdesbjpred[#1][#2][#3][#4][#5][#6]}%
%%% Quantorenanhebung
\DeclareDocumentCommand{\fgl@inside@rsrdeqrsemvar}{O{} O{\phi} O{\ensuremath{x}} O{\fgl@internalsrdesituation} O{\textit{g}} O{}}{\rentry[#1]{\srdeqrsemvar[#2][#3][#4][#5]}[#6]}%
\DeclareDocumentCommand{\fgl@inside@rsrdeqrabs}{O{} O{\phi} O{\textit{x}} O{\fgl@internalsrdesituation} O{\textit{g}} O{\textit{f}} O{\ensuremath{\delta}} O{}}{\rentry[#1]{\srdeqrabs[#2][#3][#4][#5][#6][#7]}[#8]}%
\DeclareDocumentCommand{\fgl@inside@rsrdeqrlex}{O{} O{\ensuremath{\alpha}} O{\ensuremath{\beta}} O{\fgl@internalsrdesituation} O{\text{\textit{g}}} O{} }{\rentry[#1]{\srdeqrlex[#2][#3][#4][#5]}[#6]}%
\DeclareDocumentCommand{\fgl@inside@rsrdeqrfa}{O{} O{\ensuremath{\alpha}} O{\ensuremath{\beta}} O{\ensuremath{\gamma}} O{\fgl@internalsrdesituation} O{\text{\textit{g}}} O{}}{\rentry[#1]{\srdeqrfa[#2][#3][#4][#5][#6]}[#7]}%
\DeclareDocumentCommand{\fgl@inside@rsrdeqrtree}{O{} O{x} O{\ensuremath{\psi}} O{\ensuremath{\phi}} O{\ensuremath{\delta}} O{\fgl@internalsrdesituation} O{\text{\textit{g}}} O{\@typee} O{}}{\rentry[#1]{\srdeqrtree[#2][#3][#4][#5][#6][#7][#8]}[#9]}%
%%% Translation
\DeclareDocumentCommand{\fgl@inside@rsrit}{m m O{} O{}}{\rentry[#3]{\t{#1} = #2}[#4]}%
\DeclareDocumentCommand{\fgl@inside@rsriti}{m m O{} O{}}{\rentry[#3]{\ti{#1} = #2}[#4]}%
\DeclareDocumentCommand{\fgl@inside@rsritibasic}{m m m O{} O{}}{\rentry[#4]{\ti{#1} = \ti{#2}(\ti{#3})}[#5]}%
\DeclareDocumentCommand{\fgl@inside@rsritcoordination}{O{} O{}}{\rsriti{S K \^{S}}{\ti{K}(\ti{\^{S}})(\ti{S})}[#1][#2]}%
\DeclareDocumentCommand{\fgl@inside@rsritpredication}{O{} O{}}{\rsritibasic{S}{P}{NN}[#1][#2]}%
\DeclareDocumentCommand{\fgl@inside@rsritnamedirectobject}{O{} O{}}{\rsritibasic{P}{V}{NN}[#1][#2]}%
\DeclareDocumentCommand{\fgl@inside@rsritquantification}{O{} O{}}{\rsritibasic{S}{Q}{P}[#1][#2]}%
\DeclareDocumentCommand{\fgl@inside@rsritquantificational}{O{} O{}}{\rsritibasic{Q}{D}{N}[#1][#2]}%
\DeclareDocumentCommand{\fgl@inside@rsritquantificationasobj}{O{} O{x} O{y} O{\@typeet} O{\@typeet} O{}}{\rsriti{P}{\L{#2}[#4]\ti{Q}\o{(}\L{#3}[#5]\ti{V}\a{\v{#3}}\a{\v{#2}}\o{)}}[#1][#6]}%
\DeclareDocumentCommand{\fgl@inside@rsritattitude}{O{} O{i} O{\@types} O{}}{\rsriti{P}{\ti{V}\o{(}\L{#2}[#3]\ti{S}\o{)}}[#1][#4]}%
\DeclareDocumentCommand{\fgl@inside@rsritraisedsubj}{O{} O{i} O{\@types} O{}}{\rsriti{S}{\ti{VP}(\L{#2}[#3]\ti{Q})}[#1][#4]}%
\DeclareDocumentCommand{\fgl@inside@rsritcontrolverbs}{O{} O{x} O{i} O{\@typee} O{\@types} O{}}{\rsriti{VP}{\L{#2}[#4]\ti{V}\o{(}\L{#3}[#5]\ti{P}\a{\v{#2}}\o{)}\a{\v{#2}}}[#1][#6]}%
%%% Denotation
\DeclareDocumentCommand{\fgl@inside@rsrid}{m m O{} O{g} O{}}{\rentry[#3]{\sid[#4]{#1} = #2}[#5]}%
\DeclareDocumentCommand{\fgl@inside@rsridinterpretvar}{O{} O{g} O{x} O{}}{\rsrid{\v{#3}}{\j{#2}\a{#3}}[#1][#2][#4]}%
\DeclareDocumentCommand{\fgl@inside@rsridapp}{O{} O{g} O{\ensuremath{\bm{\alpha}}} O{\ensuremath{\bm{\beta}}} O{}}{\rsrid{#3\a{#4}}{\d[#2]{#3}\a{\d[#2]{#4}}}[#1][#2][#5]}%
\DeclareDocumentCommand{\fgl@inside@rsridabs}{O{} O{g} O{\ensuremath{\bm{\alpha}}} O{x} O{u} O{}}{\rsrid{\L{#4}#3}{\l{#5}\sidR{#3}{#5}[#4]}[#1][#2][#6]}%

\DeclareDocumentEnvironment{semrule}{O{} O{\@srdesituation}}{%
	\setcounter{@fglscalcitemcounter}{0}%
	\def\@rentrylabellower{r}%
	\def\fgl@internalsrdesituation{#2}
	% Rules
	%% General
	\let\rsrgarrow\fgl@inside@rsrgarrow
	%% Direkt
	\let\rsrde\fgl@inside@rsrde%
	\let\rsrdi\fgl@inside@rsrdi%
	%%% Common Zimmerman
	\let\rsrdesbjpred\fgl@inside@rsrdesbjpred%
	\let\rsrdesbjquant\fgl@inside@rsrdesbjquant%
	\let\rsrdeobjpred\fgl@inside@rsrdeobjpred%
	\let\rsrdeobjquant\fgl@inside@rsrdeobjquant%
	\let\rsrdequant\fgl@inside@rsrdequant%
	%%% Logic
	\DeclareDocumentCommand{\rsrdecoordination}{O{} O{#1} O{}}{\rsrde{\v{S K \^{S}}}{\e[##2]{\v{K}}\a{\e[##2]{\^{S}}}\a{\e[##2]{S}}}[##1][##2][##3]}%
	\let\rsrdiconva\fgl@inside@rsrdiconva%
	\let\rsrdiconvb\fgl@inside@rsrdiconvb%
	\let\rsrdeattitude\fgl@inside@rsrdeattitude%
	%%% Quantorenanhebung
	\let\rsrdeqrsemvar\fgl@inside@rsrdeqrsemvar%
	\let\rsrdeqrabs\fgl@inside@rsrdeqrabs%
	\let\rsrdeqrlex\fgl@inside@rsrdeqrlex%
	\let\rsrdeqrfa\fgl@inside@rsrdeqrfa%
	\let\rsrdeqrtree\fgl@inside@rsrdeqrtree%
	%% Indirekt 
	%%% Translation
	\let\rsrit\fgl@inside@rsrit%
	\let\rsriti\fgl@inside@rsriti%
	\let\rsritibasic\fgl@inside@rsritibasic%
	\let\rsritcoordination\fgl@inside@rsritcoordination%
	\let\rsritpredication\fgl@inside@rsritpredication%
	\let\rsritnamedirectobject\fgl@inside@rsritnamedirectobject%
	\let\rsritquantification\fgl@inside@rsritquantification%
	\let\rsritquantificational\fgl@inside@rsritquantificational%
	\let\rsritquantificationasobj\fgl@inside@rsritquantificationasobj%
	\let\rsritattitude\fgl@inside@rsritattitude%
	\let\rsritraisedsubj\fgl@inside@rsritraisedsubj%
	\let\rsritcontrolverbs\fgl@inside@rsritcontrolverbs%
	%%% Denotation
	\let\rsrid\fgl@inside@rsrid%
	\let\rsridinterpretvar\fgl@inside@rsridinterpretvar%
	\let\rsridapp\fgl@inside@rsridapp%
	\let\rsridabs\fgl@inside@rsridabs%
	\@ifempty{#1}{\item\textit{\@fragolivarrules}:}{\item[#1]}%
	\begin{itemize}%
	}
{\end{itemize}%
}
\endinput
% End of file `fragoli.sty'.