fix(tests/lean/*): fix tests
This commit is contained in:
parent
2beb0030d6
commit
eea4e4ec55
11 changed files with 16 additions and 18 deletions
|
@ -528,7 +528,7 @@ begin
|
||||||
{rewrite add.comm4}
|
{rewrite add.comm4}
|
||||||
end
|
end
|
||||||
|
|
||||||
protected theorem mul_right_distrib (a b c : ℤ) : (a + b) * c = a * c + b * c :=
|
protected theorem right_distrib (a b c : ℤ) : (a + b) * c = a * c + b * c :=
|
||||||
eq_of_repr_equiv_repr
|
eq_of_repr_equiv_repr
|
||||||
(calc
|
(calc
|
||||||
repr ((a + b) * c) = pmul (repr (a + b)) (repr c) : repr_mul
|
repr ((a + b) * c) = pmul (repr (a + b)) (repr c) : repr_mul
|
||||||
|
@ -538,10 +538,10 @@ eq_of_repr_equiv_repr
|
||||||
... = padd (repr (a * c)) (repr (b * c)) : repr_mul
|
... = padd (repr (a * c)) (repr (b * c)) : repr_mul
|
||||||
... ≡ repr (a * c + b * c) : repr_add)
|
... ≡ repr (a * c + b * c) : repr_add)
|
||||||
|
|
||||||
protected theorem mul_left_distrib (a b c : ℤ) : a * (b + c) = a * b + a * c :=
|
protected theorem left_distrib (a b c : ℤ) : a * (b + c) = a * b + a * c :=
|
||||||
calc
|
calc
|
||||||
a * (b + c) = (b + c) * a : int.mul_comm
|
a * (b + c) = (b + c) * a : int.mul_comm
|
||||||
... = b * a + c * a : int.mul_right_distrib
|
... = b * a + c * a : int.right_distrib
|
||||||
... = a * b + c * a : int.mul_comm
|
... = a * b + c * a : int.mul_comm
|
||||||
... = a * b + a * c : int.mul_comm
|
... = a * b + a * c : int.mul_comm
|
||||||
|
|
||||||
|
@ -567,8 +567,8 @@ protected definition integral_domain [reducible] [trans_instance] : algebra.inte
|
||||||
one := 1,
|
one := 1,
|
||||||
one_mul := int.one_mul,
|
one_mul := int.one_mul,
|
||||||
mul_one := int.mul_one,
|
mul_one := int.mul_one,
|
||||||
left_distrib := int.mul_left_distrib,
|
left_distrib := int.left_distrib,
|
||||||
right_distrib := int.mul_right_distrib,
|
right_distrib := int.right_distrib,
|
||||||
mul_comm := int.mul_comm,
|
mul_comm := int.mul_comm,
|
||||||
zero_ne_one := int.zero_ne_one,
|
zero_ne_one := int.zero_ne_one,
|
||||||
eq_zero_or_eq_zero_of_mul_eq_zero := @int.eq_zero_or_eq_zero_of_mul_eq_zero⦄
|
eq_zero_or_eq_zero_of_mul_eq_zero := @int.eq_zero_or_eq_zero_of_mul_eq_zero⦄
|
||||||
|
|
|
@ -406,7 +406,7 @@ calc
|
||||||
a * b div (a * c) = a * (b div c * c + b mod c) div (a * c) : eq_div_mul_add_mod
|
a * b div (a * c) = a * (b div c * c + b mod c) div (a * c) : eq_div_mul_add_mod
|
||||||
|
|
||||||
... = (a * (b mod c) + a * c * (b div c)) div (a * c) :
|
... = (a * (b mod c) + a * c * (b div c)) div (a * c) :
|
||||||
by rewrite [!add.comm, int.mul_left_distrib, mul.comm _ c, -!mul.assoc]
|
by rewrite [!add.comm, int.left_distrib, mul.comm _ c, -!mul.assoc]
|
||||||
... = a * (b mod c) div (a * c) + b div c : !int.add_mul_div_self_left H3
|
... = a * (b mod c) div (a * c) + b div c : !int.add_mul_div_self_left H3
|
||||||
... = 0 + b div c : {!div_eq_zero_of_lt H5 H4}
|
... = 0 + b div c : {!div_eq_zero_of_lt H5 H4}
|
||||||
... = b div c : zero_add
|
... = b div c : zero_add
|
||||||
|
|
|
@ -9,7 +9,6 @@ false.rec_on|Π (C : Type), false → C
|
||||||
false.cases_on|Π (C : Type), false → C
|
false.cases_on|Π (C : Type), false → C
|
||||||
false.induction_on|∀ (C : Prop), false → C
|
false.induction_on|∀ (C : Prop), false → C
|
||||||
true_ne_false|¬true = false
|
true_ne_false|¬true = false
|
||||||
nat.lt_self_iff_false|∀ (n : ℕ), n < n ↔ false
|
|
||||||
not_of_is_false|is_false ?c → ¬?c
|
not_of_is_false|is_false ?c → ¬?c
|
||||||
not_of_iff_false|(?a ↔ false) → ¬?a
|
not_of_iff_false|(?a ↔ false) → ¬?a
|
||||||
is_false|Π (c : Prop) [H : decidable c], Prop
|
is_false|Π (c : Prop) [H : decidable c], Prop
|
||||||
|
|
|
@ -78,8 +78,8 @@ nat.case_strong_induction_on m
|
||||||
take z,
|
take z,
|
||||||
assume Hzx : measure z < measure x,
|
assume Hzx : measure z < measure x,
|
||||||
calc
|
calc
|
||||||
f' m z = restrict default measure f m z : IH m !le.refl z
|
f' m z = restrict default measure f m z : IH m !nat.le_refl z
|
||||||
... = f z : !restrict_lt_eq (lt_of_lt_of_le Hzx (le_of_lt_succ H1))
|
... = f z : !restrict_lt_eq (nat.lt_of_lt_of_le Hzx (le_of_lt_succ H1))
|
||||||
∎,
|
∎,
|
||||||
have H2 : f' (succ m) x = rec_val x f,
|
have H2 : f' (succ m) x = rec_val x f,
|
||||||
proof
|
proof
|
||||||
|
|
|
@ -4,7 +4,7 @@ open nat well_founded decidable prod eq.ops
|
||||||
-- Auxiliary lemma used to justify recursive call
|
-- Auxiliary lemma used to justify recursive call
|
||||||
private definition lt_aux {x y : nat} (H : 0 < y ∧ y ≤ x) : x - y < x :=
|
private definition lt_aux {x y : nat} (H : 0 < y ∧ y ≤ x) : x - y < x :=
|
||||||
and.rec_on H (λ ypos ylex,
|
and.rec_on H (λ ypos ylex,
|
||||||
sub_lt (lt_of_lt_of_le ypos ylex) ypos)
|
sub_lt (nat.lt_of_lt_of_le ypos ylex) ypos)
|
||||||
|
|
||||||
definition wdiv.F (x : nat) (f : Π x₁, x₁ < x → nat → nat) (y : nat) : nat :=
|
definition wdiv.F (x : nat) (f : Π x₁, x₁ < x → nat → nat) (y : nat) : nat :=
|
||||||
if H : 0 < y ∧ y ≤ x then f (x - y) (lt_aux H) y + 1 else zero
|
if H : 0 < y ∧ y ≤ x then f (x - y) (lt_aux H) y + 1 else zero
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
open nat
|
open nat
|
||||||
|
|
||||||
definition lt_of_succ : ∀ {a b : nat}, succ a < b → a < b
|
definition lt_of_succ : ∀ {a b : nat}, succ a < b → a < b
|
||||||
| lt_of_succ (lt.base (succ a)) := lt.trans (lt.base a) (lt.base (succ a))
|
| lt_of_succ (lt.base (succ a)) := nat.lt_trans (lt.base a) (lt.base (succ a))
|
||||||
| lt_of_succ (lt.step h) := lt.step (lt_of_succ h)
|
| lt_of_succ (lt.step h) := lt.step (lt_of_succ h)
|
||||||
|
|
|
@ -8,7 +8,7 @@ nat.cases_on n
|
||||||
(λ (f : Π (m : nat), m < (succ zero) → nat), succ zero)
|
(λ (f : Π (m : nat), m < (succ zero) → nat), succ zero)
|
||||||
(λ (n₂ : nat) (f : Π (m : nat), m < (succ (succ n₂)) → nat),
|
(λ (n₂ : nat) (f : Π (m : nat), m < (succ (succ n₂)) → nat),
|
||||||
have l₁ : succ n₂ < succ (succ n₂), from lt.base (succ n₂),
|
have l₁ : succ n₂ < succ (succ n₂), from lt.base (succ n₂),
|
||||||
have l₂ : n₂ < succ (succ n₂), from lt.trans (lt.base n₂) l₁,
|
have l₂ : n₂ < succ (succ n₂), from nat.lt_trans (lt.base n₂) l₁,
|
||||||
f (succ n₂) l₁ + f n₂ l₂))
|
f (succ n₂) l₁ + f n₂ l₂))
|
||||||
|
|
||||||
definition fib (n : nat) :=
|
definition fib (n : nat) :=
|
||||||
|
|
|
@ -5,13 +5,13 @@ open nat prod sigma
|
||||||
-- g (succ x) := g (g x)
|
-- g (succ x) := g (g x)
|
||||||
definition g.F (x : nat) : (Π y, y < x → Σ r : nat, r ≤ y) → Σ r : nat, r ≤ x :=
|
definition g.F (x : nat) : (Π y, y < x → Σ r : nat, r ≤ y) → Σ r : nat, r ≤ x :=
|
||||||
nat.cases_on x
|
nat.cases_on x
|
||||||
(λ f, ⟨zero, le.refl zero⟩)
|
(λ f, ⟨zero, nat.le_refl zero⟩)
|
||||||
(λ x₁ (f : Π y, y < succ x₁ → Σ r : nat, r ≤ y),
|
(λ x₁ (f : Π y, y < succ x₁ → Σ r : nat, r ≤ y),
|
||||||
let p₁ := f x₁ (lt.base x₁) in
|
let p₁ := f x₁ (lt.base x₁) in
|
||||||
let gx₁ := pr₁ p₁ in
|
let gx₁ := pr₁ p₁ in
|
||||||
let p₂ := f gx₁ (lt_of_le_of_lt (pr₂ p₁) (lt.base x₁)) in
|
let p₂ := f gx₁ (nat.lt_of_le_of_lt (pr₂ p₁) (lt.base x₁)) in
|
||||||
let ggx₁ := pr₁ p₂ in
|
let ggx₁ := pr₁ p₂ in
|
||||||
⟨ggx₁, le_succ_of_le (le.trans (pr₂ p₂) (pr₂ p₁))⟩)
|
⟨ggx₁, le_succ_of_le (nat.le_trans (pr₂ p₂) (pr₂ p₁))⟩)
|
||||||
|
|
||||||
definition g (x : nat) : nat :=
|
definition g (x : nat) : nat :=
|
||||||
pr₁ (well_founded.fix g.F x)
|
pr₁ (well_founded.fix g.F x)
|
||||||
|
|
|
@ -10,4 +10,4 @@ by rewrite ^sub -- unfold sub
|
||||||
definition double (x : int) := x + x
|
definition double (x : int) := x + x
|
||||||
|
|
||||||
theorem double_zero (x : int) : double (0 + x) = (1 + 1)*x :=
|
theorem double_zero (x : int) : double (0 + x) = (1 + 1)*x :=
|
||||||
by rewrite [↑double, zero_add, mul.right_distrib, one_mul]
|
by rewrite [↑double, int.zero_add, int.right_distrib, int.one_mul]
|
||||||
|
|
|
@ -25,7 +25,7 @@ theorem height_lt.node_right {A : Type} (t₁ t₂ : tree A) : height_lt t₂ (n
|
||||||
lt_succ_of_le (le_max_right (height t₁) (height t₂))
|
lt_succ_of_le (le_max_right (height t₁) (height t₂))
|
||||||
|
|
||||||
theorem height_lt.trans {A : Type} : transitive (@height_lt A) :=
|
theorem height_lt.trans {A : Type} : transitive (@height_lt A) :=
|
||||||
inv_image.trans lt height @lt.trans
|
inv_image.trans lt height @nat.lt_trans
|
||||||
|
|
||||||
example : height_lt (leaf (2:nat)) (node (leaf 1) (leaf 2)) :=
|
example : height_lt (leaf (2:nat)) (node (leaf 1) (leaf 2)) :=
|
||||||
!height_lt.node_right
|
!height_lt.node_right
|
||||||
|
|
|
@ -7,7 +7,6 @@ simplification rules for iff
|
||||||
#2, ?M_1 - ?M_2 < succ ?M_1 ↦ true
|
#2, ?M_1 - ?M_2 < succ ?M_1 ↦ true
|
||||||
#1, ?M_1 < 0 ↦ false
|
#1, ?M_1 < 0 ↦ false
|
||||||
#1, ?M_1 < succ ?M_1 ↦ true
|
#1, ?M_1 < succ ?M_1 ↦ true
|
||||||
#1, ?M_1 < ?M_1 ↦ false
|
|
||||||
#1, 0 < succ ?M_1 ↦ true
|
#1, 0 < succ ?M_1 ↦ true
|
||||||
simplification rules for eq
|
simplification rules for eq
|
||||||
#1, g ?M_1 ↦ f ?M_1 + 1
|
#1, g ?M_1 ↦ f ?M_1 + 1
|
||||||
|
|
Loading…
Reference in a new issue