This commit is contained in:
Thomas Baruchel 2022-11-22 22:22:50 +01:00
parent 47a1c275cc
commit abfb4f4166

View File

@ -882,17 +882,22 @@ Qed.
(*
Lemma nth_error_app : forall (l1 l2 : list bool) (k : nat),
nth_error (l1 ++ l2) (k + length l1) = nth_error l2 k.
Lemma tm_step_next_range :
forall (n : nat) (l1 l2 : list bool) (b : bool),
tm_step n = l1 ++ b :: l2
-> nth_error (tm_step (S n)) (length l1) = Some b.
Proof.
nth_error_app2:
forall [A : Type] (l l' : list A) [n : nat],
length l <= n -> nth_error (l ++ l') n = nth_error l' (n - length l)
intros n l1 l2 b. intros H.
assert (nth_error (tm_step n) (length l1) = Some b).
generalize H. apply list_concat_to_pos.
rewrite tm_build.
rewrite nth_error_app1.
*)
Lemma tm_step_next_range :
Lemma tm_step_next_range2 :
forall (n : nat) (l1 l2 : list bool) (b : bool),
tm_step n = l1 ++ b :: l2
-> nth_error (tm_step (S n)) (length l1 + 2^n) = Some (negb b).
@ -903,8 +908,7 @@ Proof.
rewrite tm_build.
assert (I: length l1 < 2^n).
rewrite <- tm_size_power2. generalize H. apply list_app_length_lt.
rewrite nth_error_app2. rewrite <- tm_size_power2.
replace (length l1 + length (tm_step n) - length (tm_step n)) with (length l1).
rewrite nth_error_app2. rewrite tm_size_power2.