alias symbol "eq" = "setoid1 eq".
alias symbol "eq" = "setoid eq".
alias symbol "eq" = "setoid1 eq".
+alias symbol "eq" = "setoid eq".
+alias symbol "eq" = "setoid1 eq".
nrecord partition (A: setoid) : Type[1] ≝
{ support: setoid;
indexes: qpowerclass support;
(fi: ∀i. isomorphism ?? (Nat_ (s i)) (class ? P (iso_f ???? f i))) m index
on index : A ≝
match ltb m (s index) with
- [ or_introl _ ⇒ iso_f ???? (fi index) m
- | or_intror _ ⇒
+ [ true ⇒ iso_f ???? (fi index) m
+ | false ⇒
match index with
[ O ⇒ (* dummy value: it could be an elim False: *) iso_f ???? (fi O) O
| S index' ⇒
big_union A B T f = big_union A' B T' (λx.f (iso_f ???? g x)).
naxiom le_to_lt_or_eq: ∀n,m. n ≤ m → n < m ∨ n = m.
+alias symbol "eq" = "leibnitz's equality".
naxiom minus_canc: ∀n. O = minus n n.
-naxiom lt_to_ltb_t:
- ∀n,m. ∀P: n < m ∨ ¬ (n < m) → CProp[0].
- (∀H: n < m. P (or_introl ?? H)) → n < m → P (ltb n m).
-naxiom lt_to_ltb_f:
- ∀n,m. ∀P: n < m ∨ ¬ (n < m) → CProp[0].
- (∀H: ¬ (n < m). P (or_intror ?? H)) → ¬ (n < m) → P (ltb n m).
+naxiom lt_to_ltb_t: ∀n,m. ∀P: bool → CProp[0]. P true → n < m → P (ltb n m).
+naxiom lt_to_ltb_f: ∀n,m. ∀P: bool → CProp[0]. P false → ¬ (n < m) → P (ltb n m).
naxiom lt_to_minus: ∀n,m. n < m → S (minus (minus m n) (S O)) = minus m n.
naxiom not_lt_O: ∀n. ¬ (n < O).
naxiom minus_S: ∀n,m. m ≤ n → minus (S n) m = S (minus n m).
-naxiom minus_lt_to_lt: ∀n,m,p. n < p → minus n m < p.
+naxiom minus_lt_to_lt: ∀n,m,p. n < p → minus n m < p.
+naxiom minus_O_n: ∀n. O = minus O n.
+naxiom le_O_to_eq: ∀n. n ≤ O → n=O.
+naxiom lt_to_minus_to_S: ∀n,m. m < n → ∃k. minus n m = S k.
+naxiom ltb_t: ∀n,m. n < m → ltb n m = true.
nlemma partition_splits_card:
∀A. ∀P:partition A. ∀n,s.
[ nwhd in Hni1; nwhd; nelim daemon
| nwhd in ⊢ (???%?);
nchange in Hni1 with (nindex < S n);
- ngeneralize in match (le_S_S_to_le … Hni1) in ⊢ ?; #K;
- nwhd in ⊢ (???(???????%?)?);
+ ngeneralize in match (le_S_S_to_le … Hni1) in ⊢ ?;
+ nwhd in ⊢ (? → ???(???????%?)?);
+ napply (nat_rect_CProp0
+ (λx. nindex ≤ x →
+ partition_splits_card_map A P (S n) s f fi
+ (plus
+ match minus x nindex with
+ [ O ⇒ O | S nn ⇒ big_plus nn (λi.λ_.s (S (plus i nindex)))]
+ nindex2) x = y) ?? n)
+ [ #K; nrewrite < (minus_O_n nindex); nwhd in ⊢ (???(???????%?)?);
+ nwhd in ⊢ (???%?); nchange in Hni21 with (nindex2 < s nindex);
+ ngeneralize in match (le_O_to_eq … K) in ⊢ ?; #K';
+ ngeneralize in match Hni21 in ⊢ ?;
+ ngeneralize in match Hni22 in ⊢ ?;
+ nrewrite > K' in ⊢ (% → % → ?); #K1; #K2;
+ nrewrite > (ltb_t … K2);
+ nwhd in ⊢ (???%?); nassumption
+ | #n'; #Hrec; #HH; nelim (le_to_lt_or_eq … HH)
+ [##2: #K; nrewrite < K; nrewrite < (minus_canc nindex);
+ nwhd in ⊢ (???(???????%?)?);
+ (*???????*)
+ ##| #K; nwhd in ⊢ (???%?);
+ nrewrite > (minus_S n' nindex ?) [##2: napply le_S_S_to_le; nassumption]
+ ngeneralize in match (? :
+ match S (minus n' nindex) with [O ⇒ O | S nn ⇒ big_plus nn (λi.λ_.s (S (plus i nindex)))]
+ = big_plus (minus n' nindex) (λi.λ_.s (S (plus i nindex)))) in ⊢ ? [##2: napply refl]
+ #He; napply (eq_rect_CProp0_r ??
+ (λx.λ_.
+ match ltb (plus x nindex2) (s (S n')) with
+ [ true ⇒ iso_f ???? (fi (S n')) (plus x nindex2)
+ | false ⇒ ?(*partition_splits_card_map A P (S n) s f fi
+ (minus (plus x nindex2) (s (S n'))) n'*)
+ ] = y)
+ ?? He);
+ ngeneralize in match (? :
+ ltb (plus (big_plus (minus n' nindex) (λi.λ_.s (S (plus i nindex)))) nindex2)
+ (s (S n')) = false) in ⊢ ?
+ [ #Hc; nrewrite > Hc; nwhd in ⊢ (???%?);
+ nelim (le_to_lt_or_eq … (le_S_S_to_le … K))
+ [
+ ##| #E; ngeneralize in match Hc in ⊢ ?;
+ nrewrite < E; nrewrite < (minus_canc nindex);
+ nwhd in ⊢ (??(?%?)? → ?);
+ nrewrite > E in Hni21; #E'; nchange in E' with (nindex2 < s n');
+ ngeneralize in match Hni21 in ⊢ ?;
+
+
+ ngeneralize in match (? :
+ minus (plus (big_plus (minus n' nindex) (λi.λ_.s (S (plus i nindex)))) nindex2)
+ (s (S n'))
+ =
+ plus
+ match minus n' nindex with
+ [ O ⇒ O | S nn ⇒ big_plus nn (λi.λ_.s (S (plus i nindex)))] nindex2)
+ in ⊢ ?
+ [ #F; nrewrite > F; napply Hrec; napply le_S_S_to_le; nassumption
+ | nelim (le_to_lt_or_eq … (le_S_S_to_le … K))
+ [
+ ##| #E; nrewrite < E; nrewrite < (minus_canc nindex); nnormalize;
+
+ nwhd in ⊢ (???%);
+ ]
+
+
+ nrewrite > He;
+
+
+ nnormalize in ⊢ (???%?);
+
+
+
nelim (le_to_lt_or_eq … K)
[##2: #K'; nrewrite > K'; nrewrite < (minus_canc n); nnormalize;
napply (eq_rect_CProp0 nat nindex (λx:nat.λ_.partition_splits_card_map A P (S n) s f fi nindex2 x = y) ? n K');