Require Import Omega.
Require Import mathcomp.ssreflect.ssreflect.
Require Import K_def demo.

Set Implicit Arguments.
Import Prenex Implicits.

Implicit Types (C D : clause).

Hilbert Refutations


Section RefPred.
  Variable (F : {fset sform}).
  Hypothesis (sfc_F : sf_closed F).


  Definition href C := prv ([af C] ---> Bot).

  Ltac Lbase_aux := move => D; rewrite !inE; (try case/orP) =>/eqP->.
  Ltac Lbase1 := Lbase_aux; by rewrite /= ?fsubUset ?fsub1 ?powersetE ?fsubUset ?fsub1 ?inE ?ssub_refl.
  Ltac Lbase3 := Lbase_aux; rewrite /weight /= ?fsumU !fsum1 /= /sltype.f_weight /= -?(plusE,minusE);
                 apply/leP; omega.
  Ltac Lbase4 := move => L; Lbase_aux; by rewrite /sltype.supp /= ?suppCU ?suppC1 /=; bcase.

The lemma below is simple but tedious to prove. The recursive structure is provided in the sltype.v (Lemma supp_aux) such that it can be shared between all formula types for which Hilbert system and support have been defined.

  Lemma base0P C : C \in U ->
     prv ([af C] ---> \or_(L <- base [fset D in U | literalC D] C) [af L]).

  Lemma ax_lcons C : ~~ lcons C -> prv ([af C] ---> Bot).

  Lemma href_R2 C s : href (s^- |` R C) -> href (fAX s^- |` C).

  Section ContextRefutations.
  Variables (S : {fset clause}) (coref_S : coref F href S).

  Lemma baseP C : C \in U ->
     prv ([af C] ---> \or_(D <- base S C) [af D]).

  Lemma href_R1 C : C \in U -> ~~ suppS S C -> href C.

  End ContextRefutations.

  Theorem href_of C : ref F C -> href C.

End RefPred.

Completeness


Theorem informative_completeness s :
    prv (fImp s fF)
  + (exists2 M:fmodel, #|M| <= 2^(f_size s) & exists w:M, eval s w).

Corollary prv_dec s : decidable (prv s).

Corollary sat_dec s : decidable (exists (M:cmodel) (w:M), eval s w).

Corollary valid_dec s : decidable (forall (M:cmodel) (w:M), eval s w).

Small Model Theorem

Canonicity of pruning demo


Lemma DD_supp_sat F C : suppS (DD F) C -> exists M : cmodel, sat M C.

Fact DD_supp F (sfc_F : sf_closed F) (C : clause) :
  C \in U F -> reflect (exists M : cmodel, sat M C) (suppS (DD F) C).

Fact DD_canonical F (sfc_F : sf_closed F) (C : clause) :
  reflect (C \in S0 F /\ exists M : cmodel, sat M C) (C \in DD F).

Proposition support_sat C :
  (exists M, sat M C) <->
  (exists D, [/\ D \in S0 (sfc C), (exists M, sat M D) & suppC D C]).