]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/tests/coercions.ma
ocaml 3.09 transition
[helm.git] / helm / matita / tests / coercions.ma
index 1e92364fe61387e0918c1657f39be361050368e8..ae69759bf4c083fe6ccaf5c4acb2325631d5e69d 100644 (file)
@@ -1,50 +1,47 @@
-
-Inductive nat : Set \def
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+set "baseuri" "cic:/matita/tests/coercions/".
+include "coq.ma".
+
+inductive pos: Set \def
+| one : pos
+| next : pos \to pos.
+
+inductive nat:Set \def
 | O : nat
 | S : nat \to nat.
 
-Inductive list (A:Set) : Set \def
-| nil : list A
-| cons : A \to list A \to list A.
-
-Inductive bool: Set \def
-| true : bool
-| false : bool.
-
-
-
-
-let rec len (A:Set)(l:list A) on l : nat \def
- match l:list with [
-   nil \Rightarrow O
- | (cons e tl) \Rightarrow (S (len A tl))].
+inductive int: Set \def
+| positive: nat \to int
+| negative : nat \to int.
 
-let rec plus (n,m:nat) : nat \def
- match n:nat with [
-   O \Rightarrow m
- | (S x) \Rightarrow (S (plus x m)) ].  
+inductive empty : Set \def .
 
-let rec is_zero (n:nat) : bool \def
-  match n:nat with [
-    O \Rightarrow true
-  | (S x) \Rightarrow false].  
+let rec pos2nat x \def 
+  match x with  
+  [ one \Rightarrow (S O)
+  | (next z) \Rightarrow S (pos2nat z)].
 
-let rec nat_eq_dec (n,m:nat) : bool \def
-  match n:nat with [
-    O \Rightarrow 
-         match m:nat with [
-           O \Rightarrow true
-        | (S x) \Rightarrow false]
-  | (S x) \Rightarrow
-             match m:nat with [
-               O \Rightarrow false
-            | (S y) \Rightarrow (nat_eq_dec x y)]
-  ].
+definition nat2int \def \lambda x. positive x.
 
+coercion pos2nat.
 
-Coercion is_zero.
-Coercion len.
+coercion nat2int.
 
-Print Coer.
-Print Env.
+definition fst \def \lambda x,y:int.x.
 
+theorem a: fst O one = fst (positive O) (next one).
+reflexivity.
+qed.