|
definition: |
theoremToAgda :: Options -> QName -> [CFuncDecl] -> [CTypeDecl] -> IO ()
theoremToAgda opts qtheo@(_,theoname) allfuncs alltypes = do
let (rename, orgtypedrules) = funcDeclsToTypedRules allfuncs
transform = if optScheme opts == "nondet" then transformRuleWithNondet
else transformRuleWithChoices
typedrules = concatMap (transform opts) orgtypedrules
(theorules,funcrules) = partition (\ (fn,_,_,_) -> fn == qtheo)
typedrules
mname = "TO-PROVE-" ++ theoname
hrule = take 75 (repeat '-')
agdaprog = unlines $
agdaHeader opts mname ++
[hrule, "-- Translated Curry operations:",""] ++
map typeDeclAsAgda alltypes ++
showTypedTRSAsAgda opts rename [] funcrules ++
[hrule, ""] ++
concatMap (theoremAsAgda rename) theorules ++
[hrule]
--putStr agdaprog
let agdafile = mname ++ ".agda"
when (optVerb opts > 1 || not (optStore opts)) $ putStr agdaprog
when (optStore opts) $ do
writeFile agdafile agdaprog
when (optScheme opts == "nondet") $
mapM_ copyImport ["nondet.agda","nondet-thms.agda"]
when (optVerb opts > 0) $ putStrLn $
"Agda module '" ++ agdafile ++ "' written.\n" ++
"If you completed the proof, rename it to 'PROOF-" ++ theoname ++ ".agda'."
|
|
demand: |
argument 2 |
|
deterministic: |
deterministic operation |
|
documentation: |
Generate an Agda program file for a given theorem name and the list of all functions involved in this theorem. |
|
failfree: |
<FAILING> |
|
indeterministic: |
referentially transparent operation |
|
infix: |
no fixity defined |
|
iotype: |
{(_,{(,)},_,_) |-> _}
|
|
name: |
theoremToAgda |
|
precedence: |
no precedence defined |
|
result-values: |
_ |
|
signature: |
VerifyOptions.Options -> (String, String) -> [AbstractCurry.Types.CFuncDecl] -> [AbstractCurry.Types.CTypeDecl] -> Prelude.IO () |
|
solution-complete: |
operation might suspend on free variables |
|
terminating: |
possibly non-terminating |
|
totally-defined: |
possibly non-reducible on same data term |