- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
考虑下面定义的函数。它的作用并不重要。
Require Import Ring.
Require Import Vector.
Require Import ArithRing.
Fixpoint
ScatHUnion_0 {A} (n:nat) (pad:nat) : t A n -> t (option A) ((S pad) * n).
refine (
match n return (t A n) -> (t (option A) ((S pad)*n)) with
| 0 => fun _ => (fun H => _)(@nil (option A))
| S p =>
fun a =>
let foo := (@ScatHUnion_0 A p pad (tl a)) in
(fun H => _) (cons _ (Some (hd a)) _ (append (const None pad) foo))
end
).
rewrite <-(mult_n_O (S pad)); auto.
replace (S pad * S p) with ( (S (pad + S pad * p)) ); auto; ring.
Defined.
Lemma test0: @ScatHUnion_0 nat 0 0 ( @nil nat) = ( @nil (option nat)).
simpl. unfold eq_rect_r. unfold eq_rect.
match mult_n_O 1 in (_ = y) return (t (option nat) y) with
| eq_refl => nil (option nat)
end = nil (option nat)
apply trans_eq with (Vector.const (@None nat) (1 * 0)); auto.
destruct (mult_n_O 1); auto.
destruct
不起作用(有关错误消息,请参见下文)。但是,如果我首先在引理中甚至用
assert
证明完全相同的目标在证明里面,我可以应用和解决它,像这样:
Lemma test1: @ScatHUnion_0 nat 0 0 ( @nil nat) = ( @nil (option nat)).
simpl. unfold eq_rect_r. unfold eq_rect.
assert (
match mult_n_O 1 in (_ = y) return (t (option nat) y) with
| eq_refl => nil (option nat)
end = nil (option nat)
) as H.
{
apply trans_eq with (Vector.const (@None nat) (1 * 0)); auto.
destruct (mult_n_O 1); auto.
}
apply H.
Qed.
Toplevel input, characters 0-21:
Error: Abstracting over the terms "n" and "e" leads to a term
"fun (n : nat) (e : 0 = n) =>
match e in (_ = y) return (t (option nat) y) with
| eq_refl => nil (option nat)
end = const None n" which is ill-typed.
Error: Abstracting over the terms "n" and "e" leads to a term
fun (n0 : nat) (e0 : 0 = n0) =>
match e0 in (_ = y) return (t (option nat) y) with
| eq_refl => nil (option nat)
end = const None n0
which is ill-typed.
Reason is: Illegal application:
The term "@eq" of type "forall A : Type, A -> A -> Prop"
cannot be applied to the terms
"t (option nat) 0" : "Set"
"match e0 in (_ = y) return (t (option nat) y) with
| eq_refl => nil (option nat)
end" : "t (option nat) n0"
"const None n0" : "t (option nat) n0"
The 2nd term has type "t (option nat) n0" which should be coercible to
"t (option nat) 0".
最佳答案
@Vinz 回答解释了原因,并建议 Set Printing All.
这显示了区别是什么。问题是 simpl.
简化了 match
的返回类型.使用 unfold ScatHUnion_0.
而不是 simpl.
使我能够直接在目标上使用 destruct。
从根本上说,我的麻烦源于我想说服类型系统0=0
与 0=1*0
相同. (顺便说一句,我仍然不知道这样做的最佳方法。)我使用的是 mult_n_O
来证明这一点,但它是不透明的,因此在检查两种类型是否相等时,类型系统无法展开它。
当我用自己的 Fixpoint
替换它时变体(不是不透明的),
Fixpoint mult_n_O n: 0 = n*0 :=
match n as n0 return (0 = n0 * 0) with
| 0 => eq_refl
| S n' => mult_n_O n'
end.
ScatHUnion_0
的定义中使用它,引理很容易证明:
Lemma test0: @ScatHUnion_0 nat 0 0 ( @nil nat) = ( @nil (option nat)).
reflexivity.
Qed.
mult_n_O
的证明定义。它基于
proof by Jason Gross .
mult_n_O 1
的类型成为
0=0
通过使用
generalize
.它使用
set
修改术语的隐含部分,例如
eq_refl
中的类型,仅在
Set Printing All.
之后可见命令。
change
也可以这样做,但是
replace
和
rewrite
似乎无法做到这一点。
Lemma test02:
match mult_n_O 1 in (_ = y) return (t (option nat) y) with
| eq_refl => nil (option nat)
end = nil (option nat).
Proof.
Set Printing All.
generalize (mult_n_O 1 : 0=0).
simpl.
set (z:=0) at 2 3.
change (nil (option nat)) with (const (@None nat) z) at 2.
destruct e.
reflexivity.
Qed.
Lemma test03:
match mult_n_O 1 in (_ = y) return (t (option nat) y) with
| eq_refl => nil (option nat)
end = nil (option nat).
Proof.
replace (mult_n_O 1) with (@eq_refl nat 0);
auto using Peano_dec.UIP_nat.
Qed.
关于coq - 为什么有时我可以通过引理证明目标,但不能直接证明?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30683347/
如果我在 C 中调用一个函数并传入一个结构(对那些 C++ 读者来说不是通过指针或引用),它会复制该对象。如果我传入一个包含数组的结构,它会复制该数组(如教授在类里面所说)。但是,如果我传入一个包含对
在 vim 等中,您可以使用 CTRLA 和 CTRLX 增加或减少光标所在的数字。然而,这会增加总数,但我想简单地增加光标正下方的数字。这有点难以描述,所以这就是我的意思: Ctrl+A usage
我正在将 Spring 4.3.2 项目升级到 Spring 5.1.5。我的一个测试用例开始因错误而失败。 ClassNotFoundException: org.hibernate.propert
我想在 Java 中分配一个直接 IntBuffer,比如说 10 亿个元素(64 位系统)。我知道的唯一方法是创建一个直接 ByteBuffer 并将其视为直接 IntBuffer。但是,4*1,0
我正在寻找特定的打印机或某些打印机上存在的技术(接口(interface)、标准、协议(protocol)),这使得可以使用 AJAX 从 Web 浏览器实现直接打印。 这意味着打印机必须: 网络接口
我正在寻求实现删除确认表单的最佳实践建议。 除其他选项外,以下页面包含删除按钮... /website/features/f/123 ...当点击一个简单的表单时,会在以下 url 下加载: /web
我正在使用直接 Web 远程处理库在我的应用程序中执行一些 ajax 调用。我有一个问题,我认为归结为服务调用的延迟响应。以下是我认为有问题的部分代码。问题出在 getDefaultReviewerT
我想替换 Javascript confirm() 函数以允许自定义按钮而不是 Yes/Cancel。我尝试搜索,但所有解决方案都是事件驱动的,例如 jquery 对话框(代码不等待响应但它是事件驱动
我知道有几个类似的问题,但是,其中的示例并没有说明问题,或者我无法从中获利 - 我真可耻。 所以我的问题是在带有 GUI 的简单应用程序中加载图像。例如: 我在 "D:\javaeclipseprog
我想用不同的颜色为表格的行着色,所以我正在使用它 table#news tr:nth-child(even) { background-color: red; } table#news
下面的测试代码不起作用 from("direct:start").setExchangePattern(ExchangePattern.InOnly).threads(5).delay(2000).b
我在 python 中实现的第一个项目之一是对棒渗流进行蒙特卡罗模拟。代码不断增长。第一部分是棍子渗滤的可视化。在宽度*长度的区域中,使用随机起始坐标和方向绘制具有一定长度的直棒的定义密度(棒/面积)
跟踪直接文件下载的最佳方法是什么?我找到了一些解决方案,例如这个: http://www.gayadesign.com/diy/download-counter-in-php-using-htacce
我在一个线程中有一个直接的 ByteBuffer(堆外),并使用 JMM 给我的一种机制将它安全地发布到另一个线程。 happens-before 关系是否扩展到由 ByteBuffer 包装的 na
当我测试直接 java.nio.ByteBuffer 的读取性能时,我注意到绝对读取平均比相对读取快 2 倍。此外,如果我比较相对读取与绝对读取的源代码,除了相对读取维护和内部计数器外,代码几乎相同。
我知道这个问题已经被问了无数次,并且在很多情况下都得到了答案。我相信我已经阅读了其中的大部分内容。不幸的是,我在这上面能找到的一切 简单说明 ElementRef.nativeElement不好,不要
回到一些 C 语言工作。 我的许多函数看起来像这样: int err = do_something(arg1, arg2, arg3, &result); 根据意图,结果由函数填充,返回值是调用的状态
当我将 XML 提交到 https://secure-test.WorldPay.com/jsp/merchant/xml/paymentService.jsp 时: Personalised
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
我的 Angular 路由行为有问题。刷新或输入的 url 像/user 总是将我重定向到/home。我还在 index.html 文件中设置了 。通过单击导航菜单按钮一切正常。但是一旦我尝试刷新页面
我是一名优秀的程序员,十分优秀!