The areas / V32. Logic, model theory and computability
Mathlib.ModelTheory.Arithmetic.Presburger.Semilinear.Defs
50 declarations. Mathlib docs · Source
Linear and semilinear sets
This file defines linear and semilinear sets. In an AddCommMonoid, a linear set is a coset of a
finitely generated additive submonoid, and a semilinear set is a finite union of linear sets.
We prove that semilinear sets are closed under union, projection, set addition and additive closure. We also prove that any semilinear set can be decomposed into a finite union of proper linear sets, which are linear sets with linearly independent submonoid generators (periods).
Main Definitions
IsLinearSet: a set is linear if it is a coset of a finitely generated additive submonoid.IsSemilinearSet: a set is semilinear if it is a finite union of linear sets.IsProperLinearSet: a linear set is proper if its submonoid generators (periods) are linearly independent.IsProperSemilinearSet: a semilinear set is proper if it is a finite union of proper linear sets.
Main Results
IsSemilinearSetis closed under union, projection, set addition and additive closure.IsSemilinearSet.isProperSemilinearSet: every semilinear set is a finite union of proper linear sets.Nat.isSemilinearSet_iff_ultimately_periodic: A set ofℕis semilinear if and only if it is ultimately periodic, i.e. periodic after some numberk.
Naming convention
IsSemilinearSet.proj projects a semilinear set of ι ⊕ κ → M to ι → M by taking Sum.inl on
the index. It is a special case of IsSemilinearSet.image, and is useful in proving semilinearity
of sets in form { x | ∃ y, p x y }.
References
- [Seymour Ginsburg and Edwin H. Spanier, Bounded ALGOL-Like Languages][ginsburg1964]
- [Samuel Eilenberg and M. P. Schützenberger, Rational Sets in Commutative Monoids][eilenberg1969]
def IsLinearSet E3 #
{M : Type u_1} → [AddCommMonoid M] → Set M → Prop
A set is linear if it is a coset of a finitely generated additive submonoid.
theorem isLinearSet_iff E0 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s : Set M}, IsLinearSet s ↔ ∃ a t, s = a +ᵥ ↑(AddSubmonoid.closure ↑t)
An equivalent expression of IsLinearSet in terms of Finset instead of Set.Finite.
theorem IsLinearSet.singleton E0 #
∀ {M : Type u_1} [inst : AddCommMonoid M] (a : M), IsLinearSet {a}
theorem IsLinearSet.closure_finset E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] (s : Finset M), IsLinearSet ↑(AddSubmonoid.closure ↑s)
theorem IsLinearSet.closure_of_finite E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s : Set M}, s.Finite → IsLinearSet ↑(AddSubmonoid.closure s)
theorem isLinearSet_iff_exists_fg_eq_vadd E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s : Set M}, IsLinearSet s ↔ ∃ a P, P.FG ∧ s = a +ᵥ ↑P
theorem IsLinearSet.of_fg E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {P : AddSubmonoid M}, P.FG → IsLinearSet ↑P
theorem IsLinearSet.univ E0 #
∀ {M : Type u_1} [inst : AddCommMonoid M] [AddMonoid.FG M], IsLinearSet Set.univ
theorem IsLinearSet.vadd E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s : Set M} (a : M), IsLinearSet s → IsLinearSet (a +ᵥ s)
theorem IsLinearSet.add E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s₁ s₂ : Set M}, IsLinearSet s₁ → IsLinearSet s₂ → IsLinearSet (s₁ + s₂)
theorem IsLinearSet.image E1 #
∀ {M : Type u_1} {N : Type u_2} {F : Type u_5} [inst : AddCommMonoid M] [inst_1 : AddCommMonoid N]
[inst_2 : FunLike F M N] [AddMonoidHomClass F M N] {s : Set M}, IsLinearSet s → ∀ (f : F), IsLinearSet (⇑f '' s)
def IsSemilinearSet E3 #
{M : Type u_1} → [AddCommMonoid M] → Set M → Prop
A set is semilinear if it is a finite union of linear sets.
theorem isSemilinearSet_iff E0 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s : Set M}, IsSemilinearSet s ↔ ∃ S, (∀ t ∈ S, IsLinearSet t) ∧ s = ⋃₀ ↑S
An equivalent expression of IsSemilinearSet in terms of Finset instead of Set.Finite.
theorem IsLinearSet.isSemilinearSet E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s : Set M}, IsLinearSet s → IsSemilinearSet s
theorem IsSemilinearSet.empty E0 #
∀ {M : Type u_1} [inst : AddCommMonoid M], IsSemilinearSet ∅
theorem IsSemilinearSet.singleton E0 #
∀ {M : Type u_1} [inst : AddCommMonoid M] (a : M), IsSemilinearSet {a}
theorem IsSemilinearSet.closure_finset E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] (s : Finset M), IsSemilinearSet ↑(AddSubmonoid.closure ↑s)
theorem IsSemilinearSet.closure_of_finite E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s : Set M}, s.Finite → IsSemilinearSet ↑(AddSubmonoid.closure s)
theorem IsSemilinearSet.of_fg E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {P : AddSubmonoid M}, P.FG → IsSemilinearSet ↑P
theorem IsSemilinearSet.univ E0 #
∀ {M : Type u_1} [inst : AddCommMonoid M] [AddMonoid.FG M], IsSemilinearSet Set.univ
theorem IsSemilinearSet.union E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s₁ s₂ : Set M},
IsSemilinearSet s₁ → IsSemilinearSet s₂ → IsSemilinearSet (s₁ ∪ s₂)
Semilinear sets are closed under union.
theorem IsSemilinearSet.sUnion E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {S : Set (Set M)},
S.Finite → (∀ s ∈ S, IsSemilinearSet s) → IsSemilinearSet (⋃₀ S)
theorem IsSemilinearSet.iUnion E1 #
∀ {M : Type u_1} {ι : Type u_3} [inst : AddCommMonoid M] [Finite ι] {s : ι → Set M},
(∀ (i : ι), IsSemilinearSet (s i)) → IsSemilinearSet (⋃ i, s i)
theorem IsSemilinearSet.biUnion E1 #
∀ {M : Type u_1} {ι : Type u_3} [inst : AddCommMonoid M] {s : Set ι} {t : ι → Set M},
s.Finite → (∀ i ∈ s, IsSemilinearSet (t i)) → IsSemilinearSet (⋃ i ∈ s, t i)
theorem IsSemilinearSet.biUnion_finset E1 #
∀ {M : Type u_1} {ι : Type u_3} [inst : AddCommMonoid M] {s : Finset ι} {t : ι → Set M},
(∀ i ∈ s, IsSemilinearSet (t i)) → IsSemilinearSet (⋃ i ∈ s, t i)
theorem IsSemilinearSet.of_finite E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s : Set M}, s.Finite → IsSemilinearSet s
theorem IsSemilinearSet.vadd E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s : Set M} (a : M), IsSemilinearSet s → IsSemilinearSet (a +ᵥ s)
theorem IsSemilinearSet.add E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s₁ s₂ : Set M},
IsSemilinearSet s₁ → IsSemilinearSet s₂ → IsSemilinearSet (s₁ + s₂)
Semilinear sets are closed under set addition.
theorem IsSemilinearSet.image E1 #
∀ {M : Type u_1} {N : Type u_2} {F : Type u_5} [inst : AddCommMonoid M] [inst_1 : AddCommMonoid N]
[inst_2 : FunLike F M N] [AddMonoidHomClass F M N] {s : Set M},
IsSemilinearSet s → ∀ (f : F), IsSemilinearSet (⇑f '' s)
The image of a semilinear set under a homomorphism is semilinear.
theorem isSemilinearSet_image_iff E0 #
∀ {M : Type u_1} {N : Type u_2} [inst : AddCommMonoid M] [inst_1 : AddCommMonoid N] {s : Set M} {F : Type u_6}
[inst_2 : EquivLike F M N] [AddEquivClass F M N] (f : F), IsSemilinearSet (⇑f '' s) ↔ IsSemilinearSet s
theorem IsSemilinearSet.proj E1 #
∀ {M : Type u_1} {ι : Type u_3} {κ : Type u_4} [inst : AddCommMonoid M] {s : Set (ι ⊕ κ → M)},
IsSemilinearSet s → IsSemilinearSet {x | ∃ y, Sum.elim x y ∈ s}
Semilinear sets are closed under projection (from ι ⊕ κ → M to ι → M by taking Sum.inl on
the index). It is a special case of IsSemilinearSet.image.
theorem IsSemilinearSet.proj' E1 #
∀ {M : Type u_1} {ι : Type u_3} {κ : Type u_4} [inst : AddCommMonoid M] {p : (ι → M) → (κ → M) → Prop},
IsSemilinearSet {x | p (x ∘ Sum.inl) (x ∘ Sum.inr)} → IsSemilinearSet {x | ∃ y, p x y}
A variant of IsSemilinearSet.proj for backward reasoning.
theorem IsLinearSet.closure E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s : Set M}, IsLinearSet s → IsSemilinearSet ↑(AddSubmonoid.closure s)
theorem IsSemilinearSet.closure E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s : Set M}, IsSemilinearSet s → IsSemilinearSet ↑(AddSubmonoid.closure s)
Semilinear sets are closed under additive closure.
def IsProperLinearSet E3 #
{M : Type u_1} → [AddCommMonoid M] → Set M → Prop
A linear set is proper if its submonoid generators (periods) are linearly independent.
theorem isProperLinearSet_iff E0 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s : Set M},
IsProperLinearSet s ↔ ∃ a t, LinearIndepOn ℕ id ↑t ∧ s = a +ᵥ ↑(AddSubmonoid.closure ↑t)
An equivalent expression of IsProperLinearSet in terms of Finset instead of Set.Finite.
theorem IsProperLinearSet.isLinearSet E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s : Set M}, IsProperLinearSet s → IsLinearSet s
theorem IsProperLinearSet.singleton E0 #
∀ {M : Type u_1} [inst : AddCommMonoid M] (a : M), IsProperLinearSet {a}
def IsProperSemilinearSet E3 #
{M : Type u_1} → [AddCommMonoid M] → Set M → Prop
A semilinear set is proper if it is a finite union of proper linear sets.
theorem isProperSemilinearSet_iff E0 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s : Set M},
IsProperSemilinearSet s ↔ ∃ S, (∀ t ∈ S, IsProperLinearSet t) ∧ s = ⋃₀ ↑S
An equivalent expression of IsProperSemilinearSet in terms of Finset instead of
Set.Finite.
theorem IsProperSemilinearSet.isSemilinearSet E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s : Set M}, IsProperSemilinearSet s → IsSemilinearSet s
theorem IsProperLinearSet.isProperSemilinearSet E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s : Set M}, IsProperLinearSet s → IsProperSemilinearSet s
theorem IsProperSemilinearSet.empty E0 #
∀ {M : Type u_1} [inst : AddCommMonoid M], IsProperSemilinearSet ∅
theorem IsProperSemilinearSet.union E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s₁ s₂ : Set M},
IsProperSemilinearSet s₁ → IsProperSemilinearSet s₂ → IsProperSemilinearSet (s₁ ∪ s₂)
theorem IsProperSemilinearSet.sUnion E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {S : Set (Set M)},
S.Finite → (∀ s ∈ S, IsProperSemilinearSet s) → IsProperSemilinearSet (⋃₀ S)
theorem IsProperSemilinearSet.biUnion E1 #
∀ {M : Type u_1} {ι : Type u_3} [inst : AddCommMonoid M] {s : Set ι} {t : ι → Set M},
s.Finite → (∀ i ∈ s, IsProperSemilinearSet (t i)) → IsProperSemilinearSet (⋃ i ∈ s, t i)
theorem IsProperSemilinearSet.biUnion_finset E1 #
∀ {M : Type u_1} {ι : Type u_3} [inst : AddCommMonoid M] {s : Finset ι} {t : ι → Set M},
(∀ i ∈ s, IsProperSemilinearSet (t i)) → IsProperSemilinearSet (⋃ i ∈ s, t i)
theorem IsLinearSet.isProperSemilinearSet E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s : Set M} [IsCancelAdd M], IsLinearSet s → IsProperSemilinearSet s
theorem IsSemilinearSet.isProperSemilinearSet E3 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {s : Set M} [IsCancelAdd M], IsSemilinearSet s → IsProperSemilinearSet s
The proper decomposition of semilinear sets: every semilinear set is a finite union of proper linear sets.
theorem Nat.isSemilinearSet_iff_ultimately_periodic E3 #
∀ {s : Set ℕ}, IsSemilinearSet s ↔ ∃ k, ∃ p > 0, ∀ x ≥ k, x ∈ s ↔ x + p ∈ s
A set of ℕ is semilinear if and only if it is ultimately periodic, i.e. periodic after some
number k.