Theory IsaSAT_Arena_Sorting_LLVM
theory IsaSAT_Arena_Sorting_LLVM
imports IsaSAT_Sorting_LLVM IsaSAT_Arena_LLVM
begin
type_synonym vdom_fast_assn = ‹64 word array_list64›
abbreviation vdom_fast_assn :: ‹vdom ⇒ vdom_fast_assn ⇒ assn› where
‹vdom_fast_assn ≡ arl64_assn sint64_nat_assn›
sepref_def delete_index_and_swap_code2
is ‹uncurry (RETURN oo delete_index_and_swap)›
:: ‹[λ(xs, i). i < length xs]⇩a
vdom_fast_assn⇧d *⇩a sint64_nat_assn⇧k → vdom_fast_assn›
unfolding delete_index_and_swap.simps
by sepref
definition idx_cdom :: ‹arena ⇒ nat set› where
‹idx_cdom arena ≡ {i. valid_sort_clause_score_pre_at arena i}›
clause_score_extract arena_status arena_lbd unat32_max DELETED
lemma valid_sort_clause_score_pre_at_alt_def:
‹valid_sort_clause_score_pre_at arena C ⟷
(∃i vdom. C = vdom ! i ∧ arena_is_valid_clause_vdom arena (vdom!i) ∧
(arena_status arena (vdom!i) ≠ DELETED ⟶
((get_clause_LBD_pre arena (vdom!i) ∧ arena_act_pre arena (vdom!i)) ∧
arena_is_valid_clause_idx arena C))
∧ i < length vdom)›
unfolding valid_sort_clause_score_pre_at_def arena_is_valid_clause_idx_def
arena_act_pre_def arena_is_valid_clause_idx_def by auto
sepref_def (in -)
is ‹uncurry (RETURN oo clause_score_extract)›
:: ‹[uncurry valid_sort_clause_score_pre_at]⇩a
arena_fast_assn⇧k *⇩a sint64_nat_assn⇧k → uint32_nat_assn ×⇩a sint64_nat_assn ×⇩a sint64_nat_assn›
supply [[goals_limit = 1]]
unfolding clause_score_extract_def valid_sort_clause_score_pre_at_alt_def unat64_max_def[simplified]
sepref
sepref_def (in -) clause_score_ordering_code
is ‹uncurry (RETURN oo clause_score_ordering)›
:: ‹(uint32_nat_assn ×⇩a sint64_nat_assn ×⇩a sint64_nat_assn)⇧k *⇩a (uint32_nat_assn ×⇩a sint64_nat_assn ×⇩a sint64_nat_assn)⇧k →⇩a bool1_assn›
supply [[goals_limit = 1]]
unfolding clause_score_ordering_def
by sepref
sepref_register mop_clause_score_less clause_score_less clause_score_ordering
sepref_def mop_clause_score_less_impl
is ‹uncurry2 mop_clause_score_less›
:: ‹arena_fast_assn⇧k *⇩a sint64_nat_assn⇧k *⇩a sint64_nat_assn⇧k →⇩a bool1_assn›
unfolding mop_clause_score_less_def
by sepref
interpretation LBD: weak_ordering_on_lt where
C = ‹idx_cdom vs› and
less = ‹clause_score_less vs›
by unfold_locales
(auto simp: clause_score_less_def clause_score_extract_def
clause_score_ordering_def split: if_splits)