Definition Rbar_minus (x y : Rbar) := Rbar_plus x (Rbar_opp y).
Arguments Rbar_minus !x !y /.
Definition is_Rbar_minus (x y z : Rbar) : Prop :=
is_Rbar_plus x (Rbar_opp y) z.
Definition ex_Rbar_minus (x y : Rbar) : Prop :=
ex_Rbar_plus x (Rbar_opp y).
Arguments ex_Rbar_minus !x !y /.
(** *** Multiplicative operators *)
Definition Rbar_inv (x : Rbar) : Rbar :=
match x with
| Finite x => Finite (/x)
| _ => Finite 0
end.
Definition Rbar_mult' (x y : Rbar) :=
match x with
| Finite x => match y with
| Finite y => Some (Finite (x * y))
| p_infty => match (Rle_dec 0 x) with
| left H => match Rle_lt_or_eq_dec _ _ H with left _ => Some p_infty | right _ => None end
| right _ => Some m_infty
end
| m_infty => match (Rle_dec 0 x) with
| left H => match Rle_lt_or_eq_dec _ _ H with left _ => Some m_infty | right _ => None end
| right _ => Some p_infty
end
end
| p_infty => match y with
| Finite y => match (Rle_dec 0 y) with
| left H => match Rle_lt_or_eq_dec _ _ H with left _ => Some p_infty | right _ => None end
| right _ => Some m_infty
end
| p_infty => Some p_infty
| m_infty => Some m_infty
end
| m_infty => match y with
| Finite y => match (Rle_dec 0 y) with
| left H => match Rle_lt_or_eq_dec _ _ H with left _ => Some m_infty | right _ => None end
| right _ => Some p_infty
end
| p_infty => Some m_infty
| m_infty => Some p_infty
end
end.
Definition Rbar_mult (x y : Rbar) :=
match Rbar_mult' x y with Some z => z | None => Finite 0 end.
Arguments Rbar_mult !x !y /.
Definition is_Rbar_mult (x y z : Rbar) : Prop :=
Rbar_mult' x y = Some z.
Definition ex_Rbar_mult (x y : Rbar) : Prop :=
match x with
| Finite x => match y with
| Finite y => True
| p_infty => x <> 0
| m_infty => x <> 0
end
| p_infty => match y with
| Finite y => y <> 0
| p_infty => True
| m_infty => True
end
| m_infty => match y with
| Finite y => y <> 0
| p_infty => True
| m_infty => True
end
end.
Arguments ex_Rbar_mult !x !y /.
Definition Rbar_mult_pos (x : Rbar) (y : posreal) :=
match x with
| Finite x => Finite (x*y)
| _ => x
end.

Lemma is_Rbar_mult_unique (x y z : Rbar) :
is_Rbar_mult x y z -> Rbar_mult x y = z.