I am using the Mathematical Components library and I am trying to prove this:
Lemma card_sub_ord (k : nat) (P : nat -> bool) :
#|[set i : 'I_k | P i]| <= k.
Proof.
set S := [set i : 'I_k | P i].
have H1 : S \subset 'I_k.
by apply: subset_predT.
have H2 : #|S| <= #|'I_k|.
by apply: subset_leq_card.
have H3 : k = #|'I_k|.
by rewrite card_ord.
(* Only goal left: #|S| <= k *)
rewrite H3 (* <--- this fails *)
Admitted.
The last rewrite fails with an error message:
Error: dependent type error in rewrite of
(fun _pattern_value_ : nat => is_true (#|S| <= _pattern_value_)
Any idea on why the rewrite fails or an explanation of this error message?