add missing files from th-bool-dyn

This commit is contained in:
Simon Cruanes 2022-08-16 21:58:38 -04:00
parent a446af49be
commit b7eb6749a1
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
5 changed files with 89 additions and 0 deletions

View file

@ -0,0 +1,15 @@
(** Theory of boolean formulas.
This handles formulas containing "and", "or", "=>", "if-then-else", etc.
The difference with {!Sidekick_th_bool_static} is that here, clausification
of a formula [F] is done only when [F] is on the trail.
*)
module Intf = Intf
module Proof_rules = Proof_rules
open Intf
module type ARG = Intf.ARG
val theory : (module ARG) -> SMT.Theory.t

6
src/th-bool-dyn/dune Normal file
View file

@ -0,0 +1,6 @@
(library
(name Sidekick_th_bool_dyn)
(public_name sidekick.th-bool-dyn)
(libraries containers sidekick.core sidekick.smt-solver sidekick.util
sidekick.simplify)
(flags :standard -open Sidekick_util))

29
src/th-bool-dyn/intf.ml Normal file
View file

@ -0,0 +1,29 @@
open Sidekick_core
module SMT = Sidekick_smt_solver
module Simplify = Sidekick_simplify
type term = Term.t
type ty = Term.t
(** Boolean-oriented view of terms *)
type 'a bool_view = 'a Bool_view.t =
| B_bool of bool
| B_not of 'a
| B_and of 'a * 'a
| B_or of 'a * 'a
| B_imply of 'a * 'a
| B_equiv of 'a * 'a
| B_xor of 'a * 'a
| B_eq of 'a * 'a
| B_neq of 'a * 'a
| B_ite of 'a * 'a * 'a
| B_atom of 'a
(** Argument to the theory *)
module type ARG = sig
val view_as_bool : term -> term bool_view
(** Project the term into the boolean view. *)
val mk_bool : Term.store -> term bool_view -> term
(** Make a term from the given boolean view. *)
end

View file

@ -0,0 +1,19 @@
open Sidekick_core
type term = Term.t
type lit = Lit.t
let lemma_bool_tauto lits : Proof_term.t =
Proof_term.apply_rule "bool.tauto" ~lits
let lemma_bool_c name terms : Proof_term.t =
Proof_term.apply_rule ("bool.c." ^ name) ~terms
let lemma_bool_equiv t u : Proof_term.t =
Proof_term.apply_rule "bool.equiv" ~terms:[ t; u ]
let lemma_ite_true ~ite : Proof_term.t =
Proof_term.apply_rule "bool.ite.true" ~terms:[ ite ]
let lemma_ite_false ~ite : Proof_term.t =
Proof_term.apply_rule "bool.ite.false" ~terms:[ ite ]

View file

@ -0,0 +1,20 @@
open Sidekick_core
type term = Term.t
type lit = Lit.t
val lemma_bool_tauto : lit list -> Proof_term.t
(** Boolean tautology lemma (clause) *)
val lemma_bool_c : string -> term list -> Proof_term.t
(** Basic boolean logic lemma for a clause [|- c].
[proof_bool_c b name cs] is the Proof_term.t designated by [name]. *)
val lemma_bool_equiv : term -> term -> Proof_term.t
(** Boolean tautology lemma (equivalence) *)
val lemma_ite_true : ite:term -> Proof_term.t
(** lemma [a ==> ite a b c = b] *)
val lemma_ite_false : ite:term -> Proof_term.t
(** lemma [¬a ==> ite a b c = c] *)