reserve v for object;
reserve V,A for set;
reserve f for SCBinominativeFunction of V,A;
reserve d for TypeSCNominativeData of V,A;
reserve d1 for NonatomicND of V,A;
reserve a,b,c,z for Element of V;
reserve x,y for object;
reserve p,q,r,s for SCPartialNominativePredicate of V,A;
reserve x0,y0 for Nat;

theorem Th18:
  V is non empty & A is_without_nonatomicND_wrt V & a <> b &
  A is complex-containing &
  (for d holds a is_complex_on d) & (for d holds b is_complex_on d)
  implies
  <* PP_and(less(A,a,b),gcd_inv(V,A,a,b,x0,y0)),
     SC_assignment(subtraction(A,b,a),b),
     gcd_inv(V,A,a,b,x0,y0) *> is SFHT of ND(V,A)
  proof
    assume that
A1: V is non empty and
A2: A is_without_nonatomicND_wrt V and
A3: a <> b and
A4: A is complex-containing and
A5: for d holds a is_complex_on d and
A6: for d holds b is_complex_on d;
    set i = gcd_inv(V,A,a,b,x0,y0);
    set l = less(A,a,b);
    set D = subtraction(A,b,a);
    set Da = denaming(V,A,a);
    set Db = denaming(V,A,b);
    set f = SC_assignment(D,b);
    set p = PP_and(l,i);
    set S = SC_Psuperpos(i,D,b);
A7: <*S,f,i*> is SFHT of ND(V,A) by NOMIN_3:29;
    for d holds d in dom p & p.d = TRUE & d in dom f & f.d in dom i implies
     i.(f.d) = TRUE
    proof
      let d such that
A8:   d in dom p and
A9:   p.d = TRUE and
A10:  d in dom f and
A11:  f.d in dom i;
A12:  dom f = dom D by NOMIN_2:def 7;
A13:  dom S = {d where d is TypeSCNominativeData of V,A:
       local_overlapping(V,A,d,D.d,b) in dom i & d in dom D} by NOMIN_2:def 11;
A14:  dom Da = {d where d is NonatomicND of V,A: a in dom d} by NOMIN_1:def 18;
A15:  dom Db = {d where d is NonatomicND of V,A: b in dom d} by NOMIN_1:def 18;
A16:  d in dom l by A8,A9,PARTPR_1:23;
A17:  dom(less(A)*<:Da,Db:>) c= dom <:Da,Db:> by RELAT_1:25;
A18:  dom <:Da,Db:> = dom Da /\ dom Db by FUNCT_3:def 7;
      then
A19:  d in dom Da by A16,A17,XBOOLE_0:def 4;
      then consider da being NonatomicND of V,A such that
A20:  d = da and
A21:  a in dom da by A14;
A22:  d in dom Db by A16,A17,A18,XBOOLE_0:def 4;
      then consider db being NonatomicND of V,A such that
A23:  d = db and
A24:  b in dom db by A15;
      reconsider L = local_overlapping(V,A,db,D.db,b) as Function;
      dom i = ND(V,A) by Def28;
      then
A25:  L in dom i;
A26:  rng D c= rng subtraction(A) by RELAT_1:26;
A27:  rng D c= A by A26,XBOOLE_1:1;
      reconsider L as NonatomicND of V,A by NOMIN_2:9;
A28:  gcd_inv_pred V,A,a,b,x0,y0,L
      proof
        take L;
        thus L = L;
        d in dom i & i.d = TRUE by A8,A9,PARTPR_1:23;
        then gcd_inv_pred V,A,a,b,x0,y0,d by Def28;
        then consider d1 being NonatomicND of V,A such that
A29:    d = d1 and
        a in dom d1 and
        b in dom d1 and
A30:    ex x,y being Nat st x = d1.a & y = d1.b & x gcd y = x0 gcd y0;
        consider x,y being Nat such that
A31:    x = d1.a and
A32:    y = d1.b and
A33:    x gcd y = x0 gcd y0 by A30;
        D.d in rng D by A10,A12,FUNCT_1:def 3;
        then reconsider Dd = D.d as TypeSCNominativeData of V,A
        by A27,NOMIN_1:def 6;
A34:    L.b = Dd by A1,A23,NOMIN_2:10;
A35:    <:Da,Db:>.d = [Da.d,Db.d] by A16,A17,FUNCT_3:def 7;
A36:    Da.d = denaming(a,da) & Db.d = denaming(b,db)
        by A20,A23,A19,A22,NOMIN_1:def 18;
        a is_complex_on d & b is_complex_on d by A5,A6;
        then consider x1,y1 being Complex such that
A37:    x1 = denaming(b,db) and
A38:    y1 = denaming(a,da) and
A39:    subtraction(denaming(b,db),denaming(a,da)) = x1 - y1 by A36,Def14;
A40:    y1 = x by A20,A21,A29,A31,A38,NOMIN_1:def 12;
A41:    x1 = y by A23,A24,A29,A32,A37,NOMIN_1:def 12;
A42:    not db in A by A2,Th3;
A43:    not naming(V,A,b,D.db) in A by A2,Th3;
A44:    Dd = D.d;
A45:    denaming(a,da) in COMPLEX by A38,XCMPLX_0:def 2;
A46:    denaming(b,db) in COMPLEX by A37,XCMPLX_0:def 2;
A47:    dom local_overlapping(V,A,db,Dd,b) = dom db
        by A1,A23,A24,A42,A43,NOMIN_2:14;
        hence a in dom L by A20,A21,A23;
        thus b in dom L by A23,A24,A47;
A48:    l.d = TRUE by A8,A9,PARTPR_1:23;
        d in dom l by A8,A9,PARTPR_1:23;
        then l.d = (less(A)).(Da.d,Db.d) by A35,FUNCT_1:12;
        then Da.d less_pred Db.d by A4,A36,A45,A46,A48,Def12;
        then y-x in NAT by A36,A37,A38,A40,A41,INT_1:5;
        then reconsider z = y-x as Nat;
        take x,z;
        dom <:Db,Da:> = dom Da /\ dom Db by FUNCT_3:def 7;
        then
A49:    d in dom <:Db,Da:> by A19,A22,XBOOLE_0:def 4;
        then <:Db,Da:>.d = [Db.d,Da.d] by FUNCT_3:def 7;
        then
A50:    D.d = (subtraction(A)).(denaming(b,db),denaming(a,da))
        by A36,A49,FUNCT_1:13
        .= subtraction(denaming(b,db),denaming(a,da)) by A4,A45,A46,Def15;
        thus x = L.a by A1,A3,A20,A21,A23,A29,A31,A42,A43,A44,NOMIN_2:12;
        thus z = L.b by A20,A21,A29,A31,A34,A38,A39,A41,A50,NOMIN_1:def 12;
        (y-1*x) gcd x = y gcd x by NEWTON02:5;
        hence thesis by A33;
      end;
A51:  d in dom S by A10,A12,A13,A23,A25;
      then S.d = i.L by A23,NOMIN_2:35
      .= TRUE by A25,A28,Def28;
      hence i.(f.d) = TRUE by A7,A10,A11,A51,NOMIN_3:11;
    end;
    hence thesis by NOMIN_3:28;
  end;
