A tensor network formalism for neuro-symbolic AI