Skip to content

Commit cb372af

Browse files
author
Alex Gryzlov
committed
fix line breaks/spacing
1 parent cb6375a commit cb372af

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

src/Lists.lidr

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -406,11 +406,13 @@ return the same bag unchanged.
406406
407407
$\square$
408408
409-
==== Exercise: 3 stars, recommendedM (bag_theorem) Write down an interesting
410-
theorem `bag_theorem` about bags involving the functions `count` and `add`, and
411-
prove it. Note that, since this problem is somewhat open-ended, it's possible
412-
that you may come up with a theorem which is true, but whose proof requires
413-
techniques you haven't learned yet. Feel free to ask for help if you get stuck!
409+
==== Exercise: 3 stars, recommendedM (bag_theorem)
410+
411+
Write down an interesting theorem `bag_theorem` about bags involving the
412+
functions `count` and `add`, and prove it. Note that, since this problem is
413+
somewhat open-ended, it's possible that you may come up with a theorem which is
414+
true, but whose proof requires techniques you haven't learned yet. Feel free to
415+
ask for help if you get stuck!
414416
415417
> bag_theorem : ?bag_theorem
416418
@@ -510,10 +512,10 @@ _Proof_: By induction on `l1`.
510512
- Next, suppose `l1 = n :: l1'`, with
511513
`(l1' ++ l2) ++ l3 = l1' ++ (l2 ++ l3)`
512514
(the induction hypothesis). We must show
513-
`((n :: l1') ++ l2) ++ l3 = (n :: l1') ++ (l2 ++ l3)`.
514-
By the definition of `++`, this follows from
515-
`n :: ((l1' ++ l2) ++ l 3) = n :: (l1' ++ (l2 ++ l3))`,
516-
which is immediate from the induction hypothesis. $\square$
515+
`((n :: l1') ++ l2) ++ l3 = (n :: l1') ++ (l2 ++ l3)`.
516+
By the definition of `++`, this follows from
517+
`n :: ((l1' ++ l2) ++ l 3) = n :: (l1' ++ (l2 ++ l3))`,
518+
which is immediate from the induction hypothesis. $\square$
517519
518520
==== Reversing a List
519521
@@ -586,33 +588,33 @@ _Proof_: By induction on `l1`.
586588
587589
- First, suppose `l1 = []`. We must show
588590
`length ([] ++ l2) = length [] + length l2`,
589-
which follows directly from the definitions of `length` and `++`.
591+
which follows directly from the definitions of `length` and `++`.
590592
591593
- Next, suppose `l1 = n :: l1'`, with
592594
`length (l1' ++ l2) = length l1' + length l2`.
593-
We must show
594-
`length ((n :: l1') ++ l2) = length (n :: l1') + length l2)`.
595+
We must show
596+
`length ((n :: l1') ++ l2) = length (n :: l1') + length l2)`.
595597
This follows directly from the definitions of `length` and `++` together
596-
with the induction hypothesis. $\square$
598+
with the induction hypothesis. $\square$
597599
598600
_Theorem_: For all lists `l`, `length (rev l) = length l`.
599601
600602
_Proof_: By induction on `l`.
601603
602604
- First, suppose `l = []`. We must show
603605
`length (rev []) = length []`,
604-
which follows directly from the definitions of `length` and `rev`.
606+
which follows directly from the definitions of `length` and `rev`.
605607
606608
- Next, suppose l = n :: l' , with
607609
`length (rev l') = length l'`.
608-
We must show
609-
`length (rev (n :: l')) = length (n :: l')`.
610-
By the definition of `rev`, this follows from
611-
`length ((rev l') ++ [n]) = S (length l')`
612-
which, by the previous lemma, is the same as
613-
`length (rev l') + length [n] = S (length l')`.
610+
We must show
611+
`length (rev (n :: l')) = length (n :: l')`.
612+
By the definition of `rev`, this follows from
613+
`length ((rev l') ++ [n]) = S (length l')`
614+
which, by the previous lemma, is the same as
615+
`length (rev l') + length [n] = S (length l')`.
614616
This follows directly from the induction hypothesis and the definition of
615-
`length`. $\square$
617+
`length`. $\square$
616618
617619
The style of these proofs is rather longwinded and pedantic. After the first
618620
few, we might find it easier to follow proofs that give fewer details (which can
@@ -918,8 +920,9 @@ $\square$
918920
919921
$\square$
920922
921-
==== Exercise: 2 starsM (baz_num_elts) Consider the following inductive
922-
definition:
923+
==== Exercise: 2 starsM (baz_num_elts)
924+
925+
Consider the following inductive definition:
923926
924927
> data Baz : Type where
925928
> Baz1 : Baz -> Baz

0 commit comments

Comments
 (0)