Closed nimec01 closed 9 months ago
Two further aspects:
createOnlyHornClauses = True
could be the default. Or even a more specific name, depending on the 2. point.I think the principled approach would be to change the underlying genClause
-Generator to take an additional argument of some type like
data ClauseShape = AnyClause | HornClause HornShape
data HornShape = AnyHornClause | Fact | Procedure | Query
and generate the respective type of clause.
Then, the configuration of (Prolog) resolution tasks could have configuration options like firstClauseShape :: ClauseShape
, secondClauseShape :: ClauseShape
, ...
I like the idea of using the ClauseShape
and HornShape
types and replacing createOnlyHornClauses
in PrologConfig
by firstClauseShape :: ClauseShape
and secondClauseShape :: ClauseShape
.
But let's not go for parametrizing genClause
right now. Instead, refashion isHornClause :: PrologClause -> Bool
into a function hasTheClauseShape :: ClauseShape -> PrologClause -> Bool
and replace https://github.com/fmidue/logic-tasks/blob/4e0df5d3a6230100670f4e14b6c44ba5edd66c91/src/LogicTasks/Semantics/Prolog.hs#L37 by:
`suchThat` \(PrologInst clause1 clause2 _) -> hasTheClauseShape firstClauseShape clause1 && hasTheClauseShape secondClauseShape clause2
If at any point we do feel like actually changing genClause
to take a ClauseShape
argument, we can then move hasTheClauseShape
over to the test suite, testing genClause
.
I have added a few checks so that you cannot create a PrologConfig
with which no resolution is possible.
Behebt #54.
genPrologInst
generiert nun nurPrologInst
mit Hornklauseln. Ich habe dementsprechend auch ein Testcase erstellt, welches erfolgreich durchlaufen wird.