OPTIMALLY REWRITING FORMULAS AND DATABASE QUERIES: A CONFLUENCE OF TERM REWRITING, STRUCTURAL DECOMPOSITION, AND COMPLEXITY. - CHEN, HUBIE; MENGEL, STEFAN (Logical Methods in Computer Science (LMCS), 2026)