Metamath Proof Explorer


Theorem numma

Description: Perform a multiply-add of two decimal integers M and N against a fixed multiplicand P (no carry). (Contributed by Mario Carneiro, 18-Feb-2014)

Ref Expression
Hypotheses numma.1
|- T e. NN0
numma.2
|- A e. NN0
numma.3
|- B e. NN0
numma.4
|- C e. NN0
numma.5
|- D e. NN0
numma.6
|- M = ( ( T x. A ) + B )
numma.7
|- N = ( ( T x. C ) + D )
numma.8
|- P e. NN0
numma.9
|- ( ( A x. P ) + C ) = E
numma.10
|- ( ( B x. P ) + D ) = F
Assertion numma
|- ( ( M x. P ) + N ) = ( ( T x. E ) + F )

Proof

Step Hyp Ref Expression
1 numma.1
 |-  T e. NN0
2 numma.2
 |-  A e. NN0
3 numma.3
 |-  B e. NN0
4 numma.4
 |-  C e. NN0
5 numma.5
 |-  D e. NN0
6 numma.6
 |-  M = ( ( T x. A ) + B )
7 numma.7
 |-  N = ( ( T x. C ) + D )
8 numma.8
 |-  P e. NN0
9 numma.9
 |-  ( ( A x. P ) + C ) = E
10 numma.10
 |-  ( ( B x. P ) + D ) = F
11 6 oveq1i
 |-  ( M x. P ) = ( ( ( T x. A ) + B ) x. P )
12 11 7 oveq12i
 |-  ( ( M x. P ) + N ) = ( ( ( ( T x. A ) + B ) x. P ) + ( ( T x. C ) + D ) )
13 1 nn0cni
 |-  T e. CC
14 2 nn0cni
 |-  A e. CC
15 8 nn0cni
 |-  P e. CC
16 14 15 mulcli
 |-  ( A x. P ) e. CC
17 4 nn0cni
 |-  C e. CC
18 13 16 17 adddii
 |-  ( T x. ( ( A x. P ) + C ) ) = ( ( T x. ( A x. P ) ) + ( T x. C ) )
19 13 14 15 mulassi
 |-  ( ( T x. A ) x. P ) = ( T x. ( A x. P ) )
20 19 oveq1i
 |-  ( ( ( T x. A ) x. P ) + ( T x. C ) ) = ( ( T x. ( A x. P ) ) + ( T x. C ) )
21 18 20 eqtr4i
 |-  ( T x. ( ( A x. P ) + C ) ) = ( ( ( T x. A ) x. P ) + ( T x. C ) )
22 21 oveq1i
 |-  ( ( T x. ( ( A x. P ) + C ) ) + ( ( B x. P ) + D ) ) = ( ( ( ( T x. A ) x. P ) + ( T x. C ) ) + ( ( B x. P ) + D ) )
23 13 14 mulcli
 |-  ( T x. A ) e. CC
24 3 nn0cni
 |-  B e. CC
25 23 24 15 adddiri
 |-  ( ( ( T x. A ) + B ) x. P ) = ( ( ( T x. A ) x. P ) + ( B x. P ) )
26 25 oveq1i
 |-  ( ( ( ( T x. A ) + B ) x. P ) + ( ( T x. C ) + D ) ) = ( ( ( ( T x. A ) x. P ) + ( B x. P ) ) + ( ( T x. C ) + D ) )
27 23 15 mulcli
 |-  ( ( T x. A ) x. P ) e. CC
28 13 17 mulcli
 |-  ( T x. C ) e. CC
29 24 15 mulcli
 |-  ( B x. P ) e. CC
30 5 nn0cni
 |-  D e. CC
31 27 28 29 30 add4i
 |-  ( ( ( ( T x. A ) x. P ) + ( T x. C ) ) + ( ( B x. P ) + D ) ) = ( ( ( ( T x. A ) x. P ) + ( B x. P ) ) + ( ( T x. C ) + D ) )
32 26 31 eqtr4i
 |-  ( ( ( ( T x. A ) + B ) x. P ) + ( ( T x. C ) + D ) ) = ( ( ( ( T x. A ) x. P ) + ( T x. C ) ) + ( ( B x. P ) + D ) )
33 22 32 eqtr4i
 |-  ( ( T x. ( ( A x. P ) + C ) ) + ( ( B x. P ) + D ) ) = ( ( ( ( T x. A ) + B ) x. P ) + ( ( T x. C ) + D ) )
34 9 oveq2i
 |-  ( T x. ( ( A x. P ) + C ) ) = ( T x. E )
35 34 10 oveq12i
 |-  ( ( T x. ( ( A x. P ) + C ) ) + ( ( B x. P ) + D ) ) = ( ( T x. E ) + F )
36 12 33 35 3eqtr2i
 |-  ( ( M x. P ) + N ) = ( ( T x. E ) + F )