]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/tests/coercions.ma
prima implementazione di demodulate, superposition_left e superposition_right
[helm.git] / helm / matita / tests / coercions.ma
index 1e92364fe61387e0918c1657f39be361050368e8..9e47c3e1e5b6b99ab0677a9344799b14e44bb4f1 100644 (file)
@@ -1,50 +1,44 @@
+inductive pos: Set \def
+| one : pos
+| next : pos \to pos.
 
-Inductive nat : Set \def
+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 int: Set \def
+| positive: nat \to int
+| negative : nat \to int.
 
-Inductive bool: Set \def
-| true : bool
-| false : bool.
+inductive empty : Set \def .
 
+let rec pos2nat x \def 
+  match x with  
+  [ one \Rightarrow (S O)
+  | (next z) \Rightarrow S (pos2nat z)].
+
+let rec nat2int x \def
+  match x with
+  [ O \Rightarrow positive O
+  | (S z) \Rightarrow positive (S z)].
+
+coercion pos2nat.
+
+coercion nat2int.
+
+let rec plus x y \def
+  match x with
+  [ (positive n) \Rightarrow x
+  | (negative z) \Rightarrow y].
+
+theorem a: plus O one.
 
 
 
-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))].
 
-let rec plus (n,m:nat) : nat \def
- match n:nat with [
-   O \Rightarrow m
- | (S x) \Rightarrow (S (plus x m)) ].  
 
-let rec is_zero (n:nat) : bool \def
-  match n:nat with [
-    O \Rightarrow true
-  | (S x) \Rightarrow false].  
 
-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)]
-  ].
 
 
-Coercion is_zero.
-Coercion len.
 
-Print Coer.
-Print Env.