Skip to content

Commit c98d269

Browse files
committed
IndProp: add TeX proofs
1 parent 4fa6416 commit c98d269

File tree

1 file changed

+67
-46
lines changed

1 file changed

+67
-46
lines changed

src/IndProp.lidr

Lines changed: 67 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,18 @@ We will see many definitions like this one during the rest of the course. For
3333
purposes of informal discussions, it is helpful to have a lightweight notation
3434
that makes them easy to read and write. _Inference rules_ are one such notation:
3535

36-
\todo[inline]{Use proper TeX}
37-
38-
```
39-
---- (ev_0)
40-
ev 0
41-
42-
ev n
43-
------------ (ev_SS)
44-
ev (S (S n))
45-
```
36+
\[
37+
\begin{prooftree}
38+
\infer0[\idr{ev_0}]{\idr{ev 0}}
39+
\end{prooftree}
40+
\]
41+
42+
\[
43+
\begin{prooftree}
44+
\hypo{\idr{ev n}}
45+
\infer1[\idr{ev_SS}]{\idr{ev (S (S n))}}
46+
\end{prooftree}
47+
\]
4648

4749
Each of the textual rules above is reformatted here as an inference rule; the
4850
intended reading is that, if the _premises_ above the line all hold, then the
@@ -54,14 +56,13 @@ We can represent a proof using these rules by combining rule applications into a
5456
_proof tree_. Here's how we might transcribe the above proof that \idr{4} is
5557
even:
5658

57-
```
58-
------ (ev_0)
59-
ev 0
60-
------ (ev_SS)
61-
ev 2
62-
------ (ev_SS)
63-
ev 4
64-
```
59+
\[
60+
\begin{prooftree}
61+
\infer0[\idr{ev_0}]{\idr{ev 0}}
62+
\infer1[\idr{ev_SS}]{\idr{ev 2}}
63+
\infer1[\idr{ev_SS}]{\idr{ev 4}}
64+
\end{prooftree}
65+
\]
6566

6667
Why call this a "tree" (rather than a "stack", for example)? Because, in
6768
general, inference rules can have multiple premises. We will see examples of
@@ -751,34 +752,54 @@ notation. At the same time, let's introduce a more readable infix notation.
751752
> syntax [s] "=~" [re] = (Exp_match s re)
752753
>
753754

754-
\todo[inline]{Use proper TeX?}
755-
756-
```idris
757-
-------------- (MEmpty)
758-
[] =~ EmptyStr
759-
760-
------------ (MChar)
761-
[x] =~ Chr x
762-
763-
s1 =~ re1 s2 =~ re2
764-
----------------------- (MApp)
765-
s1 ++ s2 =~ App re1 re2
766-
767-
s1 =~ re1
768-
------------------- (MUnionL)
769-
s1 =~ Union re1 re2
770-
771-
s2 =~ re2
772-
------------------- (MUnionR)
773-
s2 =~ Union re1 re2
774-
775-
------------- (MStar0)
776-
[] =~ Star re
777-
778-
s1 =~ re s2 =~ Star re
779-
------------------------- (MStarApp)
780-
s1 ++ s2 =~ Star re
781-
```
755+
\[
756+
\begin{prooftree}
757+
\infer0[\idr{MEmpty}]{\idr{[] =~ EmptyStr}}
758+
\end{prooftree}
759+
\]
760+
761+
\[
762+
\begin{prooftree}
763+
\infer0[\idr{MChar}]{\idr{[x] =~ Chr x}}
764+
\end{prooftree}
765+
\]
766+
767+
\[
768+
\begin{prooftree}
769+
\hypo{\idr{s1 =~ re1}}
770+
\hypo{\idr{s2 =~ r2}}
771+
\infer2[\idr{MApp}]{\idr{s1 ++ s2 =~ App re1 re2}}
772+
\end{prooftree}
773+
\]
774+
775+
\[
776+
\begin{prooftree}
777+
\hypo{\idr{s1 =~ re1}}
778+
\infer1[\idr{MUnionL}]{\idr{s1 =~ Union re1 re2}}
779+
\end{prooftree}
780+
\]
781+
782+
783+
\[
784+
\begin{prooftree}
785+
\hypo{\idr{s2 =~ re2}}
786+
\infer1[\idr{MUnionR}]{\idr{s2 =~ Union re1 re2}}
787+
\end{prooftree}
788+
\]
789+
790+
\[
791+
\begin{prooftree}
792+
\infer0[\idr{MStar0}]{\idr{[] =~ Star re}}
793+
\end{prooftree}
794+
\]
795+
796+
\[
797+
\begin{prooftree}
798+
\hypo{\idr{s1 =~ re}}
799+
\hypo{\idr{s2 =~ Star re}}
800+
\infer2[\idr{MStarApp}]{\idr{s1 ++ s2 =~ Star re}}
801+
\end{prooftree}
802+
\]
782803

783804
Notice that these rules are not _quite_ the same as the informal ones that we
784805
gave at the beginning of the section. First, we don't need to include a rule

0 commit comments

Comments
 (0)