nb DSL built-ins

Single source of truth for nb built-in functions.

Every built-in is declared exactly once here with its classification facts. Both the semantic analyzer (return types, depth-opacity) and the code generator (encrypted-ness, plaintext-ness, vector-ness) derive their tables from this registry — adding a built-in is a one-line change, and the two phases can no longer drift apart.

User-defined functions are NOT listed here: their classification comes from their declared signatures (see codegen's _fn_sigs lookup).

Return kinds:
  'enc'       — returns a ciphertext (Ciphertext<DCRTPoly> or enc<T>)
  'plain'     — returns plaintext data whose precise type isn't modeled
                (vectors/matrices of cleartext values, paths into data, ...)
  'u32'/'i64'/'f64'/'string'/'path'/'void' — concrete plaintext scalars
  'keybundle'/'secretkey' — key objects
  'unknown'   — genuinely polymorphic (e.g. load() of an arbitrary wire type)
Flags:
  enc_hint      — codegen treats the result as a ciphertext even though the
                  semantic return type stays unknown (e.g. reduce over a
                  ciphertext collection).
  vector_return — generates a std::vector<double> (plaintext vector); drives
                  MakeCKKSPackedPlaintext wrapping in mixed ct/vector ops.
  depth_opaque  — performs homomorphic multiplications whose depth is not
                  statically modeled; suppresses the depth over-provision
                  warning for any program using it.

Keys and encryption

Built-inReturnsFlagsNote
keygenkeybundle
encryptenc
decryptplainplaintext vector of slot values
save_secret_keyvoid
load_secret_keysecretkey

Serialization / data loading

Built-inReturnsFlagsNote
loadunknownwire-type dependent
load_allunknown
load_matrixplain
load_vecplain
load_modelunknown
savevoid

Ciphertext operations

Built-inReturnsFlagsNote
cloneenc
zeroenc
relinenc
rotateenc
negateenc
mul_monomialenc
chebyshevencdepth_opaque
slot_sumenc
total_sumsenc
running_sumsvoiddepth_opaque
slot_replicatorunknown
extern_callunknowndepth_opaque

Collection combinators (closure depth not modeled)

Built-inReturnsFlagsNote
reduceunknownenc_hint, depth_opaque
mapunknowndepth_opaque
zip_mapunknowndepth_opaque

Plaintext data shaping

Built-inReturnsFlagsNote
tileplainvector_return
slot_maskplainvector_return
to_matrix_formplainvector_return
transposeplain
batchplain
scaleplain
prepend_columnplain
vec_zerosunknownvec_zeros<enc<...>> can hold cts
mat_zerosplain
sortplain
argmaxplain
enumerateunknown
strideplain

Plaintext scalar helpers

Built-inReturnsFlagsNote
lenu32
rowsu32
ceil_divu32
log2u32
roundi64
inti64
strstring
absf64
expf64
tanhf64
rootpath

I/O / debug

Built-inReturnsFlagsNote
printvoid

Something not looking right? Suggest a change on GitHub.