From 751e50a8640e460a3d1a9fad96b8ec5fb3e663d0 Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Tue, 4 Sep 2007 09:42:39 +0000 Subject: [PATCH 1/1] A test for propagation of coercions (that open new goals) under lambdas, cases, etc. --- .../matita/tests/coercions_propagation.ma | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 helm/software/matita/tests/coercions_propagation.ma diff --git a/helm/software/matita/tests/coercions_propagation.ma b/helm/software/matita/tests/coercions_propagation.ma new file mode 100644 index 000000000..c8529631b --- /dev/null +++ b/helm/software/matita/tests/coercions_propagation.ma @@ -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. +*) -- 2.39.2