Parikh images and semilinear sets

DefinitionParikh vector of a word#βœ“fully proved

The Parikh vector of a word: the function counting, for each letter, how many times it occurs in the word.

def parikhVector (w : List T) [DecidableEq T] : T β†’ β„• :=
  fun a => w.count a
Sources
  • Parikh, "On context-free languages", Journal of the ACM 13 (1966), 570-581.
Used by 6

DefinitionParikh image of a language#βœ“fully proved

The Parikh image of a language: the set of Parikh vectors of its words.

def parikhImage (L : Language T) [DecidableEq T] : Set (T β†’ β„•) :=
  (fun w => parikhVector w) '' L
Sources
  • Parikh, "On context-free languages", Journal of the ACM 13 (1966), 570-581.
Uses 1 Β· Used by 3

TheoremParikh vector of the empty word is zero#βœ“fully proved

The Parikh vector of the empty word is zero.

theorem parikhVector_nil [DecidableEq T] : parikhVector ([] : List T) = 0
Sources
  • Parikh, "On context-free languages", Journal of the ACM 13 (1966), 570-581.
Uses 1

TheoremParikh vectors add over concatenation#βœ“fully proved

Parikh vectors add over concatenation.

theorem parikhVector_append [DecidableEq T] (u v : List T) :
    parikhVector (u ++ v) = parikhVector u + parikhVector v
Sources
  • Parikh, "On context-free languages", Journal of the ACM 13 (1966), 570-581.
Uses 1

TheoremParikh image of a union of languages#βœ“fully proved

The Parikh image of a union is the union of the Parikh images.

theorem parikhImage_union [DecidableEq T] (L M : Language T) :
    parikhImage (L + M) = parikhImage L βˆͺ parikhImage M
Sources
  • Parikh, "On context-free languages", Journal of the ACM 13 (1966), 570-581.
Uses 2

TheoremParikh image of the empty language is empty#βœ“fully proved

The Parikh image of the empty language is empty.

theorem parikhImage_empty [DecidableEq T] :
    parikhImage (0 : Language T) = βˆ…
Sources
  • Parikh, "On context-free languages", Journal of the ACM 13 (1966), 570-581.
Uses 2

TheoremParikh image of a singleton language#βœ“fully proved

The Parikh image of a singleton language is the singleton of the Parikh vector.

theorem parikhImage_singleton [DecidableEq T] (w : List T) :
    parikhImage ({w} : Language T) = {parikhVector w}
Sources
  • Parikh, "On context-free languages", Journal of the ACM 13 (1966), 570-581.
Uses 2

DefinitionLinear combination of period vectors#βœ“fully proved

The linear combination of a list of period vectors with a coefficient list c: pair the two lists position by position and sum the scaled periods, and reject mismatched lengths by returning 0 (the length guard is checked up front, before the recursion, so a shorter coefficient list cannot silently truncate and a longer one cannot silently drop coefficients). Coefficients are indexed by position in P, not by period value, so duplicate periods get independent coefficients: for P = [p, p], linComb P [1, 0] = p, not 2 β€’ p.

def linComb (P : List (T β†’ β„•)) (c : List β„•) : T β†’ β„• :=
  if P.length = c.length then linCombAux P c else 0
where
  /-- The unguarded recursion behind `linComb`: pair the two lists
  position by position. Used only behind the length guard in
  `linComb`, so the two lists have equal length here. -/
  linCombAux : List (T β†’ β„•) β†’ List β„• β†’ T β†’ β„•
    | [], _ => 0
    | _, [] => 0
    | p :: P, n :: c => n β€’ p + linCombAux P c
Sources
  • Parikh, "On context-free languages", Journal of the ACM 13 (1966), 570-581.
Used by 6

TheoremUnguarded linear combination agrees on equal lengths#βœ“fully proved

The unguarded recursion agrees with linComb on equal-length inputs.

theorem linComb_eq_aux_of_length_eq {P : List (T β†’ β„•)} {c : List β„•}
    (h : P.length = c.length) : linComb P c = linComb.linCombAux P c
Sources
  • Parikh, "On context-free languages", Journal of the ACM 13 (1966), 570-581.
Uses 1 Β· Used by 1

TheoremLinear combination with too few coefficients is zero#βœ“fully proved

Mismatched lengths are rejected: a shorter coefficient list does not silently truncate.

theorem linComb_eq_zero_of_length_lt {P : List (T β†’ β„•)} {c : List β„•}
    (h : c.length < P.length) : linComb P c = 0
Sources
  • Parikh, "On context-free languages", Journal of the ACM 13 (1966), 570-581.
Uses 1

TheoremLinear combination with too many coefficients is zero#βœ“fully proved

Mismatched lengths are rejected: a longer coefficient list does not silently drop coefficients.

theorem linComb_eq_zero_of_length_gt {P : List (T β†’ β„•)} {c : List β„•}
    (h : P.length < c.length) : linComb P c = 0
Sources
  • Parikh, "On context-free languages", Journal of the ACM 13 (1966), 570-581.
Uses 1

TheoremDuplicate periods get independent coefficients#βœ“fully proved

Duplicate periods get independent coefficients: with P = [p, p], the coefficients (1, 0) give p.

theorem linComb_dup (p : T β†’ β„•) : linComb [p, p] [1, 0] = p
Sources
  • Parikh, "On context-free languages", Journal of the ACM 13 (1966), 570-581.
Uses 2

DefinitionLinear set of vectors#βœ“fully proved

A set of vectors is linear when it consists of a base vector plus arbitrary nonnegative combinations of finitely many period vectors, with one coefficient per position in the period list.

def IsLinear (S : Set (T β†’ β„•)) : Prop :=
  βˆƒ (b : T β†’ β„•) (P : List (T β†’ β„•)),
    S = {v | βˆƒ c : List β„•, c.length = P.length ∧ v = b + linComb P c}
Sources
  • Parikh, "On context-free languages", Journal of the ACM 13 (1966), 570-581.
Uses 1 Β· Used by 5

DefinitionSemilinear set of vectors#βœ“fully proved

A set of vectors is semilinear when it is a finite union of linear sets.

def IsSemilinear (S : Set (T β†’ β„•)) : Prop :=
  βˆƒ (F : Finset (Set (T β†’ β„•))), (βˆ€ S' ∈ F, IsLinear S') ∧ ⋃₀ F = S
Sources
  • Parikh, "On context-free languages", Journal of the ACM 13 (1966), 570-581.
Uses 1 Β· Used by 4

TheoremA singleton set of vectors is linear#βœ“fully proved

A singleton set of vectors is linear, with no periods.

theorem isLinear_singleton (b : T β†’ β„•) : IsLinear ({b} : Set (T β†’ β„•))
Sources
  • Parikh, "On context-free languages", Journal of the ACM 13 (1966), 570-581.
Uses 2 Β· Used by 1

TheoremLinear sets are semilinear#βœ“fully proved

Linear sets are semilinear.

theorem IsLinear.isSemilinear {S : Set (T β†’ β„•)} (hS : IsLinear S) :
    IsSemilinear S
Sources
  • Parikh, "On context-free languages", Journal of the ACM 13 (1966), 570-581.
Uses 2 Β· Used by 1

TheoremThe empty set is semilinear#βœ“fully proved

The empty set of vectors is semilinear.

theorem isSemilinear_empty : IsSemilinear (βˆ… : Set (T β†’ β„•))
Sources
  • Parikh, "On context-free languages", Journal of the ACM 13 (1966), 570-581.
Uses 2

TheoremA singleton set of vectors is semilinear#βœ“fully proved

A singleton set of vectors is semilinear.

theorem isSemilinear_singleton (b : T β†’ β„•) :
    IsSemilinear ({b} : Set (T β†’ β„•))
Sources
  • Parikh, "On context-free languages", Journal of the ACM 13 (1966), 570-581.
Uses 3

TheoremSemilinear sets are closed under union#βœ“fully proved

Semilinear sets are closed under union.

theorem IsSemilinear.union {S S' : Set (T β†’ β„•)}
    (hS : IsSemilinear S) (hS' : IsSemilinear S') :
    IsSemilinear (S βˆͺ S')
Sources
  • Parikh, "On context-free languages", Journal of the ACM 13 (1966), 570-581.
Uses 2
19 fully proved

The dependency explorer needs JavaScript and its graph data.

Download the complete graph data.