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 include "ground/arith/pnat.ma".
17 (* TRICHOTOMY OPERATOR FOR POSITIVE INTEGERS ********************************)
19 rec definition ptri (A:Type[0]) p1 p2 a1 a2 a3 on p1 : A ≝
21 [ punit ⇒ match p2 with [ punit ⇒ a2 | psucc p2 ⇒ a1 ]
22 | psucc p1 ⇒ match p2 with [ punit ⇒ a3 | psucc p2 ⇒ ptri A p1 p2 a1 a2 a3 ]
25 (* Basic constructions ******************************************************)
27 lemma ptri_unit_bi (A) (a1) (a2) (a3):
28 a2 = ptri A (𝟏) (𝟏) a1 a2 a3.
31 lemma ptri_unit_succ (A) (a1) (a2) (a3) (p):
32 a1 = ptri A (𝟏) (↑p) a1 a2 a3.
35 lemma ptri_succ_unit (A) (a1) (a2) (a3) (p):
36 a3 = ptri A (↑p) (𝟏) a1 a2 a3.
39 lemma ptri_succ_bi (A) (a1) (a2) (a3) (p1) (p2):
40 ptri A (p1) (p2) a1 a2 a3 = ptri A (↑p1) (↑p2) a1 a2 a3.
43 (* Advanced constructions ***************************************************)
45 lemma ptri_eq (A) (a1) (a2) (a3) (p): a2 = ptri A p p a1 a2 a3.
46 #A #a1 #a2 #a3 #p elim p -p //
49 lemma ptri_f_tri (A) (B) (f) (a1) (a2) (a3) (p1) (p2):
50 f (ptri A p1 p2 a1 a2 a3) = ptri B p1 p2 (f a1) (f a2) (f a3).
51 #A #B #f #a1 #a2 #a3 #p1
52 elim p1 -p1 [| #p1 #IH ] * //