cfahlgren1/math / lean /OAI /Computability /MinUncut /PCP /PreprocessingRegularLoopWords.lean
cfahlgren1's picture
download
raw
2.31 kB
import Mathlib
import OAI.Computability.MinUncut.Model
namespace OAI
section
namespace MinUncutGames.Foundations.PCP.PreprocessingRegularLoopWords
def blocksPrefix {n : Nat} (f : Fin n → List Bool) (k : Nat) : List Bool :=
((List.ofFn f).take k).flatten
def blocksSuffix {n : Nat} (f : Fin n → List Bool) (k : Nat) : List Bool :=
((List.ofFn f).drop k).flatten
@[simp] theorem blocksPrefix_zero {n : Nat} (f : Fin n → List Bool) :
blocksPrefix f 0 = [] := by
simp only [blocksPrefix, List.take_zero, List.flatten_nil]
@[simp] theorem blocksPrefix_all {n : Nat} (f : Fin n → List Bool) :
blocksPrefix f n = (List.ofFn f).flatten := by
have h : (List.ofFn f).take n = List.ofFn f := by
simpa only [List.length_ofFn] using (List.take_length (l := List.ofFn f))
exact congrArg List.flatten h
theorem blocksPrefix_succ {n : Nat} (f : Fin n → List Bool) (k : Nat) (h : k < n) :
blocksPrefix f (k + 1) = blocksPrefix f k ++ f ⟨k, h⟩ := by
unfold blocksPrefix
rw [List.take_succ_eq_append_getElem
(show k < (List.ofFn f).length by simpa only [List.length_ofFn] using h)]
simp only [List.flatten_append, List.flatten_cons, List.flatten_nil,
List.append_nil, List.getElem_ofFn]
@[simp] theorem blocksSuffix_zero {n : Nat} (f : Fin n → List Bool) :
blocksSuffix f 0 = (List.ofFn f).flatten := by
simp only [blocksSuffix, List.drop_zero]
@[simp] theorem blocksSuffix_all {n : Nat} (f : Fin n → List Bool) :
blocksSuffix f n = [] := by
have h : (List.ofFn f).drop n = [] := by
simpa only [List.length_ofFn] using (List.drop_length (l := List.ofFn f))
exact congrArg List.flatten h
theorem blocksSuffix_succ {n : Nat} (f : Fin n → List Bool) (k : Nat) (h : k < n) :
blocksSuffix f k = f ⟨k, h⟩ ++ blocksSuffix f (k + 1) := by
unfold blocksSuffix
rw [List.drop_eq_getElem_cons
(show k < (List.ofFn f).length by simpa only [List.length_ofFn] using h)]
simp only [List.flatten_cons, List.getElem_ofFn]
theorem blocksPrefix_append_suffix {n : Nat} (f : Fin n → List Bool) (k : Nat) :
blocksPrefix f k ++ blocksSuffix f k = (List.ofFn f).flatten := by
unfold blocksPrefix blocksSuffix
rw [← List.flatten_append, List.take_append_drop]
end MinUncutGames.Foundations.PCP.PreprocessingRegularLoopWords
end
end OAI

Xet Storage Details

Size:
2.31 kB
·
Xet hash:
2bd38618189f4619289e2f50526aecebb4316da50cd431eb253d47b689aac006

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