Require Import Omega.
Require Import mathcomp.ssreflect.ssreflect.
Require Import CTL_def dags demo hilbert relaxed_pruning.
Import IC.

Set Implicit Arguments.
Import Prenex Implicits.

Implicit Types (C D L : clause) (S : {fset clause}).

Completeness of the Hilbert system

Pruning refutations to Hilbert Refutations


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


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

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

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

  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 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 ax_Req C L : C \in Req L -> prv ([af L] ---> EX [af C]).

  Lemma ax_ReqR C D : D \in Req C -> href D -> href C.

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

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

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

  Lemma unfulfilledAU_refute s t L : L \in S -> (fAX (fAU s t)^+ \in L) ->
    ~~ fulfillsAU S S0 s t L -> mprv ([af L] ---> Bot).

  Lemma unfulfilledAR_refute s t C : C \in S -> fAX (fAR s t)^- \in C ->
     ~~ fulfillsAR S S0 s t C -> prv ([af C] ---> Bot).

  End EventualityRefutations.

  Lemma href_translation C : ref F C -> href C.
End RefPred.

Informative Completeness and Corollaries


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

Corollary fin_completeness s : (forall (M:fmodel) (w:M), eval s w) -> prv s.

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).

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