@@ -128,6 +128,12 @@ Add Search Blacklist "_mixin_".
128128(* fctE == multi-rule for fct *)
129129(* ``` *)
130130(* *)
131+ (* ``` *)
132+ (*Section linfun_lmodtype == canonical lmodtype structure on linear maps *)
133+ (* between lmodtypes. *)
134+ (* *)
135+ (* *)
136+ (* *)
131137(***************************************************************************** *)
132138
133139Set SsrOldRewriteGoalsOrder. (* change Set to Unset when porting the file, then remove the line when requiring MathComp >= 2.6 *)
@@ -2750,3 +2756,111 @@ End function_space_lemmas.
27502756
27512757Lemma inv_funK T (R : unitRingType) (f : T -> R) : (f\^-1\^-1)%R = f.
27522758Proof . by apply/funeqP => x; rewrite /inv_fun/= GRing.invrK. Qed .
2759+
2760+
2761+ Local Open Scope ring_scope.
2762+ Import GRing.Theory.
2763+
2764+ Section linfun_pred.
2765+ (* Beware that lfun is reserved for vector types, hence this one has been
2766+ renamed linfun *)
2767+ Context {K : numDomainType} {E : lmodType K} {F : lmodType K} {s : K -> F -> F}.
2768+ Definition linfun : {pred E -> F} := mem [set f | linear_for s f ].
2769+ Definition linfun_key : pred_key linfun. Proof . exact. Qed .
2770+ Canonical linfun_keyed := KeyedPred linfun_key.
2771+
2772+ End linfun_pred.
2773+
2774+ Section linfun.
2775+ Context {R : numDomainType} {E : lmodType R}
2776+ {F : lmodType R} {s : GRing.Scale.law R F}.
2777+ Notation T := {linear E -> F | s}.
2778+ Notation linfun := (@linfun _ E F s).
2779+
2780+ Section Sub.
2781+ Context (f : E -> F) (fP : f \in linfun).
2782+
2783+ Definition linfun_Sub_subproof :=
2784+ @GRing.isLinear.Build _ E F s f (set_mem fP).
2785+
2786+ #[local] HB.instance Definition _ := linfun_Sub_subproof.
2787+ Definition linfun_Sub : {linear _ -> _ | _ } := f.
2788+ End Sub.
2789+
2790+ Lemma linfun_rect (K : T -> Type ) :
2791+ (forall f (Pf : f \in linfun), K (linfun_Sub Pf)) -> forall u : T, K u.
2792+ Proof .
2793+ move=> Ksub [f] [[[Pf1 Pf2]] [Pf3]].
2794+ set G := (G in K G).
2795+ have Pf : f \in linfun.
2796+ by rewrite inE /= => // x u y; rewrite Pf2 Pf3.
2797+ suff -> : G = linfun_Sub Pf by apply: Ksub.
2798+ rewrite {}/G.
2799+ congr GRing.Linear.Pack.
2800+ congr GRing.Linear.Class.
2801+ - by congr GRing.isNmodMorphism.Axioms_; apply: Prop_irrelevance.
2802+ - by congr GRing.isScalable.Axioms_; apply: Prop_irrelevance.
2803+ Qed .
2804+
2805+ Lemma linfun_valP f (Pf : f \in linfun) : linfun_Sub Pf = f :> (_ -> _).
2806+ Proof . by []. Qed .
2807+
2808+ HB.instance Definition _ := isSub.Build _ _ T linfun_rect linfun_valP.
2809+
2810+ Lemma linfuneqP (f g : {linear E -> F | s}) : f = g <-> f =1 g.
2811+ Proof . by split=> [->//|fg]; apply/val_inj/funext. Qed .
2812+
2813+ HB.instance Definition _ := [Choice of {linear E -> F | s} by <:].
2814+
2815+ Variant linfun_spec (f : E -> F) : (E -> F) -> bool -> Type :=
2816+ | Islinfun (l : {linear E -> F | s}) : linfun_spec f l true.
2817+
2818+ (*to be renamed ? *)
2819+ Lemma linfunE (f : E -> F) : (f \in linfun) -> linfun_spec f f (f \in linfun).
2820+ Proof .
2821+ move=> /[dup] f_lc ->.
2822+ have {2}-> :(f = (linfun_Sub f_lc)) by rewrite linfun_valP.
2823+ constructor.
2824+ Qed .
2825+
2826+ End linfun.
2827+
2828+ Section linfun_comp.
2829+
2830+ Context {R : numDomainType} {E F : lmodType R}
2831+ {S : lmodType R} {s : GRing.Scale.law R S}
2832+ (f : {linear E -> F}) (g : {linear F -> S | s}).
2833+
2834+ Lemma linfun_comp_subproof : linear_for s (g \o f).
2835+ Proof . by move=> *; move=> */=; rewrite !linearP. Qed .
2836+
2837+ HB.instance Definition _ := @GRing.isLinear.Build R E S s (g \o f)
2838+ linfun_comp_subproof.
2839+ (* HB warning : no new instance generated but before we have
2840+ Fail Check ( (g \o f) : {linear E -> F | s}). ? *)
2841+
2842+ End linfun_comp.
2843+
2844+ Section linfun_lmodtype.
2845+ Context {R : numFieldType} {E F G: lmodType R}.
2846+
2847+ Implicit Types (r : R) (f g : {linear E -> F}) (h : {linear F -> G}).
2848+
2849+ Import GRing.Theory.
2850+
2851+ Lemma linfun0 : (\0 : {linear E -> F}) =1 cst 0 :> (_ -> _). Proof . by []. Qed .
2852+
2853+ Lemma linfun_submod_closed : submod_closed (@linfun R E F *:%R).
2854+ Proof .
2855+ split; first by rewrite inE; apply/linearP.
2856+ move=> r /= _ _ /linfunE[f] /linfunE[g].
2857+ by rewrite inE /=; exact: linearP.
2858+ Qed .
2859+
2860+ HB.instance Definition _ :=
2861+ @GRing.isSubmodClosed.Build _ _ linfun linfun_submod_closed.
2862+
2863+ HB.instance Definition _ :=
2864+ [SubChoice_isSubLmodule of {linear E -> F } by <:].
2865+
2866+ End linfun_lmodtype.
0 commit comments