Ternary Gamma Semirings as a Novel Algebraic Framework for Learnable Symbolic Reasoning