NLA-lib Explorer

NLAlib.ShiftedQR.stepWithDiag_writes_of_inv

Library · theorem

The memory of the step: on a scalar machine with exact comparisons and the literal 0 exact, if a property Inv of the rounds (NLAlib.ShiftedQR.KeptByRound) holds of the machine shift (NLAlib.ShiftedQR.machineShiftedPrefix) and \mathbf{H}, then stepWithDiag appends n entries with planes below n to the pending slot of the log, and ends with a working matrix and an output satisfying Inv after n rounds: the output with its fill deleted (NLAlib.upperHessenbergPart) at z, the last working diagonal entry at dg. A fragment of the tree NLAlib.ShiftedQR.stepWithDiagInPlace.

NLAlib.ShiftedQR.stepWithDiag_writes_of_inv {Op Tst : Type} [Ops.Has Ops.ScalarOp Op]
  [Ops.Has Ops.IndexOp Op] [Ops.Has Ops.CmpTst Tst] {M : Ops.Machine ℝ} {I : Ops.Interp Op Tst ℝ}
  (hS : Ops.IsScalar M I) (hzero : M.lit 0 = 0) (hCmp : Ops.IsCmp id I) (hL : Ops.IsIndexLit M I)
  {nmax : ℕ} (hNat : Ops.IsExactNatLit id M nmax) {τ : Ops.Tape ℝ} {m : Ops.Mem ℝ} {n : ℕ}
  {a s z dg lg : ℕ × ℕ} {H : Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ} {shift : ℂ} (hn : n ≤ nmax)
  {ns w : ℕ} {L : List (Option (List GivensEntry))} {P : List GivensEntry}
  (hlog : HoldsSlottedLog lg ns w L P m.store) (hj : L.length < ns) (hw : P.length + n ≤ w)
  (hl : m.Live [a, s, z, dg, lg]) (hA : HoldsMatrix a H m.store)
  (hs : m.store.readBlock s.1 s.2 2 = some [shift.re, shift.im])
  (hz : z.2 + 2 * ((n + 1) * (n + 1)) ≤ m.store.len z.1) (hd : dg.2 + 2 ≤ m.store.len dg.1)
  (haz :
    Ops.Fp.Disj (Ops.Store.inBlock a.1 a.2 (2 * ((n + 1) * (n + 1))))
      (Ops.Store.inBlock z.1 z.2 (2 * ((n + 1) * (n + 1)))))
  (hsz :
    Ops.Fp.Disj (Ops.Store.inBlock s.1 s.2 2) (Ops.Store.inBlock z.1 z.2 (2 * ((n + 1) * (n + 1)))))
  (hzd :
    Ops.Fp.Disj (Ops.Store.inBlock z.1 z.2 (2 * ((n + 1) * (n + 1))))
      (Ops.Store.inBlock dg.1 dg.2 2))
  (hlgd :
    Ops.Fp.Disj (Ops.Store.inBlock lg.1 lg.2 (ns * (1 + 5 * w)))
      (Ops.Store.inBlock a.1 a.2 (2 * ((n + 1) * (n + 1))) ⊔ Ops.Store.inBlock s.1 s.2 2 ⊔
          Ops.Store.inBlock z.1 z.2 (2 * ((n + 1) * (n + 1))) ⊔
        Ops.Store.inBlock dg.1 dg.2 2))
  {Inv :
    ℕ →
      List GivensEntry →
        Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ → Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ → Prop}
  (hInv : ∀ (r : ℕ), ShiftedQR.KeptByRound M Inv r)
  (h0 : Inv 0 [] (ShiftedQR.machineShiftedPrefix M H shift (n + 1)) H) :
  Ops.Writes Ops.Mode.total I τ ShiftedQR.stepWithDiag
    (Ops.Env.frame [n + 1, w, L.length, P.length] [a, s, z, dg, lg])
    (Ops.Store.inBlock z.1 z.2 (2 * ((n + 1) * (n + 1))) ⊔ Ops.Store.inBlock dg.1 dg.2 2 ⊔
      Ops.Store.inBlock lg.1 lg.2 (ns * (1 + 5 * w)))
    (fun m' ↦
      m'.pos = m.pos ∧
        ∃ es,
          es.length = n ∧
            (∀ e ∈ es, e.1 + 1 < n + 1) ∧
              HoldsSlottedLog lg ns w L (P ++ es) m'.store ∧
                ∃ W Z,
                  Inv n es W Z ∧
                    HoldsMatrix z (upperHessenbergPart Z) m'.store ∧
                      m'.store.readBlock dg.1 dg.2 2 =
                        some [(W (Fin.last n) (Fin.last n)).re, (W (Fin.last n) (Fin.last n)).im])
    m

Full source on GitHub

Import NLAlib.Eigensolvers.ShiftedQR.StableStep.