@@ -125,98 +125,3 @@ theorem setEntails_iff_union_not_unsat' [inst : DecidableEq X]
125125 intro I β hgstrue
126126 specialize hunsat I β
127127 aesop
128-
129-
130- /- ## Exercise 4 -/
131-
132- namespace Exercise4
133-
134- /- ### Exercise 4-1 -/
135-
136- inductive fs where | b | c | d | f deriving BEq
137- inductive ps where | P
138- def F : Formula ⟨fs, ps⟩ String := .and (.and (.and (.atom (.pred .P [.func .b []]))
139- (.atom (.pred .P [.func .c []])))
140- (.neg (.atom (.pred .P [.func .d []]))))
141- (.neg (.ex "x" (.atom (.pred .P [.func .f [.func .f [.var "x" ]]]))))
142-
143- theorem ex_4_1 : ∃ I : Interpretation ⟨fs, ps⟩ (Fin 2 ), ∃ β : Assignment String (Fin 2 ),
144- Formula.eval I β F := by
145- let I : Interpretation ⟨fs, ps⟩ (Fin 2 ) := ⟨
146- fun g a => if g == .f || g == .d then 1 else 0 ,
147- fun _ u => if u[0 ]! == 0 then True else False⟩
148- use I
149- use (fun _ => 0 )
150- simp [I, F]
151- have : fs.f == fs.f := rfl
152- aesop
153-
154-
155- /-
156- Exercise 4.7 (*)
157- Let Π be a set of propositional variables. Let N and N' be sets
158- of clauses over Π. Let S be a set of literals that does not contain any complementary
159- literals. Prove: If every clause in N contains at least one literal L with L ∈ S and if no
160- clause in N' contains a literal L with L ∈ S, then N ∪ N' is satisfiable if and only if N'
161- is satisfiable.
162- -/
163- def Interpretation.add (I : Interpretation ⟨Empty, String⟩ String)
164- (β : Assignment Empty String) (L : Literal ⟨Empty, String⟩ Empty) :
165- Interpretation ⟨Empty, String⟩ String :=
166- -- add something to I such that Formula.eval L is true
167- Interpretation.mk I.functions (match L with
168- | Literal.pos a => match a with
169- | Atom.pred p args =>
170- have argsinter := args.map (Term.eval I β)
171- (fun p' args' => if p' == p && args' == argsinter
172- then True
173- else I.predicates p' args')
174- | Literal.neg a => match a with
175- | Atom.pred p args =>
176- have argsinter := args.map (Term.eval I β)
177- (fun p' args' => if p' == p && args' == argsinter
178- then False
179- else I.predicates p' args')
180- )
181-
182- lemma tmp (I : Interpretation ⟨Empty, String⟩ String) (β : Assignment Empty String)
183- (C : Clause ⟨Empty, String⟩ Empty)
184- (hCsat : EntailsInterpret I β C) (L : Literal ⟨Empty, String⟩ Empty) (h : L.comp ∉ C) :
185- EntailsInterpret (Interpretation.add I β L) β C := by
186- sorry
187-
188- theorem ex_4_7
189- (N N' : Set <| Clause ⟨Empty, String⟩ Empty) (S : Set <| Literal ⟨Empty, String⟩ Empty)
190- (hSnoCompl : ∀ L ∈ S, L.comp ∉ S)
191- (hNsatByS : ∀ C ∈ N, ∃ L ∈ C, L ∈ S) (hN'noComplS : ∀ C ∈ N', ¬∃ L ∈ C, L.comp ∈ S) :
192- (@ClauseSetSatisfiable _ _ univ _ (N ∪ N') ↔ @ClauseSetSatisfiable _ _ univ _ N') := by
193- simp only [not_exists, not_and] at hN'noComplS
194- apply Iff.intro
195- · simp [ClauseSetSatisfiable]
196- intro I β h
197- apply Exists.intro
198- · apply Exists.intro
199- · intro C a
200- apply h
201- simp_all only [or_true]
202- · simp [ClauseSetSatisfiable]
203- intro I_N' β_N' hN'sat
204- use I_N'
205- use β_N' -- delay instanciation of assignment
206- intro C hC
207- cases hC
208- next hCinN =>
209- /- This is the actual hard case of this exercise. On paper it might look like this:
210- - Show that I_N' and β_N' do not contradict (SAT N) (this is due to hN'noComplS)
211- - Expand β_N' by the assignments implied by S to β_N'andS
212- - then β_N'andS satisfies N using hNsatByS
213- -/
214- obtain ⟨L, ⟨hLinC, hLinS⟩⟩ := hNsatByS C hCinN
215- have hLcompninS : L.comp ∉ S := by exact hSnoCompl L hLinS
216- --let ?β := β_N'
217- --let β_N'andS := β.modify L
218- sorry
219-
220- next hCinN' => exact hN'sat C hCinN'
221-
222- end Exercise4
0 commit comments