1- (* mathcomp analysis (c) 2017 Inria and AIST. License: CeCILL-C. *)
1+ (* mathcomp analysis (c) 2017 Inria and AIST. License: CeCILL-C. *)
22From HB Require Import structures.
33From mathcomp Require Import all_ssreflect_compat ssralg ssrnum vector.
44From mathcomp Require Import interval_inference.
@@ -37,10 +37,10 @@ From mathcomp Require Import pseudometric_normed_Zmodule.
3737(* UniformZmodule == HB class, join of UniformNmodule and Zmodule *)
3838(* with uniformly continuous opposite operator *)
3939(* PreUniformLmodule K == HB class, join of Uniform and Lmodule over K *)
40- (* K is a numDomainType. *)
40+ (* K is a numDomainType *)
4141(* UniformLmodule K == HB class, join of UniformNmodule and Lmodule *)
4242(* with a uniformly continuous scaling operation *)
43- (* K is a numFieldType. *)
43+ (* K is a numFieldType *)
4444(* convexTvsType R == interface type for a locally convex *)
4545(* tvs on a numDomain R *)
4646(* A convex tvs is constructed over a uniform *)
@@ -49,7 +49,6 @@ From mathcomp Require Import pseudometric_normed_Zmodule.
4949(* PreTopologicalLmod_isConvexTvs == factory allowing the construction of a *)
5050(* convex tvs from an Lmodule which is also a *)
5151(* topological space *)
52- (* ``` *)
5352(* HB instances: *)
5453(* - The type R^o (R : numFieldType) is endowed with the structure of *)
5554(* ConvexTvs. *)
@@ -603,3 +602,198 @@ HB.instance Definition _ :=
603602 Uniform_isConvexTvs.Build K (E * F)%type prod_locally_convex.
604603
605604End prod_ConvexTvs.
605+
606+ HB.structure Definition LinearContinuous (K : numDomainType) (E : NbhsLmodule.type K)
607+ (F : NbhsZmodule.type) (s : K -> F -> F) :=
608+ {f of @GRing.Linear K E F s f & @Continuous E F f }.
609+
610+ (* https://github.com/math-comp/math-comp/issues/1536
611+ we use GRing.Scale.law even though it is claimed to be internal *)
612+ HB.factory Structure isLinearContinuous (K : numDomainType) (E : NbhsLmodule.type K)
613+ (F : NbhsZmodule.type) (s : GRing.Scale.law K F) (f : E -> F) := {
614+ linearP : linear_for s f ;
615+ continuousP : continuous f
616+ }.
617+
618+ HB.builders Context K E F s f of @isLinearContinuous K E F s f.
619+
620+ HB.instance Definition _ := GRing.isLinear.Build K E F s f linearP.
621+ HB.instance Definition _ := isContinuous.Build E F f continuousP.
622+
623+ HB.end .
624+
625+ Section lcfun_pred.
626+ Context {K : numDomainType} {E : NbhsLmodule.type K} {F : NbhsZmodule.type} {s : K -> F -> F}.
627+ Definition lcfun : {pred E -> F} := mem [set f | linear_for s f /\ continuous f ].
628+ Definition lcfun_key : pred_key lcfun. Proof . exact. Qed .
629+ Canonical lcfun_keyed := KeyedPred lcfun_key.
630+
631+ End lcfun_pred.
632+
633+ Reserved Notation "'{' 'linear_continuous' U '->' V '|' s '}'"
634+ (at level 0, U at level 98, V at level 99,
635+ format "{ 'linear_continuous' U -> V | s }").
636+ Reserved Notation "'{' 'linear_continuous' U '->' V '}'"
637+ (at level 0, U at level 98, V at level 99,
638+ format "{ 'linear_continuous' U -> V }").
639+ Notation "{ 'linear_continuous' U -> V | s }" := (@LinearContinuous.type _ U%type V%type s)
640+ : type_scope.
641+ Notation "{ 'linear_continuous' U -> V }" := {linear_continuous U%type -> V%type | *:%R}
642+ : type_scope.
643+
644+ Section lcfun.
645+ Context {R : numDomainType} {E : NbhsLmodule.type R}
646+ {F : NbhsZmodule.type} {s : GRing.Scale.law R F}.
647+ Notation T := {linear_continuous E -> F | s}.
648+ Notation lcfun := (@lcfun _ E F s).
649+
650+ Section Sub.
651+ Context (f : E -> F) (fP : f \in lcfun).
652+
653+ Definition lcfun_Sub_subproof :=
654+ @isLinearContinuous.Build _ E F s f (proj1 (set_mem fP)) (proj2 (set_mem fP)).
655+ #[local] HB.instance Definition _ := lcfun_Sub_subproof.
656+ Definition lcfun_Sub : {linear_continuous _ -> _ | _ } := f.
657+ End Sub.
658+
659+ Lemma lcfun_rect (K : T -> Type ) :
660+ (forall f (Pf : f \in lcfun), K (lcfun_Sub Pf)) -> forall u : T, K u.
661+ Proof .
662+ move=> Ksub [f [[Pf1] [Pf2] [Pf3]]].
663+ set G := (G in K G).
664+ have Pf : f \in lcfun.
665+ by rewrite inE /=; split => // x u v; rewrite Pf1 Pf2.
666+ suff -> : G = lcfun_Sub Pf by apply: Ksub.
667+ rewrite {}/G.
668+ congr LinearContinuous.Pack.
669+ congr LinearContinuous.Class.
670+ - by congr GRing.isNmodMorphism.Axioms_; apply: Prop_irrelevance.
671+ - by congr GRing.isScalable.Axioms_; apply: Prop_irrelevance.
672+ - by congr isContinuous.Axioms_; apply: Prop_irrelevance.
673+ Qed .
674+
675+ Lemma lcfun_valP f (Pf : f \in lcfun) : lcfun_Sub Pf = f :> (_ -> _).
676+ Proof . by []. Qed .
677+
678+ HB.instance Definition _ := isSub.Build _ _ T lcfun_rect lcfun_valP.
679+
680+ Lemma lcfuneqP (f g : {linear_continuous E -> F | s}) : f = g <-> f =1 g.
681+ Proof . by split=> [->//|fg]; apply/val_inj/funext. Qed .
682+
683+ HB.instance Definition _ := [Choice of {linear_continuous E -> F | s} by <:].
684+
685+ Variant lcfun_spec (f : E -> F) : (E -> F) -> bool -> Type :=
686+ | Islcfun (l : {linear_continuous E -> F | s}) : lcfun_spec f l true.
687+
688+ (*to be renamed ? *)
689+ Lemma lcfunE (f : E -> F) : (f \in lcfun) -> lcfun_spec f f (f \in lcfun).
690+ Proof .
691+ move=> /[dup] f_lc ->.
692+ have {2}-> :(f = (lcfun_Sub f_lc)) by rewrite lcfun_valP.
693+ constructor.
694+ Qed .
695+
696+ End lcfun.
697+
698+ Section lcfun_comp.
699+
700+ Context {R : numDomainType} {E F : NbhsLmodule.type R}
701+ {S : NbhsZmodule.type} {s : GRing.Scale.law R S}
702+ (f : {linear_continuous E -> F}) (g : {linear_continuous F -> S | s}).
703+
704+ Lemma lcfun_comp_subproof1 : linear_for s (g \o f).
705+ Proof . by move=> *; move=> */=; rewrite !linearP. Qed .
706+
707+ (* TODO weaken proof continuous_comp to arbitrary nbhsType *)
708+ Lemma lcfun_comp_subproof2 : continuous (g \o f).
709+ Proof . by move=> x; move=> A /cts_fun /cts_fun. Qed .
710+
711+ HB.instance Definition _ := @isLinearContinuous.Build R E S s (g \o f)
712+ lcfun_comp_subproof1 lcfun_comp_subproof2.
713+
714+ End lcfun_comp.
715+
716+ Section lcfun_lmodtype.
717+ Context {R : numFieldType} {E F G: convexTvsType R}.
718+
719+ Implicit Types (r : R) (f g : {linear_continuous E -> F}) (h : {linear_continuous F -> G}).
720+
721+ Import GRing.Theory.
722+
723+ Lemma null_fun_continuous : continuous (\0 : E -> F).
724+ Proof .
725+ by apply: cst_continuous.
726+ Qed .
727+
728+ HB.instance Definition _ := isContinuous.Build E F \0 null_fun_continuous.
729+
730+ Lemma lcfun0 : (\0 : {linear_continuous E -> F}) =1 cst 0 :> (_ -> _).
731+ Proof . by []. Qed .
732+
733+ (* NB : cvgD in pseudometric_normedZmodule should be lowered to some common
734+ structure to tvstype and pseudometric, then lcfun doesn't need to exist
735+ anymore *)
736+ Lemma lcfun_cvgD (U : set_system E) {FF : Filter U} f g a b :
737+ f @ U --> a -> g @ U --> b -> (f \+ g) @ U --> a + b.
738+ Proof .
739+ move=> fa ga.
740+ apply: continuous2_cvg; [|by []..].
741+ apply @add_continuous. (* TODO: why the @ ? *)
742+ Qed .
743+
744+ Lemma lcfun_continuousD f g : continuous (f \+ g).
745+ Proof . move=> /= x; apply: lcfun_cvgD; apply: cts_fun. Qed .
746+
747+
748+ Lemma lcfun_cvgN (U : set_system E) {FF : Filter U} f a : f @ U --> a -> \- f @ U --> - a.
749+ Proof . by move=> ?; apply: continuous_cvg => //; exact: opp_continuous. Qed .
750+
751+
752+ Lemma lcfun_continuousN f : continuous (\- f).
753+ Proof .
754+ by move=> /= x; apply: lcfun_cvgN; apply: cts_fun.
755+ Qed .
756+
757+ HB.instance Definition _ f g := isContinuous.Build E F (f \+ g) (@lcfun_continuousD f g).
758+
759+ Lemma lcfun_cvgZ (U : set_system E) {FF : Filter U} l f r a : l @ U --> r -> f @ U --> a ->
760+ l x *: f x @[x --> U] --> r *: a.
761+ Proof .
762+ move=> ? ?; apply: continuous2_cvg => //; exact: (scale_continuous (_, _)).
763+ Qed .
764+
765+ Lemma lcfun_cvgZr (U : set_system E) {FF : Filter U} k f a : f @ U --> a -> k \*: f @ U --> k *: a.
766+ Proof . apply: lcfun_cvgZ => //; exact: cvg_cst. Qed .
767+
768+ Lemma lcfun_continuousM r g : continuous (r \*: g).
769+ Proof . by move=> /= x; apply: lcfun_cvgZr; apply: cts_fun. Qed .
770+
771+ HB.instance Definition _ r g := isContinuous.Build E F (r \*: g) (@lcfun_continuousM r g).
772+
773+ Lemma lcfun_submod_closed : submod_closed (@lcfun R E F *:%R).
774+ Proof .
775+ split; first by rewrite inE; split; first apply/linearP; apply: cst_continuous.
776+ move=> r /= _ _ /lcfunE[f] /lcfunE[g].
777+ by rewrite inE /=; split; [exact: linearP | exact: lcfun_continuousD].
778+ Qed .
779+
780+ HB.instance Definition _ f := isContinuous.Build E F (\- f) (@lcfun_continuousN f).
781+
782+ HB.instance Definition _ :=
783+ @GRing.isSubmodClosed.Build _ _ lcfun lcfun_submod_closed.
784+
785+ HB.instance Definition _ :=
786+ [SubChoice_isSubLmodule of {linear_continuous E -> F } by <:].
787+
788+ End lcfun_lmodtype.
789+
790+
791+ Section Substructures.
792+ Context (R: numFieldType) (V : convexTvsType R).
793+ Variable (A : pred V).
794+
795+ HB.instance Definition _ := ConvexTvs.on (subspace A).
796+
797+ Check {linear_continuous (subspace A) -> R^o}.
798+
799+ End Substructures.
0 commit comments