diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-04-03 02:46:12 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-04-03 02:46:12 +0800 |
| commit | 52ff8a1695a2cc5157b98d4e71b05d7ea58bb97a (patch) | |
| tree | 68d96786f6f8b06a9d4cc49824ae7c322600947e /proofsearch/include/atp/core/term.h | |
| parent | 892fe0a993803592dd9dfaa22cfa889faa210af4 (diff) | |
| download | rcc-project-52ff8a1695a2cc5157b98d4e71b05d7ea58bb97a.tar.gz rcc-project-52ff8a1695a2cc5157b98d4e71b05d7ea58bb97a.tar.xz | |
feat: implement core term, symbol, and clause storage logic with canonicalization support
Diffstat (limited to 'proofsearch/include/atp/core/term.h')
| -rw-r--r-- | proofsearch/include/atp/core/term.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/proofsearch/include/atp/core/term.h b/proofsearch/include/atp/core/term.h index e1edfcf..017882a 100644 --- a/proofsearch/include/atp/core/term.h +++ b/proofsearch/include/atp/core/term.h @@ -16,28 +16,30 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - #pragma once /// @file term.h /// @brief Core Term data structure — hash-consed, immutable. +/// +/// V1 uses vector<TermId> for args. +/// Future: flat arena with contiguous arg storage for cache locality. -#include <span> +#include <vector> #include "atp/core/types.h" namespace atp { /// A term is a function/predicate application: f(t1, t2, ..., tn). -/// Stored in a flat arena; args are contiguous TermIds following the header. -/// Variables are represented as terms with a special symbol range. +/// Variables are 0-arity terms whose symbol has SymbolKind::kVariable. struct Term { - SymbolId symbol_id; ///< Index into the SymbolTable - uint16_t arity; ///< Number of arguments + SymbolId symbol_id; ///< Index into the SymbolTable + std::vector<TermId> args; ///< Argument sub-term IDs - /// Access the argument TermIds (stored immediately after this struct in the arena). - [[nodiscard]] std::span<const TermId> args() const; - [[nodiscard]] std::span<TermId> mutableArgs(); + /// Number of arguments. + [[nodiscard]] uint16_t arity() const { + return static_cast<uint16_t>(args.size()); + } }; } // namespace atp |
