\proves and \prove
Cycling through proves, shows, implies, ensures, demonstrates, and establishes
The following code defines two commands, \proves and
\prove. The command \proves expands to one of
proves, shows, implies, ensures, demonstrates, and
establishes, cycling through these options. The \prove command does the
same but expands to the corresponding plural forms.
\ExplSyntaxOn
\seq_const_from_clist:Nn \g_prove_mru {
establish,
demonstrate,
prove,
show,
imply,
ensure
}
\prop_new:N \l__verbs
\prop_put:Nnn \l__verbs {show} {shows}
\prop_put:Nnn \l__verbs {imply} {implies}
\prop_put:Nnn \l__verbs {demonstrate} {demonstrates}
\prop_put:Nnn \l__verbs {prove} {proves}
\prop_put:Nnn \l__verbs {establish} {establishes}
\prop_put:Nnn \l__verbs {ensure} {ensures}
\prop_put:Nnn \l__verbs {assure} {assures}
\tl_new:N \g_wordtmp
\seq_new:N \l_mytmps
\cs_generate_variant:Nn \str_if_in:nnTF { nVTF }
\NewDocumentCommand{\prove}{ o }{
\IfValueTF{#1}{
\seq_clear:N \l_mytmps
\seq_map_inline:Nn \g_prove_mru {
\str_if_eq:nnTF {##1} {ensure} {
\str_set:Nn \l_temps {n}
} {
\str_set:Nx \l_temps {\str_head_ignore_spaces:n {##1}}
}
\str_if_in:nVTF {#1} \l_temps {
\seq_put_right:Nn \l_mytmps {##1}
} { }
}
\seq_get_right:NN \l_mytmps \g_wordtmp
} {
\seq_get_right:NN \g_prove_mru \g_wordtmp
}
\tl_use:N \g_wordtmp
\IfValueTF{#1}{}{~}
\seq_gput_left:NV \g_prove_mru \g_wordtmp
\seq_gremove_duplicates:N \g_prove_mru
}
\NewDocumentCommand{\proves}{ o }{
\IfValueTF{#1}{
\seq_clear:N \l_mytmps
\seq_map_inline:Nn \g_prove_mru {
\str_if_eq:nnTF {##1} {ensure} {
\str_set:Nn \l_temps {n}
} {
\str_set:Nx \l_temps {\str_head_ignore_spaces:n {##1}}
}
\str_if_in:nVTF {#1} \l_temps {
\seq_put_right:Nn \l_mytmps {##1}
} { }
}
\seq_get_right:NN \l_mytmps \g_wordtmp
} {
\seq_get_right:NN \g_prove_mru \g_wordtmp
}
\str_set:NV \l_tmpa_str \g_wordtmp
\prop_get:NVN \l__verbs \l_tmpa_str \l_tmpa_tl
\tl_use:N \l_tmpa_tl
\IfValueTF{#1}{}{~}
\seq_gput_left:NV \g_prove_mru \g_wordtmp
\seq_gremove_duplicates:N \g_prove_mru
}
\ExplSyntaxOffBoth commands take an optional argument, which should consist of any combination of the letters
p for proves,s for shows,i for implies,n for ensures,d for demonstrates, ande for establishes.This forces the command to choose only among the corresponding words, e.g., \prove[dep]
will expand to demonstrate, establish, or prove
(whichever one has been used least recently).
Here is an example that illustrates how these commands work:
This and \cref{lem:important} \prove that $x>0$.
Combining this with the fact that $y>0$ \proves that $xy>0$.
\Moreover the fact that $z>0$ \proves[nie] \cref{eq:important.1}.