123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114(******************************************************************************)(* This file is part of Waterproof-lib. *)(* *)(* Waterproof-lib is free software: you can redistribute it and/or modify *)(* it under the terms of the GNU General Public License as published by *)(* the Free Software Foundation, either version 3 of the License, or *)(* (at your option) any later version. *)(* *)(* Waterproof-lib is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)(* GNU General Public License for more details. *)(* *)(* You should have received a copy of the GNU General Public License *)(* along with Waterproof-lib. If not, see <https://www.gnu.org/licenses/>. *)(* *)(******************************************************************************)openEConstropenHintsopenProofviewopenHint_datasetopenHint_dataset_declarationsopenWp_autoopenWp_eautoopenWp_rewrite(**
Is automation shield enabled ?
*)letautomation_shield:boolref=Summary.ref~name:"automation_shield"true(**
Do we want to debug the automation ?
*)letautomation_debug:boolref=Summary.ref~name:"automation_debug"false(**
Should rewrite hints be printed ?
*)letprint_rewrite_hints:boolref=Summary.ref~name:"print_rewrite_hints"false(**
Function that will actually call automation functions
*)letautomation_routine(depth:int)(lems:Tactypes.delayed_open_constrlist)(databases:hint_db_namelist):unittactic=Tacticals.tclFIRST[Tacticals.tclCOMPLETE@@tclIGNORE@@wp_auto!automation_debugdepthlemsdatabases;Tacticals.tclCOMPLETE@@tclIGNORE@@wp_eauto!automation_debugdepthlemsdatabases;Tacticals.tclCOMPLETE@@tclIGNORE@@wp_autorewrite~print_hints:(!print_rewrite_hints)!automation_debug@@wp_auto!automation_debugdepthlemsdatabases;Tacticals.tclCOMPLETE@@tclIGNORE@@wp_autorewrite~print_hints:(!print_rewrite_hints)!automation_debug@@wp_eauto!automation_debugdepthlemsdatabases](**
Same function as {! automation_routine} but with restricted version of automation functions
*)letrestricted_automation_routine(depth:int)(lems:Tactypes.delayed_open_constrlist)(databases:hint_db_namelist)(must_use:Pp.tlist)(forbidden:Pp.tlist):unittactic=Tacticals.tclFIRST[Tacticals.tclCOMPLETE@@tclIGNORE@@rwp_auto!automation_debugdepthlemsdatabasesmust_useforbidden;Tacticals.tclCOMPLETE@@tclIGNORE@@rwp_eauto!automation_debugdepthlemsdatabasesmust_useforbidden;Tacticals.tclCOMPLETE@@tclIGNORE@@wp_autorewrite~print_hints:(!print_rewrite_hints)!automation_debug@@wp_auto!automation_debugdepthlemsdatabases;Tacticals.tclCOMPLETE@@tclIGNORE@@wp_autorewrite~print_hints:(!print_rewrite_hints)!automation_debug@@wp_eauto!automation_debugdepthlemsdatabases](**
Waterprove
This function is the main automatic solver of coq-waterproof.
The databases used for the proof search are the one declared in the current imported dataset (see {! Hint_dataset.loaded_hint_dataset}).
The forbidden patterns are defined in {! is_forbidden}.
Arguments:
- [depth] ([int]): max depth of the proof search
- [shield] ([bool]): if set to [true], will stop the proof search if a forbidden pattern is found
- [lems] ([Tactypes.delayed_open_constr list]): additional lemmas that are given to solve the proof
- [database_type] ([Hint_dataset_declarations]): type of databases that will be use as hint databases
*)letwaterprove(depth:int)?(shield:bool=false)(lems:Tactypes.delayed_open_constrlist)(database_type:database_type):unittactic=Proofview.Goal.enter@@fungoal->beginifshield&&!automation_shieldthenautomation_routine3lems(get_current_databasesShorten)elseautomation_routinedepthlems(get_current_databasesdatabase_type)end(**
Restricted Waterprove
This function is similar to {! waterprove} but use {! wp_auto.rwp_auto} and {! wp_eauto.rwp_eauto} instead of {! wp_auto.wp_auto} and {! wp_eauto.wp_eauto}.
Arguments:
- [depth] ([int]): max depth of the proof search
- [shield] ([bool]): if set to [true], will stop the proof search if a forbidden pattern is found
- [lems] ([Tactypes.delayed_open_constr list]): additional lemmas that are given to solve the proof
- [database_type] ([Hint_dataset_declarations]): type of databases that will be use as hint databases
- [must_use] ([string list]): list of hints that have to be used during the automatic solving
- [forbidden] ([string list]): list of hints that must not be used during the automatic solving
*)letrwaterprove(depth:int)?(shield:bool=false)(lems:Tactypes.delayed_open_constrlist)(database_type:database_type)(must_use:constrlist)(forbidden:constrlist):unittactic=Proofview.Goal.enter@@fungoal->beginletenv=Proofview.Goal.envgoalinletsigma=Proofview.Goal.sigmagoalinletmust_use_tactics=List.map(Printer.pr_econstr_envenvsigma)must_useinletforbidden_tactics=List.map(Printer.pr_econstr_envenvsigma)forbiddeninifshield&&!automation_shieldthenrestricted_automation_routine3lems(get_current_databasesShorten)must_use_tacticsforbidden_tacticselserestricted_automation_routinedepthlems(get_current_databasesdatabase_type)must_use_tacticsforbidden_tacticsend