From 5ab3efd522cf0221481684b5bbc9c2ac6bfc9919 Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Tue, 7 Apr 2026 03:59:58 +0800 Subject: refactor: rename struct members to follow trailing underscore naming convention across core, search, and frontend components --- include/atp/core/clause.h | 16 ++++++++-------- include/atp/core/literal.h | 6 +++--- include/atp/core/symbol_table.h | 8 ++++---- include/atp/core/term.h | 6 +++--- include/atp/core/term_bank.h | 10 +++++----- 5 files changed, 23 insertions(+), 23 deletions(-) (limited to 'include/atp/core') diff --git a/include/atp/core/clause.h b/include/atp/core/clause.h index 7e0cbff..6387adf 100644 --- a/include/atp/core/clause.h +++ b/include/atp/core/clause.h @@ -33,20 +33,20 @@ namespace atp { /// A clause: a disjunction of literals plus provenance for proof reconstruction. struct Clause { - ClauseId id = kInvalidId; - std::vector literals; + ClauseId id_ = kInvalidId; + std::vector literals_; // Provenance (for proof trace) - InferenceRule rule = InferenceRule::kInput; - ClauseId parent1 = kInvalidId; - ClauseId parent2 = kInvalidId; - uint16_t depth = 0; ///< Derivation depth (for BFS scheduling) + InferenceRule rule_ = InferenceRule::kInput; + ClauseId parent1_ = kInvalidId; + ClauseId parent2_ = kInvalidId; + uint16_t depth_ = 0; ///< Derivation depth (for BFS scheduling) /// True if the clause has no literals (contradiction). - [[nodiscard]] bool isEmpty() const { return literals.empty(); } + [[nodiscard]] bool isEmpty() const { return literals_.empty(); } /// Number of literals. - [[nodiscard]] size_t size() const { return literals.size(); } + [[nodiscard]] size_t size() const { return literals_.size(); } }; } // namespace atp diff --git a/include/atp/core/literal.h b/include/atp/core/literal.h index 212c281..e58b185 100644 --- a/include/atp/core/literal.h +++ b/include/atp/core/literal.h @@ -27,11 +27,11 @@ namespace atp { /// A literal: a polarity flag plus the TermId of the atom. struct Literal { - TermId atom; ///< TermId of the predicate application - bool is_positive; ///< true = positive, false = negated + TermId atom_; ///< TermId of the predicate application + bool is_positive_; ///< true = positive, false = negated /// Complement: flip polarity, same atom. - [[nodiscard]] Literal complement() const { return {.atom = atom, .is_positive = !is_positive}; } + [[nodiscard]] Literal complement() const { return {.atom_ = atom_, .is_positive_ = !is_positive_}; } bool operator==(const Literal& other) const = default; }; diff --git a/include/atp/core/symbol_table.h b/include/atp/core/symbol_table.h index 30453fc..a646f78 100644 --- a/include/atp/core/symbol_table.h +++ b/include/atp/core/symbol_table.h @@ -33,10 +33,10 @@ namespace atp { /// Metadata associated with an interned symbol. struct SymbolInfo { - std::string name; - SymbolKind kind = SymbolKind::kFunction; - uint16_t arity = 0; - SortId sort = kUnsorted; ///< Result sort (for sorted logic) + std::string name_; + SymbolKind kind_ = SymbolKind::kFunction; + uint16_t arity_ = 0; + SortId sort_ = kUnsorted; ///< Result sort (for sorted logic) }; /// Interns symbol names so that each unique string is stored exactly once. diff --git a/include/atp/core/term.h b/include/atp/core/term.h index 2be01e7..d35c753 100644 --- a/include/atp/core/term.h +++ b/include/atp/core/term.h @@ -33,11 +33,11 @@ namespace atp { /// A term is a function/predicate application: f(t1, t2, ..., tn). /// Variables are 0-arity terms whose symbol has SymbolKind::kVariable. struct Term { - SymbolId symbol_id; ///< Index into the SymbolTable - std::vector args; ///< Argument sub-term IDs + SymbolId symbol_id_; ///< Index into the SymbolTable + std::vector args_; ///< Argument sub-term IDs /// Number of arguments. - [[nodiscard]] uint16_t arity() const { return static_cast(args.size()); } + [[nodiscard]] uint16_t arity() const { return static_cast(args_.size()); } }; } // namespace atp diff --git a/include/atp/core/term_bank.h b/include/atp/core/term_bank.h index f909e2f..3339ceb 100644 --- a/include/atp/core/term_bank.h +++ b/include/atp/core/term_bank.h @@ -61,17 +61,17 @@ class TermBank { private: struct TermKey { - SymbolId symbol; - std::vector args; + SymbolId symbol_; + std::vector args_; bool operator==(const TermKey& other) const = default; }; struct TermKeyHash { size_t operator()(const TermKey& key) const { - size_t seed = std::hash{}(key.symbol); - for (TermId arg : key.args) { - seed ^= std::hash{}(arg) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + size_t seed = std::hash{}(key.symbol_); + for (const TermId kArg : key.args_) { + seed ^= std::hash{}(kArg) + 0x9e3779b9 + (seed << 6) + (seed >> 2); } return seed; } -- cgit v1.2.3