File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import BoltLean.Boolean.Basic
2+
3+ namespace Valuation
4+ @[simp]
5+ def exact_at_indices (v: Valuation n_var) (indices: List (Fin n_var)): BoolFormula n_var :=
6+ let vars := indices.map (fun i => BoolFormula.Var i (¬v[i]))
7+ vars.foldr BoolFormula.And BoolFormula.True
8+
9+ def exact (v: Valuation n_var): BoolFormula n_var :=
10+ v.exact_at_indices (List.finRange n_var)
11+
12+ -- Completeness of Exact
13+ theorem exact_at_indices_accepts (v: Valuation n_var) (indices: List (Fin n_var)):
14+ (v.exact_at_indices indices).accepts v := by
15+ induction indices with
16+ | nil => simp
17+ | cons hd tl ih =>
18+ simp
19+ simp at ih
20+ exact ih
21+
22+ theorem exact_accepts (v: Valuation n_var):
23+ v.exact.accepts v := by
24+ unfold exact
25+ apply exact_at_indices_accepts
26+
27+ -- Soundness of Exact
28+ theorem exact_at_indices_accepts_exact (v v': Valuation n_var) (indices: List (Fin n_var)):
29+ (v.exact_at_indices indices).accepts v' → ∀ i ∈ indices, v[i.val] = v'[i.val] := by
30+ intro h i hi
31+ induction indices with
32+ | nil => simp at hi
33+ | cons hd tl ih =>
34+ simp at h
35+ simp [exact_at_indices] at ih
36+ by_cases hyp: i ∈ tl
37+ . exact ih h.right hyp
38+ . simp [hyp] at hi
39+ rw [hi]
40+ rw [eq_comm]
41+ exact h.left
42+
43+ theorem exact_accepts_only (v v': Valuation n_var):
44+ v.exact.accepts v' → v = v' := by
45+ intro hex
46+ ext i hi
47+ unfold exact at hex
48+ apply exact_at_indices_accepts_exact v v' (List.finRange n_var) hex ⟨i, hi⟩
49+ simp
50+
51+ end Valuation
You can’t perform that action at this time.
0 commit comments