Theory CDCL_W_Partial_Optimal_Model
theory CDCL_W_Partial_Optimal_Model
imports CDCL_W_Partial_Encoding
begin
lemma isabelle_should_do_that_automatically: ‹Suc (a - Suc 0) = a ⟷ a ≥ 1›
by auto
lemma (in conflict_driven_clause_learning⇩W_optimal_weight)
conflict_opt_state_eq_compatible:
‹conflict_opt S T ⟹ S ∼ S' ⟹ T ∼ T' ⟹ conflict_opt S' T'›
using state_eq_trans[of T' T
‹update_conflicting (Some (negate_ann_lits (trail S'))) S›]
using state_eq_trans[of T
‹update_conflicting (Some (negate_ann_lits (trail S'))) S›
‹update_conflicting (Some (negate_ann_lits (trail S'))) S'›]
update_conflicting_state_eq[of S S' ‹Some {#}›]
apply (auto simp: conflict_opt.simps state_eq_sym)
using reduce_trail_to_state_eq state_eq_trans update_conflicting_state_eq by blast
context optimal_encoding
begin
definition base_atm :: ‹'v ⇒ 'v› where
‹base_atm L = (if L ∈ Σ - ΔΣ then L else
if L ∈ replacement_neg ` ΔΣ then (SOME K. (K ∈ ΔΣ ∧ L = replacement_neg K))
else (SOME K. (K ∈ ΔΣ ∧ L = replacement_pos K)))›
lemma normalize_lit_Some_simp[simp]: ‹(SOME K. K ∈ ΔΣ ∧ (L⇧↦⇧0 = K⇧↦⇧0)) = L› if ‹L ∈ ΔΣ› for K
by (rule some1_equality) (use that in auto)
lemma base_atm_simps1[simp]:
‹L ∈ Σ ⟹ L ∉ ΔΣ ⟹ base_atm L = L›
by (auto simp: base_atm_def)
lemma base_atm_simps2[simp]:
‹L ∈ (Σ - ΔΣ) ∪ replacement_neg ` ΔΣ ∪ replacement_pos ` ΔΣ ⟹
K ∈ Σ ⟹ K ∉ ΔΣ ⟹ L ∈ Σ ⟹ K = base_atm L ⟷ L = K›
by (auto simp: base_atm_def)
lemma base_atm_simps3[simp]:
‹L ∈ Σ - ΔΣ ⟹ base_atm L ∈ Σ›
‹L ∈ replacement_neg ` ΔΣ ∪ replacement_pos ` ΔΣ ⟹ base_atm L ∈ ΔΣ›
apply (auto simp: base_atm_def)
by (metis (mono_tags, lifting) tfl_some)
lemma base_atm_simps4[simp]:
‹L ∈ ΔΣ ⟹ base_atm (replacement_pos L) = L›
‹L ∈ ΔΣ ⟹ base_atm (replacement_neg L) = L›
by (auto simp: base_atm_def)
fun normalize_lit :: ‹'v literal ⇒ 'v literal› where
‹normalize_lit (Pos L) =
(if L ∈ replacement_neg ` ΔΣ
then Neg (replacement_pos (SOME K. (K ∈ ΔΣ ∧ L = replacement_neg K)))
else Pos L)› |
‹normalize_lit (Neg L) =
(if L ∈ replacement_neg ` ΔΣ
then Pos (replacement_pos (SOME K. K ∈ ΔΣ ∧ L = replacement_neg K))
else Neg L)›
abbreviation normalize_clause :: ‹'v clause ⇒ 'v clause› where
‹normalize_clause C ≡ normalize_lit `# C›
lemma normalize_lit[simp]:
‹L ∈ Σ - ΔΣ ⟹ normalize_lit (Pos L) = (Pos L)›
‹L ∈ Σ - ΔΣ ⟹ normalize_lit (Neg L) = (Neg L)›
‹L ∈ ΔΣ ⟹ normalize_lit (Pos (replacement_neg L)) = Neg (replacement_pos L)›
‹L ∈ ΔΣ ⟹ normalize_lit (Neg (replacement_neg L)) = Pos (replacement_pos L)›
by auto
definition all_clauses_literals :: ‹'v list› where
‹all_clauses_literals =
(SOME xs. mset xs = mset_set ((Σ - ΔΣ) ∪ replacement_neg ` ΔΣ ∪ replacement_pos ` ΔΣ))›