For nonnegative integers q, n, d, let A q (n, d) denote the maximum cardinality of a code of length n over an alphabet [q] with q letters and with minimum distance at least d. We consider the following upper bound on A q (n, d). For any k, let C k be the collection of codes of cardinality at most k. Then A q (n, d) is at most the maximum value of v∈[q] n x({v}), where x is a function C 4 → R + such that x(∅) = 1 and x(C) = 0 if C has minimum distance less than d, and such that the C 2 ×C 2 matrix (x(C ∪C )) C,C ∈C 2 is positive semidefinite. By the symmetry of the problem, we can apply representation theory to reduce the problem to a semidefinite programming problem with order bounded by a polynomial in n. It yields the new upper bounds A 4 (6, 3) ≤ 176, A 4 (7, 3) ≤ 596, A 4 (7, 4) ≤ 155, A 5 (7, 4) ≤ 489, and A 5 (7, 5) ≤ 87.