include "Bool.ma". include "Universes.ma". include "Plogic/equality.ma". ninductive Maybe (A: Type[0]): Type[0] ≝ Nothing: Maybe A | Just: A → Maybe A. ndefinition is_just ≝ λA: Type[0]. λm: Maybe A. match m with [ Nothing ⇒ false | Just j ⇒ true ]. ndefinition is_nothing ≝ λA: Type[0]. λm: Maybe A. match m with [ Nothing ⇒ true | Just j ⇒ false ]. ndefinition to_maybe ≝ λA: Type[0]. λb: Bool. λa: A. match b with [ true ⇒ Just A a | false ⇒ Nothing A ]. nlemma to_maybe_is_just: ∀A: Type[0]. ∀a: A. ∀b: Bool. is_just A (to_maybe A b a) = b. #A a b. ncases b. nnormalize. @. nnormalize. @. nqed.