reserve x for set;
reserve i,j for Integer;
reserve n,n1,n2,n3 for Nat;
reserve p for Prime;
reserve a,b,c,d for Element of GF(p);
reserve K for Ring;
reserve a1,a2,a3,a4,a5,a6 for Element of K;

theorem Th27:
  for g2, a, b, c, d be Element of GF(p) st g2 = 2 mod p holds
  (a*c+b*d) |^2 = (a |^2)*(c |^2) + g2*a*b*c*d + (b |^2)*(d |^2)
  proof
    let g2, a, b, c, d be Element of GF(p) such that
    A1: g2 = 2 mod p;
    thus (a*c+b*d) |^2 = ((a*c) |^2)+g2*(a*c)*(b*d)+((b*d) |^2) by A1,Th25
    .= (a |^2)*(c |^2)+g2*(a*c)*(b*d)+((b*d) |^2) by BINOM:9
    .= (a |^2)*(c |^2)+g2*(a*c)*(b*d)+(b |^2)*(d |^2) by BINOM:9
    .= (a |^2)*(c |^2)+g2*((a*c)*(b*d))+(b |^2)*(d |^2) by GROUP_1:def 3
    .= (a |^2)*(c |^2)+g2*((a*c)*b*d)+(b |^2)*(d |^2) by GROUP_1:def 3
    .= (a |^2)*(c |^2)+g2*(a*b*c*d)+(b |^2)*(d |^2) by GROUP_1:def 3
    .= (a |^2)*(c |^2)+g2*a*b*c*d+(b |^2)*(d |^2) by Th11;
  end;
