let rectangle_area (width : real) (height : real) : real =
  (* Calculate area of rectangle. *)
  basic.py.multiply width height

let rectangle_perimeter (width : real) (height : real) : real =
  (* Calculate perimeter of rectangle. *)
  basic.py.multiply 2.0 (basic.py.add width height)

let square_area (side : real) : real =
  (* Calculate area of square. *)
  basic.py.multiply side side

let triangle_area (base : real) (height : real) : real =
  (* Calculate area of triangle using base and height. *)
  let half = 0.5 in
  basic.py.multiply half (basic.py.multiply base height)

let is_valid_triangle (a : real) (b : real) (c : real) : bool =
  (* Check if three sides can form a valid triangle. *)
  let all_positive = basic.py.is_positive a && basic.py.is_positive b && basic.py.is_positive c in
  let triangle_inequality = 
    basic.py.add a b >. c &&
    basic.py.add b c >. a &&
    basic.py.add a c >. b
  in
  all_positive && triangle_inequality

let max_side_length (a : real) (b : real) (c : real) : real =
  (* Find the maximum side length among three sides. *)
  `utils/helpers.py`.max_of_three a b c
