Quantifier-free logic over word models #
The quantifier-free (QF) fragment of the logic of word models. Terms are built from a variable
by applying the successor/predecessor partial functions; formulas are boolean combinations of
atomic label/equality/definedness tests. Because successor is a function, a QF term reaches a
bounded neighbourhood of its variable with no quantifiers — the syntactic counterpart of
strict locality (an existential like ∃w,y[succ w x ∧ succ x y ∧ …] collapses to the
quantifier-free … (pred x) ∧ … (succ x)). The locality bridge (Logic/LocalityBridge.lean)
makes this precise: QF-definable transductions are exactly the Input-Strictly-Local functions of
Subregular ([Cha14a], [CJ19]).
Main definitions #
Subregular.Logic.Term— QF terms (var,succ,pred);Term.evalinterprets them.Subregular.Logic.Atom/QF— atomic and quantifier-free formulas.Atom.Realize/QF.Realize— satisfaction in a word model under an assignment, decidable.QF.initial/QF.final— edge positions, derived from definedness ofpred/succ.
Implementation notes #
Realize is Prop-valued (mathlib's model-theory idiom) with a derived Decidable instance,
so worked examples close by decide. A Term evaluates to Option ℕ, none once it falls off
an edge; atoms over an undefined term are false.
Equations
- Subregular.Logic.instDecidableEqTerm.decEq (Subregular.Logic.Term.var a) (Subregular.Logic.Term.var b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- Subregular.Logic.instDecidableEqTerm.decEq (Subregular.Logic.Term.var a) a_1.succ = isFalse ⋯
- Subregular.Logic.instDecidableEqTerm.decEq (Subregular.Logic.Term.var a) a_1.pred = isFalse ⋯
- Subregular.Logic.instDecidableEqTerm.decEq a.succ (Subregular.Logic.Term.var a_1) = isFalse ⋯
- Subregular.Logic.instDecidableEqTerm.decEq a.succ b.succ = if h : a = b then h ▸ have inst := Subregular.Logic.instDecidableEqTerm.decEq a a; isTrue ⋯ else isFalse ⋯
- Subregular.Logic.instDecidableEqTerm.decEq a.succ a_1.pred = isFalse ⋯
- Subregular.Logic.instDecidableEqTerm.decEq a.pred (Subregular.Logic.Term.var a_1) = isFalse ⋯
- Subregular.Logic.instDecidableEqTerm.decEq a.pred a_1.succ = isFalse ⋯
- Subregular.Logic.instDecidableEqTerm.decEq a.pred b.pred = if h : a = b then h ▸ have inst := Subregular.Logic.instDecidableEqTerm.decEq a a; isTrue ⋯ else isFalse ⋯
Instances For
Interpret a term in a word model under an assignment ρ of variables to positions;
none if it falls off an edge.
Equations
- Subregular.Logic.Term.eval w ρ (Subregular.Logic.Term.var v) = if w.Mem (ρ v) then some (ρ v) else none
- Subregular.Logic.Term.eval w ρ t.succ = (Subregular.Logic.Term.eval w ρ t).bind w.succ?
- Subregular.Logic.Term.eval w ρ t.pred = (Subregular.Logic.Term.eval w ρ t).bind w.pred?
Instances For
Directed terms and substitution #
A term is backward if it uses no successor — only the variable and predecessors, so it reads positions at or before its variable.
Equations
Instances For
Equations
- (Subregular.Logic.Term.var a).instDecidableBackward = isTrue trivial
- t.pred.instDecidableBackward = t.instDecidableBackward
- a.succ.instDecidableBackward = isFalse not_false
Equations
- (Subregular.Logic.Term.var a).instDecidableForward = isTrue trivial
- t.pred.instDecidableForward = isFalse not_false
- a.succ.instDecidableForward = a.instDecidableForward
Quantifier-free formulas: boolean combinations of atoms (no quantifiers).
- atom {α : Type u_3} {V : Type u_4} : Atom α V → QF α V
- tru {α : Type u_3} {V : Type u_4} : QF α V
- fls {α : Type u_3} {V : Type u_4} : QF α V
- neg {α : Type u_3} {V : Type u_4} : QF α V → QF α V
- conj {α : Type u_3} {V : Type u_4} : QF α V → QF α V → QF α V
- disj {α : Type u_3} {V : Type u_4} : QF α V → QF α V → QF α V
Instances For
Satisfaction of an atom in w under assignment ρ.
Equations
- Subregular.Logic.Atom.Realize w ρ (Subregular.Logic.Atom.label a t) = ((Subregular.Logic.Term.eval w ρ t).bind w.label? = some a)
- Subregular.Logic.Atom.Realize w ρ (Subregular.Logic.Atom.eq t₁ t₂) = (Subregular.Logic.Term.eval w ρ t₁ = Subregular.Logic.Term.eval w ρ t₂ ∧ Subregular.Logic.Term.eval w ρ t₁ ≠ none)
- Subregular.Logic.Atom.Realize w ρ (Subregular.Logic.Atom.defined t) = (Subregular.Logic.Term.eval w ρ t ≠ none)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Satisfaction of a quantifier-free formula in w under assignment ρ.
Equations
- Subregular.Logic.QF.Realize w ρ (Subregular.Logic.QF.atom a) = Subregular.Logic.Atom.Realize w ρ a
- Subregular.Logic.QF.Realize w ρ Subregular.Logic.QF.tru = True
- Subregular.Logic.QF.Realize w ρ Subregular.Logic.QF.fls = False
- Subregular.Logic.QF.Realize w ρ φ.neg = ¬Subregular.Logic.QF.Realize w ρ φ
- Subregular.Logic.QF.Realize w ρ (φ.conj ψ) = (Subregular.Logic.QF.Realize w ρ φ ∧ Subregular.Logic.QF.Realize w ρ ψ)
- Subregular.Logic.QF.Realize w ρ (φ.disj ψ) = (Subregular.Logic.QF.Realize w ρ φ ∨ Subregular.Logic.QF.Realize w ρ ψ)
Instances For
Equations
- Subregular.Logic.QF.instDecidableRealize w ρ (Subregular.Logic.QF.atom a) = Subregular.Logic.QF.instDecidableRealize._aux_1 w ρ a
- Subregular.Logic.QF.instDecidableRealize w ρ Subregular.Logic.QF.tru = isTrue trivial
- Subregular.Logic.QF.instDecidableRealize w ρ Subregular.Logic.QF.fls = isFalse not_false
- Subregular.Logic.QF.instDecidableRealize w ρ φ.neg = instDecidableNot
- Subregular.Logic.QF.instDecidableRealize w ρ (φ.conj ψ) = instDecidableAnd
- Subregular.Logic.QF.instDecidableRealize w ρ (φ.disj ψ) = instDecidableOr
t is an initial position: in-domain with no predecessor.
Equations
Instances For
t is a final position: in-domain with no successor.
Equations
Instances For
Worked example #
Equations
- Subregular.Logic.instDecidableEqSym x✝ y✝ = if h : Subregular.Logic.Sym.ctorIdx✝ x✝ = Subregular.Logic.Sym.ctorIdx✝ y✝ then isTrue ⋯ else isFalse ⋯