L ≟ re (carr (acarr A))
(* -------------------------------------------- *) ⊢
eq_re A a b ≡ eq_rel L R a b.
+
+(* XXX This seems to be a pattern for equations in setoid(0) *)
+unification hint 0 ≔ AA;
+ A ≟ carr (acarr AA),
+ R ≟ setoid1_of_setoid (RE AA)
+(*-----------------------------------------------*) ⊢
+ re A ≡ carr1 R.
+
+alias symbol "hint_decl" (instance 1) = "hint_decl_CProp2".
+unification hint 0 ≔ S : Alpha, x,y: re (carr (acarr S));
+ SS ≟ RE S,
+ TT ≟ setoid1_of_setoid SS,
+ T ≟ carr1 TT
+(*-----------------------------------------*) ⊢
+ eq_re S x y ≡ eq_rel1 T (eq1 TT) x y.
+(* contructors are morphisms *)
nlemma c_is_morph : ∀A:Alpha.(re A) ⇒_0 (re A) ⇒_0 (re A).
-#A; napply (mk_binary_morphism … (λs1,s2:re A. s1 · s2));
-#a; nelim a;
-##[##1,2: #a' b b'; ncases a'; nnormalize; /2/ by conj;
-##|#x a' b b'; ncases a'; /2/ by conj;
-##|##4,5: #r1 r2 IH1 IH2 a'; ncases a'; nnormalize; /2/ by conj;
-##|#r IH a'; ncases a'; nnormalize; /2/ by conj; ##]
-nqed.
+#A; napply (mk_binary_morphism … (λs1,s2:re A. s1 · s2)); #a; nelim a; /2/ by conj; nqed.
(* XXX This is the good format for hints about morphisms, fix the others *)
alias symbol "hint_decl" (instance 1) = "hint_decl_Type0".
fun1 T T (fun1 T (unary_morph_setoid T T) MM A) B ≡ c SS A B.
nlemma o_is_morph : ∀A:Alpha.(re A) ⇒_0 (re A) ⇒_0 (re A).
-#A; napply (mk_binary_morphism … (λs1,s2:re A. s1 + s2));
-#a; nelim a;
-##[##1,2: #a' b b'; ncases a'; nnormalize; /2/ by conj;
-##|#x a' b b'; ncases a'; /2/ by conj;
-##|##4,5: #r1 r2 IH1 IH2 a'; ncases a'; nnormalize; /2/ by conj;
-##|#r IH a'; ncases a'; nnormalize; /2/ by conj; ##]
-nqed.
+#A; napply (mk_binary_morphism … (λs1,s2:re A. s1 + s2)); #a; nelim a; /2/ by conj; nqed.
unification hint 0 ≔ S:Alpha, A,B:re (carr (acarr S));
SS ≟ carr (acarr S),
(*--------------------------------------------------------------------------*) ⊢
fun1 T T (fun1 T (unary_morph_setoid T T) MM A) B ≡ o SS A B.
+nlemma k_is_morph : ∀A:Alpha.(re A) ⇒_0 (re A).
+#A; @(λs1:re A. s1^* ); #a; nelim a; /2/ by conj; nqed.
+
+unification hint 0 ≔ S:Alpha, A:re (carr (acarr S));
+ SS ≟ carr (acarr S),
+ MM ≟ mk_unary_morphism ?? (λB.B^* ) (prop1 ?? (k_is_morph S)),
+ T ≟ RE S
+(*--------------------------------------------------------------------------*) ⊢
+ fun1 T T MM A ≡ k SS A.
+
+nlemma s_is_morph : ∀A:Alpha.A ⇒_0 (re A).
+#A; @(λs1:A. s ? s1 ); #x y E; //; nqed.
+
+unification hint 0 ≔ S:Alpha, a: carr (acarr S);
+ SS ≟ carr (acarr S),
+ MM ≟ mk_unary_morphism ?? (λb.s ? b ) (prop1 ?? (s_is_morph S)),
+ T ≟ RE S, T1 ≟ acarr S
+(*--------------------------------------------------------------------------*) ⊢
+ fun1 T1 T MM a ≡ s SS a.
+
(* end setoids support for re *)
nlet rec conjunct S (l : list (list S)) (L : lang S) on l: CProp[0] ≝
notation < "ϵ b" non associative with precedence 90 for @{'app_epsilon $b}.
interpretation "epsilon lang" 'app_epsilon b = (epsilon ? b).
+(* hints for epsilon *)
+nlemma epsilon_is_morph : ∀A:Alpha. (setoid1_of_setoid bool) ⇒_1 (lang A).
+#X; @; ##[#b; napply(ϵ b)] #a1 a2; ncases a1; ncases a2; //; *; nqed.
+
+nlemma epsilon_is_ext: ∀A:Alpha. (setoid1_of_setoid bool) → (Elang A).
+ #S b; @(ϵ b); #w1 w2 E; ncases b; @; ##[##3,4:*]
+nchange in match (w1 ∈ ϵ true) with ([] =_0 w1);
+nchange in match (w2 ∈ ϵ true) with ([] =_0 w2); #H; napply (.= H); /2/;
+nqed.
+
+alias symbol "hint_decl" = "hint_decl_Type1".
+unification hint 0 ≔ A : Alpha, B : bool;
+ AA ≟ LIST (acarr A),
+ R ≟ mk_ext_powerclass ?
+ (ϵ B) (ext_prop ? (epsilon_is_ext ? B))
+(*--------------------------------------------------------------------*) ⊢
+ ext_carr AA R ≡ epsilon A B.
+
+unification hint 0 ≔ S:Alpha, A:bool;
+ B ≟ setoid1_of_setoid BOOL,
+ T ≟ powerclass_setoid (list (carr (acarr S))),
+ MM ≟ mk_unary_morphism1 B T
+ (λB.ϵ B) (prop11 B T (epsilon_is_morph S))
+(*--------------------------------------------------------------------------*) ⊢
+ fun11 B T MM A ≡ epsilon S A.
+
+nlemma epsilon_is_ext_morph:∀A:Alpha. (setoid1_of_setoid bool) ⇒_1 (Elang A).
+#A; @(epsilon_is_ext …);
+#x1 x2 Ex; napply (prop11 … (epsilon_is_morph A)); nassumption.
+nqed.
+
+unification hint 1 ≔ AA : Alpha, B : bool;
+ AAS ≟ LIST (acarr AA),
+ BB ≟ setoid1_of_setoid BOOL,
+ T ≟ ext_powerclass_setoid AAS,
+ R ≟ mk_unary_morphism1 BB T
+ (λS.
+ mk_ext_powerclass AAS (epsilon AA S)
+ (ext_prop AAS (epsilon_is_ext AA S)))
+ (prop11 BB T (epsilon_is_ext_morph AA))
+(*------------------------------------------------------*) ⊢
+ ext_carr AAS (fun11 BB T R B) ≡ epsilon AA B.
+
+(* end hints for epsilon *)
+
ndefinition L_pr ≝ λS : Alpha.λp:pre S. 𝐋\p\ (\fst p) ∪ ϵ (\snd p).
interpretation "L_pr" 'L_pi E = (L_pr ? E).
nlemma subW : ∀S.∀a,b:Ω^S.∀w.w ∈ (a - b) → w ∈ a.
#S a b w; nnormalize; *; //; nqed.
+alias symbol "eclose" (instance 3) = "eclose".
nlemma erase_bull : ∀S:Alpha.∀a:pitem S. |\fst (•a)| = |a|.
#S a; nelim a; // by {};
##[ #e1 e2 IH1 IH2;
napply Hw2;
nqed.
-(* XXX This seems to be a pattern for equations *)
-alias symbol "hint_decl" (instance 1) = "hint_decl_CProp2".
-unification hint 0 ≔ S : Alpha, x,y: re (carr (acarr S));
- SS ≟ RE S,
- TT ≟ setoid1_of_setoid SS,
- T ≟ carr1 TT
-(*-----------------------------------------*) ⊢
- eq_re S x y ≡ eq_rel1 T (eq1 TT) x y.
-(* XXX the previous hint does not work *)
+
(* theorem 16: 1 → 3 *)
nlemma odot_dot_aux : ∀S:Alpha.∀e1,e2: pre S.
napply (.=_1 (cupA …)^-1);
napply (.=_1 (cupA …)^-1 ╪_1 #);
napply (.=_1 (cupA …));
- nlapply (erase_bull S e2'); #XX;
- napply (.=_1 (((# ╪_1 (┼_1 ?) )╪_1 #)╪_1 #)); ##[##2: napply XX; ##| ##skip]
+ napply (.=_1 (((# ╪_1 (┼_1 (erase_bull S e2')) )╪_1 #)╪_1 #));
//;
##| ncases e2; #e2' b2'; nchange in match (𝐋\p ?) with (?∪?∪?);
napply (.=_1 (cupA…));
*; #w1; *; #w2; *; *; #defw sube; *; #lw; *; #flx cj;
@ (w1 :: lw); @; ##[ napply (.=_0 # ╪_0 flx); napply (?^-1); //]
@; //; napply (subW … sube);
-##| *; #wl; *; #defw Pwl; (* STOP manca ext_carr vs epsilon. *)
-ncases b; ##[ nchange in match (ϵtrue) with {[]}.
-napply (. (defw^-1 ╪_1 #)); nelim wl in Pwl; /2/;
-#s tl IH; *; #Xs Ptl; ncases s in Xs; ##[ #; napply IH; //] #x xs Xxxs;
-@; @(x :: xs); @(flatten ? tl); @; ##[ @; ##[ napply #] @; //; nassumption; ##]
-nelim tl in Ptl; ##[ #; @[]; /2/] #w ws IH; *; #Xw Pws; @(w :: ws); @; ##[ napply #]
-@; //;
-
-
-
- nrewrite < defw; nelim wl in Pwl; ##[ #_; @2; //]
- #w' wl' IH; *; #Pw' IHp; nlapply (IH IHp); *;
- ##[ *; #w1; *; #w2; *; *; #defwl' H1 H2;
- @; ncases b in H1; #H1;
- ##[##2: nrewrite > (sub0…); @w'; @(w1@w2);
- nrewrite > (associative_append ? w' w1 w2);
- nrewrite > defwl'; @; ##[@;//] @(wl'); @; //;
- ##| ncases w' in Pw';
- ##[ #ne; @w1; @w2; nrewrite > defwl'; @; //; @; //;
- ##| #x xs Px; @(x::xs); @(w1@w2);
- nrewrite > (defwl'); @; ##[@; //; @; //; @; nnormalize; #; ndestruct]
- @wl'; @; //; ##] ##]
- ##| #wlnil; nchange in match (flatten ? (w'::wl')) with (w' @ flatten ? wl');
- nrewrite < (wlnil); nrewrite > (append_nil…); ncases b;
- ##[ ncases w' in Pw'; /2/; #x xs Pxs; @; @(x::xs); @([]);
- nrewrite > (append_nil…); @; ##[ @; //;@; //; nnormalize; @; #; ndestruct]
- @[]; @; //;
- ##| @; @w'; @[]; nrewrite > (append_nil…); @; ##[##2: @[]; @; //]
- @; //; @; //; @; *;##]##]##]
+##| *; #wl; *; #defw Pwl; napply (. (defw^-1 ╪_1 #));
+ nelim wl in Pwl; /2/;
+ #s tl IH; *; #Xs Ptl; ncases s in Xs; ##[ #; napply IH; //] #x xs Xxxs;
+ @; @(x :: xs); @(flatten ? tl); @;
+ ##[ @; ##[ napply #] @; ##[nassumption] ncases b; *; ##]
+ nelim tl in Ptl; ##[ #; @[]; /2/] #w ws IH; *; #Xw Pws; @(w :: ws); @; ##[ napply #]
+ @; //;##]
nqed.
(* theorem 16: 1 *)
alias symbol "in_pl" (instance 23) = "in_pl".
alias symbol "in_pl" (instance 5) = "in_pl".
alias symbol "eclose" (instance 21) = "eclose".
-ntheorem bull_cup : ∀S:Alpha. ∀e:pitem S. 𝐋\p (•e) = 𝐋\p e ∪ 𝐋 .|e|.
+ntheorem bull_cup : ∀S:Alpha. ∀e:pitem S. 𝐋\p (•e) = 𝐋\p e ∪ 𝐋 |e|.
#S e; nelim e; //;
- ##[ #a; napply extP; #w; nnormalize; @; *; /3/ by or_introl, or_intror;
- ##| #a; napply extP; #w; nnormalize; @; *; /3/ by or_introl; *;
+ ##[ #a; napply ext_set; #w; @; *; /3/ by or_introl, or_intror;
+ ##| #a; napply ext_set; #w; @; *; /3/ by or_introl; *;
##| #e1 e2 IH1 IH2;
- nchange in ⊢ (??(??(%))?) with (•e1 ⊙ 〈e2,false〉);
- nrewrite > (odot_dot_aux S (•e1) 〈e2,false〉 IH2);
- nrewrite > (IH1 …); nrewrite > (cup_dotD …);
- nrewrite > (cupA …); nrewrite > (cupC ?? (𝐋\p ?) …);
- nchange in match (𝐋\p 〈?,?〉) with (𝐋\p e2 ∪ {}); nrewrite > (cup0 …);
- nrewrite < (erase_dot …); nrewrite < (cupA …); //;
+ nchange in match (•(e1·e2)) with (•e1 ⊙ 〈e2,false〉);
+ napply (.=_1 (odot_dot_aux ?? 〈e2,false〉 IH2));
+ napply (.=_1 (IH1 ╪_1 #) ╪_1 #);
+ napply (.=_1 (cup_dotD …) ╪_1 #);
+ napply (.=_1 (cupA …));
+ napply (.=_1 # ╪_1 ((erase_dot ???)^-1 ╪_1 (cup0 ??)));
+ napply (.=_1 # ╪_1 (cupC…));
+ napply (.=_1 (cupA …)^-1); //;
##| #e1 e2 IH1 IH2;
- nchange in match (•(?+?)) with (•e1 ⊕ •e2); nrewrite > (oplus_cup …);
- nrewrite > (IH1 …); nrewrite > (IH2 …); nrewrite > (cupA …);
- nrewrite > (cupC ? (𝐋\p e2)…);nrewrite < (cupA ??? (𝐋\p e2)…);
- nrewrite > (cupC ?? (𝐋\p e2)…); nrewrite < (cupA …);
- nrewrite < (erase_plus …); //.
+ nchange in match (•(?+?)) with (•e1 ⊕ •e2);
+ napply (.=_1 (oplus_cup …));
+ napply (.=_1 IH1 ╪_1 IH2);
+ napply (.=_1 (cupA …));
+ napply (.=_1 # ╪_1 (# ╪_1 (cupC…)));
+ napply (.=_1 # ╪_1 (cupA ????)^-1);
+ napply (.=_1 # ╪_1 (cupC…));
+ napply (.=_1 (cupA ????)^-1);
+ napply (.=_1 # ╪_1 (erase_plus ???)^-1); //;
##| #e; nletin e' ≝ (\fst (•e)); nletin b' ≝ (\snd (•e)); #IH;
- nchange in match (𝐋\p ?) with (𝐋\p 〈e'^*,true〉);
+ nchange in match (𝐋\p ?) with (𝐋\p 〈e'^*,true〉);
nchange in match (𝐋\p ?) with (𝐋\p (e'^* ) ∪ {[ ]});
- nchange in ⊢ (??(??%?)?) with (𝐋\p e' · 𝐋 .|e'|^* );
- nrewrite > (erase_bull…e);
- nrewrite > (erase_star …);
- nrewrite > (?: 𝐋\p e' = 𝐋\p e ∪ (𝐋 .|e| - ϵ b')); ##[##2:
- nchange in IH : (??%?) with (𝐋\p e' ∪ ϵ b'); ncases b' in IH;
- ##[ #IH; nrewrite > (cup_sub…); //; nrewrite < IH;
- nrewrite < (cup_sub…); //; nrewrite > (subK…); nrewrite > (cup0…);//;
- ##| nrewrite > (sub0 …); #IH; nrewrite < IH; nrewrite > (cup0 …);//; ##]##]
- nrewrite > (cup_dotD…); nrewrite > (cupA…);
- nrewrite > (?: ((?·?)∪{[]} = 𝐋 .|e^*|)); //;
- nchange in match (𝐋 .|e^*|) with ((𝐋. |e|)^* ); napply sub_dot_star;##]
- nqed.
+ (* nwhd in match (𝐋\p e'^* ); (* XXX bug uncertain *) *)
+ nchange in ⊢ (???(??%?)?) with (𝐋\p e' · ?);
+ napply (.=_1 (# ╪_1 (┼_1 (┼_0 (erase_bull S e)))) ╪_1 #);
+ napply (.=_1 (# ╪_1 (erase_star …)) ╪_1 #);
+ ncut ( 𝐋\p e' = 𝐋\p e ∪ (𝐋 |e| - ϵ b')); ##[
+ nchange in IH : (???%?) with (𝐋\p e' ∪ ϵ b'); ncases b' in IH;
+ ##[ #IH; napply (?^-1); napply (.=_1 (cup_sub … (not_epsilon_lp…)));
+ napply (.=_1 (IH^-1 ╪_1 #));
+ alias symbol "invert" = "setoid1 symmetry".
+ (* XXX too slow if ambiguous, since it tries with a ? (takes 12s) then
+ tries with sym0 and fails immediately, then with sym1 that is OK *)
+ napply (.=_1 (cup_sub …(not_epsilon_lp …))^-1);
+ napply (.=_1 # ╪_1 (subK…)); napply (.=_1 (cup0…)); //;
+ ##| #IH; napply (?^-1); napply (.=_1 # ╪_1 (sub0 …));
+ napply (.=_1 IH^-1); napply (.=_1 (cup0 …)); //; ##]##] #EE;
+ napply (.=_1 (EE ╪_1 #) ╪_1 #);
+ napply (.=_1 (cup_dotD…) ╪_1 #);
+ napply (.=_1 (cupA…));
+ napply (.=_1 # ╪_1 (sub_dot_star…)); //; ##]
+nqed.
+
+STOP
(* theorem 16: 3 *)
nlemma odot_dot: