File size: 2,979 Bytes
6fe30b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import OAI.Computability.FourierTransform.ChunkCompiler
import OAI.Computability.FourierTransform.WordCompilation

namespace OAI

namespace PowerSaving.RAM
open Ty Slant Slant.Stroke Spectral
noncomputable section

universe U
namespace Bench.Engrave

variable {m : Bool} {ι : Type U} {b : Bench m ι}
    {n l k : ι→ℕ}

lemma strand (h : b.Digit n) (hk : b.Digit k) (hl : b.Digit l)
    (r : ι→ℕ→Reel) (H : (b.scan l).Engrave (fun i => n i.i) (fun i => r i.i i.j))
    (g : ∀ i, ∀ j<l i, (r i j).beats=k i) :
    b.Engrave n fun i => Slant.strand (r i) (l i) := by
  let R i j := Slant.strand (r i) j
  have hb (i : ι) (j : ℕ) (hj : j ≤ l i) : (R i j).beats=j*k i :=
    beat_strand j _ (fun t ht => g i t (ht.trans_le hj))
  have hs (i : ι) (j : ℕ) (hj : j ≤ l i) : (R i j).Sound (n i) :=
    sound_strand _ _ fun t ht => H.sound ⟨i,t,ht.trans_le hj⟩
  refine ⟨fun i => hs i _ le_rfl, (hl.mul hk).congr (fun i => (hb i _ le_rfl).symm),h,?_⟩
  let U i j := film (n i) (R i j)
  refine loop (t:=filmTy) hl U ?_ ?_
  · exact (Engrave.rest h (Digit.wc 0)).layers
  · let P := b.climbs l filmTy U
    have F := Feeds.climbs b l U
    have hj := stepi hl U -- specify
    have hg : P.Engrave (fun i => n i.i) (fun i => R i.i i.j) :=
      ⟨fun i => hs i.i i.j i.hj.le, ((hj.mul (draw F hk)).congr (fun i => (hb i.i i.j i.hj.le).symm)),
        draw F h,stepsum b l U⟩
    exact (hg.stack (H.transfer (inspect b l U))).layers

/-- nesting scans for 3 chunk coordinates. -/
abbrev double (b : Bench m ι) (l : ι→ℕ) :=
  (b.scan l).scan fun i => l i.i
abbrev triple (b : Bench m ι) (l : ι→ℕ) :=
  (double b l).scan fun i => l i.i.i

private lemma duoStrand (h : b.Digit n) (hk : b.Digit k) (hl : b.Digit l)
    (r : ι→ℕ→ℕ→Reel)
    (H : (double b l).Engrave (fun i => n i.i.i) (fun i => r i.i.i i.i.j i.j))
    (g : ∀ i, ∀ j<l i, ∀ s<l i, (r i j s).beats=k i) :
    b.Engrave n fun i => Slant.strand (fun j => Slant.strand (r i j) (l i)) (l i) := by
  have F := Feeds.scan b l
  apply strand h (hl.mul hk) hl (fun i j => Slant.strand (r i j) (l i))
  · exact strand (draw F h) (draw F hk) (draw F hl) (fun i => r i.i i.j) H
      (fun i => g i.i i.j i.hj)
  · exact fun i j hj => beat_strand _ _ (g i j hj)

lemma riprap (h : b.Digit n) (hk : b.Digit k) (hl : b.Digit l)
    (r : ι→ℕ→ℕ→ℕ→Reel)
    (H : (triple b l).Engrave (fun i => n i.i.i.i) (fun i => r i.i.i.i i.i.i.j i.i.j i.j))
    (g : ∀ i, ∀ j<l i, ∀ s<l i, ∀ t<l i, (r i j s t).beats=k i) :
    b.Engrave n fun i => Slant.riprap (r i) (l i) := by
  have F := Feeds.scan b l
  exact strand h (hl.mul (hl.mul hk)) hl
    (fun i j => Slant.strand (fun s => Slant.strand (r i j s) (l i)) (l i))
    (duoStrand (draw F h) (draw F hk) (draw F hl) (fun i => r i.i i.j) H
      (fun i => g i.i i.j i.hj)) (fun i j hj =>
      beat_strand _ _ (fun s hs => beat_strand _ _ (g i j hj s hs)))

end Bench.Engrave
end
end PowerSaving.RAM

end OAI