fix(tests/lean/extra/show_goal_bag): adjust test to recent changes in the standard library
This commit is contained in:
parent
9ff0097223
commit
0309a1e131
2 changed files with 20 additions and 18 deletions
|
@ -302,7 +302,7 @@ private lemma max_count_eq (l₁ l₂ : list A) : ∀ {a : A} {l : list A}, a
|
|||
end)
|
||||
(suppose i : ¬ list.count a l₁ ≥ list.count a l₂, begin
|
||||
unfold max_count, subst b,
|
||||
rewrite [if_neg i, list.count_append, count_gen, max_eq_right' (lt_of_not_ge i), count_eq_zero_of_not_mem `a ∉ max_count l₁ l₂ l`]
|
||||
rewrite [if_neg i, list.count_append, count_gen, max_eq_right_of_lt (lt_of_not_ge i), count_eq_zero_of_not_mem `a ∉ max_count l₁ l₂ l`]
|
||||
end))
|
||||
(suppose a ∈ l,
|
||||
assert a ≠ b, from suppose a = b, by subst b; contradiction,
|
||||
|
@ -516,10 +516,10 @@ calc empty ∩ b = b ∩ empty : inter.comm
|
|||
|
||||
lemma append_union_inter (b₁ b₂ : bag A) : (b₁ ∪ b₂) ++ (b₁ ∩ b₂) = b₁ ++ b₂ :=
|
||||
bag.ext (λ a, begin
|
||||
rewrite [*count_append, count_inter, count_union], unfold [max, min],
|
||||
apply (@by_cases (count a b₁ < count a b₂)),
|
||||
{ intro H, rewrite [*if_pos H, add.comm] },
|
||||
{ intro H, rewrite [*if_neg H, add.comm] }
|
||||
rewrite [*count_append, count_inter, count_union],
|
||||
apply (or.elim (lt_or_ge (count a b₁) (count a b₂))),
|
||||
{ intro H, rewrite [min_eq_left_of_lt H, max_eq_right_of_lt H, add.comm] },
|
||||
{ intro H, rewrite [min_eq_right H, max_eq_left H, add.comm] }
|
||||
end)
|
||||
|
||||
lemma inter.left_distrib (b₁ b₂ b₃ : bag A) : b₁ ∩ (b₂ ∪ b₃) = (b₁ ∩ b₂) ∪ (b₁ ∩ b₃) :=
|
||||
|
@ -531,22 +531,22 @@ bag.ext (λ a, begin
|
|||
have H₁₃ : count a b₁ ≤ count a b₃, from le.trans H₁₂ H₂₃,
|
||||
rewrite [max_eq_right H₂₃, min_eq_left H₁₂, min_eq_left H₁₃, max_self]},
|
||||
{ intro H₂₃,
|
||||
rewrite [min_eq_left H₁₂, max.comm, max_eq_right' (lt_of_not_ge H₂₃) ],
|
||||
rewrite [min_eq_left H₁₂, max.comm, max_eq_right_of_lt (lt_of_not_ge H₂₃) ],
|
||||
apply (@by_cases (count a b₁ ≤ count a b₃)),
|
||||
{ intro H₁₃, rewrite [min_eq_left H₁₃, max_self, min_eq_left H₁₂] },
|
||||
{ intro H₁₃,
|
||||
rewrite [min.comm (count a b₁) (count a b₃), min_eq_left' (lt_of_not_ge H₁₃),
|
||||
min_eq_left H₁₂, max.comm, max_eq_right' (lt_of_not_ge H₁₃)]}}},
|
||||
rewrite [min.comm (count a b₁) (count a b₃), min_eq_left_of_lt (lt_of_not_ge H₁₃),
|
||||
min_eq_left H₁₂, max.comm, max_eq_right_of_lt (lt_of_not_ge H₁₃)]}}},
|
||||
{ intro H₁₂, apply (@by_cases (count a b₂ ≤ count a b₃)),
|
||||
{ intro H₂₃,
|
||||
rewrite [max_eq_right H₂₃],
|
||||
apply (@by_cases (count a b₁ ≤ count a b₃)),
|
||||
{ intro H₁₃, rewrite [min_eq_left H₁₃, min.comm, min_eq_left' (lt_of_not_ge H₁₂), max_eq_right' (lt_of_not_ge H₁₂)] },
|
||||
{ intro H₁₃, rewrite [min.comm, min_eq_left' (lt_of_not_ge H₁₃), min.comm, min_eq_left' (lt_of_not_ge H₁₂), max_eq_right H₂₃] } },
|
||||
{ intro H₁₃, rewrite [min_eq_left H₁₃, min.comm, min_eq_left_of_lt (lt_of_not_ge H₁₂), max_eq_right_of_lt (lt_of_not_ge H₁₂)] },
|
||||
{ intro H₁₃, rewrite [min.comm, min_eq_left_of_lt (lt_of_not_ge H₁₃), min.comm, min_eq_left_of_lt (lt_of_not_ge H₁₂), max_eq_right H₂₃] } },
|
||||
{ intro H₂₃,
|
||||
have H₁₃ : count a b₁ > count a b₃, from lt.trans (lt_of_not_ge H₂₃) (lt_of_not_ge H₁₂),
|
||||
rewrite [max.comm, max_eq_right' (lt_of_not_ge H₂₃), min.comm, min_eq_left' (lt_of_not_ge H₁₂)],
|
||||
rewrite [min.comm, min_eq_left' H₁₃, max.comm, max_eq_right' (lt_of_not_ge H₂₃)] } }
|
||||
rewrite [max.comm, max_eq_right_of_lt (lt_of_not_ge H₂₃), min.comm, min_eq_left_of_lt (lt_of_not_ge H₁₂)],
|
||||
rewrite [min.comm, min_eq_left_of_lt H₁₃, max.comm, max_eq_right_of_lt (lt_of_not_ge H₂₃)] } }
|
||||
end)
|
||||
|
||||
lemma inter.right_distrib (b₁ b₂ b₃ : bag A) : (b₁ ∪ b₂) ∩ b₃ = (b₁ ∩ b₃) ∪ (b₂ ∩ b₃) :=
|
||||
|
@ -620,10 +620,10 @@ open decidable
|
|||
|
||||
lemma union_subbag_append (b₁ b₂ : bag A) : b₁ ∪ b₂ ⊆ b₁ ++ b₂ :=
|
||||
subbag.intro (take a, begin
|
||||
rewrite [count_append, count_union], unfold max,
|
||||
exact by_cases
|
||||
(suppose count a b₁ < count a b₂, by rewrite [if_pos this]; apply le_add_left)
|
||||
(suppose ¬ count a b₁ < count a b₂, by rewrite [if_neg this]; apply le_add_right)
|
||||
rewrite [count_append, count_union],
|
||||
exact (or.elim !lt_or_ge)
|
||||
(suppose count a b₁ < count a b₂, by rewrite [max_eq_right_of_lt this]; apply le_add_left)
|
||||
(suppose count a b₁ ≥ count a b₂, by rewrite [max_eq_left this]; apply le_add_right)
|
||||
end)
|
||||
|
||||
lemma subbag_insert (a : A) (b : bag A) : b ⊆ insert a b :=
|
||||
|
|
|
@ -18,8 +18,10 @@ while [ $i -lt $size ]; do
|
|||
let i=i+1
|
||||
produced=bag.$line.$col.produced.out
|
||||
expected=bag.$line.$col.expected.out
|
||||
$LEAN --line=$line --col=$col --goal bag.lean &> $produced
|
||||
cp $produced $expected
|
||||
if ! $LEAN --line=$line --col=$col --goal bag.lean &> $produced; then
|
||||
echo "ERROR: lean failed"
|
||||
exit 1
|
||||
fi
|
||||
if test -f $expected; then
|
||||
if diff --ignore-all-space -I "executing external script" "$produced" "$expected"; then
|
||||
echo "-- checked"
|
||||
|
|
Loading…
Reference in a new issue