- nletin xxx ≝ (plus match minus n nindex return λ_.nat with [ O ⇒ O | S nn ⇒ big_plus nn (λi.λ_.s (S (plus i nindex)))] nindex2);
- napply (ex_intro … xxx); napply conj
- [ 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 ⊢ ?;
- 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');
- nchange in Hni21 with (nindex2 < s nindex); ngeneralize in match Hni21 in ⊢ ?;
- ngeneralize in match Hni22 in ⊢ ?;
- nelim nindex
- [ #X1; #X2; nwhd in ⊢ (??? % ?);
- napply (lt_to_ltb_t ???? X2); #D; nwhd in ⊢ (??? % ?); nassumption
- | #n0; #_; #X1; #X2; nwhd in ⊢ (??? % ?);
- napply (lt_to_ltb_t ???? X2); #D; nwhd in ⊢ (??? % ?); nassumption]
- ##| #K'; ngeneralize in match (lt_to_minus … K') in ⊢ ?; #K2;
- napply (eq_rect_CProp0 ?? (λx.λ_.?) ? ? K2); (* uffa, ancora??? *)
- nwhd in ⊢ (??? (???????(?%?)?) ?);
- ngeneralize in match K' in ⊢ ?;
- napply (nat_rect_CProp0
- (λx. nindex < x →
- partition_splits_card_map A P (S n) s f fi
- (plus (big_op plus_magma_type (minus (minus x nindex) (S O))
- (λi.λ_.s (S (plus i nindex))) O) nindex2) x = y) ?? n)
- [ #A; nelim (not_lt_O … A)
- | #n'; #Hrec; #X; nwhd in ⊢ (???%?);
- ngeneralize in match
- (? : ¬ ((plus (big_op plus_magma_type (minus (minus (S n') nindex) (S O))
- (λi.λ_.s (S (plus i nindex))) O) nindex2) < s (S n'))) in ⊢ ?
- [ #B1; napply (lt_to_ltb_f ???? B1); #B1'; nwhd in ⊢ (???%?);
- nrewrite > (minus_S n' nindex …) [##2: napply le_S_S_to_le; nassumption]
- ngeneralize in match (le_S_S_to_le … X) in ⊢ ?; #X';
- nelim (le_to_lt_or_eq … X')
- [##2: #X'';
- nchange in Hni21 with (nindex2 < s nindex); ngeneralize in match Hni21 in ⊢ ?;
- nrewrite > X''; nrewrite < (minus_canc n');
- nrewrite < (minus_canc (S O)); nnormalize in ⊢ (? → %);
- nelim n'
- [ #Y; nwhd in ⊢ (??? % ?);
- ngeneralize in match (minus_lt_to_lt ? (s (S O)) ? Y) in ⊢ ?; #Y';
- napply (lt_to_ltb_t … Y'); #H; nwhd in ⊢ (???%?);
-
- nrewrite > (minus_S (minus n' nindex) (S O) …) [##2:
-
- XXX;
-
- nelim n in f K' ⊢ ?
- [ #A; nelim daemon;
-
- (* BEL POSTO DOVE FARE UN LEMMA *)
- (* invariante: Hni1; altre premesse: Hni1, Hni22 *)
- nelim n in ⊢ (% → ??? (????????%) ?)
- [ #A (* decompose *)
- | #index'; #Hrec; #K; nwhd in ⊢ (???%?);
- nelim (ltb xxx (s (S index')));
- #K1; nwhd in ⊢ (???%?)
- [
-
- nindex < S index' + 1
- +^{nindex} (s i) w < s (S index')
- S index' == nindex
-
- |
- ]
- ]
- ]
- | #x; #x'; nnormalize in ⊢ (? → ? → %);
- nelim daemon
- ]
+ nletin xxx ≝ (plus (big_plus (minus n nindex) (λi.λ_.s (S (plus i nindex)))) nindex2);
+ @ xxx; @
+ [ napply iso_nat_nat_union_pre [ napply le_S_S_to_le; nassumption | nassumption ]
+ ##| nwhd in ⊢ (???%%); napply (.= ?) [##3: nassumption|##skip]
+ nlapply (iso_nat_nat_union_char n s xxx ?)
+ [napply iso_nat_nat_union_pre [ napply le_S_S_to_le; nassumption | nassumption]##]
+ *; *; #K1; #K2; #K3;
+ nlapply
+ (iso_nat_nat_union_uniq n s nindex (fst … (iso_nat_nat_union s xxx n))
+ nindex2 (snd … (iso_nat_nat_union s xxx n)) ?????); /2/
+ [##2: *; #E1; #E2; nrewrite > E1; nrewrite > E2; //
+ | nassumption ]##]
+##| #x; #x'; nnormalize in ⊢ (? → ? → %); #Hx; #Hx'; #E;
+ ncut(∀i1,i2,i1',i2'. i1 ∈ Nat_ (S n) → i1' ∈ Nat_ (S n) → i2 ∈ Nat_ (s i1) → i2' ∈ Nat_ (s i1') → eq_rel (carr A) (eq A) (fi i1 i2) (fi i1' i2') → i1=i1' ∧ i2=i2');
+ ##[ #i1; #i2; #i1'; #i2'; #Hi1; #Hi1'; #Hi2; #Hi2'; #E;
+ nlapply(disjoint … P (f i1) (f i1') ???)
+ [##2,3: napply f_closed; //
+ |##1: @ (fi i1 i2); @;
+ ##[ napply f_closed; // ##| alias symbol "refl" = "refl1".
+napply (. E‡#);
+ nwhd; napply f_closed; //]##]
+ #E'; ncut(i1 = i1'); ##[ napply (f_inj … E'); // ##]
+ #E''; nrewrite < E''; @; //;
+ nrewrite < E'' in E; #E'''; napply (f_inj … E'''); //;
+ nrewrite > E''; // ]##]
+ ##] #K;
+ nelim (iso_nat_nat_union_char n s x Hx); *; #i1x; #i2x; #i3x;
+ nelim (iso_nat_nat_union_char n s x' Hx'); *; #i1x'; #i2x'; #i3x';
+ nlapply (K … E)
+ [##1,2: nassumption;
+ ##|##3,4:napply le_to_le_S_S; nassumption; ##]
+ *; #K1; #K2;
+ napply (eq_rect_CProp0_r ?? (λX.λ_.? = X) ?? i1x');
+ napply (eq_rect_CProp0_r ?? (λX.λ_.X = ?) ?? i1x);
+ nrewrite > K1; nrewrite > K2; napply refl.