Inner product grammar is neater than sum(index) in JuMP modeling, But triggers Warning?

I reviewed some math books and concluded that ip (inner product) is a false name which conveyed a misconception. A correction could be

function sm(p, x) return sum(p .* x) end

where s stands for vector sum and m stands for scalar multiplication.

The sm should be a more fundamental operation, which makes sense in, e.g.,
integration theory (p represents a probability measure while x represents a measurable function).

And some related useful formulas are:

  1. @assert sm(A, B) == tr(transpose(A) * B)
  2. @assert transpose(z) * A * w == tr(A * w * transpose(z))
  3. @assert tr(A * B) == tr(B * A) as long as size(A) == size(transpose(B))
  4. @assert sm(c .* x, y) == sm(c, diag(x * y'))

where, tr and diag are from module LinearAlgebra.
From the 4th point we see that sm is indeed more versatile that tr. Therefore I think it’s obfuscating to define an inner product using tr (as it was done in some textbooks).