Regex 当没有输入信息时,如何在coq问题中断言(H4:[]=[]+;+;[])?
我被困在下面的证据中,因为我不知道如何证明 断言(H4:[]=[]+[]])。 在下面的最后一行中,因此应用MApp,因为上下文中没有已知的类型信息。 此外,我无法应用前面练习中的app_nil_r,或者如果可以,我不确定如何应用-我正在尝试应用(app_nil_r[])。 有什么建议可以解决这个问题吗 错误:无法推断nil的隐式参数X,其类型在Regex 当没有输入信息时,如何在coq问题中断言(H4:[]=[]+;+;[])?,regex,coq,Regex,Coq,我被困在下面的证据中,因为我不知道如何证明 断言(H4:[]=[]+[]])。 在下面的最后一行中,因此应用MApp,因为上下文中没有已知的类型信息。 此外,我无法应用前面练习中的app_nil_r,或者如果可以,我不确定如何应用-我正在尝试应用(app_nil_r[])。 有什么建议可以解决这个问题吗 错误:无法推断nil的隐式参数X,其类型在 您可以使用显式字符串作为参数应用MApp,以避免歧义: apply (MApp [] _ []). (* Provided the goal is
您可以使用显式字符串作为参数应用
MApp
,以避免歧义:
apply (MApp [] _ []). (* Provided the goal is of the form ([] ++ []) =~ App re0 re1 (i.e., the conclusion of the type of MApp) or [] =~ App re0 re1 *)
(* (this should be fine because ([] ++ []) is definitionally equal to []) *)
断言
[]=[]+[]
是有问题的,因为[]
的类型不明确。此处不需要此断言,但通常可以显式应用nil
构造函数来确定其类型:
assert (@nil ascii = [] ++ []). (* Note: [] is notation for "@nil _", leaving _ to be determined by type inference. All we're doing here is replacing "_" with something explicit. *)
在这种情况下,我会使用一种更强大的策略:
have H: [] ++ [] = [].
这将产生
H: forall T : Type, [::] ++ [::] = [::]
ashave
执行未绑定类型的泛化。这在实践中非常有用
have
在ssreflect
包中,Coq的需要导入ssreflect。
注意,您也可以编写[]=[[]+[]:>列表ascii
。哦,好极了。:>
到底做什么?(在手册中找不到):“x=y:>A”:=(@eq A x y):键入范围。
H: forall T : Type, [::] ++ [::] = [::]