NLA-lib Explorer

NLAlib.SmallEig.oneEigRound_good

Library · theorem

One round of NLAlib.SmallEig.oneEig (NLAlib.SmallEig.oneEigRound) with the scratch from L when its sample is good: on a scalar machine with index literals, the literals 0 and 1 exact, exact comparisons and an exact polar sampler on the stream sU, with DistSpec accurate on a set \mathbf{P} holding the six candidates NLAlib.SmallEig.oneEigPointWord of the estimate \tau at Tau, the computed directions, the point s at Lam and the polar sample w of the window at the current position (radius word r at qw[4]), if 1.1 times the distance of some candidate is at most \theta and \theta is below the bar \mathrm{fl}(\tau k_0) (k_0 at K[0]), then the round writes only Lam and the scratch, and stores at Lam a candidate and at Tau an estimate at most \theta and within 10\% of its distance.

NLAlib.SmallEig.oneEigRound_good {O Q : Type} [Ops.Has Ops.ScalarOp O] [Ops.Has Ops.IndexOp O]
  [Ops.Has ShiftedQR.DiskSampleOp O] [Ops.Has Ops.CmpTst Q] {M : Ops.Machine ℝ}
  {I : Ops.Interp O Q ℝ} (hS : Ops.IsScalar M I) (hL : Ops.IsIndexLit M I) (h0 : M.lit 0 = 0)
  (h1 : M.lit 1 = 1) (hCmp : Ops.IsCmp id I) {sU : ℕ} (hDisk : ShiftedQR.IsPolarDiskSampler sU I)
  {n m q L : ℕ} {H : Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ} {d : Fin (n + 1) → ℂ} {P : Set ℂ}
  (hDS : SmallEig.DistSpecAccurateOn I H d m q P) {τ : Ops.Tape ℝ} {μ : Ops.Mem ℝ}
  {h qw lam f : ℕ × ℕ} (hh : h.1 < L) (hqw : qw.1 < L) (hlam : lam.1 < L) (hf : f.1 < L)
  (hlen : List.length μ.store = L + 7) (hl0 : μ.store.len L = 1) (hl1 : μ.store.len (L + 1) = 2)
  (hl2 : μ.store.len (L + 2) = 2) (hl3 : μ.store.len (L + 3) = 1) (hl4 : μ.store.len (L + 4) = 3)
  (hl6 : μ.store.len (L + 6) = 2) (hroom : lam.2 + 2 ≤ μ.store.len lam.1)
  (hH : HoldsMatrix h H μ.store) {r t₀ k₀ θ : ℝ} {s : ℂ}
  (hq4 : μ.store.get qw.1 (qw.2 + 4) = some r) (hT : μ.store.get L 0 = some t₀)
  (hD : ∀ i < 12, μ.store.get (L + 5) i = some (SmallEig.oneEigDirWords M i))
  (hK0 : μ.store.get (L + 6) 0 = some k₀) (hs : μ.store.readBlock lam.1 lam.2 2 = some [s.re, s.im])
  (hP :
    ∀ j < 6,
      SmallEig.oneEigPointWord M t₀ (SmallEig.oneEigDir M j) s
          (polarDisk 0 r (τ.windowFn sU μ.pos 2)) ∈
        P)
  (hcov :
    ∃ j < 6,
      1.1 *
          ⨅ i,
            ‖SmallEig.oneEigPointWord M t₀ (SmallEig.oneEigDir M j) s
                  (polarDisk 0 r (τ.windowFn sU μ.pos 2)) -
                d i‖ ≤
        θ)
  (hθ : θ < M.mul t₀ k₀) :
  Ops.Writes Ops.Mode.total I τ SmallEig.oneEigRound
    (Ops.Env.frame [n + 1, m, q]
      [h, qw, (L + 5, 0), lam, (L, 0), f, (L + 1, 0), (L + 2, 0), (L + 3, 0), (L + 4, 0),
        (L + 6, 0)])
    (Ops.Store.inBlock lam.1 lam.2 2 ⊔ Ops.Fp.above L)
    (fun μ' ↦
      (∃ j < 6,
          μ'.store.readBlock lam.1 lam.2 2 =
              some
                [(SmallEig.oneEigPointWord M t₀ (SmallEig.oneEigDir M j) s
                      (polarDisk 0 r (τ.windowFn sU μ.pos 2))).re,
                  (SmallEig.oneEigPointWord M t₀ (SmallEig.oneEigDir M j) s
                      (polarDisk 0 r (τ.windowFn sU μ.pos 2))).im] ∧
            ∃ b,
              μ'.store.get L 0 = some b ∧
                b ≤ θ ∧
                  0.9 *
                        ⨅ i,
                          ‖SmallEig.oneEigPointWord M t₀ (SmallEig.oneEigDir M j) s
                                (polarDisk 0 r (τ.windowFn sU μ.pos 2)) -
                              d i‖ ≤
                      b ∧
                    b ≤
                      1.1 *
                        ⨅ i,
                          ‖SmallEig.oneEigPointWord M t₀ (SmallEig.oneEigDir M j) s
                                (polarDisk 0 r (τ.windowFn sU μ.pos 2)) -
                              d i‖) ∧
        (∀ i < 12, μ'.store.get (L + 5) i = some (SmallEig.oneEigDirWords M i)) ∧
          μ'.store.get (L + 6) 0 = some k₀)
    μ

Full source on GitHub

Import NLAlib.Eigensolvers.SmallEig.OneEigParts.