(*********************************************************)
(** * Definition of arcsine based on arctangent          *)
(*********************************************************)

(** asin is defined by cases so that it is defined in the full range from -1 .. 1 *)

Definition asin x :=
  if Rle_dec x (-1) then - (PI / 2) else
  if Rle_dec 1 x then PI / 2 else
  atan (x / sqrt (1 - x²)).

(* Specifications: *)
Lemma asin_atan : forall x, -1 < x < 1 -> asin x = atan (x / sqrt (1 - x²)).
Lemma asin_0 : asin 0 = 0.
Lemma asin_1 : asin 1 = PI / 2.
Lemma asin_inv_sqrt2 : asin (/sqrt 2) = PI/4.
Lemma asin_opp : forall x, asin (- x) = - asin x.
Lemma asin_bound : forall x, - (PI/2) <= asin x <= PI/2.
Lemma asin_bound_lt : forall x, -1 < x < 1 -> - (PI/2) < asin x < PI/2.
Lemma sin_asin : forall x, -1 <= x <= 1 -> sin (asin x) = x.
Lemma asin_sin : forall x, -(PI/2) <= x <= PI/2 -> asin (sin x) = x.
Lemma cos_asin : forall x, -1 <= x <= 1 -> cos (asin x) = sqrt (1 - x²).
Lemma tan_asin : forall x, -1 <= x <= 1 -> tan (asin x) = x / sqrt (1 - x²).
Lemma derivable_pt_asin : forall x, -1 < x < 1 -> derivable_pt asin x.
Lemma derive_pt_asin : forall (x : R) (Hxrange : -1 < x < 1), derive_pt asin x (derivable_pt_asin x Hxrange) = 1 / sqrt (1 - x²).