Instiki
Theorems

Instiki supports something resembling the amsthm Theorem Environments.

The following input

+-- {: .un_defn}
###### Definition
Let $H$ be a subgroup of a group $G$.  A *left coset* of
$H$ in $G$ is a subset of $G$ that is of the form $x H$,
where $x \in G$ and $x H = \{ x h : h \in H \}$.

Similarly a *right coset* of $H$ in $G$ is a subset of $G$
that is of the form $H x$, where $H x = \{ h x : h \in H\}$.
=--

produces an un-numbered Definition:

Definition

Let HH be a subgroup of a group GG. A left coset of HH in GG is a subset of GG that is of the form xHx H, where xGx \in G and xH={xh:hH}x H = \{ x h : h \in H \}.

Similarly a right coset of HH in GG is a subset of GG that is of the form HxH x, where Hx={hx:hH}H x = \{ h x : h \in H \}.

Similarly, the input

 +-- {: .num_lemma #LeftCosetsDisjoint}
 ###### Lemma
 Let $H$ be a subgroup of a group $G$, and let $x$ and $y$ be elements
 of $G$. Suppose that $x H \cap y H$ is non-empty. Then $x H = y H$.
 =--

 +-- {: .proof}
 ###### Proof
 Let $z$ be some element of $x H \cap y H$.  Then $z = x a$ for some
 $a \in H$, and $z = y b$ for some $b \in H$.  If $h$ is any element
 of $H$ then $a h \in H$ and $a^{-1}h \in H$, since $H$ is a subgroup
 of $G$. But $z h = x(a h)$ and $x h = z(a^{-1}h)$ for all $h \in H$.
 Therefore $z H \subset x H$ and $x H \subset z H$, and thus
 $x H = z H$. Similarly $y H = z H$, and thus $x H = y H$, as required.
 =--

 +-- {: .num_lemma #SizeOfLeftCoset}
 ###### Lemma
 Let $H$ be a finite subgroup of a group $G$.  Then each left
 coset of $H$ in $G$ has the same number of elements as $H$.
 =--

 +-- {: .num_theorem #Lagrange}
 ###### Theorem
 **(Lagrange's Theorem)**. Let $G$ be a finite group, and let $H$ be a
 subgroup of $G$. Then the order of $H$ divides the order of $G$.
 =--

produces a numbered Lemma, followed by a Proof, followed by another numbered Lemma and a numbered Theorem:

Lemma

Let HH be a subgroup of a group GG, and let xx and yy be elements of GG. Suppose that xHyHx H \cap y H is non-empty. Then xH=yHx H = y H.

Proof

Let zz be some element of xHyHx H \cap y H. Then z=xaz = x a for some aHa \in H, and z=ybz = y b for some bHb \in H. If hh is any element of HH then ahHa h \in H and a 1hHa^{-1}h \in H, since HH is a subgroup of GG. But zh=x(ah)z h = x(a h) and xh=z(a 1h)x h = z(a^{-1}h) for all hHh \in H. Therefore zHxHz H \subset x H and xHzHx H \subset z H, and thus xH=zHx H = z H. Similarly yH=zHy H = z H, and thus xH=yHx H = y H, as required.

Lemma

Let HH be a finite subgroup of a group GG. Then each left coset of HH in GG has the same number of elements as HH.

Theorem

(Lagrange’s Theorem). Let GG be a finite group, and let HH be a subgroup of GG. Then the order of HH divides the order of GG.

These can be linked-to in the obvious fashion.

 See Lemma \ref{LeftCosetsDisjoint}.

produces

See Lemma 1.

as you’d expect. Note that each type of numbered Theorem-like environment has its own number counter.

The key is in the CSS classes.

 .proof

produces a Proof environment.

 .num_*

where ”*” is one of

 theorem     (for Theorem)
 lemma       (for Lemma)
 prop        (for Proposition)
 cor         (for Corollary)
 defn        (for Definition)
 example     (for Example)
 remark      (for Remark)
 note        (for Note)

produces a numbered Theorem (Lemma, … etc).

.un_*

produces the corresponding un-numbered version.

The above examples were drawn from here, though the LaTeX output (as can be seen, by clicking on the TeX link at the bottom of the page) is, instead, amsthm-compatible.

Extensions

Extending this facility, with new Theorem-like environments is easy. For example, say we wish to add a Conjecture and a Problem environment.

In our LaTeX template, we will need

 \theoremstyle{plain}
 \newtheorem{conjecture}{Conjecture}
 \newtheorem*{uconjecture}{Conjecture}
 \theoremstyle{definition}
 \newtheorem{problem}{Problem}
 \newtheorem*{uproblem}{Problem}

(Note the naming convention: the un-numbered version has a “u” prepended to the name.)

The CSS styles for our wiki get augmented with

body {counter-reset: theorem lemma proposition corollary definition example remark note
     conjecture problem}
.un_conjecture *, .num_conjecture * {font-style: italic}
.num_conjecture .theorem_label:after {
    content: " " counter(conjecture); counter-increment: conjecture;}
.num_problem .theorem_label:after {
    content: " " counter(problem); counter-increment: problem;}

and we’re now ready to use our newly-minted CSS class-names, un_conjecture, num_conjecture, un_problem and num_problem.