-
Notifications
You must be signed in to change notification settings - Fork 38
/
index.html
961 lines (852 loc) · 38 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2024-07-09 Tue 16:53 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>A 2024 Computer Science Curriculum</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="jbh" />
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
.title { text-align: center;
margin-bottom: .2em; }
.subtitle { text-align: center;
font-size: medium;
font-weight: bold;
margin-top:0; }
.todo { font-family: monospace; color: red; }
.done { font-family: monospace; color: green; }
.priority { font-family: monospace; color: orange; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #ccc;
box-shadow: 3px 3px 3px #eee;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: visible;
padding-top: 1.2em;
}
pre.src:before {
display: none;
position: absolute;
background-color: white;
top: -10px;
right: 10px;
padding: 3px;
border: 1px solid black;
}
pre.src:hover:before { display: inline;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
pre.src-C:before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure:before { content: 'Clojure'; }
pre.src-css:before { content: 'CSS'; }
pre.src-D:before { content: 'D'; }
pre.src-ditaa:before { content: 'ditaa'; }
pre.src-dot:before { content: 'Graphviz'; }
pre.src-calc:before { content: 'Emacs Calc'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-fortran:before { content: 'Fortran'; }
pre.src-gnuplot:before { content: 'gnuplot'; }
pre.src-haskell:before { content: 'Haskell'; }
pre.src-hledger:before { content: 'hledger'; }
pre.src-java:before { content: 'Java'; }
pre.src-js:before { content: 'Javascript'; }
pre.src-latex:before { content: 'LaTeX'; }
pre.src-ledger:before { content: 'Ledger'; }
pre.src-lisp:before { content: 'Lisp'; }
pre.src-lilypond:before { content: 'Lilypond'; }
pre.src-lua:before { content: 'Lua'; }
pre.src-matlab:before { content: 'MATLAB'; }
pre.src-mscgen:before { content: 'Mscgen'; }
pre.src-ocaml:before { content: 'Objective Caml'; }
pre.src-octave:before { content: 'Octave'; }
pre.src-org:before { content: 'Org mode'; }
pre.src-oz:before { content: 'OZ'; }
pre.src-plantuml:before { content: 'Plantuml'; }
pre.src-processing:before { content: 'Processing.js'; }
pre.src-python:before { content: 'Python'; }
pre.src-R:before { content: 'R'; }
pre.src-ruby:before { content: 'Ruby'; }
pre.src-sass:before { content: 'Sass'; }
pre.src-scheme:before { content: 'Scheme'; }
pre.src-screen:before { content: 'Gnu Screen'; }
pre.src-sed:before { content: 'Sed'; }
pre.src-sh:before { content: 'shell'; }
pre.src-sql:before { content: 'SQL'; }
pre.src-sqlite:before { content: 'SQLite'; }
/* additional languages in org.el's org-babel-load-languages alist */
pre.src-forth:before { content: 'Forth'; }
pre.src-io:before { content: 'IO'; }
pre.src-J:before { content: 'J'; }
pre.src-makefile:before { content: 'Makefile'; }
pre.src-maxima:before { content: 'Maxima'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-picolisp:before { content: 'Pico Lisp'; }
pre.src-scala:before { content: 'Scala'; }
pre.src-shell:before { content: 'Shell Script'; }
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
/* additional language identifiers per "defun org-babel-execute"
in ob-*.el */
pre.src-cpp:before { content: 'C++'; }
pre.src-abc:before { content: 'ABC'; }
pre.src-coq:before { content: 'Coq'; }
pre.src-groovy:before { content: 'Groovy'; }
/* additional language identifiers from org-babel-shell-names in
ob-shell.el: ob-shell is the only babel language using a lambda to put
the execution function name together. */
pre.src-bash:before { content: 'bash'; }
pre.src-csh:before { content: 'csh'; }
pre.src-ash:before { content: 'ash'; }
pre.src-dash:before { content: 'dash'; }
pre.src-ksh:before { content: 'ksh'; }
pre.src-mksh:before { content: 'mksh'; }
pre.src-posh:before { content: 'posh'; }
/* Additional Emacs modes also supported by the LaTeX listings package */
pre.src-ada:before { content: 'Ada'; }
pre.src-asm:before { content: 'Assembler'; }
pre.src-caml:before { content: 'Caml'; }
pre.src-delphi:before { content: 'Delphi'; }
pre.src-html:before { content: 'HTML'; }
pre.src-idl:before { content: 'IDL'; }
pre.src-mercury:before { content: 'Mercury'; }
pre.src-metapost:before { content: 'MetaPost'; }
pre.src-modula-2:before { content: 'Modula-2'; }
pre.src-pascal:before { content: 'Pascal'; }
pre.src-ps:before { content: 'PostScript'; }
pre.src-prolog:before { content: 'Prolog'; }
pre.src-simula:before { content: 'Simula'; }
pre.src-tcl:before { content: 'tcl'; }
pre.src-tex:before { content: 'TeX'; }
pre.src-plain-tex:before { content: 'Plain TeX'; }
pre.src-verilog:before { content: 'Verilog'; }
pre.src-vhdl:before { content: 'VHDL'; }
pre.src-xml:before { content: 'XML'; }
pre.src-nxml:before { content: 'XML'; }
/* add a generic configuration mode; LaTeX export needs an additional
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
pre.src-conf:before { content: 'Configuration File'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.org-right { text-align: center; }
th.org-left { text-align: center; }
th.org-center { text-align: center; }
td.org-right { text-align: right; }
td.org-left { text-align: left; }
td.org-center { text-align: center; }
dt { font-weight: bold; }
.footpara { display: inline; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.equation-container {
display: table;
text-align: center;
width: 100%;
}
.equation {
vertical-align: middle;
}
.equation-label {
display: table-cell;
text-align: right;
vertical-align: middle;
}
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
.org-svg { width: 90%; }
/*]]>*/-->
</style>
<style> body {max-width: 62.5rem; padding: 1rem; margin: auto; background-color: #fafad2} </style>
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012-2020 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
displayAlign: "center",
displayIndent: "0em",
"HTML-CSS": { scale: 100,
linebreaks: { automatic: "false" },
webFont: "TeX"
},
SVG: {scale: 100,
linebreaks: { automatic: "false" },
font: "TeX"},
NativeMML: {scale: 100},
TeX: { equationNumbers: {autoNumber: "AMS"},
MultLineWidth: "85%",
TagSide: "right",
TagIndent: ".8em"
}
});
</script>
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML"></script>
</head>
<body>
<div id="content">
<h1 class="title">A 2024 Computer Science Curriculum</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org17c2af9">What is this</a></li>
<li><a href="#org1e000c5">Intros</a>
<ul>
<li><a href="#org7817ca5">How to write a proof</a></li>
<li><a href="#org42b9847">Intro to Programming</a></li>
</ul>
</li>
<li><a href="#orgea3c393">Computational Trinity</a>
<ul>
<li><a href="#orgb2667fb">Programming Languages</a></li>
<li><a href="#orgbc964bc">Logic</a></li>
<li><a href="#org64bc844">Categories</a></li>
</ul>
</li>
<li><a href="#org01fc7ea">BEGIN</a>
<ul>
<li><a href="#org9f5de3d">Proving equalities</a></li>
<li><a href="#orgada33f1">Tips and tricks</a></li>
<li><a href="#orgdfa5039">Proving inequalities</a></li>
<li><a href="#org98f1150">Proofs with structure</a></li>
<li><a href="#org02c6cbf">Invoking lemmas</a></li>
</ul>
</li>
<li><a href="#orgfa753bf">Principles of Functional Programming</a>
<ul>
<li><a href="#org64b3a81">Lecture 1</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-org17c2af9" class="outline-2">
<h2 id="org17c2af9">What is this</h2>
<div class="outline-text-2" id="text-org17c2af9">
<p>
This is a dive into what <a href="https://www.cs.cmu.edu/~rwh/">Robert Harper</a> calls <a href="https://existentialtype.wordpress.com/2011/03/27/the-holy-trinity/">computational trinitarianism</a> where the theory of computation manifests itself in three forms: Logic, Languages and Categories. Any route can get you to the 'divine notion of computation'.
</p>
<p>
We only have access to nice things old exams, labs, and assignments if you don't pester the schools/profs as it's a breach of academic conduct for them to comment on any assignments to outsiders. If you want to meet the leading researchers visit a Topos Insitute <a href="https://www.youtube.com/playlist?list=PLhgq-BqyZ7i5Va6FzpXkcNUJIpbSacAze">seminar</a> or pay for industry <a href="https://www.cs.uoregon.edu/research/summerschool/summer23/rates.php">registration</a> to the next OPLSS, POPL or <a href="https://hott-uf.github.io/2024/">HoTT</a> workshop that is how you get involved. If you want to learn this material with a community some have started a Discord <a href="https://discord.gg/V34pTzY">channel</a>.
</p>
</div>
</div>
<div id="outline-container-org1e000c5" class="outline-2">
<h2 id="org1e000c5">Intros</h2>
<div class="outline-text-2" id="text-org1e000c5">
</div>
<div id="outline-container-org7817ca5" class="outline-3">
<h3 id="org7817ca5">How to write a proof</h3>
<div class="outline-text-3" id="text-org7817ca5">
<p>
This is a benefit of dependently typed languages your future 'discrete math' intro course that every undergrad teaches can all be done with a proof assistant now.
</p>
<ul class="org-ul">
<li><i>The Mechanics of Proof</i> using <a href="https://hrmacbeth.github.io/math2001/">Lean</a> by Heather MacBeth</li>
</ul>
</div>
</div>
<div id="outline-container-org42b9847" class="outline-3">
<h3 id="org42b9847">Intro to Programming</h3>
<div class="outline-text-3" id="text-org42b9847">
<ul class="org-ul">
<li>15-150 <a href="https://brandonspark.github.io/150/">Principles of Functional Programming</a> (SML)
<ul class="org-ul">
<li>Older Assignments & labs can be grabbed from <a href="https://github.com/zhengguan/15150-2">here</a> and <a href="https://github.com/zh3036/15150">here</a></li>
<li>TAs wrote helpful <a href="https://smlhelp.github.io/book/docs/">docs</a> for 15-150</li>
<li>We can also try whatever current version of <a href="https://hypefortypes.github.io/">hype for types</a></li>
</ul></li>
<li><a href="http://brendanfong.com/programmingcats.html">Programming with Categories</a> a workbook (Haskell)</li>
</ul>
<p>
They are going to fully mechanize 15-210 soon using <a href="https://github.com/jonsterling/agda-calf">calf</a>/decalf to prove costs.
</p>
<ul class="org-ul">
<li>15-210 <a href="https://www.diderot.one/courses/121">Parallel & Sequential Algorithms</a> (SML)
<ul class="org-ul">
<li>Some recitations/review videos <a href="https://www.diderot.one/courses/44/books">here</a> but we won't need them</li>
<li>The hw/labs can be found <a href="https://github.com/EAirPeter/Labs-15210">here</a> or <a href="https://github.com/functionalCS/15210labs">here</a></li>
<li>A very <a href="https://www.cambridge.org/core/journals/journal-of-functional-programming/article/proofdirected-program-transformation-a-functional-account-of-efficient-regular-expression-matching/454BB5CD9B0B056FA91957F2F9CC3EC5?utm_campaign=shareaholic&utm_medium=copy_link&utm_source=bookmark">detailed</a> rewrite of the regex matcher from Harper's SML book for proof directed debugging but now with efficient backtracking</li>
<li><a href="https://cs.uwaterloo.ca/~plragde/flaneries/FDS/">Functional Data Structures</a> by Prof Ragde (OCaml)</li>
</ul></li>
</ul>
</div>
</div>
</div>
<div id="outline-container-orgea3c393" class="outline-2">
<h2 id="orgea3c393">Computational Trinity</h2>
<div class="outline-text-2" id="text-orgea3c393">
</div>
<div id="outline-container-orgb2667fb" class="outline-3">
<h3 id="orgb2667fb">Programming Languages</h3>
<div class="outline-text-3" id="text-orgb2667fb">
<ul class="org-ul">
<li><i>Practical Foundations for Programming Languages</i> <a href="http://www.cs.cmu.edu/~rwh/pfpl.html">book</a> and supplementary materials</li>
<li>Robert Harper <a href="https://www.cs.uoregon.edu/research/summerschool/summer21/topics.php">OPLSS</a> 2021 lectures and some earlier OPLSS lectures for his book
<ul class="org-ul">
<li>We have access to older 15-312 <a href="https://www.cs.cmu.edu/~rjsimmon/15312-s14/">assignments</a> (SML)</li>
</ul></li>
<li><a href="https://www.plai.org/">PLAI</a> a workbook (Racket/Lisp)</li>
</ul>
<p>
The HoTT seminar explains how univalence works which will be needed to understand how equality works in many new type theories
</p>
<ul class="org-ul">
<li>15-819 <a href="http://www.cs.cmu.edu/~rwh/courses/hott/#schedule">Homotopy Type Theory</a> and book
<ul class="org-ul">
<li><a href="https://www.cse.chalmers.se/research/group/logic/book/">Programming in MLTT</a> book</li>
</ul></li>
</ul>
</div>
</div>
<div id="outline-container-orgbc964bc" class="outline-3">
<h3 id="orgbc964bc">Logic</h3>
<div class="outline-text-3" id="text-orgbc964bc">
<p>
Whatever proof theory and categorical logic we can get our hands on
</p>
<ul class="org-ul">
<li><a href="https://symbolaris.com/course/constlog21-schedule.html">Constructive Logic</a> (SML)</li>
<li>How to read/use The Edinburgh Logical Framework or <a href="https://homepages.inf.ed.ac.uk/gdp/publications/Framework_Def_Log.pdf">LF</a>
<ul class="org-ul">
<li>technical details we have to know</li>
</ul></li>
<li>Logical relations and LR as types or ParamTT</li>
<li>80-514 <a href="https://awodey.github.io/catlog/">Categorical Logic</a></li>
</ul>
</div>
</div>
<div id="outline-container-org64bc844" class="outline-3">
<h3 id="org64bc844">Categories</h3>
<div class="outline-text-3" id="text-org64bc844">
<p>
Mac Lane's or Emily Riehl's <a href="https://math.jhu.edu/~eriehl/context/">book</a> is accessible too if we learn some insights into basic <a href="https://www.youtube.com/playlist?list=PL6763F57A61FE6FE8">algebraic topology</a>.
</p>
<ul class="org-ul">
<li>MIT course <a href="https://ocw.mit.edu/courses/18-s097-applied-category-theory-january-iap-2019/">Applied Category Theory</a>
<ul class="org-ul">
<li><i>Categories for Types</i> by Crole or Awodey's book</li>
</ul></li>
</ul>
</div>
<div id="outline-container-orgee14311" class="outline-4">
<h4 id="orgee14311">Applications</h4>
<div class="outline-text-4" id="text-orgee14311">
<p>
See the <a href="https://topos.institute/collaborative-modelling">Topos Institute</a> for more.
</p>
<ul class="org-ul">
<li><a href="https://kilthub.cmu.edu/articles/journal_contribution/A_Network_Protocol_Stack_in_Standard_ML/6591089">Project</a> that Robert Harper calls 'the greatest and most ignored idea' how they designed a network protocol stack in SML by combining two modules that share specs/cohere (a <a href="https://ncatlab.org/nlab/show/pullback">pullback</a>)</li>
<li><a href="https://www.cs.uoregon.edu/research/summerschool/summer16/curriculum.php">Network Programming</a> OPLSS lectures provide a comprehensive intro to the theory and practice of network programming (OCaml)</li>
</ul>
</div>
</div>
<div id="outline-container-org2e4214b" class="outline-4">
<h4 id="org2e4214b">Research</h4>
<div class="outline-text-4" id="text-org2e4214b">
<p>
Robert Harper once spent an <a href="https://www.cambridge.org/core/journals/journal-of-functional-programming/article/on-being-a-phd-student-of-robert-harper/B68BCF31384084D9FDCB17A7DF1DE7A0">entire week</a> reading the source of an operating system to find out in complete detail exactly what happened when he pushed a button on his keyboard how it ended up transformed as pixels on his screen. His advice to grad students is to develop a point of view so when you start a project articulate exactly why it's worthwhile and keep this perspective when you are deep into the seemingly impossible technical details.
</p>
<ul class="org-ul">
<li><a href="https://www.youtube.com/watch?v=LE0SSLizYUI">OPLSS</a> 2018 lectures/draft book on Computational Type Theory and whatever other research is <a href="https://www.cs.cmu.edu/~rwh/papers.html">going on</a>.</li>
</ul>
</div>
</div>
</div>
</div>
<div id="outline-container-org01fc7ea" class="outline-2">
<h2 id="org01fc7ea">BEGIN</h2>
<div class="outline-text-2" id="text-org01fc7ea">
<p>
I'm going to start with the book <i>The Mechanics of Proof</i> because 15-150 will assume we know some of this as most CMU students will be taking <a href="https://www.math.cmu.edu/~jmackey/151_128/welcome.html">15-151</a> at the same time as 15-150.
</p>
<ul class="org-ul">
<li>Workbook <a href="https://hrmacbeth.github.io/math2001/index.html">The Mechanics of Proof</a> Fordham 2023
<ul class="org-ul">
<li>See these <a href="https://github.com/hrmacbeth/math2001">install instructions</a></li>
<li>There's many <a href="https://www.youtube.com/watch?v=YbntYOs8gUQ">demos</a> on YouTube by the author Heather Macbeth</li>
</ul></li>
</ul>
</div>
<div id="outline-container-orgc9df1b4" class="outline-4">
<h4 id="orgc9df1b4">Local install</h4>
<div class="outline-text-4" id="text-orgc9df1b4">
<p>
Gitpod free tier is easiest. To install Lean locally w/Visual Studio:
</p>
<ul class="org-ul">
<li>install <a href="https://leanprover-community.github.io/get_started.html">Lean</a></li>
<li>install git</li>
<li>install code (Visual Studio code) though I use emacs see below</li>
<li>in terminal type: git clone <a href="https://github.com/hrmacbeth/math2001.git">https://github.com/hrmacbeth/math2001.git</a></li>
<li>cd math2001</li>
<li>in terminal: lake exe cache get
<ul class="org-ul">
<li>it downloads 3972+ files (wtf)</li>
</ul></li>
<li>'code .' to start from present directory</li>
<li>install lean4 extension</li>
</ul>
<p>
Click on 01ProofsbyCalculation.lean you should get a right panel opening up in VS code called 'Lean Infoview' that displays tactic state goals and all messages.
</p>
</div>
</div>
<div id="outline-container-org8a98bcb" class="outline-4">
<h4 id="org8a98bcb">Emacs</h4>
<div class="outline-text-4" id="text-org8a98bcb">
<p>
Install everything as before then git clone <a href="https://github.com/leanprover/lean4-mode">lean4-mode</a>, paste the readme elisp into .emacs or init.el file, restart and open any .lean file. Ctrl-c Ctrl-i opens the lean view in a new window showing goals. If you use vanilla emacs from some distros like Ubuntu you'll have some 'can't verify signature' error which is fixed by <a href="http://elpa.gnu.org/packages/gnu-elpa-keyring-update.html">updating elpa keyring</a>.
</p>
<p>
Another way is with gpg:
</p>
<pre class="example">
gpg --homedir ~/.emacs.d/elpa/gnupg --list-keys
/home/x/.emacs.d/elpa/gnupg/pubring.kbx
-----------------------------------------
pub dsa2048 2014-09-24 [SC] [expired: 2019-09-23]
CA442C00F91774F17F59D9B0474F05837FBDEF9B
uid [ expired] GNU ELPA Signing Agent (2014) <elpasign@elpa.gnu.org>
pub rsa3072 2019-04-23 [SC] [expires: 2024-04-21]
C433554766D3DDC64221BFAA066DAFCB81E42C40
uid [ unknown] GNU ELPA Signing Agent (2019) <elpasign@elpa.gnu.org>
pub ed25519 2022-12-28 [C] [expires: 2032-12-25]
AC49B8A5FDED6931F40EE78BF993C03786DE7ECA
uid [ unknown] GNU ELPA Signing Agent (2023) <elpasign@elpa.gnu.org>
sub ed25519 2022-12-28 [S] [expires: 2027-12-27]
</pre>
<p>
Update key if your second key is expired:
</p>
<pre class="example">
gpg --homedir ~/.emacs.d/elpa/gnupg --keyserver hkps://keys.openpgp.org --recv-keys 066DAFCB81E42C40
</pre>
</div>
</div>
<div id="outline-container-org9f5de3d" class="outline-3">
<h3 id="org9f5de3d">Proving equalities</h3>
<div class="outline-text-3" id="text-org9f5de3d">
<p>
Reading 1.1 <i>Proving equalities</i> from <a href="https://hrmacbeth.github.io/math2001/01_Proofs_by_Calculation.html#proving-equalities">Mechanics of Proof</a>. Any examples you don't understand come back here after writing some Lean proofs you won't get them all immediately. First example expand out (a - b) and notice you need to add 4ab in order to balance both sides. The problem statement tells us (a - b) = 4 so (a - b)<sup>2</sup> is 16 after substitution.
</p>
<p>
1.2.x <i>Proving equalities in Lean</i> the .lean files are all included in the Math2001 directory you cloned from github. I had to fight with Lean to get it to accept 1.2.4 so rewrote it exactly like she did with parens:
</p>
<pre class="example">
-- Example 1.2.4.
-- Exercise: type out the whole proof printed in the text as a Lean proof.
example {a b c d e f : ℤ} (h1 : a * d = b * c) (h2 : c * f = d * e) :
d * (a * f - b * e) = 0 :=
calc
d * (a * f - b * e)
= d * a * f - d * b * e := by ring
_ = (a * d) * f - d * b * e := by ring
_ = (b * c) * f - d * b * e := by rw [h1]
_ = b * (c * f) - d * b * e := by ring
_ = b * (d * e) - d * b * e := by rw [h2]
_ = 0 := by ring
</pre>
<p>
We are using 'calc' in Lean hence the name proof by calculation. I'm guessing the underscore represents the entire left hand side of the equation indicating to the rw (rewrite) pattern matcher to ignore it. There's nothing in the documentation I could easily find but Terence Tao describes the underscore <a href="https://terrytao.wordpress.com/2023/12/05/a-slightly-longer-lean-4-proof-tour/">here</a> same way.
</p>
<p>
Look at the infoview/goals it will tell you when that stage is done by 'goals accomplished', also click around various parts of the proof to see how the infoview changes:
</p>
<pre class="example">
-- Example 1.3.2
example {x : ℤ} (h1 : x + 4 = 2) : x = -2 :=
calc
x = (x + 4) - 4 := by ring
_ = 2 - 4 := by rw [h1]
_ = -2 := by ring
</pre>
<p>
I guessed the syntax for rationals in Lean and it worked:
</p>
<pre class="example">
-- Example 1.3.4
example {w : ℚ} (h1 : 3 * w + 1 = 4) : w = 1 :=
calc
w = (3 * w + 1)/3 - 1/3 := by ring
_ = 4/3 - 1/3 := by rw [h1]
_ = 1 := by ring
</pre>
<p>
1.3.11 you can use Lean to tell you when the sides have been balanced. You did it correctly if goals panel or infoview shows goals accomplished and the linter hasn't added any red squiggle lines or other errors. Some exercises I tried, you can rewrite a line using both hypotheses and eliminate a lot of steps I kept them here for illustration how Lean works:
</p>
<pre class="example">
example {u v : ℚ} (h1 : 4 * u + v = 3) (h2 : v = 2) : u = 1 / 4 :=
calc
u = (4 * u + v)/4 - v/4 := by ring
_ = 3/4 - 2/4 := by rw [h1, h2]
_ = 1/4 := by ring
example {u v : ℝ} (h1 : u + 1 = v) : u ^ 2 + 3 * u + 1 = v ^ 2 + v - 1 :=
calc
u ^ 2 + 3 * u + 1 = (u + 1) * (u + 1) + (u + 1) - 1 := by ring
_ = v * v + v - 1 := by rw [h1]
_ = v ^ 2 + v - 1 := by ring
</pre>
</div>
</div>
<div id="outline-container-orgada33f1" class="outline-3">
<h3 id="orgada33f1">Tips and tricks</h3>
<div class="outline-text-3" id="text-orgada33f1">
<p>
1.3.2 once again we first establish x = x then use the hypothesis to rewrite it
</p>
<pre class="example">
-- Example 1.3.2
example {x : ℤ} (h1 : x + 4 = 2) : x = -2 :=
calc
x = (x + 4) - 4 := by ring
_ = 2 - 4 := by rw [h1]
_ = -2 := by ring
</pre>
<p>
For the rest of these examples try them yourself going through the 03TipsandTricks.lean file before looking at the solution it's the only way you learn.
</p>
<pre class="example">
-- Example 1.3.5
example {x : ℤ} (h1 : 2 * x + 3 = x) : x = -3 :=
calc
x = (2 * x) - x := by ring
_ = 2 * x - (2 * x + 3) := by rw [h1]
_ = -3 := by ring
</pre>
<p>
(╯°□°)╯︵ ┻━┻ if you see calc underlined with a red error it means you forgot an equal sign or _ sign in your chain of rewrites or there is an accidental character floating around in the scope out of view somewhere it took me forever to figure that out as Lean kept giving some cryptic message and I was looking at the signature.
</p>
<p>
1.3.11 exercises all use the examples we just saw. Look at 1.3.8 example when you try exercise 11 and manipulate it so a = (4 + 2) / 3.
</p>
<pre class="example">
example {x y : ℝ} (h1 : x = 3) (h2 : y = 4 * x - 3) : y = 9 :=
calc
y = y := by ring
_ = 4*x - 3 := by rw [h2]
_ = 4*3 - 3 := by rw [h1]
_ = 9 := by ring
example {p : ℝ} (h1 : 5 * p - 3 = 3 * p + 1) : p = 2 :=
calc
p = (5*p -3 - 3*p + 1)/2 + 1 := by ring
_ = (3*p + 1 - 3*p + 1)/2 + 1 := by rw [h1]
_ = 2/2 + 1 := by ring
_ = 2 := by ring
</pre>
</div>
</div>
<div id="outline-container-orgdfa5039" class="outline-3">
<h3 id="orgdfa5039">Proving inequalities</h3>
<div class="outline-text-3" id="text-orgdfa5039">
<p>
We're still doing the <a href="https://hrmacbeth.github.io/math2001/01_Proofs_by_Calculation.html#proving-inequalities">proofs by calc</a> chapter.
</p>
<p>
1.4.1 example copy down some of the general rules
</p>
<ul class="org-ul">
<li>Inequality preserved if C \(\ge\) 0:</li>
<li>A \(\ge\) B implies CA \(\ge\) CB</li>
<li>A \(\ge\) B implies A - C \(\ge\) B - C</li>
<li>A \(\ge\) B and B > C then A > C</li>
</ul>
<ul class="org-ul">
<li>Reversed inequality:</li>
<li>A \(\ge\) B implies C - B \(\ge\) C - A
<ul class="org-ul">
<li>2 \(\ge\) 1 implies 5 - 1 \(\ge\) 5 - 2</li>
</ul></li>
</ul>
<p>
To get the full list of the unicode symbols every editor plugin comes with an <a href="https://github.com/leanprover-community/lean4-mode/blob/master/data/abbreviations.json">abbreviations.json</a> file. Place '\' (LaTeX style commands) before any of those symbols on the left of the abbreviations file to see them converted to the symbols on the right. For example \b is converted in the editor to \(\beta\)
</p>
<pre class="example">
\ge greater or equal
\le less than or equal
< and > are just unicode keyboard chars
</pre>
<pre class="example">
-- Example 1.4.2
-- Exercise: replace the words "sorry" with the correct Lean justification.
example {r s : ℚ} (h1 : s + 3 ≥ r) (h2 : s + r ≤ 3) : r ≤ 3 :=
calc
r = (s + r + r - s) / 2 := by ring
_ ≤ (3 + (s + 3) - s) / 2 := by rel [h1, h2]
_ = 3 := by ring
</pre>
<p>
Example 1.4.3 think why is x + y <= x + (x + 5) it's because y <= x + 5 and x is <= to itself.
</p>
<pre class="example">
-- Example 1.4.3
-- Exercise: type out the whole proof printed in the text as a Lean proof.
example {x y : ℝ} (h1 : y ≤ x + 5) (h2 : x ≤ -2) : x + y < 2 :=
calc
x + y ≤ x + (x + 5) := by rel [h1]
_ = 2 * x + 5 := by ring
_ ≤ 2 * -2 + 5 := by rel [h2]
_ < 2 := by numbers
</pre>
<p>
Example 1.4.6 the final tactic is := by extra which is defined if you click on 'Index of Lean tactics' as "extra checks an inequality whose two sides differ by the addition of a positive quantity".
</p>
<pre class="example">
-- Example 1.4.9
-- Exercise: replace the words "sorry" with the correct Lean justification.
example {a b : ℚ} (h1 : a ≥ 0) (h2 : b ≥ 0) (h3 : a + b ≤ 8) :
3 * a * b + a ≤ 7 * b + 72 :=
calc
3 * a * b + a
≤ 2 * b ^ 2 + a ^ 2 + (3 * a * b + a) := by extra
_ = 2 * ((a + b) * b) + (a + b) * a + a := by ring
_ ≤ 2 * (8 * b) + 8 * a + a := by rel [h3]
_ = 7 * b + 9 * (a + b) := by ring
_ ≤ 7 * b + 9 * 8 := by rel [h3]
_ = 7 * b + 72 := by ring
</pre>
<p>
1.4.10 same tactic used, put left hand side of inequality on right and side, add some positive squares. If you use any symbolic calculator online then the enormous expanded square makes sense as (a<sup>4</sup> + b<sup>4</sup> + c<sup>4</sup>)<sup>2</sup> = a<sup>8</sup>+2a<sup>4</sup>b<sup>4</sup>+2a<sup>4</sup>c<sup>4</sup>+b<sup>8</sup>+2b<sup>4</sup>c<sup>4</sup>+c<sup>8</sup>
</p>
<p>
Try some 14.11 exercises
</p>
<pre class="example">
example {a b : ℚ} (h1 : 3 ≤ a) (h2 : a + 2 * b ≥ 4) : a + b ≥ 3 :=
calc
a + b = a/2 + (a + 2*b)/2 := by ring
_ ≥ 3/2 + 4/2 := by rel [h1,h2]
_ ≥ 3 := by numbers
example {x : ℤ} (hx : x ≥ 9) : x ^ 3 - 8 * x ^ 2 + 2 * x ≥ 3 :=
calc
x ^ 3 - 8 * x ^ 2 + 2 * x =
x * x * x - 8 * x * x + 2 * x := by ring
_ ≥ 9 * x * x - 8 * x * x + 2 * x := by rel [hx]
_ = x * x + 2 * x := by ring
_ ≥ 9 * x + 2 * x := by rel [hx]
_ = 11 * x := by ring
_ ≥ 11 * 9 := by rel [hx]
_ ≥ 3 := by numbers
example {n : ℤ} (hn : n ≥ 10) : n ^ 4 - 2 * n ^ 2 > 3 * n ^ 3 :=
calc
n^4 - 2 * n^2 =
n * n^3 - 2 * n^2 := by ring
_ ≥ 10 * n^3 - 2 * n^2 := by rel [hn]
_ = 3 * n^3 + 7 * n * n * n - 2 * n * n := by ring
_ ≥ 3 * n^3 + 7 * 10 * n * n - 2 * n * n := by rel [hn]
_ = 3 * n^3 + 68 * n * n := by ring
_ ≥ 3 * n^3 + 68 * 10 * 10 := by rel [hn]
_ > 3 * n^3 := by extra
</pre>
<p>
Exercise 6 I couldn't figure it out in lean as I don't know enough of the standard library yet as there's no hypothesis to use rel or addarith with and the sig wants a rational number. My attempts using squares with the tactic extra failed too whereas by hand it is easy:
</p>
<ul class="org-ul">
<li>x<sup>2</sup> - 2x \(\ge\) -1</li>
<li>x<sup>2</sup> - 2x + 1 \(\ge\) -1 + 1</li>
<li>(x - 1)<sup>2</sup> \(\ge\) 0
<ul class="org-ul">
<li>which we know is true since squares are always positive</li>
</ul></li>
</ul>
</div>
</div>
<div id="outline-container-org98f1150" class="outline-3">
<h3 id="org98f1150">Proofs with structure</h3>
<div class="outline-text-3" id="text-org98f1150">
<p>
Reading the <a href="https://hrmacbeth.github.io/math2001/02_Proofs_with_Structure.html">second</a> chapter.
</p>
<p>
2.1.2 prove m + 3 = 9 then final tactic is addarith to subtract 3 from both sides and show m = 9 - 3 or 6.
</p>
<p>
2.1.5 example remember extra checks an inequality whose two sides differ by the addition of a positive quantity and the square b<sup>2</sup> is always positive.
</p>
<p>
Another example is 2.1.7 of extra since positive quantities
</p>
<pre class="example">
example (a b : ℝ) (h1 : -b ≤ a) (h2 : a ≤ b) : a ^ 2 ≤ b ^ 2 := by
have h3 : 0 ≤ b + a := by addarith [h1]
have h4 : 0 ≤ b - a := by addarith [h2]
calc
a^2 ≤ a^2 + (b + a) * (b - a) := by extra
_ = b^2 := by ring
</pre>
<p>
2.1.8 extra tactic again:
</p>
<pre class="example">
example (a b : ℝ) (h : a ≤ b) : a ^ 3 ≤ b ^ 3 := by
have h2 : 0 ≤ b - a := by addarith [h]
calc
a^3 ≤ a^3 + ((b-a)*((b-a)^2 + 3*(b + a)^2)/4) := by extra
_ = b^3 := by ring
</pre>
<p>
The cancel tactic is defined as follows if you look at the code it's another tactic written for this book to simplify the regular lean libraries which are all abstract algebra we haven't learned yet.
</p>
<p>
'Cancel 2 at h' means
</p>
<ul class="org-ul">
<li>2x = 2y cancel to x = y</li>
<li>2x < 2y cancel to x < y</li>
<li>x<sup>2</sup> = y<sup>2</sup> cancel to x = y</li>
<li>0 < 2x cancel to 0 < x</li>
<li>x<sup>2</sup> = 0 cancel to x = 0</li>
</ul>
<p>
However in the exercises I couldn't get it work.
</p>
<p>
Example Ex 2.1.9 this is what I want to do but it won't let me despite x already being x > 1 so no possible way (x + 2) could be (-2 + 2) or 0:
</p>
<pre class="example">
example {x : ℚ} (h1 : x ^ 2 = 4) (h2 : 1 < x) : x = 2 := by
have h3 :=
calc
x * (x + 2) = 2 * (x ^ 2 + 2 * x)/2 := by ring
_ = 2 * (4 + 2 * x)/2 := by rw [h1]
_ = 2 * (x + 2) := by ring
cancel (x + 2) at h3
</pre>
<p>
Another example from 2.1.9 that doesn't work, I tried after to manually add in (h : n > 0) and still fails:
</p>
<pre class="example">
example {n : ℤ} (hn : n ^ 2 + 4 = 4 * n) : n = 2 := by
have hm : 0 = n ^ 2 - 4 * n + 4 := by addarith [hn]
have h1 :=
calc
0 = n ^ 2 - 4 * n + 4 := by rw [hm]
_ = (n - 2)^2 := by ring
cancel 2 at h1
addarith [h1]
</pre>
<p>
Others have had problems too and filed an <a href="https://github.com/hrmacbeth/math2001/issues/17">issue</a> for a possible bug or maybe I don't understand how Lean4 tactics work we'll have to skip these and try them again later when the author replies.
</p>
</div>
</div>
<div id="outline-container-org02c6cbf" class="outline-3">
<h3 id="org02c6cbf">Invoking lemmas</h3>
<div class="outline-text-3" id="text-org02c6cbf">
<p>
TODO
</p>
</div>
</div>
</div>
<div id="outline-container-orgfa753bf" class="outline-2">
<h2 id="orgfa753bf">Principles of Functional Programming</h2>
<div class="outline-text-2" id="text-orgfa753bf">
<p>
There's no programming prereqs. 15-150 was designed so students who already had some background in high school CS or who took <a href="https://www.cs.cmu.edu/~15122/schedule.shtml">15-122</a> <i>Principles of Imperative Computation</i> wouldn't have any kind of advantage. If they didn't have high school CS they would likely take 15-110/112 which is now some kind of <a href="https://academy.cs.cmu.edu/">CS academy</a> but those legacy courses aren't needed.
</p>
</div>
<div id="outline-container-org64b3a81" class="outline-3">
<h3 id="org64b3a81">Lecture 1</h3>
<div class="outline-text-3" id="text-org64b3a81">
<p>
Watching the <a href="https://brandonspark.github.io/prologue/">first lecture</a>. According to <a href="https://www.cs.cmu.edu/~rwh/papers/paradigms/paradigm.pdf">Robert Harper</a> and <a href="https://cs.brown.edu/~sk/Publications/Papers/Published/sk-teach-pl-post-linnaean/">Shriram Krishnamurthi</a> so-called 'programming paradigms' like imperative, object-oriented or functional are vague descriptors of the same thing which is just programming. We'll work through both their books PFPL and PLAI after this course. The professor he talks about ~45m we're doing his constructive logic <a href="https://symbolaris.com/course/constlog21-schedule.html">course</a> after this too. @51m LaTeX is how you generate symbols like \(\implies\) for books/papers. Don Knuth invented the original program TeX (annoyingly pronounced 'tek') to write <a href="https://learnaifromscratch.github.io/taocp.html">TAOCP</a>.
</p>
<p>
If you want to follow what he's doing in the REPL try <a href="https://sosml.org/">SOSML</a> the online interpreter. The type annotations are optional in SML you can enter 'fun double n = n + n' though I would always use them in the beginning just to remember what you're doing.
</p>
</div>
<div id="outline-container-org0c84935" class="outline-4">
<h4 id="org0c84935">PSML</h4>
<div class="outline-text-4" id="text-org0c84935">
<p>
Go to Robert Harper's <a href="https://www.cs.cmu.edu/~rwh/">CMU page</a> and get <a href="http://www.cs.cmu.edu/~rwh/isml/book.pdf">Programming in Standard ML</a>. Skip the overview (we'll do that regex debugging later) and start at Chapter 2 <i>Types, Values, and Effects</i>. In 2.1 if you don't remember what a <a href="https://topos.site/events/poly-course/">polynomial</a> is: f(x) = x<sup>2</sup> + x<sup>1</sup> + .. you bind x to an input value like x=1 then evaluate by rules of arithmetic the value of the polynomial at that given input f(1) = 1<sup>2</sup> + 1<sup>1</sup> + …
</p>
<p>
Harper is purposely provocative in all his writings and talks to get the reader/listener engaged and here he is claiming that the evaluation model of SML completely subsumes all other models where in only special cases would you program via execution of commands that manipulate memory and SML allows you to do both if needed. TODO
</p>
<p>
… cont
</p>
<hr />
</div>
</div>
</div>
</div>
</div>
</body>
</html>