]> matita.cs.unibo.it Git - helm.git/commitdiff
A test for propagation of coercions (that open new goals) under lambdas,
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Tue, 4 Sep 2007 09:42:39 +0000 (09:42 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Tue, 4 Sep 2007 09:42:39 +0000 (09:42 +0000)
cases, etc.

matita/tests/coercions_propagation.ma [new file with mode: 0644]

diff --git a/matita/tests/coercions_propagation.ma b/matita/tests/coercions_propagation.ma
new file mode 100644 (file)
index 0000000..c852963
--- /dev/null
@@ -0,0 +1,65 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||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/test/coercions_propagation/".
+
+include "logic/connectives.ma".
+include "nat/orders.ma".
+alias num (instance 0) = "natural number".
+
+inductive sigma (A:Type) (P:A → Prop) : Type ≝
+ sigma_intro: ∀a:A. P a → sigma A P.
+
+interpretation "sigma" 'exists \eta.x =
+  (cic:/matita/test/coercions_propagation/sigma.ind#xpointer(1/1) _ x).
+  
+definition inject ≝ λP.λa:nat.λp:P a. sigma_intro ? P ? p.
+
+coercion cic:/matita/test/coercions_propagation/inject.con 0 1.
+
+definition eject ≝ λP.λc: ∃n:nat.P n. match c with [ sigma_intro w _ ⇒ w].
+
+coercion cic:/matita/test/coercions_propagation/eject.con.
+
+alias num (instance 0) = "natural number".
+
+theorem test: ∃n. 0 ≤ n.
+ apply (S O : ∃n. 0 ≤ n).
+ autobatch.
+qed.
+
+theorem test2: nat → ∃n. 0 ≤ n.
+ apply ((λn:nat. 0) : nat → ∃n. 0 ≤ n);
+ autobatch.
+qed.
+
+theorem test3: (∃n. 0 ≤ n) → nat.
+ apply ((λn:nat.n) : (∃n. 0 ≤ n) → nat).
+qed.
+
+theorem test4: (∃n. 1 ≤ n) → ∃n. 0 < n.
+ apply ((λn:nat.n) : (∃n. 1 ≤ n) → ∃n. 0 < n);
+ cases name_con;
+ assumption.
+qed.
+
+(*
+theorem test5: nat → ∃n. 0 ≤ n.
+ apply (λn:nat.?);
+ apply
+  (match n return λ_.∃n.0 ≤ n with [O ⇒ (0 : ∃n.0 ≤ n) | S n' ⇒ ex_intro ? ? n' ?]
+  : ∃n. 0 ≤ n);
+ autobatch.
+qed.
+*)