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: Cosimo Oliboni, oliboni@cs.unibo.it *)
19 (* Cosimo Oliboni, oliboni@cs.unibo.it *)
21 (* ********************************************************************** *)
23 include "freescale/bool_lemmas.ma".
24 include "freescale/option.ma".
30 nlemma option_destruct_some_some : ∀T.∀x1,x2:T.Some T x1 = Some T x2 → x1 = x2.
32 nchange with (match Some T x2 with [ None ⇒ False | Some a ⇒ x1 = a ]);
38 nlemma option_destruct_some_none : ∀T.∀x:T.Some T x = None T → False.
40 nchange with (match Some T x with [ None ⇒ True | Some a ⇒ False ]);
46 nlemma option_destruct_none_some : ∀T.∀x:T.None T = Some T x → False.
48 nchange with (match Some T x with [ None ⇒ True | Some a ⇒ False ]);
54 nlemma symmetric_eqoption :
55 ∀T:Type.∀op1,op2:option T.∀f:T → T → bool.
56 (symmetricT T bool f) →
57 (eq_option T op1 op2 f = eq_option T op2 op1 f).
58 #T; #op1; #op2; #f; #H;
59 napply (option_ind T ??? op1);
60 napply (option_ind T ??? op2);
62 ##[ ##1: napply (refl_eq ??)
63 ##| ##2,3: #H; napply (refl_eq ??)
70 nlemma eq_to_eqoption :
71 ∀T.∀op1,op2:option T.∀f:T → T → bool.
72 (∀x1,x2:T.x1 = x2 → f x1 x2 = true) →
73 (op1 = op2 → eq_option T op1 op2 f = true).
74 #T; #op1; #op2; #f; #H;
75 napply (option_ind T ??? op1);
76 napply (option_ind T ??? op2);
78 ##[ ##1: #H1; napply (refl_eq ??)
79 ##| ##2: #a; #H1; nelim (option_destruct_none_some ?? H1)
80 ##| ##3: #a; #H1; nelim (option_destruct_some_none ?? H1)
81 ##| ##4: #a; #a0; #H1;
82 nrewrite > (option_destruct_some_some ??? H1);
83 nrewrite > (H a a (refl_eq ??));
88 nlemma eqoption_to_eq :
89 ∀T.∀op1,op2:option T.∀f:T → T → bool.
90 (∀x1,x2:T.f x1 x2 = true → x1 = x2) →
91 (eq_option T op1 op2 f = true → op1 = op2).
92 #T; #op1; #op2; #f; #H;
93 napply (option_ind T ??? op1);
94 napply (option_ind T ??? op2);
96 ##[ ##1: #H1; napply (refl_eq ??)
97 ##| ##2,3: #a; #H1; napply (bool_destruct ??? H1)
98 ##| ##4: #a; #a0; #H1;