Cours 5: Computational $λ$-calculus

Call-by-value + computational effects ⟶ evaluation strategy

In a cartesian closed category:

\[M ⟶_{βη} N ⟹ ⟦M⟧ = ⟦N⟧\]

where

  • $M, N$ are $λ$-terms
  • $⟶_{βη}$ means $β$-reduction/$η$-expansion applied at any position / occurence of the $λ$-term

Keep in mind the specific monad:

Partiality monad:

\[T: \begin{cases} Set ⟶ Set \\ A \mapsto 1+A \end{cases}\]

Whenever we have a monad:

Kleisli category $Kl(T)$ of $T$:
  • sets as objects

  • functions $T: \begin{cases} A ⟶ TB
    A \mapsto 1+B \end{cases}$ as morphisms: i.e. partial function from $A$ to $B$.

  • Composition: $f: A\overset{Kl}{⟶}B$ and $g: B\overset{Kl}{⟶}C$ are composed in the following way: $f ; Tg ; μ_T$

Does it corresponds to the way we compose partial functions ? Yes:

\[A ⟶ 1+B ⟶ 1+1+C ⟶ 1+C\]

If $T$ is the partiality monad:

\[Kl(T) = pSet\]

where $pSet$ is the category of sets and partial functions.

If $P : A$, $[P] : TA$ ⟶ turn an implicit effect into an explicit one.

Strong monads

\[t_{A, B}: A × TB ⟶ T(A × B)\]

In the case of the partiality monad $T: Set ⟶ Set$:

\[\begin{cases} A × (1+B) \overset{t_{A, B}}{⟶} 1+(A×B) \\ (a, inr \; b) \mapsto inr \; (a, b) \\ (a, \star) ⟼ \star \end{cases}\]

where $1 + B = \lbrace \star \rbrace \sqcup \lbrace inr \; b \mid b ∈ B \rbrace$


Cartesian category equipped with the identity strong monad is a cartesian closed category.

NB: The diagram going from $TA × TB$ to $T(A × B)$ doesn’t commute in general, but it does indeed if you have only ONE exception (partiality monad): it doesn’t matter when it is triggered.

Leave a comment