diff --git a/src/SCFirstOrderLogic/ClauseIndexing/FeatureVectorIndex{TFeature,TValue}.cs b/src/SCFirstOrderLogic/ClauseIndexing/FeatureVectorIndex{TFeature,TValue}.cs index 7f2485dc..4bccc629 100644 --- a/src/SCFirstOrderLogic/ClauseIndexing/FeatureVectorIndex{TFeature,TValue}.cs +++ b/src/SCFirstOrderLogic/ClauseIndexing/FeatureVectorIndex{TFeature,TValue}.cs @@ -333,7 +333,7 @@ public IEnumerable GetSubsumed(CNFClause clause) return ExpandNode(root, 0); // NB: subsumed clauses will have equal or higher vector elements. - // We allow zero-valued elements to be omitted from the vectors (so that we don't have to know what identifiers are possible ahead of time). + // We allow zero-valued elements to be omitted from the vectors (so that we don't have to know what features are possible ahead of time). // This makes the logic here a little similar to what you'd find in a set trie when querying for supersets. IEnumerable ExpandNode(IFeatureVectorIndexNode node, int vectorComponentIndex) { diff --git a/src/SCFirstOrderLogic/SentenceFormatting/SentenceFormatter.cs b/src/SCFirstOrderLogic/SentenceFormatting/SentenceFormatter.cs index 2c3d9d81..fa6504ea 100644 --- a/src/SCFirstOrderLogic/SentenceFormatting/SentenceFormatter.cs +++ b/src/SCFirstOrderLogic/SentenceFormatting/SentenceFormatter.cs @@ -14,6 +14,8 @@ namespace SCFirstOrderLogic.SentenceFormatting; // TODO-FEATURE: Will ultimately want something that is more intelligent with brackets (i.e. drops them where not needed). // Will need precedence list in here - then presumably not too tough to include brackets or not based on the relative priority // of current op and child. +// TODO-BREAKING-FEATURE: Allow for configuration of whether zero-arity functions (and predicates?) should have brackets or not. +// Or roll into labeller (perhaps renamed - or separate interface - or perhaps some broader refactoring to do here) so can be by identifier? public class SentenceFormatter { private const char PrecedenceBracketL = '['; diff --git a/src/SCFirstOrderLogic/SentenceManipulation/VariableManipulation/VariableIdIgnorantEqualityComparer.cs b/src/SCFirstOrderLogic/SentenceManipulation/VariableManipulation/VariableIdIgnorantEqualityComparer.cs index b265f8ed..a0609f60 100644 --- a/src/SCFirstOrderLogic/SentenceManipulation/VariableManipulation/VariableIdIgnorantEqualityComparer.cs +++ b/src/SCFirstOrderLogic/SentenceManipulation/VariableManipulation/VariableIdIgnorantEqualityComparer.cs @@ -12,8 +12,8 @@ namespace SCFirstOrderLogic.SentenceManipulation.VariableManipulation; /// /// /// NB: of course, such comparison is non-trivial in terms of performance. When an unambiguous ordering of -/// literals can be established, consider transformation via -/// followed by equality comparison using plain old instead. +/// literals can be established, instead consider prior transformation via , +/// followed by equality comparison using plain old . /// /// // TODO-PERFORMANCE: The doc above does make it clear that this is a last resort, but I should defo take some time to try @@ -36,7 +36,7 @@ public bool Equals(CNFClause? x, CNFClause? y) } else { - return TryUpdateUnifier(x, y, new(), new()); + return TryUpdateVariableMap(x, y, new(), new()); } } @@ -59,7 +59,7 @@ public bool Equals(Literal? x, Literal? y) } else { - return TryUpdateUnifier(x, y, new(), new()); + return TryUpdateVariableMap(x, y, new(), new()); } } @@ -82,7 +82,7 @@ public bool Equals(Predicate? x, Predicate? y) } else { - return TryUpdateUnifier(x, y, new(), new()); + return TryUpdateVariableMap(x, y, new(), new()); } } @@ -105,7 +105,7 @@ public bool Equals(Term? x, Term? y) } else { - return TryUpdateUnifier(x, y, new(), new()); + return TryUpdateVariableMap(x, y, new(), new()); } } @@ -115,7 +115,7 @@ public int GetHashCode([DisallowNull] Term obj) return TransformForHashCode(obj).GetHashCode(); } - private static bool TryUpdateUnifier( + private static bool TryUpdateVariableMap( CNFClause x, CNFClause y, Dictionary xToY, @@ -128,7 +128,7 @@ private static bool TryUpdateUnifier( foreach (var literals in x.Literals.Zip(y.Literals, (x, y) => (x, y))) { - if (!TryUpdateUnifier(literals.x, literals.y, xToY, yToX)) + if (!TryUpdateVariableMap(literals.x, literals.y, xToY, yToX)) { return false; } @@ -137,7 +137,7 @@ private static bool TryUpdateUnifier( return true; } - private static bool TryUpdateUnifier( + private static bool TryUpdateVariableMap( Literal x, Literal y, Dictionary xToY, @@ -148,10 +148,10 @@ private static bool TryUpdateUnifier( return false; } - return TryUpdateUnifier(x.Predicate, y.Predicate, xToY, yToX); + return TryUpdateVariableMap(x.Predicate, y.Predicate, xToY, yToX); } - private static bool TryUpdateUnifier( + private static bool TryUpdateVariableMap( Predicate x, Predicate y, Dictionary xToY, @@ -165,7 +165,7 @@ private static bool TryUpdateUnifier( foreach (var args in x.Arguments.Zip(y.Arguments, (x, y) => (x, y))) { - if (!TryUpdateUnifier(args.x, args.y, xToY, yToX)) + if (!TryUpdateVariableMap(args.x, args.y, xToY, yToX)) { return false; } @@ -174,7 +174,7 @@ private static bool TryUpdateUnifier( return true; } - private static bool TryUpdateUnifier( + private static bool TryUpdateVariableMap( Term x, Term y, Dictionary xToY, @@ -182,13 +182,13 @@ private static bool TryUpdateUnifier( { return (x, y) switch { - (VariableReference variableX, VariableReference variableY) => TryUpdateUnifier(variableX, variableY, xToY, yToX), - (Function functionX, Function functionY) => TryUpdateUnifier(functionX, functionY, xToY, yToX), + (VariableReference variableX, VariableReference variableY) => TryUpdateVariableMap(variableX, variableY, xToY, yToX), + (Function functionX, Function functionY) => TryUpdateVariableMap(functionX, functionY, xToY, yToX), _ => false }; } - private static bool TryUpdateUnifier( + private static bool TryUpdateVariableMap( VariableReference x, VariableReference y, Dictionary xToY, @@ -215,7 +215,7 @@ private static bool TryUpdateUnifier( return true; } - private static bool TryUpdateUnifier( + private static bool TryUpdateVariableMap( Function x, Function y, Dictionary xToY, @@ -228,7 +228,7 @@ private static bool TryUpdateUnifier( for (int i = 0; i < x.Arguments.Count; i++) { - if (!TryUpdateUnifier(x.Arguments[i], y.Arguments[i], xToY, yToX)) + if (!TryUpdateVariableMap(x.Arguments[i], y.Arguments[i], xToY, yToX)) { return false; } diff --git a/src/SCFirstOrderLogic/TermIndexing/AsyncDiscriminationTree.cs b/src/SCFirstOrderLogic/TermIndexing/AsyncDiscriminationTree.cs index c0f0df31..1623f96b 100644 --- a/src/SCFirstOrderLogic/TermIndexing/AsyncDiscriminationTree.cs +++ b/src/SCFirstOrderLogic/TermIndexing/AsyncDiscriminationTree.cs @@ -9,7 +9,6 @@ namespace SCFirstOrderLogic.TermIndexing; /// /// An implementation of a discrimination tree for s - specifically, one for which the attached values are the terms themselves. /// -/// public class AsyncDiscriminationTree { private readonly AsyncDiscriminationTree actualTree; diff --git a/src/SCFirstOrderLogic/TermIndexing/AsyncDiscriminationTree{TValue}.cs b/src/SCFirstOrderLogic/TermIndexing/AsyncDiscriminationTree{TValue}.cs index c5de5213..a9b0b7f3 100644 --- a/src/SCFirstOrderLogic/TermIndexing/AsyncDiscriminationTree{TValue}.cs +++ b/src/SCFirstOrderLogic/TermIndexing/AsyncDiscriminationTree{TValue}.cs @@ -11,7 +11,6 @@ namespace SCFirstOrderLogic.TermIndexing; /// An implementation of a discrimination tree for s. /// /// The type of value attached for each term. -/// // NB: not a TODO just yet, but - while it's not terrible - there are a few aspects of this // class that aren't great from a performance perspective. Notably, while the recursive iterator // approach used for the retrieval methods may be easy to understand, it will make a lot of heap diff --git a/src/SCFirstOrderLogic/TermIndexing/DiscriminationTree.cs b/src/SCFirstOrderLogic/TermIndexing/DiscriminationTree.cs index a0e2cd2b..98059aab 100644 --- a/src/SCFirstOrderLogic/TermIndexing/DiscriminationTree.cs +++ b/src/SCFirstOrderLogic/TermIndexing/DiscriminationTree.cs @@ -14,7 +14,6 @@ namespace SCFirstOrderLogic.TermIndexing; /// Discrimination trees are particularly well-suited to (i.e. performant at) looking up generalisations of a query term. /// /// -/// public class DiscriminationTree { private readonly DiscriminationTree actualTree; diff --git a/src/SCFirstOrderLogic/TermIndexing/DiscriminationTree{TValue}.cs b/src/SCFirstOrderLogic/TermIndexing/DiscriminationTree{TValue}.cs index 0a3cf1a1..3cbe487c 100644 --- a/src/SCFirstOrderLogic/TermIndexing/DiscriminationTree{TValue}.cs +++ b/src/SCFirstOrderLogic/TermIndexing/DiscriminationTree{TValue}.cs @@ -17,7 +17,6 @@ namespace SCFirstOrderLogic.TermIndexing; /// /// /// The type of value attached for each term. -/// // NB: not a TODO just yet, but - while it's not terrible - there are a few aspects of this // class that aren't great from a performance perspective. Notably, while the recursive iterator // approach used for the retrieval methods may be easy to understand, it will make a lot of heap