Metamath Proof Explorer


Theorem lgsdilem

Description: Lemma for lgsdi and lgsdir : the sign part of the Legendre symbol is multiplicative. (Contributed by Mario Carneiro, 4-Feb-2015)

Ref Expression
Assertion lgsdilem
|- ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) -> if ( ( N < 0 /\ ( A x. B ) < 0 ) , -u 1 , 1 ) = ( if ( ( N < 0 /\ A < 0 ) , -u 1 , 1 ) x. if ( ( N < 0 /\ B < 0 ) , -u 1 , 1 ) ) )

Proof

Step Hyp Ref Expression
1 simplrr
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> B =/= 0 )
2 1 biantrud
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> ( 0 <_ B <-> ( 0 <_ B /\ B =/= 0 ) ) )
3 0re
 |-  0 e. RR
4 simpl2
 |-  ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) -> B e. ZZ )
5 4 zred
 |-  ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) -> B e. RR )
6 5 adantr
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> B e. RR )
7 ltlen
 |-  ( ( 0 e. RR /\ B e. RR ) -> ( 0 < B <-> ( 0 <_ B /\ B =/= 0 ) ) )
8 3 6 7 sylancr
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> ( 0 < B <-> ( 0 <_ B /\ B =/= 0 ) ) )
9 simpl1
 |-  ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) -> A e. ZZ )
10 9 zred
 |-  ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) -> A e. RR )
11 10 adantr
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> A e. RR )
12 11 renegcld
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> -u A e. RR )
13 12 recnd
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> -u A e. CC )
14 13 mul01d
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> ( -u A x. 0 ) = 0 )
15 11 recnd
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> A e. CC )
16 6 recnd
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> B e. CC )
17 15 16 mulneg1d
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> ( -u A x. B ) = -u ( A x. B ) )
18 14 17 breq12d
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> ( ( -u A x. 0 ) < ( -u A x. B ) <-> 0 < -u ( A x. B ) ) )
19 0red
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> 0 e. RR )
20 10 lt0neg1d
 |-  ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) -> ( A < 0 <-> 0 < -u A ) )
21 20 biimpa
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> 0 < -u A )
22 ltmul2
 |-  ( ( 0 e. RR /\ B e. RR /\ ( -u A e. RR /\ 0 < -u A ) ) -> ( 0 < B <-> ( -u A x. 0 ) < ( -u A x. B ) ) )
23 19 6 12 21 22 syl112anc
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> ( 0 < B <-> ( -u A x. 0 ) < ( -u A x. B ) ) )
24 10 5 remulcld
 |-  ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) -> ( A x. B ) e. RR )
25 24 adantr
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> ( A x. B ) e. RR )
26 25 lt0neg1d
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> ( ( A x. B ) < 0 <-> 0 < -u ( A x. B ) ) )
27 18 23 26 3bitr4d
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> ( 0 < B <-> ( A x. B ) < 0 ) )
28 2 8 27 3bitr2rd
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> ( ( A x. B ) < 0 <-> 0 <_ B ) )
29 lenlt
 |-  ( ( 0 e. RR /\ B e. RR ) -> ( 0 <_ B <-> -. B < 0 ) )
30 3 6 29 sylancr
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> ( 0 <_ B <-> -. B < 0 ) )
31 28 30 bitrd
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> ( ( A x. B ) < 0 <-> -. B < 0 ) )
32 31 ifbid
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> if ( ( A x. B ) < 0 , -u 1 , 1 ) = if ( -. B < 0 , -u 1 , 1 ) )
33 oveq2
 |-  ( if ( B < 0 , -u 1 , 1 ) = -u 1 -> ( -u 1 x. if ( B < 0 , -u 1 , 1 ) ) = ( -u 1 x. -u 1 ) )
34 neg1mulneg1e1
 |-  ( -u 1 x. -u 1 ) = 1
35 33 34 eqtrdi
 |-  ( if ( B < 0 , -u 1 , 1 ) = -u 1 -> ( -u 1 x. if ( B < 0 , -u 1 , 1 ) ) = 1 )
36 oveq2
 |-  ( if ( B < 0 , -u 1 , 1 ) = 1 -> ( -u 1 x. if ( B < 0 , -u 1 , 1 ) ) = ( -u 1 x. 1 ) )
37 ax-1cn
 |-  1 e. CC
38 37 mulm1i
 |-  ( -u 1 x. 1 ) = -u 1
39 36 38 eqtrdi
 |-  ( if ( B < 0 , -u 1 , 1 ) = 1 -> ( -u 1 x. if ( B < 0 , -u 1 , 1 ) ) = -u 1 )
40 35 39 ifsb
 |-  ( -u 1 x. if ( B < 0 , -u 1 , 1 ) ) = if ( B < 0 , 1 , -u 1 )
41 ifnot
 |-  if ( -. B < 0 , -u 1 , 1 ) = if ( B < 0 , 1 , -u 1 )
42 40 41 eqtr4i
 |-  ( -u 1 x. if ( B < 0 , -u 1 , 1 ) ) = if ( -. B < 0 , -u 1 , 1 )
43 32 42 eqtr4di
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> if ( ( A x. B ) < 0 , -u 1 , 1 ) = ( -u 1 x. if ( B < 0 , -u 1 , 1 ) ) )
44 iftrue
 |-  ( A < 0 -> if ( A < 0 , -u 1 , 1 ) = -u 1 )
45 44 adantl
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> if ( A < 0 , -u 1 , 1 ) = -u 1 )
46 45 oveq1d
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> ( if ( A < 0 , -u 1 , 1 ) x. if ( B < 0 , -u 1 , 1 ) ) = ( -u 1 x. if ( B < 0 , -u 1 , 1 ) ) )
47 43 46 eqtr4d
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ A < 0 ) -> if ( ( A x. B ) < 0 , -u 1 , 1 ) = ( if ( A < 0 , -u 1 , 1 ) x. if ( B < 0 , -u 1 , 1 ) ) )
48 iffalse
 |-  ( -. A < 0 -> if ( A < 0 , -u 1 , 1 ) = 1 )
49 48 adantl
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. A < 0 ) -> if ( A < 0 , -u 1 , 1 ) = 1 )
50 49 oveq1d
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. A < 0 ) -> ( if ( A < 0 , -u 1 , 1 ) x. if ( B < 0 , -u 1 , 1 ) ) = ( 1 x. if ( B < 0 , -u 1 , 1 ) ) )
51 neg1cn
 |-  -u 1 e. CC
52 51 37 ifcli
 |-  if ( B < 0 , -u 1 , 1 ) e. CC
53 52 mulid2i
 |-  ( 1 x. if ( B < 0 , -u 1 , 1 ) ) = if ( B < 0 , -u 1 , 1 )
54 5 adantr
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. A < 0 ) -> B e. RR )
55 0red
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. A < 0 ) -> 0 e. RR )
56 10 adantr
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. A < 0 ) -> A e. RR )
57 lenlt
 |-  ( ( 0 e. RR /\ A e. RR ) -> ( 0 <_ A <-> -. A < 0 ) )
58 3 10 57 sylancr
 |-  ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) -> ( 0 <_ A <-> -. A < 0 ) )
59 58 biimpar
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. A < 0 ) -> 0 <_ A )
60 simplrl
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. A < 0 ) -> A =/= 0 )
61 56 59 60 ne0gt0d
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. A < 0 ) -> 0 < A )
62 ltmul2
 |-  ( ( B e. RR /\ 0 e. RR /\ ( A e. RR /\ 0 < A ) ) -> ( B < 0 <-> ( A x. B ) < ( A x. 0 ) ) )
63 54 55 56 61 62 syl112anc
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. A < 0 ) -> ( B < 0 <-> ( A x. B ) < ( A x. 0 ) ) )
64 56 recnd
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. A < 0 ) -> A e. CC )
65 64 mul01d
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. A < 0 ) -> ( A x. 0 ) = 0 )
66 65 breq2d
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. A < 0 ) -> ( ( A x. B ) < ( A x. 0 ) <-> ( A x. B ) < 0 ) )
67 63 66 bitrd
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. A < 0 ) -> ( B < 0 <-> ( A x. B ) < 0 ) )
68 67 ifbid
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. A < 0 ) -> if ( B < 0 , -u 1 , 1 ) = if ( ( A x. B ) < 0 , -u 1 , 1 ) )
69 53 68 syl5eq
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. A < 0 ) -> ( 1 x. if ( B < 0 , -u 1 , 1 ) ) = if ( ( A x. B ) < 0 , -u 1 , 1 ) )
70 50 69 eqtr2d
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. A < 0 ) -> if ( ( A x. B ) < 0 , -u 1 , 1 ) = ( if ( A < 0 , -u 1 , 1 ) x. if ( B < 0 , -u 1 , 1 ) ) )
71 47 70 pm2.61dan
 |-  ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) -> if ( ( A x. B ) < 0 , -u 1 , 1 ) = ( if ( A < 0 , -u 1 , 1 ) x. if ( B < 0 , -u 1 , 1 ) ) )
72 71 adantr
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ N < 0 ) -> if ( ( A x. B ) < 0 , -u 1 , 1 ) = ( if ( A < 0 , -u 1 , 1 ) x. if ( B < 0 , -u 1 , 1 ) ) )
73 simpr
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ N < 0 ) -> N < 0 )
74 73 biantrurd
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ N < 0 ) -> ( ( A x. B ) < 0 <-> ( N < 0 /\ ( A x. B ) < 0 ) ) )
75 74 ifbid
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ N < 0 ) -> if ( ( A x. B ) < 0 , -u 1 , 1 ) = if ( ( N < 0 /\ ( A x. B ) < 0 ) , -u 1 , 1 ) )
76 73 biantrurd
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ N < 0 ) -> ( A < 0 <-> ( N < 0 /\ A < 0 ) ) )
77 76 ifbid
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ N < 0 ) -> if ( A < 0 , -u 1 , 1 ) = if ( ( N < 0 /\ A < 0 ) , -u 1 , 1 ) )
78 73 biantrurd
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ N < 0 ) -> ( B < 0 <-> ( N < 0 /\ B < 0 ) ) )
79 78 ifbid
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ N < 0 ) -> if ( B < 0 , -u 1 , 1 ) = if ( ( N < 0 /\ B < 0 ) , -u 1 , 1 ) )
80 77 79 oveq12d
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ N < 0 ) -> ( if ( A < 0 , -u 1 , 1 ) x. if ( B < 0 , -u 1 , 1 ) ) = ( if ( ( N < 0 /\ A < 0 ) , -u 1 , 1 ) x. if ( ( N < 0 /\ B < 0 ) , -u 1 , 1 ) ) )
81 72 75 80 3eqtr3d
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ N < 0 ) -> if ( ( N < 0 /\ ( A x. B ) < 0 ) , -u 1 , 1 ) = ( if ( ( N < 0 /\ A < 0 ) , -u 1 , 1 ) x. if ( ( N < 0 /\ B < 0 ) , -u 1 , 1 ) ) )
82 simpr
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. N < 0 ) -> -. N < 0 )
83 82 intnanrd
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. N < 0 ) -> -. ( N < 0 /\ ( A x. B ) < 0 ) )
84 83 iffalsed
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. N < 0 ) -> if ( ( N < 0 /\ ( A x. B ) < 0 ) , -u 1 , 1 ) = 1 )
85 1t1e1
 |-  ( 1 x. 1 ) = 1
86 84 85 eqtr4di
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. N < 0 ) -> if ( ( N < 0 /\ ( A x. B ) < 0 ) , -u 1 , 1 ) = ( 1 x. 1 ) )
87 82 intnanrd
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. N < 0 ) -> -. ( N < 0 /\ A < 0 ) )
88 87 iffalsed
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. N < 0 ) -> if ( ( N < 0 /\ A < 0 ) , -u 1 , 1 ) = 1 )
89 82 intnanrd
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. N < 0 ) -> -. ( N < 0 /\ B < 0 ) )
90 89 iffalsed
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. N < 0 ) -> if ( ( N < 0 /\ B < 0 ) , -u 1 , 1 ) = 1 )
91 88 90 oveq12d
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. N < 0 ) -> ( if ( ( N < 0 /\ A < 0 ) , -u 1 , 1 ) x. if ( ( N < 0 /\ B < 0 ) , -u 1 , 1 ) ) = ( 1 x. 1 ) )
92 86 91 eqtr4d
 |-  ( ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) /\ -. N < 0 ) -> if ( ( N < 0 /\ ( A x. B ) < 0 ) , -u 1 , 1 ) = ( if ( ( N < 0 /\ A < 0 ) , -u 1 , 1 ) x. if ( ( N < 0 /\ B < 0 ) , -u 1 , 1 ) ) )
93 81 92 pm2.61dan
 |-  ( ( ( A e. ZZ /\ B e. ZZ /\ N e. ZZ ) /\ ( A =/= 0 /\ B =/= 0 ) ) -> if ( ( N < 0 /\ ( A x. B ) < 0 ) , -u 1 , 1 ) = ( if ( ( N < 0 /\ A < 0 ) , -u 1 , 1 ) x. if ( ( N < 0 /\ B < 0 ) , -u 1 , 1 ) ) )