Last active
December 23, 2023 11:12
-
-
Save jp-diegidio/37fef7673349cd4bad3b007b3368164c to your computer and use it in GitHub Desktop.
Naive SAT solver in Coq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From Coq Require Import Bool. | |
Ltac solve_sat_naive := | |
repeat multimatch goal with | |
| [|- exists _ : bool, _] => exists true | |
| [|- exists _ : bool, _] => exists false | |
end; reflexivity. | |
Example ex_01 : exists x y, x && negb y = true. | |
Proof. solve_sat_naive. Qed. | |
Example ex_02 : exists x y z, x && negb y || z = false. | |
Proof. solve_sat_naive. Qed. | |
Example ex_e1 : exists x, x && negb x = true. | |
Proof. Fail solve_sat_naive. Abort. | |
Print ex_01. | |
(* | |
ex_01 = | |
ex_intro (fun x => exists y, x && negb y = true) true | |
(ex_intro (fun y => true && negb y = true) false | |
eq_refl) | |
: exists x y, x && negb y = true | |
*) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment