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 (**************************************************************************)
15 include "arithmetics/nat.ma".
17 ndefinition two ≝ S (S O).
18 ndefinition natone ≝ S O.
19 ndefinition four ≝ two * two.
20 ndefinition eight ≝ two * four.
23 include "topology/igft.ma".
25 nlemma hint_auto2 : ∀T.∀U,V:Ω^T.(∀x.x ∈ U → x ∈ V) → U ⊆ V.
29 alias symbol "covers" = "covers set".
30 alias symbol "coverage" = "coverage cover".
31 alias symbol "I" = "I".
34 (U ⊆ P) → (∀a:A.∀j:𝐈 a. 𝐂 a j ◃ U → 𝐂 a j ⊆ P → a ∈ P) →
36 #A; #U; #P; #refl; #infty; #a; #H; nelim H; /3/.
39 alias symbol "covers" (instance 1) = "covers".
41 ∀A:Ax.∀U:Ω^A.∀P:A → CProp[0].
42 (∀a. a ∈ U → P a) → (∀a:A.∀j:𝐈 a. 𝐂 a j ◃ U → (∀b. b ∈ 𝐂 a j → P b) → P a) →
44 #A; #U; #P; nletin V ≝ {x | P x}; napply (cover_ind' … V).
47 (*********** from Cantor **********)
48 ninductive eq1 (A : Type[0]) : Type[0] → CProp[0] ≝
51 notation "hvbox( a break ∼ b)" non associative with precedence 40
54 interpretation "eq between types" 'eqT a b = (eq1 a b).
56 ninductive unit : Type[0] ≝ one : unit.
58 ninductive option (A: Type[0]) : Type[0] ≝
62 nrecord uuAx : Type[1] ≝ {
64 uuC : uuS → option uuS
67 ndefinition uuax : uuAx → Ax.
69 [ #a; ncases (uuC … a) [ napply False | #_; napply unit]
70 ##| #a; ncases (uuC … a)
71 [ nnormalize; #H; napply (False_rect_Type1 … H)
72 | nnormalize; #b; #_; napply {x | x=b }]##]
75 ncoercion uuax : ∀u:uuAx. Ax ≝ uuax on _u : uuAx to Ax.
77 nlemma eq_rect_Type0_r':
78 ∀A.∀a,x.∀p:eq ? x a.∀P: ∀x:A. eq ? x a → Type[0]. P a (refl A a) → P x p.
79 #A; #a; #x; #p; ncases p; //;
82 nlemma eq_rect_Type0_r:
83 ∀A.∀a.∀P: ∀x:A. eq ? x a → Type[0]. P a (refl A a) → ∀x.∀p:eq ? x a.P x p.
84 #A; #a; #P; #p; #x0; #p0; napply (eq_rect_Type0_r' ??? p0); nassumption.
87 ninductive bool: Type[0] ≝
91 nrecord memdec (A: Type[0]) (U:Ω^A) : Type[0] ≝
92 { decide_mem:> A → bool;
93 decide_mem_ok: ∀x. decide_mem x = true → x ∈ U;
94 decide_mem_ko: ∀x. decide_mem x = false → ¬ (x ∈ U)
97 (*********** end from Cantor ********)
99 alias symbol "covers" (instance 9) = "covers".
100 alias symbol "covers" (instance 8) = "covers".
102 (A:uuAx) (U:Ω^(uuax A)) (memdec: memdec … U) (P:uuax A → Type[0])
103 (refl: ∀a:uuax A. a ∈ U → P a)
104 (infty: ∀a:uuax A.∀i: 𝐈 a. 𝐂 a i ◃ U → (∀b. b ∈ 𝐂 a i → P b) → P a)
105 (b:uuax A) (p: b ◃ U) on p : P b
107 nlapply (decide_mem_ok … memdec b); nlapply (decide_mem_ko … memdec b);
108 ncases (decide_mem … memdec b)
109 [ #_; #H; napply refl; /2/
110 | #H; #_; ncut (uuC … b=uuC … b) [//] ncases (uuC … b) in ⊢ (???% → ?)
111 [ #E; napply False_rect_Type0; ncut (b=b) [//] ncases p in ⊢ (???% → ?)
112 [ #a; #K; #E2; napply H [ // | nrewrite > E2; // ]
113 ##| #a; #i; #K; #E2; nrewrite < E2 in i; nnormalize; nrewrite > E; nnormalize;
117 [ nlapply E; nlapply (H ?) [//] ncases p
118 [ #x; #Hx; #K1; #_; ncases (K1 Hx)
119 ##| #x; #i; #Hx; #K1; #E2; napply Hx; ngeneralize in match i; nnormalize;
120 nrewrite > E2; nnormalize; #_; //]##]
122 nlapply (infty b); nnormalize; nrewrite > E; nnormalize; #H2;
123 napply (H2 one); #y; #E2; nrewrite > E2
124 (* [##2: napply cover_rect] //; *)
126 ##| napply (cover_rect A U memdec P refl infty a); // ]##]
133 | S m ⇒ S m * skipfact (pred m) ]
136 ntheorem psym_plus: ∀n,m. n + m = m + n.//.
139 nlemma easy1: ∀n:nat. two * (S n) = two + two * n.//.
142 ndefinition skipfact_dom: uuAx.
143 @ nat; #n; ncases n [ napply None | #m; napply (Some … (pred m)) ]
146 ntheorem skipfact_base_dec:
147 memdec (uuax skipfact_dom) (mk_powerclass ? (λx: uuax skipfact_dom. x=O)).
148 nnormalize; @ (λx. match x with [ O ⇒ true | S _ ⇒ false ]); #n; nelim n;
149 nnormalize; //; #X; ndestruct; #Y; #Z; ndestruct; #W; ndestruct.
152 ntheorem skipfact_partial:
153 ∀n: uuax skipfact_dom. two * n ◃ mk_powerclass ? (λx: uuax skipfact_dom.x=O).
158 | nnormalize; #y; nchange in ⊢ (% → ?) with (y = pred (pred (two * (natone + m))));
159 nnormalize; nrewrite < (plus_n_Sm …); nnormalize;
160 #E; nrewrite > E; napply H ]##]
163 ndefinition skipfact: ∀n:nat. n ◃ mk_powerclass ? (λx: uuax skipfact_dom.x=O) → nat.
164 #n; #D; napply (cover_rect … skipfact_base_dec … n D)
165 [ #a; #_; napply natone
167 [ nnormalize; #i; nelim i
168 | #m; #i; nnormalize in i; #d; #H;
169 napply (S m * H (pred m) …); //]
172 nlemma test: skipfact four ? = eight. ##[##2: napply (skipfact_partial two)] //.