Skip to content
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

Fix why3 tactic (WIP) #1174

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/common/debug.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module D = struct
| Some x -> out ppf "Some(%a)" elt x

let pair : 'a pp -> 'b pp -> ('a * 'b) pp = fun elt1 elt2 ppf (x1,x2) ->
out ppf "%a,%a" elt1 x1 elt2 x2
out ppf "(%a,%a)" elt1 x1 elt2 x2

let list : 'a pp -> 'a list pp = fun elt ppf l ->
match l with
Expand Down
38 changes: 34 additions & 4 deletions src/handle/fol.ml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
(** Configuration for tactics based on first-order logic. *)

open Common
open Common open Error
open Core open Term

(** Builtin configuration for propositional logic. *)
type config =
{ symb_P : sym (** Encoding of propositions. *)
{ symb_Prop: sym (** Type of propositions. *)
; symb_P : sym (** Encoding of propositions. *)
; symb_Set : sym (** Type of sets. *)
; symb_T : sym (** Encoding of types. *)
; symb_or : sym (** Disjunction(∨) symbol. *)
; symb_and : sym (** Conjunction(∧) symbol. *)
; symb_imp : sym (** Implication(⇒) symbol. *)
; symb_eqv : sym (** Equivalence(⇔) symbol. *)
; symb_bot : sym (** Bot(⊥) symbol. *)
; symb_top : sym (** Top(⊤) symbol. *)
; symb_not : sym (** Not(¬) symbol. *)
Expand All @@ -19,11 +22,38 @@ type config =
(** [get_config ss pos] build the configuration using [ss]. *)
let get_config : Sig_state.t -> Pos.popt -> config = fun ss pos ->
let builtin = Builtin.get ss pos in
{ symb_P = builtin "P"
; symb_T = builtin "T"
let symb_P = builtin "P" and symb_T = builtin "T" in
let symb_Prop =
match unfold Timed.(!(symb_P.sym_type)) with
| Prod(a,_) ->
begin
match unfold a with
| Symb s -> s
| _ ->
fatal pos "The type of %a is not of the form Prop → _ \
with Prop a symbol." Print.sym symb_P
end
| _ -> fatal pos "The type of %a is not a product" Print.sym symb_P
and symb_Set =
match unfold Timed.(!(symb_T.sym_type)) with
| Prod(a,_) ->
begin
match unfold a with
| Symb s -> s
| _ ->
fatal pos "The type of %a is not of the form Prop → _ \
with Prop a symbol." Print.sym symb_T
end
| _ -> fatal pos "The type of %a is not a product" Print.sym symb_T
in
{ symb_Prop
; symb_P
; symb_Set
; symb_T
; symb_or = builtin "or"
; symb_and = builtin "and"
; symb_imp = builtin "imp"
; symb_eqv = builtin "eqv"
; symb_bot = builtin "bot"
; symb_top = builtin "top"
; symb_not = builtin "not"
Expand Down
6 changes: 3 additions & 3 deletions src/handle/rewrite.ml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let get_eq_config : Sig_state.t -> popt -> eq_config = fun ss pos ->

(* Register checks for the builtin symbols related to rewriting. *)
let _ =
let check_t_or_p _ss pos sym =
let check_codomain_is_Type _ss pos sym =
let valid =
match Eval.whnf [] !(sym.sym_type) with
| Prod(_, b) -> Eval.eq_modulo [] (snd (Bindlib.unbind b)) mk_Type
Expand All @@ -40,9 +40,9 @@ let _ =
fatal pos "The type of [%s] is not of the form [_ → TYPE]." sym.sym_name
in
(* The type of the builtin ["T"] should be [U → TYPE]. *)
Builtin.register "T" check_t_or_p;
Builtin.register "T" check_codomain_is_Type;
(* The type of the builtin ["P"] should be [Prop → TYPE]. *)
Builtin.register "P" check_t_or_p;
Builtin.register "P" check_codomain_is_Type;
let get_domain_of_type s =
match Eval.whnf [] !(s.sym_type) with
| Prod(a,_) -> a
Expand Down
Loading
Loading