1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
17 include "logic/connectives.ma".
18 include "nat/orders.ma".
20 inductive sigma (A:Type) (P:A → Prop) : Type ≝
21 sigma_intro: ∀a:A. P a → sigma A P.
23 interpretation "sigma" 'exists \eta.x =
24 (cic:/matita/tests/coercions_propagation/sigma.ind#xpointer(1/1) _ x).
26 definition inject ≝ λP.λa:nat.λp:P a. sigma_intro ? P ? p.
28 coercion cic:/matita/tests/coercions_propagation/inject.con 0 1.
30 definition eject ≝ λP.λc: ∃n:nat.P n. match c with [ sigma_intro w _ ⇒ w].
32 coercion cic:/matita/tests/coercions_propagation/eject.con.
34 alias num (instance 0) = "natural number".
35 theorem test: ∃n. 0 ≤ n.
36 apply (S O : ∃n. 0 ≤ n).
40 theorem test2: nat → ∃n. 0 ≤ n.
41 apply ((λn:nat. 0) : nat → ∃n. 0 ≤ n);
45 theorem test3: (∃n. 0 ≤ n) → nat.
46 apply ((λn:nat.n) : (∃n. 0 ≤ n) → nat).
49 theorem test4: (∃n. 1 ≤ n) → ∃n. 0 < n.
50 apply ((λn:nat.n) : (∃n. 1 ≤ n) → ∃n. 0 < n);
55 theorem test5: nat → ∃n. 1 ≤ n.
65 [ cases (aux n1); simplify; ] autobatch;
68 inductive NN (A:Type) : nat -> Type ≝
70 | NS : ∀n:nat. NN A n → NN A (S n).
72 definition injectN ≝ λA,k.λP.λa:NN A k.λp:P a. sigma_intro ? P ? p.
74 coercion cic:/matita/tests/coercions_propagation/injectN.con 0 1.
76 definition ejectN ≝ λA,k.λP.λc: ∃n:NN A k.P n. match c with [ sigma_intro w _ ⇒ w].
78 coercion cic:/matita/tests/coercions_propagation/ejectN.con.
81 λA,k.λx:NN A k. 1 <= k.
83 theorem test51_byhand: ∀A,k. NN A k → ∃n:NN A (S k). PN ? ? n.
86 let rec aux (w : nat) (n : NN A w) on n : ∃p:NN A (S w).PN ? ? p ≝
87 match n in NN return λx.λm:NN A x.∃p:NN A (S x).PN ? ? p with
88 [ NO ⇒ injectN ? ? ? (NS A ? (NO A)) ?
89 | NS x m ⇒ injectN ? ? ? (NS A (S x) (ejectN ? ? ? (aux ? m))) ?
93 : ∀n:nat. NN A n → ∃m:NN A (S n). PN ? ? m);
94 [2: cases (aux x m); simplify; autobatch ] unfold PN; autobatch;
97 theorem f : nat -> nat -> ∃n:nat.O <= n.
98 apply (λx,y:nat.y : nat -> nat -> ∃n:nat. O <= n).
102 axiom F : nat -> nat -> nat.
104 theorem f1 : nat -> nat -> ∃n:nat.O <= n.
105 apply (F : nat -> nat -> ∃n:nat. O <= n).
109 theorem test51: ∀A,k. NN A k → ∃n:NN A (S k). PN ? ? n.
112 let rec aux (w : nat) (n : NN A w) on n : NN A (S w) ≝
113 match n in NN return λx.λm:NN A x.NN A (S x) with
115 | NS x m ⇒ NS A (S x) (aux ? m)
119 : ∀n:nat. NN A n → ∃m:NN A (S n). PN ? ? m); [3: apply xxx];
120 unfold PN in aux ⊢ %; [cases (aux n2 n3)] autobatch;
123 (* guarded troppo debole *)
124 theorem test522: nat → ∃n. 1 ≤ n.
126 let rec aux n : nat ≝
134 [ cases (aux n1); simplify;