From 623373c61f325566f47adbecd7849ca454f55d56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Sun, 26 Jul 2026 08:29:20 +0200 Subject: [PATCH] Clearer error message for different bases --- src/Certificate/Certificate.jl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Certificate/Certificate.jl b/src/Certificate/Certificate.jl index b85c992e2..be16d6334 100644 --- a/src/Certificate/Certificate.jl +++ b/src/Certificate/Certificate.jl @@ -85,7 +85,15 @@ function maxdegree_gram_basis( ) sub = MB.SubBasis{B}(monos) new_sub, new_full = SA.promote_bases(sub, full) - @assert new_full === full + if new_full !== full + error( + "the Gram basis spans variables `$(MP.variables(new_sub))` that are not " * + "all in the target basis `$(MP.variables(full))`. This typically means a " * + "generator (e.g. `1 - x_i^2`) was expressed over fewer variables than the " * + "certified polynomial; express generators over all variables of the " * + "problem (e.g. by promoting them with `StarAlgebras.promote_bases`).", + ) + end return new_sub end