reserve A for non trivial Nat,
        B,C,n,m,k for Nat,
        e for Nat;
reserve a for non trivial Nat;

theorem Th12:
  for a be non trivial Nat,s,n be Nat holds
    s^2*(s|^n)^2-(s^2-1)*Py(a,n+1)*(s|^n)-1,0 are_congruent_mod 2*a*s-s^2-1
proof
  let a be non trivial Nat,s be Nat;set S=s^2;
  defpred P[Nat] means
    S*(s|^$1)^2-(S-1)*Py(a,$1+1)*(s|^$1)-1,0 are_congruent_mod
    2*a*s-s^2-1;
A1:Py(a,0+1) = Px(a,0) + Py(a,0)*a & Py(a,0) = 0 by HILB10_1:3,6;
  then
A2: Py(a,0+1) =1 + 0*a by HILB10_1:3;
  s|^0 = 1 by NEWTON:4;
  then
A3: S*(s|^0)^2-(S-1)*Py(a,0+1)*(s|^0)-1
     = S * (1*1) - (S-1)*1*1-1 by A2,SQUARE_1:def 1
    .=0;
A4: for k be Nat st for n st n < k holds P[n] holds P[k]
  proof
    let k be Nat such that
A5:   for n st n < k holds P[n];
    set as2 = 2*a*s-S-1;
    per cases by NAT_1:23;
    suppose k=0;
      hence thesis by A3,INT_1:11;
    end;
    suppose
A6:     k =1;
A7:     Py(a,0+2) = 2*a*Py(a,0+1) - Py(a,0) by HILB10_6:12;
      s|^1 = s & s*s =s^2 by SQUARE_1:def 1;
      then s^2*(s|^1)^2-(s^2-1)*Py(a,1+1)*(s|^1)-1 =
        as2*(-s*s+1) by A7,A1,A2;
      then as2 divides s^2*(s|^1)^2-(s^2-1)*Py(a,1+1)*(s|^1)-1 -0
        by INT_1:def 3;
      hence thesis by A6,INT_1:def 4;
    end;
    suppose k>=2;
      then reconsider n =k-2 as Nat by NAT_1:21;
      set Sn = s|^n;
A8:     Py(a,n+1+2) = 2*a*Py(a,n+1+1) - Py(a,n+1) by HILB10_6:12;
A9:     - S*Sn^2 +1,- S*Sn^2 +1 are_congruent_mod as2 by INT_1:11;
A10:    -S,-S are_congruent_mod as2 by INT_1:11;
A11:    -S*(s|^(n+1))^2 +1,-S*(s|^(n+1))^2+1 are_congruent_mod as2 by INT_1:11;
A12:    (2*a)*s,(2*a)*s are_congruent_mod as2 by INT_1:11;
A13:    -Sn^2 * S*S +1,-Sn^2 * S*S +1 are_congruent_mod as2 by INT_1:11;
A14:    s|^(n+1+1)= s|^(n+1) *s & s|^(n+1) = Sn * s & S=s*s
        by NEWTON:6,SQUARE_1:def 1;
A15:  n+1<n+1+1 by NAT_1:13;
      then S*(s|^(n+1))^2-(S-1)*Py(a,n+1+1)*(s|^(n+1))-1,0
        are_congruent_mod as2 by A5;
      then (S*(s|^(n+1))^2-(S-1)*Py(a,k)*(s|^(n+1))-1) +
        (- S*(s|^(n+1))^2 +1), 0+(- S*(s|^(n+1))^2 +1)
      are_congruent_mod as2 by A11,INT_1:16;
      then
A16:    (-(S-1)*Py(a,k)*(s|^(n+1)))*((2*a)*s), (1-S*(s|^(n+1))^2)*(2*a*s)
        are_congruent_mod as2 by A12,INT_1:18;
      n<k by A15,NAT_1:13;
      then s^2*(s|^n)^2-(s^2-1)*Py(a,n+1)*Sn-1,0 are_congruent_mod as2 by A5;
      then s^2*Sn^2-(s^2-1)*Py(a,n+1)*Sn-1+
        (- s^2*Sn^2 +1), 0+(- s^2*Sn^2 +1) are_congruent_mod as2
        by A9,INT_1:16;
      then
A17:   (-(S-1)*Py(a,n+1)*Sn)*(-S), (1- s^2*Sn^2)*(-S)
        are_congruent_mod as2 by A10,INT_1:18;
      S*(s|^k)^2-1, S*(s|^k)^2-1 are_congruent_mod as2 by INT_1:11;
      then S*(s|^k)^2-1+(s^2-1)*Py(a,n+1)*(s|^k),
      S*(s|^k)^2-1 +(1- S*(s|^n)^2)*(-S)
      are_congruent_mod as2 by A14,A17,INT_1:16;
      then
A18:    S*(s|^k)^2-1+(S-1)*Py(a,n+1)*(s|^k)+(-(S-1)*(2*a*Py(a,k))*(s|^k)),
      S*(s|^k)^2-1 +(1- S*(s|^n)^2)*(-S) +(1-S*(s|^(n+1))^2)*(2*a*s)
      are_congruent_mod as2 by A16,A14,INT_1:16;
      s|^k = Sn*(s*s) by A14;
      then
A19:  (s|^k)^2 = Sn^2 * (s*s)^2 by SQUARE_1:9
        .= Sn^2 * (S*S) by SQUARE_1:9;
A20:  (s|^(n+1))^2 = Sn^2*S by A14,SQUARE_1:9;
      as2,0 are_congruent_mod as2 by INT_1:12;
      then (- Sn^2 * S*S +1)*as2,0*(- Sn^2 * S*S +1) are_congruent_mod as2
        by A13,INT_1:18;
      hence thesis by A8,A20,A19,A18,INT_1:15;
    end;
  end;
  P[n] from NAT_1:sch 4(A4);
  hence thesis;
end;
