2023 James B. Wilson, Colorado State University
Or start a the beginning with "What is a function?"
Where to start?
What to make first?
Any "real-world" problem?
How to reuse what exists?
Can I publish a paper?
Is it "real-world" experience?
Is it math?
Can I teach it to a student?
Will my advisor understand?
Where's a proof?
How to finish it?
Will a math system take it?
Programming Idioms: logic written to simulate human language*
Public Domain, original copyright (c) James S. Davis
for x in [1..5] ...
Programming "Idioma" Language
Collection of idioms that can
model a symbolic logic.
\[\forall x.(1\leq x\leq 5\Rightarrow ...)\]
becomes
*Catch: Math/Logic is human language so much of programming still looks like math/logic.
Atomic functions
Combinatorial Logic = Assembly Language,
...but lets skip assembly.
Informally
Logically
Untyped Reduction Rule \(\mathbb{I}X\rhd X\)
Example
\[\mathbb{I}7 \rhd 7\qquad \mathbb{I}(27)\rhd 27\]
Untyped Procedural Programing Idiom (Python)
def id(x) :
return x
let id x = x
Untyped Functional Programing Idiom (OCaml)
Typed Rules
Typed Procedural Programing Idiom (Java)
X id(X x) {
return x
}
id:X -> X
id x = x
Typed Functional Programing Idiom (Haskell/Idris)
\[\frac{X:Type}{\mathbb{I}^X:X\to X}(I)\qquad\begin{array}{l}X:Type\\ x:X\\ \hline \mathbb{I}^X(x):=x \end{array}(C)\]
Untyped Reduction Rule \(\mathbb{K}XY\rhd X\)
Example
\[\mathbb{K}27 \rhd 2\qquad \mathbb{K}(27)(13)\rhd 27\]
Untyped Procedural Programing Idiom (Python)
def konst(c,x) :
return c
let konst c x = c
Untyped Functional Programing Idiom (OCaml)
Typed Rules
Typed Procedural Programing Idiom (Java)
C konst(C c, X x) {
return c
}
konst:C -> X -> C
konst c = x -> c
Typed Functional Programing Idiom (Haskell/Idris)
\[\begin{array}{l} C,X:Type\\ c:X\\ \hline \mathbb{K}_c^{C,X}:X\to C \end{array}(I) \qquad \begin{array}{l} C,X:Type\\ c:C\\ x:X\\ \hline \mathbb{K}_c(x):=c \end{array}(C) \]
Untyped Reduction Rule \(\mathbb{Y}X\rhd X(\mathbb{Y}X)\)
Example
\[\mathbb{K}27 \rhd 2\qquad \mathbb{K}(27)(13)\rhd 27\]
Untyped Procedural Programing Idiom (Python)
def konst(c,x) :
return c
let konst c x = c
Untyped Functional Programing Idiom (OCaml)