Skip to content

Commit 2c5fb01

Browse files
committed
Abduction: bug fixed. add type cleaning and type checking to refutation.
1 parent 03644fb commit 2c5fb01

3 files changed

Lines changed: 16 additions & 12 deletions

File tree

Abduction/Abduction.thy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ strategy Attack_On_Or_Node =
7575

7676
setup\<open> Config.put_global Top_Down_Util.timeout_config (60.0 * 60.0 * 10.0) \<close>
7777
setup\<open> Config.put_global Top_Down_Util.limit_for_first_decrement 40 \<close>
78-
setup\<open> Config.put_global Top_Down_Util.limit_for_other_decrement 20 \<close>
78+
setup\<open> Config.put_global Top_Down_Util.limit_for_other_decrement 40 \<close>
7979

8080
(* UI *)
8181
ML\<open> (*This part (the definitions of long_keyword, long_statement, and short_statement) are from

Abduction/Seed_Of_Or2And_Edge.ML

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,6 @@ fun condition_to_filter_out_conjecture (parent_or(*parent_or*):term) (refutation
126126
not (SFTD.run_assertion pst parent_or SFTD.has_func_with_three_occs_in_a_row)
127127
andalso
128128
SFTD.run_assertion pst conjecture SFTD.has_func_with_three_occs_in_a_row;
129-
fun has_counter_example_in_prems (pst:Proof.state) (term:term) =
130-
let
131-
val prems = Logic.strip_imp_prems term: terms;
132-
in
133-
SS.any_of_these_is_refuted refutation pst prems: bool
134-
end;
135129
fun get_concl (term:term) = try (snd o Logic.dest_implies) term
136130
<$> Top_Down_Util.standardize_vnames
137131
<$> Isabelle_Utils.strip_atyp
@@ -140,12 +134,19 @@ fun condition_to_filter_out_conjecture (parent_or(*parent_or*):term) (refutation
140134
val concl_of_meta_imp_in_conjec = get_concl conjecture: term option;
141135
fun concls_are_same _ = Utils.mk_option_pair (concl_of_meta_imp_in_parent, concl_of_meta_imp_in_conjec)
142136
<$> (op =) |> Utils.is_some_true;
137+
fun concl_of_conj_refuted_even_cncl_of_parent_is_not _ =
138+
if is_none concl_of_meta_imp_in_parent orelse is_none concl_of_meta_imp_in_conjec
139+
then false
140+
else if SS.is_refuted refutation pst (the concl_of_meta_imp_in_parent)
141+
then false
142+
else SS.is_refuted refutation pst (the concl_of_meta_imp_in_conjec);
143143
in
144144
too_large () orelse
145145
eq_to_final_goal () andalso from_tactic orelse
146146
concl_is_eq_to_final_goal () (*andalso seed_is_from_tactic seed*) orelse
147147
has_func_with_three_occs_in_a_row_even_though_the_parent_does_not_have_those () orelse
148-
concls_are_same ()
148+
concls_are_same () orelse
149+
concl_of_conj_refuted_even_cncl_of_parent_is_not ()
149150
(*
150151
(*not from_tactic andalso not orig_prem_is_refuted andalso*) has_counter_example_in_prems pst conjecture(*TODO: This is BAD. We should also check if the conclusions are the same in the parent-node and the conjecture.*)
151152
*)

Abduction/Shared_State.ML

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,11 @@ in
9797
fun refute (synched_table:synched_term2real_table) (pst:Proof.state) (cnjctr:term): real =
9898
let
9999
val cnjctr_prop = if Top_Down_Util.is_prop cnjctr then cnjctr else HOLogic.mk_Trueprop cnjctr: term;
100+
val cnjctr_prop_clean = Top_Down_Util.standardize_vnames cnjctr_prop
101+
|> Isabelle_Utils.strip_atyp
102+
|> Utils.try_with @{prop "False"} (Syntax.check_prop (Proof.context_of pst)) : term;
100103
val old_table = Synchronized.value synched_table : term2real_table;
101-
val already_checked = defined old_table cnjctr_prop : bool;
104+
val already_checked = defined old_table cnjctr_prop_clean : bool;
102105
fun quickcheck cnjctr = (cnjctr, TBC_Utils.term_has_counterexample_in_pst pst cnjctr) : (term * real);
103106
val _ =
104107
if already_checked then ()
@@ -107,12 +110,12 @@ fun refute (synched_table:synched_term2real_table) (pst:Proof.state) (cnjctr:ter
107110
(* It is okay to spend some time to run quick-check before calling Synchronized.change:
108111
* Even if other threads find a counter-example for the same conjecture,
109112
* the result should be the same. *)
110-
val pair = quickcheck cnjctr_prop
113+
val pair = quickcheck cnjctr_prop_clean
111114
in
112115
Synchronized.change synched_table (insert_bool pair): unit
113116
end;
114-
val new_table = Synchronized.value synched_table: term2real_table;
115-
val result = lookup new_table cnjctr_prop : real;
117+
val new_table = Synchronized.value synched_table : term2real_table;
118+
val result = lookup new_table cnjctr_prop_clean: real;
116119
in
117120
result: real
118121
end;

0 commit comments

Comments
 (0)