2
2
3
3
> module ProofObjects
4
4
5
- \ [
6
- \ say{" \t extit{Algorithms are the computational content of proofs.}" - Robert
5
+ \ say{" \t extit{Algorithms are the computational content of proofs.}" - Robert
7
6
Harper }
8
- \ ]
9
7
10
8
We have seen that Idris has mechanisms both for _programming_, using inductive
11
9
data types like \idr{Nat } or \idr{List } and functions over these types, and for
@@ -103,9 +101,10 @@ wants to be further applied to evidence that that number is even; its type,
103
101
{n : Nat} -> Ev n -> Ev (S (S n ))
104
102
```
105
103
106
- expresses this functionality, in the same way that the polymorphic type \idr{{x
107
- : Type} -> List x } expresses the fact that the constructor \idr{Nil} can be
108
- thought of as a function from types to empty lists with elements of that type.
104
+ expresses this functionality, in the same way that the polymorphic type
105
+ \idr{{x : Type} -> List x } expresses the fact that the constructor \idr{Nil} can
106
+ be thought of as a function from types to empty lists with elements of that
107
+ type.
109
108
110
109
\todo[inline]{Edit or remove}
111
110
@@ -128,7 +127,8 @@ programs in the language.
128
127
129
128
== Proof Scripts
130
129
131
- \ \todo[inline]{Rewrite, keep explanation about holes ? Seems a bit late for that }
130
+ \ \todo[inline]{Rewrite, keep explanation about holes ? Seems a bit late for
131
+ that}
132
132
133
133
The _proof objects_ we've been discussing lie at the core of how Idris operates .
134
134
When Idris is following a proof script, what is happening internally is that it
@@ -219,7 +219,7 @@ n)} — that is, a function that takes two arguments (one number and a piece of
219
219
evidence) and returns a piece of evidence ! Here it is:
220
220
221
221
```coq
222
- Definition ev_plus4' : ∀ n, ev n -> ev (4 + n) :=
222
+ Definition ev_plus4' : forall n , ev n -> ev (4 + n) :=
223
223
fun (n : Nat) => fun (H : ev n ) =>
224
224
ev_SS (S (S n)) (ev_SS n H).
225
225
```
@@ -359,12 +359,12 @@ we've been doing. We can also use it to build proofs directly, using
359
359
pattern-matching. For instance:
360
360
361
361
```coq
362
- Definition and_comm'_aux P Q (H : P ∧ Q) :=
362
+ Definition and_comm'_aux P Q (H : P /\ Q) :=
363
363
match H with
364
364
| conj HP HQ => conj HQ HP
365
365
end.
366
366
367
- Definition and_comm' P Q : P ∧ Q ↔ Q ∧ P :=
367
+ Definition and_comm' P Q : P /\ Q <-> Q /\ P :=
368
368
conj (and_comm'_aux P Q) (and_comm'_aux Q P).
369
369
```
370
370
@@ -396,11 +396,11 @@ Once again, we can also directly write proof objects for theorems involving
396
396
\idr{Or}, without resorting to tactics.
397
397
398
398
399
- ==== Exercise: 2 stars, optional (or_commut'' )
399
+ ==== Exercise: 2 stars, optional (or_comm )
400
400
401
401
\ \todo[inline]{Edit}
402
402
403
- Try to write down an explicit proof object for \idr{or_commut } (without using
403
+ Try to write down an explicit proof object for \idr{or_comm } (without using
404
404
`Print` to peek at the ones we already defined!).
405
405
406
406
> or_comm : Or p q -> Or q p
@@ -450,7 +450,7 @@ Complete the definition of the following proof object:
450
450
$\square$
451
451
452
452
453
- === \ idr{Unit} and \idr{Void}
453
+ \subsection{\ idr{Unit} and \idr{Void} }
454
454
455
455
The inductive definition of the \idr{Unit} proposition is simple:
456
456
@@ -465,7 +465,7 @@ a proof of\idr{Unit} is not informative.)
465
465
\idr{Void} is equally simple — indeed, so simple it may look syntactically wrong
466
466
at first glance!
467
467
468
- \todo[inline]{Edit, this actually is wrong, stdlib uses \idr{% runElab} to define
468
+ \todo[inline]{Edit, this actually is wrong, stdlib uses \idr{runElab} to define
469
469
it}
470
470
471
471
```idris
@@ -570,8 +570,8 @@ In general, the `inversion` tactic...
570
570
- adds these equalities to the context (and, for convenience, rewrites them
571
571
in the goal), and
572
572
573
- - if the equalities are not satisfiable (e.g., they involve things like `S n
574
- = Z` ), immediately solves the subgoal.
573
+ - if the equalities are not satisfiable (e.g., they involve things like
574
+ \idr{S n = Z} ), immediately solves the subgoal.
575
575
576
576
_Example_: If we invert a hypothesis built with \idr{Or}, there are two
577
577
constructors, so two subgoals get generated. The conclusion (result type) of the
0 commit comments