File: Mathlib/Computability/Language.lean

full_name: Language
code: /-- A language is a set of strings over an alphabet. -/
def Language (α) 
goal: Type u_4

full_name: instMembershipListLanguage
code: instance : Membership (List α) (Language α) 
goal: Membership (List α) (Language α)

full_name: instSingletonListLanguage
code: instance : Singleton (List α) (Language α) 
goal: Singleton (List α) (Language α)

full_name: instInsertListLanguage
code: instance : Insert (List α) (Language α) 
goal: Insert (List α) (Language α)

full_name: instCompleteAtomicBooleanAlgebraLanguage
code: instance : CompleteAtomicBooleanAlgebra (Language α) 
goal: CompleteAtomicBooleanAlgebra (Language α)

full_name: Language.instZero
code: /-- Zero language has no elements. -/
instance : Zero (Language α) 
goal: Zero (Language α)

full_name: Language.instOne
code: /-- `1 : Language α` contains only one element `[]`. -/
instance : One (Language α) 
goal: One (Language α)

full_name: Language.instInhabited
code: instance : Inhabited (Language α) 
goal: Inhabited (Language α)

full_name: Language.instAdd
code: /-- The sum of two languages is their union. -/
instance : Add (Language α) 
goal: Add (Language α)

full_name: Language.instMul
code: /-- The product of two languages `l` and `m` is the language made of the strings `x ++ y` where
`x ∈ l` and `y ∈ m`. -/
instance : Mul (Language α) 
goal: Mul (Language α)

full_name: Language.zero_def
code: theorem zero_def : (0 : Language α) = (∅ : Set _) 
goal: 0 = ∅

full_name: Language.one_def
code: theorem one_def : (1 : Language α) = ({[]} : Set (List α)) 
goal: 1 = {[]}

full_name: Language.add_def
code: theorem add_def (l m : Language α) : l + m = (l ∪ m : Set (List α)) 
goal: l + m = l ∪ m

full_name: Language.mul_def
code: theorem mul_def (l m : Language α) : l * m = image2 (· ++ ·) l m 
goal: l * m = Set.image2 (fun x x_1 => x ++ x_1) l m

full_name: Language.instKStar
code: /-- The Kleene star of a language `L` is the set of all strings which can be written by
concatenating strings from `L`. -/
instance : KStar (Language α) 
goal: KStar (Language α)

full_name: Language.kstar_def
code: lemma kstar_def (l : Language α) : l∗ = {x | ∃ L : List (List α), x = L.join ∧ ∀ y ∈ L, y ∈ l} 
goal: l∗ = {x | ∃ L, x = L.join ∧ ∀ y ∈ L, y ∈ l}

full_name: Language.ext
code: @[ext]
theorem ext {l m : Language α} (h : ∀ (x : List α), x ∈ l ↔ x ∈ m) : l = m 
goal: l = m

full_name: Language.not_mem_zero
code: @[simp]
theorem not_mem_zero (x : List α) : x ∉ (0 : Language α) 
goal: x ∉ 0

full_name: Language.mem_one
code: @[simp]
theorem mem_one (x : List α) : x ∈ (1 : Language α) ↔ x = [] 
goal: x ∈ 1 ↔ x = []

full_name: Language.nil_mem_one
code: theorem nil_mem_one : [] ∈ (1 : Language α) 
goal: [] ∈ 1

full_name: Language.mem_add
code: theorem mem_add (l m : Language α) (x : List α) : x ∈ l + m ↔ x ∈ l ∨ x ∈ m 
goal: x ∈ l + m ↔ x ∈ l ∨ x ∈ m

full_name: Language.mem_mul
code: theorem mem_mul : x ∈ l * m ↔ ∃ a ∈ l, ∃ b ∈ m, a ++ b = x 
goal: x ∈ l * m ↔ ∃ a ∈ l, ∃ b ∈ m, a ++ b = x

full_name: Language.append_mem_mul
code: theorem append_mem_mul : a ∈ l → b ∈ m → a ++ b ∈ l * m 
goal: a ∈ l → b ∈ m → a ++ b ∈ l * m

full_name: Language.mem_kstar
code: theorem mem_kstar : x ∈ l∗ ↔ ∃ L : List (List α), x = L.join ∧ ∀ y ∈ L, y ∈ l 
goal: x ∈ l∗ ↔ ∃ L, x = L.join ∧ ∀ y ∈ L, y ∈ l

full_name: Language.join_mem_kstar
code: theorem join_mem_kstar {L : List (List α)} (h : ∀ y ∈ L, y ∈ l) : L.join ∈ l∗ 
goal: L.join ∈ l∗

full_name: Language.nil_mem_kstar
code: theorem nil_mem_kstar (l : Language α) : [] ∈ l∗ 
goal: [] ∈ l∗

full_name: Language.instSemiring
code: instance instSemiring : Semiring (Language α) 
goal: Semiring (Language α)

full_name: Language.add_self
code: @[simp]
theorem add_self (l : Language α) : l + l = l 
goal: l + l = l

full_name: Language.map
code: /-- Maps the alphabet of a language. -/
def map (f : α → β) : Language α →+* Language β 
goal: Language α →+* Language β

full_name: Language.map_id
code: @[simp]
theorem map_id (l : Language α) : map id l = l 
goal: (Language.map id) l = l

full_name: Language.map_map
code: @[simp]
theorem map_map (g : β → γ) (f : α → β) (l : Language α) : map g (map f l) = map (g ∘ f) l 
goal: (Language.map g) ((Language.map f) l) = (Language.map (g ∘ f)) l

full_name: Language.mem_kstar_iff_exists_nonempty
code: lemma mem_kstar_iff_exists_nonempty {x : List α} :
    x ∈ l∗ ↔ ∃ S : List (List α), x = S.join ∧ ∀ y ∈ S, y ∈ l ∧ y ≠ [] 
goal: x ∈ l∗ ↔ ∃ S, x = S.join ∧ ∀ y ∈ S, y ∈ l ∧ y ≠ []

full_name: Language.kstar_def_nonempty
code: theorem kstar_def_nonempty (l : Language α) :
    l∗ = { x | ∃ S : List (List α), x = S.join ∧ ∀ y ∈ S, y ∈ l ∧ y ≠ [] } 
goal: l∗ = {x | ∃ S, x = S.join ∧ ∀ y ∈ S, y ∈ l ∧ y ≠ []}

full_name: Language.le_iff
code: theorem le_iff (l m : Language α) : l ≤ m ↔ l + m = m 
goal: l ≤ m ↔ l + m = m

full_name: Language.le_mul_congr
code: theorem le_mul_congr {l₁ l₂ m₁ m₂ : Language α} : l₁ ≤ m₁ → l₂ ≤ m₂ → l₁ * l₂ ≤ m₁ * m₂ 
goal: l₁ ≤ m₁ → l₂ ≤ m₂ → l₁ * l₂ ≤ m₁ * m₂

full_name: Language.le_add_congr
code: theorem le_add_congr {l₁ l₂ m₁ m₂ : Language α} : l₁ ≤ m₁ → l₂ ≤ m₂ → l₁ + l₂ ≤ m₁ + m₂ 
goal: l₁ ≤ m₁ → l₂ ≤ m₂ → l₁ + l₂ ≤ m₁ + m₂

full_name: Language.mem_iSup
code: theorem mem_iSup {ι : Sort v} {l : ι → Language α} {x : List α} : (x ∈ ⨆ i, l i) ↔ ∃ i, x ∈ l i 
goal: x ∈ ⨆ i, l i ↔ ∃ i, x ∈ l i

full_name: Language.iSup_mul
code: theorem iSup_mul {ι : Sort v} (l : ι → Language α) (m : Language α) :
    (⨆ i, l i) * m = ⨆ i, l i * m 
goal: (⨆ i, l i) * m = ⨆ i, l i * m

full_name: Language.mul_iSup
code: theorem mul_iSup {ι : Sort v} (l : ι → Language α) (m : Language α) :
    (m * ⨆ i, l i) = ⨆ i, m * l i 
goal: m * ⨆ i, l i = ⨆ i, m * l i

full_name: Language.iSup_add
code: theorem iSup_add {ι : Sort v} [Nonempty ι] (l : ι → Language α) (m : Language α) :
    (⨆ i, l i) + m = ⨆ i, l i + m 
goal: (⨆ i, l i) + m = ⨆ i, l i + m

full_name: Language.add_iSup
code: theorem add_iSup {ι : Sort v} [Nonempty ι] (l : ι → Language α) (m : Language α) :
    (m + ⨆ i, l i) = ⨆ i, m + l i 
goal: m + ⨆ i, l i = ⨆ i, m + l i

full_name: Language.mem_pow
code: theorem mem_pow {l : Language α} {x : List α} {n : ℕ} :
    x ∈ l ^ n ↔ ∃ S : List (List α), x = S.join ∧ S.length = n ∧ ∀ y ∈ S, y ∈ l 
goal: x ∈ l ^ n ↔ ∃ S, x = S.join ∧ S.length = n ∧ ∀ y ∈ S, y ∈ l

full_name: Language.kstar_eq_iSup_pow
code: theorem kstar_eq_iSup_pow (l : Language α) : l∗ = ⨆ i : ℕ, l ^ i 
goal: l∗ = ⨆ i, l ^ i

full_name: Language.map_kstar
code: @[simp]
theorem map_kstar (f : α → β) (l : Language α) : map f l∗ = (map f l)∗ 
goal: (Language.map f) l∗ = ((Language.map f) l)∗

full_name: Language.mul_self_kstar_comm
code: theorem mul_self_kstar_comm (l : Language α) : l∗ * l = l * l∗ 
goal: l∗ * l = l * l∗

full_name: Language.one_add_self_mul_kstar_eq_kstar
code: @[simp]
theorem one_add_self_mul_kstar_eq_kstar (l : Language α) : 1 + l * l∗ = l∗ 
goal: 1 + l * l∗ = l∗

full_name: Language.one_add_kstar_mul_self_eq_kstar
code: @[simp]
theorem one_add_kstar_mul_self_eq_kstar (l : Language α) : 1 + l∗ * l = l∗ 
goal: 1 + l∗ * l = l∗

full_name: Language.instKleeneAlgebra
code: instance : KleeneAlgebra (Language α) 
goal: KleeneAlgebra (Language α)

full_name: Language.reverse
code: /-- Language `l.reverse` is defined as the set of words from `l` backwards. -/
def reverse (l : Language α) : Language α 
goal: Language α

full_name: Language.mem_reverse
code: @[simp]
lemma mem_reverse : a ∈ l.reverse ↔ a.reverse ∈ l 
goal: a ∈ l.reverse ↔ a.reverse ∈ l

full_name: Language.reverse_mem_reverse
code: lemma reverse_mem_reverse : a.reverse ∈ l.reverse ↔ a ∈ l 
goal: a.reverse ∈ l.reverse ↔ a ∈ l

full_name: Language.reverse_eq_image
code: lemma reverse_eq_image (l : Language α) : l.reverse = List.reverse '' l 
goal: l.reverse = List.reverse '' l

full_name: Language.reverse_zero
code: @[simp]
lemma reverse_zero : (0 : Language α).reverse = 0 
goal: Language.reverse 0 = 0

full_name: Language.reverse_one
code: @[simp]
lemma reverse_one : (1 : Language α).reverse = 1 
goal: Language.reverse 1 = 1

full_name: Language.reverse_involutive
code: lemma reverse_involutive : Function.Involutive (reverse : Language α → _) 
goal: Function.Involutive Language.reverse

full_name: Language.reverse_bijective
code: lemma reverse_bijective : Function.Bijective (reverse : Language α → _) 
goal: Function.Bijective Language.reverse

full_name: Language.reverse_injective
code: lemma reverse_injective : Function.Injective (reverse : Language α → _) 
goal: Function.Injective Language.reverse

full_name: Language.reverse_surjective
code: lemma reverse_surjective : Function.Surjective (reverse : Language α → _) 
goal: Function.Surjective Language.reverse

full_name: Language.reverse_reverse
code: @[simp]
lemma reverse_reverse (l : Language α) : l.reverse.reverse = l 
goal: l.reverse.reverse = l

full_name: Language.reverse_add
code: @[simp]
lemma reverse_add (l m : Language α) : (l + m).reverse = l.reverse + m.reverse 
goal: (l + m).reverse = l.reverse + m.reverse

full_name: Language.reverse_mul
code: @[simp]
lemma reverse_mul (l m : Language α) : (l * m).reverse = m.reverse * l.reverse 
goal: (l * m).reverse = m.reverse * l.reverse

full_name: Language.reverse_iSup
code: @[simp]
lemma reverse_iSup {ι : Sort*} (l : ι → Language α) : (⨆ i, l i).reverse = ⨆ i, (l i).reverse 
goal: (⨆ i, l i).reverse = ⨆ i, (l i).reverse

full_name: Language.reverse_iInf
code: @[simp]
lemma reverse_iInf {ι : Sort*} (l : ι → Language α) : (⨅ i, l i).reverse = ⨅ i, (l i).reverse 
goal: (⨅ i, l i).reverse = ⨅ i, (l i).reverse

full_name: Language.reverseIso_apply
code: /-- `Language.reverse` as a ring isomorphism to the opposite ring. -/
@[simps]
def reverseIso : Language α ≃+* (Language α)ᵐᵒᵖ 
goal: (Language.reverseIso α) l = MulOpposite.op l.reverse

full_name: Language.reverseIso_symm_apply
code: /-- `Language.reverse` as a ring isomorphism to the opposite ring. -/
@[simps]
def reverseIso : Language α ≃+* (Language α)ᵐᵒᵖ 
goal: (Language.reverseIso α).symm l' = (MulOpposite.unop l').reverse

full_name: Language.reverseIso
code: /-- `Language.reverse` as a ring isomorphism to the opposite ring. -/
@[simps]
def reverseIso : Language α ≃+* (Language α)ᵐᵒᵖ 
goal: Language α ≃+* (Language α)ᵐᵒᵖ

full_name: Language.reverse_pow
code: @[simp]
lemma reverse_pow (l : Language α) (n : ℕ) : (l ^ n).reverse = l.reverse ^ n 
goal: (l ^ n).reverse = l.reverse ^ n

full_name: Language.reverse_kstar
code: @[simp]
lemma reverse_kstar (l : Language α) : l∗.reverse = l.reverse∗ 
goal: l∗.reverse = l.reverse∗

full_name: Symbol.nonterminal
code: /-- Symbols for use by all kinds of grammars. -/
inductive Symbol (T N : Type*)
  /-- Terminal symbols (of the same type as the language) -/
  | terminal    (t : T) : Symbol T N
  /-- Nonterminal symbols (must not be present at the end of word being generated) -/
  | nonterminal (n : N) : Symbol T N
deriving
  DecidableEq, Repr, Fintype
goal: Symbol T N

full_name: Symbol
code: /-- Symbols for use by all kinds of grammars. -/
inductive Symbol (T N : Type*)
  /-- Terminal symbols (of the same type as the language) -/
  | terminal    (t : T) : Symbol T N
  /-- Nonterminal symbols (must not be present at the end of word being generated) -/
  | nonterminal (n : N) : Symbol T N
deriving
  DecidableEq, Repr, Fintype
goal: Type (max u_1 u_2)

full_name: instFintypeSymbol
code: /-- Symbols for use by all kinds of grammars. -/
inductive Symbol (T N : Type*)
  /-- Terminal symbols (of the same type as the language) -/
  | terminal    (t : T) : Symbol T N
  /-- Nonterminal symbols (must not be present at the end of word being generated) -/
  | nonterminal (n : N) : Symbol T N
deriving
  DecidableEq, Repr, Fintype
goal: {T : Type u_4} → {N : Type u_5} → [inst : Fintype T] → [inst : Fintype N] → Fintype (Symbol T N)

full_name: instReprSymbol
code: /-- Symbols for use by all kinds of grammars. -/
inductive Symbol (T N : Type*)
  /-- Terminal symbols (of the same type as the language) -/
  | terminal    (t : T) : Symbol T N
  /-- Nonterminal symbols (must not be present at the end of word being generated) -/
  | nonterminal (n : N) : Symbol T N
deriving
  DecidableEq, Repr, Fintype
goal: {T : Type u_4} → {N : Type u_5} → [inst : Repr T] → [inst : Repr N] → Repr (Symbol T N)

full_name: Symbol.terminal
code: /-- Symbols for use by all kinds of grammars. -/
inductive Symbol (T N : Type*)
  /-- Terminal symbols (of the same type as the language) -/
  | terminal    (t : T) : Symbol T N
  /-- Nonterminal symbols (must not be present at the end of word being generated) -/
  | nonterminal (n : N) : Symbol T N
deriving
  DecidableEq, Repr, Fintype
goal: Symbol T N