Last active
February 18, 2018 12:56
-
-
Save yoshihiro503/1886630cf8b5a633d39e53f3a3bf3de6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Require Import Arith List. | |
Import ListNotations. | |
Fixpoint range_aux (a len: nat) : list nat := | |
match len with | |
| O => [] | |
| S len' => a :: range_aux (S a) len' | |
end. | |
Definition range (a b: nat) : list nat := range_aux a (b - a + 1). | |
Lemma range_Forall : forall a b, | |
Forall (fun x => a <= x <= b) (range a b). | |
Proof. | |
(* 未解決 *) | |
Admitted. |
おお!ありがとうございます!
(b + 1 - a)
の方針に修正します!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Definition range (a b: nat) : list nat := range_aux a (b + 1 - a). (* -aの位置を後ろにずらした *)
にしないと b < a のときにrange_auxがaのリストを作るのでrange_Forallが成り立ちません。
(Eval compute in (range 4 3). では[4]が出ます)
rangeの定義を上のものに変更するか、range_Forallの前提にa <= bを入れる必要があります。