Require Import mathcomp.ssreflect.ssreflect.
Require Import CTL_def hilbert.
Import IC.

Set Implicit Arguments.
Import Prenex Implicits.

Agreement of Paths Semantics and Inductive Semantics

Agreement on Finite Models

Function choosing infinite paths for serial relations

Lemma xchoose_rel (T : choiceType) (e : rel T) :
  (forall x, exists y, e x y) -> exists f, forall x, e x (f x).

We show that the path semantics agrees with the boolean reflections for the inductive semantics on finite models.

Section Agreement.
  Variables (T: finType) (e : rel T) (p q : pred T).
  Hypothesis serial_e : forall x, exists y, e x y.

  Lemma auP2 w : reflect (pAU e p q w) (AUb w).

  Lemma pARE1 w : pAR e p q w -> q w.

  Lemma pARE2 w v : pAR e p q w -> ~~ p w -> e w v -> pAR e p q v.

  Lemma arP2 w : reflect (pAR e p q w) (ARb w).
End Agreement.

Given the agreement for AU and AR, agreement between the two semantics follows using a simple induction on formulas

Lemma evalP2 (M:fmodel) s (w : M) : satisfies s w <-> eval s w.

Agreement on General Models

Even though this is not necesary for the soundness result we prove the corresponcence lemmas for all characterizations (AU, AG, EU, and EG).

Lemma dn (xm : XM) : forall P, ~ ~ P -> P.

Lemma dmAll (xm : XM) X (P : X -> Prop) : (~ forall x, P x) -> exists x, ~ P x.

Lemma nImp (xm : XM) (P Q : Prop) : ~ (P -> Q) -> P /\ ~ Q.

Section Paths.
  Variables (X : Type) (R : X -> X -> Prop) (P Q : X -> Prop).
  Hypothesis (R_serial : forall x, exists y, R x y).

  Implicit Types (f g : nat -> X).

  Lemma dmAU (xm : XM) w : ~ cAU R P Q w -> cER R (PredC P) (PredC Q) w.

  Lemma dmAR (xm : XM) w : ~ cAR R P Q w -> cEU R (PredC P) (PredC Q) w.

  Lemma dmpAR (xm : XM) w : ~ pAR R P Q w -> pEU R (PredC P) (PredC Q) w.

  Lemma EU1 (dc : DC_ X) w : cEU R P Q w -> pEU R P Q w.

  Lemma EU2 w : pEU R P Q w -> cEU R P Q w.

  Lemma AU1 w : cAU R P Q w -> pAU R P Q w.

This is, up to duality, the converse direction of AU1, see AU2 below
  Lemma ER1 (xm : XM ) (dc : DC_ X) w : cER R P Q w -> pER R P Q w.
End Paths.

Section Paths2.
  Variables (X : Type) (R : X -> X -> Prop).
  Hypothesis (R_serial : forall x, exists y, R x y).

  Lemma AU2 (xm : XM) (dc : DC_ X) P Q w : pAU R P Q w -> cAU R P Q w.

  Lemma ER2 (xm : XM) P Q w : pER R P Q w -> cER R P Q w.

  Lemma AR1 (xm : XM) (dc : DC_ X) P Q w : pAR R P Q w -> cAR R P Q w.

  Lemma AR2 (xm : XM) P Q w : cAR R P Q w -> pAR R P Q w.
End Paths2.

Soundness of Hilbert System for Path Semantics and General Models


Section Soundness.

Variables (xm : XM) (dc : DC).

Lemma sts_agreement (M:sts) (w :M) s : eval s w <-> satisfies s w.

Lemma sts_path_soundness s : prv s -> forall (M : sts) (w : M), satisfies s w.

End Soundness.

Lemma XM_required :
  (forall s, prv s -> forall (M : sts) (w : M), satisfies s w) -> XM.

Lemma prv_ER : prv (ER fF (fF ---> fF)).

Lemma DC_required :
  (forall s, prv s -> forall (M : sts) (w : M), satisfies s w) -> DC.

Agreement with Disjunctive Release implies LPO

We give a path characterization for AR that is classically equivalent to pAR but does not constructively agree with cAR on finite models

Definition p_release' X (p q : X -> Prop) pi :=
  (forall n, q (pi n)) \/ (exists2 n, p (pi n) & forall m, m < n -> q (pi m)).

Definition pAR' X (R : X -> X -> Prop) (p q : X -> Prop) (w : X) : Prop :=
  forall pi, path R pi -> pi 0 = w -> p_release' p q pi.

Definition R3 (m n : 'I_3) : bool :=
  match m : nat, n : nat with
    | 0,0 => true
    | 0,1 => true
    | 1,2 => true
    | 2,2 => true
    | _,_ => false
  end.

Lemma ser_R3 : forall w, exists v, R3 w v.

Definition L3 p (w : 'I_3) :=
  match p with
    | 0 => w == 1 :> nat
    | 1 => w < 2
    | _ => false
  end.

Definition M3 := FModel L3 ser_R3.

Lemma AR3_0 : cAR (@trans M3) (eval (fV 0)) (eval (fV 1)) ord0.

Section LPO.
  Hypothesis hyp_AR : forall (M : fmodel) (w : M) (s t : form),
    cAR (@trans M) (eval s) (eval t) w -> pAR' (@trans M) (satisfies s) (satisfies t) w.

  Variable f : nat -> bool.

  Definition pi3 (n : nat) : 'I_3 :=
    match n with
      | 0 => ord0
      | n.+1 => if [exists m : 'I_n, f m] then Ordinal (erefl (2 < 3)) else
                  if f n then Ordinal (erefl (1 < 3)) else ord0
    end.

   Lemma path_pi3 : path R3 pi3.

   Lemma LPO_of_disjunctive_AR : (forall n, f n = false) \/ exists n, f n = true.
End LPO.