Theory Equality_Saturation_Checker
section ‹Equality-saturation explanation certificates›
theory Equality_Saturation_Checker
imports
First_Order_Rewriting.Trs
First_Order_Terms.Term_Impl
begin
text ‹
This development deliberately reuses the first-order terms, substitutions,
positions, and contexts from the AFP session
\<^session>‹First_Order_Terms›. It uses the rewrite relation from
\<^session>‹First_Order_Rewriting›. In particular, the semantic target of
the checker is the existing conversion relation
\<^term>‹(rstep (set R))⇧↔⇧*›; no separate term language or
equational calculus is introduced here.
What is specific to equality saturation is the certificate boundary. A
certificate is a flat path whose steps either apply a numbered input rule at
an AFP position, or reuse a numbered equality recorded by an earlier checked
e-class merge. Recorded merges are concrete term equalities, as in an
e-graph, and therefore need no substitution when reused.
›
datatype direction = Forward | Backward
fun orient_pair :: "direction ⇒ 'a × 'a ⇒ 'a × 'a" where
"orient_pair Forward ab = ab"
| "orient_pair Backward (a, b) = (b, a)"