Finite coloured graphs and the cluster fragment
Lax977378.Logic · concepts/Lax977378/Logic.lean · lax-977378
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural 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
Lean source view on GitHub
| 1 | import Mathlib.Data.Fintype.Card |
| 2 | import Mathlib.Order.Basic |
| 3 | |
| 4 | /-! |
| 5 | --- |
| 6 | title: Finite coloured graphs and the cluster fragment |
| 7 | type: definition |
| 8 | --- |
| 9 | Vertices are numbered solely to present a finite domain. Formulas have no access |
| 10 | to vertex numbers. Each unary predicate is interpreted independently. The |
| 11 | auxiliary order is an arbitrary linear order on the domain. |
| 12 | |
| 13 | A variable is a word of child indices together with a continuation index. |
| 14 | The constructors of Legal express precisely the variable restrictions in the |
| 15 | graph vocabulary of the thesis. Greater-than is expressed by swapping the |
| 16 | arguments of less-than. Disjunction, negation and existential quantification |
| 17 | give the other Boolean connectives and universal quantification. |
| 18 | -/ |
| 19 | namespace Lax977378.Logic |
| 20 | |
| 21 | structure 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 | |
| 28 | def 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 | |
| 32 | abbrev Var := List Nat × Nat |
| 33 | |
| 34 | inductive 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 | |
| 43 | def conj {c : Nat} (f g : Formula c) : Formula c := |
| 44 | .neg (.disj (.neg f) (.neg g)) |
| 45 | |
| 46 | def root : Var := ([], 0) |
| 47 | |
| 48 | def child (w : List Nat) (a : Nat) : Var := (w ++ [a], 0) |
| 49 | |
| 50 | def comparable (x y : Var) : Prop := |
| 51 | x.1 = y.1 ∨ (∃ a, x = child y.1 a) ∨ (∃ a, y = child x.1 a) |
| 52 | |
| 53 | inductive 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 | |
| 67 | def 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 | |
| 75 | def 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 | |
| 81 | def 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 | |
| 91 | def Holds {c : Nat} (G : Graph c) (ord : LinearOrder (Fin G.size)) |
| 92 | (f : Formula c) : Prop := eval G ord (fun _ => none) f |
| 93 | |
| 94 | def Unordered {c : Nat} (G : Graph c) (f : Formula c) : Prop := |
| 95 | Holds G inferInstance f |
| 96 | |
| 97 | def 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 | |
| 100 | end Lax977378.Logic |
| 101 |
Builds on
none
Used by
From Mathlib
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments