Definition KSap i j a b (g : KleeneStore i j (a -> b)) (k : KleeneStore i j a) :
  KleeneStore i j b :=
  kleeneStore (fun v => append_view (P := fun _ => b) (fun v1 v2 => (peek (k:=g) v1) (peek (k:=k) v2)) v)
              (Vector.append (pos g) (pos k)).

Lemma interchange_KSpure i j a b (f : KleeneStore i j (a -> b)) (x : a): KSap f (KSpure i j x) = KSap (KSpure i j (fun f => f x)) f.