Finite coloured graphs and the cluster fragment

Lax977378.Logic · concepts/Lax977378/Logic.lean · lax-977378

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

    Vertices are numbered solely to present a finite domain. Formulas have no access to vertex numbers. Each unary predicate is interpreted independently. The auxiliary order is an arbitrary linear order on the domain.

    A variable is a word of child indices together with a continuation index. The constructors of Legal express precisely the variable restrictions in the graph vocabulary of the thesis. Greater-than is expressed by swapping the arguments of less-than. Disjunction, negation and existential quantification give the other Boolean connectives and universal quantification.

    Concept map
    1 concept
    100%
    DefinitionThis conceptDescendants are omitted for concepts with more than 10 descendants.

    Lean source view on GitHub

    1import Mathlib.Data.Fintype.Card
    2import Mathlib.Order.Basic
    3
    4/-!
    5---
    6title: Finite coloured graphs and the cluster fragment
    7type: definition
    8---
    9Vertices are numbered solely to present a finite domain. Formulas have no access
    10to vertex numbers. Each unary predicate is interpreted independently. The
    11auxiliary order is an arbitrary linear order on the domain.
    12
    13A variable is a word of child indices together with a continuation index.
    14The constructors of Legal express precisely the variable restrictions in the
    15graph vocabulary of the thesis. Greater-than is expressed by swapping the
    16arguments of less-than. Disjunction, negation and existential quantification
    17give the other Boolean connectives and universal quantification.
    18-/
    19namespace Lax977378.Logic
    20
    21structure Graph (c : Nat) where
    22 size : Nat
    23 edge : Fin size → Fin size → Prop
    24 symm : ∀ x y, edge x y → edge y x
    25 loopless : ∀ x, ¬ edge x x
    26 pred : Fin c → Fin size → Prop
    27
    28def Graph.Bounded {c : Nat} (G : Graph c) (d : Nat) : Prop :=
    29 ∀ x, ∃ neighbours : List (Fin G.size), neighbours.Nodup ∧
    30 neighbours.length ≤ d ∧ ∀ y, y ∈ neighbours ↔ G.edge x y
    31
    32abbrev Var := List Nat × Nat
    33
    34inductive Formula (c : Nat)
    35 | pred (p : Fin c) (x : Var)
    36 | edge (x y : Var)
    37 | eq (x y : Var)
    38 | lt (x y : Var)
    39 | neg (f : Formula c)
    40 | disj (f g : Formula c)
    41 | ex (x : Var) (f : Formula c)
    42
    43def conj {c : Nat} (f g : Formula c) : Formula c :=
    44 .neg (.disj (.neg f) (.neg g))
    45
    46def root : Var := ([], 0)
    47
    48def child (w : List Nat) (a : Nat) : Var := (w ++ [a], 0)
    49
    50def comparable (x y : Var) : Prop :=
    51 x.1 = y.1 ∨ (∃ a, x = child y.1 a) ∨ (∃ a, y = child x.1 a)
    52
    53inductive Legal {c : Nat} : List Var → Formula c → Prop
    54 | pred {S x p} : x ∈ S → Legal S (.pred p x)
    55 | edge {S x y} : x ∈ S → y ∈ S → x.1 = y.1 → Legal S (.edge x y)
    56 | eq {S x y} : x ∈ S → y ∈ S → comparable x y → Legal S (.eq x y)
    57 | lt {S x y} : x ∈ S → y ∈ S → comparable x y → Legal S (.lt x y)
    58 | neg {S f} : Legal S f → Legal S (.neg f)
    59 | disj {S f g} : Legal S f → Legal S g → Legal S (.disj f g)
    60 | rootEx {f} : Legal [root] f → Legal [] (.ex root f)
    61 | childEx {S w a f} : (w, 0) ∈ S → child w a ∉ S →
    62 Legal (child w a :: S) f → Legal S (.ex (child w a) f)
    63 | continuation {S w i j f} : (w, j) ∈ S → j < i → (w, i) ∉ S →
    64 (∀ l < i, (w, l) ∈ S) → Legal ((w, i) :: S) f →
    65 Legal S (.ex (w, i) (conj (.edge (w, i) (w, j)) f))
    66
    67def Plain {c : Nat} (S : List Var) : Formula c → Prop
    68 | .pred _ x => x ∈ S
    69 | .edge x y | .eq x y => x ∈ S ∧ y ∈ S
    70 | .lt _ _ => False
    71 | .neg f => Plain S f
    72 | .disj f g => Plain S f ∧ Plain S g
    73 | .ex x f => Plain (x :: S) f
    74
    75def rank {c : Nat} : Formula c → Nat
    76 | .neg f => rank f
    77 | .disj f g => max (rank f) (rank g)
    78 | .ex _ f => rank f + 1
    79 | _ => 0
    80
    81def eval {c : Nat} (G : Graph c) (ord : LinearOrder (Fin G.size))
    82 (env : Var → Option (Fin G.size)) : Formula c → Prop
    83 | .pred p x => ∃ u, env x = some u ∧ G.pred p u
    84 | .edge x y => ∃ u v, env x = some u ∧ env y = some v ∧ G.edge u v
    85 | .eq x y => ∃ u, env x = some u ∧ env y = some u
    86 | .lt x y => ∃ u v, env x = some u ∧ env y = some v ∧ ord.lt u v
    87 | .neg f => ¬ eval G ord env f
    88 | .disj f g => eval G ord env f ∨ eval G ord env g
    89 | .ex x f => ∃ u, eval G ord (fun y => if y = x then some u else env y) f
    90
    91def Holds {c : Nat} (G : Graph c) (ord : LinearOrder (Fin G.size))
    92 (f : Formula c) : Prop := eval G ord (fun _ => none) f
    93
    94def Unordered {c : Nat} (G : Graph c) (f : Formula c) : Prop :=
    95 Holds G inferInstance f
    96
    97def InvariantOn {c : Nat} (C : Graph c → Prop) (f : Formula c) : Prop :=
    98 ∀ G, C G → ∀ o₁ o₂, Holds G o₁ f ↔ Holds G o₂ f
    99
    100end Lax977378.Logic
    101

    Discussion

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

    Loading discussion…