reserve x,y,X for set,
        r for Real,
        n,k for Nat;
reserve RLS for non empty RLSStruct,
        Kr,K1r,K2r for SimplicialComplexStr of RLS,
        V for RealLinearSpace,
        Kv for non void SimplicialComplex of V;
reserve Ks for simplex-join-closed SimplicialComplex of V,
        As,Bs for Subset of Ks,
        Ka for non void affinely-independent SimplicialComplex of V,
        Kas for non void affinely-independent simplex-join-closed
                 SimplicialComplex of V,
        K for non void affinely-independent simplex-join-closed total
                 SimplicialComplex of V;
reserve Aff for finite affinely-independent Subset of V,
        Af,Bf for finite Subset of V,
        B for Subset of V,
        S,T for finite Subset-Family of V,
        Sf for c=-linear finite finite-membered Subset-Family of V,
        Sk,Tk for finite simplex-like Subset-Family of K,
        Ak for Simplex of K;

theorem Th39:
  for Sf st Sf is with_non-empty_elements & card Sf+1 = card union Sf &
            union Sf is affinely-independent
  holds card {S1 where S1 is Simplex of card Sf,BCS Complex_of{union Sf}:
              (center_of_mass V).:Sf c= S1} = 2
 proof
  let S be finite c=-linear finite-membered Subset-Family of V such that
   A1: S is with_non-empty_elements and
   A2: card S+1=card union S and
   A3: union S is affinely-independent;
  set B=center_of_mass V;
  reconsider U=union S as finite affinely-independent Subset of V by A3;
  reconsider s=S as Subset-Family of U by ZFMISC_1:82;
  A4: S is non empty by A2,ZFMISC_1:2;
  then consider ss1 be Subset-Family of U such that
   A5: s c=ss1 and
   A6: ss1 is with_non-empty_elements c=-linear and
   A7: card ss1=card U and
   A8: for X st X in ss1 & card X<>1 ex x st x in X & X\{x} in ss1 by A1,
SIMPLEX0:9,13;
  card(ss1\s)=card S+1-card S by A2,A5,A7,CARD_2:44;
  then consider x being object such that
   A9: ss1\s={x} by CARD_2:42;
  reconsider c =card U as ExtReal;
  set CU=Complex_of{U};
  set TC=the topology of CU;
  A10: TC=bool U by SIMPLEX0:4;
  then reconsider ss=ss1 as Subset-Family of CU by XBOOLE_1:1;
  set BC=BCS CU;
  reconsider cc=card U-1 as ExtReal;
  A11: |.CU.|c=[#]CU;
  then A12: BC=subdivision(B,CU) by Def5;
  then A13: [#]BC=[#]CU by SIMPLEX0:def 20;
  then reconsider Bss=B.:ss as Subset of BC;
  A14: ss is simplex-like
  proof
   let A be Subset of CU;
   assume A in ss;
   hence thesis by A10;
  end;
  then A15: card Bss=card U by A6,A7,Th33;
  then A16: card Bss=cc+1 by A2,XXREAL_3:def 2;
  A17: x in {x} by TARSKI:def 1;
  then A18: x in ss1 by A9,XBOOLE_0:def 5;
  A19: not x in s by A9,A17,XBOOLE_0:def 5;
  reconsider x as finite Subset of V by A9,A17,XBOOLE_1:1;
  degree CU=c-1 by SIMPLEX0:26
   .=card U +-1 by XXREAL_3:def 2;
  then A20: cc=degree BC by A11,Th31;
  Bss is simplex-like by A6,A12,A14,SIMPLEX0:def 20;
  then A21: Bss is Simplex of card U-1,BC by A2,A16,A20,SIMPLEX0:def 18;
  x<>{} by A6,A18;
  then reconsider c1=card x-1 as Element of NAT by NAT_1:20;
  ex xm be set st(xm in s or xm={}) & card xm=card x-1 & for y st y in s & y c=
x holds y c=xm
  proof
   per cases;
   suppose A22: card x=1;
    then A23: ex z be object st x={z} by CARD_2:42;
    take xm={};
    thus(xm in s or xm={}) & card xm=card x-1 by A22;
    let y such that
     A24: y in s and
     A25: y c=x;
    y<>x by A9,A17,A24,XBOOLE_0:def 5;
    hence thesis by A23,A25,ZFMISC_1:33;
   end;
   suppose card x<>1;
    then consider z be set such that
     A26: z in x and
     A27: x\{z} in ss1 by A8,A18;
    take xm=x\{z};
    A28: x=xm\/{z} by A26,ZFMISC_1:116;
    xm in s
    proof
     assume not xm in s;
     then xm in ss1\s by A27,XBOOLE_0:def 5;
     then xm=x by A9,TARSKI:def 1;
     hence thesis by A26,ZFMISC_1:56;
    end;
    hence xm in s or xm={};
    card x=c1+1;
    hence card xm=card x-1 by A26,STIRL2_1:55;
    let y such that
     A29: y in s and
     A30: y c=x;
    assume A31: not y c=xm;
    xm,y are_c=-comparable by A5,A6,A27,A29;
    then xm c=y by A31;
    hence contradiction by A19,A28,A29,A30,A31,ZFMISC_1:138;
   end;
  end;
  then consider xm be set such that
   A32: xm in s or xm={} and
   A33: card xm=card x-1 and
   A34: for y st y in s & y c=x holds y c=xm;
  A35: U in S by A4,SIMPLEX0:9;
  then union ss1 c=U & U c=union ss by A5,ZFMISC_1:74;
  then A36: union ss=U;
  x c<U by A9,A17,A19,A35;
  then card x<card U by CARD_2:48;
  then card x+1<=card U by NAT_1:13;
  then consider xM be set such that
   A37: xM in ss and
   A38: card xM=card x+1 by A6,A36,A21,Th36;
  reconsider xm as finite Subset of V by A32,XBOOLE_1:2;
  reconsider xM as finite Subset of V by A37;
  A39: not xM c=xm
  proof
   assume xM c=xm;
   then card x+1<=card x+-1 by A33,A38,NAT_1:43;
   hence contradiction by XREAL_1:6;
  end;
  A40: xM in s
  proof
   assume not xM in s;
   then xM in ss\s by A37,XBOOLE_0:def 5;
   then xM=x by A9,TARSKI:def 1;
   hence contradiction by A38;
  end;
  then xm,xM are_c=-comparable or xm c=xM by A32,ORDINAL1:def 8;
  then A41: xm c=xM by A39;
  then card(xM\xm)=card xM-card xm by CARD_2:44;
  then consider x1,x2 be object such that
   A42: x1<>x2 and
   A43: xM\xm={x1,x2} by A33,A38,CARD_2:60;
  A44: x1 in {x1,x2} by TARSKI:def 2;
  A45: x2 in {x1,x2} by TARSKI:def 2;
  then reconsider x1,x2 as Element of V by A43,A44;
  set xm1=xm\/{x1},xm2=xm\/{x2};
  reconsider S1=S\/{xm1},S2=S\/{xm2} as Subset-Family of CU;
  reconsider BS1=B.:S1,BS2=B.:S2 as Subset of BC by A13;
  A46: BS1=B.:S\/B.:{xm1} by RELAT_1:120;
  A47: not x1 in xm by A43,A44,XBOOLE_0:def 5;
  then A48: card xm1=card xm+1 by CARD_2:41;
  A49: not xm1 in S
  proof
   assume A50: xm1 in S;
   then x,xm1 are_c=-comparable by A5,A6,A18;
   then x c=xm1 or xm1 c=x;
   hence thesis by A19,A33,A48,A50,CARD_2:102;
  end;
  not x2 in xm by A43,A45,XBOOLE_0:def 5;
  then A51: card xm2=card xm+1 by CARD_2:41;
  A52: not xm2 in S
  proof
   assume A53: xm2 in S;
   then x,xm2 are_c=-comparable by A5,A6,A18;
   then x c=xm2 or xm2 c=x;
   hence thesis by A19,A33,A51,A53,CARD_2:102;
  end;
  x2 in xM by A43,A45,XBOOLE_0:def 5;
  then {x2}c=xM by ZFMISC_1:31;
  then A54: xm2 c=xM by A41,XBOOLE_1:8;
  A55: S2 c=bool U
  proof
   let A be object such that
    A56: A in S2;
    reconsider AA=A as set by TARSKI:1;
   per cases by A56,XBOOLE_0:def 3;
   suppose A in S;
    then AA c=U by ZFMISC_1:74;
    hence thesis;
   end;
   suppose A in {xm2};
    then A=xm2 by TARSKI:def 1;
    then AA c=U by A37,A54,XBOOLE_1:1;
    hence thesis;
   end;
  end;
  A57: S2 is simplex-like
  proof
   let A be Subset of CU;
   assume A in S2;
   hence thesis by A10,A55;
  end;
  then card BS2=card S2 by A1,Th33;
  then A58: card BS2=card S+1 by A52,CARD_2:41;
  x1 in xM by A43,A44,XBOOLE_0:def 5;
  then {x1}c=xM by ZFMISC_1:31;
  then A59: xm1 c=xM by A41,XBOOLE_1:8;
  A60: S1 c=bool U
  proof
   let A be object such that
    A61: A in S1;
    reconsider AA=A as set by TARSKI:1;
   per cases by A61,XBOOLE_0:def 3;
   suppose A in S;
    then AA c=U by ZFMISC_1:74;
    hence thesis;
   end;
   suppose A in {xm1};
    then A=xm1 by TARSKI:def 1;
    then AA c=U by A37,A59,XBOOLE_1:1;
    hence thesis;
   end;
  end;
  then A62: BS1=(B|TC).:S1 by A10,RELAT_1:129;
  A63: S1 is simplex-like
  proof
   let A be Subset of CU;
   assume A in S1;
   hence thesis by A10,A60;
  end;
  then card BS1=card S1 by A1,Th33;
  then A64: card BS1=card S+1 by A49,CARD_2:41;
  A65: xm c=xm1 & xm c=xm2 by XBOOLE_1:7;
  A66: for y1 be set st y1 in S holds y1,xm1 are_c=-comparable & y1,xm2
are_c=-comparable
  proof
   let y1 be set;
   assume A67: y1 in S;
   then A68: xM,y1 are_c=-comparable by A40,ORDINAL1:def 8;
   per cases by A68;
   suppose xM c=y1 or xM=y1;
    then xm1 c=y1 & xm2 c=y1 by A54,A59;
    hence thesis;
   end;
   suppose A69: y1 c=xM & xM<>y1;
    then reconsider y1 as finite set;
    A70: y1 c<xM by A69;
    A71: not x c=y1
    proof
     A72: card y1<card xM by A70,CARD_2:48;
     assume A73: x c=y1;
     then card x<=card y1 by NAT_1:43;
     then card x=card y1 by A38,A72,NAT_1:9;
     hence contradiction by A19,A67,A73,CARD_2:102;
    end;
    x in ss by A9,A17,XBOOLE_0:def 5;
    then y1,x are_c=-comparable by A5,A6,A67;
    then y1 c=x by A71;
    then y1 c=xm by A34,A67;
    then y1 c=xm1 & y1 c=xm2 by A65;
    hence thesis;
   end;
  end;
  S1 is c=-linear
  proof
   let y1,y2 be set;
   assume that
    A74: y1 in S1 and
    A75: y2 in S1;
   y1 in S or y1 in {xm1} by A74,XBOOLE_0:def 3;
   then A76: y1 in S or y1=xm1 by TARSKI:def 1;
   y2 in S or y2 in {xm1} by A75,XBOOLE_0:def 3;
   then y2 in S or y2=xm1 by TARSKI:def 1;
   hence thesis by A66,A76,ORDINAL1:def 8;
  end;
  then BS1 is simplex-like by A12,A63,SIMPLEX0:def 20;
  then A77: BS1 is Simplex of card U-1,BC by A2,A15,A16,A20,A64,SIMPLEX0:def 18
;
  set SS={S3 where S3 is Simplex of card S,BCS Complex_of{union S}:B.:S c=S3};
  B.:S c=B.:S\/B.:{xm1} by XBOOLE_1:7;
  then A78: BS1 in SS by A2,A46,A77;
  A79: BS2=B.:S\/B.:{xm2} by RELAT_1:120;
  A80: SS c={BS1,BS2}
  proof
   let w be object;
   reconsider n=0 as Nat;
   assume w in SS;
   then consider W be Simplex of card S,BC such that
    A81: w=W and
    A82: B.:S c=W;
   card S+n+1<=card U by A2;
   then consider T be finite Subset-Family of V such that
    A83: T misses S and
    A84: T\/S is c=-linear with_non-empty_elements and
    A85: card T=n+1 and
    A86: union T c=U and
    A87: @W=B.:S\/B.:T by A1,A82,Th35;
   consider x3 be object such that
    A88: {x3}=T by A85,CARD_2:42;
   A89: x3 in T by A88,TARSKI:def 1;
   then A90: not x3 in S by A83,XBOOLE_0:3;
    reconsider x3 as set by TARSKI:1;
   A91: x3 c=union T by A89,ZFMISC_1:74;
   A92: x3 in T\/S by A89,XBOOLE_0:def 3;
   reconsider x3 as finite Subset of U by A86,A91,XBOOLE_1:1;
   A93: not xM c=x3
   proof
    consider x4 be set such that
     A94: x4 in ss and
     A95: card x4=card x3 by A6,A36,A21,A84,A92,Th36,NAT_1:43;
    assume xM c=x3;
    then card x+1<=card x3 by A38,NAT_1:43;
    then x<>x4 by A95,NAT_1:13;
    then not x4 in {x} by TARSKI:def 1;
    then A96: x4 in s by A9,A94,XBOOLE_0:def 5;
    then x4 in S\/T by XBOOLE_0:def 3;
    then x3,x4 are_c=-comparable by A84,A92;
    then x3 c=x4 or x4 c=x3;
    hence contradiction by A90,A95,A96,CARD_2:102;
   end;
   A97: xm c=x3 & xm<>x3
   proof
    per cases by A32;
    suppose xm={};
     hence thesis by A84,A92;
    end;
    suppose A98: xm in s;
     A99: not x3 c=xm
     proof
      assume x3 c=xm;
      then A100: card x3<=card xm by NAT_1:43;
      consider x4 be set such that
       A101: x4 in ss and
       A102: card x4=card x3 by A6,A36,A21,A84,A92,Th36,NAT_1:43;
      card xm+1=card x by A33;
      then card x<>card x3 by A100,NAT_1:13;
      then not x4 in {x} by A102,TARSKI:def 1;
      then A103: x4 in s by A9,A101,XBOOLE_0:def 5;
      then x4 in S\/T by XBOOLE_0:def 3;
      then x3,x4 are_c=-comparable by A84,A92;
      then x3 c=x4 or x4 c=x3;
      hence contradiction by A90,A102,A103,CARD_2:102;
     end;
     xm in T\/S by A98,XBOOLE_0:def 3;
     then xm,x3 are_c=-comparable by A84,A92;
     hence thesis by A99;
    end;
   end;
   then A104: x3=x3\/xm by XBOOLE_1:12;
   xM in S\/T by A40,XBOOLE_0:def 3;
   then xM,x3 are_c=-comparable by A84,A92;
   then x3 c=xM by A93;
   then A105: x3\xm c=xM\xm by XBOOLE_1:33;
   A106: xM=xm\/xM by A41,XBOOLE_1:12;
   A107: x3\xm<>xM\xm
   proof
    assume x3\xm=xM\xm;
    then x3=(xM\xm)\/xm by A104,XBOOLE_1:39;
    hence contradiction by A93,A106,XBOOLE_1:39;
   end;
   A108: x3\xm<>{}
   by XBOOLE_1:37,A97;
   x3\/xm=(x3\xm)\/xm by XBOOLE_1:39;
   then x3=xm1 or x3=xm2 by A43,A104,A105,A107,A108,ZFMISC_1:36;
   hence thesis by A79,A46,A81,A87,A88,TARSKI:def 2;
  end;
  A109: BS2=(B|TC).:S2 by A10,A55,RELAT_1:129;
  A110: BS1<>BS2
  proof
   assume A111: BS1=BS2;
   then BS1\BS2={} by XBOOLE_1:37;
   then (B|TC).:(S1\S2)={} by A109,A62,FUNCT_1:64;
   then A112: dom(B|TC)misses S1\S2 by RELAT_1:118;
   BS2\BS1={} by A111,XBOOLE_1:37;
   then (B|TC).:(S2\S1)={} by A109,A62,FUNCT_1:64;
   then A113: dom(B|TC)misses S2\S1 by RELAT_1:118;
   A114: dom(B|TC)=dom B/\TC by RELAT_1:61;
   xm1 in {xm1} by TARSKI:def 1;
   then A115: xm1 in S1 by XBOOLE_0:def 3;
   A116: dom B=(bool the carrier of V)\{{}} by FUNCT_2:def 1;
   A117: S1\S2 c=S1 by XBOOLE_1:36;
   then not{} in S1\S2 by A1;
   then A118: S1\S2 c=dom B by A116,ZFMISC_1:34;
   A119: S2\S1 c=S2 by XBOOLE_1:36;
   then not{} in S2\S1 by A1;
   then A120: S2\S1 c=dom B by A116,ZFMISC_1:34;
   S1\S2 c=bool U by A60,A117;
   then S1\S2 c=dom(B|TC) by A10,A114,A118,XBOOLE_1:19;
   then A121: S1\S2={} by A112,XBOOLE_1:67;
   S2\S1 c=bool U by A55,A119;
   then S2\S1 c=dom(B|TC) by A10,A114,A120,XBOOLE_1:19;
   then S1=S2 by A113,A121,XBOOLE_1:32,67;
   then xm1 in {xm2} by A49,A115,XBOOLE_0:def 3;
   then A122: xm1=xm2 by TARSKI:def 1;
   x1 in {x1} by TARSKI:def 1;
   then x1 in xm1 by XBOOLE_0:def 3;
   then x1 in {x2} by A47,A122,XBOOLE_0:def 3;
   hence contradiction by A42,TARSKI:def 1;
  end;
  S2 is c=-linear
  proof
   let y1,y2 be set;
   assume that
    A123: y1 in S2 and
    A124: y2 in S2;
   y1 in S or y1 in {xm2} by A123,XBOOLE_0:def 3;
   then A125: y1 in S or y1=xm2 by TARSKI:def 1;
   y2 in S or y2 in {xm2} by A124,XBOOLE_0:def 3;
   then y2 in S or y2=xm2 by TARSKI:def 1;
   hence thesis by A66,A125,ORDINAL1:def 8;
  end;
  then BS2 is simplex-like by A12,A57,SIMPLEX0:def 20;
  then A126: BS2 is Simplex of card U-1,BC by A2,A15,A16,A20,A58,
SIMPLEX0:def 18;
  B.:S c=B.:S\/B.:{xm2} by XBOOLE_1:7;
  then BS2 in SS by A2,A79,A126;
  then {BS1,BS2}c=SS by A78,ZFMISC_1:32;
  then SS={BS1,BS2} by A80;
  hence thesis by A110,CARD_2:57;
 end;
