Check repeated substitution

A compiler represents a substitution SS by the following bindings:


S={a↦Pair(b,b), b↦List(c), c↦Int}.S=\{a\mapsto\mathrm{Pair}(b,b),\ b\mapsto\mathrm{List}(c),\ c\mapsto\mathrm{Int}\}.


Each application is simultaneous: replace variables in the input expression once, but do not apply SS again inside a replacement inserted during that application. Constructors remain unchanged. Write Sn(t)S^n(t) for applying SS to tt exactly nn times.


A substitution is idempotent when S(S(t))=S(t)S(S(t))=S(t) for every type expression tt.


Find S2(a)S^2(a), S3(a)S^3(a), and the smallest integer n≥1n\geq 1 for which Sn+1(a)=Sn(a)S^{n+1}(a)=S^n(a). Also state whether SS is idempotent, entering true or false. Enter type expressions using the notation Pair(Int,Bool) and List(Int), without spaces. Enter nn as an exact integer.

Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Unification Questions: