Skip to content

Commit

Permalink
Minor changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
sdcondon committed Jul 29, 2023
1 parent 180dc9d commit 97ffe36
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Engines;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Linq;
using static SCFirstOrderLogic.SentenceCreation.OperableSentenceFactory;
Expand All @@ -19,8 +20,7 @@ public class DiscriminationTreeBenchmarks
private static Function G(Term x, Term y) => new(nameof(G), x, y);
private static Function H(Term x) => new(nameof(H), x);

// Example from https://rg1-teaching.mpi-inf.mpg.de/autrea-ws19/script-6.2-7.4.pdf
private static readonly DiscriminationTree tree = new(new[]
private static readonly Term[] Terms =
{
F(G(D, X), C),
G(B, H(C)),
Expand All @@ -29,18 +29,12 @@ public class DiscriminationTreeBenchmarks
F(B, G(X, B)),
F(X, C),
F(X, G(C, B))
});
};

private static readonly DiscriminationTree_WOVarBinding<Term> tree_withoutVarBinding = new(new Term[]
{
F(G(D, X), C),
G(B, H(C)),
F(G(X, C), C),
F(B, G(C, B)),
F(B, G(X, B)),
F(X, C),
F(X, G(C, B))
}.Select(t => KeyValuePair.Create(t, t)));
// Example from https://rg1-teaching.mpi-inf.mpg.de/autrea-ws19/script-6.2-7.4.pdf
private static readonly DiscriminationTree tree = new(Terms);

private static readonly DiscriminationTree_WOVarBinding<Term> tree_withoutVarBinding = new(Terms.Select(t => KeyValuePair.Create(t, t)));

private readonly Consumer consumer = new Consumer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
// Yes, could cache the parse results to avoid parsing multiple times, but not worth it for now at least.
// TODO: Some "TryParse.." methods might be useful - they'd certainly make this method a bit cleaner.
// TODO: If we had a ParseError exception type, we could perhaps highlight the offending text.
// TODO-FEATURE: Some "TryParse.." methods might be useful - they'd certainly make this method a bit cleaner.
// TODO-FEATURE: If we had a ParseError exception type, we could perhaps highlight the offending text.
Sentence[] knowledge;
Sentence query;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace SCFirstOrderLogic.SentenceFormatting
/// This class provides functionality for rendering <see cref="Sentence"/> instances (and <see cref="CNFSentence"/> instances) in the standard first-order logic syntax.
/// Using a single <see cref="SentenceFormatter"/> instance allows for unique (and customisable) labelling of standardised variables and Skolem functions for all sentences formatted with the instance.
/// </summary>
// TODO: Will ultimately want something that is more intelligent with brackets (i.e. drops them where not needed).
// TODO-FEATURE: Will ultimately want something that is more intelligent with brackets (i.e. drops them where not needed).
public class SentenceFormatter
{
private readonly ILabellingScope<StandardisedVariableIdentifier> standardisedVariableLabellingScope;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (c) 2021-2023 Simon Condon.
// You may use this file in accordance with the terms of the MIT license.
using SCFirstOrderLogic;
using System.Collections.Generic;
using System.Linq;

Expand Down

0 comments on commit 97ffe36

Please sign in to comment.