我对closed_subspace_equiv
有以下定义library(dplyr)
library(tidyr)
foo <- data.frame(comb=replicate(10,
paste(paste(sample(LETTERS, 4), collapse=''),
sample(c('p', 'n'), 1),
sample(1:100, 1),
paste(sample(letters, 2), collapse=''),
sep='.')
),
num = sample(1:10, 10, replace=T))
我想要的是
Record Closed_Subspace (V:Normed_Space) := {
closed_subspace :> V -> Prop;
addition_closure : forall (x y:V),(closed_subspace x) -> (closed_subspace y) -> (closed_subspace (add V x y));
smul_closure : forall (x:V) (a:R),(closed_subspace x) -> (closed_subspace (scalar_mul V a x));
subspace_closure : forall (x:V), closure (closed_subspace) x <-> closed_subspace x}.
Definition closed_subspace_equiv {V : Normed_Space} (U:Closed_Subspace V) (x y:V) (p:U x)(q:U y) := exists z:V,(add V x z = y) /\ (U z).
我该怎么做?
对于上下文,这里是Normed_Space。
Definition closed_subspace_equiv {V : Normed_Space} (U:Closed_Subspace V) (x y:U) := exists z:U,(add V x z = y).
答案 0 :(得分:2)
V
参数可以移动到记录正文中,使用:>
语法自动创建强制。
Record Closed_Subspace := {
normed_space :> Normed_Space;
closed_subspace :> normed_space -> Prop;
addition_closure : forall x y:normed_space, closed_subspace x -> closed_subspace y -> closed_subspace (add normed_space x y);
smul_closure : forall (x:normed_space) (a:R), closed_subspace x -> closed_subspace (scalar_mul normed_space a x);
subspace_closure : forall x:normed_space, closure (closed_subspace) x <-> closed_subspace x
}.
现在你的第二个定义有效:
Definition closed_subspace_equiv (U:Closed_Subspace) (x y:U) :=
exists z:U, add _ x z = y.
保留参数V
的另一种方法是定义Closed_Subspace
,如下所示:
Record Closed_Subspace (V:Normed_Space) : Type := {
normed_space := V;
closed_subspace :> V -> Prop;
addition_closure : forall x y:V, closed_subspace x -> closed_subspace y -> closed_subspace (add V x y);
smul_closure : forall (x:V) (a:R), closed_subspace x -> closed_subspace (scalar_mul V a x);
subspace_closure : forall (x:V), closure (closed_subspace) x <-> closed_subspace x
}.
手动添加必要的强制:
Coercion normed_space : Closed_Subspace >-> Normed_Space.