(* ========================================================================= *)
(* Cross products in real^3. *)
(* ========================================================================= *)
needs "Multivariate/topology.ml";;
prioritize_vector();;
(* ------------------------------------------------------------------------- *)
(* The definition. *)
(* ------------------------------------------------------------------------- *)
parse_as_infix("cross",(20,"right"));;
let cross = new_definition
`(a:real^3) cross (b:real^3) =
vector [a$2 * b$3 - a$3 * b$2;
a$3 * b$1 - a$1 * b$3;
a$1 * b$2 - a$2 * b$1] :real^3`;;
(* ------------------------------------------------------------------------- *)
(* Some simple automation. *)
(* ------------------------------------------------------------------------- *)
let VEC3_TAC =
SIMP_TAC[CART_EQ; LAMBDA_BETA; FORALL_3; SUM_3; DIMINDEX_3; VECTOR_3;
vector_add; vec; dot; cross; orthogonal; basis; DET_3;
vector_neg; vector_sub; vector_mul; ARITH] THEN
CONV_TAC REAL_RING;;
let VEC3_RULE tm = prove(tm,VEC3_TAC);;
(* ------------------------------------------------------------------------- *)
(* Basic lemmas. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Preservation by rotation, or other orthogonal transformation up to sign. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Continuity. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Prove a weaker variant for more convenient interface with functions *)
(* intended to work in 1 dimension. *)
(* ------------------------------------------------------------------------- *)
add_linear_invariants [CROSS_LINEAR_IMAGE_WEAK];;