Boolean monadic recursive schemes #
A boolean monadic recursive scheme (BMRS) is a program of mutually recursive boolean-valued
unary predicates over words, built from if…then…else, the edge tests min and max, input
class tests, and calls of the program's rule heads. Its one-sided fragments characterize the
left- and right-subsequential functions, a characterization later extended to the rational
functions and applied to phonological analysis.
Input labels α get the lookup rule and rule heads F the unfolding rule, so a Program is a
total map F → Expr α F. Eval is the derivation system w, i ⊢_P e → b. It is partial: a
program that does not halt derives nothing. Program.approx computes it in rounds, each rerunning
every rule body against the values the previous rounds found, and on a word of length n the
rounds settle by round card F * n, so evaluation is decidable.
Main definitions #
BMRS.Expr,BMRS.Program: syntax.BMRS.Eval: the derivation system.Program.approx,Program.eval: the rounds of evaluation and the value they settle on.Program.Backward/Program.Forward: the one-sided fragmentsBMRSᵖandBMRSˢ, in which the successor (dually, the predecessor) occurs in no rule.
Main statements #
Program.eval_eq_some_iff: the rounds settle on the derivation system, soEvalis decidable.Eval.congr_eqOn_Iic/Eval.congr_eqOn_Ici: one-sided locality: a backward program evaluated atireads only positions≤ i(dually≥ i).
Implementation notes #
Evalis the derivation system of Yolyan and Comer (2026, Figs. 6–7), in which a term stepping off the word denotes nothing and an expression reading it is undefined. Bhaskar, Chandlee and Jardine (2023) instead let successor and predecessor fix the last and first positions, and Yolyan (2025) evaluates a predicate of an undefined term as false. Programs that testmin/maxbefore stepping past an edge evaluate alike under all three.- The rounds are those of Yolyan and Comer (Fig. 4) and Yolyan (3.14). A head gets a value at a position once its body evaluates against the values already found.
References #
Syntax #
A BMRS expression is an edge test initial or final (the literature's min(T),
max(T)), an input class test label (the lookup rule, over a Finset of symbols, so that
featural predicates like V or N are single atoms), a rule-head call call (the unfolding rule),
or an if…then…else.
- tru {α : Type u_3} {F : Type u_4} : Expr α F
- fls {α : Type u_3} {F : Type u_4} : Expr α F
- initial {α : Type u_3} {F : Type u_4} (t : Walk) : Expr α F
- final {α : Type u_3} {F : Type u_4} (t : Walk) : Expr α F
- label {α : Type u_3} {F : Type u_4} (s : Finset α) (t : Walk) : Expr α F
- call {α : Type u_3} {F : Type u_4} (f : F) (t : Walk) : Expr α F
- ite {α : Type u_3} {F : Type u_4} (c e₁ e₂ : Expr α F) : Expr α F
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Subregular.BMRS.instDecidableEqExpr.decEq Subregular.BMRS.Expr.tru Subregular.BMRS.Expr.tru = isTrue ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq Subregular.BMRS.Expr.tru Subregular.BMRS.Expr.fls = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq Subregular.BMRS.Expr.tru (Subregular.BMRS.Expr.initial t) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq Subregular.BMRS.Expr.tru (Subregular.BMRS.Expr.final t) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq Subregular.BMRS.Expr.tru (Subregular.BMRS.Expr.label s t) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq Subregular.BMRS.Expr.tru (Subregular.BMRS.Expr.call f t) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq Subregular.BMRS.Expr.tru (c.ite e₁ e₂) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq Subregular.BMRS.Expr.fls Subregular.BMRS.Expr.tru = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq Subregular.BMRS.Expr.fls Subregular.BMRS.Expr.fls = isTrue ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq Subregular.BMRS.Expr.fls (Subregular.BMRS.Expr.initial t) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq Subregular.BMRS.Expr.fls (Subregular.BMRS.Expr.final t) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq Subregular.BMRS.Expr.fls (Subregular.BMRS.Expr.label s t) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq Subregular.BMRS.Expr.fls (Subregular.BMRS.Expr.call f t) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq Subregular.BMRS.Expr.fls (c.ite e₁ e₂) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.initial t) Subregular.BMRS.Expr.tru = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.initial t) Subregular.BMRS.Expr.fls = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.initial a) (Subregular.BMRS.Expr.initial b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.initial t) (Subregular.BMRS.Expr.final t_1) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.initial t) (Subregular.BMRS.Expr.label s t_1) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.initial t) (Subregular.BMRS.Expr.call f t_1) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.initial t) (c.ite e₁ e₂) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.final t) Subregular.BMRS.Expr.tru = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.final t) Subregular.BMRS.Expr.fls = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.final t) (Subregular.BMRS.Expr.initial t_1) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.final a) (Subregular.BMRS.Expr.final b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.final t) (Subregular.BMRS.Expr.label s t_1) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.final t) (Subregular.BMRS.Expr.call f t_1) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.final t) (c.ite e₁ e₂) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.label s t) Subregular.BMRS.Expr.tru = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.label s t) Subregular.BMRS.Expr.fls = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.label s t) (Subregular.BMRS.Expr.initial t_1) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.label s t) (Subregular.BMRS.Expr.final t_1) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.label s t) (Subregular.BMRS.Expr.call f t_1) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.label s t) (c.ite e₁ e₂) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.call f t) Subregular.BMRS.Expr.tru = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.call f t) Subregular.BMRS.Expr.fls = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.call f t) (Subregular.BMRS.Expr.initial t_1) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.call f t) (Subregular.BMRS.Expr.final t_1) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.call f t) (Subregular.BMRS.Expr.label s t_1) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (Subregular.BMRS.Expr.call f t) (c.ite e₁ e₂) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (c.ite e₁ e₂) Subregular.BMRS.Expr.tru = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (c.ite e₁ e₂) Subregular.BMRS.Expr.fls = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (c.ite e₁ e₂) (Subregular.BMRS.Expr.initial t) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (c.ite e₁ e₂) (Subregular.BMRS.Expr.final t) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (c.ite e₁ e₂) (Subregular.BMRS.Expr.label s t) = isFalse ⋯
- Subregular.BMRS.instDecidableEqExpr.decEq (c.ite e₁ e₂) (Subregular.BMRS.Expr.call f t) = isFalse ⋯
Instances For
A BMRS program assigns one defining expression to each rule head.
Equations
- Subregular.BMRS.Program α F = (F → Subregular.BMRS.Expr α F)
Instances For
Negation as if…then…else.
Equations
Instances For
e.subst u substitutes the term u for the variable throughout e, the e[u/x] that the
μ-calculus translation writes tr(φ)[s(x)].
Equations
- Subregular.BMRS.Expr.tru.subst x✝ = Subregular.BMRS.Expr.tru
- Subregular.BMRS.Expr.fls.subst x✝ = Subregular.BMRS.Expr.fls
- (Subregular.BMRS.Expr.initial t).subst x✝ = Subregular.BMRS.Expr.initial (t.comp x✝)
- (Subregular.BMRS.Expr.final t).subst x✝ = Subregular.BMRS.Expr.final (t.comp x✝)
- (Subregular.BMRS.Expr.label s t).subst x✝ = Subregular.BMRS.Expr.label s (t.comp x✝)
- (Subregular.BMRS.Expr.call f t).subst x✝ = Subregular.BMRS.Expr.call f (t.comp x✝)
- (c.ite e₁ e₂).subst x✝ = (c.subst x✝).ite (e₁.subst x✝) (e₂.subst x✝)
Instances For
e.AllWalks p holds when every walk occurring in e satisfies p.
Equations
- Subregular.BMRS.Expr.AllWalks p Subregular.BMRS.Expr.tru = True
- Subregular.BMRS.Expr.AllWalks p Subregular.BMRS.Expr.fls = True
- Subregular.BMRS.Expr.AllWalks p (Subregular.BMRS.Expr.initial t) = p t
- Subregular.BMRS.Expr.AllWalks p (Subregular.BMRS.Expr.final t) = p t
- Subregular.BMRS.Expr.AllWalks p (Subregular.BMRS.Expr.label s t) = p t
- Subregular.BMRS.Expr.AllWalks p (Subregular.BMRS.Expr.call f t) = p t
- Subregular.BMRS.Expr.AllWalks p (c.ite e₁ e₂) = (Subregular.BMRS.Expr.AllWalks p c ∧ Subregular.BMRS.Expr.AllWalks p e₁ ∧ Subregular.BMRS.Expr.AllWalks p e₂)
Instances For
Equations
- Subregular.BMRS.Expr.instDecidableAllWalks p Subregular.BMRS.Expr.tru = isTrue trivial
- Subregular.BMRS.Expr.instDecidableAllWalks p Subregular.BMRS.Expr.fls = isTrue trivial
- Subregular.BMRS.Expr.instDecidableAllWalks p (Subregular.BMRS.Expr.initial t) = Subregular.BMRS.Expr.instDecidableAllWalks._aux_1 p t
- Subregular.BMRS.Expr.instDecidableAllWalks p (Subregular.BMRS.Expr.final t) = Subregular.BMRS.Expr.instDecidableAllWalks._aux_3 p t
- Subregular.BMRS.Expr.instDecidableAllWalks p (Subregular.BMRS.Expr.label s t) = Subregular.BMRS.Expr.instDecidableAllWalks._aux_5 p s t
- Subregular.BMRS.Expr.instDecidableAllWalks p (Subregular.BMRS.Expr.call f t) = Subregular.BMRS.Expr.instDecidableAllWalks._aux_7 p f t
- Subregular.BMRS.Expr.instDecidableAllWalks p (c.ite e₁ e₂) = instDecidableAnd
A program is backward, BMRSᵖ, when the successor occurs in none of its rules.
Equations
- P.Backward = ∀ (f : F), Subregular.BMRS.Expr.AllWalks Subregular.Walk.Backward (P f)
Instances For
A program is forward, BMRSˢ, when the predecessor occurs in none of its rules.
Equations
- P.Forward = ∀ (f : F), Subregular.BMRS.Expr.AllWalks Subregular.Walk.Forward (P f)
Instances For
Equations
- P.instDecidableBackwardOfFintype = { decide := decide (∀ a ∈ Finset.univ, (fun (f : F) => Subregular.BMRS.Expr.AllWalks Subregular.Walk.Backward (P f)) a), reflects_decide := ⋯ }
Equations
- P.instDecidableForwardOfFintype = { decide := decide (∀ a ∈ Finset.univ, (fun (f : F) => Subregular.BMRS.Expr.AllWalks Subregular.Walk.Forward (P f)) a), reflects_decide := ⋯ }
The derivation system #
Eval P w i e b is the derivation w, i ⊢_P e → b of a BMRS expression. It is partial by
design, a non-halting program deriving nothing.
- tru {α : Type u_1} {F : Type u_2} {P : Program α F} {w : List α} {i : ℕ} : Eval P w i Expr.tru true
- fls {α : Type u_1} {F : Type u_2} {P : Program α F} {w : List α} {i : ℕ} : Eval P w i Expr.fls false
- initial_true {α : Type u_1} {F : Type u_2} {P : Program α F} {w : List α} {i : ℕ} {t : Walk} (h : Walk.eval w i t = some 0) : Eval P w i (Expr.initial t) true
- initial_false {α : Type u_1} {F : Type u_2} {P : Program α F} {w : List α} {i : ℕ} {t : Walk} {v : ℕ} (h : Walk.eval w i t = some v) (hv : 0 < v) : Eval P w i (Expr.initial t) false
- final_true {α : Type u_1} {F : Type u_2} {P : Program α F} {w : List α} {i : ℕ} {t : Walk} (h : Walk.eval w i t = some (w.length - 1)) : Eval P w i (Expr.final t) true
- final_false {α : Type u_1} {F : Type u_2} {P : Program α F} {w : List α} {i : ℕ} {t : Walk} {v : ℕ} (h : Walk.eval w i t = some v) (hv : v < w.length - 1) : Eval P w i (Expr.final t) false
- label_true {α : Type u_1} {F : Type u_2} {P : Program α F} {w : List α} {i : ℕ} {s : Finset α} {t : Walk} {v : ℕ} {a : α} (h : Walk.eval w i t = some v) (hl : w[v]? = some a) (has : a ∈ s) : Eval P w i (Expr.label s t) true
- label_false {α : Type u_1} {F : Type u_2} {P : Program α F} {w : List α} {i : ℕ} {s : Finset α} {t : Walk} {v : ℕ} {a : α} (h : Walk.eval w i t = some v) (hl : w[v]? = some a) (has : a ∉ s) : Eval P w i (Expr.label s t) false
- call {α : Type u_1} {F : Type u_2} {P : Program α F} {w : List α} {i : ℕ} {f : F} {t : Walk} {v : ℕ} {b : Bool} (h : Walk.eval w i t = some v) (he : Eval P w v (P f) b) : Eval P w i (Expr.call f t) b
- ite_true {α : Type u_1} {F : Type u_2} {P : Program α F} {w : List α} {i : ℕ} {c e₁ e₂ : Expr α F} {b : Bool} (hc : Eval P w i c true) (h₁ : Eval P w i e₁ b) : Eval P w i (c.ite e₁ e₂) b
- ite_false {α : Type u_1} {F : Type u_2} {P : Program α F} {w : List α} {i : ℕ} {c e₁ e₂ : Expr α F} {b : Bool} (hc : Eval P w i c false) (h₂ : Eval P w i e₂ b) : Eval P w i (c.ite e₁ e₂) b
Instances For
Boolean-form introduction for the initial test.
Boolean-form introduction for the final test.
Boolean-form introduction for the class test.
A program is total on w when every rule head is defined at every position.
Equations
- P.TotalOn w = ∀ (f : F), ∀ i < w.length, ∃ (b : Bool), Subregular.BMRS.Eval P w i (Subregular.BMRS.Expr.call f Subregular.Walk.var) b
Instances For
Substitution #
Locality #
Evaluation reads only the positions its walks reach. Successor-free programs compute
left-subsequentially and predecessor-free programs right-subsequentially, and the one-sided
locality below is what those inclusions rest on. Equal length is load-bearing: walks and the
max test read w.length.
Locality. If every walk of P and of e satisfies p, and a p-walk read from j
reaches only positions r-related to j for a transitive r, then equal-length words agreeing
on the positions r-related to i evaluate e at i alike.
A successor-free program evaluated at i reads only positions ≤ i, so equal-length words
agreeing up to i evaluate identically.
A predecessor-free program evaluated at i reads only positions ≥ i, so equal-length
words agreeing from i on evaluate identically.
Evaluation in rounds #
A round reruns every rule body with its calls read from a table of the values found so far,
starting from the empty table. Values only accumulate, a round reads the table only at
positions of the word, and until the rounds settle each one values a new pair of a head and a
position, so on a word of length n they settle by round card F * n.
e.evalWith w V i evaluates e at i in one round, reading each rule-head call from the
table V instead of unfolding it.
Equations
- One or more equations did not get rendered due to their size.
- Subregular.BMRS.Expr.evalWith w V i Subregular.BMRS.Expr.tru = some true
- Subregular.BMRS.Expr.evalWith w V i Subregular.BMRS.Expr.fls = some false
- Subregular.BMRS.Expr.evalWith w V i (Subregular.BMRS.Expr.initial t) = Option.map (fun (v : ℕ) => decide (v = 0)) (Subregular.Walk.eval w i t)
- Subregular.BMRS.Expr.evalWith w V i (Subregular.BMRS.Expr.final t) = Option.map (fun (v : ℕ) => decide (v = w.length - 1)) (Subregular.Walk.eval w i t)
- Subregular.BMRS.Expr.evalWith w V i (Subregular.BMRS.Expr.label s t) = (Subregular.Walk.eval w i t).bind fun (v : ℕ) => Option.map (fun (a : α) => decide (a ∈ s)) w[v]?
- Subregular.BMRS.Expr.evalWith w V i (Subregular.BMRS.Expr.call f t) = (Subregular.Walk.eval w i t).bind (V f)
Instances For
P.approx w k is the table after k rounds of evaluation. The first round starts from the
empty table, and each round reruns every rule body against the table before it.
Equations
- P.approx w 0 x✝¹ x✝ = none
- P.approx w k.succ x✝¹ x✝ = Subregular.BMRS.Expr.evalWith w (P.approx w k) x✝ (P x✝¹)
Instances For
A round against a larger table finds the same values.
A round reads its table only at positions of the word.
A round against a table of derived values derives every value it finds.
Every derived value is found by some round.
On a word of length n the rounds settle by round card F * n, since each round before
they settle gives a value to a new pair of a head and a position.
The value of e at i under P, from the round by which the rounds settle; none where
P does not halt.
Equations
- P.eval w i e = Subregular.BMRS.Expr.evalWith w (P.approx w (Fintype.card F * w.length)) i e
Instances For
Equations
- Subregular.BMRS.Program.instDecidableEvalOfFintype = decidable_of_iff (P.eval w i e = some b) ⋯