Reality as Category-Theoretic State Machines: A Mathematical Framework — LessWrong