Closed andrew-appel closed 1 year ago
example1
and example2
are performance issues. The performance is not so bad, so it is not a high priority.
example3
is about whether to include rep_lia
in list_solve
. Our design choice is that list_solve
should not depend on other parts of VST, which include rep_lia
. Another consideration is performance: if rep_lia
is not much slower than lia
, then it is like calling lia
twice. This overhead might be okay. Then we can add it to list_solve
in floyd/functional_base.v
using a hook in list_solve
.
example4
is a bug in list_solve
's internal mechanism. apply_list_ext
is an internal tactic to apply extensionality to lists. It used to fail when the array length goals in extensionality are not directly provable. I have updated the tactic and will push it so the array length goals will go through the same proof procedure as the main goal.
example5
is about instantiation choice. The completeness of list_solve
requires instantiating with the bound set. For example, if we have forall_range 0 n a P
, we always need to instantiate to P (a[0])
and P (a[n-1])
. This is costly and not often useful, so this instantiation is disabled by Ltac instantiate_bound_set := false
by default. I tested as follows. It solves but takes a long time.
Lemma example5: forall
(N cols r j : Z)
(col_ind row_ptr : list Z)
(L : Zlength row_ptr = N + 1)
(L1 : Zlength col_ind = Znth N row_ptr)
(COL : Forall (fun j : Z => 0 <= j < cols) col_ind)
(SORT : sorted Z.le (0 :: (r :: row_ptr) ++ [Int.max_unsigned]))
(H1 : 0 <= j < N),
sublist (Znth j row_ptr) (Znth (j + 1) row_ptr) col_ind =
sublist (Znth j row_ptr - r) (Znth (j + 1) row_ptr - r)
(sublist r (Zlength col_ind) col_ind).
Proof.
intros.
rewrite sublist_sublist.
- admit.
Ltac instantiate_bound_set ::= true.
- Time list_simplify. (* 56.665 secs *)
Abort.
Therefore, it is good to tune for sortedness. Your tactic is a plan.
The zlist solver
list_solve
has some trouble with sorted lists. In the examples below:sorted
hypothesis such assorted Z.le (0 :: (r :: row_ptr) ++ [m]))
, the solver fails. On the other hand, when we split up the hypothesis by means of my new tacticsplit_sorted
, the solver can succeed in some cases, and faster. This example demonstrates other problems as well, if you look at all the Fail commands.