reserve A,B,a,b,c,d,e,f,g,h for set;

theorem Th31:
  for R be non empty irreflexive symmetric RelStr holds
  ComplRelStr R is not path-connected implies ex G1,G2 being non empty strict
  irreflexive symmetric RelStr st the carrier of G1 misses the carrier of G2 &
  the RelStr of R = sum_of(G1,G2)
proof
  let R be non empty irreflexive symmetric RelStr;
  set cR = the carrier of R, IR = the InternalRel of R, CR = ComplRelStr R,
  ICR = the InternalRel of ComplRelStr R, cCR = the carrier of ComplRelStr R;
  assume CR is not path-connected;
  then consider x,y being set such that
A1: x in cCR and
A2: y in cCR and
  x <> y and
A3: not ICR reduces x,y;
  reconsider x,y as Element of CR by A1,A2;
  set A1 = component x, A2 = (the carrier of R) \ A1;
  reconsider A1 as Subset of R by NECKLACE:def 8;
  ICR = ICR~ by RELAT_2:13;
  then not ICR \/ ICR~ reduces x,y by A3;
  then not x,y are_convertible_wrt ICR by REWRITE1:def 4;
  then not [x,y] in EqCl ICR by MSUALG_6:41;
  then
A4: not y in A1 by Th29;
  reconsider A2 as Subset of R;
  set G1 = subrelstr A1, G2 = subrelstr A2;
A5: the carrier of G1 = A1 by YELLOW_0:def 15;
  set IG1 = the InternalRel of G1, IG2 = the InternalRel of G2, G1G2 = [:the
carrier of G1,the carrier of G2:], G2G1 = [:the carrier of G2,the carrier of G1
  :];
A6: cR = A1 \/ A2
  proof
    thus cR c= A1 \/ A2
    proof
      let a be object;
      assume
A7:   a in cR;
      assume not thesis;
      then ( not a in A1)& not a in A2 by XBOOLE_0:def 3;
      hence contradiction by A7,XBOOLE_0:def 5;
    end;
    let a be object;
    assume
A8: a in A1 \/ A2;
    per cases by A8,XBOOLE_0:def 3;
    suppose
      a in A1;
      hence thesis;
    end;
    suppose
      a in A2;
      hence thesis;
    end;
  end;
A9: the carrier of G2 = A2 by YELLOW_0:def 15;
  then
A10: (the carrier of G1) misses (the carrier of G2) by A5,XBOOLE_1:79;
A11: the InternalRel of G1 misses the InternalRel of G2
  proof
    assume not thesis;
    then IG1 /\ IG2 <> {};
    then consider a be object such that
A12: a in IG1 /\ IG2 by XBOOLE_0:def 1;
    a in IG1 by A12,XBOOLE_0:def 4;
    then consider c1,c2 be object such that
A13: a = [c1,c2] and
A14: c1 in A1 and
    c2 in A1 by A5,RELSET_1:2;
    ex g1,g2 be object st a = [g1,g2] & g1 in A2 & g2 in A2
by A9,A12,RELSET_1:2;
    then c1 in A2 by A13,XTUPLE_0:1;
    then c1 in A1 /\ A2 by A14,XBOOLE_0:def 4;
    hence contradiction by A5,A9,A10;
  end;
A15: the InternalRel of G2 = IR \ IG1 \ G1G2 \ G2G1
  proof
    thus IG2 c= IR \ IG1 \ G1G2 \ G2G1
    proof
      let a be object;
      assume
A16:  a in IG2;
      then consider g1,g2 be object such that
A17:  a = [g1,g2] and
A18:  g1 in A2 and
A19:  g2 in A2 by A9,RELSET_1:2;
      reconsider g1,g2 as Element of G2 by A18,A19,YELLOW_0:def 15;
      reconsider u1 = g1, u2 = g2 as Element of R by A18,A19;
A20:  not a in IG1
      by A16,XBOOLE_0:def 4,A11;
A21:  not a in G2G1
      proof
        assume a in G2G1;
        then g2 in A1 by A5,A17,ZFMISC_1:87;
        then g2 in A1 /\ A2 by A19,XBOOLE_0:def 4;
        hence thesis by A5,A9,A10;
      end;
A22:  not a in G1G2
      proof
        assume a in G1G2;
        then g1 in A1 by A5,A17,ZFMISC_1:87;
        then g1 in A1 /\ A2 by A18,XBOOLE_0:def 4;
        hence thesis by A5,A9,A10;
      end;
      g1 <= g2 by A16,A17,ORDERS_2:def 5;
      then u1 <= u2 by YELLOW_0:59;
      then a in IR by A17,ORDERS_2:def 5;
      then a in IR \ IG1 by A20,XBOOLE_0:def 5;
      then a in IR \ IG1 \ G1G2 by A22,XBOOLE_0:def 5;
      hence thesis by A21,XBOOLE_0:def 5;
    end;
    let a be object;
    assume
A23: a in IR \ IG1 \ G1G2 \ G2G1;
    then
A24: not a in G2G1 by XBOOLE_0:def 5;
A25: a in IR \ IG1 \ G1G2 by A23,XBOOLE_0:def 5;
    then
A26: a in IR \ IG1 by XBOOLE_0:def 5;
    then
A27: not a in IG1 by XBOOLE_0:def 5;
A28: not a in G1G2 by A25,XBOOLE_0:def 5;
    consider c1,c2 be object such that
A29: a = [c1,c2] and
A30: c1 in cR & c2 in cR by A23,RELSET_1:2;
    reconsider c1,c2 as Element of R by A30;
    a in IR by A26,XBOOLE_0:def 5;
    then
A31: c1 <= c2 by A29,ORDERS_2:def 5;
    per cases by A6,XBOOLE_0:def 3;
    suppose
A32:  c1 in A1 & c2 in A1;
      then reconsider d2 = c2 as Element of G1 by YELLOW_0:def 15;
      reconsider d1 = c1 as Element of G1 by A32,YELLOW_0:def 15;
      d1 <= d2 by A5,A31,YELLOW_0:60;
      hence thesis by A27,A29,ORDERS_2:def 5;
    end;
    suppose
      c1 in A1 & c2 in A2;
      hence thesis by A5,A9,A28,A29,ZFMISC_1:87;
    end;
    suppose
      c1 in A2 & c2 in A1;
      hence thesis by A5,A9,A24,A29,ZFMISC_1:87;
    end;
    suppose
A33:  c1 in A2 & c2 in A2;
      then reconsider d1 = c1,d2 = c2 as Element of G2 by YELLOW_0:def 15;
      d1 <= d2 by A9,A31,A33,YELLOW_0:60;
      hence thesis by A29,ORDERS_2:def 5;
    end;
  end;
  IR = (the InternalRel of G1) \/ (the InternalRel of G2) \/ [:the
  carrier of G1,the carrier of G2:] \/ [:the carrier of G2,the carrier of G1:]
  proof
    set G1G2 = [:the carrier of G1,the carrier of G2:], G2G1 = [:the carrier
    of G2,the carrier of G1:];
    thus IR c= IG1 \/ IG2 \/ G1G2 \/ G2G1
    proof
      let a be object;
      assume
A34:  a in IR;
      assume
A35:  not thesis;
      then
A36:  not a in (IG1 \/ IG2 \/ G1G2) by XBOOLE_0:def 3;
      then
A37:  not a in (IG1 \/ IG2) by XBOOLE_0:def 3;
      then not a in IG2 by XBOOLE_0:def 3;
      then not a in IR \ IG1 \ G1G2 or a in G2G1 by A15,XBOOLE_0:def 5;
      then
A38:  not a in IR \ IG1 or a in G1G2 or a in G2G1 by XBOOLE_0:def 5;
      not a in IG1 by A37,XBOOLE_0:def 3;
      hence thesis by A34,A35,A36,A38,XBOOLE_0:def 3,def 5;
    end;
    let a be object;
    assume a in IG1 \/ IG2 \/ G1G2 \/ G2G1;
    then a in IG1 \/ IG2 \/ G1G2 or a in G2G1 by XBOOLE_0:def 3;
    then
A39: a in IG1 \/ IG2 or a in G1G2 or a in G2G1 by XBOOLE_0:def 3;
    per cases by A39,XBOOLE_0:def 3;
    suppose
A40:  a in IG1;
      then consider v,w be object such that
A41:  a = [v,w] and
A42:  v in A1 & w in A1 by A5,RELSET_1:2;
      reconsider v,w as Element of G1 by A42,YELLOW_0:def 15;
      reconsider u1 = v, u2 = w as Element of R by A42;
      v <= w by A40,A41,ORDERS_2:def 5;
      then u1 <= u2 by YELLOW_0:59;
      hence thesis by A41,ORDERS_2:def 5;
    end;
    suppose
A43:  a in IG2;
      then consider v,w be object such that
A44:  a = [v,w] and
A45:  v in A2 & w in A2 by A9,RELSET_1:2;
      reconsider v,w as Element of G2 by A45,YELLOW_0:def 15;
      reconsider u1 = v, u2 = w as Element of R by A45;
      v <= w by A43,A44,ORDERS_2:def 5;
      then u1 <= u2 by YELLOW_0:59;
      hence thesis by A44,ORDERS_2:def 5;
    end;
    suppose
A46:  a in G1G2;
      assume
A47:  not thesis;
      consider v,w be object such that
A48:  a = [v,w] by A46,RELAT_1:def 1;
A49:  w in A2 by A9,A46,A48,ZFMISC_1:87;
A50:  v in A1 by A5,A46,A48,ZFMISC_1:87;
      then reconsider v,w as Element of CR by A49,NECKLACE:def 8;
      v <> w
      by A5,A9,A10,A50,A49,XBOOLE_0:def 4;
      then
A51:  not a in id cR by A48,RELAT_1:def 10;
      [v,w] in [:cR,cR:] by A50,A49,ZFMISC_1:87;
      then a in [:cR,cR:] \ IR by A48,A47,XBOOLE_0:def 5;
      then a in IR` by SUBSET_1:def 4;
      then a in IR` \ id cR by A51,XBOOLE_0:def 5;
      then [v,w] in ICR by A48,NECKLACE:def 8;
      then v,w are_convertible_wrt ICR by REWRITE1:29;
      then
A52:  [v,w] in EqCl ICR by MSUALG_6:41;
      [x,v] in EqCl ICR by A50,Th29;
      then [x,w] in EqCl ICR by A52,EQREL_1:7;
      then w in component x by Th29;
      then w in A1 /\ A2 by A49,XBOOLE_0:def 4;
      hence thesis by A5,A9,A10;
    end;
    suppose
A53:  a in G2G1;
      assume
A54:  not thesis;
      consider v,w be object such that
A55:  a = [v,w] by A53,RELAT_1:def 1;
A56:  w in A1 by A5,A53,A55,ZFMISC_1:87;
A57:  v in A2 by A9,A53,A55,ZFMISC_1:87;
      then reconsider v,w as Element of CR by A56,NECKLACE:def 8;
      v <> w
      by A5,A9,A10,A57,A56,XBOOLE_0:def 4;
      then
A58:  not a in id cR by A55,RELAT_1:def 10;
      [v,w] in [:cR,cR:] by A57,A56,ZFMISC_1:87;
      then a in [:cR,cR:] \ IR by A55,A54,XBOOLE_0:def 5;
      then a in IR` by SUBSET_1:def 4;
      then a in IR` \ id cR by A58,XBOOLE_0:def 5;
      then [v,w] in ICR by A55,NECKLACE:def 8;
      then v,w are_convertible_wrt ICR by REWRITE1:29;
      then [v,w] in EqCl ICR by MSUALG_6:41;
      then
A59:  [w,v] in EqCl ICR by EQREL_1:6;
      [x,w] in EqCl ICR by A56,Th29;
      then [x,v] in EqCl ICR by A59,EQREL_1:7;
      then v in component x by Th29;
      then v in A1 /\ A2 by A57,XBOOLE_0:def 4;
      hence thesis by A5,A9,A10;
    end;
  end;
  then
A60: IR = the InternalRel of sum_of(G1,G2) by NECKLA_2:def 3;
  y in cR by A2,NECKLACE:def 8;
  then
A61: G2 is non empty strict RelStr by A9,A4,XBOOLE_0:def 5;
  cR = the carrier of sum_of(G1,G2) by A5,A9,A6,NECKLA_2:def 3;
  hence thesis by A5,A10,A61,A60;
end;
