reserve k,n for Element of NAT,
  a,Y for set,
  D,D1,D2 for non empty set,
  p,q for FinSequence of NAT;
reserve F,F1,G,G1,H,H1,H2 for CTL-formula;
reserve sq,sq9 for FinSequence;
reserve V for CTLModel;
reserve Kai for Function of atomic_WFF,the BasicAssign of V;
reserve f,f1,f2 for Function of CTL_WFF,the carrier of V;
reserve S for non empty set;
reserve R for total Relation of S,S;
reserve s,s0,s1 for Element of S;
reserve BASSIGN for non empty Subset of ModelSP(S);
reserve kai for Function of atomic_WFF,the BasicAssign of BASSModel(R,BASSIGN);

theorem Th40:
  for g being Assign of BASSModel(R,BASSIGN), s0 being Element of S
  st s0 |= g holds (for s being Element of S holds s|= g implies s|= EX(g))
  implies ex pai being inf_path of R st pai.0= s0 & for n being Nat
  holds pai.In(n,NAT) |= g
proof
  let g be Assign of BASSModel(R,BASSIGN);
  let s0 be Element of S such that
A1: s0 |= g;
  deffunc Next(object) = {x where x is Element of S : [$1,x] in R};
  assume
A2: for s being Element of S holds s|= g implies s|= EX(g);
  for p being set st p in BOOL S holds p<>{} by ORDERS_1:1;
  then consider Choice being Function such that
A3: dom Choice = BOOL S and
A4: for p being set st p in BOOL S holds Choice.p in p by FUNCT_1:111;
  deffunc H(object) = UnivF((Next($1) /\ SIGMA(g)),Choice,s0);
A5: for x being object st x in S holds H(x) in S
  proof
    let x be object such that
    x in S;
    set Y = Next(x) /\ SIGMA(g);
    per cases;
    suppose
A6:   Y in dom Choice;
      then H(x)= Choice.Y by Def3;
      then H(x) in Y by A3,A4,A6;
      then H(x) in Next(x) by XBOOLE_0:def 4;
      then ex z be Element of S st z=H(x) & [x,z] in R;
      hence thesis;
    end;
    suppose
      not Y in dom Choice;
      then H(x)= s0 by Def3;
      hence thesis;
    end;
  end;
  consider h being Function of S,S such that
A7: for x being object st x in S holds h.x= H(x) from FUNCT_2:sch 2(A5);
  deffunc PAI(object) = (h|**(k_nat($1))).s0;
A8: for n being object st n in NAT holds PAI(n) in S;
  consider pai being sequence of S such that
A9: for n being object st n in NAT holds pai.n= PAI(n) from FUNCT_2:sch 2(
  A8 );
A10: pai.0 = PAI(0) by A9
    .= (h|**0).s0 by Def2
    .= (id S).s0 by FUNCT_7:84
    .= s0;
A11: s0 in S;
A12: for n being Nat holds [pai.n,pai.(n+1)] in R & pai.In(n,NAT) |= g
  proof
    defpred P[Nat] means [pai.$1,pai.($1+1)] in R & pai.In($1,NAT) |= g;
A13: for k being Nat st P[k] holds P[k+1]
    proof
      let k be Nat;
      set k1=k+1;
      set k2=k1+1;
      set p0 = pai.In(k,NAT);
      set p1 = pai.k1;
      set p2 = pai.k2;
      set Y1 = Next(p0) /\ SIGMA(g);
      set Y2 = Next(p1) /\ SIGMA(g);
A14:  s0 in dom (h|**k) by A11,FUNCT_2:def 1;
      assume P[k];
      then p0 |= EX(g) by A2;
      then consider pai01 be inf_path of R such that
A15:  pai01.0 = p0 and
A16:  (pai01.1) |= g by Th14;
      set x1 = pai01.1;
      [pai01.0,pai01.(0+1)] in R by Def39;
      then
A17:  x1 in Next(p0) by A15;
      x1 in SIGMA(g) by A16;
      then Y1 <> {} by A17,XBOOLE_0:def 4;
      then not Y1 in {{}} by TARSKI:def 1;
      then
A18:  Y1 in bool S \ {{}} by XBOOLE_0:def 5;
      then
A19:  Y1 in BOOL S by ORDERS_1:def 3;
A20:  Y1 in dom Choice by A3,A18,ORDERS_1:def 3;
A21:    k in NAT by ORDINAL1:def 12;
      p1 = PAI(k1) by A9
        .= (h|**k1).s0 by Def2
        .= (h*(h|**k)).s0 by FUNCT_7:71
        .= h.((h|**k).s0) by A14,FUNCT_1:13
        .= h.(PAI(k)) by Def2,A21
        .= h.p0 by A9
        .= H(p0) by A7
        .= Choice.Y1 by A20,Def3;
      then p1 in Y1 by A4,A19;
      then p1 in SIGMA(g) by XBOOLE_0:def 4;
      then
A22:  ex q1 be Element of S st q1=p1 & q1|= g;
      then p1 |= EX(g) by A2;
      then consider pai02 be inf_path of R such that
A23:  pai02.0 = p1 and
A24:  (pai02.1) |= g by Th14;
      set x2 = pai02.1;
      [pai02.0,pai02.(0+1)] in R by Def39;
      then
A25:  x2 in Next(p1) by A23;
      x2 in SIGMA(g) by A24;
      then x2 in Y2 by A25,XBOOLE_0:def 4;
      then not Y2 in {{}} by TARSKI:def 1;
      then
A26:  Y2 in bool S \ {{}} by XBOOLE_0:def 5;
      then
A27:  Y2 in BOOL S by ORDERS_1:def 3;
A28:  s0 in dom (h|**k1) by A11,FUNCT_2:def 1;
A29:  Y2 in dom Choice by A3,A26,ORDERS_1:def 3;
      p2 = PAI(k2) by A9
        .= (h|**k2).s0 by Def2
        .= (h*(h|**k1)).s0 by FUNCT_7:71
        .= h.((h|**k1).s0) by A28,FUNCT_1:13
        .= h.(PAI(k1)) by Def2
        .= h.p1 by A9
        .= H(p1) by A7
        .= Choice.Y2 by A29,Def3;
      then p2 in Y2 by A4,A27;
      then p2 in Next(p1) by XBOOLE_0:def 4;
      then ex q2 be Element of S st q2=p2 & [p1,q2] in R;
      hence thesis by A22;
    end;
A30: P[0]
    proof
      set Y = Next(s0) /\ SIGMA(g);
      set y = Choice.Y;
      s0 |= EX(g) by A1,A2;
      then consider pai01 be inf_path of R such that
A31:  pai01.0 = s0 and
A32:  (pai01.1) |= g by Th14;
      set x = pai01.1;
      [pai01.0,pai01.(0+1)] in R by Def39;
      then
A33:  x in Next(s0) by A31;
      x in SIGMA(g) by A32;
      then Y <> {} by A33,XBOOLE_0:def 4;
      then not Y in {{}} by TARSKI:def 1;
      then
A34:  Y in bool S \ {{}} by XBOOLE_0:def 5;
      then
A35:  Y in dom Choice by A3,ORDERS_1:def 3;
      Y in BOOL S by A34,ORDERS_1:def 3;
      then
A36:  y in Y by A4;
      then y in Next(s0) by XBOOLE_0:def 4;
      then consider t be Element of S such that
A37:  y = t and
A38:  [s0,t] in R;
      t in SIGMA(g) by A36,A37,XBOOLE_0:def 4;
      then consider s1 be Element of S such that
A39:  t = s1 and
      s1 |= g;
      pai.1 = PAI(1) by A9
        .= (h|**1).s0 by Def2
        .= h.s0 by FUNCT_7:70
        .=H(s0) by A7
        .=s1 by A35,A37,A39,Def3;
      hence thesis by A1,A10,A38,A39;
    end;
    for k being Nat holds P[k] from NAT_1:sch 2(A30,A13);
    hence thesis;
  end;
  then reconsider pai as inf_path of R by Def39;
  take pai;
  thus thesis by A10,A12;
end;
