Skip to content
The Lumenary

Practice · First-year graduate

Monads

Monads

Warm-upHuman

The maybe monad on Set\mathbf{Set} has TX=X⊔{⊥}TX = X \sqcup \{\bot\}, ηX(x)=x\eta_X(x) = x, and μX\mu_X collapsing the two copies of ⊥\bot. What is a TT-algebra (A,a)(A, a)?

Choose one

Monads

CoreHuman

How many algebra structures a:PA→Aa : \mathcal{P}A \to A for the power-set monad are there on the three-element set A={p,q,r}A = \{p, q, r\}?

Monads

Warm-upHuman

In the Kleisli category of the list monad, let f(n)=[n,n+1]f(n) = [n, n + 1] and g(n)=[10n]g(n) = [10n] (both from Z\mathbb{Z} to List(Z)\mathrm{List}(\mathbb{Z})). What is (g∘Tf)(1)=μ(Tg(f(1)))(g \circ_T f)(1) = \mu(Tg(f(1)))?

Choose one

Monads

CoreHuman

Let F⊣GF \dashv G with F:C→DF : \mathcal{C} \to \mathcal{D}, unit η\eta and counit ε\varepsilon. The induced monad is T=GFT = GF on C\mathcal{C}. What is its multiplication μX:GFGFX→GFX\mu_X : GFGFX \to GFX?

Choose one

Monads

CoreHuman

In proving that ηA\eta_A is a right identity in the Kleisli category, we write, for f:A→TBf : A \to TB,

f∘TηA=μB∘Tf∘ηA=μB∘ηTB∘f=f.f \circ_T \eta_A = \mu_B \circ Tf \circ \eta_A = \mu_B \circ \eta_{TB} \circ f = f.

Which two facts justify the second and third equalities, in order?

Choose one

Monads

StretchHuman

For the list monad TT on Set\mathbf{Set}, SetT≃Mon\mathbf{Set}^T \simeq \mathbf{Mon}. Which argument shows that the Kleisli category SetT\mathbf{Set}_T is not equivalent to Mon\mathbf{Mon}?

Choose one

Monads

CoreHuman

Which forgetful functors to Set\mathbf{Set} are monadic? (Choose all that apply.)

Choose all that apply

Monads

CoreFormal

In the Lean file, a list algebra on X has act : List X → X. Which field states the associativity law a∘Ta=a∘μAa \circ Ta = a \circ \mu_A?

Choose one

Monads

StretchComputational

Write kleisli(f, g) returning the Kleisli composite (first f, then g) for the list monad: f and g are Python functions returning lists, and the composite applies g to every output of f and concatenates. Also write unit(x) returning [x]. The tests check the Kleisli category laws on examples.

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.