pub struct TheoremKind {
pub class: Name,
pub words: PrefixWords,
pub expects_proof: bool,
}Expand description
One theorem kind: one environment an author writes, such as
theorem, lemma, proof or a host’s exercise. Its key in
TheoremsConfig::kinds is the environment’s name.
A kind declares its theorem class, its words, and whether each of its statements expects a proof.
The words are a PrefixWords value, the numbering feature’s words
written before a number: a base pair (the singular and the plural), which
the heading and a plain \ref write, and named variants, each a pair,
which a reference asks for by name (\ref[abbreviated]{lem:x}). The base
pair of every shipped kind is the capitalized form (Lemma, Lemmas),
and every shipped kind declares the variants LOWERCASE_VARIANT,
CAPITAL_VARIANT and ABBREVIATED_VARIANT. The words are FLM markup
and hold no space before the number: the kind’s counter style writes a
non-breaking space after each (numbers). The base
singular word is also the word a heading shows alone where the theorem
has no number, and the display name the recomposed LaTeX gives the
environment in its declaration (Lemma in \newtheorem{lemma}{Lemma}).
§Examples
use flm_core::stdlib::features::numbering::{PluralWords, PrefixWords};
use flm_core::stdlib::features::theorems::TheoremKind;
// The two regular forms derived from one word, no abbreviation.
let lemma = TheoremKind::from_word("theoremlike", "lemma");
assert_eq!(lemma.words.base, PluralWords::new("Lemma", "Lemmas"));
assert_eq!(lemma.words.variants["lowercase"], PluralWords::new("lemma", "lemmas"));
assert!(!lemma.words.variants.contains_key("abbreviated"));
// Every form written out, with a variant of the host's own naming.
let exercise = TheoremKind::new(
"definitionlike",
PrefixWords::new("Exercise", "Exercises")
.with_variant("short", PluralWords::new("Ex.", "Exs.")),
);
assert!(!exercise.expects_proof);Fields§
§class: NameThe name of the kind’s theorem class, a key of
TheoremsConfig::classes.
words: PrefixWordsThe kind’s words: the word written before the number, singular and plural, with its named variants.
expects_proof: boolWhether each statement of this kind should have a proof that refers
back to it, unless the statement carries \noproofref. false unless
set. The feature’s check reports a statement without such a proof
(check).
A proof refers back to a statement through one of its labels, so a
kind that expects a proof must accept a label: it must be a kind of a
numbered class, under a configuration declaring at least one of the
label_types. A kind of an unnumbered
class accepts no label and could never be proved, so
TheoremsConfig::validate refuses such a configuration when the
registry is built.
Implementations§
Source§impl TheoremKind
impl TheoremKind
Sourcepub fn new(class: impl Into<Name>, words: PrefixWords) -> TheoremKind
pub fn new(class: impl Into<Name>, words: PrefixWords) -> TheoremKind
A kind of the class class with the words words, expecting no
proof.
Sourcepub fn from_word(class: impl Into<Name>, word: &str) -> TheoremKind
pub fn from_word(class: impl Into<Name>, word: &str) -> TheoremKind
A kind of the class class, expecting no proof, whose words are
derived from the single lowercase word word: the plural adds an s,
and the capitalized forms capitalize the first letter (lemma,
lemmas, Lemma, Lemmas). The capitalized pair is the base, and the
two pairs are the variants LOWERCASE_VARIANT and
CAPITAL_VARIANT. No ABBREVIATED_VARIANT is declared: to declare
an abbreviation, write the words out with TheoremKind::new. A
\ref[abbreviated]{…} to a kind made with this function is reported by
the references feature as an Error, because the kind does not declare
the variant.
Sourcepub fn expects_proof(self, expects_proof: bool) -> TheoremKind
pub fn expects_proof(self, expects_proof: bool) -> TheoremKind
Builder: whether each statement of this kind expects a proof.
Trait Implementations§
Source§impl Clone for TheoremKind
impl Clone for TheoremKind
Source§impl Debug for TheoremKind
impl Debug for TheoremKind
Source§impl<'de> Deserialize<'de> for TheoremKind
impl<'de> Deserialize<'de> for TheoremKind
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for TheoremKind
Source§impl JsonSchema for TheoremKind
impl JsonSchema for TheoremKind
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for TheoremKind
impl PartialEq for TheoremKind
Source§impl Serialize for TheoremKind
impl Serialize for TheoremKind
impl StructuralPartialEq for TheoremKind
Auto Trait Implementations§
impl Forget for TheoremKind
impl Freeze for TheoremKind
impl Move for TheoremKind
impl RefUnwindSafe for TheoremKind
impl Send for TheoremKind
impl Sync for TheoremKind
impl Unpin for TheoremKind
impl UnsafeUnpin for TheoremKind
impl UnwindSafe for TheoremKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more