-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reasoning with database #1836
Reasoning with database #1836
Conversation
when compiling, I get a number of "missing module" warnings. I am just curious why missing modules do not cause errors. Have you employed some dynamic loading of modules at run-time?
|
This is because of some left-overs that GHC hasn't detected. |
good, thanks. Now I have tried your example call and get:
This is strange because 1) I have tried to prove, not to cons-check, 2) I have cons checkers available when using the old Hets GUI. |
Is |
no |
OK, will try with "prove" |
Then it is filtered away in Lines 1839 to 1847 in c7bf6ef
which is quite old Hets-code (just moved out into a separate function) |
OK, I managed to prove a goal and found the prover output in table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will be offline soon, therefore just one comment for now.
|
||
data Action = Action { evaluationState :: String | ||
, message :: Maybe String | ||
} deriving (Show, Typeable, Data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this datatype called Action
? It seems to be more a datatype for storing results of some action?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be extended to the action datatype that Tim described in his master's thesis. It can get an ETA and more information about the action in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good, then please add a corresponding comment.
That's because Hets does not capture the output in the old function Lines 1821 to 1837 in c7bf6ef
|
OK, but could you then please create an issue for that? |
PGIP/Server.hs
Outdated
then case reasoningParametersE of | ||
Left _ -> False | ||
Right _ -> True | ||
else True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shorter:
not (validReasoningParams = elem newIde ["prove", "consistency-check"]) || Data.Either.isRight reasoningParametersE
or even
Data.Either.isRight reasoningParametersE <= (validReasoningParams = elem newIde ["prove", "consistency-check"])
Here, <=
is read as "if", i.e. reverse "implies". See also https://mail.haskell.org/pipermail/libraries/2016-January/026565.html
PGIP/Server.hs
Outdated
|
||
isLeft :: Either a b -> Bool | ||
isLeft (Left _) = True | ||
isLeft _ = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function is already provided by Data.Either
PGIP/Server.hs
Outdated
|
||
unRight :: Either a b -> b | ||
unRight (Right x) = x | ||
unRight _ = error "PGIP.Server.unRight received a Left." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shorter: unRight = fromRight $ error "PGIP.Server.unRight received a Left."
Perhaps you could make the error message a bit more informative?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot use fromRight
. It could not be found even though I have imported Data.Either
.
I think I added it in 0555999. |
yes, works, great! |
PGIP/Server.hs
Outdated
failOnLefts reasoningCache = | ||
let lefts_ = filter isLeft reasoningCache | ||
in if null lefts_ | ||
then return () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shorter: if null $ lefts reasoningCache
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aha, or better: let lefts_ = lefts reasoningCache
PGIP/Server.hs
Outdated
reasonREST opts libEnv libName dGraph_ proverMode location reasoningParameters = do | ||
reasoningCacheE <- liftIO $ buildReasoningCache | ||
failOnLefts reasoningCacheE | ||
let reasoningCache1 = map unRight $ filter (not . isLeft) reasoningCacheE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shorter: let reasoningCache1 = rights reasoningCacheE
(you already know that there are only Right
elements)
PGIP/Server.hs
Outdated
) | ||
[] $ | ||
groupBy (\ a b -> ReasoningParameters.node a == ReasoningParameters.node b) $ | ||
ReasoningParameters.goals reasoningParameters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it hard to review buildReasoningCache
. Could you please give names to the anonymous functions (even if this means passing more arguments around), and also to the groupby
term at the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do. Could take me some time because I'm working on a different task right now.
Nothing -> | ||
fail ("Cannot compute global theory of: " | ||
++ showName (dgn_name nodeLabel) ++ "\n") | ||
Just gTheory_ -> return gTheory_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a repetition of lines 1898ff. Could be relegated into a small function.
Nothing -> | ||
fail ("Cannot compute global theory of: " | ||
++ showName (dgn_name nodeLabel) ++ "\n") | ||
Just gTheory_ -> return gTheory_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a repetition of lines 1898ff. Could be relegated into a small function.
BTW: In Issue ??? you asked for DB "driver" separation as done for MySQL. This would at least in theory allow a "no DB at all" configuration. So related questions are: Is that a supported config? If so, is the new code prepared for it (i.e. relevant parts enclosed in e.g. #ifdef USE_DB ... #endif )? |
It is compatible to a no-db configuration. |
The relevant code is only called if Hets has been called with database-related commandline-options. |
I have a question about
In the DB, I get
How can a comorphism be reconstructed from EDIT: the problem should be even worse with
because |
The last question is relevant when I want to specify a translation (possibly a composition of logic mappings) that should be used for proving. Now my question is: how can I do this? I tried
By the way, the error message would be more informative if the translation or prover that has not been found were included into the message. |
It seems to be that only |
There seems to be problem with imported axioms. Consider
I get
although the sentence is there (but for OMS sp, not sp1!)
|
let goalName = fromJust $ rceGoalNameM reasoningCacheGoal | ||
performPremiseSelection opts gTheory goalName | ||
premiseSelectionParameters premiseSelectionKindV | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would omit this blank line, or else also add one before the return
below.
Note that the origin of sentences is now available, see #1837 |
16f270a
to
f4873e7
Compare
I still would like to fix the origin in another pull request. I'm not sure if I should do something about travis not finishing for PostgreSQL. It will be difficult though, because recreating the cache and compiling consumes almost the whole time quota. |
OK, then I suggest to merge this now. |
Hi, I am having the issue: Luis Ramos |
This should add database support for reasoning. It changes the REST API wrt. Proving/Consistency-Checking.
Please review this carefully because there might be some typos when changing the state (moving through libEnv1, libEnv2, libEnv3 and so on while proving many conjectures). Please also check if there are any logical mistakes like not using the correct gTheory for proving/consistency-checking or not passing the set of all sentences (even imported ones) to the SInE premise selection.
REST API
/prove/coded-iri/command-list
is for invoking a prover on a proof goal. It accepts the following request body/consistency-check/coded-iri/command-list
is for invoking a consistency-checker on a node. It accepts the following request bodyTo Do
buildReasoningCache
. See Reasoning with database #1836 (comment). Done in 0d3de41.parameterize
call of logic translations. See Reasoning with database #1836 (comment) for the required escaping and a few comments above that one for the general problem. Done in a different way in 957a8be.