cfahlgren1/math / lean /ComparatorChallenges /TwoWayComplementation.lean
cfahlgren1's picture
download
raw
1.45 kB
import Mathlib
namespace OAI
namespace TwoWayComplementation
open scoped SetRel
def relStar {α : Type*} (R : SetRel α α) : SetRel α α :=
{(x, y) | Relation.ReflTransGen (fun a b => (a, b) ∈ R) x y}
structure TwoNFA (Sigma Q : Type*) where
initial : Q
accepting : Set Q
transition : Q → (Fin 2 ⊕ Sigma) → Set (Q × Fin 3)
def tapeSymbol {Sigma : Type*} (w : List Sigma) (p : Fin (w.length + 2)) : Fin 2 ⊕ Sigma :=
if hleft : p.val = 0 then .inl 0
else if hright : p.val = w.length + 1 then .inl 1
else .inr (w[p.val - 1]'(by omega))
namespace TwoNFA
def step {Sigma Q : Type*} (A : TwoNFA Sigma Q) (w : List Sigma) :
SetRel (Q × Fin (w.length + 2)) (Q × Fin (w.length + 2)) :=
{(c, d) | ∃ move : Fin 3,
(d.1, move) ∈ A.transition c.1 (tapeSymbol w c.2) ∧
(d.2.val : ℤ) = (c.2.val : ℤ) + (move.val : ℤ) - 1}
def language {Sigma Q : Type*} (A : TwoNFA Sigma Q) : Set (List Sigma) :=
{w | ∃ c, c.1 ∈ A.accepting ∧
((A.initial, ⟨0, by omega⟩), c) ∈ relStar (A.step w)}
end TwoNFA
theorem complementation_lower_bound_finite (n : ℕ) (hn : 4 ≤ n) :
∃ A : TwoNFA (SetRel (Fin (n - 2)) (Fin (n - 2))) (Fin n),
∀ (Q : Type*) [Fintype Q], ∀ B : TwoNFA (SetRel (Fin (n - 2)) (Fin (n - 2))) Q,
B.language = A.languageᶜ →
(1 / 2 : ℝ) * 2 ^ ((n - 4) / 127) - 1 ≤ (Fintype.card Q : ℝ) := by
sorry
end TwoWayComplementation
end OAI

Xet Storage Details

Size:
1.45 kB
·
Xet hash:
e31bdd39a97aa2d797952eeca207c48e2132df277877288fd09701698dc990f8

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.