Model Checking and Weighted Fagin Definability
Lax496464.WH_B3_LogicProblems · concepts/Lax496464/WH_B3_LogicProblems.lean · lax-496464
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Definition
The two families of parameterized problems that define the hierarchies.
Model checking for a class of formulas. Instance: a structure and a formula . Parameter: . Question: is , that is, do some elements of satisfy when assigned to its free variables? [FG06, Section 4.2]
Weighted Fagin definability for a formula with a free relation variable of arity . Instance: a structure and . Parameter: . Question: is there a relation with such that ? [FG06, p. 95]
Concept map
Lean source view on GitHub
| 1 | import Lax496464.WH_B2_FirstOrder |
| 2 | import Lax888481.ParameterizedComplexity |
| 3 | |
| 4 | /-! |
| 5 | --- |
| 6 | title: Model Checking and Weighted Fagin Definability |
| 7 | type: definition |
| 8 | --- |
| 9 | The two families of parameterized problems that define the hierarchies. |
| 10 | |
| 11 | **Model checking** for a class of formulas. *Instance:* a structure |
| 12 | and a formula . *Parameter:* . *Question:* is |
| 13 | , that is, do some elements of satisfy |
| 14 | when assigned to its free variables? [FG06, Section 4.2] |
| 15 | |
| 16 | **Weighted Fagin definability** for a formula with a free relation |
| 17 | variable of arity . *Instance:* a structure and . |
| 18 | *Parameter:* . *Question:* is there a relation with such that |
| 19 | ? [FG06, p. 95] |
| 20 | |
| 21 | # Formalization Notes |
| 22 | |
| 23 | **Words.** An instance of model checking is the word of the structure followed by the word of the |
| 24 | formula; an instance of weighted definability is the word of the structure followed by . Both |
| 25 | parts are self-delimiting, so a word determines them. The parameter is the size of the formula, or |
| 26 | the last entry. |
| 27 | |
| 28 | **Model checking.** The formula does not use the relation variable, and it is false in a structure |
| 29 | whose vocabulary it does not fit. Its free variables range over the universe. The class |
| 30 | restricts the instances only: the yes-instances of are those of |
| 31 | for every that lie in the smaller domain. |
| 32 | |
| 33 | **Weighted definability.** The formula of is fixed, so each formula and arity |
| 34 | give one problem. The formulas defining the hierarchies are sentences, evaluated under an arbitrary |
| 35 | assignment (here the one sending every variable to ). A relation of tuples is a finite set |
| 36 | of lists of length over the universe. A formula that does not fit the vocabulary has no |
| 37 | witness. |
| 38 | -/ |
| 39 | |
| 40 | namespace Lax496464.WH_B3_LogicProblems |
| 41 | |
| 42 | open Lax496464.WH_B1_Structures Lax496464.WH_B2_FirstOrder |
| 43 | open Lax888481.ParameterizedComplexity (Problem) |
| 44 | |
| 45 | /-- The word `x` is the word of the structure `A` followed by the word of the formula `φ`. -/ |
| 46 | def EncodesMC (x : List ℕ) (A : Structure) (φ : Formula) : Prop := |
| 47 | ∃ y, Encodes y A ∧ x = y ++ φ.encode |
| 48 | |
| 49 | /-- `φ(A) ≠ ∅`: the formula fits the vocabulary of `A`, does not use the relation variable, and is |
| 50 | satisfied by some assignment of universe elements to its free variables. -/ |
| 51 | def Models (A : Structure) (φ : Formula) : Prop := |
| 52 | φ.Fits A.arities 0 ∧ φ.NoSetVar ∧ |
| 53 | ∃ ρ : Assignment, (∀ v ∈ φ.freeVars, ρ v < A.size) ∧ Sat A ∅ φ ρ |
| 54 | |
| 55 | open Classical in |
| 56 | /-- The parameter of a model-checking word: the size of its formula (`0` on other words). -/ |
| 57 | noncomputable def mcParam (x : List ℕ) : ℕ := |
| 58 | if h : ∃ p : Structure × Formula, EncodesMC x p.1 p.2 then (Classical.choose h).2.size else 0 |
| 59 | |
| 60 | /-- **`p-MC(Φ)`**, parameterized model checking for the class `Φ` of formulas. -/ |
| 61 | noncomputable def pMC (Φ : Set Formula) : Problem where |
| 62 | Domain := {x | ∃ A φ, EncodesMC x A φ ∧ φ ∈ Φ ∧ φ.NoSetVar} |
| 63 | Yes x := ∃ A φ, EncodesMC x A φ ∧ Models A φ |
| 64 | param := mcParam |
| 65 | |
| 66 | /-- The word `x` is the word of the structure `A` followed by the number `k`. -/ |
| 67 | def EncodesWD (x : List ℕ) (A : Structure) (k : ℕ) : Prop := |
| 68 | ∃ y, Encodes y A ∧ x = y ++ [k] |
| 69 | |
| 70 | /-- A **witness** of weight `k` for `φ(X)` in `A`, with `X` of arity `s`: a set of `k` tuples of |
| 71 | length `s` over the universe that, taken as the value of `X`, makes `φ` true. -/ |
| 72 | def Witness (A : Structure) (φ : Formula) (s k : ℕ) : Prop := |
| 73 | φ.Fits A.arities s ∧ ∃ S : Finset (List ℕ), S.card = k ∧ |
| 74 | (∀ t ∈ S, t.length = s ∧ ∀ a ∈ t, a < A.size) ∧ Sat A ↑S φ fun _ => 0 |
| 75 | |
| 76 | /-- **`p-WD_φ`**, weighted Fagin definability of `φ(X)` with `X` of arity `s`. -/ |
| 77 | def pWD (φ : Formula) (s : ℕ) : Problem where |
| 78 | Domain := {x | ∃ A k, EncodesWD x A k} |
| 79 | Yes x := ∃ A k, EncodesWD x A k ∧ Witness A φ s k |
| 80 | param x := x.getLast?.getD 0 |
| 81 | |
| 82 | end Lax496464.WH_B3_LogicProblems |
| 83 |
Formalization Notes
Words. An instance of model checking is the word of the structure followed by the word of the formula; an instance of weighted definability is the word of the structure followed by . Both parts are self-delimiting, so a word determines them. The parameter is the size of the formula, or the last entry.
Model checking. The formula does not use the relation variable, and it is false in a structure whose vocabulary it does not fit. Its free variables range over the universe. The class restricts the instances only: the yes-instances of are those of for every that lie in the smaller domain.
Weighted definability. The formula of is fixed, so each formula and arity give one problem. The formulas defining the hierarchies are sentences, evaluated under an arbitrary assignment (here the one sending every variable to ). A relation of tuples is a finite set of lists of length over the universe. A formula that does not fit the vocabulary has no witness.
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments