2
函数'f'出现在我的证明中。我需要证明当它的两个参数都是相同的数字时,它等于零。实际上,函数f相当于“大于或等于”函数“geq”。修复条款的减少。 (Coq)
我使用的是https://github.com/HoTT/HoTT库,但很明显问题不是库特定的,所以我在下面做了一个独立的示例。它至少应该可以通过Coq v8.5运行。从库的代码部分:
Local Set Typeclasses Strict Resolution.
Local Unset Elimination Schemes.
Global Set Keyed Unification.
Global Unset Refine Instance Mode.
Global Unset Strict Universe Declaration.
Global Unset Universe Minimization ToSet.
Inductive paths {A : Type} (a : A) : A -> Type :=
idpath : paths a a.
Arguments idpath {A a} , [A] a.
Scheme paths_ind := Induction for paths Sort Type.
Arguments paths_ind [A] a P f y p.
Scheme paths_rec := Minimality for paths Sort Type.
Arguments paths_rec [A] a P f y p.
Definition paths_rect := paths_ind.
Notation "x = y :> A" := (@paths A x y) : type_scope.
Notation "x = y" := (x = y :>_) : type_scope.
Inductive Bool := true | false.
Fixpoint add n m :=
match n with
| 0 => m
| S p => S (add p m)
end.
主要部分:
Definition code_n := (fix code_n (m n : nat) {struct m} : Bool :=
match m with
| 0 =>
match n with
| 0 => true
| S n' =>false
end
| S m' =>
match n with
| 0 => false
| S n' => code_n m' n'
end
end).
Definition f (m:nat) := (fix acc (m0 : nat) : nat :=
match m0 with
| 0 => 0
| S m1 => add (if code_n m1 m then 1 else 0) (acc m1)
end).
Eval compute in f 1 1. (*=0*)
Eval compute in f 1 2. (*=1*)
Eval compute in f 2 2. (*=0*)
Fixpoint impprf (m:nat): f m m = 0. (*How to prove it??*)
作为第一步,它很容易证明,当它的两个参数相等,即code_n是正确的:
Fixpoint code_n_eq (v : nat): (code_n v v) = true
:= match v as n return (code_n n n = true) with
| 0 => @idpath Bool true
| S v0 => code_n_eq v0
end.
第二步:问题可能会重新形成为证明
code_n_eq (S m) (S m) = code_n_eq m m.
或者,也许,这
(0 = code_n_eq m m)-> (0 = code_n_eq (S m) (S m)).
(+)。我会尝试用这种方法重写证明。 –
你的意思是什么? –
(欧米茄与“Hoq”不符......) –