1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 (* ********************************************************************** *)
16 (* Progetto FreeScale *)
18 (* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *)
19 (* Sviluppo: 2008-2010 *)
21 (* ********************************************************************** *)
23 include "num/bool.ma".
29 ninductive option (A:Type) : Type ≝
31 | Some : A → option A.
33 ndefinition eq_option ≝
34 λT.λf:T → T → bool.λop1,op2:option T.
36 [ None ⇒ match op2 with [ None ⇒ true | Some _ ⇒ false ]
37 | Some x1 ⇒ match op2 with [ None ⇒ false | Some x2 ⇒ f x1 x2 ]
40 (* option map = match ... with [ None ⇒ None ? | Some .. ⇒ .. ] *)
42 λT1,T2:Type.λt:option T1.λf:T1 → option T2.
43 match t with [ None ⇒ None ? | Some x ⇒ (f x) ].