TITLE: Cauchy-Schwarz inequality for bilinear forms valued in an abstract vector space
QUESTION [7 upvotes]: I previously posted this question on Math.SE but didn't receive an answer.  It is perhaps a little vague; part of what I want to know is what question I should ask.
First, consider the following form of the Cauchy-Schwarz inequality: let $V$ be a real vector space, and suppose $(\cdot, \cdot) : V \times V \to \mathbb{R}$ is a symmetric bilinear form which is positive semidefinite, that is, $(x,x) \ge 0$ for all $x$.  Then for any $x,y \in V$ we have $|(x,y)|^2 \le (x,x) (y,y)$.   
I'd like to know what happens if we replace $\mathbb{R}$ by some other space $W$.  Suppose at first that $W$ is a real vector space, equipped with a partial order $\le$ that makes it an an ordered vector space, as well as a multiplication operation $\cdot$ that makes it an algebra.  Then it makes sense to speak of a positive semidefinite symmetric bilinear form $(\cdot, \cdot) : V \times V \to W$, and ask whether it satisfies the Cauchy-Schwarz inequality $(v,w)\cdot(v,w) \le (v,v) \cdot (w,w)$.

Under what conditions on $W$ does this "generalized Cauchy-Schwarz inequality" hold?

At a minimum I expect we will need some more structure on $W$; in particular I assume we would like the multiplication and the partial ordering in $W$ to interact in some reasonable way, so that for instance $w\cdot w \ge 0$ for all $w \in W$.  Are there other properties that $W$ should have?
There are lots of proofs of the classical Cauchy-Schwarz inequality; presumably one should try to find one of them which generalizes.  But I couldn't immediately see how to do this.

My motivating example is the quadratic variation form from probability. For instance, we could take $V$ to be the vector space of continuous $L^2$ martingales on some filtered probability space over some time interval $[0,T]$, and $W$ to be the vector space of continuous adapted processes of bounded variation, mod indistinguishability, with pointwise multiplication and the partial order $X \le Y$ iff $X_t \le Y_t$ for all $t$ almost surely. Then the quadratic variation $\langle M,N \rangle$ is a symmetric positive semidefinite bilinear form from $V \times V$ to $W$.  
In this case I can prove the Cauchy-Schwarz inequality pointwise: fix $M,N \in V$.  For almost every $\omega$, for all $t \in [0,T]$ and all $q \in \mathbb{Q}$ I can say
$$q^2 \langle M,M \rangle_t(\omega) \pm 2 \langle M,N \rangle_t(\omega) + \frac{1}{q^2} \langle N,N \rangle_t(\omega) = \langle q M \pm \frac{1}{q} N \rangle_t(\omega) \ge 0$$
and then letting $q$ be a rational very close to $\sqrt{\langle N,N \rangle_t(\omega) / \langle M,M \rangle_t(\omega)}$ shows that $$|\langle M,N \rangle_t(\omega)| \le \sqrt{\langle M,M \rangle_t(\omega) \langle N,N \rangle_t(\omega)}$$
which is what we want.  But I have used in an essential way the fact that $W$ is a function space, and it would be nice to see if this can be avoided.

REPLY [3 votes]: For a commutative $C^*$-algebra your generalized Cauchy–Schwarz inequality holds, almost:

Kaplansky, 1953 Let $\mathscr{A}$ be a commutative $C^*$-algebra with unit.  Let $\mathscr{X}$ be a right $\mathscr{A}$-module. Let  $\left<\,\cdot\,,\,\cdot\,\right>$ be a $\mathscr{A}$-valued inner product on $\mathscr{X}$. Then for all $x,y\in\mathscr{X}$,
  $$ \left< x,y\right>\left<y,x\right>\ \leq\ \left<x,x\right>\,\left<y,y\right>. $$

"Almost" because by "$\mathscr{A}$-valued inner product on $\mathscr{X}$" we mean a
 sesquilinear map $\left<\,\cdot\,,\,\cdot\,\right>\colon \mathscr{X}\times\mathscr{X}\to\mathscr{A}$ with for all $x,y\in\mathscr{X}$ and $a\in \mathscr{A}$,

$\left<x,x\right>\geq 0$;
$\left<x,x\right>=0$ iff $x=0$;
$\left<x,y\right>^* = \left<y,x\right>$;
$\left<x,ya\right>=\left<x,y\right>a$.

Note that such an inner product is not just linear in the second coordinate, but also an $\mathscr{A}$-module map.
There is a modified version for (not necessarily commutative) $C^*$-algebras, see Proposition 2.3 of [2]:

Pasckke, 1973 Let $\mathscr{A}$ be a $C^*$-algebra.  Then for any $\scr{A}$-valued inner product $\left<\,\cdot\,,\,\cdot\,\right>$  on a right $\mathscr{A}$-module  $\mathscr{X}$, and $x,y\in\mathscr{X}$,
  $$ \left< x,y\right>\left<y,x\right>\ \leq\ 
\left<x,x\right>\,\left\|\left<y,y\right>\right\|. $$

And there is also a version for completely positive maps, see Exercise 3.2 and 3.4 of [3]:

For a $2$-positive map $f\colon \mathscr{A}\to\mathscr{B}$ between $C^*$-algebras, we have, for all $a,b\in\mathscr{A}$,
  $$ f(a^*b) \,f(b^*a)\ \leq\ f(a^*a)\, \left\|f(b^*b)\right\|.$$


[1] I. Kaplansky, Modules over operator algebras, American Journal of Mathematics, 1953
[2] W.L. Paschke, Inner product modules over $B^*$-algebras, Transactions of the American Mathematical Society, 1973
[3] V. Paulsen, Completely bounded maps and operator algebras, Cambridge University Press, 2002