Boolean Monadic Recursive Schemes #
BMRS ([BCJO20]; [BCJ23];
phonological modelling in [CJ21]): programs of mutually recursive
Boolean-valued unary predicates over word models, built from if…then…else, the
edge tests initial/final (the literature's min/max), input class tests, and
recursive calls. Terms are the
quantifier-free terms of Logic/QFLogic.lean at a single index variable.
Two symbol types dissolve the literature's sig(P) bookkeeping: input labels α get
the lookup rule, rule heads F get the unfolding rule, and a Program is a total map
F → Expr α F.
Semantics is the derivation system of [YC26] (Fig. 6–7), an inductive
judgment Eval — faithful to partiality: a non-halting program (f := g, g := f)
derives nothing. evalFuel is its computable face, related by eval_iff_evalFuel.
Main definitions #
BMRS.Expr,BMRS.Program— syntax;BMRS.tden— term denotation at an index.BMRS.Eval— the derivation system;BMRS.evalFuel— the fuel-bounded evaluator.Expr.Backward/Program.Backward(duallyForward) — the one-sided fragmentsBMRSᵖ/BMRSˢof [BCJO20].BMRS.combine/BMRS.combineC— the value combinators of simultaneous application (⊙, [Yol25] Def. 4.1) and its conjunctive dual (⊘, Def. 6.5).
Main results #
Eval.deterministic— an expression has at most one value.eval_iff_evalFuel— adequacy of the fuel evaluator.Eval.congr_agreeUpto/Eval.congr_agreeFrom— one-sided locality: a backward program evaluated atireads only positions≤ i, so equal-length words agreeing there evaluate identically (dually for forward). The engine of [Yol25]'s negative results (Thm. 5.2–5.5).combine_comm,combine_assoc,combine_id— the ⊙-algebra ([Yol25] Prop. 4.4), extensionally at the value level.
Syntax #
BMRS expressions: edge tests initial/final (the literature's min(T)/max(T)),
input class tests label (the lookup rule; a Finset of symbols, so featural
predicates like V or N over a segment alphabet are single atoms — a symbol test is the
singleton case), rule-head calls call (the unfolding rule), and if…then…else.
Terms are the single-variable quantifier-free terms of Logic/QFLogic.lean.
- 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 : Term Unit) : Expr α F
- final {α : Type u_3} {F : Type u_4} (t : Term Unit) : Expr α F
- label {α : Type u_3} {F : Type u_4} (s : Finset α) (t : Term Unit) : Expr α F
- call {α : Type u_3} {F : Type u_4} (f : F) (t : Term Unit) : 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.Logic.BMRS.instDecidableEqExpr.decEq Subregular.Logic.BMRS.Expr.tru Subregular.Logic.BMRS.Expr.tru = isTrue ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq Subregular.Logic.BMRS.Expr.tru Subregular.Logic.BMRS.Expr.fls = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq Subregular.Logic.BMRS.Expr.tru (Subregular.Logic.BMRS.Expr.initial t) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq Subregular.Logic.BMRS.Expr.tru (Subregular.Logic.BMRS.Expr.final t) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq Subregular.Logic.BMRS.Expr.tru (Subregular.Logic.BMRS.Expr.label s t) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq Subregular.Logic.BMRS.Expr.tru (Subregular.Logic.BMRS.Expr.call f t) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq Subregular.Logic.BMRS.Expr.tru (c.ite e₁ e₂) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq Subregular.Logic.BMRS.Expr.fls Subregular.Logic.BMRS.Expr.tru = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq Subregular.Logic.BMRS.Expr.fls Subregular.Logic.BMRS.Expr.fls = isTrue ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq Subregular.Logic.BMRS.Expr.fls (Subregular.Logic.BMRS.Expr.initial t) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq Subregular.Logic.BMRS.Expr.fls (Subregular.Logic.BMRS.Expr.final t) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq Subregular.Logic.BMRS.Expr.fls (Subregular.Logic.BMRS.Expr.label s t) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq Subregular.Logic.BMRS.Expr.fls (Subregular.Logic.BMRS.Expr.call f t) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq Subregular.Logic.BMRS.Expr.fls (c.ite e₁ e₂) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.initial t) Subregular.Logic.BMRS.Expr.tru = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.initial t) Subregular.Logic.BMRS.Expr.fls = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.initial a) (Subregular.Logic.BMRS.Expr.initial b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.initial t) (Subregular.Logic.BMRS.Expr.final t_1) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.initial t) (Subregular.Logic.BMRS.Expr.label s t_1) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.initial t) (Subregular.Logic.BMRS.Expr.call f t_1) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.initial t) (c.ite e₁ e₂) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.final t) Subregular.Logic.BMRS.Expr.tru = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.final t) Subregular.Logic.BMRS.Expr.fls = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.final t) (Subregular.Logic.BMRS.Expr.initial t_1) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.final a) (Subregular.Logic.BMRS.Expr.final b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.final t) (Subregular.Logic.BMRS.Expr.label s t_1) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.final t) (Subregular.Logic.BMRS.Expr.call f t_1) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.final t) (c.ite e₁ e₂) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.label s t) Subregular.Logic.BMRS.Expr.tru = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.label s t) Subregular.Logic.BMRS.Expr.fls = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.label s t) (Subregular.Logic.BMRS.Expr.initial t_1) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.label s t) (Subregular.Logic.BMRS.Expr.final t_1) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.label s t) (Subregular.Logic.BMRS.Expr.call f t_1) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.label s t) (c.ite e₁ e₂) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.call f t) Subregular.Logic.BMRS.Expr.tru = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.call f t) Subregular.Logic.BMRS.Expr.fls = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.call f t) (Subregular.Logic.BMRS.Expr.initial t_1) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.call f t) (Subregular.Logic.BMRS.Expr.final t_1) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.call f t) (Subregular.Logic.BMRS.Expr.label s t_1) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (Subregular.Logic.BMRS.Expr.call f t) (c.ite e₁ e₂) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (c.ite e₁ e₂) Subregular.Logic.BMRS.Expr.tru = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (c.ite e₁ e₂) Subregular.Logic.BMRS.Expr.fls = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (c.ite e₁ e₂) (Subregular.Logic.BMRS.Expr.initial t) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (c.ite e₁ e₂) (Subregular.Logic.BMRS.Expr.final t) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (c.ite e₁ e₂) (Subregular.Logic.BMRS.Expr.label s t) = isFalse ⋯
- Subregular.Logic.BMRS.instDecidableEqExpr.decEq (c.ite e₁ e₂) (Subregular.Logic.BMRS.Expr.call f t) = isFalse ⋯
Instances For
A BMRS program: one defining expression per rule head.
Equations
- Subregular.Logic.BMRS.Program α F = (F → Subregular.Logic.BMRS.Expr α F)
Instances For
Conjunction as if…then…else ([Yol25] (3.6)).
Equations
- e₁.and e₂ = e₁.ite e₂ Subregular.Logic.BMRS.Expr.fls
Instances For
Disjunction as if…then…else ([Yol25] (3.7)).
Equations
- e₁.or e₂ = e₁.ite Subregular.Logic.BMRS.Expr.tru e₂
Instances For
Substitute a term for the variable throughout an expression: e.subst u is
e[u/x], the operation the μ-calculus translation writes tr(φ)[s(x)].
Equations
- Subregular.Logic.BMRS.Expr.tru.subst x✝ = Subregular.Logic.BMRS.Expr.tru
- Subregular.Logic.BMRS.Expr.fls.subst x✝ = Subregular.Logic.BMRS.Expr.fls
- (Subregular.Logic.BMRS.Expr.initial t).subst x✝ = Subregular.Logic.BMRS.Expr.initial (t.comp x✝)
- (Subregular.Logic.BMRS.Expr.final t).subst x✝ = Subregular.Logic.BMRS.Expr.final (t.comp x✝)
- (Subregular.Logic.BMRS.Expr.label s t).subst x✝ = Subregular.Logic.BMRS.Expr.label s (t.comp x✝)
- (Subregular.Logic.BMRS.Expr.call f t).subst x✝ = Subregular.Logic.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
Backward expressions: every term is backward.
Equations
- Subregular.Logic.BMRS.Expr.tru.Backward = True
- Subregular.Logic.BMRS.Expr.fls.Backward = True
- (Subregular.Logic.BMRS.Expr.initial t).Backward = t.Backward
- (Subregular.Logic.BMRS.Expr.final t).Backward = t.Backward
- (Subregular.Logic.BMRS.Expr.label s t).Backward = t.Backward
- (Subregular.Logic.BMRS.Expr.call f t).Backward = t.Backward
- (c.ite e₁ e₂).Backward = (c.Backward ∧ e₁.Backward ∧ e₂.Backward)
Instances For
Forward expressions.
Equations
- Subregular.Logic.BMRS.Expr.tru.Forward = True
- Subregular.Logic.BMRS.Expr.fls.Forward = True
- (Subregular.Logic.BMRS.Expr.initial t).Forward = t.Forward
- (Subregular.Logic.BMRS.Expr.final t).Forward = t.Forward
- (Subregular.Logic.BMRS.Expr.label s t).Forward = t.Forward
- (Subregular.Logic.BMRS.Expr.call f t).Forward = t.Forward
- (c.ite e₁ e₂).Forward = (c.Forward ∧ e₁.Forward ∧ e₂.Forward)
Instances For
Equations
- Subregular.Logic.BMRS.Expr.tru.instDecidableBackward = isTrue trivial
- Subregular.Logic.BMRS.Expr.fls.instDecidableBackward = isTrue trivial
- (Subregular.Logic.BMRS.Expr.initial t).instDecidableBackward = Subregular.Logic.BMRS.Expr.instDecidableBackward._aux_1 t
- (Subregular.Logic.BMRS.Expr.final t).instDecidableBackward = Subregular.Logic.BMRS.Expr.instDecidableBackward._aux_3 t
- (Subregular.Logic.BMRS.Expr.label s t).instDecidableBackward = Subregular.Logic.BMRS.Expr.instDecidableBackward._aux_5 s t
- (Subregular.Logic.BMRS.Expr.call f t).instDecidableBackward = Subregular.Logic.BMRS.Expr.instDecidableBackward._aux_7 f t
- (c.ite e₁ e₂).instDecidableBackward = instDecidableAnd
Equations
- Subregular.Logic.BMRS.Expr.tru.instDecidableForward = isTrue trivial
- Subregular.Logic.BMRS.Expr.fls.instDecidableForward = isTrue trivial
- (Subregular.Logic.BMRS.Expr.initial t).instDecidableForward = Subregular.Logic.BMRS.Expr.instDecidableForward._aux_1 t
- (Subregular.Logic.BMRS.Expr.final t).instDecidableForward = Subregular.Logic.BMRS.Expr.instDecidableForward._aux_3 t
- (Subregular.Logic.BMRS.Expr.label s t).instDecidableForward = Subregular.Logic.BMRS.Expr.instDecidableForward._aux_5 s t
- (Subregular.Logic.BMRS.Expr.call f t).instDecidableForward = Subregular.Logic.BMRS.Expr.instDecidableForward._aux_7 f t
- (c.ite e₁ e₂).instDecidableForward = instDecidableAnd
Term denotation #
Denotation of a BMRS term at index i (the judgment w, i ⊢ T → v).
Equations
- Subregular.Logic.BMRS.tden w i t = Subregular.Logic.Term.eval w (fun (x : Unit) => i) t
Instances For
A one-step predecessor term denotes the predecessor position (in-domain: off the
right edge pred? is still defined at w.length but the variable is not).
The derivation system #
The derivation system for BMRS expressions ([YC26] Fig. 7):
Eval P w i e b is w, i ⊢_P e → b. Partial by design: a non-halting program
derives nothing.
- tru {α : Type u_1} {F : Type u_2} {P : Program α F} {w : WordModel α} {i : ℕ} : Eval P w i Expr.tru true
- fls {α : Type u_1} {F : Type u_2} {P : Program α F} {w : WordModel α} {i : ℕ} : Eval P w i Expr.fls false
- initial_true {α : Type u_1} {F : Type u_2} {P : Program α F} {w : WordModel α} {i : ℕ} {t : Term Unit} (h : tden 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 : WordModel α} {i : ℕ} {t : Term Unit} {v : ℕ} (h : tden 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 : WordModel α} {i : ℕ} {t : Term Unit} (h : tden w i t = some (List.length w - 1)) : Eval P w i (Expr.final t) true
- final_false {α : Type u_1} {F : Type u_2} {P : Program α F} {w : WordModel α} {i : ℕ} {t : Term Unit} {v : ℕ} (h : tden w i t = some v) (hv : v < List.length w - 1) : Eval P w i (Expr.final t) false
- label_true {α : Type u_1} {F : Type u_2} {P : Program α F} {w : WordModel α} {i : ℕ} {s : Finset α} {t : Term Unit} {v : ℕ} {a : α} (h : tden 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 : WordModel α} {i : ℕ} {s : Finset α} {t : Term Unit} {v : ℕ} {a : α} (h : tden 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 : WordModel α} {i : ℕ} {f : F} {t : Term Unit} {v : ℕ} {b : Bool} (h : tden 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 : WordModel α} {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 : WordModel α} {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 edge test: the value is the comparison.
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 < List.length w, ∃ (b : Bool), Subregular.Logic.BMRS.Eval P w i (Subregular.Logic.BMRS.Expr.call f (Subregular.Logic.Term.var ())) b
Instances For
The fuel evaluator #
Fuel-bounded evaluator: the computable face of Eval.
Equations
- One or more equations did not get rendered due to their size.
- Subregular.Logic.BMRS.evalFuel P w 0 x✝¹ x✝ = none
- Subregular.Logic.BMRS.evalFuel P w n.succ x✝ Subregular.Logic.BMRS.Expr.tru = some true
- Subregular.Logic.BMRS.evalFuel P w n.succ x✝ Subregular.Logic.BMRS.Expr.fls = some false
- Subregular.Logic.BMRS.evalFuel P w n.succ x✝ (Subregular.Logic.BMRS.Expr.initial t) = Option.map (fun (x : ℕ) => x == 0) (Subregular.Logic.BMRS.tden w x✝ t)
- Subregular.Logic.BMRS.evalFuel P w n.succ x✝ (Subregular.Logic.BMRS.Expr.final t) = Option.map (fun (x : ℕ) => x == List.length w - 1) (Subregular.Logic.BMRS.tden w x✝ t)
- Subregular.Logic.BMRS.evalFuel P w n.succ x✝ (Subregular.Logic.BMRS.Expr.label s t) = (Subregular.Logic.BMRS.tden w x✝ t).bind fun (v : ℕ) => Option.map (fun (a : α) => decide (a ∈ s)) w[v]?
- Subregular.Logic.BMRS.evalFuel P w fuel.succ x✝ (Subregular.Logic.BMRS.Expr.call f t) = (Subregular.Logic.BMRS.tden w x✝ t).bind fun (v : ℕ) => Subregular.Logic.BMRS.evalFuel P w fuel v (P f)
Instances For
Substitution #
Transport a derivation through substitution: evaluating e[u/x] at i is
evaluating e at the position u denotes.
One-sided fragments and locality #
BMRSᵖ-programs (successor-free) compute left-subsequentially, BMRSˢ-programs
(predecessor-free) right-subsequentially ([BCJO20]). The
locality lemmas below are what those inclusions rest on and are the engine of
[Yol25]'s negative results: the flags of a one-sided program cannot see across
the target. Equal length is load-bearing — min/max atoms read w.length.
One-sided locality (left): a successor-free program evaluated at i reads only
positions ≤ i, so equal-length words agreeing up to i evaluate identically.
One-sided locality (right): a predecessor-free program evaluated at i reads
only positions ≥ i, so equal-length words agreeing from i on evaluate identically.
Simultaneous application, at the value level #
[Yol25] Def. 4.1 (⊙) and Def. 6.5 (⊘) act per input position on the input value
and the two programs' output values; the program-level operators lift these pointwise.
Stating the algebra ([Yol25] Prop. 4.4) on values keeps it a finite Bool
computation and spares the combined-head-space transport.
Simultaneous application ⊙ on values ([Yol25] Def. 4.1): a change survives iff either program makes it.
Equations
- Subregular.Logic.BMRS.combine pin a b = if pin = true then a && b else a || b
Instances For
Conjunctive simultaneous application ⊘ on values ([Yol25] Def. 6.5): a change survives iff both programs make it.
Equations
- Subregular.Logic.BMRS.combineC pin a b = if pin = true then a || b else a && b
Instances For
On a true input, ⊙ is conjunction.
On a false input, ⊙ is disjunction — the collapse behind [Yol25] (5.15): with no underlying stress the ⊙ of the two stress programs is their disjunction.
On a true input, ⊘ is disjunction.
On a false input, ⊘ is conjunction — the conjunctive licensing of [Yol25] §6.3.
A ⊙-value differs from the input iff one of the components does ([Yol25] Prop. 4.2): the changes of the simultaneous application are the union of the changes.
The input itself is a ⊙-identity ([Yol25] Prop. 4.4(iii)).
⊘ is the De Morgan dual of ⊙: negate the two output values, not the input.