]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/tests/coercions.ma
test branch
[helm.git] / helm / matita / tests / coercions.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 set "baseuri" "cic:/matita/tests/coercions/".
16 include "legacy/coq.ma".
17
18 inductive pos: Set \def
19 | one : pos
20 | next : pos \to pos.
21
22 inductive nat:Set \def
23 | O : nat
24 | S : nat \to nat.
25
26 inductive int: Set \def
27 | positive: nat \to int
28 | negative : nat \to int.
29
30 inductive empty : Set \def .
31
32 let rec pos2nat x \def 
33   match x with  
34   [ one \Rightarrow (S O)
35   | (next z) \Rightarrow S (pos2nat z)].
36
37 definition nat2int \def \lambda x. positive x.
38
39 coercion cic:/matita/tests/coercions/pos2nat.con.
40
41 coercion cic:/matita/tests/coercions/nat2int.con.
42
43 definition fst \def \lambda x,y:int.x.
44
45 theorem a: fst O one = fst (positive O) (next one).
46 reflexivity.
47 qed.
48
49 definition double: 
50   \forall f:int \to int. pos \to int 
51 \def 
52   \lambda f:int \to int. \lambda x : pos .f (nat2int x).
53   
54 definition double1: 
55   \forall f:int \to int. pos \to int 
56 \def 
57   \lambda f:int \to int. \lambda x : pos .f (pos2nat x).
58
59 definition double2: 
60   \forall f:int \to int. pos \to int 
61 \def 
62   \lambda f:int \to int. \lambda x : pos .f (nat2int (pos2nat x)).
63   
64