Skip to content
Snippets Groups Projects
Commit 647587cc authored by Andre Maroneze's avatar Andre Maroneze
Browse files

[Logic] add attributes to identified lemmas

parent 5553210f
No related branches found
No related tags found
No related merge requests found
...@@ -127,6 +127,7 @@ and identified_lemma = { ...@@ -127,6 +127,7 @@ and identified_lemma = {
il_labels : logic_label list; il_labels : logic_label list;
il_args : string list; il_args : string list;
il_pred : toplevel_predicate; il_pred : toplevel_predicate;
il_attrs : attributes;
il_loc : location il_loc : location
} }
...@@ -422,6 +423,7 @@ include Datatype.Make_with_collections ...@@ -422,6 +423,7 @@ include Datatype.Make_with_collections
IPAxiom { IPAxiom {
il_name="";il_labels=[];il_args=[]; il_name="";il_labels=[];il_args=[];
il_pred=Logic_const.(toplevel_predicate ptrue); il_pred=Logic_const.(toplevel_predicate ptrue);
il_attrs=[];
il_loc=Location.unknown il_loc=Location.unknown
}] }]
...@@ -839,23 +841,25 @@ let rec pretty_debug fmt = function ...@@ -839,23 +841,25 @@ let rec pretty_debug fmt = function
Cil_types_debug.pp_kinstr id_kinstr Cil_types_debug.pp_kinstr id_kinstr
(Cil_types_debug.pp_option Cil_types_debug.pp_code_annotation) id_ca (Cil_types_debug.pp_option Cil_types_debug.pp_code_annotation) id_ca
Cil_types_debug.pp_variant id_variant Cil_types_debug.pp_variant id_variant
| IPAxiom {il_name; il_labels; il_args; il_pred; il_loc} -> | IPAxiom {il_name; il_labels; il_args; il_pred; il_attrs; il_loc} ->
Format.fprintf fmt "IPAxiom(%a,%a,%a,%a,%a)" Format.fprintf fmt "IPAxiom(%a,%a,%a,%a,%a,%a)"
Cil_types_debug.pp_string il_name Cil_types_debug.pp_string il_name
(Cil_types_debug.pp_list Cil_types_debug.pp_logic_label) il_labels (Cil_types_debug.pp_list Cil_types_debug.pp_logic_label) il_labels
(Cil_types_debug.pp_list Cil_types_debug.pp_string) il_args (Cil_types_debug.pp_list Cil_types_debug.pp_string) il_args
Cil_types_debug.pp_toplevel_predicate il_pred Cil_types_debug.pp_toplevel_predicate il_pred
Cil_types_debug.pp_attributes il_attrs
Cil_types_debug.pp_location il_loc Cil_types_debug.pp_location il_loc
| IPAxiomatic {iax_name; iax_props} -> | IPAxiomatic {iax_name; iax_props} ->
Format.fprintf fmt "IPAxiomatic(%a,%a)" Format.fprintf fmt "IPAxiomatic(%a,%a)"
Cil_types_debug.pp_string iax_name Cil_types_debug.pp_string iax_name
(Cil_types_debug.pp_list pretty_debug) iax_props (Cil_types_debug.pp_list pretty_debug) iax_props
| IPLemma {il_name; il_labels; il_args; il_pred; il_loc} -> | IPLemma {il_name; il_labels; il_args; il_pred; il_attrs; il_loc} ->
Format.fprintf fmt "IPLemma(%a,%a,%a,%a,%a)" Format.fprintf fmt "IPLemma(%a,%a,%a,%a,%a,%a)"
Cil_types_debug.pp_string il_name Cil_types_debug.pp_string il_name
(Cil_types_debug.pp_list Cil_types_debug.pp_logic_label) il_labels (Cil_types_debug.pp_list Cil_types_debug.pp_logic_label) il_labels
(Cil_types_debug.pp_list Cil_types_debug.pp_string) il_args (Cil_types_debug.pp_list Cil_types_debug.pp_string) il_args
Cil_types_debug.pp_toplevel_predicate il_pred Cil_types_debug.pp_toplevel_predicate il_pred
Cil_types_debug.pp_attributes il_attrs
Cil_types_debug.pp_location il_loc Cil_types_debug.pp_location il_loc
| IPTypeInvariant {iti_name; iti_type; iti_pred; iti_loc} -> | IPTypeInvariant {iti_name; iti_type; iti_pred; iti_loc} ->
Format.fprintf fmt "IPTypeInvariant(%a,%a,%a,%a)" Format.fprintf fmt "IPTypeInvariant(%a,%a,%a,%a)"
...@@ -1548,10 +1552,10 @@ let ip_of_global_annotation a = ...@@ -1548,10 +1552,10 @@ let ip_of_global_annotation a =
| Daxiomatic(iax_name, l, _, _) -> | Daxiomatic(iax_name, l, _, _) ->
let iax_props = List.fold_left aux [] l in let iax_props = List.fold_left aux [] l in
IPAxiomatic {iax_name; iax_props} :: (iax_props @ acc) IPAxiomatic {iax_name; iax_props} :: (iax_props @ acc)
| Dlemma(il_name, true, il_labels, il_args, il_pred, _, il_loc) -> | Dlemma(il_name, true, il_labels, il_args, il_pred, il_attrs, il_loc) ->
ip_axiom {il_name; il_labels; il_args; il_pred; il_loc} :: acc ip_axiom {il_name; il_labels; il_args; il_pred; il_attrs; il_loc} :: acc
| Dlemma(il_name, false, il_labels, il_args, il_pred, _, il_loc) -> | Dlemma(il_name, false, il_labels, il_args, il_pred, il_attrs, il_loc) ->
ip_lemma {il_name; il_labels; il_args; il_pred; il_loc} :: acc ip_lemma {il_name; il_labels; il_args; il_pred; il_attrs; il_loc} :: acc
| Dinvariant(l, igi_loc) -> | Dinvariant(l, igi_loc) ->
let igi_pred = match l.l_body with let igi_pred = match l.l_body with
| LBpred p -> p | LBpred p -> p
......
...@@ -157,6 +157,7 @@ and identified_lemma = { ...@@ -157,6 +157,7 @@ and identified_lemma = {
il_labels : logic_label list; il_labels : logic_label list;
il_args : string list; il_args : string list;
il_pred : toplevel_predicate; il_pred : toplevel_predicate;
il_attrs : attributes;
il_loc : location il_loc : location
} }
......
...@@ -68,6 +68,7 @@ type logic_lemma = { ...@@ -68,6 +68,7 @@ type logic_lemma = {
lem_property : predicate ; lem_property : predicate ;
lem_depends : logic_lemma list ; lem_depends : logic_lemma list ;
(* global lemmas declared before in AST order (in reverse order) *) (* global lemmas declared before in AST order (in reverse order) *)
lem_attrs : attributes ;
} }
type axiomatic = { type axiomatic = {
...@@ -203,10 +204,11 @@ let ip_lemma l = ...@@ -203,10 +204,11 @@ let ip_lemma l =
mk_prop mk_prop
{il_name = l.lem_name; il_labels = l.lem_labels; {il_name = l.lem_name; il_labels = l.lem_labels;
il_args = l.lem_types; il_loc = (l.lem_position, l.lem_position); il_args = l.lem_types; il_loc = (l.lem_position, l.lem_position);
il_attrs = l.lem_attrs;
il_pred = Logic_const.toplevel_predicate ~only_check l.lem_property} il_pred = Logic_const.toplevel_predicate ~only_check l.lem_property}
let lemma_of_global ~context = function let lemma_of_global ~context = function
| Dlemma(name,axiom,labels,types,pred,_,loc) -> | Dlemma(name,axiom,labels,types,pred,attrs,loc) ->
let kind = if axiom then `Axiom else let kind = if axiom then `Axiom else
if pred.tp_only_check then `Check else `Lemma in if pred.tp_only_check then `Check else `Lemma in
{ {
...@@ -217,6 +219,7 @@ let lemma_of_global ~context = function ...@@ -217,6 +219,7 @@ let lemma_of_global ~context = function
lem_kind = kind ; lem_kind = kind ;
lem_property = pred.tp_statement ; lem_property = pred.tp_statement ;
lem_depends = context ; lem_depends = context ;
lem_attrs = attrs ;
} }
| _ -> assert false | _ -> assert false
......
...@@ -40,6 +40,7 @@ type logic_lemma = { ...@@ -40,6 +40,7 @@ type logic_lemma = {
lem_labels : logic_label list ; lem_labels : logic_label list ;
lem_property : predicate ; lem_property : predicate ;
lem_depends : logic_lemma list ; (** in reverse order *) lem_depends : logic_lemma list ; (** in reverse order *)
lem_attrs : attributes ;
} }
type axiomatic = { type axiomatic = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment