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
  for val being size-element FinSequence
  for dx,dy being object
  for NN being Nat st NN = size-2 holds
  loc,val,size are_correct_wrt d1 &
  dx = LocalOverlapSeq(A,loc,val,d1,size).(size-1) &
    local_overlapping(V,A,dx,denaming(V,A,val.len val).dx,loc/.len val)
    in dom p &
  dy = local_overlapping(V,A,LocalOverlapSeq(A,loc,val,d1,size).NN,
  denaming(V,A,val.(NN+1)).(LocalOverlapSeq(A,loc,val,d1,size).NN),
  loc/.(NN+1)) &
  local_overlapping(V,A,dy,denaming(V,A,val.len val).dy,loc/.len val) in dom p
  implies
  SC_Psuperpos_Seq(loc,val,p).1.(LocalOverlapSeq(A,loc,val,d1,size).(size-1)) =
  p.(LocalOverlapSeq(A,loc,val,d1,size).size)
  proof
    let val be size-element FinSequence;
    let dx,dy be object;
    let NN be Nat such that
A1: NN = size-2;
    set S = SC_Psuperpos_Seq(loc,val,p);
    set L = LocalOverlapSeq(A,loc,val,d1,size);
    set D = denaming(V,A,val.len val);
    assume that
A2: loc,val,size are_correct_wrt d1 and
A3: dx = LocalOverlapSeq(A,loc,val,d1,size).(size-1) and
A4: local_overlapping(V,A,dx,D.dx,loc/.len val) in dom p and
A5: dy = local_overlapping(V,A,L.NN,denaming(V,A,val.(NN+1)).(L.NN),
    loc/.(NN+1)) and
A6: local_overlapping(V,A,dy,D.dy,loc/.len val) in dom p;
A7: 0+2 <= size-2+2 by A1,XREAL_1:6;
    then
A8: 1 <= size by XXREAL_0:2;
    reconsider N = size-1 as Element of NAT by A7,XXREAL_0:2,INT_1:5;
A9: len L = size by NOMIN_7:def 4;
A10: len val = size by CARD_1:def 7;
A11: S.1 = SC_Psuperpos(p,D,loc/.len val) by Def9;
A12: dom(SC_Psuperpos(p,D,loc/.len val)) =
      {d where d is TypeSCNominativeData of V,A:
      local_overlapping(V,A,d,D.d,loc/.len val) in dom p & d in dom D}
      by NOMIN_2:def 11;
A13: 2-1 <= N by A7,XREAL_1:9;
    then per cases by XXREAL_0:1;
    suppose
A14:  N = 1;
      set D1 = denaming(V,A,val.1);
A15:  L.1 = local_overlapping(V,A,d1,D1.d1,loc/.1) by NOMIN_7:def 4;
A16:  L.(N+1) =
      local_overlapping(V,A,L.N,denaming(V,A,val.(N+1)).(L.N),loc/.(N+1))
      by A9,A14,NOMIN_7:def 4;
      set dd = local_overlapping(V,A,d1,D1.d1,loc/.1);
      dd in dom D by A2,A9,A10,A8,A15,Th15;
      then dd in dom(SC_Psuperpos(p,D,loc/.len val)) by A12,A3,A4,A14,A15;
      hence S.1.(L.(size-1)) = p.(L.size) by A14,A10,A15,A16,A11,NOMIN_2:35;
    end;
    suppose
A17:  1 < N;
      then reconsider NN = N-1 as Element of NAT by INT_1:5;
      1-1 < N-1 by A17,XREAL_1:9;
      then
A18:  0+1 <= NN by INT_1:7;
A19:  N-1 < N by XREAL_1:44;
A20:  N < len L by A9,XREAL_1:44;
      then NN < len L by A19,XXREAL_0:2;
      then
A21:  L.(NN+1) =
      local_overlapping(V,A,L.NN,denaming(V,A,val.(NN+1)).(L.NN),loc/.(NN+1))
      by A18,NOMIN_7:def 4;
A22:  L.(N+1) =
      local_overlapping(V,A,L.N,denaming(V,A,val.(N+1)).(L.N),loc/.(N+1))
      by A17,A20,NOMIN_7:def 4;
      set Dn = denaming(V,A,val.(NN+1));
      set dd = local_overlapping(V,A,L.NN,Dn.(L.NN),loc/.(NN+1));
      dd in dom D by A2,A9,A10,A8,A21,A13,A20,Th15;
      then dd in dom(SC_Psuperpos(p,D,loc/.len val)) by A1,A5,A6,A12;
      hence S.1.(L.(size-1)) = p.(L.size) by A10,A22,A11,A21,NOMIN_2:35;
    end;
  end;
