The Problem
At the intersection of mathematics, computer science, and insanity, we find the $M_Q$ functor${}^1$.
$${M_Q} = {\Phi _{{s_1},{s_2}}}\left\{ {\begin{array}{*{20}{l}} {E \leftarrow {\Phi _{{c_1},{c_2}}}\left\{ { \Leftarrow \left\{ {\begin{array}{*{20}{l}} 1&{{\text{if }}{c_1} = {c_2}} \\ 0&{{\text{otherwise}}} \end{array}} \right.} \right.} \\ {N \leftarrow {\Re _0}\left[ {{\Phi _{{x_1},{x_2}}} \Leftarrow {x_1} + {x_2}} \right]} \\ {U \leftarrow {\Phi _c} \Leftarrow 60{{\left( {N\left( {\mathcal{L}\xrightarrow{s}N\left( {s\xrightarrow{\chi }E\left( {c,\chi } \right)} \right)} \right) + 1} \right)}^{ - 1}}} \\ {{I_{\text{L}}} \leftarrow {\Phi _s}\left\{ { \Leftarrow \left\{ {\begin{array}{*{20}{l}} 1&{{\text{if }}s \in \left\{ s \right\} \cap \mathcal{L}} \\ 0&{{\text{otherwise}}} \end{array}} \right.} \right.} \\ {\bar S \leftarrow {\Phi _s} \Leftarrow \left( {{2^{\left\{ {i\,|\,i \in \mathbb{N},\,i \leqslant \left| s \right|} \right\}}}\xrightarrow{X}{s^X}} \right)\backslash \left\{ {s,\varepsilon } \right\}} \\ {V \leftarrow {\Phi _s} \Leftarrow N\left( {s\xrightarrow{\chi }U\left( \chi \right)} \right)} \\ {x \leftarrow {\Phi _s} \Leftarrow {\Re _0}\left[ {{\Phi _{{x_1},{x_2}}}\left\{ { \Leftarrow \left\{ {\begin{array}{*{20}{l}} {{x_1}}&{{\text{if }}{x_1} \geqslant {x_2}} \\ {{x_2}}&{{\text{otherwise}}} \end{array}} \right.} \right.} \right]\left( {\bar S\left( s \right)\xrightarrow{{s'}}V\left( {s'} \right) I_{\rm L}\left( s' \right)} \right)} \\ {\Upsilon \leftarrow {\Phi _s} \Leftarrow \frac{{V\left( s \right) - x\left( s \right)}}{{2{I_{\text{L}}}\left( s \right) - 1}}} \\ { \Leftarrow \Upsilon \left( {{s_1}} \right) - \Upsilon \left( {{s_2}} \right)} \end{array}} \right.$$
$M_Q$ is a binary (that is, two-parameter) comparator of strings. As most computer scientists know, a comparator is a special type of functor that imposes a total ordering on a set of objects.
When applied to strings $s_1$ and $s_2$, ${M_Q}\left( {{s_1},{s_2}} \right)$ returns
- a negative value if $s_1$ should come before $s_2$ in a sorted list
- a positive value if $s_1$ should come after $s_2$ in a sorted list
- $0$ if the relative order of $s_1$ and $s_2$ is unimportant
$M_Q$ also relies on a language, $\mathcal{L}$, which is an ordered list of non-empty strings.
For our purposes, let the elements of $\mathcal{L}$ be the strings $\mathsf{a}$, $\mathsf{ae}$, $\mathsf{be}$, $\mathsf{bee}$, $\mathsf{ade}$, $\mathsf{bed}$, $\mathsf{are}$, $\mathsf{bad}$, $\mathsf{bab}$, $\mathsf{baa}$, $\mathsf{abe}$, $\mathsf{bear}$, $\mathsf{barb}$, $\mathsf{bard}$, $\mathsf{bade}$, $\mathsf{beard}$, $\mathsf{bread}$, $\mathsf{badab}$, $\mathsf{bared}$, $\mathsf{barred}$.
$M_Q$ can compare not only strings in $\mathcal{L}$, but also any strings made up of the letters $\mathsf{a}$-$\mathsf{z}$ (for example, $\mathsf{leopard}$).
The Challenge
Your task is threefold:
Describe, in plain English, the order that $M_Q$ imposes on strings. In other words, provide a description of what exactly the comparator does.
Determine which string will come last if $\mathcal{L}$ is sorted by $M_Q$.
Determine a string (not necessarily in $\mathcal{L}$) that will come before the string $\mathsf{babadook}$ in a list sorted by $M_Q$.
This problem can (and ideally should) be solved without programming. In particular, all of the variables, functions, etc. have straightforward behaviours that can be intuited and computed by hand. There should be no heavy lifting or brute forcing involved.
Are you up to the task? Can you master the comparatortionist?
Notes on Syntax
Let $\varepsilon$ be the empty string.
Let $\left| s\right|$ be the length (i.e. number of characters in) string $s$.
Strings may be treated as lists. A string is an ordered list of its characters.
Let ${\Phi _{{{\arg }_1},{{\arg }_2}, \cdots ,{{\arg }_n}}} \Leftarrow f\left( {{{\arg }_1},\,\,{{\arg }_2},\,\, \cdots ,\,\,{{\arg }_n}} \right)$ be a function returning an $n$-ary functor that returns the value of the function $f$ applied to its arguments. (This convention is used since functors may be nested or passed as arguments to other functors.)
Similarly, let $${\Phi _{{{\arg }_1},{{\arg }_2}, \cdots ,{{\arg }_n}}}\left\{ {\begin{array}{*{20}{l}} {{\text{assignment}}} \\ {{\text{assignment}}} \\ {\,\,\,\,\,\,\,\,\, \vdots } \\ {{\text{assignment}}} \\ { \Leftarrow f\left( {{{\arg }_1},\,\,{{\arg }_2},\,\, \cdots ,\,\,{{\arg }_n}} \right)} \end{array}} \right.$$ be a function returning an $n$-ary functor that evaluates assignments from top to bottom and returns the value of the function $f$ applied to its arguments.
Let ${\Re _{{\text{init}}}}\left[ f \right]$ be a function returning a unary functor accepting a list/string as its argument. Call this argument $A$. The functor returned by ${\Re _{{\text{init}}}}\left[ f \right]$ reduces $A$ to a single value, starting with an initial value $\text{init}$ and iteratively applying the reducing binary operator $f$. Note that $f$ is always an associative and commutative functor.
Let $S\xrightarrow{e}f\left( e \right)$ be the ordered list obtained by mapping each element $e$ of $S$ to $f\left( e \right)$, where $f$ is a function.
Finally, given string $s$ and set of natural numbers $X$, let ${s^X}$ be the substring of $s$ whose 1-based character indices are present in $X$. For example, if $s = \mathsf{this}$, then ${s^{\left\{ {1,3} \right\}}} = \mathsf{ti}$ and ${s^{\left\{ {1,2,4} \right\}}} = \mathsf{ths}$.
All remaining operators, symbols, and syntax are standard for mathematical science, computer science, or both, and are left to the reader to infer/deduce. A large part of the challenge is "getting a handle on" the syntax.
${}^1$ note that "functor" here refers to "function which can be stored as a variable and passed as an argument". Also commonly known as a "lambda expression" or a "map".