Require Import Relations Omega.
Require Import mathcomp.ssreflect.ssreflect.
Require Import Kstar_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 ref C := prv ([af C] ---> Bot).

  Lemma refI1n s C : prv ([af C] ---> s) -> ref (s^- |` C).

  Lemma refE1n s C : ref (s^- |` C) -> prv ([af C] ---> s).

  Definition base0 C := [fset L in U | literalC L && suppC L C].

  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.

  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 R2 C s : ref (s^- |` R C) -> ref (fAX s^- |` C).

  Section ContextRefutations.
  Variable S : {fset clause}.
  Hypothesis sub_S : S `<=` S0.
  Hypothesis coref_S : coref F ref S.

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

  Lemma R1 C : C \in U -> ~~ suppS S C -> ref C.

  Lemma R3 C s : C \in S -> fAX (fAG s)^- \in C -> ~ fulfillAG S s C -> ref C.

  End ContextRefutations.

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

End RefPred.

Completeness


Lemma prf_ref_sound C : prv ([af C] ---> Bot) -> ~ (exists M : fmodel, sat M C).

Theorem informative_completeness s :
    prv (fImp s fF)
  + (exists2 M:fmodel, #|M| <= 2^(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


Corollary small_models s:
  (exists (M:cmodel) (w:M), eval s w) ->
  (exists2 M:fmodel, #|M| <= 2^(2 * f_size s) & exists w:M, eval s w).