Skip to content

Commit d2dd370

Browse files
committed
doc tweaks
1 parent 4f227c9 commit d2dd370

6 files changed

Lines changed: 25 additions & 15 deletions

File tree

src/SCFirstOrderLogic.Tests/FormulaFormatting/FormulaFormatterTests.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,26 @@ public static class FormulaFormatterTests
99
public static Test FormatBehaviour => TestThat
1010
.GivenEachOf<FormatTestCase>(() =>
1111
[
12-
new(Formula: "P(C())", Expected: "P(C())"),
13-
new(Formula: "P() & Q() & R()", Expected: "P() ∧ Q() ∧ R()"),
12+
new(Formula: "P(C())", Expected: "P(C())"),
13+
new(Formula: "P() & Q() & R()", Expected: "P() ∧ Q() ∧ R()"),
1414
new(Formula: "[P() | Q()] & R()", Expected: "[P() ∨ Q()] ∧ R()"),
1515
new(Formula: "P() | [Q() & R()]", Expected: "P() ∨ [Q() ∧ R()]"),
16-
new(Formula: "![P() | Q()]", Expected: "¬[P() ∨ Q()]"),
17-
new(Formula: "![P()]", Expected: "¬P()"),
16+
new(Formula: "![P() | Q()]", Expected: "¬[P() ∨ Q()]"),
17+
new(Formula: "![P()]", Expected: "¬P()"),
1818

1919
//∃∀
20-
new(Formula: "∃ x, P(x)", Expected: "∃ x, P(x)"),
20+
new(Formula: "∃ x, P(x)", Expected: "∃ x, P(x)"),
2121
new(Formula: "∃ x, P(x) | Q(x)", Expected: "∃ x, P(x) ∨ Q(x)"),
2222
new(Formula: "∃ x, P(x) => Q(x)", Expected: "∃ x, P(x) ⇒ Q(x)"),
2323

24-
new(Formula: "∃ x, ∀ y, P(x, y)", Expected: "∃ x, ∀ y, P(x, y)"),
24+
new(Formula: "∃ x, ∀ y, P(x, y)", Expected: "∃ x, ∀ y, P(x, y)"),
2525

2626
new(Formula: "∀ x, P(x) => Q(x) => R(x)", Expected: "∀ x, [P(x) ⇒ Q(x)] ⇒ R(x)"),
2727

2828
new(Formula: "∀ x, ∀ y, P(x, y)", Expected: "∀ x, y, P(x, y)"),
2929
new(Formula: "∃ x, ∃ y, P(x, y)", Expected: "∃ x, y, P(x, y)"),
30+
31+
new(Formula: "∀ x, [∀ y, Animal(y) ⇒ Loves(x, y)] ⇒ [∃ y, Loves(y, x)]", Expected: "∀ x, [∀ y, Animal(y) ⇒ Loves(x, y)] ⇒ [∃ y, Loves(y, x)]")
3032
])
3133
.When(tc => new FormulaFormatter().Format(FormulaParser.Default.Parse(tc.Formula)))
3234
.ThenReturns()

src/SCFirstOrderLogic/CNFClause.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ namespace SCFirstOrderLogic;
1010

1111
/// <summary>
1212
/// <para>
13-
/// Streamlined representation of an individual clause (i.e. a disjunction of <see cref="Literal"/>s) of a first-order logic formula in conjunctive normal form.
14-
/// Consists of a set of <see cref="Literal"/>s.
13+
/// Streamlined representation of an individual clause of a first-order logic formula in conjunctive normal form (CNF).
14+
/// Consists of a <see cref="IReadOnlySet{T}"/> set of <see cref="Literal"/>s.
1515
/// </para>
1616
/// <para>
1717
/// Note that this type is NOT a subtype of <see cref="Formula"/>. To represent a clause as a <see cref="Formula"/>,

src/SCFirstOrderLogic/CNFFormula.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ namespace SCFirstOrderLogic;
1010

1111
/// <summary>
1212
/// <para>
13-
/// Streamlined representation of a <see cref="Formula"/> in conjunctive normal form (CNF).
14-
/// Consists of a set of <see cref="CNFClause"/>s.
13+
/// Streamlined representation of a first-order logic formula in conjunctive normal form (CNF).
14+
/// Consists of a <see cref="IReadOnlySet{T}"/> of <see cref="CNFClause"/>s.
1515
/// </para>
1616
/// <para>
1717
/// Note that this type is NOT a subtype of <see cref="Formula"/>. To represent CNF as a <see cref="Formula"/>,
@@ -39,7 +39,13 @@ public CNFFormula(IEnumerable<CNFClause> clauses)
3939
}
4040

4141
/// <summary>
42+
/// <para>
4243
/// Initialises a new instance of the <see cref="CNFFormula"/> class from a <see cref="Formula"/> that is a conjunction of disjunctions of literals (a literal being a predicate or a negated predicate).
44+
/// </para>
45+
/// <para>
46+
/// An <see cref="ArgumentException"/> will be thrown if the provided formula is not a conjunction of disjunctions of literals.
47+
/// In other words, conversion to CNF is NOT carried out by this constructor.
48+
/// </para>
4349
/// </summary>
4450
/// <param name="cnfFormula">
4551
/// The formula, in CNF but represented as a <see cref="Formula"/>. An <see cref="ArgumentException"/> will be thrown if it is not a conjunction of disjunctions of literals.

src/SCFirstOrderLogic/FormulaFormatting/FormulaFormatter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ namespace SCFirstOrderLogic.FormulaFormatting;
1010

1111
/// <summary>
1212
/// This class provides functionality for rendering <see cref="Formula"/> instances (and <see cref="CNFFormula"/> instances) in the standard first-order logic syntax.
13-
/// Using a single <see cref="FormulaFormatter"/> instance allows for unique (and customisable) labelling of standardised variables and Skolem functions for all formulas formatted with the instance.
13+
/// Using a single <see cref="FormulaFormatter"/> instance allows for unique (and customisable) labelling of identifiers (e.g. standardised variables and Skolem functions)
14+
/// for all formulas formatted with the instance.
1415
/// </summary>
1516
public class FormulaFormatter
1617
{

src/SCFirstOrderLogic/FormulaFormatting/ILabeller.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace SCFirstOrderLogic.FormulaFormatting;
66

77
/// <summary>
8-
/// Interface for types capable of creating labels for identifiers that are unique (within a specified scope).
8+
/// Interface for types capable of creating labels for identifiers that are unique within a specified scope.
99
/// </summary>
1010
public interface ILabeller
1111
{

src/SCFirstOrderLogic/_PackageFiles/SCFirstOrderLogic.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
The SCFirstOrderLogic NuGet package contains basic but fully functional and documented [first-order logic](https://en.wikipedia.org/wiki/First-order_logic) implementations for .NET.
44
Included are:
55

6-
* Implementations of both raw and CNF formula representation.
6+
* A tree model for formulas.
7+
* A streamlined model for formulas in conjunctive normal form - a set of clauses rather than a tree.
78
* Multiple ways of instantiating raw formulas, ranging from string parsing, through a number of code-based approaches, all the way to a language-integrated approach that allows (the domain to be modelled as an IEnumerable&lt;T&gt; and) formulas to be provided as lambda expressions.
8-
* Formula manipulation logic - base classes for formula visitors and transformations, as well as some implementations - e.g. normalisation, variable substitutions and basic unification logic.
9-
* Formula formatting logic that allows for (customisable) unique labelling of standardised variables and Skolem functions across a set of formulas.
9+
* Formula manipulation logic - base classes for formula visitors and transformations, as well as some fundamental implementations - normalisation, variable substitutions and basic unification logic.
10+
* Formula formatting logic that allows for (customisable) unique labelling of identifiers (e.g. standardised variables and Skolem functions) across a set of formulas.
1011
* Index structures for terms and clauses, with node abstractions to allow for consumer-provided backing stores. Specifically, we have discrimination tree, path tree and feature vector index implementations.
1112

1213
Accompanying the core SCFirstOrderLogic package are three supporting packages:

0 commit comments

Comments
 (0)