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

theorem Th38:
  for G being non empty symmetric irreflexive RelStr, a,b,c,d
  being Element of G, Z being Subset of G st Z = {a,b,c,d} & a,b,c,d
  are_mutually_distinct & [a,b] in the InternalRel of G & [b,c] in the
InternalRel of G & [c,d] in the InternalRel of G & not [a,c] in the InternalRel
  of G & not [a,d] in the InternalRel of G & not [b,d] in the InternalRel of G
  holds subrelstr Z embeds Necklace 4
proof
  let G be non empty symmetric irreflexive symmetric RelStr;
  let a,b,c,d be Element of G;
  let Z be Subset of G;
  assume that
A1: Z = {a,b,c,d} and
A2: a,b,c,d are_mutually_distinct and
A3: [a,b] in the InternalRel of G and
A4: [b,c] in the InternalRel of G and
A5: [c,d] in the InternalRel of G and
A6: not [a,c] in the InternalRel of G and
A7: not [a,d] in the InternalRel of G and
A8: not [b,d] in the InternalRel of G;
  set g = (0,1) --> (a,b), h = (2,3) --> (c,d), f = g +* h;
A9: rng h = {c,d} by FUNCT_4:64;
A10: a <> b by A2,ZFMISC_1:def 6;
A11: rng (0 .--> a) misses rng (1 .--> b)
  proof
    assume rng (0 .--> a) meets rng (1 .--> b);
    then consider x being object such that
A12: x in rng (0 .--> a) and
A13: x in rng (1 .--> b) by XBOOLE_0:3;
    rng (0 .--> a) = {a} by FUNCOP_1:8;
    then rng (1 .--> b) = {b} & x = a by A12,FUNCOP_1:8,TARSKI:def 1;
    hence contradiction by A10,A13,TARSKI:def 1;
  end;
  set H = subrelstr Z, N4 = Necklace 4, IH = the InternalRel of H, cH = the
carrier of H, IG = the InternalRel of G, X = {[a,a],[a,b],[b,a],[b,b],[a,c],[a,
  d],[b,c],[b,d]}, Y = {[c,a],[c,b],[d,a],[d,b],[c,c],[c,d],[d,c],[d,d]};
A14: the carrier of H is non empty by A1,YELLOW_0:def 15;
A15: h = (2 .--> c) +* (3 .--> d) by FUNCT_4:def 4;
A16: c <> d by A2,ZFMISC_1:def 6;
  rng (2 .--> c) misses rng (3 .--> d)
  proof
    assume rng (2 .--> c) meets rng (3 .--> d);
    then consider x being object such that
A17: x in rng (2 .--> c) and
A18: x in rng (3 .--> d) by XBOOLE_0:3;
    rng (2 .--> c) = {c} by FUNCOP_1:8;
    then rng (3 .--> d) = {d} & x = c by A17,FUNCOP_1:8,TARSKI:def 1;
    hence contradiction by A16,A18,TARSKI:def 1;
  end;
  then
A19: h is one-to-one by A15,FUNCT_4:92;
A20: rng g = {a,b} by FUNCT_4:64;
A21: rng g misses rng h
  proof
    assume not thesis;
    then consider x being object such that
A22: x in rng g and
A23: x in rng h by XBOOLE_0:3;
A24: x = c or x = d by A9,A23,TARSKI:def 2;
    x = a or x = b by A20,A22,TARSKI:def 2;
    hence contradiction by A2,A24,ZFMISC_1:def 6;
  end;
  dom f = dom g \/ dom h by FUNCT_4:def 1
    .= {0,1} \/ dom h by FUNCT_4:62
    .= {0,1} \/ {2,3} by FUNCT_4:62
    .= {0,1,2,3} by ENUMSET1:5;
  then
A25: dom f = the carrier of N4 by NECKLACE:1,20;
A26: dom g misses dom h
  proof
    assume not thesis;
    then consider x being object such that
A27: x in dom g and
A28: x in dom h by XBOOLE_0:3;
    x=0 or x=1 by A27,TARSKI:def 2;
    hence contradiction by A28,TARSKI:def 2;
  end;
  then rng f = rng g \/ rng h by NECKLACE:6;
  then rng f = {a,b,c,d} by A20,A9,ENUMSET1:5;
  then
A29: rng f = the carrier of H by A1,YELLOW_0:def 15;
  then reconsider f as Function of N4,H by A25,FUNCT_2:def 1,RELSET_1:4;
  g = (0 .--> a) +* (1 .-->b) by FUNCT_4:def 4;
  then
A30: g is one-to-one by A11,FUNCT_4:92;
  then
A31: f is one-to-one by A19,A21,FUNCT_4:92;
A32: the InternalRel of H = {[a,b],[b,a],[b,c],[c,b],[c,d],[d,c]}
  proof
    thus the InternalRel of H c= {[a,b],[b,a],[b,c],[c,b],[c,d],[d,c]}
    proof
      let x be object;
A33:  the carrier of H = Z by YELLOW_0:def 15;
      assume
A34:  x in IH;
      then
A35:  x in IG |_2 cH by YELLOW_0:def 14;
      then
A36:  x in IG by XBOOLE_0:def 4;
      x in [:cH,cH:] by A34;
      then
A37:  x in X \/ Y by A1,A33,Th3;
      per cases by A37,XBOOLE_0:def 3;
      suppose
A38:    x in X;
        thus thesis
        proof
          per cases by A38,ENUMSET1:def 6;
          suppose
A39:        x = [a,a];
            not [a,a] in IG by NECKLACE:def 5;
            hence thesis by A35,A39,XBOOLE_0:def 4;
          end;
          suppose
            x =[a,b];
            hence thesis by ENUMSET1:def 4;
          end;
          suppose
            x =[b,a];
            hence thesis by ENUMSET1:def 4;
          end;
          suppose
A40:        x =[b,b];
            not [b,b] in IG by NECKLACE:def 5;
            hence thesis by A35,A40,XBOOLE_0:def 4;
          end;
          suppose
            x = [a,c];
            hence thesis by A6,A35,XBOOLE_0:def 4;
          end;
          suppose
            x = [a,d];
            hence thesis by A7,A35,XBOOLE_0:def 4;
          end;
          suppose
            x = [b,c];
            hence thesis by ENUMSET1:def 4;
          end;
          suppose
            x =[b,d];
            hence thesis by A8,A35,XBOOLE_0:def 4;
          end;
        end;
      end;
      suppose
A41:    x in Y;
A42:    IG is_symmetric_in the carrier of G by NECKLACE:def 3;
        thus thesis
        proof
          per cases by A41,ENUMSET1:def 6;
          suppose
            x = [c,a];
            hence thesis by A6,A36,A42;
          end;
          suppose
            x = [c,b];
            hence thesis by ENUMSET1:def 4;
          end;
          suppose
            x = [d,a];
            hence thesis by A7,A36,A42;
          end;
          suppose
            x = [d,b];
            hence thesis by A8,A36,A42;
          end;
          suppose
A43:        x = [c,c];
            not [c,c] in IG by NECKLACE:def 5;
            hence thesis by A35,A43,XBOOLE_0:def 4;
          end;
          suppose
            x = [c,d];
            hence thesis by ENUMSET1:def 4;
          end;
          suppose
            x = [d,c];
            hence thesis by ENUMSET1:def 4;
          end;
          suppose
A44:        x = [d,d];
            not [d,d] in IG by NECKLACE:def 5;
            hence thesis by A35,A44,XBOOLE_0:def 4;
          end;
        end;
      end;
    end;
    let x be object;
    assume
A45: x in {[a,b],[b,a],[b,c],[c,b],[c,d],[d,c]};
    per cases by A45,ENUMSET1:def 4;
    suppose
A46:  x = [a,b];
      b in Z by A1,ENUMSET1:def 2;
      then
A47:  b in cH by YELLOW_0:def 15;
      a in Z by A1,ENUMSET1:def 2;
      then a in cH by YELLOW_0:def 15;
      then [a,b] in [:cH,cH:] by A47,ZFMISC_1:87;
      then x in IG |_2 cH by A3,A46,XBOOLE_0:def 4;
      hence thesis by YELLOW_0:def 14;
    end;
    suppose
A48:  x = [b,a];
      IG is_symmetric_in the carrier of G by NECKLACE:def 3;
      then
A49:  [b,a] in IG by A3;
      a in Z by A1,ENUMSET1:def 2;
      then
A50:  a in cH by YELLOW_0:def 15;
      b in Z by A1,ENUMSET1:def 2;
      then b in cH by YELLOW_0:def 15;
      then [b,a] in [:cH,cH:] by A50,ZFMISC_1:87;
      then x in IG |_2 cH by A48,A49,XBOOLE_0:def 4;
      hence thesis by YELLOW_0:def 14;
    end;
    suppose
A51:  x = [b,c];
      c in Z by A1,ENUMSET1:def 2;
      then
A52:  c in cH by YELLOW_0:def 15;
      b in Z by A1,ENUMSET1:def 2;
      then b in cH by YELLOW_0:def 15;
      then [b,c] in [:cH,cH:] by A52,ZFMISC_1:87;
      then x in IG |_2 cH by A4,A51,XBOOLE_0:def 4;
      hence thesis by YELLOW_0:def 14;
    end;
    suppose
A53:  x = [c,b];
      IG is_symmetric_in the carrier of G by NECKLACE:def 3;
      then
A54:  [c,b] in IG by A4;
      c in Z by A1,ENUMSET1:def 2;
      then
A55:  c in cH by YELLOW_0:def 15;
      b in Z by A1,ENUMSET1:def 2;
      then b in cH by YELLOW_0:def 15;
      then [c,b] in [:cH,cH:] by A55,ZFMISC_1:87;
      then x in IG |_2 cH by A53,A54,XBOOLE_0:def 4;
      hence thesis by YELLOW_0:def 14;
    end;
    suppose
A56:  x = [c,d];
      d in Z by A1,ENUMSET1:def 2;
      then
A57:  d in cH by YELLOW_0:def 15;
      c in Z by A1,ENUMSET1:def 2;
      then c in cH by YELLOW_0:def 15;
      then [c,d] in [:cH,cH:] by A57,ZFMISC_1:87;
      then x in IG |_2 cH by A5,A56,XBOOLE_0:def 4;
      hence thesis by YELLOW_0:def 14;
    end;
    suppose
A58:  x = [d,c];
      IG is_symmetric_in the carrier of G by NECKLACE:def 3;
      then
A59:  [d,c] in IG by A5;
      d in Z by A1,ENUMSET1:def 2;
      then
A60:  d in cH by YELLOW_0:def 15;
      c in Z by A1,ENUMSET1:def 2;
      then c in cH by YELLOW_0:def 15;
      then [d,c] in [:cH,cH:] by A60,ZFMISC_1:87;
      then x in IG |_2 cH by A58,A59,XBOOLE_0:def 4;
      hence thesis by YELLOW_0:def 14;
    end;
  end;
  for x,y being Element of N4 holds [x,y] in the InternalRel of N4 iff [
  f.x,f.y] in the InternalRel of H
  proof
    let x,y being Element of N4;
    thus [x,y] in the InternalRel of N4 implies [f.x,f.y] in the InternalRel
    of H
    proof
      assume
A61:  [x,y] in the InternalRel of N4;
      per cases by A61,ENUMSET1:def 4,NECKLA_2:2;
      suppose
A62:    [x,y] = [0,1];
        then
A63:    y = 1 by XTUPLE_0:1;
        then y in {0,1} by TARSKI:def 2;
        then y in dom g by FUNCT_4:62;
        then
A64:    f.y = g.1 by A26,A63,FUNCT_4:16
          .= b by FUNCT_4:63;
A65:    x = 0 by A62,XTUPLE_0:1;
        then x in {0,1} by TARSKI:def 2;
        then x in dom g by FUNCT_4:62;
        then f.x = g.0 by A26,A65,FUNCT_4:16
          .= a by FUNCT_4:63;
        hence thesis by A32,A64,ENUMSET1:def 4;
      end;
      suppose
A66:    [x,y] = [1,0];
        then
A67:    y = 0 by XTUPLE_0:1;
        then y in {0,1} by TARSKI:def 2;
        then y in dom g by FUNCT_4:62;
        then
A68:    f.y = g.0 by A26,A67,FUNCT_4:16
          .= a by FUNCT_4:63;
A69:    x = 1 by A66,XTUPLE_0:1;
        then x in {0,1} by TARSKI:def 2;
        then x in dom g by FUNCT_4:62;
        then f.x = g.1 by A26,A69,FUNCT_4:16
          .= b by FUNCT_4:63;
        hence thesis by A32,A68,ENUMSET1:def 4;
      end;
      suppose
A70:    [x,y] = [1,2];
        then
A71:    x = 1 by XTUPLE_0:1;
        then x in {0,1} by TARSKI:def 2;
        then x in dom g by FUNCT_4:62;
        then
A72:    f.x = g.1 by A26,A71,FUNCT_4:16
          .= b by FUNCT_4:63;
A73:    y = 2 by A70,XTUPLE_0:1;
        then y in {2,3} by TARSKI:def 2;
        then
A74:    y in dom h by FUNCT_4:62;
        g +* h = h +* g by A26,FUNCT_4:35;
        then f.y = h.2 by A26,A73,A74,FUNCT_4:16
          .= c by FUNCT_4:63;
        hence thesis by A32,A72,ENUMSET1:def 4;
      end;
      suppose
A75:    [x,y] = [2,1];
        then
A76:    y = 1 by XTUPLE_0:1;
        then y in {0,1} by TARSKI:def 2;
        then y in dom g by FUNCT_4:62;
        then
A77:    f.y = g.1 by A26,A76,FUNCT_4:16
          .= b by FUNCT_4:63;
A78:    x = 2 by A75,XTUPLE_0:1;
        then x in {2,3} by TARSKI:def 2;
        then
A79:    x in dom h by FUNCT_4:62;
        g +* h = h +* g by A26,FUNCT_4:35;
        then f.x = h.2 by A26,A78,A79,FUNCT_4:16
          .= c by FUNCT_4:63;
        hence thesis by A32,A77,ENUMSET1:def 4;
      end;
      suppose
A80:    [x,y] = [2,3];
A81:    g +* h = h +* g by A26,FUNCT_4:35;
A82:    y = 3 by A80,XTUPLE_0:1;
        then y in {2,3} by TARSKI:def 2;
        then y in dom h by FUNCT_4:62;
        then
A83:    f.y = h.3 by A26,A82,A81,FUNCT_4:16
          .= d by FUNCT_4:63;
A84:    x = 2 by A80,XTUPLE_0:1;
        then x in {2,3} by TARSKI:def 2;
        then x in dom h by FUNCT_4:62;
        then f.x = h.2 by A26,A84,A81,FUNCT_4:16
          .= c by FUNCT_4:63;
        hence thesis by A32,A83,ENUMSET1:def 4;
      end;
      suppose
A85:    [x,y] = [3,2];
A86:    g +* h = h +* g by A26,FUNCT_4:35;
A87:    y = 2 by A85,XTUPLE_0:1;
        then y in {3,2} by TARSKI:def 2;
        then y in dom h by FUNCT_4:62;
        then
A88:    f.y = h.2 by A26,A87,A86,FUNCT_4:16
          .= c by FUNCT_4:63;
A89:    x = 3 by A85,XTUPLE_0:1;
        then x in {3,2} by TARSKI:def 2;
        then x in dom h by FUNCT_4:62;
        then f.x = h.3 by A26,A89,A86,FUNCT_4:16
          .= d by FUNCT_4:63;
        hence thesis by A32,A88,ENUMSET1:def 4;
      end;
    end;
    thus [f.x,f.y] in the InternalRel of H implies [x,y] in the InternalRel of
    N4
    proof
      reconsider F=f" as Function of the carrier of H,the carrier of N4 by A29
,A31,FUNCT_2:25;
A90:  dom g = {0,1} by FUNCT_4:62;
A91:  rng g = {a,b} by FUNCT_4:64;
      then reconsider g as Function of {0,1},{a,b} by A90,RELSET_1:4;
      reconsider G = g" as Function of {a,b},{0,1} by A20,A30,FUNCT_2:25;
A92:  dom h = {2,3} by FUNCT_4:62;
A93:  rng h = {c,d} by FUNCT_4:64;
      then reconsider h as Function of {2,3},{c,d} by A92,RELSET_1:4;
      reconsider Hh = h" as Function of {c,d},{2,3} by A9,A19,FUNCT_2:25;
A94:  dom Hh = {c,d} by A19,A93,FUNCT_1:33;
A95:  Hh = (c,d) --> (2,3) by A16,NECKLACE:10;
A96:  F = G +* Hh by A26,A30,A19,A21,NECKLACE:7;
A97:  G = (a,b) --> (0,1) by A10,NECKLACE:10;
A98:  dom G = {a,b} by A30,A91,FUNCT_1:33;
      then G +* Hh = Hh +* G by A20,A9,A21,A94,FUNCT_4:35;
      then
A99:  F = Hh +* G by A26,A30,A19,A21,NECKLACE:7;
      assume
A100: [f.x,f.y] in the InternalRel of H;
      per cases by A32,A100,ENUMSET1:def 4;
      suppose
A101:   [f.x,f.y] = [a,b];
        then
A102:   f.x = a by XTUPLE_0:1;
        then f.x in {a,b} by TARSKI:def 2;
        then F.(f.x) = G.a by A20,A9,A21,A98,A94,A96,A102,FUNCT_4:16
          .= 0 by A10,A97,FUNCT_4:63;
        then
A103:   x = 0 by A14,A31,FUNCT_2:26;
A104:   f.y = b by A101,XTUPLE_0:1;
        then f.y in dom G by A98,TARSKI:def 2;
        then
A105:   F.(f.y) = G.b by A20,A9,A21,A98,A94,A96,A104,FUNCT_4:16
          .= 1 by A97,FUNCT_4:63;
        F.(f.y) = y by A14,A31,FUNCT_2:26;
        hence thesis by A103,A105,ENUMSET1:def 4,NECKLA_2:2;
      end;
      suppose
A106:   [f.x,f.y] = [b,a];
        then
A107:   f.y = a by XTUPLE_0:1;
        then f.y in {a,b} by TARSKI:def 2;
        then F.(f.y) = G.a by A20,A9,A21,A98,A94,A96,A107,FUNCT_4:16
          .= 0 by A10,A97,FUNCT_4:63;
        then
A108:   y = 0 by A14,A31,FUNCT_2:26;
A109:   f.x = b by A106,XTUPLE_0:1;
        then f.x in dom G by A98,TARSKI:def 2;
        then
A110:   F.(f.x) = G.b by A20,A9,A21,A98,A94,A96,A109,FUNCT_4:16
          .= 1 by A97,FUNCT_4:63;
        F.(f.x) = x by A14,A31,FUNCT_2:26;
        hence thesis by A108,A110,ENUMSET1:def 4,NECKLA_2:2;
      end;
      suppose
A111:   [f.x,f.y] = [b,c];
        then
A112:   f.x = b by XTUPLE_0:1;
        then f.x in dom G by A98,TARSKI:def 2;
        then F.(f.x) = G.b by A20,A9,A21,A98,A94,A96,A112,FUNCT_4:16
          .= 1 by A97,FUNCT_4:63;
        then
A113:   x = 1 by A14,A31,FUNCT_2:26;
A114:   f.y = c by A111,XTUPLE_0:1;
        then f.y in dom Hh by A94,TARSKI:def 2;
        then
A115:   F.(f.y) = Hh.c by A20,A9,A21,A98,A94,A99,A114,FUNCT_4:16
          .= 2 by A16,A95,FUNCT_4:63;
        F.(f.y) = y by A14,A31,FUNCT_2:26;
        hence thesis by A113,A115,ENUMSET1:def 4,NECKLA_2:2;
      end;
      suppose
A116:   [f.x,f.y] = [c,b];
        then
A117:   f.y = b by XTUPLE_0:1;
        then f.y in dom G by A98,TARSKI:def 2;
        then F.(f.y) = G.b by A20,A9,A21,A98,A94,A96,A117,FUNCT_4:16
          .= 1 by A97,FUNCT_4:63;
        then
A118:   y = 1 by A14,A31,FUNCT_2:26;
A119:   f.x = c by A116,XTUPLE_0:1;
        then f.x in dom Hh by A94,TARSKI:def 2;
        then
A120:   F.(f.x) = Hh.c by A20,A9,A21,A98,A94,A99,A119,FUNCT_4:16
          .= 2 by A16,A95,FUNCT_4:63;
        F.(f.x) = x by A14,A31,FUNCT_2:26;
        hence thesis by A118,A120,ENUMSET1:def 4,NECKLA_2:2;
      end;
      suppose
A121:   [f.x,f.y] = [c,d];
        then
A122:   f.x = c by XTUPLE_0:1;
        then f.x in {c,d} by TARSKI:def 2;
        then F.(f.x) = Hh.c by A20,A9,A21,A98,A94,A99,A122,FUNCT_4:16
          .= 2 by A16,A95,FUNCT_4:63;
        then
A123:   x = 2 by A14,A31,FUNCT_2:26;
A124:   f.y = d by A121,XTUPLE_0:1;
        then f.y in dom Hh by A94,TARSKI:def 2;
        then
A125:   F.(f.y) = Hh.d by A20,A9,A21,A98,A94,A99,A124,FUNCT_4:16
          .= 3 by A95,FUNCT_4:63;
        F.(f.y) = y by A14,A31,FUNCT_2:26;
        hence thesis by A123,A125,ENUMSET1:def 4,NECKLA_2:2;
      end;
      suppose
A126:   [f.x,f.y] = [d,c];
        then
A127:   f.y = c by XTUPLE_0:1;
        then f.y in {c,d} by TARSKI:def 2;
        then F.(f.y) = Hh.c by A20,A9,A21,A98,A94,A99,A127,FUNCT_4:16
          .= 2 by A16,A95,FUNCT_4:63;
        then
A128:   y = 2 by A14,A31,FUNCT_2:26;
A129:   f.x = d by A126,XTUPLE_0:1;
        then f.x in dom Hh by A94,TARSKI:def 2;
        then
A130:   F.(f.x) = Hh.d by A20,A9,A21,A98,A94,A99,A129,FUNCT_4:16
          .= 3 by A95,FUNCT_4:63;
        F.(f.x) = x by A14,A31,FUNCT_2:26;
        hence thesis by A128,A130,ENUMSET1:def 4,NECKLA_2:2;
      end;
    end;
  end;
  hence thesis by A31;
end;
