-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCnfSpec.v
39 lines (27 loc) · 799 Bytes
/
CnfSpec.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
(** Syntax and Semantics of CNF *)
Require Export BinNums.
Local Open Scope list_scope.
Definition var := positive.
Definition model := var -> bool.
Record literal := { is_pos: bool ; ident: var }.
(* syntactic clause *)
Definition clause := list literal.
Fixpoint sat (c: clause) (m: model): Prop :=
match c with
| nil => False
| l::c' => m (ident l) = is_pos l \/ sat c' m
end.
(* syntactic cnf *)
Definition cnf := list clause.
Fixpoint sats (f: cnf) (m: model): Prop :=
match f with
| nil => True
| c::f' => sat c m /\ sats f' m
end.
Inductive isUnsat (f:cnf): Prop :=
isUnsat_proof: (forall m, ~(sats f m)) -> isUnsat f.
Definition isSat(f: cnf): Prop := exists m, sats f m.
Lemma isSat_neg_isUnsat (f: cnf): isUnsat f <-> ~(isSat f).
Proof.
firstorder.
Qed.