https://github.com/EasyCrypt/easycrypt
Revision 36f7f5a29ef730b23ec3b2a96e76e387e90ea0e5 authored by Alley Stoughton on 21 February 2018, 22:32:02 UTC, committed by Pierre-Yves Strub on 26 February 2018, 15:04:53 UTC
The elements of prover [...] have one of the following forms, where s
is a string:

s (add s to the use-only list)
+s (add include s to the include/exclude list)
-s (add exclude s to the include/exclude list)

The include/exclude list is ordered, so that later instructions can
supersede earlier ones. The use-only list was not ordered, but now
is. The relative order of the use-only and include/exclude lists
is irrelevant, so that, e.g., prover ["Z3" +"Alt-Ergo"] and prover
[+"Alt-Ergo" "Z3"] are equivalent.

The semantics is that the use-only list is first interpreted (if it's
empty, one starts with the current provers as the base), and only then
are the instructions of the include/exclude list applied to it, in
order.

There was already the special use-only instruction "ALL". Now, there is
also the use-only instruction "CLEAR", which clears the use-only list,
but may be superseded by the use-only instructions that follow.

Examples (assuming "Z3" and "Alt-Ergo" are only known provers):
prover []. (* a no-op *)
prover [+"Z3"]  (* adds just "Z3" to whatever current provers are *)
prover [-"Z3"]  (* removes just "Z3" from whatever current provers are *)
prover ["ALL"]  (* results in "Z3", "Alt-Ergo" *)
prover ["CLEAR"]  (* results in nothing *)
prover ["CLEAR" +"Z3"]  (* results in just "Z3" *)
prover [+"Z3" "CLEAR"]  (* results in just "Z3" *)
prover ["CLEAR" "Z3"]  (* result in just "Z3" *)
prover ["Z3" "CLEAR"]  (* results in nothing *)
prover [-"Z3" "ALL"]  (* results in "Alt-Ergo" *)
prover [+"Z3" "ALL" -"Z3"]  (* results in "Alt-Ergo" *)
prover [-"Z3" "ALL" +"Z3"]  (* results in "Z3", "Alt-Ergo" *)
1 parent 5115c89
Raw File
Tip revision: 36f7f5a29ef730b23ec3b2a96e76e387e90ea0e5 authored by Alley Stoughton on 21 February 2018, 22:32:02 UTC
Added clean way to clear the list of current provers.
Tip revision: 36f7f5a
ecCoreHiPhl.ml
(* --------------------------------------------------------------------
 * Copyright (c) - 2012--2016 - IMDEA Software Institute
 * Copyright (c) - 2012--2018 - Inria
 * Copyright (c) - 2012--2018 - Ecole Polytechnique
 *
 * Distributed under the terms of the CeCILL-C-V1 license
 * -------------------------------------------------------------------- *)

(* -------------------------------------------------------------------- *)
open EcTypes
open EcFol
open EcEnv
open EcLogic

(* -------------------------------------------------------------------- *)
let process_phl_form ty g phi =
  let (hyps, concl) = get_goal g in

  let m =
    match concl.f_node with
    | FhoareS   hs -> hs.hs_m
    | FbdHoareS hs -> hs.bhs_m
    | _ -> tacuerror "expecting a (bounded) hoare statement"
  in

  let hyps = LDecl.push_active m hyps in
    EcCoreHiLogic.process_form hyps phi ty

(* -------------------------------------------------------------------- *)
let process_prhl_form ty g phi =
  let (hyps, concl) = get_goal g in

  let (ml, mr) =
    match concl.f_node with
    | FequivS es -> (es.es_ml, es.es_mr)
    | _ -> tacuerror "expecting a PRHL statement"
  in

  let hyps = LDecl.push_all [ml; mr] hyps in
    EcCoreHiLogic.process_form hyps phi ty

let process_prhl_post g phi =
  let env, hyps, concl = get_goal_e g in
  let (ml, mr) =
    match concl.f_node with
    | FequivS es -> (es.es_ml, es.es_mr)
    | FequivF ef -> snd (EcEnv.Fun.equivF_memenv ef.ef_fl ef.ef_fr env)
    | _ -> tacuerror "expecting a PRHL statement" in
  let hyps = LDecl.push_all [ml; mr] hyps in
  EcCoreHiLogic.process_form hyps phi tbool

(* -------------------------------------------------------------------- *)
let process_phl_exp side e ty g =
  let (hyps, concl) = get_goal g in

  let (m, _) =
    try  EcFol.destr_programS side concl
    with DestrError _ -> tacuerror "conclusion not of the right form"
  in

  let hyps = LDecl.push_active m hyps in
    EcCoreHiLogic.process_exp hyps `InProc e ty

(* -------------------------------------------------------------------- *)
let process_phl_formula  = process_phl_form tbool
let process_prhl_formula = process_prhl_form tbool

let process_prhl_stmt side g c =
  let (hyps, concl) = get_goal g in

  let es   = EcCorePhl.t_as_equivS concl in
  let mt   = snd (if side then es.es_ml else es.es_mr) in
  let hyps = LDecl.push_active (mhr,mt) hyps in
  let env  = LDecl.toenv hyps in
  let ue   = EcCoreHiLogic.unienv_of_hyps hyps in
  let c    = EcTyping.transstmt env ue c in
  let esub = Tuni.offun (EcUnify.UniEnv.close ue) in
  let esub = { e_subst_id with es_ty = esub; } in
    EcModules.s_subst esub c
back to top