Require Import Omega.
Require Import mathcomp.ssreflect.ssreflect.
Require Import CTL_def demo gen_def relaxed_pruning.

Set Implicit Arguments.
Import Prenex Implicits.

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

Completeness of the Gentzen System

Pruning Refutations to Gentzen derivations


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


  Definition ref' C := gen (C,aVoid).

  Lemma lcons_gen C a : ~~ lcons C -> gen (C,a).

  Ltac Lsupp1 := by rewrite /= ?fsubUset !fsub1 !inE // !ssub_refl.
  Ltac Lsupp2 := rewrite /weight /= ?fsumU !fsum1 /= /sltype.f_weight /= -?(plusE,minusE); apply/leP; omega.
  Ltac Lsupp3 := move => L; rewrite /= ?suppCU !suppC1 /=; by bcase.

  Lemma ref_R0 C a : C \in U -> (forall D, D \in base S0 C -> gen (D,a)) -> gen (C,a).

  Lemma ref_R1 C S : C \in U -> coref F ref' S -> ~~ suppS S C -> ref' C.

  Lemma ref_R2 C D a : D \in Req C -> gen (D,aR a) -> gen (C,a).

  Lemma fulfillsAUEn s t S C : C \in S0 -> ~~ fulfillsAU S S0 s t C -> exists D,
    [/\ D \in Req C , ~~ suppS S (t^+ |` D) &
        forall E, E \in base S0 (s^+ |` D) -> ~~ fulfillsAU S S0 s t E].

  Lemma ref_R4_aux s t (sF : s^+ \in F) (tF : t^+ \in F) S H C :
    coref F ref' S -> H `<=` U -> C \in U -> ~~ suppS S (t^+ |` C) ->
    (forall E, E \in base S0 (s^+ |` C) -> ~~ fulfillsAU S S0 s t E) ->
    gen (C,aAU (s,t,H)).

  Lemma ref_R4 S C : S `<=` S0 -> coref F ref' S -> C \in S -> pAU F C S -> ref' C.

  Lemma fulfillsAREn s t S C : C \in S0 -> ~~ fulfillsAR S S0 s t C ->
    (exists2 D : clause, D \in Req C & ~~ suppS S D) \/
    ~~ suppS S (t^-|` R C) /\ forall E : clause, E \in base S0 (s^- |` R C) -> ~~ fulfillsAR S S0 s t E.

  Lemma ref_R3_aux s t (sF : s^- \in F) (tF : t^- \in F) S H C :
    coref F ref' S -> H `<=` U -> C \in U -> ~~ suppS S (t^- |` C) ->
    (forall E, E \in base S0 (s^- |` C) -> ~~ fulfillsAR S S0 s t E) ->
    gen (C,aAR (s,t,H)).

  Lemma ref_R3 S C : S `<=` S0 -> coref F ref' S -> C \in S -> pAR F C S -> ref' C.

  Theorem refpred_ref' C : ref F C -> ref' C.

End RefPred.

Completeness Theorem


Theorem gen_complete C :
  gen (C,aVoid) + (exists (M:fmodel) (w:M), forall s, s \in C -> eval (interp' s) w).