https://github.com/lukstafi/curious-ocaml
A curious book about OCaml: logic (types), algebra (values), computation (rewrite semantics), functions (lambda calculus), constraints, monads, expression.
https://github.com/lukstafi/curious-ocaml
computer-science functional-programming ocaml
Last synced: 6 months ago
JSON representation
A curious book about OCaml: logic (types), algebra (values), computation (rewrite semantics), functions (lambda calculus), constraints, monads, expression.
- Host: GitHub
- URL: https://github.com/lukstafi/curious-ocaml
- Owner: lukstafi
- License: gpl-3.0
- Created: 2023-01-29T06:55:17.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-13T15:33:30.000Z (almost 2 years ago)
- Last Synced: 2024-05-01T13:58:31.793Z (over 1 year ago)
- Topics: computer-science, functional-programming, ocaml
- Language: Tcl
- Homepage: https://lukstafi.github.io/curious-ocaml/
- Size: 14.8 MB
- Stars: 24
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
---
title: Curious OCaml
author: Lukasz Stafiniak
header-includes:
-
-
-
---# Curious OCaml
## From logic rules to programming constructsWhat logical connectives do you know?
|$\top$ | $\bot$ | $\wedge$ | $\vee$ | $\rightarrow$
|---|---|---|---|---
| | | $a \wedge b$ | $a \vee b$ | $a \rightarrow b$
| truth | falsehood | conjunction | disjunction | implication
| "trivial" | "impossible" | $a$ and $b$ | $a$ or $b$ | $a$ gives $b$
| | shouldn't get | got both | got at least one | given $a$, we get $b$How can we define them? Think in terms of _derivation trees_:
$$
\frac{
\frac{\frac{\,}{\text{a premise}} \; \frac{\,}{\text{another premise}}}{\frac{\,}{\text{some fact}}} \;
\frac{\frac{\,}{\text{a premise}} \; \frac{\,}{\text{another premise}}}{\frac{\,}{\text{another fact}}}}
{\text{final conclusion}}
$$To define the connectives, we provide rules for using them: for example, a rule $\frac{a \; b}{c}$
matches parts of the tree that have two premises, represented by variables $a$
and $b$, and have any conclusion, represented by variable $c$.### Rules for Logical Connectives
Introduction rules say how to produce a connective. Elimination rules say how to use it.
Text in parentheses is comments. Letters are variables: stand for anything.Try to use only the connective you define in its definition.
TODO