cfahlgren1's picture
download
raw
2.64 kB
14
structure OutputBands where
body · 4 lines
  starts : Finset ℕ
  upper : ℕ → ℕ
  nonempty : ∀ k ∈ starts, k ≤ upper k
  separated : ∀ k ∈ starts, ∀ l ∈ starts, k < l → upper k < l
20
def OutputBands.Allows (B : OutputBands) (x : ℕ) : Prop :=
body · 1 line
  ∃ k ∈ B.starts, k ≤ x ∧ x ≤ B.upper k
23
def OutputBands.label (B : OutputBands) (x : ℕ) : ℕ := by
body · 2 lines
  classical
  exact if h : B.Allows x then Classical.choose h else 0
27
lemma OutputBands.label_spec (B : OutputBands) {x : ℕ} (h : B.Allows x) :
    B.label x ∈ B.starts ∧ B.label x ≤ x ∧ x ≤ B.upper (B.label x) := by
proof · 2 lines
  rw [OutputBands.label,dite_eq_left h]
  exact Classical.choose_spec h
32
lemma OutputBands.unique (B : OutputBands) {x k l : ℕ}
    (hk : k ∈ B.starts) (hl : l ∈ B.starts)
    (hkx : k ≤ x) (hxk : x ≤ B.upper k) (hlx : l ≤ x) (hxl : x ≤ B.upper l) : k = l := by
proof · 6 lines
  rcases lt_trichotomy k l with h | h | h
  · have := B.separated k hk l hl h
    omega
  · exact h
  · have := B.separated l hl k hk h
    omega
42
lemma OutputBands.label_iff (B : OutputBands) {k x : ℕ} (hk : k ∈ B.starts) :
    (B.Allows x ∧ B.label x = k) ↔ x ∈ Set.Icc k (B.upper k) := by
proof · 9 lines
  constructor
  · rintro ⟨hx,hk'⟩
    have h := B.label_spec hx
    rw [hk'] at h
    exact h.2
  · rintro ⟨hkx,hxk⟩
    have hx : B.Allows x := ⟨k,hk,hkx,hxk⟩
    have h := B.label_spec hx
    exact ⟨hx,B.unique h.1 hk h.2.1 h.2.2 hkx hxk⟩
54
lemma OutputBands.ordered (B : OutputBands) {x y : ℕ}
    (hx : B.Allows x) (hy : B.Allows y) (hxy : B.label x < B.label y) : x < y := by
proof · 3 lines
  have hx' := B.label_spec hx
  have hy' := B.label_spec hy
  exact lt_of_le_of_lt hx'.2.2 ((B.separated _ hx'.1 _ hy'.1 hxy).trans_le hy'.2.1)
60
def OutputBands.alphabet (B : OutputBands) (d : ℕ) : Fin (d*d) → Prop :=
body · 1 line
  fun a => B.Allows (output a)
63
def OutputBands.letterLabel (B : OutputBands) (d : ℕ) : Fin (d*d) → ℕ :=
body · 1 line
  fun a => B.label (output a)
66
lemma OutputBands.letter_iff (B : OutputBands) {d k : ℕ} (hk : k ∈ B.starts)
    (a : Fin (d*d)) :
    (B.alphabet d a ∧ B.letterLabel d a = k) ↔ output a ∈ Set.Icc k (B.upper k) :=
proof · 1 line
  B.label_iff hk
71
lemma OutputBands.letter_ordered (B : OutputBands) (d : ℕ) :
    ∀ x y, B.alphabet d x → B.alphabet d y →
      B.letterLabel d x < B.letterLabel d y → output x < output y := by
proof · 2 lines
  intro x y hx hy h
  exact B.ordered hx hy h

Xet Storage Details

Size:
2.64 kB
·
Xet hash:
3689b804d59993e0481135315022c22f6b2d9cfdc53b06b1d0c38d1de562d2ec

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