aboutsummaryrefslogtreecommitdiff
path: root/proofsearch/include/atp/infer/unification.h
diff options
context:
space:
mode:
Diffstat (limited to 'proofsearch/include/atp/infer/unification.h')
-rw-r--r--proofsearch/include/atp/infer/unification.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/proofsearch/include/atp/infer/unification.h b/proofsearch/include/atp/infer/unification.h
new file mode 100644
index 0000000..870be66
--- /dev/null
+++ b/proofsearch/include/atp/infer/unification.h
@@ -0,0 +1,43 @@
+/*
+ * richard-atp-engine: A saturation-based automated theorem prover for first-order logic.
+ * Copyright (C) 2026 Richard Qin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+/// @file unification.h
+/// @brief Most General Unifier (MGU) computation.
+
+#include "atp/core/term_bank.h"
+#include "atp/infer/substitution.h"
+
+namespace atp {
+
+/// Configuration for the unification algorithm.
+struct UnificationConfig {
+ bool enable_occurs_check_ = false; ///< Set true for sound but slower unification
+};
+
+/// Attempt to unify two terms, producing a most general unifier.
+/// @return true if unification succeeds, with the MGU in `subst`.
+bool unify(const TermBank& bank, TermId t1, TermId t2, Substitution& subst,
+ const UnificationConfig& config = {});
+
+/// Apply a substitution to a term recursively, creating new terms in the bank.
+/// Free (unbound) variables are left unchanged.
+TermId applySubstitution(const Substitution& subst, TermId term, TermBank& bank);
+
+} // namespace atp