First-order logic with order, addition and BIT

Lax895169.BitLogic · concepts/Lax895169/BitLogic.lean · lax-895169

definition

Loading review…

Sign in with ORCID

Community review

Flags

Each flag is tied to a public ORCID identity and explains why this concept may be incorrect.

No flags have been submitted.

    Community review

    Flag this concept

    State precisely what appears incorrect. This explanation will be public under your ORCID name.

    No source line selected.

    Natural Language Statement

    Definition

    The atoms of the bit-level logic over a vocabulary LL are x≤yx \le y, the addition of ranks r(x)+r(y)=r(z)r(x) + r(y) = r(z), BIT(i,x)(i, x), and the atoms of LL. A kernel is a Boolean combination of atoms, and a sentence is in prenex form: a quantifier prefix over finitely many variables followed by a kernel. It holds on a finite linearly ordered LL-structure when the prefix holds of the kernel.

    A decision problem PP over LL is bit-definable when some sentence holds, for every nonempty finite LL-structure AA and every linear order on AA, exactly when AA is a yes-instance of PP. This is the logic FO(≤,+\le, +, BIT), in prenex form.

    Concept map
    3 concepts; 7 descendants hidden
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A

    Lean source view on GitHub

    1import Mathlib.ModelTheory.Order
    2import Mathlib.ModelTheory.Semantics
    3import Lax904597.Problems
    4import Lax895169.BitPredicate
    5
    6/-!
    7---
    8title: First-order logic with order, addition and BIT
    9type: definition
    10---
    11The atoms of the bit-level logic over a vocabulary LL are x≤yx \le y, the
    12addition of ranks r(x)+r(y)=r(z)r(x) + r(y) = r(z), BIT(i,x)(i, x), and the atoms of LL.
    13A kernel is a Boolean combination of atoms, and a sentence is in prenex
    14form: a quantifier prefix over finitely many variables followed by a kernel.
    15It holds on a finite linearly ordered LL-structure when the prefix holds of
    16the kernel.
    17
    18A decision problem PP over LL is bit-definable when some sentence holds,
    19for every nonempty finite LL-structure AA and every linear order on AA,
    20exactly when AA is a yes-instance of PP. This is the logic
    21FO(≤,+\le, +, BIT), in prenex form.
    22-/
    23
    24namespace Lax895169.BitLogic
    25
    26open Lax895169.BitPredicate Lax904597.Problems
    27
    28open FirstOrder
    29
    30open Language Structure
    31
    32/-- The atoms of the bit-level logic: the order, the addition of ranks, the bit
    33of an element at an index, and an input relation at a tuple of variables. -/
    34inductive BitAtom (L : Language.{0, 0}) (γ : Type) where
    35 /-- `x ≤ y`. -/
    36 | le (x y : γ) : BitAtom L γ
    37 /-- `orank x + orank y = orank z`. -/
    38 | plus (x y z : γ) : BitAtom L γ
    39 /-- The bit of `x` at the index `i` is set. -/
    40 | bit (i x : γ) : BitAtom L γ
    41 /-- An input relation at a tuple of variables. -/
    42 | rel {a : ℕ} (R : L.Relations a) (arg : Fin a → γ) : BitAtom L γ
    43
    44/-- A quantifier-free kernel over the bit-level atoms. -/
    45inductive BitKernel (L : Language.{0, 0}) (γ : Type) where
    46 /-- An atom. -/
    47 | atom (a : BitAtom L γ) : BitKernel L γ
    48 /-- The constant `true`, so that a trivial relation needs no dummy variable. -/
    49 | tt : BitKernel L γ
    50 /-- Negation. -/
    51 | not (k : BitKernel L γ) : BitKernel L γ
    52 /-- Conjunction. -/
    53 | and (k k' : BitKernel L γ) : BitKernel L γ
    54 /-- Disjunction. -/
    55 | or (k k' : BitKernel L γ) : BitKernel L γ
    56
    57/-- **A sentence of the bit-level logic, in prenex form**: a polarity per
    58variable and a quantifier-free kernel. -/
    59structure BitSentence (L : Language.{0, 0}) where
    60 /-- The number of quantified variables. -/
    61 vars : ℕ
    62 /-- The quantifier at each variable: `true` existential, `false` universal. -/
    63 pol : Fin vars → Bool
    64 /-- The quantifier-free kernel. -/
    65 kernel : BitKernel L (Fin vars)
    66
    67namespace BitAtom
    68
    69variable {L : Language.{0, 0}} {γ : Type}
    70
    71/-- What an atom says of a valuation. -/
    72def Holds {A : Type} [L.Structure A] [LinearOrder A] [Finite A] :
    73 BitAtom L γ → (γ → A) → Prop
    74 | .le x y, v => v x ≤ v y
    75 | .plus x y z, v => orank (v x) + orank (v y) = orank (v z)
    76 | .bit i x, v => BitIx (v i) (v x)
    77 | .rel R arg, v => RelMap R fun t => v (arg t)
    78
    79end BitAtom
    80
    81namespace BitKernel
    82
    83variable {L : Language.{0, 0}} {γ : Type}
    84
    85/-- What a kernel says of a valuation. -/
    86def Holds {A : Type} [L.Structure A] [LinearOrder A] [Finite A] :
    87 BitKernel L γ → (γ → A) → Prop
    88 | .atom a, v => a.Holds v
    89 | .tt, _ => True
    90 | .not k, v => ¬ k.Holds v
    91 | .and k k', v => k.Holds v ∧ k'.Holds v
    92 | .or k k', v => k.Holds v ∨ k'.Holds v
    93
    94end BitKernel
    95
    96namespace BitSentence
    97
    98/-- What a sentence says of an instance: the prefix, played over the kernel. -/
    99def Holds {L : Language.{0, 0}} (φ : BitSentence L) (A : Type) [L.Structure A] [LinearOrder A]
    100 [Finite A] : Prop :=
    101 prefixHolds (A := A) φ.vars φ.pol fun v => φ.kernel.Holds v
    102
    103end BitSentence
    104
    105/-- A decision problem is **bit-definable** when a prenex sentence over the
    106order, the addition and the bit at an index – `FO(≤, +, BIT)` – decides it on
    107every nonempty finite ordered structure. -/
    108def BitDefinable {L : Language.{0, 0}} [L.IsRelational] (P : DecisionProblem L) : Prop :=
    109 ∃ φ : BitSentence L, ∀ (A : Type) [L.Structure A] [LinearOrder A] [Finite A] [Nonempty A],
    110 P A ↔ φ.Holds A
    111
    112end Lax895169.BitLogic
    113

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above.

    Loading discussion…