(`!a b c A B C. ~(A = Cx(&0)) /\ ~(B = Cx(&0)) /\ ~(C = Cx(&0))
/\ (!x. A *
REPEAT GEN_TAC THEN STRIP_TAC
THEN SUBGOAL_THEN
`!x. a * A *
cexp (a*Cx x) + b * B *
cexp (b*Cx x) = c * C *
cexp (c*Cx x)`
ASSUME_TAC
THENL ON_FIRST_GOAL
(REWRITE_TAC[
FORALL_DROP] THEN GEN_TAC
THEN MATCH_MP_TAC
VECTOR_DERIVATIVE_UNIQUE_AT
THEN MAP_EVERY EXISTS_TAC [`\x. C *
cexp (c * Cx(
drop x))`;`x:real^1`]
THEN REWRITE_TAC
[MESON[
COMPLEX_MUL_AC] `!A a. a * A *
cexp x = A * a *
cexp x`]
THEN CONJ_TAC THEN TRY (MATCH_ACCEPT_TAC
HAS_VECTOR_DERIVATIVE_CEXP)
THEN POP_ASSUM (fun x -> REWRITE_TAC[GSYM x])
THEN MATCH_ACCEPT_TAC
HAS_VECTOR_DERIVATIVE_SUM_CEXP)
THEN SUBGOAL_THEN `!x. a pow 2 * A *
cexp (a*Cx x) + b
pow 2 * B *
cexp (b*Cx x) = c pow 2 * C *
cexp (c*Cx x)` ASSUME_TAC
THENL ON_FIRST_GOAL
(REWRITE_TAC[
FORALL_DROP] THEN GEN_TAC
THEN MATCH_MP_TAC
VECTOR_DERIVATIVE_UNIQUE_AT
THEN MAP_EVERY EXISTS_TAC [`\x.(C * c) *
cexp (c * Cx(
drop x))`;`x:real^1`]
THEN REWRITE_TAC[
COMPLEX_POW_2]
THEN REWRITE_TAC
[MESON[
COMPLEX_MUL_AC] `!A a. (a*a) * A *
cexp x = (A*a)*a*cexp x`]
THEN CONJ_TAC THEN TRY (MATCH_ACCEPT_TAC
HAS_VECTOR_DERIVATIVE_CEXP)
THEN
let assoc_on_cexp =
MESON[
COMPLEX_MUL_AC] `!C c. (C*c) *
cexp x = c*C*cexp x`
in
REWRITE_TAC[assoc_on_cexp]
THEN POP_ASSUM (fun x -> REWRITE_TAC[GSYM x; GSYM assoc_on_cexp])
THEN REWRITE_TAC
[MESON[
COMPLEX_MUL_AC] `!A a. (a*A*a) *
cexp x = (A*a)*a*cexp x`]
THEN MATCH_ACCEPT_TAC
HAS_VECTOR_DERIVATIVE_SUM_CEXP)
THEN RULE_ASSUM_TAC (try_or_id (REWRITE_RULE[
COMPLEX_MUL_RZERO;
COMPLEX_ADD_RID;
CEXP_0;
COMPLEX_MUL_RID] o SPEC `&0`))
THEN SUBGOAL_THEN
`(a*A+b*B) pow 2 = a pow 2 * A pow 2 + b pow 2 * B pow 2 + Cx(&2)*a*b*A*B`
MP_TAC
THENL ON_FIRST_GOAL
(REWRITE_TAC[
COMPLEX_POW_2] THEN SIMPLE_COMPLEX_ARITH_TAC)
THEN SUBGOAL_THEN
`(a*A+b*B) pow 2 = a pow 2 * A pow 2 + b pow 2 * B pow 2 + a pow 2 * A *
B + b pow 2 * A * B :complex`
(SINGLE REWRITE_TAC)
THENL ON_FIRST_GOAL
(GEN_REWRITE_TAC (RATOR_CONV o ONCE_DEPTH_CONV) [
COMPLEX_POW_2]
THEN ASM
(GEN_REWRITE_TAC (RATOR_CONV o RAND_CONV o RATOR_CONV o DEPTH_CONV)) []
THEN FIND_ASSUM (SINGLE REWRITE_TAC o GSYM) `A+B=C:complex`
THEN FIND_ASSUM (SINGLE REWRITE_TAC) `a * A + b * B = c * C:complex`
THEN SUBGOAL_TAC "" `(c * (A + B)) * c * C = (A+B) * c pow 2 * C:complex`
[REWRITE_TAC[
COMPLEX_POW_2] THEN SIMPLE_COMPLEX_ARITH_TAC]
THEN POP_ASSUM (SINGLE REWRITE_TAC)
THEN FIND_ASSUM (SINGLE REWRITE_TAC o GSYM)
(`a pow 2 * A + b pow 2 * B = c pow 2 * C:complex`)
THEN REWRITE_TAC[
COMPLEX_POW_2] THEN SIMPLE_COMPLEX_ARITH_TAC)
THEN REWRITE_TAC[
COMPLEX_EQ_ADD_LCANCEL]
THEN SUBGOAL_THEN `a pow 2 * A * B + b pow 2 * A * B = Cx (&2) * a * b * A *
B <=> (a-b) pow 2 * A * B = Cx(&0)` (SINGLE REWRITE_TAC)
THENL ON_FIRST_GOAL
(REWRITE_TAC[
COMPLEX_POW_2] THEN SIMPLE_COMPLEX_ARITH_TAC)
THEN REWRITE_TAC[
COMPLEX_ENTIRE]
THEN RULE_ASSUM_TAC (SINGLE PURE_REWRITE_RULE (TAUT `~p <=> (p<=>F)`))
THEN ASM_REWRITE_TAC[
COMPLEX_POW_2;
COMPLEX_ENTIRE;
COMPLEX_SUB_0]
THEN DISCH_THEN (fun x -> REWRITE_ASSUMPTIONS[x;GSYM
COMPLEX_ADD_LDISTRIB]
THEN REWRITE_TAC[x])
THEN POP_ASSUM (K ALL_TAC) THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[
COMPLEX_EQ_MUL_RCANCEL]);;