Lecture 11:

Important concepts in rewriting theory: when redexes are created

How can this situation happen?

\[t = C ⟨ \underbrace{u}_{\text{not a } λ} s⟩ ⟶_β C'⟨\underbrace{u'}_{\text{a } λ} s⟩\]
  1. when $u$ is a redex itself

    • when $u = (λx.λy. p) q ⟶ λy. p \lbrace x ← q\rbrace$

    • when $u = I (λx. p) ⟶ λx. p$

  2. $u$ is a variable $x$ and it is substituted by a $λ$.

    \[(λz. δ) (xy) δ ⟶ δδ\]

Value substitution calculus:

\[L ⟨λx. t⟩s ⟶_{mult} L ⟨t[x ← s]⟩\\ t [x ← L⟨v⟩] ⟶_{exp} L ⟨t \lbrace x ← s \rbrace⟩\\ L \; ≝ \; ⟨\cdot⟩ \; \mid \; L[x ← s]\]
  • Functional Programming Languages: weak $λ$-calulus + closed terms
  • Proof assistants: strong $λ$ + open terms

Intermediate level: OPEN: (weak $λ$ + open terms)

In CBN: open vs. closed doesn’t change much whereas for CBV: open vs. closed is crucial, it can affect termination

Fireables (aka fireball) and Intert terms:

\[f = v \; \mid \; i\\ i \; ≝ \; x \; \mid \; i f \qquad (x f_1 ⋯ f_n)\]

And new rewriting rules:

\[(λx. t) f ⟶_{βf} t \lbrace x ← f \rbrace\\ (λx. t) v ⟶_{βr} t \lbrace x ← v \rbrace\\ (λx. t) i ⟶_{βi} t \lbrace x ← i \rbrace\\ E \; ≝ \; ⟨ \cdot ⟩ \; \mid \; Et \; \mid \; t E\]

Harmony property:

  • either $t ⟶_{βf} t’$
  • or $t$ is a fireball

NB: When $t$ is closed:

  • $t ⟶_{βv} t’$
  • $t$ is a value

There are a couple of issues though if you extend this calculus under $λ$’s. Consider this term:

\[(λx. ((λy.I) (xx))) δ ⟶ (λy.I)δ ⟶ I\\ (λx. ((λy.I) (xx))) δ ⟶ (λy.I)(δδ) ⟶ (λy.I)(δδ) ⟶ ⋯\\\]

So in the strong case, fireball doesn’t work.


Intermediate between a calculus with explicit substitutions and a $λ$-calulus:

Split fireball calculus:

\[t \; ≝ \; x \; \mid \; λx. t \; \mid \; t u\\ v \; ≝ \; λx.t \; \mid \; x\\ i \; ≝ \; x f_1 ⋯ f_n \qquad n>0\\ E \; ≝ \; ε \; \mid \; E[x ← i]\\ P \; ≝ \; (t, E)\]

and

\[(λx. t) f ⟶_{βf} t \lbrace x ← f \rbrace\\ (C ⟨ (λx. t) v ⟩, E) ⟶_{βr} (C ⟨ t \lbrace x ← v \rbrace ⟩, E)\\ (C ⟨ (λx. t) i ⟩, E) ⟶_{βi} (C ⟨ t ⟩, [x ← i] E)\\ C \; ≝ \; ⟨ \cdot ⟩ \; \mid \; Ct \; \mid \; t C\]

The point of inert terms is that substituting them does not create new redexes.

Sum up:

  • Size explosion: there’s a mismatch: $β$-step cannot be taken as an atomic operatic for all strategies (both CBN and CBV are reasonable, given two AM with polynomial overhead)

    Important concept: being reasonable doesn’t mean to be efficient, it’s about being able to be implemented with a polynomial overhead

  • AM: search (linear in the work done by substitutions) and substitutions. By removing search ⟹ linear substitution calculus

  • Certain strategies in PN never change the boxes ⟹ subterm property

  • CBneed: best of the two worlds (CBV and CBN), but doesn’t have a clean interpretation in linear logic

Leave a comment