Notation u := (∑ l (fun i => power (power (S i) 2) r)).
Notation u1 := (∑ l (fun i => power (power (S (S i)) 2) r)).
Section mult_utils.
Variable (b c : nat-> nat) (cb cc : nat)
(Hb : is_cipher_of b cb)
(Hc : is_cipher_of c cc).
Let eq1 :    cb*cc = ∑ l (fun i => (b i*c i)*power (power (S (S i)) 2) r)
+ ∑ l (fun i => ∑ i (fun j => (b i*c j + b j*c i)*power (power (S i) 2 + power (S j) 2) r)).
Let Hbc_1 i : i < l -> b i * c i < r.
Let Hbc_2 i j : i < l -> j < l -> b i * c j + b j * c i < r.
Let Hbc_3 : ∑ l (fun i => (b i*c i)*power (power (S (S i)) 2) r)
= msum nat_join 0 l (fun i => (b i*c i)*power (power (S (S i)) 2) r).
Let Hbc_4 : ∑ l (fun i => ∑ i (fun j => (b i*c j + b j*c i)*power (power (S i) 2 + power (S j) 2) r))
= msum nat_join 0 l (fun i =>
msum nat_join 0 i (fun j => (b i*c j + b j*c i)*power (power (S i) 2 + power (S j) 2) r)).
Let eq2 :   cb*cc = msum nat_join 0 l (fun i => (b i*c i)*power (power (S (S i)) 2) r)
⇡ msum nat_join 0 l (fun i =>
msum nat_join 0 i (fun j => (b i*c j + b j*c i)*power (power (S i) 2 + power (S j) 2) r)).
Let Hr_1 : (r-1)*u1 = ∑ l (fun i => (r-1)*power (power (S (S i)) 2) r).
Fact cipher_mult_eq : (cb*cc)⇣((r-1)*u1) = ∑ l (fun i => (b i*c i)*power (power (S (S i)) 2) r).
End mult_utils.
Section mult.
Variable (a b c : nat-> nat) (ca cb cc : nat)
(Ha : is_cipher_of a ca)
(Hb : is_cipher_of b cb)
(Hc : is_cipher_of c cc).
Definition Code_mult :=
l = 0
\/ l <> 0
/\ exists v v1 r' r'' p,
r'' = r
/\ r'' = r'+1
/\ seqs_of_ones v v1
/\ p = (ca*v)⇣(r'*v1)
/\ p = (cb*cc)⇣(r'*v1).

Lemma Code_mult_spec : Code_mult <-> forall i, i < l -> a i = b i * c i.
End mult.