Add an interactive 'can this query be satisfied' interface

This commit is contained in:
2023-11-26 12:47:05 -08:00
parent 9f7b59c65d
commit 985be53367
2 changed files with 25 additions and 8 deletions

View File

@@ -90,16 +90,19 @@ provePremises l =
case l of
t :: ts ->
pure (::)
|> apply (prove t)
|> apply (proveTerm t)
|> apply (provePremises ts)
[] -> pure []
proveTerm : Term UnificationVar -> Prover ProofTree
proveTerm t =
getEnv
|> andThen (\env -> List.foldl (\r -> interleave (rule t r)) fail env.rules)
prove : Term Metavariable -> Prover ProofTree
prove mt =
pure (\t env -> List.foldl (\r -> interleave (rule t r)) fail env.rules)
|> apply (liftInstantiation instantiate mt)
|> apply getEnv
|> join
liftInstantiation instantiate mt
|> andThen proveTerm
single : RuleEnv -> Prover a -> Maybe a
single env p =