fact
stringlengths
6
3.84k
type
stringclasses
11 values
library
stringclasses
32 values
imports
listlengths
1
14
filename
stringlengths
20
95
symbolic_name
stringlengths
1
90
docstring
stringlengths
7
20k
Produces.trans_derives {u v w : List (Symbol T g.NT)} (huv : g.Produces u v) (hvw : g.Derives v w) : g.Derives u w := huv.single.trans hvw
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
Produces.trans_derives
null
Derives.eq_or_head {u w : List (Symbol T g.NT)} (huw : g.Derives u w) : u = w ∨ ∃ v : List (Symbol T g.NT), g.Produces u v ∧ g.Derives v w := Relation.ReflTransGen.cases_head huw
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
Derives.eq_or_head
null
derives_iff_eq_or_head {u w : List (Symbol T g.NT)} : g.Derives u w ↔ u = w ∨ ∃ v : List (Symbol T g.NT), g.Produces u v ∧ g.Derives v w := Relation.ReflTransGen.cases_head_iff
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
derives_iff_eq_or_head
null
Derives.eq_or_tail {u w : List (Symbol T g.NT)} (huw : g.Derives u w) : w = u ∨ ∃ v : List (Symbol T g.NT), g.Derives u v ∧ g.Produces v w := Relation.ReflTransGen.cases_tail huw
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
Derives.eq_or_tail
null
derives_iff_eq_or_tail {u w : List (Symbol T g.NT)} : g.Derives u w ↔ w = u ∨ ∃ v : List (Symbol T g.NT), g.Derives u v ∧ g.Produces v w := Relation.ReflTransGen.cases_tail_iff g.Produces u w
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
derives_iff_eq_or_tail
null
Produces.append_left {v w : List (Symbol T g.NT)} (hvw : g.Produces v w) (p : List (Symbol T g.NT)) : g.Produces (p ++ v) (p ++ w) := match hvw with | ⟨r, hrmem, hrvw⟩ => ⟨r, hrmem, hrvw.append_left p⟩
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
Produces.append_left
Add extra prefix to context-free producing.
Produces.append_right {v w : List (Symbol T g.NT)} (hvw : g.Produces v w) (p : List (Symbol T g.NT)) : g.Produces (v ++ p) (w ++ p) := match hvw with | ⟨r, hrmem, hrvw⟩ => ⟨r, hrmem, hrvw.append_right p⟩
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
Produces.append_right
Add extra postfix to context-free producing.
Derives.append_left {v w : List (Symbol T g.NT)} (hvw : g.Derives v w) (p : List (Symbol T g.NT)) : g.Derives (p ++ v) (p ++ w) := by induction hvw with | refl => rfl | tail _ last ih => exact ih.trans_produces <| last.append_left p
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
Derives.append_left
Add extra prefix to context-free deriving.
Derives.append_right {v w : List (Symbol T g.NT)} (hvw : g.Derives v w) (p : List (Symbol T g.NT)) : g.Derives (v ++ p) (w ++ p) := by induction hvw with | refl => rfl | tail _ last ih => exact ih.trans_produces <| last.append_right p
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
Derives.append_right
Add extra postfix to context-free deriving.
Produces.exists_nonterminal_input_mem {u v : List (Symbol T g.NT)} (hguv : g.Produces u v) : ∃ r ∈ g.rules, .nonterminal r.input ∈ u := by obtain ⟨w, l, r⟩ := hguv exact ⟨w, l, r.nonterminal_input_mem⟩
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
Produces.exists_nonterminal_input_mem
null
derives_nonterminal {t : g.NT} (hgt : ∀ r ∈ g.rules, r.input ≠ t) (s : List (Symbol T g.NT)) (hs : s ≠ [.nonterminal t]) : ¬g.Derives [.nonterminal t] s := by rw [derives_iff_eq_or_head] push_neg refine ⟨hs.symm, fun _ hx ↦ ?_⟩ have hxr := hx.exists_nonterminal_input_mem simp_rw [List.mem_singleton, Symbol.nonterminal.injEq] at hxr tauto
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
derives_nonterminal
null
language_eq_zero_of_forall_input_ne_initial (hg : ∀ r ∈ g.rules, r.input ≠ g.initial) : g.language = 0 := by ext; simp +contextual [derives_nonterminal, hg]
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
language_eq_zero_of_forall_input_ne_initial
null
Language.IsContextFree (L : Language T) : Prop := ∃ g : ContextFreeGrammar T, g.language = L
def
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
Language.IsContextFree
Context-free languages are defined by context-free grammars.
reverse (r : ContextFreeRule T N) : ContextFreeRule T N := ⟨r.input, r.output.reverse⟩ @[simp] lemma reverse_reverse (r : ContextFreeRule T N) : r.reverse.reverse = r := by simp [reverse] @[simp] lemma reverse_comp_reverse : reverse ∘ reverse = (id : ContextFreeRule T N → ContextFreeRule T N) := by ext : 1; simp
def
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
reverse
Rules for a grammar for a reversed language.
reverse_involutive : Involutive (reverse : ContextFreeRule T N → ContextFreeRule T N) := reverse_reverse
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
reverse_involutive
null
reverse_bijective : Bijective (reverse : ContextFreeRule T N → ContextFreeRule T N) := reverse_involutive.bijective
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
reverse_bijective
null
reverse_injective : Injective (reverse : ContextFreeRule T N → ContextFreeRule T N) := reverse_bijective.injective
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
reverse_injective
null
reverse_surjective : Surjective (reverse : ContextFreeRule T N → ContextFreeRule T N) := reverse_bijective.surjective
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
reverse_surjective
null
protected Rewrites.reverse : ∀ {u v}, r.Rewrites u v → r.reverse.Rewrites u.reverse v.reverse | _, _, head s => by simpa using .append_left .input_output _ | _, _, @cons _ _ _ x u v h => by simpa using h.reverse.append_right _
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
Rewrites.reverse
null
rewrites_reverse : r.reverse.Rewrites u.reverse v.reverse ↔ r.Rewrites u v := ⟨fun h ↦ by simpa using h.reverse, .reverse⟩ @[simp] lemma rewrites_reverse_comm : r.reverse.Rewrites u v ↔ r.Rewrites u.reverse v.reverse := by rw [← rewrites_reverse, reverse_reverse]
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
rewrites_reverse
null
@[simps] reverse (g : ContextFreeGrammar T) : ContextFreeGrammar T := ⟨g.NT, g.initial, g.rules.map (⟨ContextFreeRule.reverse, ContextFreeRule.reverse_injective⟩)⟩ @[simp] lemma reverse_reverse (g : ContextFreeGrammar T) : g.reverse.reverse = g := by simp [reverse, Finset.map_map]
def
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
reverse
Grammar for a reversed language.
reverse_involutive : Involutive (reverse : ContextFreeGrammar T → ContextFreeGrammar T) := reverse_reverse
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
reverse_involutive
null
reverse_bijective : Bijective (reverse : ContextFreeGrammar T → ContextFreeGrammar T) := reverse_involutive.bijective
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
reverse_bijective
null
reverse_injective : Injective (reverse : ContextFreeGrammar T → ContextFreeGrammar T) := reverse_bijective.injective
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
reverse_injective
null
reverse_surjective : Surjective (reverse : ContextFreeGrammar T → ContextFreeGrammar T) := reverse_bijective.surjective
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
reverse_surjective
null
produces_reverse : g.reverse.Produces u.reverse v.reverse ↔ g.Produces u v := (Equiv.ofBijective _ ContextFreeRule.reverse_bijective).exists_congr (by simp [ContextFreeRule.reverse_involutive.eq_iff]) alias ⟨_, Produces.reverse⟩ := produces_reverse @[simp] lemma produces_reverse_comm : g.reverse.Produces u v ↔ g.Produces u.reverse v.reverse := (Equiv.ofBijective _ ContextFreeRule.reverse_bijective).exists_congr (by simp [ContextFreeRule.reverse_involutive.eq_iff])
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
produces_reverse
null
protected Derives.reverse (hg : g.Derives u v) : g.reverse.Derives u.reverse v.reverse := by induction hg with | refl => rfl | tail _ orig ih => exact ih.trans_produces orig.reverse
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
Derives.reverse
null
derives_reverse : g.reverse.Derives u.reverse v.reverse ↔ g.Derives u v := ⟨fun h ↦ by convert h.reverse <;> simp, .reverse⟩ @[simp] lemma derives_reverse_comm : g.reverse.Derives u v ↔ g.Derives u.reverse v.reverse := by rw [iff_comm, ← derives_reverse, List.reverse_reverse, List.reverse_reverse]
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
derives_reverse
null
generates_reverse : g.reverse.Generates u.reverse ↔ g.Generates u := by simp [Generates] alias ⟨_, Generates.reverse⟩ := generates_reverse @[simp] lemma generates_reverse_comm : g.reverse.Generates u ↔ g.Generates u.reverse := by simp [Generates] @[simp] lemma language_reverse : g.reverse.language = g.language.reverse := by ext; simp
lemma
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
generates_reverse
null
Language.IsContextFree.reverse (L : Language T) : L.IsContextFree → L.reverse.IsContextFree := by rintro ⟨g, rfl⟩; exact ⟨g.reverse, by simp⟩
theorem
Computability
[ "Mathlib.Computability.Language" ]
Mathlib/Computability/ContextFreeGrammar.lean
Language.IsContextFree.reverse
The class of context-free languages is closed under reversal.
DFA (α : Type u) (σ : Type v) where /-- A transition function from state to state labelled by the alphabet. -/ step : σ → α → σ /-- Starting state. -/ start : σ /-- Set of acceptance states. -/ accept : Set σ
structure
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
DFA
A DFA is a set of states (`σ`), a transition function from state to state labelled by the alphabet (`step`), a starting state (`start`) and a set of acceptance states (`accept`).
evalFrom (s : σ) : List α → σ := List.foldl M.step s @[simp]
def
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
evalFrom
`M.evalFrom s x` evaluates `M` with input `x` starting from the state `s`.
evalFrom_nil (s : σ) : M.evalFrom s [] = s := rfl @[simp]
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
evalFrom_nil
null
evalFrom_singleton (s : σ) (a : α) : M.evalFrom s [a] = M.step s a := rfl @[simp]
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
evalFrom_singleton
null
evalFrom_append_singleton (s : σ) (x : List α) (a : α) : M.evalFrom s (x ++ [a]) = M.step (M.evalFrom s x) a := by simp only [evalFrom, List.foldl_append, List.foldl_cons, List.foldl_nil]
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
evalFrom_append_singleton
null
eval : List α → σ := M.evalFrom M.start @[simp]
def
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
eval
`M.eval x` evaluates `M` with input `x` starting from the state `M.start`.
eval_nil : M.eval [] = M.start := rfl @[simp]
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
eval_nil
null
eval_singleton (a : α) : M.eval [a] = M.step M.start a := rfl @[simp]
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
eval_singleton
null
eval_append_singleton (x : List α) (a : α) : M.eval (x ++ [a]) = M.step (M.eval x) a := evalFrom_append_singleton _ _ _ _
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
eval_append_singleton
null
evalFrom_of_append (start : σ) (x y : List α) : M.evalFrom start (x ++ y) = M.evalFrom (M.evalFrom start x) y := List.foldl_append
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
evalFrom_of_append
null
acceptsFrom (s : σ) : Language α := {x | M.evalFrom s x ∈ M.accept}
def
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
acceptsFrom
`M.acceptsFrom s` is the language of `x` such that `M.evalFrom s x` is an accept state.
mem_acceptsFrom {s : σ} {x : List α} : x ∈ M.acceptsFrom s ↔ M.evalFrom s x ∈ M.accept := by rfl
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
mem_acceptsFrom
null
accepts : Language α := M.acceptsFrom M.start
def
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
accepts
`M.accepts` is the language of `x` such that `M.eval x` is an accept state.
mem_accepts {x : List α} : x ∈ M.accepts ↔ M.eval x ∈ M.accept := by rfl
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
mem_accepts
null
evalFrom_split [Fintype σ] {x : List α} {s t : σ} (hlen : Fintype.card σ ≤ x.length) (hx : M.evalFrom s x = t) : ∃ q a b c, x = a ++ b ++ c ∧ a.length + b.length ≤ Fintype.card σ ∧ b ≠ [] ∧ M.evalFrom s a = q ∧ M.evalFrom q b = q ∧ M.evalFrom q c = t := by obtain ⟨n, m, hneq, heq⟩ := Fintype.exists_ne_map_eq_of_card_lt (fun n : Fin (Fintype.card σ + 1) => M.evalFrom s (x.take n)) (by simp) wlog hle : (n : ℕ) ≤ m generalizing n m · exact this m n hneq.symm heq.symm (le_of_not_ge hle) refine ⟨M.evalFrom s ((x.take m).take n), (x.take m).take n, (x.take m).drop n, x.drop m, ?_, ?_, ?_, by rfl, ?_⟩ · rw [List.take_append_drop, List.take_append_drop] · simp only [List.length_drop, List.length_take] omega · intro h have hlen' := congr_arg List.length h simp only [List.length_drop, List.length, List.length_take] at hlen' omega have hq : M.evalFrom (M.evalFrom s ((x.take m).take n)) ((x.take m).drop n) = M.evalFrom s ((x.take m).take n) := by rw [List.take_take, min_eq_left hle, ← evalFrom_of_append, heq, ← min_eq_left hle, ← List.take_take, min_eq_left hle, List.take_append_drop] use hq rwa [← hq, ← evalFrom_of_append, ← evalFrom_of_append, ← List.append_assoc, List.take_append_drop, List.take_append_drop]
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
evalFrom_split
null
evalFrom_of_pow {x y : List α} {s : σ} (hx : M.evalFrom s x = s) (hy : y ∈ ({x} : Language α)∗) : M.evalFrom s y = s := by rw [Language.mem_kstar] at hy rcases hy with ⟨S, rfl, hS⟩ induction S with | nil => rfl | cons a S ih => have ha := hS a List.mem_cons_self rw [Set.mem_singleton_iff] at ha rw [List.flatten, evalFrom_of_append, ha, hx] apply ih intro z hz exact hS z (List.mem_cons_of_mem a hz)
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
evalFrom_of_pow
null
pumping_lemma [Fintype σ] {x : List α} (hx : x ∈ M.accepts) (hlen : Fintype.card σ ≤ List.length x) : ∃ a b c, x = a ++ b ++ c ∧ a.length + b.length ≤ Fintype.card σ ∧ b ≠ [] ∧ {a} * {b}∗ * {c} ≤ M.accepts := by obtain ⟨_, a, b, c, hx, hlen, hnil, rfl, hb, hc⟩ := M.evalFrom_split (s := M.start) hlen rfl use a, b, c, hx, hlen, hnil intro y hy rw [Language.mem_mul] at hy rcases hy with ⟨ab, hab, c', hc', rfl⟩ rw [Language.mem_mul] at hab rcases hab with ⟨a', ha', b', hb', rfl⟩ rw [Set.mem_singleton_iff] at ha' hc' substs ha' hc' have h := M.evalFrom_of_pow hb hb' rwa [mem_accepts, eval, evalFrom_of_append, evalFrom_of_append, h, hc]
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
pumping_lemma
null
@[simps] comap (f : α' → α) (M : DFA α σ) : DFA α' σ where step s a := M.step s (f a) start := M.start accept := M.accept @[simp]
def
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
comap
`M.comap f` pulls back the alphabet of `M` along `f`. In other words, it applies `f` to the input before passing it to `M`.
comap_id : M.comap id = M := rfl @[simp]
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
comap_id
null
evalFrom_comap (f : α' → α) (s : σ) (x : List α') : (M.comap f).evalFrom s x = M.evalFrom s (x.map f) := by induction x using List.reverseRecOn with | nil => simp | append_singleton x a ih => simp [ih] @[simp]
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
evalFrom_comap
null
eval_comap (f : α' → α) (x : List α') : (M.comap f).eval x = M.eval (x.map f) := by simp [eval] @[simp]
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
eval_comap
null
accepts_comap (f : α' → α) : (M.comap f).accepts = List.map f ⁻¹' M.accepts := by ext x conv => rhs rw [Set.mem_preimage, mem_accepts] simp [mem_accepts]
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
accepts_comap
null
@[simps apply_step apply_start apply_accept] reindex (g : σ ≃ σ') : DFA α σ ≃ DFA α σ' where toFun M := { step := fun s a => g (M.step (g.symm s) a) start := g M.start accept := g.symm ⁻¹' M.accept } invFun M := { step := fun s a => g.symm (M.step (g s) a) start := g.symm M.start accept := g ⁻¹' M.accept } left_inv M := by simp right_inv M := by simp @[simp]
def
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
reindex
Lifts an equivalence on states to an equivalence on DFAs.
reindex_refl : reindex (Equiv.refl σ) M = M := rfl @[simp]
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
reindex_refl
null
symm_reindex (g : σ ≃ σ') : (reindex (α := α) g).symm = reindex g.symm := rfl @[simp]
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
symm_reindex
null
evalFrom_reindex (g : σ ≃ σ') (s : σ') (x : List α) : (reindex g M).evalFrom s x = g (M.evalFrom (g.symm s) x) := by induction x using List.reverseRecOn with | nil => simp | append_singleton x a ih => simp [ih] @[simp]
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
evalFrom_reindex
null
eval_reindex (g : σ ≃ σ') (x : List α) : (reindex g M).eval x = g (M.eval x) := by simp [eval] @[simp]
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
eval_reindex
null
accepts_reindex (g : σ ≃ σ') : (reindex g M).accepts = M.accepts := by ext x simp [mem_accepts]
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
accepts_reindex
null
comap_reindex (f : α' → α) (g : σ ≃ σ') : (reindex g M).comap f = reindex g (M.comap f) := by simp [comap, reindex]
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
comap_reindex
null
Language.IsRegular {T : Type u} (L : Language T) : Prop := ∃ σ : Type, ∃ _ : Fintype σ, ∃ M : DFA T σ, M.accepts = L
def
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
Language.IsRegular
A regular language is a language that is defined by a DFA with finite states.
private Language.isRegular_iff.helper.{v'} {T : Type u} {L : Language T} (hL : ∃ σ : Type v, ∃ _ : Fintype σ, ∃ M : DFA T σ, M.accepts = L) : ∃ σ' : Type v', ∃ _ : Fintype σ', ∃ M : DFA T σ', M.accepts = L := have ⟨σ, _, M, hM⟩ := hL have ⟨σ', ⟨f⟩⟩ := Small.equiv_small.{v', v} (α := σ) ⟨σ', Fintype.ofEquiv σ f, M.reindex f, hM ▸ DFA.accepts_reindex M f⟩
lemma
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
Language.isRegular_iff.helper.
Lifts the state type `σ` inside `Language.IsRegular` to a different universe.
Language.isRegular_iff {T : Type u} {L : Language T} : L.IsRegular ↔ ∃ σ : Type v, ∃ _ : Fintype σ, ∃ M : DFA T σ, M.accepts = L := ⟨Language.isRegular_iff.helper, Language.isRegular_iff.helper⟩
theorem
Computability
[ "Mathlib.Computability.Language", "Mathlib.Data.Countable.Small", "Mathlib.Data.Fintype.Pigeonhole", "Mathlib.Tactic.NormNum" ]
Mathlib/Computability/DFA.lean
Language.isRegular_iff
A language is regular if and only if it is defined by a DFA with finite states. This is more general than using the definition of `Language.IsRegular` directly, as the state type `σ` is universe-polymorphic.
Encoding (α : Type u) where /-- The alphabet of the encoding -/ Γ : Type v /-- The encoding function -/ encode : α → List Γ /-- The decoding function -/ decode : List Γ → Option α /-- Decoding and encoding are inverses of each other. -/ decode_encode : ∀ x, decode (encode x) = some x
structure
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
Encoding
An encoding of a type in a certain alphabet, together with a decoding.
Encoding.encode_injective {α : Type u} (e : Encoding α) : Function.Injective e.encode := by refine fun _ _ h => Option.some_injective _ ?_ rw [← e.decode_encode, ← e.decode_encode, h]
theorem
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
Encoding.encode_injective
null
FinEncoding (α : Type u) extends Encoding.{u, 0} α where /-- The alphabet of the encoding is finite -/ ΓFin : Fintype Γ
structure
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
FinEncoding
An encoding plus a guarantee of finiteness of the alphabet.
Γ.fintype {α : Type u} (e : FinEncoding α) : Fintype e.toEncoding.Γ := e.ΓFin
instance
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
Γ.fintype
null
Γ' | blank | bit (b : Bool) | bra | ket | comma deriving DecidableEq, Fintype
inductive
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
Γ'
A standard Turing machine alphabet, consisting of blank,bit0,bit1,bra,ket,comma.
inhabitedΓ' : Inhabited Γ' := ⟨Γ'.blank⟩
instance
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
inhabitedΓ'
null
inclusionBoolΓ' : Bool → Γ' := Γ'.bit
def
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
inclusionBoolΓ'
The natural inclusion of bool in Γ'.
sectionΓ'Bool : Γ' → Bool | Γ'.bit b => b | _ => Inhabited.default @[simp]
def
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
sectionΓ'Bool
An arbitrary section of the natural inclusion of bool in Γ'.
sectionΓ'Bool_inclusionBoolΓ' {b} : sectionΓ'Bool (inclusionBoolΓ' b) = b := by cases b <;> rfl
theorem
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
sectionΓ'Bool_inclusionBoolΓ'
null
inclusionBoolΓ'_injective : Function.Injective inclusionBoolΓ' := Function.HasLeftInverse.injective ⟨_, (fun _ => sectionΓ'Bool_inclusionBoolΓ')⟩
theorem
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
inclusionBoolΓ'_injective
null
encodePosNum : PosNum → List Bool | PosNum.one => [true] | PosNum.bit0 n => false :: encodePosNum n | PosNum.bit1 n => true :: encodePosNum n
def
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
encodePosNum
An encoding function of the positive binary numbers in bool.
encodeNum : Num → List Bool | Num.zero => [] | Num.pos n => encodePosNum n
def
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
encodeNum
An encoding function of the binary numbers in bool.
encodeNat (n : ℕ) : List Bool := encodeNum n
def
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
encodeNat
An encoding function of ℕ in bool.
decodePosNum : List Bool → PosNum | false :: l => PosNum.bit0 (decodePosNum l) | true :: l => ite (l = []) PosNum.one (PosNum.bit1 (decodePosNum l)) | _ => PosNum.one
def
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
decodePosNum
A decoding function from `List Bool` to the positive binary numbers.
decodeNum : List Bool → Num := fun l => ite (l = []) Num.zero <| decodePosNum l
def
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
decodeNum
A decoding function from `List Bool` to the binary numbers.
decodeNat : List Bool → Nat := fun l => decodeNum l
def
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
decodeNat
A decoding function from `List Bool` to ℕ.
encodePosNum_nonempty (n : PosNum) : encodePosNum n ≠ [] := PosNum.casesOn n (List.cons_ne_nil _ _) (fun _m => List.cons_ne_nil _ _) fun _m => List.cons_ne_nil _ _ @[simp] theorem decode_encodePosNum (n) : decodePosNum (encodePosNum n) = n := by induction n with unfold encodePosNum decodePosNum | one => rfl | bit1 m hm => rw [hm] exact if_neg (encodePosNum_nonempty m) | bit0 m hm => exact congr_arg PosNum.bit0 hm @[simp] theorem decode_encodeNum (n) : decodeNum (encodeNum n) = n := by obtain - | n := n <;> unfold encodeNum decodeNum · rfl rw [decode_encodePosNum n] rw [PosNum.cast_to_num] exact if_neg (encodePosNum_nonempty n) @[simp] theorem decode_encodeNat (n) : decodeNat (encodeNat n) = n := by conv_rhs => rw [← Num.to_of_nat n] exact congr_arg ((↑) : Num → ℕ) (decode_encodeNum n)
theorem
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
encodePosNum_nonempty
null
encodingNatBool : Encoding ℕ where Γ := Bool encode := encodeNat decode n := some (decodeNat n) decode_encode n := congr_arg _ (decode_encodeNat n)
def
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
encodingNatBool
A binary encoding of ℕ in bool.
finEncodingNatBool : FinEncoding ℕ := ⟨encodingNatBool, Bool.fintype⟩
def
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
finEncodingNatBool
A binary fin_encoding of ℕ in bool.
encodingNatΓ' : Encoding ℕ where Γ := Γ' encode x := List.map inclusionBoolΓ' (encodeNat x) decode x := some (decodeNat (List.map sectionΓ'Bool x)) decode_encode x := congr_arg _ <| by simp [Function.comp_def]
def
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
encodingNatΓ'
A binary encoding of ℕ in Γ'.
finEncodingNatΓ' : FinEncoding ℕ := ⟨encodingNatΓ', inferInstanceAs (Fintype Γ')⟩
def
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
finEncodingNatΓ'
A binary FinEncoding of ℕ in Γ'.
unaryEncodeNat : Nat → List Bool | 0 => [] | n + 1 => true :: unaryEncodeNat n
def
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
unaryEncodeNat
A unary encoding function of ℕ in bool.
unaryDecodeNat : List Bool → Nat := List.length @[simp] theorem unary_decode_encode_nat : ∀ n, unaryDecodeNat (unaryEncodeNat n) = n := fun n => Nat.rec rfl (fun (_m : ℕ) hm => (congr_arg Nat.succ hm.symm).symm) n
def
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
unaryDecodeNat
A unary decoding function from `List Bool` to ℕ.
unaryFinEncodingNat : FinEncoding ℕ where Γ := Bool encode := unaryEncodeNat decode n := some (unaryDecodeNat n) decode_encode n := congr_arg _ (unary_decode_encode_nat n) ΓFin := Bool.fintype
def
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
unaryFinEncodingNat
A unary fin_encoding of ℕ.
encodeBool : Bool → List Bool := pure
def
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
encodeBool
An encoding function of bool in bool.
decodeBool : List Bool → Bool | b :: _ => b | _ => Inhabited.default @[simp] theorem decode_encodeBool (b : Bool) : decodeBool (encodeBool b) = b := rfl
def
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
decodeBool
A decoding function from `List Bool` to bool.
finEncodingBoolBool : FinEncoding Bool where Γ := Bool encode := encodeBool decode x := some (decodeBool x) decode_encode x := congr_arg _ (decode_encodeBool x) ΓFin := Bool.fintype
def
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
finEncodingBoolBool
A fin_encoding of bool in bool.
inhabitedFinEncoding : Inhabited (FinEncoding Bool) := ⟨finEncodingBoolBool⟩
instance
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
inhabitedFinEncoding
null
inhabitedEncoding : Inhabited (Encoding Bool) := ⟨finEncodingBoolBool.toEncoding⟩
instance
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
inhabitedEncoding
null
Encoding.card_le_card_list {α : Type u} (e : Encoding.{u, v} α) : Cardinal.lift.{v} #α ≤ Cardinal.lift.{u} #(List e.Γ) := Cardinal.lift_mk_le'.2 ⟨⟨e.encode, e.encode_injective⟩⟩
theorem
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
Encoding.card_le_card_list
null
Encoding.card_le_aleph0 {α : Type u} (e : Encoding.{u, v} α) [Countable e.Γ] : #α ≤ ℵ₀ := haveI : Countable α := e.encode_injective.countable Cardinal.mk_le_aleph0
theorem
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
Encoding.card_le_aleph0
null
FinEncoding.card_le_aleph0 {α : Type u} (e : FinEncoding α) : #α ≤ ℵ₀ := e.toEncoding.card_le_aleph0
theorem
Computability
[ "Mathlib.Data.Fintype.Basic", "Mathlib.Data.Num.Lemmas", "Mathlib.Data.Option.Basic", "Mathlib.SetTheory.Cardinal.Basic", "Mathlib.Tactic.DeriveFintype" ]
Mathlib/Computability/Encoding.lean
FinEncoding.card_le_aleph0
null
εNFA (α : Type u) (σ : Type v) where /-- Transition function. The automaton is rendered non-deterministic by this transition function returning `Set σ` (rather than `σ`), and ε-transitions are made possible by taking `Option α` (rather than `α`). -/ step : σ → Option α → Set σ /-- Starting states. -/ start : Set σ /-- Set of acceptance states. -/ accept : Set σ variable {α : Type u} {σ : Type v} (M : εNFA α σ) {S : Set σ} {s t u : σ} {a : α}
structure
Computability
[ "Mathlib.Computability.NFA", "Mathlib.Data.List.ReduceOption" ]
Mathlib/Computability/EpsilonNFA.lean
εNFA
An `εNFA` is a set of states (`σ`), a transition function from state to state labelled by the alphabet (`step`), a starting state (`start`) and a set of acceptance states (`accept`). Note the transition function sends a state to a `Set` of states and can make ε-transitions by inputting `none`. Since this definition allows for Automata with infinite states, a `Fintype` instance must be supplied for true `εNFA`'s.
εClosure (S : Set σ) : Set σ | base : ∀ s ∈ S, εClosure S s | step : ∀ (s), ∀ t ∈ M.step s none, εClosure S s → εClosure S t @[simp]
inductive
Computability
[ "Mathlib.Computability.NFA", "Mathlib.Data.List.ReduceOption" ]
Mathlib/Computability/EpsilonNFA.lean
εClosure
The `εClosure` of a set is the set of states which can be reached by taking a finite string of ε-transitions from an element of the set.
subset_εClosure (S : Set σ) : S ⊆ M.εClosure S := εClosure.base @[simp]
theorem
Computability
[ "Mathlib.Computability.NFA", "Mathlib.Data.List.ReduceOption" ]
Mathlib/Computability/EpsilonNFA.lean
subset_εClosure
null
εClosure_empty : M.εClosure ∅ = ∅ := eq_empty_of_forall_notMem fun s hs ↦ by induction hs <;> assumption @[simp]
theorem
Computability
[ "Mathlib.Computability.NFA", "Mathlib.Data.List.ReduceOption" ]
Mathlib/Computability/EpsilonNFA.lean
εClosure_empty
null
εClosure_univ : M.εClosure univ = univ := eq_univ_of_univ_subset <| subset_εClosure _ _
theorem
Computability
[ "Mathlib.Computability.NFA", "Mathlib.Data.List.ReduceOption" ]
Mathlib/Computability/EpsilonNFA.lean
εClosure_univ
null
mem_εClosure_iff_exists : s ∈ M.εClosure S ↔ ∃ t ∈ S, s ∈ M.εClosure {t} where mp h := by induction h with | base => tauto | step _ _ _ _ ih => obtain ⟨s, _, _⟩ := ih use s solve_by_elim [εClosure.step] mpr := by intro ⟨t, _, h⟩ induction h <;> subst_vars <;> solve_by_elim [εClosure.step]
theorem
Computability
[ "Mathlib.Computability.NFA", "Mathlib.Data.List.ReduceOption" ]
Mathlib/Computability/EpsilonNFA.lean
mem_εClosure_iff_exists
null