reserve D for non empty set;
reserve f1,f2,f3,f4,f5,f6,f7,f8,f9,f10 for BinominativeFunction of D;
reserve p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11 for PartialPredicate of D;
reserve q1,q2,q3,q4,q5,q6,q7,q8,q9,q10 for total PartialPredicate of D;
reserve n,m,N for Nat;
reserve fD for PFuncs(D,D)-valued FinSequence;
reserve fB for PFuncs(D,BOOLEAN)-valued FinSequence;
reserve V,A for set;
reserve val for Function;
reserve loc for V-valued Function;
reserve d1 for NonatomicND of V,A;
reserve p for SCPartialNominativePredicate of V,A;
reserve d,v for object;
reserve size for non zero Nat;
reserve inp,pos for FinSequence;
reserve prg for non empty FPrg(ND(V,A))-valued FinSequence;

theorem Th17:
  for val being size-element FinSequence holds
  loc,val,size are_correct_wrt d1 &
  d = LocalOverlapSeq(A,loc,val,d1,size).(size-1) &
  local_overlapping(V,A,d,denaming(V,A,val.len val).d,loc/.len val) in dom p
  implies
  for m,n being Nat st 1 <= m < size & 1 <= n < size holds
  SC_Psuperpos_Seq(loc,val,p).m.(LocalOverlapSeq(A,loc,val,d1,size).(size-m)) =
  SC_Psuperpos_Seq(loc,val,p).n.(LocalOverlapSeq(A,loc,val,d1,size).(size-n))
  proof
    let val be size-element FinSequence such that
A1: loc,val,size are_correct_wrt d1 and
A2: d = LocalOverlapSeq(A,loc,val,d1,size).(size-1) and
A3: local_overlapping(V,A,d,denaming(V,A,val.len val).d,loc/.len val) in dom p;
    let m,n be Nat such that
A4: 1 <= m and
A5: m < size and
A6: 1 <= n and
A7: n < size;
    set S = SC_Psuperpos_Seq(loc,val,p);
    set L = LocalOverlapSeq(A,loc,val,d1,size);
    defpred P[Nat] means
    1 <= $1 < size implies S.m.(L.(size-m)) = S.$1.(L.(size-$1));
A8: P[0];
A9: for k being Nat st P[k] holds P[k+1]
    proof
      let k be Nat such that
A10:  P[k] and
      1 <= k+1 and
A11:  k+1 < size;
      set D = denaming(V,A,val.(len val-k));
A12:  len val = size by CARD_1:def 7;
A13:  len S = len val by Def9;
A14:  len L = size by NOMIN_7:def 4;
A15:  k < size by A11,NAT_1:13;
      per cases;
      suppose
A16:    k = 0;
        defpred R[Nat] means
        1 <= $1 < size implies S.$1.(L.(size-$1)) = S.1.(L.(size-1));
A17:    R[0];
A18:    for x being Nat st R[x] holds R[x+1]
        proof
          let x be Nat such that
A19:      R[x] and
          1 <= x+1 and
A20:      x+1 < size;
          per cases;
          suppose x = 0;
            hence thesis;
          end;
          suppose x > 0;
            then
A21:        0+1 <= x by NAT_1:13;
            set DD = denaming(V,A,val.(len val-x));
A22:        x <= x+1 by NAT_1:11;
            then x < len S by A13,A12,A20,XXREAL_0:2;
            then
A23:        S.(x+1) = SC_Psuperpos(S.x,DD,loc/.(len val-x)) by A21,Def9;
            reconsider u = size-x-1 as Element of NAT
            by A20,XREAL_1:19,INT_1:5;
            x+1-x < size-x by A20,XREAL_1:9;
            then 1-1 < size-x-1 by XREAL_1:9;
            then
A24:        0+1 <= size-(x+1) by INT_1:7;
A25:        size-(x+1) < size by XREAL_1:44;
            then reconsider dd = L.u as NonatomicND of V,A
            by A14,A24,NOMIN_7:def 6;
A26:        dom(SC_Psuperpos(S.x,DD,loc/.(len val-x))) =
            {d where d is TypeSCNominativeData of V,A:
            local_overlapping(V,A,d,DD.d,loc/.(len val-x)) in dom(S.x) &
            d in dom DD} by NOMIN_2:def 11;
            1+1 <= x+1 by A21,XREAL_1:6;
            then
A27:        local_overlapping(V,A,dd,DD.dd,loc/.(len val-x)) in dom(S.x)
            by A1,A2,A3,A20,Th16;
A28:        dom DD = {d where d is NonatomicND of V,A:val.(len val-x) in dom d}
            by NOMIN_1:def 18;
A29:        1 <= u+1 by NAT_1:11;
            u+1 <= size by A25,INT_1:7;
            then val.(u+1) in dom(L.u) by A1,A24,A25,A29,NOMIN_7:10;
            then dd in dom DD by A12,A28;
            then
A30:        dd in dom(SC_Psuperpos(S.x,DD,loc/.(len val-x))) by A26,A27;
            L.(u+1) =
            local_overlapping(V,A,L.u,denaming(V,A,val.(u+1)).(L.u),loc/.(u+1))
            by A14,A24,A25,NOMIN_7:def 4;
            hence thesis by A22,A23,A30,A12,A19,A21,A20,XXREAL_0:2,NOMIN_2:35;
          end;
        end;
        for x being Nat holds R[x] from NAT_1:sch 2(A17,A18);
        hence S.m.(L.(size-m)) = S.(k+1).(L.(size-(k+1))) by A4,A5,A16;
      end;
      suppose k > 0;
        then
A31:    0+1 <= k by NAT_1:13;
        then
A32:    S.(k+1) = SC_Psuperpos(S.k,D,loc/.(size-k)) by A12,A13,A15,Def9;
        set D1 = L.(size-(k+1));
A33:    k+1-k < size-k by A11,XREAL_1:9;
        then reconsider w = size-k-1 as Element of NAT by INT_1:5;
        1-1 < w by A33,XREAL_1:9;
        then
A34:    0+1 <= w by NAT_1:13;
A35:    size-(k+1) < size by XREAL_1:44;
        then
A36:    L.(w+1) =
        local_overlapping(V,A,L.w,denaming(V,A,val.(w+1)).(L.w),loc/.(w+1))
        by A14,A34,NOMIN_7:def 4;
        reconsider D1 as NonatomicND of V,A by A14,A34,A35,NOMIN_7:def 6;
A37:    dom(SC_Psuperpos(S.k,D,loc/.(len val-k))) =
        {d where d is TypeSCNominativeData of V,A:
        local_overlapping(V,A,d,D.d,loc/.(len val-k)) in dom(S.k) & d in dom D}
        by NOMIN_2:def 11;
A38:    D1 = L.(size-k-1);
        1+1 <= k+1 by A31,XREAL_1:6; then
A39:    local_overlapping(V,A,D1,D.D1,loc/.(len val-k)) in dom(S.k)
        by A1,A11,A2,A3,A38,Th16;
A40:    dom D = {d where d is NonatomicND of V,A: val.(len val-k) in dom d}
        by NOMIN_1:def 18;
A41:    1 <= w+1 by NAT_1:11;
        w+1 <= size by A35,INT_1:7;
        then val.(w+1) in dom(L.w) by A1,A34,A35,A41,NOMIN_7:10;
        then D1 in dom D by A12,A40;
        then D1 in dom(SC_Psuperpos(S.k,D,loc/.(len val-k))) by A37,A39;
        hence thesis by A10,A31,A32,A12,A36,A11,NAT_1:13,NOMIN_2:35;
      end;
    end;
    for k being Nat holds P[k] from NAT_1:sch 2(A8,A9);
    hence thesis by A6,A7;
  end;
