id string | source string | formal_statement string | header string | lean4_code string | has_proof bool | proof_body string | natural_language null | lean_version string | split string | tags list | category null | metadata string | verification string | v4210_is_valid bool | v4210_compiles bool | v4210_has_sorry bool | v4210_latency_s float64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
compfiles_Bulgaria1998P1 | compfiles | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# Bulgarian Mathematical Olympiad 1998, Problem 1
We will be considering colorings in 2 colors of n (distinct) points
A₁, A₂, ..., Aₙ. Call such a coloring "good" if there exist three points
Aᵢ, Aⱼ, A₂ⱼ₋ᵢ, 1 ≤ i < 2j - i ≤ n, which are colored the same color.
Find the least natural number n (n ≥ 3) such that all colorings
of n points are good.
-/
namespace Bulgaria1998P1
abbrev coloring_is_good {m : ℕ} (color : Set.Icc 1 m → Fin 2) : Prop :=
∃ i j : Set.Icc 1 m,
i < j ∧
∃ h3 : 2 * j.val - i ∈ Set.Icc 1 m,
color i = color j ∧ color i = color ⟨2 * j - i, h3⟩
abbrev all_colorings_are_good (m : ℕ) : Prop :=
3 ≤ m ∧ ∀ color : Set.Icc 1 m → Fin 2, coloring_is_good color
lemma lemma1 {m n : ℕ} (hmn : m ≤ n) (hm : all_colorings_are_good m) :
all_colorings_are_good n := by
constructor
· exact hm.1.trans hmn
· intro c
let c' : Set.Icc 1 m → Fin 2 :=
fun x ↦ c ⟨x.val, by rw [Set.mem_Icc]; exact ⟨x.prop.1, x.prop.2.trans hmn⟩⟩
obtain ⟨⟨i, hi1, hi2⟩, ⟨j, hj1, hj2⟩, hij1, hij2, hc1, hc2⟩ := hm.2 c'
use ⟨i, hi1, hi2.trans hmn⟩
use ⟨j, hj1, hj2.trans hmn⟩
simp only [Subtype.mk_lt_mk, Set.mem_Icc, tsub_le_iff_right, exists_and_left]
simp only [Subtype.mk_lt_mk] at hij1
refine ⟨hij1, ?_⟩
simp only [Set.mem_Icc, tsub_le_iff_right] at hij2
simp only [c'] at hc1
refine ⟨hc1, ?_⟩
have hij2' : 1 ≤ 2 * j - i ∧ 2 * j ≤ n + i :=
⟨hij2.1, le_add_of_le_add_right hij2.2 hmn⟩
use hij2'
def coloring_of_eight {n : ℕ} : Set.Icc 1 n → Fin 2
| ⟨1, _⟩ => 0
| ⟨2, _⟩ => 1
| ⟨3, _⟩ => 0
| ⟨4, _⟩ => 1
| ⟨5, _⟩ => 1
| ⟨6, _⟩ => 0
| ⟨7, _⟩ => 1
| ⟨8, _⟩ => 0
| _ => 0 -- unreachable
lemma lemma2 :
∃ f : Set.Icc 1 8 → Fin 2, ¬coloring_is_good f := by
use coloring_of_eight
intro h
obtain ⟨⟨i, hi1, hi2⟩, ⟨j, hj1, hj2⟩, hij1, hij2, hc1, hc2⟩ := h
dsimp [coloring_of_eight] at *
interval_cases i <;> interval_cases j <;> sorry --aesop (simp_config := {decide := true})
abbrev solution_value : ℕ := 9
theorem bulgaria1998_p1 : IsLeast { m | all_colorings_are_good m } solution_value := by
constructor
· rw [Set.mem_setOf_eq]
refine ⟨by norm_num, ?_⟩
intro color
sorry
· rw [mem_lowerBounds]
intro n hn
rw [Set.mem_setOf_eq] at hn
by_contra! H
have h1 : n ≤ solution_value - 1 := Nat.le_pred_of_lt H
have ⟨h2, h3⟩ := lemma1 h1 hn
obtain ⟨f, hf⟩ := lemma2
exact (hf (h3 f)).elim
end Bulgaria1998P1 | /- | /-
Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# Bulgarian Mathematical Olympiad 1998, Problem 1
We will be considering colorings in 2 colors of n (distinct) points
A₁, A₂, ..., Aₙ. Call such a coloring "good" if there exist three points
Aᵢ, Aⱼ, A₂ⱼ₋ᵢ, 1 ≤ i < 2j - i ≤ n, which are colored the same color.
Find the least natural number n (n ≥ 3) such that all colorings
of n points are good.
-/
namespace Bulgaria1998P1
abbrev coloring_is_good {m : ℕ} (color : Set.Icc 1 m → Fin 2) : Prop :=
∃ i j : Set.Icc 1 m,
i < j ∧
∃ h3 : 2 * j.val - i ∈ Set.Icc 1 m,
color i = color j ∧ color i = color ⟨2 * j - i, h3⟩
abbrev all_colorings_are_good (m : ℕ) : Prop :=
3 ≤ m ∧ ∀ color : Set.Icc 1 m → Fin 2, coloring_is_good color
lemma lemma1 {m n : ℕ} (hmn : m ≤ n) (hm : all_colorings_are_good m) :
all_colorings_are_good n := by
constructor
· exact hm.1.trans hmn
· intro c
let c' : Set.Icc 1 m → Fin 2 :=
fun x ↦ c ⟨x.val, by rw [Set.mem_Icc]; exact ⟨x.prop.1, x.prop.2.trans hmn⟩⟩
obtain ⟨⟨i, hi1, hi2⟩, ⟨j, hj1, hj2⟩, hij1, hij2, hc1, hc2⟩ := hm.2 c'
use ⟨i, hi1, hi2.trans hmn⟩
use ⟨j, hj1, hj2.trans hmn⟩
simp only [Subtype.mk_lt_mk, Set.mem_Icc, tsub_le_iff_right, exists_and_left]
simp only [Subtype.mk_lt_mk] at hij1
refine ⟨hij1, ?_⟩
simp only [Set.mem_Icc, tsub_le_iff_right] at hij2
simp only [c'] at hc1
refine ⟨hc1, ?_⟩
have hij2' : 1 ≤ 2 * j - i ∧ 2 * j ≤ n + i :=
⟨hij2.1, le_add_of_le_add_right hij2.2 hmn⟩
use hij2'
def coloring_of_eight {n : ℕ} : Set.Icc 1 n → Fin 2
| ⟨1, _⟩ => 0
| ⟨2, _⟩ => 1
| ⟨3, _⟩ => 0
| ⟨4, _⟩ => 1
| ⟨5, _⟩ => 1
| ⟨6, _⟩ => 0
| ⟨7, _⟩ => 1
| ⟨8, _⟩ => 0
| _ => 0 -- unreachable
lemma lemma2 :
∃ f : Set.Icc 1 8 → Fin 2, ¬coloring_is_good f := by
use coloring_of_eight
intro h
obtain ⟨⟨i, hi1, hi2⟩, ⟨j, hj1, hj2⟩, hij1, hij2, hc1, hc2⟩ := h
dsimp [coloring_of_eight] at *
interval_cases i <;> interval_cases j <;> sorry --aesop (simp_config := {decide := true})
abbrev solution_value : ℕ := 9
theorem bulgaria1998_p1 : IsLeast { m | all_colorings_are_good m } solution_value := by
constructor
· rw [Set.mem_setOf_eq]
refine ⟨by norm_num, ?_⟩
intro color
sorry
· rw [mem_lowerBounds]
intro n hn
rw [Set.mem_setOf_eq] at hn
by_contra! H
have h1 : n ≤ solution_value - 1 := Nat.le_pred_of_lt H
have ⟨h2, h3⟩ := lemma1 h1 hn
obtain ⟨f, hf⟩ := lemma2
exact (hf (h3 f)).elim
end Bulgaria1998P1
| false | null | null | v4.29.0-rc6 | test | [
"competition"
] | null | {"filename": "Bulgaria1998P1.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": true, "errors": [], "timeout_s": 600.0, "latency_s": 34.5438, "verified_at": "2026-03-26T18:15:55.711664+00:00"}} | false | true | true | 34.5438 |
compfiles_Bulgaria1998P11 | compfiles | Copyright (c) 2023 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw, Adam Kurkiewicz
-/
import Mathlib
/-!
Bulgarian Mathematical Olympiad 1998, Problem 11
Let m,n be natural numbers such that
A = ((m + 3)ⁿ + 1) / (3m)
is an integer. Prove that A is odd.
-/
namespace Bulgaria1998P11
lemma mod_3_add_3_under_exponent (m n : ℕ) : ((m + 3) ^ n) ≡ (m ^ n) [MOD 3] := by
change (m + 3)^n % 3 = m ^ n % 3
simp [Nat.pow_mod]
lemma zero_pow_mod_3 {m n : ℕ} (h1 : n > 0) (h2 : m ≡ 0 [MOD 3]) : m ^ n ≡ 0 [MOD 3]:= by
change _ % 3 = 0 at h2 ⊢
rw [←Nat.dvd_iff_mod_eq_zero] at h2 ⊢
exact Dvd.dvd.pow h2 (Nat.ne_zero_of_lt h1)
lemma one_pow_mod_3 {m n : ℕ} (h2 : m ≡ 1 [MOD 3]) : m ^ n ≡ 1 [MOD 3]:= by
change _ % _ = 1 at h2 ⊢
simp [Nat.pow_mod, h2]
lemma two_even_pow_mod_3 {m n : ℕ} (h1 : Even n) (h2 : m ≡ 2 [MOD 3]) : m ^ n ≡ 1 [MOD 3] := by
change _ % _ = _ at h2 ⊢
obtain ⟨k, hk⟩ := h1
simp (config := { arith := true, decide := true }) [Nat.pow_mod, h2, hk, pow_mul]
theorem n_odd_and_m_eq_2_mod_3 (m n A : ℕ) (h : 3 * m * A = (m + 3)^n + 1) :
Odd n ∧ m ≡ 2 [MOD 3] := by
by_cases n_gt_zero : n > 0
· have h_mod_3 : 0 ≡ (m ^ n + 1) [MOD 3] := by
calc 0 ≡ 3 * (m * A) [MOD 3] := (Nat.mul_mod_right 3 (m * A)).symm
_ ≡ (3 * m * A) [MOD 3] := by rw[show 3 * (m * A) = (3 * m * A) by ring]
_ ≡ ((m + 3) ^ n + 1) [MOD 3] := by rw[h]
_ ≡ (m ^ n + 1) [MOD 3] := Nat.ModEq.add (mod_3_add_3_under_exponent m n) rfl
mod_cases mod_case : m % 3
· have towards_contradiction : 0 ≡ 1 [MOD 3] := by
calc 0 ≡ m ^ n + 1 [MOD 3] := h_mod_3
_ ≡ 0 + 1 [MOD 3] := Nat.ModEq.add (zero_pow_mod_3 n_gt_zero mod_case) rfl
_ ≡ 1 [MOD 3] := by rfl
contradiction
· have towards_contradiction : 0 ≡ 2 [MOD 3] := by
rw[show 2 = 1 + 1 by ring]
calc 0 ≡ m ^ n + 1 [MOD 3] := h_mod_3
_ ≡ 1 + 1 [MOD 3] := Nat.ModEq.add (one_pow_mod_3 mod_case) rfl
contradiction
· by_cases n_even : Even n
· have towards_contradiction : 0 ≡ 2 [MOD 3] := by
calc 0 ≡ m ^ n + 1 [MOD 3] := h_mod_3
_ ≡ 1 + 1 [MOD 3] := Nat.ModEq.add (two_even_pow_mod_3 n_even mod_case) rfl
_ ≡ 2 [MOD 3] := by rfl
contradiction
· rw [Nat.not_even_iff_odd] at n_even
exact ⟨n_even, mod_case⟩
· rw [Nat.eq_zero_of_not_pos n_gt_zero] at h
omega
lemma not_one_le_k {k : ℕ} (h : ¬1 ≤ k) : k = 0 := by
simp_all only [not_le, Nat.lt_one_iff]
lemma two_le_pow_two (l : ℕ) : 2 ≤ 2 ^ (l + 1) := by
rw [pow_succ]
suffices 1 ≤ 2 ^ l from Nat.le_mul_of_pos_left 2 this
exact Nat.one_le_two_pow
lemma two_n_and_rest_factorisation (m : ℕ) (even_m : Even m) (h: 0 < m) :
∃ (l : ℕ) (m₁ : ℕ), 1 ≤ l ∧ Odd m₁ ∧ m = 2 ^ l * m₁ := by
have ⟨a, ha⟩ := (pow_padicValNat_dvd : 2 ^ padicValNat 2 m ∣ m)
refine ⟨padicValNat 2 m, a, ?_⟩
obtain ⟨k, hk⟩ := even_iff_two_dvd.mp even_m
have hk0 : 0 < k := by omega
refine ⟨?_, ?_, ha⟩
· rw [hk]
rw [show 2 * k = 2^1 * k from rfl]
rw [padicValNat_base_pow_mul one_lt_two hk0.ne']
exact Nat.le_add_left 1 (padicValNat 2 k)
· by_contra! Ha
rw [Nat.not_odd_iff_even] at Ha
obtain ⟨b, hb⟩ := Ha
have h3 : 2 ^ (padicValNat 2 m + 1) ∣ m := by
use b
rw [hb] at ha
rw [pow_succ]
linarith only [ha]
have h4 := (Nat.pow_dvd_iff_le_padicValNat (by omega) (Nat.ne_zero_of_lt h)).mp h3
exact (lt_self_iff_false _).mp (Nat.succ_le_iff.mp h4)
lemma m_mod_2_contradiction (m n A : ℕ)
(even_A : Even A)
(m_eq_2_mod_4 : m ≡ 2 [MOD 4])
(h : 3 * m * A = (m + 3)^n + 1) : False := by
rw [← ZMod.natCast_eq_natCast_iff] at m_eq_2_mod_4
apply_fun (fun x ↦ (x : ZMod 4)) at h
push_cast at h
rw [m_eq_2_mod_4] at h
obtain ⟨a, rfl⟩ := even_A
push_cast at h
rw [←two_mul] at h
ring_nf at h; reduce_mod_char at h
rw [one_pow n] at h
simp (config := { arith := true, decide := true })at h
lemma m_add_3_pow_n_mod_m (n m : ℕ) : (m + 3)^n ≡ 3^n [MOD m] := by
simp [Nat.ModEq, Nat.pow_mod]
lemma too_good_to_be_true (n l : ℕ)
(three_le_l : 3 ≤ l)
(two_pow_l_divides_expresion : 2^l ∣ (3^n + 1))
(expression_eq_4_mod_8 : 3^n + 1 ≡ 4 [MOD 8]) : False := by
have : 8 ∣ 3 ^ n + 1 := by
obtain ⟨a, Ha⟩ := two_pow_l_divides_expresion
obtain ⟨b, Hb⟩ := Nat.exists_eq_add_of_le' three_le_l
rw[Hb] at Ha
dsimp [Dvd.dvd]
use 2 ^ b * a
rw[Ha]
ring
obtain ⟨a, Ha⟩ := this
rw [Ha] at expression_eq_4_mod_8
dsimp[Nat.ModEq] at expression_eq_4_mod_8
simp at expression_eq_4_mod_8
lemma thue
(a n : ℕ) (hn : 1 < n) :
∃ (x y : ℤ), (a : ZMod n) * x + y = 0 ∧ 0 < |x| ∧ x ^ 2 ≤ n ∧ y ^ 2 ≤ n := by
-- https://services.artofproblemsolving.com/download.php?id=YXR0YWNobWVudHMvMy8yL2QzYjEzOGM0ODE3YzYwZGU4NGFmOTEwZDc0ZGNhODRjOGMyMzZlLnBkZg==&rn=dGh1ZS12NC5wZGY=
-- let r = ⌊√n⌋, i.e. r is the unique integer for which
-- r² ≤ n < (r + 1)².
let r := Nat.sqrt n
-- The number of pairs (x,y) so that 0 ≤ x,y ≤ r is (r + 1)² which
-- is greater than n.
--
-- Therefore there must be two different pairs (x₁, y₁) and (x₂, y₂)
-- such that
-- ax₁ + y₁ = ax₂ + ay₂ (mod n)
-- i.e.
-- a(x₁ - x₂) = y₂ - y₁ (mod n)
--
let D := Fin (r + 1) × Fin (r + 1)
let f : D → ZMod n := fun ⟨x,y⟩ ↦ a * (x.val : ZMod n) + (y.val : ZMod n)
have cardD : Fintype.card D = (r + 1)^2 := by
unfold D
rw [sq, Fintype.card_prod, Fintype.card_fin]
have : NeZero n := NeZero.of_gt hn
have cardZ : Fintype.card (ZMod n) = n := ZMod.card n
have hDZ : Fintype.card (ZMod n) < Fintype.card D := by
rw [cardD, cardZ]
exact Nat.lt_succ_sqrt' n
obtain ⟨⟨x₁, y₁⟩, ⟨x₂, y₂⟩, hxyn, hxy⟩ :=
Fintype.exists_ne_map_eq_of_card_lt f hDZ
dsimp [f] at hxy
replace hxy : (a : ZMod n) * (↑↑x₁ - ↑↑x₂) + (↑↑y₁ - ↑↑y₂) = 0 :=
by linear_combination hxy
use (x₁ : ℤ) - (x₂ : ℤ)
use (y₁ : ℤ) - (y₂ : ℤ)
have hx1 : ((x₁ : ℕ): ZMod n) = (((x₁ : ℕ): ℤ) : ZMod n) := by
norm_cast
have hx2 : ((x₂ : ℕ): ZMod n) = (((x₂ : ℕ): ℤ) : ZMod n) := by
norm_cast
have hx3 : (((x₁ : ℕ): ℤ) : ZMod n) - (((x₂ : ℕ): ℤ) : ZMod n) =
(((((x₁ : ℕ): ℤ) -((x₂ : ℕ): ℤ)) : ℤ) : ZMod n) := by
norm_cast
have hy1 : ((y₁ : ℕ): ZMod n) = (((y₁ : ℕ): ℤ) : ZMod n) := by
norm_cast
have hy2 : ((y₂ : ℕ): ZMod n) = (((y₂ : ℕ): ℤ) : ZMod n) := by
norm_cast
have hy3 : (((y₁ : ℕ): ℤ) : ZMod n) - (((y₂ : ℕ): ℤ) : ZMod n) =
(((((y₁ : ℕ): ℤ) -((y₂ : ℕ): ℤ)) : ℤ) : ZMod n) := by
norm_cast
refine ⟨?_, ?_, ?_, ?_⟩
· rw [hx1, hx2, hx3, hy1, hy2, hy3] at hxy
rw [hxy]
· by_contra! H
replace H : |((x₁:ℕ):ℤ) - ↑↑x₂| = 0 := by
have : (0 : ℤ) ≤ |((x₁:ℕ):ℤ) - ↑↑x₂| := abs_nonneg _
exact (Int.le_antisymm this H).symm
rw [abs_eq_zero] at H
replace H : ((x₁:ℕ):ℤ) = ↑↑x₂ := Int.eq_of_sub_eq_zero H
replace H : x₁.val = x₂.val := Int.ofNat_inj.mp H
replace H : x₁ = x₂ := Fin.eq_of_val_eq H
rw [H, sub_self, mul_zero, zero_add] at hxy
have h4 : ((y₁:ℕ): ZMod n) = ↑↑y₂ := by linear_combination hxy
rw [ZMod.natCast_eq_natCast_iff'] at h4
have p1 := y₁.prop
have p2 := y₂.prop
have : r + 1 ≤ n := by
have h31 := Nat.sqrt_lt_self hn
omega
have h10 : y₁.val < n := by omega
have h11 : y₂.val < n := by omega
rw [Nat.mod_eq_of_lt h10, Nat.mod_eq_of_lt h11] at h4
have h12 : y₁ = y₂ := Fin.eq_of_val_eq h4
rw [H,h12] at hxyn
simp at hxyn
· have hx₁ : x₁.val < r + 1 := x₁.prop
have hx₂ : x₂.val < r + 1 := x₂.prop
have hr1 : r^2 ≤ n := Nat.sqrt_le' n
nlinarith only [hx₁, hx₂, hr1]
· have hy₁ : y₁.val < r + 1 := y₁.prop
have hy₂ : y₂.val < r + 1 := y₂.prop
have hr1 : r^2 ≤ n := Nat.sqrt_le' n
nlinarith only [hy₁, hy₂, hr1]
/--
In this version of Thue's lemma, we get an `x` that is nonzero and
a `y` that might be zero. If we wanted to guarantee that `y` is nonzero,
we would need an extra hypothesis `Nat.Coprime a n`.
-/
lemma Thue's_lemma
(a n : ℕ)
(hn : 1 < n) :
∃ (x y : ℤ),
a * x + y ≡ 0 [ZMOD n] ∧
0 < |x| ∧
x ^ 2 ≤ n ∧
y ^ 2 ≤ n := by
obtain ⟨x, y, hxay, hx, hx1, hy1⟩ := thue a n hn
refine ⟨x, y, ?_, hx, hx1, hy1⟩
have h1 : (a : ZMod n) * (x : ZMod n) + (y : ZMod n) =
((((a : ℤ) * x + y):ℤ) : ZMod n) := by norm_cast
have h2 : ((0:ℤ):ZMod n) = 0 := by norm_cast
rw [h1, ←h2] at hxay
exact (ZMod.intCast_eq_intCast_iff (a * x + y) 0 n).mp hxay
example (a b n : ℕ) (ha : a < n + 1) (hb : b < n + 1) : ((a : ℤ) - (b : ℤ))^2 ≤ n^2 := by
nlinarith
lemma square_mod_4_zmod (x : ZMod 4) : x ^ 2 = 1 ∨ x ^ 2 = 0 := by
fin_cases x <;> simp (config := { arith := true, decide := true })lemma square_mod_3_zmod_0 : ∀ {x : ZMod 3} (_ : x ^ 2 = 0), x = 0 := by
decide
lemma leaf_contradiction {x y m₁ : ℤ} (h: 3 * x ^ 2 + y ^ 2 = m₁) (h2 : m₁ - 5 ≡ 0 [ZMOD 6]) :
False := by
replace h2 : m₁ - 5 ≡ 0 [ZMOD 3] := Int.ModEq.of_mul_left 2 h2
rw [show 3 = ((3:ℕ):ℤ) by rfl] at h2
rw [← ZMod.intCast_eq_intCast_iff] at h2
apply_fun (fun x ↦ (x : ZMod 3)) at h
push_cast at h h2
replace h2 : (m₁:ZMod 3) = 5 := by linear_combination h2
rw [h2] at h
reduce_mod_char at h
generalize hz : (y : ZMod 3) = z
fin_cases z <;> rw [hz] at h <;> grind
theorem bulgaria1998_p11
(m n A : ℕ)
(h : 3 * m * A = (m + 3)^n + 1) : Odd A := by
-- Follows the second solution in _Mathematical Olympiads 1998-1999_
-- (edited by Titu Andreescu and Zuming Feng)
have ⟨⟨k, Hk⟩, m_eq_2_mod_3⟩ : Odd n ∧ m ≡ 2 [MOD 3] := n_odd_and_m_eq_2_mod_3 m n A h
by_contra even_A
rw [Nat.not_odd_iff_even] at even_A
have zero_lt_m : 0 < m := by
by_contra m_eq_0
replace m_eq_0 := not_one_le_k m_eq_0
rw [m_eq_0] at h
ring_nf at h
have : 1 + 3 ^ n > 0 := by positivity
rw [← h] at this
contradiction
have even_m : Even m := by
have n_ne_zero : n ≠ 0 := by omega
replace evenA : (A : ZMod 2) = (0:ℕ) := by
rw [Nat.even_iff] at even_A
exact (ZMod.natCast_eq_natCast_iff' A 0 2).mpr even_A
suffices H : (m : ZMod 2) = (0:ℕ)
· rw [ZMod.natCast_eq_natCast_iff] at H
exact Nat.even_iff.mpr H
apply_fun (fun x ↦ (x : ZMod 2)) at h
push_cast at h
rw [evenA] at h
simp only [Nat.cast_zero, mul_zero] at h
generalize hm' : (m : ZMod 2) = m'
rw [hm'] at h
fin_cases m'
· rfl
· dsimp only [Nat.reduceAdd, Fin.mk_one, Fin.isValue] at h
reduce_mod_char at h
rw [zero_pow n_ne_zero, zero_add] at h
exact (zero_ne_one h).elim
obtain ⟨l, m₁, ⟨one_le_l, odd_m₁, m_factorisation⟩⟩ :=
two_n_and_rest_factorisation m even_m zero_lt_m
by_cases l_eq_one : (l = 1)
· rw [l_eq_one] at m_factorisation
ring_nf at m_factorisation
have : m₁ ≡ 1 [MOD 4] ∨ m₁ ≡ 3 [MOD 4] := by
obtain ⟨a, rfl⟩ := odd_m₁
obtain ⟨b, rfl⟩ | ⟨b, rfl⟩ := Nat.even_or_odd a
· left
dsimp [Nat.ModEq]
ring_nf
simp
· right
dsimp [Nat.ModEq]
ring_nf
simp
have m_eq_2_mod_4 : m ≡ 2 [MOD 4] := by
rw [m_factorisation]
obtain left | right := this
· nth_rw 2 [show 2 = 1 * 2 by rfl]
exact Nat.ModEq.mul_right _ left
· calc m₁ * 2 ≡ 3 * 2 [MOD 4] := Nat.ModEq.mul right rfl
_ ≡ 2 [MOD 4] := rfl
exact m_mod_2_contradiction m n A even_A m_eq_2_mod_4 h
· have eq_2 : 0 ≡ 3^n + 1 [MOD m] := by
calc 0 ≡ m * (3 * A) [MOD m] := by
rw[show 0 = 0 * (3 * A) by ring]
refine Nat.ModEq.mul_right _ ?_
simp [Nat.ModEq]
_ ≡ 3 * m * A [MOD m] := by rw[show m * (3 * A) = 3 * m * A by ring]
_ ≡ (m + 3)^n + 1 [MOD m] := by rw[h]
_ ≡ 3^n + 1 [MOD m] := by
refine Nat.ModEq.add_right _ ?_
exact m_add_3_pow_n_mod_m n m
have l_eq_2 : l = 2 := by
have two_le_l : 2 ≤ l := by omega
obtain left | right := lt_or_eq_of_le two_le_l
· have two_pow_l_divides_expresion : 2 ^ l ∣ (3^n + 1) := by
have m_divides_expression : m ∣ (3 ^ n) + 1 := by
exact (@Nat.modEq_zero_iff_dvd m (3^n + 1)).mp eq_2.symm
dsimp[Dvd.dvd]
obtain ⟨a, Ha⟩ := m_divides_expression
use m₁ * a
rw[show 2 ^ l * (m₁ * a) = (2 ^ l * m₁) * a by ring]
rw[← m_factorisation]
exact Ha
have expression_eq_4_mod_8 : 3^n + 1 ≡ 4 [MOD 8] := by
rw [←ZMod.natCast_eq_natCast_iff, Hk]
rw [pow_succ, pow_mul]
rw[show (3 ^ 2) = 9 by rfl]
push_cast
reduce_mod_char
rw [one_pow (M := ZMod 8) k]
simp (config := { arith := true, decide := true })exfalso
exact too_good_to_be_true
n l (show 3 ≤ l by exact left) two_pow_l_divides_expresion expression_eq_4_mod_8
· exact right.symm
have m_eq_4_m₁ : m = 4 * m₁ := by
rw[l_eq_2] at m_factorisation
exact m_factorisation
have m₁_divides_expresion : m₁ ∣ (3^n + 1) := by
have m_divides_expression : m ∣ (3 ^ n) + 1 := by
exact (@Nat.modEq_zero_iff_dvd m (3^n + 1)).mp eq_2.symm
dsimp[Dvd.dvd]
obtain ⟨a, Ha⟩ := m_divides_expression
use 2 ^ l * a
rw[show m₁ * (2 ^ l * a) = (2 ^ l * m₁) * a by ring]
rw[← m_factorisation]
exact Ha
have m₁_eq_2_mod_3 : m₁ ≡ 2 [MOD 3] := by
have step_1 : 4 * m₁ ≡ 2 [MOD 3] := by
rw[m_eq_4_m₁] at m_eq_2_mod_3
exact m_eq_2_mod_3
have step_2 : 4 * m₁ ≡ m₁ [MOD 3] := by
nth_rw 2 [show m₁ = 1 * m₁ by ring]
exact Nat.ModEq.mul rfl rfl
calc m₁ ≡ 4 * m₁ [MOD 3] := step_2.symm
_ ≡ 2 [MOD 3] := step_1
have m₁_eq_5_mod_6 : m₁ ≡ 5 [MOD 6] := by
mod_cases m_mod_six : m₁ % 6
· have step_1: m₁ * 2 ≡ 0 * 2 [MOD 6]:= Nat.ModEq.mul_right 2 m_mod_six
have step_2: m₁ * 2 ≡ 2 * 2 [MOD 3 * 2] := Nat.ModEq.mul_right' 2 m₁_eq_2_mod_3
simp at step_1
simp at step_2
exfalso
have := Nat.ModEq.trans step_2.symm step_1
contradiction
· have step_1: m₁ * 2 ≡ 1 * 2 [MOD 6]:= Nat.ModEq.mul_right 2 m_mod_six
have step_2: m₁ * 2 ≡ 2 * 2 [MOD 3 * 2] := Nat.ModEq.mul_right' 2 m₁_eq_2_mod_3
simp at step_1
simp at step_2
exfalso
have := Nat.ModEq.trans step_2.symm step_1
contradiction
· have : m₁ ≡ 1 [MOD 2] := by
obtain ⟨a, Ha⟩ := odd_m₁
rw[show 1 = 0 + 1 by norm_num]
rw[Ha]
refine Nat.ModEq.add_right _ ?_
simp[Nat.ModEq]
have step_1: m₁ * 2 ≡ 2 * 2 [MOD 3 * 2] := Nat.ModEq.mul_right' 2 m₁_eq_2_mod_3
have step_2: m₁ * 3 ≡ 1 * 3 [MOD 2 * 3] := Nat.ModEq.mul_right' 3 this
change m₁ * 2 + m₁ ≡ 2 * 2 + 5 [MOD 2 * 3] at step_2
exact Nat.ModEq.add_left_cancel step_1 step_2
· have step_1: m₁ * 2 ≡ 3 * 2 [MOD 6]:= Nat.ModEq.mul_right 2 m_mod_six
have step_2: m₁ * 2 ≡ 2 * 2 [MOD 3 * 2] := Nat.ModEq.mul_right' 2 m₁_eq_2_mod_3
simp at step_1
simp at step_2
exfalso
have := Nat.ModEq.trans step_2.symm step_1
contradiction
· have step_1: m₁ * 2 ≡ 4 * 2 [MOD 6]:= Nat.ModEq.mul_right 2 m_mod_six
have step_2: m₁ * 2 ≡ 2 * 2 [MOD 3 * 2] := Nat.ModEq.mul_right' 2 m₁_eq_2_mod_3
simp at step_1
simp at step_2
exfalso
have := Nat.ModEq.trans step_2.symm step_1
contradiction
· exact m_mod_six
have exists_a : ∃ a : ℕ, a = 3 ^ (k + 1) := by
use 3 ^ (k + 1)
obtain ⟨a, Ha⟩ := exists_a
have m₁_divides_for_thues_lemma : m₁ ∣ a^2 + 3 := by
apply Nat.modEq_zero_iff_dvd.mp
have step_1:= Nat.modEq_zero_iff_dvd.mpr m₁_divides_expresion
rw[Hk] at step_1
have step_2: 3 * (3 ^ (2 * k + 1) + 1) ≡ 3 * 0 [MOD m₁] := Nat.ModEq.mul_left 3 step_1
ring_nf at step_2
rw[show 3 ^ (k * 2) * 9 = 3 ^ ((k + 1) * 2 ) by ring] at step_2
have step_3 : 3 ^ ((k + 1) * 2) = (3 ^ (k + 1)) ^ (2) :=
pow_mul 3 (k + 1) 2
rw[step_3] at step_2
rw[← Ha] at step_2
ring_nf
exact step_2
have hn1 : 1 < m₁ := by
change _ % _ = _ % _ at m₁_eq_2_mod_3
omega
obtain ⟨x, y, x_y_props⟩ := Thue's_lemma a m₁ hn1
clear hn1
obtain ⟨mod_expression, x_lower, x_higher, y_higher⟩ := x_y_props
have lifted_m₁_result := Int.natCast_modEq_iff.mpr (Nat.modEq_zero_iff_dvd.mpr m₁_divides_for_thues_lemma)
norm_num at lifted_m₁_result
have expression : 3 * x ^ 2 + y ^ 2 ≡ 0 [ZMOD m₁] := by
have step_2 : a * x ≡ -y [ZMOD m₁] := by
rw [show -y = 0 - y by ring]
rw [show a * x = a * x + y - y by ring]
exact Int.ModEq.sub_right _ mod_expression
have step_3 : a ^ 2 * x ^ 2 ≡ y ^ 2 [ZMOD m₁] := by
rw [show a ^ 2 * x ^ 2 = (a * x) * (a * x) by ring]
rw [show y ^ 2 = (-y) * (-y) by ring]
exact Int.ModEq.mul step_2 step_2
have step_4: (-3) * x ^ 2 ≡ y ^ 2 [ZMOD m₁] := by
have step_1 : a ^ 2 ≡ -3 [ZMOD m₁] :=
Int.ModEq.add_right_cancel' 3 lifted_m₁_result
trans a ^ 2 * x ^ 2
· exact Int.ModEq.mul (step_1.symm) rfl
· exact step_3
have : ((-3) * x ^ 2) + (3 * x ^ 2) ≡ (y ^ 2) + (3 * x ^ 2) [ZMOD m₁] :=
Int.ModEq.add_right _ step_4
rw [show (-3) * x ^ 2 + (3 * x ^ 2) = 0 by ring] at this
rw [show y ^ 2 + 3 * x ^ 2 = 3 * x ^ 2 + y ^ 2 by ring] at this
exact this.symm
obtain ⟨s, Hs⟩ := Int.modEq_zero_iff_dvd.mp expression
rw [m_eq_4_m₁] at zero_lt_m
have zero_lt_m₁ : 0 < @Nat.cast ℤ _ m₁ := by omega
have upper_bound_s : s ≤ 4 := by
have upper_bound_expression: 3 * x ^ 2 + y ^ 2 ≤ 4 * m₁ := by omega
rw [Hs] at upper_bound_expression
rw [show m₁ * s = s * m₁ by ring] at upper_bound_expression
exact le_of_mul_le_mul_right upper_bound_expression zero_lt_m₁
have lower_bound_s : 0 < s := by
have lower_bound_expression : 0 < 3 * x ^ 2 + y ^ 2 := by
have h1 : 0 < 3 * x ^ 2 := by rw [←sq_abs]; positivity
exact Int.add_pos_of_pos_of_nonneg h1 (sq_nonneg y)
rw [Hs] at lower_bound_expression
exact Int.pos_of_mul_pos_right lower_bound_expression zero_lt_m₁
have m₁_sub_5_mod_6 : ↑m₁ - 5 ≡ 0 [ZMOD 6] := by
exact Int.ModEq.sub (Int.natCast_modEq_iff.mpr m₁_eq_5_mod_6) rfl
interval_cases s
· -- s = 1
rw [mul_one] at Hs
exact leaf_contradiction Hs m₁_sub_5_mod_6
· -- s = 2
have := Int.modEq_zero_iff_dvd.mp m₁_sub_5_mod_6
dsimp[Dvd.dvd] at this
obtain ⟨c, this⟩ := this
have expr_m₁_mod_6 : ↑m₁ = 6 * c + 5 := sub_eq_iff_eq_add.mp this
rw[expr_m₁_mod_6] at Hs
ring_nf at Hs
have expression_mod_4 : ((x : (ZMod 4)) ^ 2 * 3 + y ^ 2) = ((10 + c * 12) : (ZMod 4)) := by
norm_cast
rw[Hs]
reduce_mod_char at expression_mod_4
obtain left_x | right_x := square_mod_4_zmod x
· rw[left_x] at expression_mod_4
obtain left_y | right_y := square_mod_4_zmod y
· rw[left_y] at expression_mod_4
simp (config := { arith := true, decide := true })at expression_mod_4
· rw[right_y] at expression_mod_4
simp (config := { arith := true, decide := true })at expression_mod_4
· rw[right_x] at expression_mod_4
obtain left_y | right_y := square_mod_4_zmod y
· rw[left_y] at expression_mod_4
simp (config := { arith := true, decide := true })at expression_mod_4
· rw[right_y] at expression_mod_4
simp (config := { arith := true, decide := true })at expression_mod_4
· -- s = 3
have := Int.modEq_zero_iff_dvd.mp m₁_sub_5_mod_6
dsimp[Dvd.dvd] at this
obtain ⟨c, this⟩ := this
have expr_m₁_mod_6 : ↑m₁ = 6 * c + 5 := by omega
rw[expr_m₁_mod_6] at Hs
ring_nf at Hs
have expression_mod_3 :
((x : (ZMod 3)) ^ 2 * 3 + y ^ 2) = ((15 + c * 18) : (ZMod 3)) := by
norm_cast
rw[Hs]
reduce_mod_char at expression_mod_3
have : (y : ZMod 3) = 0 := square_mod_3_zmod_0 expression_mod_3
have := (ZMod.intCast_zmod_eq_zero_iff_dvd y 3).mp this
dsimp[Dvd.dvd] at this
obtain⟨y', Hy'⟩ := this
rw[Hy'] at Hs
ring_nf at Hs
rw[show x ^ 2 * 3 + y' ^ 2 * 9 = 3 * (x ^ 2 + 3 * y' ^ 2) by ring] at Hs
rw[show 15 + c * 18 = 3 * (5 + 6 * c) by ring] at Hs
have reduced_expression : (x ^ 2 + 3 * y' ^ 2) = (5 + 6 * c) := by
omega
rw[show 5 + 6 * c = 6 * c + 5 by ring] at reduced_expression
rw[← expr_m₁_mod_6] at reduced_expression
rw[show x ^ 2 + 3 * y' ^ 2 = 3 * y' ^ 2 + x ^ 2 by ring] at reduced_expression
exact leaf_contradiction reduced_expression m₁_sub_5_mod_6
· -- s = 4
have : y^2 < m₁ := by
by_contra! H
have h1 : y^2 = m₁ := (Int.le_antisymm H y_higher).symm
rw [←sq_abs, Int.abs_eq_natAbs] at h1
norm_cast at h1
generalize hyy : y.natAbs = yy
rw [hyy] at h1
rw [←h1] at m₁_eq_2_mod_3
mod_cases Hyy : yy % 3 <;>
change _ % _ = _ % _ at Hyy m₁_eq_2_mod_3 <;>
simp [Nat.pow_mod, Hyy] at m₁_eq_2_mod_3
omega
end Bulgaria1998P11 | /- | /-
Copyright (c) 2023 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw, Adam Kurkiewicz
-/
import Mathlib
/-!
Bulgarian Mathematical Olympiad 1998, Problem 11
Let m,n be natural numbers such that
A = ((m + 3)ⁿ + 1) / (3m)
is an integer. Prove that A is odd.
-/
namespace Bulgaria1998P11
lemma mod_3_add_3_under_exponent (m n : ℕ) : ((m + 3) ^ n) ≡ (m ^ n) [MOD 3] := by
change (m + 3)^n % 3 = m ^ n % 3
simp [Nat.pow_mod]
lemma zero_pow_mod_3 {m n : ℕ} (h1 : n > 0) (h2 : m ≡ 0 [MOD 3]) : m ^ n ≡ 0 [MOD 3]:= by
change _ % 3 = 0 at h2 ⊢
rw [←Nat.dvd_iff_mod_eq_zero] at h2 ⊢
exact Dvd.dvd.pow h2 (Nat.ne_zero_of_lt h1)
lemma one_pow_mod_3 {m n : ℕ} (h2 : m ≡ 1 [MOD 3]) : m ^ n ≡ 1 [MOD 3]:= by
change _ % _ = 1 at h2 ⊢
simp [Nat.pow_mod, h2]
lemma two_even_pow_mod_3 {m n : ℕ} (h1 : Even n) (h2 : m ≡ 2 [MOD 3]) : m ^ n ≡ 1 [MOD 3] := by
change _ % _ = _ at h2 ⊢
obtain ⟨k, hk⟩ := h1
simp (config := { arith := true, decide := true }) [Nat.pow_mod, h2, hk, pow_mul]
theorem n_odd_and_m_eq_2_mod_3 (m n A : ℕ) (h : 3 * m * A = (m + 3)^n + 1) :
Odd n ∧ m ≡ 2 [MOD 3] := by
by_cases n_gt_zero : n > 0
· have h_mod_3 : 0 ≡ (m ^ n + 1) [MOD 3] := by
calc 0 ≡ 3 * (m * A) [MOD 3] := (Nat.mul_mod_right 3 (m * A)).symm
_ ≡ (3 * m * A) [MOD 3] := by rw[show 3 * (m * A) = (3 * m * A) by ring]
_ ≡ ((m + 3) ^ n + 1) [MOD 3] := by rw[h]
_ ≡ (m ^ n + 1) [MOD 3] := Nat.ModEq.add (mod_3_add_3_under_exponent m n) rfl
mod_cases mod_case : m % 3
· have towards_contradiction : 0 ≡ 1 [MOD 3] := by
calc 0 ≡ m ^ n + 1 [MOD 3] := h_mod_3
_ ≡ 0 + 1 [MOD 3] := Nat.ModEq.add (zero_pow_mod_3 n_gt_zero mod_case) rfl
_ ≡ 1 [MOD 3] := by rfl
contradiction
· have towards_contradiction : 0 ≡ 2 [MOD 3] := by
rw[show 2 = 1 + 1 by ring]
calc 0 ≡ m ^ n + 1 [MOD 3] := h_mod_3
_ ≡ 1 + 1 [MOD 3] := Nat.ModEq.add (one_pow_mod_3 mod_case) rfl
contradiction
· by_cases n_even : Even n
· have towards_contradiction : 0 ≡ 2 [MOD 3] := by
calc 0 ≡ m ^ n + 1 [MOD 3] := h_mod_3
_ ≡ 1 + 1 [MOD 3] := Nat.ModEq.add (two_even_pow_mod_3 n_even mod_case) rfl
_ ≡ 2 [MOD 3] := by rfl
contradiction
· rw [Nat.not_even_iff_odd] at n_even
exact ⟨n_even, mod_case⟩
· rw [Nat.eq_zero_of_not_pos n_gt_zero] at h
omega
lemma not_one_le_k {k : ℕ} (h : ¬1 ≤ k) : k = 0 := by
simp_all only [not_le, Nat.lt_one_iff]
lemma two_le_pow_two (l : ℕ) : 2 ≤ 2 ^ (l + 1) := by
rw [pow_succ]
suffices 1 ≤ 2 ^ l from Nat.le_mul_of_pos_left 2 this
exact Nat.one_le_two_pow
lemma two_n_and_rest_factorisation (m : ℕ) (even_m : Even m) (h: 0 < m) :
∃ (l : ℕ) (m₁ : ℕ), 1 ≤ l ∧ Odd m₁ ∧ m = 2 ^ l * m₁ := by
have ⟨a, ha⟩ := (pow_padicValNat_dvd : 2 ^ padicValNat 2 m ∣ m)
refine ⟨padicValNat 2 m, a, ?_⟩
obtain ⟨k, hk⟩ := even_iff_two_dvd.mp even_m
have hk0 : 0 < k := by omega
refine ⟨?_, ?_, ha⟩
· rw [hk]
rw [show 2 * k = 2^1 * k from rfl]
rw [padicValNat_base_pow_mul one_lt_two hk0.ne']
exact Nat.le_add_left 1 (padicValNat 2 k)
· by_contra! Ha
rw [Nat.not_odd_iff_even] at Ha
obtain ⟨b, hb⟩ := Ha
have h3 : 2 ^ (padicValNat 2 m + 1) ∣ m := by
use b
rw [hb] at ha
rw [pow_succ]
linarith only [ha]
have h4 := (Nat.pow_dvd_iff_le_padicValNat (by omega) (Nat.ne_zero_of_lt h)).mp h3
exact (lt_self_iff_false _).mp (Nat.succ_le_iff.mp h4)
lemma m_mod_2_contradiction (m n A : ℕ)
(even_A : Even A)
(m_eq_2_mod_4 : m ≡ 2 [MOD 4])
(h : 3 * m * A = (m + 3)^n + 1) : False := by
rw [← ZMod.natCast_eq_natCast_iff] at m_eq_2_mod_4
apply_fun (fun x ↦ (x : ZMod 4)) at h
push_cast at h
rw [m_eq_2_mod_4] at h
obtain ⟨a, rfl⟩ := even_A
push_cast at h
rw [←two_mul] at h
ring_nf at h; reduce_mod_char at h
rw [one_pow n] at h
simp (config := { arith := true, decide := true })at h
lemma m_add_3_pow_n_mod_m (n m : ℕ) : (m + 3)^n ≡ 3^n [MOD m] := by
simp [Nat.ModEq, Nat.pow_mod]
lemma too_good_to_be_true (n l : ℕ)
(three_le_l : 3 ≤ l)
(two_pow_l_divides_expresion : 2^l ∣ (3^n + 1))
(expression_eq_4_mod_8 : 3^n + 1 ≡ 4 [MOD 8]) : False := by
have : 8 ∣ 3 ^ n + 1 := by
obtain ⟨a, Ha⟩ := two_pow_l_divides_expresion
obtain ⟨b, Hb⟩ := Nat.exists_eq_add_of_le' three_le_l
rw[Hb] at Ha
dsimp [Dvd.dvd]
use 2 ^ b * a
rw[Ha]
ring
obtain ⟨a, Ha⟩ := this
rw [Ha] at expression_eq_4_mod_8
dsimp[Nat.ModEq] at expression_eq_4_mod_8
simp at expression_eq_4_mod_8
lemma thue
(a n : ℕ) (hn : 1 < n) :
∃ (x y : ℤ), (a : ZMod n) * x + y = 0 ∧ 0 < |x| ∧ x ^ 2 ≤ n ∧ y ^ 2 ≤ n := by
-- https://services.artofproblemsolving.com/download.php?id=YXR0YWNobWVudHMvMy8yL2QzYjEzOGM0ODE3YzYwZGU4NGFmOTEwZDc0ZGNhODRjOGMyMzZlLnBkZg==&rn=dGh1ZS12NC5wZGY=
-- let r = ⌊√n⌋, i.e. r is the unique integer for which
-- r² ≤ n < (r + 1)².
let r := Nat.sqrt n
-- The number of pairs (x,y) so that 0 ≤ x,y ≤ r is (r + 1)² which
-- is greater than n.
--
-- Therefore there must be two different pairs (x₁, y₁) and (x₂, y₂)
-- such that
-- ax₁ + y₁ = ax₂ + ay₂ (mod n)
-- i.e.
-- a(x₁ - x₂) = y₂ - y₁ (mod n)
--
let D := Fin (r + 1) × Fin (r + 1)
let f : D → ZMod n := fun ⟨x,y⟩ ↦ a * (x.val : ZMod n) + (y.val : ZMod n)
have cardD : Fintype.card D = (r + 1)^2 := by
unfold D
rw [sq, Fintype.card_prod, Fintype.card_fin]
have : NeZero n := NeZero.of_gt hn
have cardZ : Fintype.card (ZMod n) = n := ZMod.card n
have hDZ : Fintype.card (ZMod n) < Fintype.card D := by
rw [cardD, cardZ]
exact Nat.lt_succ_sqrt' n
obtain ⟨⟨x₁, y₁⟩, ⟨x₂, y₂⟩, hxyn, hxy⟩ :=
Fintype.exists_ne_map_eq_of_card_lt f hDZ
dsimp [f] at hxy
replace hxy : (a : ZMod n) * (↑↑x₁ - ↑↑x₂) + (↑↑y₁ - ↑↑y₂) = 0 :=
by linear_combination hxy
use (x₁ : ℤ) - (x₂ : ℤ)
use (y₁ : ℤ) - (y₂ : ℤ)
have hx1 : ((x₁ : ℕ): ZMod n) = (((x₁ : ℕ): ℤ) : ZMod n) := by
norm_cast
have hx2 : ((x₂ : ℕ): ZMod n) = (((x₂ : ℕ): ℤ) : ZMod n) := by
norm_cast
have hx3 : (((x₁ : ℕ): ℤ) : ZMod n) - (((x₂ : ℕ): ℤ) : ZMod n) =
(((((x₁ : ℕ): ℤ) -((x₂ : ℕ): ℤ)) : ℤ) : ZMod n) := by
norm_cast
have hy1 : ((y₁ : ℕ): ZMod n) = (((y₁ : ℕ): ℤ) : ZMod n) := by
norm_cast
have hy2 : ((y₂ : ℕ): ZMod n) = (((y₂ : ℕ): ℤ) : ZMod n) := by
norm_cast
have hy3 : (((y₁ : ℕ): ℤ) : ZMod n) - (((y₂ : ℕ): ℤ) : ZMod n) =
(((((y₁ : ℕ): ℤ) -((y₂ : ℕ): ℤ)) : ℤ) : ZMod n) := by
norm_cast
refine ⟨?_, ?_, ?_, ?_⟩
· rw [hx1, hx2, hx3, hy1, hy2, hy3] at hxy
rw [hxy]
· by_contra! H
replace H : |((x₁:ℕ):ℤ) - ↑↑x₂| = 0 := by
have : (0 : ℤ) ≤ |((x₁:ℕ):ℤ) - ↑↑x₂| := abs_nonneg _
exact (Int.le_antisymm this H).symm
rw [abs_eq_zero] at H
replace H : ((x₁:ℕ):ℤ) = ↑↑x₂ := Int.eq_of_sub_eq_zero H
replace H : x₁.val = x₂.val := Int.ofNat_inj.mp H
replace H : x₁ = x₂ := Fin.eq_of_val_eq H
rw [H, sub_self, mul_zero, zero_add] at hxy
have h4 : ((y₁:ℕ): ZMod n) = ↑↑y₂ := by linear_combination hxy
rw [ZMod.natCast_eq_natCast_iff'] at h4
have p1 := y₁.prop
have p2 := y₂.prop
have : r + 1 ≤ n := by
have h31 := Nat.sqrt_lt_self hn
omega
have h10 : y₁.val < n := by omega
have h11 : y₂.val < n := by omega
rw [Nat.mod_eq_of_lt h10, Nat.mod_eq_of_lt h11] at h4
have h12 : y₁ = y₂ := Fin.eq_of_val_eq h4
rw [H,h12] at hxyn
simp at hxyn
· have hx₁ : x₁.val < r + 1 := x₁.prop
have hx₂ : x₂.val < r + 1 := x₂.prop
have hr1 : r^2 ≤ n := Nat.sqrt_le' n
nlinarith only [hx₁, hx₂, hr1]
· have hy₁ : y₁.val < r + 1 := y₁.prop
have hy₂ : y₂.val < r + 1 := y₂.prop
have hr1 : r^2 ≤ n := Nat.sqrt_le' n
nlinarith only [hy₁, hy₂, hr1]
/--
In this version of Thue's lemma, we get an `x` that is nonzero and
a `y` that might be zero. If we wanted to guarantee that `y` is nonzero,
we would need an extra hypothesis `Nat.Coprime a n`.
-/
lemma Thue's_lemma
(a n : ℕ)
(hn : 1 < n) :
∃ (x y : ℤ),
a * x + y ≡ 0 [ZMOD n] ∧
0 < |x| ∧
x ^ 2 ≤ n ∧
y ^ 2 ≤ n := by
obtain ⟨x, y, hxay, hx, hx1, hy1⟩ := thue a n hn
refine ⟨x, y, ?_, hx, hx1, hy1⟩
have h1 : (a : ZMod n) * (x : ZMod n) + (y : ZMod n) =
((((a : ℤ) * x + y):ℤ) : ZMod n) := by norm_cast
have h2 : ((0:ℤ):ZMod n) = 0 := by norm_cast
rw [h1, ←h2] at hxay
exact (ZMod.intCast_eq_intCast_iff (a * x + y) 0 n).mp hxay
example (a b n : ℕ) (ha : a < n + 1) (hb : b < n + 1) : ((a : ℤ) - (b : ℤ))^2 ≤ n^2 := by
nlinarith
lemma square_mod_4_zmod (x : ZMod 4) : x ^ 2 = 1 ∨ x ^ 2 = 0 := by
fin_cases x <;> simp (config := { arith := true, decide := true })lemma square_mod_3_zmod_0 : ∀ {x : ZMod 3} (_ : x ^ 2 = 0), x = 0 := by
decide
lemma leaf_contradiction {x y m₁ : ℤ} (h: 3 * x ^ 2 + y ^ 2 = m₁) (h2 : m₁ - 5 ≡ 0 [ZMOD 6]) :
False := by
replace h2 : m₁ - 5 ≡ 0 [ZMOD 3] := Int.ModEq.of_mul_left 2 h2
rw [show 3 = ((3:ℕ):ℤ) by rfl] at h2
rw [← ZMod.intCast_eq_intCast_iff] at h2
apply_fun (fun x ↦ (x : ZMod 3)) at h
push_cast at h h2
replace h2 : (m₁:ZMod 3) = 5 := by linear_combination h2
rw [h2] at h
reduce_mod_char at h
generalize hz : (y : ZMod 3) = z
fin_cases z <;> rw [hz] at h <;> grind
theorem bulgaria1998_p11
(m n A : ℕ)
(h : 3 * m * A = (m + 3)^n + 1) : Odd A := by
-- Follows the second solution in _Mathematical Olympiads 1998-1999_
-- (edited by Titu Andreescu and Zuming Feng)
have ⟨⟨k, Hk⟩, m_eq_2_mod_3⟩ : Odd n ∧ m ≡ 2 [MOD 3] := n_odd_and_m_eq_2_mod_3 m n A h
by_contra even_A
rw [Nat.not_odd_iff_even] at even_A
have zero_lt_m : 0 < m := by
by_contra m_eq_0
replace m_eq_0 := not_one_le_k m_eq_0
rw [m_eq_0] at h
ring_nf at h
have : 1 + 3 ^ n > 0 := by positivity
rw [← h] at this
contradiction
have even_m : Even m := by
have n_ne_zero : n ≠ 0 := by omega
replace evenA : (A : ZMod 2) = (0:ℕ) := by
rw [Nat.even_iff] at even_A
exact (ZMod.natCast_eq_natCast_iff' A 0 2).mpr even_A
suffices H : (m : ZMod 2) = (0:ℕ)
· rw [ZMod.natCast_eq_natCast_iff] at H
exact Nat.even_iff.mpr H
apply_fun (fun x ↦ (x : ZMod 2)) at h
push_cast at h
rw [evenA] at h
simp only [Nat.cast_zero, mul_zero] at h
generalize hm' : (m : ZMod 2) = m'
rw [hm'] at h
fin_cases m'
· rfl
· dsimp only [Nat.reduceAdd, Fin.mk_one, Fin.isValue] at h
reduce_mod_char at h
rw [zero_pow n_ne_zero, zero_add] at h
exact (zero_ne_one h).elim
obtain ⟨l, m₁, ⟨one_le_l, odd_m₁, m_factorisation⟩⟩ :=
two_n_and_rest_factorisation m even_m zero_lt_m
by_cases l_eq_one : (l = 1)
· rw [l_eq_one] at m_factorisation
ring_nf at m_factorisation
have : m₁ ≡ 1 [MOD 4] ∨ m₁ ≡ 3 [MOD 4] := by
obtain ⟨a, rfl⟩ := odd_m₁
obtain ⟨b, rfl⟩ | ⟨b, rfl⟩ := Nat.even_or_odd a
· left
dsimp [Nat.ModEq]
ring_nf
simp
· right
dsimp [Nat.ModEq]
ring_nf
simp
have m_eq_2_mod_4 : m ≡ 2 [MOD 4] := by
rw [m_factorisation]
obtain left | right := this
· nth_rw 2 [show 2 = 1 * 2 by rfl]
exact Nat.ModEq.mul_right _ left
· calc m₁ * 2 ≡ 3 * 2 [MOD 4] := Nat.ModEq.mul right rfl
_ ≡ 2 [MOD 4] := rfl
exact m_mod_2_contradiction m n A even_A m_eq_2_mod_4 h
· have eq_2 : 0 ≡ 3^n + 1 [MOD m] := by
calc 0 ≡ m * (3 * A) [MOD m] := by
rw[show 0 = 0 * (3 * A) by ring]
refine Nat.ModEq.mul_right _ ?_
simp [Nat.ModEq]
_ ≡ 3 * m * A [MOD m] := by rw[show m * (3 * A) = 3 * m * A by ring]
_ ≡ (m + 3)^n + 1 [MOD m] := by rw[h]
_ ≡ 3^n + 1 [MOD m] := by
refine Nat.ModEq.add_right _ ?_
exact m_add_3_pow_n_mod_m n m
have l_eq_2 : l = 2 := by
have two_le_l : 2 ≤ l := by omega
obtain left | right := lt_or_eq_of_le two_le_l
· have two_pow_l_divides_expresion : 2 ^ l ∣ (3^n + 1) := by
have m_divides_expression : m ∣ (3 ^ n) + 1 := by
exact (@Nat.modEq_zero_iff_dvd m (3^n + 1)).mp eq_2.symm
dsimp[Dvd.dvd]
obtain ⟨a, Ha⟩ := m_divides_expression
use m₁ * a
rw[show 2 ^ l * (m₁ * a) = (2 ^ l * m₁) * a by ring]
rw[← m_factorisation]
exact Ha
have expression_eq_4_mod_8 : 3^n + 1 ≡ 4 [MOD 8] := by
rw [←ZMod.natCast_eq_natCast_iff, Hk]
rw [pow_succ, pow_mul]
rw[show (3 ^ 2) = 9 by rfl]
push_cast
reduce_mod_char
rw [one_pow (M := ZMod 8) k]
simp (config := { arith := true, decide := true })exfalso
exact too_good_to_be_true
n l (show 3 ≤ l by exact left) two_pow_l_divides_expresion expression_eq_4_mod_8
· exact right.symm
have m_eq_4_m₁ : m = 4 * m₁ := by
rw[l_eq_2] at m_factorisation
exact m_factorisation
have m₁_divides_expresion : m₁ ∣ (3^n + 1) := by
have m_divides_expression : m ∣ (3 ^ n) + 1 := by
exact (@Nat.modEq_zero_iff_dvd m (3^n + 1)).mp eq_2.symm
dsimp[Dvd.dvd]
obtain ⟨a, Ha⟩ := m_divides_expression
use 2 ^ l * a
rw[show m₁ * (2 ^ l * a) = (2 ^ l * m₁) * a by ring]
rw[← m_factorisation]
exact Ha
have m₁_eq_2_mod_3 : m₁ ≡ 2 [MOD 3] := by
have step_1 : 4 * m₁ ≡ 2 [MOD 3] := by
rw[m_eq_4_m₁] at m_eq_2_mod_3
exact m_eq_2_mod_3
have step_2 : 4 * m₁ ≡ m₁ [MOD 3] := by
nth_rw 2 [show m₁ = 1 * m₁ by ring]
exact Nat.ModEq.mul rfl rfl
calc m₁ ≡ 4 * m₁ [MOD 3] := step_2.symm
_ ≡ 2 [MOD 3] := step_1
have m₁_eq_5_mod_6 : m₁ ≡ 5 [MOD 6] := by
mod_cases m_mod_six : m₁ % 6
· have step_1: m₁ * 2 ≡ 0 * 2 [MOD 6]:= Nat.ModEq.mul_right 2 m_mod_six
have step_2: m₁ * 2 ≡ 2 * 2 [MOD 3 * 2] := Nat.ModEq.mul_right' 2 m₁_eq_2_mod_3
simp at step_1
simp at step_2
exfalso
have := Nat.ModEq.trans step_2.symm step_1
contradiction
· have step_1: m₁ * 2 ≡ 1 * 2 [MOD 6]:= Nat.ModEq.mul_right 2 m_mod_six
have step_2: m₁ * 2 ≡ 2 * 2 [MOD 3 * 2] := Nat.ModEq.mul_right' 2 m₁_eq_2_mod_3
simp at step_1
simp at step_2
exfalso
have := Nat.ModEq.trans step_2.symm step_1
contradiction
· have : m₁ ≡ 1 [MOD 2] := by
obtain ⟨a, Ha⟩ := odd_m₁
rw[show 1 = 0 + 1 by norm_num]
rw[Ha]
refine Nat.ModEq.add_right _ ?_
simp[Nat.ModEq]
have step_1: m₁ * 2 ≡ 2 * 2 [MOD 3 * 2] := Nat.ModEq.mul_right' 2 m₁_eq_2_mod_3
have step_2: m₁ * 3 ≡ 1 * 3 [MOD 2 * 3] := Nat.ModEq.mul_right' 3 this
change m₁ * 2 + m₁ ≡ 2 * 2 + 5 [MOD 2 * 3] at step_2
exact Nat.ModEq.add_left_cancel step_1 step_2
· have step_1: m₁ * 2 ≡ 3 * 2 [MOD 6]:= Nat.ModEq.mul_right 2 m_mod_six
have step_2: m₁ * 2 ≡ 2 * 2 [MOD 3 * 2] := Nat.ModEq.mul_right' 2 m₁_eq_2_mod_3
simp at step_1
simp at step_2
exfalso
have := Nat.ModEq.trans step_2.symm step_1
contradiction
· have step_1: m₁ * 2 ≡ 4 * 2 [MOD 6]:= Nat.ModEq.mul_right 2 m_mod_six
have step_2: m₁ * 2 ≡ 2 * 2 [MOD 3 * 2] := Nat.ModEq.mul_right' 2 m₁_eq_2_mod_3
simp at step_1
simp at step_2
exfalso
have := Nat.ModEq.trans step_2.symm step_1
contradiction
· exact m_mod_six
have exists_a : ∃ a : ℕ, a = 3 ^ (k + 1) := by
use 3 ^ (k + 1)
obtain ⟨a, Ha⟩ := exists_a
have m₁_divides_for_thues_lemma : m₁ ∣ a^2 + 3 := by
apply Nat.modEq_zero_iff_dvd.mp
have step_1:= Nat.modEq_zero_iff_dvd.mpr m₁_divides_expresion
rw[Hk] at step_1
have step_2: 3 * (3 ^ (2 * k + 1) + 1) ≡ 3 * 0 [MOD m₁] := Nat.ModEq.mul_left 3 step_1
ring_nf at step_2
rw[show 3 ^ (k * 2) * 9 = 3 ^ ((k + 1) * 2 ) by ring] at step_2
have step_3 : 3 ^ ((k + 1) * 2) = (3 ^ (k + 1)) ^ (2) :=
pow_mul 3 (k + 1) 2
rw[step_3] at step_2
rw[← Ha] at step_2
ring_nf
exact step_2
have hn1 : 1 < m₁ := by
change _ % _ = _ % _ at m₁_eq_2_mod_3
omega
obtain ⟨x, y, x_y_props⟩ := Thue's_lemma a m₁ hn1
clear hn1
obtain ⟨mod_expression, x_lower, x_higher, y_higher⟩ := x_y_props
have lifted_m₁_result := Int.natCast_modEq_iff.mpr (Nat.modEq_zero_iff_dvd.mpr m₁_divides_for_thues_lemma)
norm_num at lifted_m₁_result
have expression : 3 * x ^ 2 + y ^ 2 ≡ 0 [ZMOD m₁] := by
have step_2 : a * x ≡ -y [ZMOD m₁] := by
rw [show -y = 0 - y by ring]
rw [show a * x = a * x + y - y by ring]
exact Int.ModEq.sub_right _ mod_expression
have step_3 : a ^ 2 * x ^ 2 ≡ y ^ 2 [ZMOD m₁] := by
rw [show a ^ 2 * x ^ 2 = (a * x) * (a * x) by ring]
rw [show y ^ 2 = (-y) * (-y) by ring]
exact Int.ModEq.mul step_2 step_2
have step_4: (-3) * x ^ 2 ≡ y ^ 2 [ZMOD m₁] := by
have step_1 : a ^ 2 ≡ -3 [ZMOD m₁] :=
Int.ModEq.add_right_cancel' 3 lifted_m₁_result
trans a ^ 2 * x ^ 2
· exact Int.ModEq.mul (step_1.symm) rfl
· exact step_3
have : ((-3) * x ^ 2) + (3 * x ^ 2) ≡ (y ^ 2) + (3 * x ^ 2) [ZMOD m₁] :=
Int.ModEq.add_right _ step_4
rw [show (-3) * x ^ 2 + (3 * x ^ 2) = 0 by ring] at this
rw [show y ^ 2 + 3 * x ^ 2 = 3 * x ^ 2 + y ^ 2 by ring] at this
exact this.symm
obtain ⟨s, Hs⟩ := Int.modEq_zero_iff_dvd.mp expression
rw [m_eq_4_m₁] at zero_lt_m
have zero_lt_m₁ : 0 < @Nat.cast ℤ _ m₁ := by omega
have upper_bound_s : s ≤ 4 := by
have upper_bound_expression: 3 * x ^ 2 + y ^ 2 ≤ 4 * m₁ := by omega
rw [Hs] at upper_bound_expression
rw [show m₁ * s = s * m₁ by ring] at upper_bound_expression
exact le_of_mul_le_mul_right upper_bound_expression zero_lt_m₁
have lower_bound_s : 0 < s := by
have lower_bound_expression : 0 < 3 * x ^ 2 + y ^ 2 := by
have h1 : 0 < 3 * x ^ 2 := by rw [←sq_abs]; positivity
exact Int.add_pos_of_pos_of_nonneg h1 (sq_nonneg y)
rw [Hs] at lower_bound_expression
exact Int.pos_of_mul_pos_right lower_bound_expression zero_lt_m₁
have m₁_sub_5_mod_6 : ↑m₁ - 5 ≡ 0 [ZMOD 6] := by
exact Int.ModEq.sub (Int.natCast_modEq_iff.mpr m₁_eq_5_mod_6) rfl
interval_cases s
· -- s = 1
rw [mul_one] at Hs
exact leaf_contradiction Hs m₁_sub_5_mod_6
· -- s = 2
have := Int.modEq_zero_iff_dvd.mp m₁_sub_5_mod_6
dsimp[Dvd.dvd] at this
obtain ⟨c, this⟩ := this
have expr_m₁_mod_6 : ↑m₁ = 6 * c + 5 := sub_eq_iff_eq_add.mp this
rw[expr_m₁_mod_6] at Hs
ring_nf at Hs
have expression_mod_4 : ((x : (ZMod 4)) ^ 2 * 3 + y ^ 2) = ((10 + c * 12) : (ZMod 4)) := by
norm_cast
rw[Hs]
reduce_mod_char at expression_mod_4
obtain left_x | right_x := square_mod_4_zmod x
· rw[left_x] at expression_mod_4
obtain left_y | right_y := square_mod_4_zmod y
· rw[left_y] at expression_mod_4
simp (config := { arith := true, decide := true })at expression_mod_4
· rw[right_y] at expression_mod_4
simp (config := { arith := true, decide := true })at expression_mod_4
· rw[right_x] at expression_mod_4
obtain left_y | right_y := square_mod_4_zmod y
· rw[left_y] at expression_mod_4
simp (config := { arith := true, decide := true })at expression_mod_4
· rw[right_y] at expression_mod_4
simp (config := { arith := true, decide := true })at expression_mod_4
· -- s = 3
have := Int.modEq_zero_iff_dvd.mp m₁_sub_5_mod_6
dsimp[Dvd.dvd] at this
obtain ⟨c, this⟩ := this
have expr_m₁_mod_6 : ↑m₁ = 6 * c + 5 := by omega
rw[expr_m₁_mod_6] at Hs
ring_nf at Hs
have expression_mod_3 :
((x : (ZMod 3)) ^ 2 * 3 + y ^ 2) = ((15 + c * 18) : (ZMod 3)) := by
norm_cast
rw[Hs]
reduce_mod_char at expression_mod_3
have : (y : ZMod 3) = 0 := square_mod_3_zmod_0 expression_mod_3
have := (ZMod.intCast_zmod_eq_zero_iff_dvd y 3).mp this
dsimp[Dvd.dvd] at this
obtain⟨y', Hy'⟩ := this
rw[Hy'] at Hs
ring_nf at Hs
rw[show x ^ 2 * 3 + y' ^ 2 * 9 = 3 * (x ^ 2 + 3 * y' ^ 2) by ring] at Hs
rw[show 15 + c * 18 = 3 * (5 + 6 * c) by ring] at Hs
have reduced_expression : (x ^ 2 + 3 * y' ^ 2) = (5 + 6 * c) := by
omega
rw[show 5 + 6 * c = 6 * c + 5 by ring] at reduced_expression
rw[← expr_m₁_mod_6] at reduced_expression
rw[show x ^ 2 + 3 * y' ^ 2 = 3 * y' ^ 2 + x ^ 2 by ring] at reduced_expression
exact leaf_contradiction reduced_expression m₁_sub_5_mod_6
· -- s = 4
have : y^2 < m₁ := by
by_contra! H
have h1 : y^2 = m₁ := (Int.le_antisymm H y_higher).symm
rw [←sq_abs, Int.abs_eq_natAbs] at h1
norm_cast at h1
generalize hyy : y.natAbs = yy
rw [hyy] at h1
rw [←h1] at m₁_eq_2_mod_3
mod_cases Hyy : yy % 3 <;>
change _ % _ = _ % _ at Hyy m₁_eq_2_mod_3 <;>
simp [Nat.pow_mod, Hyy] at m₁_eq_2_mod_3
omega
end Bulgaria1998P11
| true | Copyright (c) 2023 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw, Adam Kurkiewicz
-/
import Mathlib
/-!
Bulgarian Mathematical Olympiad 1998, Problem 11
Let m,n be natural numbers such that
A = ((m + 3)ⁿ + 1) / (3m)
is an integer. Prove that A is odd.
-/
namespace Bulgaria1998P11
lemma mod_3_add_3_under_exponent (m n : ℕ) : ((m + 3) ^ n) ≡ (m ^ n) [MOD 3] := by
change (m + 3)^n % 3 = m ^ n % 3
simp [Nat.pow_mod]
lemma zero_pow_mod_3 {m n : ℕ} (h1 : n > 0) (h2 : m ≡ 0 [MOD 3]) : m ^ n ≡ 0 [MOD 3]:= by
change _ % 3 = 0 at h2 ⊢
rw [←Nat.dvd_iff_mod_eq_zero] at h2 ⊢
exact Dvd.dvd.pow h2 (Nat.ne_zero_of_lt h1)
lemma one_pow_mod_3 {m n : ℕ} (h2 : m ≡ 1 [MOD 3]) : m ^ n ≡ 1 [MOD 3]:= by
change _ % _ = 1 at h2 ⊢
simp [Nat.pow_mod, h2]
lemma two_even_pow_mod_3 {m n : ℕ} (h1 : Even n) (h2 : m ≡ 2 [MOD 3]) : m ^ n ≡ 1 [MOD 3] := by
change _ % _ = _ at h2 ⊢
obtain ⟨k, hk⟩ := h1
simp (config := { arith := true, decide := true }) [Nat.pow_mod, h2, hk, pow_mul]
theorem n_odd_and_m_eq_2_mod_3 (m n A : ℕ) (h : 3 * m * A = (m + 3)^n + 1) :
Odd n ∧ m ≡ 2 [MOD 3] := by
by_cases n_gt_zero : n > 0
· have h_mod_3 : 0 ≡ (m ^ n + 1) [MOD 3] := by
calc 0 ≡ 3 * (m * A) [MOD 3] := (Nat.mul_mod_right 3 (m * A)).symm
_ ≡ (3 * m * A) [MOD 3] := by rw[show 3 * (m * A) = (3 * m * A) by ring]
_ ≡ ((m + 3) ^ n + 1) [MOD 3] := by rw[h]
_ ≡ (m ^ n + 1) [MOD 3] := Nat.ModEq.add (mod_3_add_3_under_exponent m n) rfl
mod_cases mod_case : m % 3
· have towards_contradiction : 0 ≡ 1 [MOD 3] := by
calc 0 ≡ m ^ n + 1 [MOD 3] := h_mod_3
_ ≡ 0 + 1 [MOD 3] := Nat.ModEq.add (zero_pow_mod_3 n_gt_zero mod_case) rfl
_ ≡ 1 [MOD 3] := by rfl
contradiction
· have towards_contradiction : 0 ≡ 2 [MOD 3] := by
rw[show 2 = 1 + 1 by ring]
calc 0 ≡ m ^ n + 1 [MOD 3] := h_mod_3
_ ≡ 1 + 1 [MOD 3] := Nat.ModEq.add (one_pow_mod_3 mod_case) rfl
contradiction
· by_cases n_even : Even n
· have towards_contradiction : 0 ≡ 2 [MOD 3] := by
calc 0 ≡ m ^ n + 1 [MOD 3] := h_mod_3
_ ≡ 1 + 1 [MOD 3] := Nat.ModEq.add (two_even_pow_mod_3 n_even mod_case) rfl
_ ≡ 2 [MOD 3] := by rfl
contradiction
· rw [Nat.not_even_iff_odd] at n_even
exact ⟨n_even, mod_case⟩
· rw [Nat.eq_zero_of_not_pos n_gt_zero] at h
omega
lemma not_one_le_k {k : ℕ} (h : ¬1 ≤ k) : k = 0 := by
simp_all only [not_le, Nat.lt_one_iff]
lemma two_le_pow_two (l : ℕ) : 2 ≤ 2 ^ (l + 1) := by
rw [pow_succ]
suffices 1 ≤ 2 ^ l from Nat.le_mul_of_pos_left 2 this
exact Nat.one_le_two_pow
lemma two_n_and_rest_factorisation (m : ℕ) (even_m : Even m) (h: 0 < m) :
∃ (l : ℕ) (m₁ : ℕ), 1 ≤ l ∧ Odd m₁ ∧ m = 2 ^ l * m₁ := by
have ⟨a, ha⟩ := (pow_padicValNat_dvd : 2 ^ padicValNat 2 m ∣ m)
refine ⟨padicValNat 2 m, a, ?_⟩
obtain ⟨k, hk⟩ := even_iff_two_dvd.mp even_m
have hk0 : 0 < k := by omega
refine ⟨?_, ?_, ha⟩
· rw [hk]
rw [show 2 * k = 2^1 * k from rfl]
rw [padicValNat_base_pow_mul one_lt_two hk0.ne']
exact Nat.le_add_left 1 (padicValNat 2 k)
· by_contra! Ha
rw [Nat.not_odd_iff_even] at Ha
obtain ⟨b, hb⟩ := Ha
have h3 : 2 ^ (padicValNat 2 m + 1) ∣ m := by
use b
rw [hb] at ha
rw [pow_succ]
linarith only [ha]
have h4 := (Nat.pow_dvd_iff_le_padicValNat (by omega) (Nat.ne_zero_of_lt h)).mp h3
exact (lt_self_iff_false _).mp (Nat.succ_le_iff.mp h4)
lemma m_mod_2_contradiction (m n A : ℕ)
(even_A : Even A)
(m_eq_2_mod_4 : m ≡ 2 [MOD 4])
(h : 3 * m * A = (m + 3)^n + 1) : False := by
rw [← ZMod.natCast_eq_natCast_iff] at m_eq_2_mod_4
apply_fun (fun x ↦ (x : ZMod 4)) at h
push_cast at h
rw [m_eq_2_mod_4] at h
obtain ⟨a, rfl⟩ := even_A
push_cast at h
rw [←two_mul] at h
ring_nf at h; reduce_mod_char at h
rw [one_pow n] at h
simp (config := { arith := true, decide := true })at h
lemma m_add_3_pow_n_mod_m (n m : ℕ) : (m + 3)^n ≡ 3^n [MOD m] := by
simp [Nat.ModEq, Nat.pow_mod]
lemma too_good_to_be_true (n l : ℕ)
(three_le_l : 3 ≤ l)
(two_pow_l_divides_expresion : 2^l ∣ (3^n + 1))
(expression_eq_4_mod_8 : 3^n + 1 ≡ 4 [MOD 8]) : False := by
have : 8 ∣ 3 ^ n + 1 := by
obtain ⟨a, Ha⟩ := two_pow_l_divides_expresion
obtain ⟨b, Hb⟩ := Nat.exists_eq_add_of_le' three_le_l
rw[Hb] at Ha
dsimp [Dvd.dvd]
use 2 ^ b * a
rw[Ha]
ring
obtain ⟨a, Ha⟩ := this
rw [Ha] at expression_eq_4_mod_8
dsimp[Nat.ModEq] at expression_eq_4_mod_8
simp at expression_eq_4_mod_8
lemma thue
(a n : ℕ) (hn : 1 < n) :
∃ (x y : ℤ), (a : ZMod n) * x + y = 0 ∧ 0 < |x| ∧ x ^ 2 ≤ n ∧ y ^ 2 ≤ n := by
-- https://services.artofproblemsolving.com/download.php?id=YXR0YWNobWVudHMvMy8yL2QzYjEzOGM0ODE3YzYwZGU4NGFmOTEwZDc0ZGNhODRjOGMyMzZlLnBkZg==&rn=dGh1ZS12NC5wZGY=
-- let r = ⌊√n⌋, i.e. r is the unique integer for which
-- r² ≤ n < (r + 1)².
let r := Nat.sqrt n
-- The number of pairs (x,y) so that 0 ≤ x,y ≤ r is (r + 1)² which
-- is greater than n.
--
-- Therefore there must be two different pairs (x₁, y₁) and (x₂, y₂)
-- such that
-- ax₁ + y₁ = ax₂ + ay₂ (mod n)
-- i.e.
-- a(x₁ - x₂) = y₂ - y₁ (mod n)
--
let D := Fin (r + 1) × Fin (r + 1)
let f : D → ZMod n := fun ⟨x,y⟩ ↦ a * (x.val : ZMod n) + (y.val : ZMod n)
have cardD : Fintype.card D = (r + 1)^2 := by
unfold D
rw [sq, Fintype.card_prod, Fintype.card_fin]
have : NeZero n := NeZero.of_gt hn
have cardZ : Fintype.card (ZMod n) = n := ZMod.card n
have hDZ : Fintype.card (ZMod n) < Fintype.card D := by
rw [cardD, cardZ]
exact Nat.lt_succ_sqrt' n
obtain ⟨⟨x₁, y₁⟩, ⟨x₂, y₂⟩, hxyn, hxy⟩ :=
Fintype.exists_ne_map_eq_of_card_lt f hDZ
dsimp [f] at hxy
replace hxy : (a : ZMod n) * (↑↑x₁ - ↑↑x₂) + (↑↑y₁ - ↑↑y₂) = 0 :=
by linear_combination hxy
use (x₁ : ℤ) - (x₂ : ℤ)
use (y₁ : ℤ) - (y₂ : ℤ)
have hx1 : ((x₁ : ℕ): ZMod n) = (((x₁ : ℕ): ℤ) : ZMod n) := by
norm_cast
have hx2 : ((x₂ : ℕ): ZMod n) = (((x₂ : ℕ): ℤ) : ZMod n) := by
norm_cast
have hx3 : (((x₁ : ℕ): ℤ) : ZMod n) - (((x₂ : ℕ): ℤ) : ZMod n) =
(((((x₁ : ℕ): ℤ) -((x₂ : ℕ): ℤ)) : ℤ) : ZMod n) := by
norm_cast
have hy1 : ((y₁ : ℕ): ZMod n) = (((y₁ : ℕ): ℤ) : ZMod n) := by
norm_cast
have hy2 : ((y₂ : ℕ): ZMod n) = (((y₂ : ℕ): ℤ) : ZMod n) := by
norm_cast
have hy3 : (((y₁ : ℕ): ℤ) : ZMod n) - (((y₂ : ℕ): ℤ) : ZMod n) =
(((((y₁ : ℕ): ℤ) -((y₂ : ℕ): ℤ)) : ℤ) : ZMod n) := by
norm_cast
refine ⟨?_, ?_, ?_, ?_⟩
· rw [hx1, hx2, hx3, hy1, hy2, hy3] at hxy
rw [hxy]
· by_contra! H
replace H : |((x₁:ℕ):ℤ) - ↑↑x₂| = 0 := by
have : (0 : ℤ) ≤ |((x₁:ℕ):ℤ) - ↑↑x₂| := abs_nonneg _
exact (Int.le_antisymm this H).symm
rw [abs_eq_zero] at H
replace H : ((x₁:ℕ):ℤ) = ↑↑x₂ := Int.eq_of_sub_eq_zero H
replace H : x₁.val = x₂.val := Int.ofNat_inj.mp H
replace H : x₁ = x₂ := Fin.eq_of_val_eq H
rw [H, sub_self, mul_zero, zero_add] at hxy
have h4 : ((y₁:ℕ): ZMod n) = ↑↑y₂ := by linear_combination hxy
rw [ZMod.natCast_eq_natCast_iff'] at h4
have p1 := y₁.prop
have p2 := y₂.prop
have : r + 1 ≤ n := by
have h31 := Nat.sqrt_lt_self hn
omega
have h10 : y₁.val < n := by omega
have h11 : y₂.val < n := by omega
rw [Nat.mod_eq_of_lt h10, Nat.mod_eq_of_lt h11] at h4
have h12 : y₁ = y₂ := Fin.eq_of_val_eq h4
rw [H,h12] at hxyn
simp at hxyn
· have hx₁ : x₁.val < r + 1 := x₁.prop
have hx₂ : x₂.val < r + 1 := x₂.prop
have hr1 : r^2 ≤ n := Nat.sqrt_le' n
nlinarith only [hx₁, hx₂, hr1]
· have hy₁ : y₁.val < r + 1 := y₁.prop
have hy₂ : y₂.val < r + 1 := y₂.prop
have hr1 : r^2 ≤ n := Nat.sqrt_le' n
nlinarith only [hy₁, hy₂, hr1]
/--
In this version of Thue's lemma, we get an `x` that is nonzero and
a `y` that might be zero. If we wanted to guarantee that `y` is nonzero,
we would need an extra hypothesis `Nat.Coprime a n`.
-/
lemma Thue's_lemma
(a n : ℕ)
(hn : 1 < n) :
∃ (x y : ℤ),
a * x + y ≡ 0 [ZMOD n] ∧
0 < |x| ∧
x ^ 2 ≤ n ∧
y ^ 2 ≤ n := by
obtain ⟨x, y, hxay, hx, hx1, hy1⟩ := thue a n hn
refine ⟨x, y, ?_, hx, hx1, hy1⟩
have h1 : (a : ZMod n) * (x : ZMod n) + (y : ZMod n) =
((((a : ℤ) * x + y):ℤ) : ZMod n) := by norm_cast
have h2 : ((0:ℤ):ZMod n) = 0 := by norm_cast
rw [h1, ←h2] at hxay
exact (ZMod.intCast_eq_intCast_iff (a * x + y) 0 n).mp hxay
example (a b n : ℕ) (ha : a < n + 1) (hb : b < n + 1) : ((a : ℤ) - (b : ℤ))^2 ≤ n^2 := by
nlinarith
lemma square_mod_4_zmod (x : ZMod 4) : x ^ 2 = 1 ∨ x ^ 2 = 0 := by
fin_cases x <;> simp (config := { arith := true, decide := true })lemma square_mod_3_zmod_0 : ∀ {x : ZMod 3} (_ : x ^ 2 = 0), x = 0 := by
decide
lemma leaf_contradiction {x y m₁ : ℤ} (h: 3 * x ^ 2 + y ^ 2 = m₁) (h2 : m₁ - 5 ≡ 0 [ZMOD 6]) :
False := by
replace h2 : m₁ - 5 ≡ 0 [ZMOD 3] := Int.ModEq.of_mul_left 2 h2
rw [show 3 = ((3:ℕ):ℤ) by rfl] at h2
rw [← ZMod.intCast_eq_intCast_iff] at h2
apply_fun (fun x ↦ (x : ZMod 3)) at h
push_cast at h h2
replace h2 : (m₁:ZMod 3) = 5 := by linear_combination h2
rw [h2] at h
reduce_mod_char at h
generalize hz : (y : ZMod 3) = z
fin_cases z <;> rw [hz] at h <;> grind
theorem bulgaria1998_p11
(m n A : ℕ)
(h : 3 * m * A = (m + 3)^n + 1) : Odd A := by
-- Follows the second solution in _Mathematical Olympiads 1998-1999_
-- (edited by Titu Andreescu and Zuming Feng)
have ⟨⟨k, Hk⟩, m_eq_2_mod_3⟩ : Odd n ∧ m ≡ 2 [MOD 3] := n_odd_and_m_eq_2_mod_3 m n A h
by_contra even_A
rw [Nat.not_odd_iff_even] at even_A
have zero_lt_m : 0 < m := by
by_contra m_eq_0
replace m_eq_0 := not_one_le_k m_eq_0
rw [m_eq_0] at h
ring_nf at h
have : 1 + 3 ^ n > 0 := by positivity
rw [← h] at this
contradiction
have even_m : Even m := by
have n_ne_zero : n ≠ 0 := by omega
replace evenA : (A : ZMod 2) = (0:ℕ) := by
rw [Nat.even_iff] at even_A
exact (ZMod.natCast_eq_natCast_iff' A 0 2).mpr even_A
suffices H : (m : ZMod 2) = (0:ℕ)
· rw [ZMod.natCast_eq_natCast_iff] at H
exact Nat.even_iff.mpr H
apply_fun (fun x ↦ (x : ZMod 2)) at h
push_cast at h
rw [evenA] at h
simp only [Nat.cast_zero, mul_zero] at h
generalize hm' : (m : ZMod 2) = m'
rw [hm'] at h
fin_cases m'
· rfl
· dsimp only [Nat.reduceAdd, Fin.mk_one, Fin.isValue] at h
reduce_mod_char at h
rw [zero_pow n_ne_zero, zero_add] at h
exact (zero_ne_one h).elim
obtain ⟨l, m₁, ⟨one_le_l, odd_m₁, m_factorisation⟩⟩ :=
two_n_and_rest_factorisation m even_m zero_lt_m
by_cases l_eq_one : (l = 1)
· rw [l_eq_one] at m_factorisation
ring_nf at m_factorisation
have : m₁ ≡ 1 [MOD 4] ∨ m₁ ≡ 3 [MOD 4] := by
obtain ⟨a, rfl⟩ := odd_m₁
obtain ⟨b, rfl⟩ | ⟨b, rfl⟩ := Nat.even_or_odd a
· left
dsimp [Nat.ModEq]
ring_nf
simp
· right
dsimp [Nat.ModEq]
ring_nf
simp
have m_eq_2_mod_4 : m ≡ 2 [MOD 4] := by
rw [m_factorisation]
obtain left | right := this
· nth_rw 2 [show 2 = 1 * 2 by rfl]
exact Nat.ModEq.mul_right _ left
· calc m₁ * 2 ≡ 3 * 2 [MOD 4] := Nat.ModEq.mul right rfl
_ ≡ 2 [MOD 4] := rfl
exact m_mod_2_contradiction m n A even_A m_eq_2_mod_4 h
· have eq_2 : 0 ≡ 3^n + 1 [MOD m] := by
calc 0 ≡ m * (3 * A) [MOD m] := by
rw[show 0 = 0 * (3 * A) by ring]
refine Nat.ModEq.mul_right _ ?_
simp [Nat.ModEq]
_ ≡ 3 * m * A [MOD m] := by rw[show m * (3 * A) = 3 * m * A by ring]
_ ≡ (m + 3)^n + 1 [MOD m] := by rw[h]
_ ≡ 3^n + 1 [MOD m] := by
refine Nat.ModEq.add_right _ ?_
exact m_add_3_pow_n_mod_m n m
have l_eq_2 : l = 2 := by
have two_le_l : 2 ≤ l := by omega
obtain left | right := lt_or_eq_of_le two_le_l
· have two_pow_l_divides_expresion : 2 ^ l ∣ (3^n + 1) := by
have m_divides_expression : m ∣ (3 ^ n) + 1 := by
exact (@Nat.modEq_zero_iff_dvd m (3^n + 1)).mp eq_2.symm
dsimp[Dvd.dvd]
obtain ⟨a, Ha⟩ := m_divides_expression
use m₁ * a
rw[show 2 ^ l * (m₁ * a) = (2 ^ l * m₁) * a by ring]
rw[← m_factorisation]
exact Ha
have expression_eq_4_mod_8 : 3^n + 1 ≡ 4 [MOD 8] := by
rw [←ZMod.natCast_eq_natCast_iff, Hk]
rw [pow_succ, pow_mul]
rw[show (3 ^ 2) = 9 by rfl]
push_cast
reduce_mod_char
rw [one_pow (M := ZMod 8) k]
simp (config := { arith := true, decide := true })exfalso
exact too_good_to_be_true
n l (show 3 ≤ l by exact left) two_pow_l_divides_expresion expression_eq_4_mod_8
· exact right.symm
have m_eq_4_m₁ : m = 4 * m₁ := by
rw[l_eq_2] at m_factorisation
exact m_factorisation
have m₁_divides_expresion : m₁ ∣ (3^n + 1) := by
have m_divides_expression : m ∣ (3 ^ n) + 1 := by
exact (@Nat.modEq_zero_iff_dvd m (3^n + 1)).mp eq_2.symm
dsimp[Dvd.dvd]
obtain ⟨a, Ha⟩ := m_divides_expression
use 2 ^ l * a
rw[show m₁ * (2 ^ l * a) = (2 ^ l * m₁) * a by ring]
rw[← m_factorisation]
exact Ha
have m₁_eq_2_mod_3 : m₁ ≡ 2 [MOD 3] := by
have step_1 : 4 * m₁ ≡ 2 [MOD 3] := by
rw[m_eq_4_m₁] at m_eq_2_mod_3
exact m_eq_2_mod_3
have step_2 : 4 * m₁ ≡ m₁ [MOD 3] := by
nth_rw 2 [show m₁ = 1 * m₁ by ring]
exact Nat.ModEq.mul rfl rfl
calc m₁ ≡ 4 * m₁ [MOD 3] := step_2.symm
_ ≡ 2 [MOD 3] := step_1
have m₁_eq_5_mod_6 : m₁ ≡ 5 [MOD 6] := by
mod_cases m_mod_six : m₁ % 6
· have step_1: m₁ * 2 ≡ 0 * 2 [MOD 6]:= Nat.ModEq.mul_right 2 m_mod_six
have step_2: m₁ * 2 ≡ 2 * 2 [MOD 3 * 2] := Nat.ModEq.mul_right' 2 m₁_eq_2_mod_3
simp at step_1
simp at step_2
exfalso
have := Nat.ModEq.trans step_2.symm step_1
contradiction
· have step_1: m₁ * 2 ≡ 1 * 2 [MOD 6]:= Nat.ModEq.mul_right 2 m_mod_six
have step_2: m₁ * 2 ≡ 2 * 2 [MOD 3 * 2] := Nat.ModEq.mul_right' 2 m₁_eq_2_mod_3
simp at step_1
simp at step_2
exfalso
have := Nat.ModEq.trans step_2.symm step_1
contradiction
· have : m₁ ≡ 1 [MOD 2] := by
obtain ⟨a, Ha⟩ := odd_m₁
rw[show 1 = 0 + 1 by norm_num]
rw[Ha]
refine Nat.ModEq.add_right _ ?_
simp[Nat.ModEq]
have step_1: m₁ * 2 ≡ 2 * 2 [MOD 3 * 2] := Nat.ModEq.mul_right' 2 m₁_eq_2_mod_3
have step_2: m₁ * 3 ≡ 1 * 3 [MOD 2 * 3] := Nat.ModEq.mul_right' 3 this
change m₁ * 2 + m₁ ≡ 2 * 2 + 5 [MOD 2 * 3] at step_2
exact Nat.ModEq.add_left_cancel step_1 step_2
· have step_1: m₁ * 2 ≡ 3 * 2 [MOD 6]:= Nat.ModEq.mul_right 2 m_mod_six
have step_2: m₁ * 2 ≡ 2 * 2 [MOD 3 * 2] := Nat.ModEq.mul_right' 2 m₁_eq_2_mod_3
simp at step_1
simp at step_2
exfalso
have := Nat.ModEq.trans step_2.symm step_1
contradiction
· have step_1: m₁ * 2 ≡ 4 * 2 [MOD 6]:= Nat.ModEq.mul_right 2 m_mod_six
have step_2: m₁ * 2 ≡ 2 * 2 [MOD 3 * 2] := Nat.ModEq.mul_right' 2 m₁_eq_2_mod_3
simp at step_1
simp at step_2
exfalso
have := Nat.ModEq.trans step_2.symm step_1
contradiction
· exact m_mod_six
have exists_a : ∃ a : ℕ, a = 3 ^ (k + 1) := by
use 3 ^ (k + 1)
obtain ⟨a, Ha⟩ := exists_a
have m₁_divides_for_thues_lemma : m₁ ∣ a^2 + 3 := by
apply Nat.modEq_zero_iff_dvd.mp
have step_1:= Nat.modEq_zero_iff_dvd.mpr m₁_divides_expresion
rw[Hk] at step_1
have step_2: 3 * (3 ^ (2 * k + 1) + 1) ≡ 3 * 0 [MOD m₁] := Nat.ModEq.mul_left 3 step_1
ring_nf at step_2
rw[show 3 ^ (k * 2) * 9 = 3 ^ ((k + 1) * 2 ) by ring] at step_2
have step_3 : 3 ^ ((k + 1) * 2) = (3 ^ (k + 1)) ^ (2) :=
pow_mul 3 (k + 1) 2
rw[step_3] at step_2
rw[← Ha] at step_2
ring_nf
exact step_2
have hn1 : 1 < m₁ := by
change _ % _ = _ % _ at m₁_eq_2_mod_3
omega
obtain ⟨x, y, x_y_props⟩ := Thue's_lemma a m₁ hn1
clear hn1
obtain ⟨mod_expression, x_lower, x_higher, y_higher⟩ := x_y_props
have lifted_m₁_result := Int.natCast_modEq_iff.mpr (Nat.modEq_zero_iff_dvd.mpr m₁_divides_for_thues_lemma)
norm_num at lifted_m₁_result
have expression : 3 * x ^ 2 + y ^ 2 ≡ 0 [ZMOD m₁] := by
have step_2 : a * x ≡ -y [ZMOD m₁] := by
rw [show -y = 0 - y by ring]
rw [show a * x = a * x + y - y by ring]
exact Int.ModEq.sub_right _ mod_expression
have step_3 : a ^ 2 * x ^ 2 ≡ y ^ 2 [ZMOD m₁] := by
rw [show a ^ 2 * x ^ 2 = (a * x) * (a * x) by ring]
rw [show y ^ 2 = (-y) * (-y) by ring]
exact Int.ModEq.mul step_2 step_2
have step_4: (-3) * x ^ 2 ≡ y ^ 2 [ZMOD m₁] := by
have step_1 : a ^ 2 ≡ -3 [ZMOD m₁] :=
Int.ModEq.add_right_cancel' 3 lifted_m₁_result
trans a ^ 2 * x ^ 2
· exact Int.ModEq.mul (step_1.symm) rfl
· exact step_3
have : ((-3) * x ^ 2) + (3 * x ^ 2) ≡ (y ^ 2) + (3 * x ^ 2) [ZMOD m₁] :=
Int.ModEq.add_right _ step_4
rw [show (-3) * x ^ 2 + (3 * x ^ 2) = 0 by ring] at this
rw [show y ^ 2 + 3 * x ^ 2 = 3 * x ^ 2 + y ^ 2 by ring] at this
exact this.symm
obtain ⟨s, Hs⟩ := Int.modEq_zero_iff_dvd.mp expression
rw [m_eq_4_m₁] at zero_lt_m
have zero_lt_m₁ : 0 < @Nat.cast ℤ _ m₁ := by omega
have upper_bound_s : s ≤ 4 := by
have upper_bound_expression: 3 * x ^ 2 + y ^ 2 ≤ 4 * m₁ := by omega
rw [Hs] at upper_bound_expression
rw [show m₁ * s = s * m₁ by ring] at upper_bound_expression
exact le_of_mul_le_mul_right upper_bound_expression zero_lt_m₁
have lower_bound_s : 0 < s := by
have lower_bound_expression : 0 < 3 * x ^ 2 + y ^ 2 := by
have h1 : 0 < 3 * x ^ 2 := by rw [←sq_abs]; positivity
exact Int.add_pos_of_pos_of_nonneg h1 (sq_nonneg y)
rw [Hs] at lower_bound_expression
exact Int.pos_of_mul_pos_right lower_bound_expression zero_lt_m₁
have m₁_sub_5_mod_6 : ↑m₁ - 5 ≡ 0 [ZMOD 6] := by
exact Int.ModEq.sub (Int.natCast_modEq_iff.mpr m₁_eq_5_mod_6) rfl
interval_cases s
· -- s = 1
rw [mul_one] at Hs
exact leaf_contradiction Hs m₁_sub_5_mod_6
· -- s = 2
have := Int.modEq_zero_iff_dvd.mp m₁_sub_5_mod_6
dsimp[Dvd.dvd] at this
obtain ⟨c, this⟩ := this
have expr_m₁_mod_6 : ↑m₁ = 6 * c + 5 := sub_eq_iff_eq_add.mp this
rw[expr_m₁_mod_6] at Hs
ring_nf at Hs
have expression_mod_4 : ((x : (ZMod 4)) ^ 2 * 3 + y ^ 2) = ((10 + c * 12) : (ZMod 4)) := by
norm_cast
rw[Hs]
reduce_mod_char at expression_mod_4
obtain left_x | right_x := square_mod_4_zmod x
· rw[left_x] at expression_mod_4
obtain left_y | right_y := square_mod_4_zmod y
· rw[left_y] at expression_mod_4
simp (config := { arith := true, decide := true })at expression_mod_4
· rw[right_y] at expression_mod_4
simp (config := { arith := true, decide := true })at expression_mod_4
· rw[right_x] at expression_mod_4
obtain left_y | right_y := square_mod_4_zmod y
· rw[left_y] at expression_mod_4
simp (config := { arith := true, decide := true })at expression_mod_4
· rw[right_y] at expression_mod_4
simp (config := { arith := true, decide := true })at expression_mod_4
· -- s = 3
have := Int.modEq_zero_iff_dvd.mp m₁_sub_5_mod_6
dsimp[Dvd.dvd] at this
obtain ⟨c, this⟩ := this
have expr_m₁_mod_6 : ↑m₁ = 6 * c + 5 := by omega
rw[expr_m₁_mod_6] at Hs
ring_nf at Hs
have expression_mod_3 :
((x : (ZMod 3)) ^ 2 * 3 + y ^ 2) = ((15 + c * 18) : (ZMod 3)) := by
norm_cast
rw[Hs]
reduce_mod_char at expression_mod_3
have : (y : ZMod 3) = 0 := square_mod_3_zmod_0 expression_mod_3
have := (ZMod.intCast_zmod_eq_zero_iff_dvd y 3).mp this
dsimp[Dvd.dvd] at this
obtain⟨y', Hy'⟩ := this
rw[Hy'] at Hs
ring_nf at Hs
rw[show x ^ 2 * 3 + y' ^ 2 * 9 = 3 * (x ^ 2 + 3 * y' ^ 2) by ring] at Hs
rw[show 15 + c * 18 = 3 * (5 + 6 * c) by ring] at Hs
have reduced_expression : (x ^ 2 + 3 * y' ^ 2) = (5 + 6 * c) := by
omega
rw[show 5 + 6 * c = 6 * c + 5 by ring] at reduced_expression
rw[← expr_m₁_mod_6] at reduced_expression
rw[show x ^ 2 + 3 * y' ^ 2 = 3 * y' ^ 2 + x ^ 2 by ring] at reduced_expression
exact leaf_contradiction reduced_expression m₁_sub_5_mod_6
· -- s = 4
have : y^2 < m₁ := by
by_contra! H
have h1 : y^2 = m₁ := (Int.le_antisymm H y_higher).symm
rw [←sq_abs, Int.abs_eq_natAbs] at h1
norm_cast at h1
generalize hyy : y.natAbs = yy
rw [hyy] at h1
rw [←h1] at m₁_eq_2_mod_3
mod_cases Hyy : yy % 3 <;>
change _ % _ = _ % _ at Hyy m₁_eq_2_mod_3 <;>
simp [Nat.pow_mod, Hyy] at m₁_eq_2_mod_3
omega
end Bulgaria1998P11 | null | v4.29.0-rc6 | test | [
"competition"
] | null | {"filename": "Bulgaria1998P11.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unsolved goals\ncase neg\nm n A : \u2115\nh : 3 * m * A = (m + 3) ^ 0 + 1\nn_gt_zero : \u00acn > 0\n\u22a2 Odd n \u2227 m \u2261 2 [MOD 3]", "unknown tactic", "unsolved goals\nm : \u2115\neven_m : Even m\nh : 0 < m\na : \u2115\nha : m = 2 ^ padicValNat 2 m * a\nk : \u2115\nhk : m = 2 * k\n\u22a2 0 < k", "unsolved goals\ncase intro\nm : \u2115\neven_m : Even m\nh : 0 < m\na : \u2115\nha : m = 2 ^ padicValNat 2 m * a\nk : \u2115\nhk : m = 2 * k\nhk0 : 0 < k\n\u22a2 1 \u2264 padicValNat 2 m \u2227 Odd a \u2227 m = 2 ^ padicValNat 2 m * a", "unknown tactic", "unsolved goals\na n : \u2115\nhn : 1 < n\nr : \u2115 := n.sqrt\nD : Type := Fin (r + 1) \u00d7 Fin (r + 1)\nf : D \u2192 ZMod n :=\n fun x =>\n match x with\n | (x, y) => \u2191a * \u2191\u2191x + \u2191\u2191y\ncardD : Fintype.card D = (r + 1) ^ 2\nthis : NeZero n\ncardZ : Fintype.card (ZMod n) = n\nhDZ : Fintype.card (ZMod n) < Fintype.card D\nx\u2081 y\u2081 x\u2082 y\u2082 : Fin (r + 1)\nhxyn : (x\u2081, y\u2081) \u2260 (x\u2082, y\u2082)\nhxy : \u2191\u2191y\u2081 - \u2191\u2191y\u2082 = 0\nhx1 : \u2191\u2191x\u2081 = \u2191\u2191\u2191x\u2081\nhx2 : \u2191\u2191x\u2082 = \u2191\u2191\u2191x\u2082\nhx3 : \u2191\u2191\u2191x\u2081 - \u2191\u2191\u2191x\u2082 = \u2191(\u2191\u2191x\u2081 - \u2191\u2191x\u2082)\nhy1 : \u2191\u2191y\u2081 = \u2191\u2191\u2191y\u2081\nhy2 : \u2191\u2191y\u2082 = \u2191\u2191\u2191y\u2082\nhy3 : \u2191\u2191\u2191y\u2081 - \u2191\u2191\u2191y\u2082 = \u2191(\u2191\u2191y\u2081 - \u2191\u2191y\u2082)\nH : x\u2081 = x\u2082\nh4 : \u2191y\u2081 % n = \u2191y\u2082 % n\np1 : \u2191y\u2081 < r + 1\np2 : \u2191y\u2082 < r + 1\nh31 : n.sqrt < n\n\u22a2 r + 1 \u2264 n", "unsolved goals\ncase h.refine_2\na n : \u2115\nhn : 1 < n\nr : \u2115 := n.sqrt\nD : Type := Fin (r + 1) \u00d7 Fin (r + 1)\nf : D \u2192 ZMod n :=\n fun x =>\n match x with\n | (x, y) => \u2191a * \u2191\u2191x + \u2191\u2191y\ncardD : Fintype.card D = (r + 1) ^ 2\nthis\u271d : NeZero n\ncardZ : Fintype.card (ZMod n) = n\nhDZ : Fintype.card (ZMod n) < Fintype.card D\nx\u2081 y\u2081 x\u2082 y\u2082 : Fin (r + 1)\nhxyn : (x\u2081, y\u2081) \u2260 (x\u2082, y\u2082)\nhxy : \u2191\u2191y\u2081 - \u2191\u2191y\u2082 = 0\nhx1 : \u2191\u2191x\u2081 = \u2191\u2191\u2191x\u2081\nhx2 : \u2191\u2191x\u2082 = \u2191\u2191\u2191x\u2082\nhx3 : \u2191\u2191\u2191x\u2081 - \u2191\u2191\u2191x\u2082 = \u2191(\u2191\u2191x\u2081 - \u2191\u2191x\u2082)\nhy1 : \u2191\u2191y\u2081 = \u2191\u2191\u2191y\u2081\nhy2 : \u2191\u2191y\u2082 = \u2191\u2191\u2191y\u2082\nhy3 : \u2191\u2191\u2191y\u2081 - \u2191\u2191\u2191y\u2082 = \u2191(\u2191\u2191y\u2081 - \u2191\u2191y\u2082)\nH : x\u2081 = x\u2082\nh4 : \u2191y\u2081 % n = \u2191y\u2082 % n\np1 : \u2191y\u2081 < r + 1\np2 : \u2191y\u2082 < r + 1\nthis : r + 1 \u2264 n\n\u22a2 False", "unsolved goals\ncase h.refine_3\na n : \u2115\nhn : 1 < n\nr : \u2115 := n.sqrt\nD : Type := Fin (r + 1) \u00d7 Fin (r + 1)\nf : D \u2192 ZMod n :=\n fun x =>\n match x with\n | (x, y) => \u2191a * \u2191\u2191x + \u2191\u2191y\ncardD : Fintype.card D = (r + 1) ^ 2\nthis : NeZero n\ncardZ : Fintype.card (ZMod n) = n\nhDZ : Fintype.card (ZMod n) < Fintype.card D\nx\u2081 y\u2081 x\u2082 y\u2082 : Fin (r + 1)\nhxyn : (x\u2081, y\u2081) \u2260 (x\u2082, y\u2082)\nhxy : \u2191a * (\u2191\u2191x\u2081 - \u2191\u2191x\u2082) + (\u2191\u2191y\u2081 - \u2191\u2191y\u2082) = 0\nhx1 : \u2191\u2191x\u2081 = \u2191\u2191\u2191x\u2081\nhx2 : \u2191\u2191x\u2082 = \u2191\u2191\u2191x\u2082\nhx3 : \u2191\u2191\u2191x\u2081 - \u2191\u2191\u2191x\u2082 = \u2191(\u2191\u2191x\u2081 - \u2191\u2191x\u2082)\nhy1 : \u2191\u2191y\u2081 = \u2191\u2191\u2191y\u2081\nhy2 : \u2191\u2191y\u2082 = \u2191\u2191\u2191y\u2082\nhy3 : \u2191\u2191\u2191y\u2081 - \u2191\u2191\u2191y\u2082 = \u2191(\u2191\u2191y\u2081 - \u2191\u2191y\u2082)\n\u22a2 (\u2191\u2191x\u2081 - \u2191\u2191x\u2082) ^ 2 \u2264 \u2191n\n\ncase h.refine_4\na n : \u2115\nhn : 1 < n\nr : \u2115 := n.sqrt\nD : Type := Fin (r + 1) \u00d7 Fin (r + 1)\nf : D \u2192 ZMod n :=\n fun x =>\n match x with\n | (x, y) => \u2191a * \u2191\u2191x + \u2191\u2191y\ncardD : Fintype.card D = (r + 1) ^ 2\nthis : NeZero n\ncardZ : Fintype.card (ZMod n) = n\nhDZ : Fintype.card (ZMod n) < Fintype.card D\nx\u2081 y\u2081 x\u2082 y\u2082 : Fin (r + 1)\nhxyn : (x\u2081, y\u2081) \u2260 (x\u2082, y\u2082)\nhxy : \u2191a * (\u2191\u2191x\u2081 - \u2191\u2191x\u2082) + (\u2191\u2191y\u2081 - \u2191\u2191y\u2082) = 0\nhx1 : \u2191\u2191x\u2081 = \u2191\u2191\u2191x\u2081\nhx2 : \u2191\u2191x\u2082 = \u2191\u2191\u2191x\u2082\nhx3 : \u2191\u2191\u2191x\u2081 - \u2191\u2191\u2191x\u2082 = \u2191(\u2191\u2191x\u2081 - \u2191\u2191x\u2082)\nhy1 : \u2191\u2191y\u2081 = \u2191\u2191\u2191y\u2081\nhy2 : \u2191\u2191y\u2082 = \u2191\u2191\u2191y\u2082\nhy3 : \u2191\u2191\u2191y\u2081 - \u2191\u2191\u2191y\u2082 = \u2191(\u2191\u2191y\u2081 - \u2191\u2191y\u2082)\n\u22a2 (\u2191\u2191y\u2081 - \u2191\u2191y\u2082) ^ 2 \u2264 \u2191n", "unknown tactic", "unsolved goals\nm n A : \u2115\nh : 3 * m * A = (m + 3) ^ n + 1\nk : \u2115\nHk : n = 2 * k + 1\nm_eq_2_mod_3 : m \u2261 2 [MOD 3]\neven_A : Even A\nzero_lt_m : 0 < m\n\u22a2 n \u2260 0", "unsolved goals\nm n A : \u2115\nh : 3 * m * A = (m + 3) ^ n + 1\nk : \u2115\nHk : n = 2 * k + 1\nm_eq_2_mod_3 : m \u2261 2 [MOD 3]\neven_A : Even A\nzero_lt_m : 0 < m\nn_ne_zero : n \u2260 0\n\u22a2 Even m", "unsolved goals\nm n A : \u2115\nh : 3 * m * A = (m + 3) ^ n + 1\nk : \u2115\nHk : n = 2 * k + 1\nm_eq_2_mod_3 : m \u2261 2 [MOD 3]\neven_A : Even A\nzero_lt_m : 0 < m\neven_m : Even m\n\u22a2 False", "unexpected identifier; expected command"], "timeout_s": 600.0, "latency_s": 40.3366, "verified_at": "2026-03-26T18:16:01.505278+00:00"}} | false | true | false | 40.3366 |
compfiles_Bulgaria1998P2 | compfiles | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# Bulgarian Mathematical Olympiad 1998, Problem 2
A convex quadrilateral ABCD has AD = CD and ∠DAB = ∠ABC < 90°.
The line through D and the midpoint of BC intersects line AB
in point E. Prove that ∠BEC = ∠DAC. (Note: The problem is valid
without the assumption ∠ABC < 90°.)
-/
namespace Bulgaria1998P2
open EuclideanGeometry
theorem bulgaria1998_p2
(A B C D E M : EuclideanSpace ℝ (Fin 2))
(H1 : dist D A = dist D C)
(H2 : ∠ D A B = ∠ A B C)
(H3 : M = midpoint ℝ B C) :
∠ B E C = ∠ D A C := by
let x := ∠ D A C
have : ∠ D A C = ∠ D C A := EuclideanGeometry.angle_eq_angle_of_dist_eq H1
let y := ∠ C A B
have : ∠ A B C = x + y := by rw [←H2]; sorry -- need to switch to oangles?
sorry
end Bulgaria1998P2 | /- | /-
Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# Bulgarian Mathematical Olympiad 1998, Problem 2
A convex quadrilateral ABCD has AD = CD and ∠DAB = ∠ABC < 90°.
The line through D and the midpoint of BC intersects line AB
in point E. Prove that ∠BEC = ∠DAC. (Note: The problem is valid
without the assumption ∠ABC < 90°.)
-/
namespace Bulgaria1998P2
open EuclideanGeometry
theorem bulgaria1998_p2
(A B C D E M : EuclideanSpace ℝ (Fin 2))
(H1 : dist D A = dist D C)
(H2 : ∠ D A B = ∠ A B C)
(H3 : M = midpoint ℝ B C) :
∠ B E C = ∠ D A C := by
let x := ∠ D A C
have : ∠ D A C = ∠ D C A := EuclideanGeometry.angle_eq_angle_of_dist_eq H1
let y := ∠ C A B
have : ∠ A B C = x + y := by rw [←H2]; sorry -- need to switch to oangles?
sorry
end Bulgaria1998P2
| false | null | null | v4.29.0-rc6 | test | [
"competition"
] | null | {"filename": "Bulgaria1998P2.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": true, "errors": [], "timeout_s": 600.0, "latency_s": 33.2751, "verified_at": "2026-03-26T18:15:54.443933+00:00"}} | false | true | true | 33.2751 |
compfiles_Bulgaria1998P3 | compfiles | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# Bulgarian Mathematical Olympiad 1998, Problem 3
Let ℝ⁺ be the set of positive real numbers. Prove that there does not exist a function
f: ℝ⁺ → ℝ⁺ such that
(f(x))² ≥ f(x + y) * (f(x) + y)
for every x,y ∈ ℝ⁺.
-/
namespace Bulgaria1998P3
lemma geom_sum_bound (n : ℕ) : ∑ i ∈ Finset.range n, (1:ℝ) / (2^i) < 3 :=
calc ∑ i ∈ Finset.range n, (1:ℝ) / ((2:ℝ)^i)
= ∑ i ∈ Finset.range n, ((1:ℝ) / 2)^i := by {congr; simp [div_eq_mul_inv]}
_ ≤ 2 := sum_geometric_two_le n
_ < 3 := by norm_num
theorem bulgaria1998_p3
(f : ℝ → ℝ)
(hpos : ∀ x : ℝ, 0 < x → 0 < f x)
(hf : (∀ x y : ℝ, 0 < x → 0 < y → (f (x + y)) * (f x + y) ≤ (f x)^2)) :
False := by
-- Follows the "second solution" of _Mathematical Olympiads 1998-1999_
-- (edited by Titu Andreescu and Zuming Feng)
have f_decr : ∀ x y : ℝ, 0 < x → 0 < y → f (x + y) < f x := by
intro x y hx hy
have h1 := hf x y hx hy
have h2 : 0 < f x + y := add_pos (hpos x hx) hy
have h4 : f x < f x + y := lt_add_of_pos_right (f x) hy
have h5 : f x / (f x + y) < 1 := (div_lt_one h2).mpr h4
calc f (x + y)
= f (x + y) * 1 := (mul_one (f (x + y))).symm
_ = f (x + y) * ((f x + y) / (f x + y)) := by rw [div_self (Ne.symm (ne_of_lt h2))]
_ = (f (x + y) * (f x + y)) / (f x + y) := mul_div_assoc' _ _ _
_ ≤ (f x)^2 / (f x + y) := (div_le_div_iff_of_pos_right h2).mpr h1
_ = (f x) * (f x / (f x + y)) := by field_simp [pow_two]
_ < f x := (mul_lt_iff_lt_one_right (hpos x hx)).mpr h5
have f_half : ∀ x : ℝ, 0 < x → f (x + f x) ≤ f x / 2 := by
intro x hx
have h0 := hpos x hx
have h1 := hf x (f x) hx h0
have h2 : 0 < f x + f x := add_pos h0 h0
have h3 : 0 ≠ f x + f x := ne_of_lt h2
have h6: 2 * f x ≠ 0 := by positivity
have h7 : (f x / (2 * f x)) = 1 / 2 := by { rw [div_eq_iff h6]; ring }
calc f (x + f x)
= f (x + f x) * 1 := (mul_one _).symm
_ = f (x + f x) * ((f x + f x) / (f x + f x)) := by rw [div_self (Ne.symm h3)]
_ = (f (x + f x) * (f x + f x)) / (f x + f x) := mul_div_assoc' _ _ _
_ ≤ (f x)^2 / (f x + f x) := (div_le_div_iff_of_pos_right h2).mpr h1
_ = (f x) * (f x / (f x + f x)) := by field_simp [pow_two]
_ = (f x) * (f x / (2 * f x)) := by rw [two_mul]
_ = f x / 2 := by field_simp [h7]
let x_seq : ℕ → ℝ := λ n : ℕ ↦ 1 + ∑ i ∈ Finset.range n, (f 1) / (2^i)
have hz : x_seq 0 = 1 := by
simp only [x_seq, add_eq_left, Finset.sum_empty, Finset.range_zero]
have hf1 := hpos 1 zero_lt_one
have x_seq_pos : ∀ n: ℕ, 0 < x_seq n := by
intro n
positivity
have f_x_seq: ∀ n : ℕ, f (x_seq n) ≤ f 1 / 2^n := by
intro n
induction n with
| zero => rw [hz]; simp only [pow_zero, div_one, le_refl]
| succ pn hpn =>
have hpp : x_seq pn.succ = x_seq pn + f 1 / 2^pn := by
rw [show x_seq _ = 1 + ∑ i ∈ Finset.range _, (f 1) / (2^i) by rfl]
have : ∑ i ∈ Finset.range pn.succ, f 1 / 2 ^ i =
f 1 / 2 ^ pn + ∑ i ∈ Finset.range pn, f 1 / 2 ^ i :=
Finset.sum_range_succ_comm (λ (x : ℕ) ↦ f 1 / 2 ^ x) pn
rw [this]
ring
have h1 : f (x_seq pn.succ) ≤ f (x_seq pn + f (x_seq pn)) := by
rw [hpp]
obtain heq | hlt := eq_or_lt_of_le hpn
· rw [heq]
· have := le_of_lt (f_decr (x_seq pn + f (x_seq pn)) (f 1 / 2 ^ pn - f (x_seq pn))
(add_pos (x_seq_pos pn) (hpos (x_seq pn) (x_seq_pos pn)))
(sub_pos.mpr hlt))
rw [add_add_sub_cancel] at this
exact this
calc f (x_seq pn.succ)
≤ f (x_seq pn + f (x_seq pn)) := h1
_ ≤ f (x_seq pn) / 2 := f_half (x_seq pn) (x_seq_pos pn)
_ ≤ (f 1 / 2 ^ pn) / 2 := (div_le_div_iff_of_pos_right two_pos).mpr hpn
_ = f 1 / 2 ^ pn.succ := by field_simp [ne_of_gt hf1]; exact pow_succ 2 pn
have h1: ∀ n: ℕ, x_seq n < 1 + 3 * f 1 := by
intro n
norm_num [x_seq]
have : MulPosStrictMono ℝ := MulPosReflectLT.toMulPosStrictMono ℝ
calc ∑ i ∈ Finset.range n, f 1 / (2:ℝ) ^ i
= (∑ i ∈ Finset.range n, 1 / (2:ℝ) ^ i) * f 1 := by rw [Finset.sum_mul]; field_simp
_ < 3 * f 1 := (mul_lt_mul_iff_left₀ hf1).mpr (geom_sum_bound n)
have h2 : ∀ n : ℕ, 0 < 1 + 3 * f 1 - x_seq n := by intro n; linarith [h1 n]
have h3 : ∀ n : ℕ, f (1 + 3 * f 1) < f 1 / 2 ^ n := by
intro n
calc f (1 + 3 * f 1)
= f (x_seq n + (1 + 3 * f 1 - x_seq n)) := by
simp only [x_seq, add_sub_add_left_eq_sub, add_add_sub_cancel]
_ < f (x_seq n) := f_decr (x_seq n) _ (x_seq_pos n) (h2 n)
_ ≤ f 1 / 2^n := f_x_seq n
have he : ∃n : ℕ, f 1 / 2^n < f (1 + 3 * f 1) := by
obtain ⟨N, hN⟩ := pow_unbounded_of_one_lt (f 1 / f (1 + 3 * f 1)) one_lt_two
use N
have hp : 0 < f (1 + 3 * f 1) :=
hpos (1 + 3 * f 1) (lt_trans (x_seq_pos 0) (h1 0))
have h2N : (0:ℝ) < 2^N := pow_pos two_pos N
exact (div_lt_iff₀ h2N).mpr ((div_lt_iff₀' hp).mp hN)
obtain ⟨N, hN⟩ := he
exact lt_irrefl _ (lt_trans (h3 N) hN)
end Bulgaria1998P3 | /- | /-
Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# Bulgarian Mathematical Olympiad 1998, Problem 3
Let ℝ⁺ be the set of positive real numbers. Prove that there does not exist a function
f: ℝ⁺ → ℝ⁺ such that
(f(x))² ≥ f(x + y) * (f(x) + y)
for every x,y ∈ ℝ⁺.
-/
namespace Bulgaria1998P3
lemma geom_sum_bound (n : ℕ) : ∑ i ∈ Finset.range n, (1:ℝ) / (2^i) < 3 :=
calc ∑ i ∈ Finset.range n, (1:ℝ) / ((2:ℝ)^i)
= ∑ i ∈ Finset.range n, ((1:ℝ) / 2)^i := by {congr; simp [div_eq_mul_inv]}
_ ≤ 2 := sum_geometric_two_le n
_ < 3 := by norm_num
theorem bulgaria1998_p3
(f : ℝ → ℝ)
(hpos : ∀ x : ℝ, 0 < x → 0 < f x)
(hf : (∀ x y : ℝ, 0 < x → 0 < y → (f (x + y)) * (f x + y) ≤ (f x)^2)) :
False := by
-- Follows the "second solution" of _Mathematical Olympiads 1998-1999_
-- (edited by Titu Andreescu and Zuming Feng)
have f_decr : ∀ x y : ℝ, 0 < x → 0 < y → f (x + y) < f x := by
intro x y hx hy
have h1 := hf x y hx hy
have h2 : 0 < f x + y := add_pos (hpos x hx) hy
have h4 : f x < f x + y := lt_add_of_pos_right (f x) hy
have h5 : f x / (f x + y) < 1 := (div_lt_one h2).mpr h4
calc f (x + y)
= f (x + y) * 1 := (mul_one (f (x + y))).symm
_ = f (x + y) * ((f x + y) / (f x + y)) := by rw [div_self (Ne.symm (ne_of_lt h2))]
_ = (f (x + y) * (f x + y)) / (f x + y) := mul_div_assoc' _ _ _
_ ≤ (f x)^2 / (f x + y) := (div_le_div_iff_of_pos_right h2).mpr h1
_ = (f x) * (f x / (f x + y)) := by field_simp [pow_two]
_ < f x := (mul_lt_iff_lt_one_right (hpos x hx)).mpr h5
have f_half : ∀ x : ℝ, 0 < x → f (x + f x) ≤ f x / 2 := by
intro x hx
have h0 := hpos x hx
have h1 := hf x (f x) hx h0
have h2 : 0 < f x + f x := add_pos h0 h0
have h3 : 0 ≠ f x + f x := ne_of_lt h2
have h6: 2 * f x ≠ 0 := by positivity
have h7 : (f x / (2 * f x)) = 1 / 2 := by { rw [div_eq_iff h6]; ring }
calc f (x + f x)
= f (x + f x) * 1 := (mul_one _).symm
_ = f (x + f x) * ((f x + f x) / (f x + f x)) := by rw [div_self (Ne.symm h3)]
_ = (f (x + f x) * (f x + f x)) / (f x + f x) := mul_div_assoc' _ _ _
_ ≤ (f x)^2 / (f x + f x) := (div_le_div_iff_of_pos_right h2).mpr h1
_ = (f x) * (f x / (f x + f x)) := by field_simp [pow_two]
_ = (f x) * (f x / (2 * f x)) := by rw [two_mul]
_ = f x / 2 := by field_simp [h7]
let x_seq : ℕ → ℝ := λ n : ℕ ↦ 1 + ∑ i ∈ Finset.range n, (f 1) / (2^i)
have hz : x_seq 0 = 1 := by
simp only [x_seq, add_eq_left, Finset.sum_empty, Finset.range_zero]
have hf1 := hpos 1 zero_lt_one
have x_seq_pos : ∀ n: ℕ, 0 < x_seq n := by
intro n
positivity
have f_x_seq: ∀ n : ℕ, f (x_seq n) ≤ f 1 / 2^n := by
intro n
induction n with
| zero => rw [hz]; simp only [pow_zero, div_one, le_refl]
| succ pn hpn =>
have hpp : x_seq pn.succ = x_seq pn + f 1 / 2^pn := by
rw [show x_seq _ = 1 + ∑ i ∈ Finset.range _, (f 1) / (2^i) by rfl]
have : ∑ i ∈ Finset.range pn.succ, f 1 / 2 ^ i =
f 1 / 2 ^ pn + ∑ i ∈ Finset.range pn, f 1 / 2 ^ i :=
Finset.sum_range_succ_comm (λ (x : ℕ) ↦ f 1 / 2 ^ x) pn
rw [this]
ring
have h1 : f (x_seq pn.succ) ≤ f (x_seq pn + f (x_seq pn)) := by
rw [hpp]
obtain heq | hlt := eq_or_lt_of_le hpn
· rw [heq]
· have := le_of_lt (f_decr (x_seq pn + f (x_seq pn)) (f 1 / 2 ^ pn - f (x_seq pn))
(add_pos (x_seq_pos pn) (hpos (x_seq pn) (x_seq_pos pn)))
(sub_pos.mpr hlt))
rw [add_add_sub_cancel] at this
exact this
calc f (x_seq pn.succ)
≤ f (x_seq pn + f (x_seq pn)) := h1
_ ≤ f (x_seq pn) / 2 := f_half (x_seq pn) (x_seq_pos pn)
_ ≤ (f 1 / 2 ^ pn) / 2 := (div_le_div_iff_of_pos_right two_pos).mpr hpn
_ = f 1 / 2 ^ pn.succ := by field_simp [ne_of_gt hf1]; exact pow_succ 2 pn
have h1: ∀ n: ℕ, x_seq n < 1 + 3 * f 1 := by
intro n
norm_num [x_seq]
have : MulPosStrictMono ℝ := MulPosReflectLT.toMulPosStrictMono ℝ
calc ∑ i ∈ Finset.range n, f 1 / (2:ℝ) ^ i
= (∑ i ∈ Finset.range n, 1 / (2:ℝ) ^ i) * f 1 := by rw [Finset.sum_mul]; field_simp
_ < 3 * f 1 := (mul_lt_mul_iff_left₀ hf1).mpr (geom_sum_bound n)
have h2 : ∀ n : ℕ, 0 < 1 + 3 * f 1 - x_seq n := by intro n; linarith [h1 n]
have h3 : ∀ n : ℕ, f (1 + 3 * f 1) < f 1 / 2 ^ n := by
intro n
calc f (1 + 3 * f 1)
= f (x_seq n + (1 + 3 * f 1 - x_seq n)) := by
simp only [x_seq, add_sub_add_left_eq_sub, add_add_sub_cancel]
_ < f (x_seq n) := f_decr (x_seq n) _ (x_seq_pos n) (h2 n)
_ ≤ f 1 / 2^n := f_x_seq n
have he : ∃n : ℕ, f 1 / 2^n < f (1 + 3 * f 1) := by
obtain ⟨N, hN⟩ := pow_unbounded_of_one_lt (f 1 / f (1 + 3 * f 1)) one_lt_two
use N
have hp : 0 < f (1 + 3 * f 1) :=
hpos (1 + 3 * f 1) (lt_trans (x_seq_pos 0) (h1 0))
have h2N : (0:ℝ) < 2^N := pow_pos two_pos N
exact (div_lt_iff₀ h2N).mpr ((div_lt_iff₀' hp).mp hN)
obtain ⟨N, hN⟩ := he
exact lt_irrefl _ (lt_trans (h3 N) hN)
end Bulgaria1998P3
| true | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# Bulgarian Mathematical Olympiad 1998, Problem 3
Let ℝ⁺ be the set of positive real numbers. Prove that there does not exist a function
f: ℝ⁺ → ℝ⁺ such that
(f(x))² ≥ f(x + y) * (f(x) + y)
for every x,y ∈ ℝ⁺.
-/
namespace Bulgaria1998P3
lemma geom_sum_bound (n : ℕ) : ∑ i ∈ Finset.range n, (1:ℝ) / (2^i) < 3 :=
calc ∑ i ∈ Finset.range n, (1:ℝ) / ((2:ℝ)^i)
= ∑ i ∈ Finset.range n, ((1:ℝ) / 2)^i := by {congr; simp [div_eq_mul_inv]}
_ ≤ 2 := sum_geometric_two_le n
_ < 3 := by norm_num
theorem bulgaria1998_p3
(f : ℝ → ℝ)
(hpos : ∀ x : ℝ, 0 < x → 0 < f x)
(hf : (∀ x y : ℝ, 0 < x → 0 < y → (f (x + y)) * (f x + y) ≤ (f x)^2)) :
False := by
-- Follows the "second solution" of _Mathematical Olympiads 1998-1999_
-- (edited by Titu Andreescu and Zuming Feng)
have f_decr : ∀ x y : ℝ, 0 < x → 0 < y → f (x + y) < f x := by
intro x y hx hy
have h1 := hf x y hx hy
have h2 : 0 < f x + y := add_pos (hpos x hx) hy
have h4 : f x < f x + y := lt_add_of_pos_right (f x) hy
have h5 : f x / (f x + y) < 1 := (div_lt_one h2).mpr h4
calc f (x + y)
= f (x + y) * 1 := (mul_one (f (x + y))).symm
_ = f (x + y) * ((f x + y) / (f x + y)) := by rw [div_self (Ne.symm (ne_of_lt h2))]
_ = (f (x + y) * (f x + y)) / (f x + y) := mul_div_assoc' _ _ _
_ ≤ (f x)^2 / (f x + y) := (div_le_div_iff_of_pos_right h2).mpr h1
_ = (f x) * (f x / (f x + y)) := by field_simp [pow_two]
_ < f x := (mul_lt_iff_lt_one_right (hpos x hx)).mpr h5
have f_half : ∀ x : ℝ, 0 < x → f (x + f x) ≤ f x / 2 := by
intro x hx
have h0 := hpos x hx
have h1 := hf x (f x) hx h0
have h2 : 0 < f x + f x := add_pos h0 h0
have h3 : 0 ≠ f x + f x := ne_of_lt h2
have h6: 2 * f x ≠ 0 := by positivity
have h7 : (f x / (2 * f x)) = 1 / 2 := by { rw [div_eq_iff h6]; ring }
calc f (x + f x)
= f (x + f x) * 1 := (mul_one _).symm
_ = f (x + f x) * ((f x + f x) / (f x + f x)) := by rw [div_self (Ne.symm h3)]
_ = (f (x + f x) * (f x + f x)) / (f x + f x) := mul_div_assoc' _ _ _
_ ≤ (f x)^2 / (f x + f x) := (div_le_div_iff_of_pos_right h2).mpr h1
_ = (f x) * (f x / (f x + f x)) := by field_simp [pow_two]
_ = (f x) * (f x / (2 * f x)) := by rw [two_mul]
_ = f x / 2 := by field_simp [h7]
let x_seq : ℕ → ℝ := λ n : ℕ ↦ 1 + ∑ i ∈ Finset.range n, (f 1) / (2^i)
have hz : x_seq 0 = 1 := by
simp only [x_seq, add_eq_left, Finset.sum_empty, Finset.range_zero]
have hf1 := hpos 1 zero_lt_one
have x_seq_pos : ∀ n: ℕ, 0 < x_seq n := by
intro n
positivity
have f_x_seq: ∀ n : ℕ, f (x_seq n) ≤ f 1 / 2^n := by
intro n
induction n with
| zero => rw [hz]; simp only [pow_zero, div_one, le_refl]
| succ pn hpn =>
have hpp : x_seq pn.succ = x_seq pn + f 1 / 2^pn := by
rw [show x_seq _ = 1 + ∑ i ∈ Finset.range _, (f 1) / (2^i) by rfl]
have : ∑ i ∈ Finset.range pn.succ, f 1 / 2 ^ i =
f 1 / 2 ^ pn + ∑ i ∈ Finset.range pn, f 1 / 2 ^ i :=
Finset.sum_range_succ_comm (λ (x : ℕ) ↦ f 1 / 2 ^ x) pn
rw [this]
ring
have h1 : f (x_seq pn.succ) ≤ f (x_seq pn + f (x_seq pn)) := by
rw [hpp]
obtain heq | hlt := eq_or_lt_of_le hpn
· rw [heq]
· have := le_of_lt (f_decr (x_seq pn + f (x_seq pn)) (f 1 / 2 ^ pn - f (x_seq pn))
(add_pos (x_seq_pos pn) (hpos (x_seq pn) (x_seq_pos pn)))
(sub_pos.mpr hlt))
rw [add_add_sub_cancel] at this
exact this
calc f (x_seq pn.succ)
≤ f (x_seq pn + f (x_seq pn)) := h1
_ ≤ f (x_seq pn) / 2 := f_half (x_seq pn) (x_seq_pos pn)
_ ≤ (f 1 / 2 ^ pn) / 2 := (div_le_div_iff_of_pos_right two_pos).mpr hpn
_ = f 1 / 2 ^ pn.succ := by field_simp [ne_of_gt hf1]; exact pow_succ 2 pn
have h1: ∀ n: ℕ, x_seq n < 1 + 3 * f 1 := by
intro n
norm_num [x_seq]
have : MulPosStrictMono ℝ := MulPosReflectLT.toMulPosStrictMono ℝ
calc ∑ i ∈ Finset.range n, f 1 / (2:ℝ) ^ i
= (∑ i ∈ Finset.range n, 1 / (2:ℝ) ^ i) * f 1 := by rw [Finset.sum_mul]; field_simp
_ < 3 * f 1 := (mul_lt_mul_iff_left₀ hf1).mpr (geom_sum_bound n)
have h2 : ∀ n : ℕ, 0 < 1 + 3 * f 1 - x_seq n := by intro n; linarith [h1 n]
have h3 : ∀ n : ℕ, f (1 + 3 * f 1) < f 1 / 2 ^ n := by
intro n
calc f (1 + 3 * f 1)
= f (x_seq n + (1 + 3 * f 1 - x_seq n)) := by
simp only [x_seq, add_sub_add_left_eq_sub, add_add_sub_cancel]
_ < f (x_seq n) := f_decr (x_seq n) _ (x_seq_pos n) (h2 n)
_ ≤ f 1 / 2^n := f_x_seq n
have he : ∃n : ℕ, f 1 / 2^n < f (1 + 3 * f 1) := by
obtain ⟨N, hN⟩ := pow_unbounded_of_one_lt (f 1 / f (1 + 3 * f 1)) one_lt_two
use N
have hp : 0 < f (1 + 3 * f 1) :=
hpos (1 + 3 * f 1) (lt_trans (x_seq_pos 0) (h1 0))
have h2N : (0:ℝ) < 2^N := pow_pos two_pos N
exact (div_lt_iff₀ h2N).mpr ((div_lt_iff₀' hp).mp hN)
obtain ⟨N, hN⟩ := he
exact lt_irrefl _ (lt_trans (h3 N) hN)
end Bulgaria1998P3 | null | v4.29.0-rc6 | test | [
"competition"
] | null | {"filename": "Bulgaria1998P3.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown identifier 'mul_lt_mul_iff_left\u2080'"], "timeout_s": 600.0, "latency_s": 35.1685, "verified_at": "2026-03-26T18:15:56.337288+00:00"}} | false | true | false | 35.1685 |
compfiles_Bulgaria1998P6 | compfiles | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# Bulgarian Mathematical Olympiad 1998, Problem 6
Prove that the equation
x²y² = z²(z² - x² - y²)
has no solutions in positive integers.
-/
namespace Bulgaria1998P6
lemma lemma_1'
(a b c : ℕ)
(ha : 0 < a)
(hb : 0 < b)
(hc : 0 < c)
(h : a^4 = b^4 + c^2) : False := by
induction' a using Nat.strongRecOn with a ih
have hab : Nat.gcd a b = 1 := sorry
obtain c_even | c_odd := Nat.even_or_odd c
· have a_odd : Odd a := sorry
have b_odd : Odd b := sorry
sorry
· sorry
lemma lemma_1
{s t u : ℤ}
(hs : 0 < s)
(ht : 0 < t)
(hu : 0 < u)
(h : s^4 - t^4 = u^2) : False := by
replace h : s^4 = t^4 + u^2 := eq_add_of_sub_eq' h
lift s to ℕ using Int.le_of_lt hs
lift t to ℕ using Int.le_of_lt ht
lift u to ℕ using Int.le_of_lt hu
replace hs : 0 < s := Int.natCast_pos.mp hs
replace ht : 0 < t := Int.natCast_pos.mp ht
replace hy : 0 < u := Int.natCast_pos.mp hu
have h' : s ^ 4 = t ^ 4 + u ^ 2 := by exact Int.ofNat_inj.mp h
exact lemma_1' s t u hs ht hy h'
theorem bulgaria1998_p6
(x y z : ℤ)
(hx : 0 < x)
(hy : 0 < y)
(_hz : 0 < z)
(h : x^2 * y^2 = z^2 * (z^2 - x^2 - y^2)) :
False := by
-- Follows the informal solution in _Mathematical Olympiads 1998-1999_
-- (edited by Titu Andreescu and Zuming Feng)
have h1 : 1 * (z^2 * z^2) + (- (x^2 + y^2)) * z^2 + -(x^2 * y^2) = 0 := by
rw[h]; ring
have : NeZero (2 : ℤ) := CharZero.NeZero.two
have h2 := (quadratic_eq_zero_iff_discrim_eq_sq one_ne_zero (z^2)).mp h1
dsimp [discrim] at h2
let a := x^2 + y^2
let b := 2 * x * y
have h3 : a^2 + b^2 = (2 * z ^ 2 - (x ^ 2 + y ^ 2)) ^ 2 :=
by linear_combination h2
have h4 : IsSquare (a^2 + b^2) := by use 2 * z ^ 2 - (x ^ 2 + y ^ 2); rwa [←sq]
have h5 : IsSquare (a^2 - b^2) := by use (x^2 - y^2); ring
have h6 : IsSquare ((a^2 + b^2) * (a^2 - b^2)) := IsSquare.mul h4 h5
rw [show (a^2 + b^2) * (a^2 - b^2) = a^4 - b^4 by ring] at h6
obtain ⟨c, hc⟩ := h6
rw [←sq, ←sq_abs] at hc
have ha' : 0 < a := by positivity
have hb' : 0 < b := by positivity
have hc' : 0 < |c| := by
obtain hc1 | hc2 | hc3 := lt_trichotomy 0 |c|
· exact hc1
· have hab : a^2 = b^2 := by
rw [← hc2, zero_pow (by norm_num)] at hc
have hc3 : (a^2)^2 = (b^2)^2 := by linear_combination hc
have hap : 0 ≤ a^2 := by positivity
have hbp : 0 ≤ b^2 := by positivity
exact (pow_left_inj₀ hap hbp two_ne_zero).mp hc3
rw [hab] at h4
obtain ⟨r, hr⟩ := h4
rw [←two_mul, ←sq] at hr
have h10 : b^2 ∣ r^2 := Dvd.intro_left _ hr
rw [Int.pow_dvd_pow_iff two_ne_zero] at h10
obtain ⟨e, rfl⟩ := h10
rw [show (b * e)^2 = e^2 * b^2 by ring] at hr
have h11 : b^2 ≠ 0 := by positivity
have h12 : 2 = e^2 := (Int.mul_eq_mul_right_iff h11).mp hr
clear h h1 h3 h5 hab
have h13 : e < 2 := by
by_contra! H
have h20 : 2^2 ≤ e^2 := by gcongr
rw [←h12] at h20
norm_num at h20
have h14 : -2 < e := by
by_contra! H
replace H : 2 ≤ -e := Int.le_neg_of_le_neg H
have h20 : 2^2 ≤ (-e)^2 := by gcongr
rw [neg_sq, ←h12] at h20
norm_num at h20
interval_cases e <;> linarith
· exact (Int.not_lt.mpr (abs_nonneg c) hc3).elim
exact lemma_1 ha' hb' hc' hc
end Bulgaria1998P6 | /- | /-
Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# Bulgarian Mathematical Olympiad 1998, Problem 6
Prove that the equation
x²y² = z²(z² - x² - y²)
has no solutions in positive integers.
-/
namespace Bulgaria1998P6
lemma lemma_1'
(a b c : ℕ)
(ha : 0 < a)
(hb : 0 < b)
(hc : 0 < c)
(h : a^4 = b^4 + c^2) : False := by
induction' a using Nat.strongRecOn with a ih
have hab : Nat.gcd a b = 1 := sorry
obtain c_even | c_odd := Nat.even_or_odd c
· have a_odd : Odd a := sorry
have b_odd : Odd b := sorry
sorry
· sorry
lemma lemma_1
{s t u : ℤ}
(hs : 0 < s)
(ht : 0 < t)
(hu : 0 < u)
(h : s^4 - t^4 = u^2) : False := by
replace h : s^4 = t^4 + u^2 := eq_add_of_sub_eq' h
lift s to ℕ using Int.le_of_lt hs
lift t to ℕ using Int.le_of_lt ht
lift u to ℕ using Int.le_of_lt hu
replace hs : 0 < s := Int.natCast_pos.mp hs
replace ht : 0 < t := Int.natCast_pos.mp ht
replace hy : 0 < u := Int.natCast_pos.mp hu
have h' : s ^ 4 = t ^ 4 + u ^ 2 := by exact Int.ofNat_inj.mp h
exact lemma_1' s t u hs ht hy h'
theorem bulgaria1998_p6
(x y z : ℤ)
(hx : 0 < x)
(hy : 0 < y)
(_hz : 0 < z)
(h : x^2 * y^2 = z^2 * (z^2 - x^2 - y^2)) :
False := by
-- Follows the informal solution in _Mathematical Olympiads 1998-1999_
-- (edited by Titu Andreescu and Zuming Feng)
have h1 : 1 * (z^2 * z^2) + (- (x^2 + y^2)) * z^2 + -(x^2 * y^2) = 0 := by
rw[h]; ring
have : NeZero (2 : ℤ) := CharZero.NeZero.two
have h2 := (quadratic_eq_zero_iff_discrim_eq_sq one_ne_zero (z^2)).mp h1
dsimp [discrim] at h2
let a := x^2 + y^2
let b := 2 * x * y
have h3 : a^2 + b^2 = (2 * z ^ 2 - (x ^ 2 + y ^ 2)) ^ 2 :=
by linear_combination h2
have h4 : IsSquare (a^2 + b^2) := by use 2 * z ^ 2 - (x ^ 2 + y ^ 2); rwa [←sq]
have h5 : IsSquare (a^2 - b^2) := by use (x^2 - y^2); ring
have h6 : IsSquare ((a^2 + b^2) * (a^2 - b^2)) := IsSquare.mul h4 h5
rw [show (a^2 + b^2) * (a^2 - b^2) = a^4 - b^4 by ring] at h6
obtain ⟨c, hc⟩ := h6
rw [←sq, ←sq_abs] at hc
have ha' : 0 < a := by positivity
have hb' : 0 < b := by positivity
have hc' : 0 < |c| := by
obtain hc1 | hc2 | hc3 := lt_trichotomy 0 |c|
· exact hc1
· have hab : a^2 = b^2 := by
rw [← hc2, zero_pow (by norm_num)] at hc
have hc3 : (a^2)^2 = (b^2)^2 := by linear_combination hc
have hap : 0 ≤ a^2 := by positivity
have hbp : 0 ≤ b^2 := by positivity
exact (pow_left_inj₀ hap hbp two_ne_zero).mp hc3
rw [hab] at h4
obtain ⟨r, hr⟩ := h4
rw [←two_mul, ←sq] at hr
have h10 : b^2 ∣ r^2 := Dvd.intro_left _ hr
rw [Int.pow_dvd_pow_iff two_ne_zero] at h10
obtain ⟨e, rfl⟩ := h10
rw [show (b * e)^2 = e^2 * b^2 by ring] at hr
have h11 : b^2 ≠ 0 := by positivity
have h12 : 2 = e^2 := (Int.mul_eq_mul_right_iff h11).mp hr
clear h h1 h3 h5 hab
have h13 : e < 2 := by
by_contra! H
have h20 : 2^2 ≤ e^2 := by gcongr
rw [←h12] at h20
norm_num at h20
have h14 : -2 < e := by
by_contra! H
replace H : 2 ≤ -e := Int.le_neg_of_le_neg H
have h20 : 2^2 ≤ (-e)^2 := by gcongr
rw [neg_sq, ←h12] at h20
norm_num at h20
interval_cases e <;> linarith
· exact (Int.not_lt.mpr (abs_nonneg c) hc3).elim
exact lemma_1 ha' hb' hc' hc
end Bulgaria1998P6
| false | null | null | v4.29.0-rc6 | test | [
"competition"
] | null | {"filename": "Bulgaria1998P6.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": true, "errors": [], "timeout_s": 600.0, "latency_s": 1.6128, "verified_at": "2026-03-26T18:15:56.056907+00:00"}} | false | true | true | 1.6128 |
compfiles_Bulgaria1998P8 | compfiles | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# Bulgarian Mathematical Olympiad 1998, Problem 8
The polynomials Pₙ(x,y) for n = 1, 2, ... are defined by P₁(x,y) = 1 and
Pₙ₊₁(x,y) = (x + y - 1)(y + 1)Pₙ(x,y+2) + (y - y²)Pₙ(x,y)
Prove that Pₙ(x,y) = Pₙ(y,x) for all x,y,n.
-/
namespace Bulgaria1998P8
variable {R : Type} [CommRing R]
def P : ℕ → R → R → R
| 0, _, _ => 1
| n+1, x, y => (x + y - 1) * (y + 1) * P n x (y + 2) + (y - y^2) * P n x y
/- helper function
Sₙ₋₁(x,y) = [(x + y)² - 1](y + 1)(x + 1)Pₙ₋₁(y+2, x+2).
-/
def S : ℕ → R → R → R
| n, x, y => ((x + y)^2 - 1) * (y + 1) * (x + 1) * P n (y + 2) (x + 2)
/- helper function
Tₙ₋₁(x,y) = (y - y²)(x - x²)Pₙ₋₁(y, x).
-/
def T : ℕ → R → R → R
| n, x, y => (y - y^2) * (x - x^2) * P n y x
/- helper function
Uₙ₋₁(x,y) = (x + y - 1) [(y + 1)(x - x²)Pₙ₋₁(y + 2, x)
+ (x + 1)(y - y²) Pₙ₋₁(y, x + 2)]
-/
def U : ℕ → R → R → R
| n, x, y => (x + y - 1) *((y + 1)*(x - x^2) * P n (y + 2) x
+ (x + 1) * (y - y^2) * P n y (x + 2))
theorem bulgaria1998_p8 (n : ℕ) (x y : R) : P n x y = P n y x := by
-- Follows the proof in _Mathematical Olympiads 1998-1999_
-- by Titu Andreescu and Zuming Feng
-- We induct on n. For n = 1,2 the result is evident.
-- So we take n > 1 and suppose that the result is true for
-- Pₙ₋₁(x,y) and Pₙ₋₂(x,y).
revert x y
induction n using Nat.strong_induction_on with | h n ih =>
cases n with | zero => intros; rfl | succ n =>
cases n with | zero => intros; dsimp only [P]; ring | succ n =>
-- in the informal proof at this point, we're trying to
-- prove the end result at n+1.
-- In our formal version, that corresponds to proving the result for
-- n.succ.succ
/- We have
Pₙ₊₁(x,y) = (x + y - 1)(y + 1)Pₙ(x,y+2) + (y - y²)Pₙ(x,y)
= (x + y - 1)(y + 1)Pₙ(y+2,x) + (y - y²)Pₙ(y,x)
-/
have ih1 := ih n.succ (lt_add_one n.succ)
have h1 : ∀ x y : R, P n.succ.succ x y =
(x + y - 1) * (y + 1) * (P n.succ (y + 2) x) +
(y - y^2) * (P n.succ y x) := by
intro x y
calc P (n.succ.succ) x y
= (x + y - 1) * (y + 1) * (P n.succ x (y + 2)) +
(y - y^2) * (P n.succ x y) := rfl
_ = (x + y - 1) * (y + 1) * (P n.succ (y + 2) x) +
(y - y^2) * (P n.succ y x) := by rw [ih1 x y, ih1 x (y+2)]
have h2 : ∀ x y : R, (x + y - 1) * (y + 1) * P n.succ (y + 2) x
= S n x y + (x + y - 1)* (y + 1) * (x - x^2)* P n (y+2) x := by
intro x y; dsimp only [S, P]; ring
have h_s_symm : ∀ m : ℕ, m < n.succ.succ → ∀ x y : R, S m x y = S m y x := by
intro m hm x y; dsimp only [S]; rw [ih m hm (x + 2) (y + 2)]; ring
have h4 : ∀ x y : R, (y - y^2) * P n.succ y x =
(y - y^2) * (x + y -1) * (x + 1) * P n y (x + 2) + T n x y := by
intro x y; dsimp only [T, P]; ring
have h_t_symm : ∀ m : ℕ, m < n.succ.succ → ∀ x y : R, T m x y = T m y x := by
intro m hm x y; dsimp only[T]; rw [ih m hm x y]; ring
have h_u_symm : ∀ m : ℕ, m < n.succ.succ → ∀ x y : R, U m x y = U m y x := by
intro m hm x y; dsimp only [U]; rw [ih m hm (y+2) x, ih m hm (x+2) y]; ring
have h7 : ∀ x y : R, P n.succ.succ x y = S n x y + T n x y + U n x y := by
intro x y; rw [h1 x y, h2 x y, h4 x y]; dsimp only [U]; ring
have h8 : n < n.succ := lt_add_one n
have h9 : n < n.succ.succ := Nat.lt_succ_of_lt h8
intro x y
calc P n.succ.succ x y
= S n x y + T n x y + U n x y := h7 x y
_ = S n y x + T n x y + U n x y := by rw [h_s_symm n h9 x y]
_ = S n y x + T n y x + U n x y := by rw [h_t_symm n h9 x y]
_ = S n y x + T n y x + U n y x := by rw [h_u_symm n h9 x y]
_ = P n.succ.succ y x := (h7 y x).symm
end Bulgaria1998P8 | /- | /-
Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# Bulgarian Mathematical Olympiad 1998, Problem 8
The polynomials Pₙ(x,y) for n = 1, 2, ... are defined by P₁(x,y) = 1 and
Pₙ₊₁(x,y) = (x + y - 1)(y + 1)Pₙ(x,y+2) + (y - y²)Pₙ(x,y)
Prove that Pₙ(x,y) = Pₙ(y,x) for all x,y,n.
-/
namespace Bulgaria1998P8
variable {R : Type} [CommRing R]
def P : ℕ → R → R → R
| 0, _, _ => 1
| n+1, x, y => (x + y - 1) * (y + 1) * P n x (y + 2) + (y - y^2) * P n x y
/- helper function
Sₙ₋₁(x,y) = [(x + y)² - 1](y + 1)(x + 1)Pₙ₋₁(y+2, x+2).
-/
def S : ℕ → R → R → R
| n, x, y => ((x + y)^2 - 1) * (y + 1) * (x + 1) * P n (y + 2) (x + 2)
/- helper function
Tₙ₋₁(x,y) = (y - y²)(x - x²)Pₙ₋₁(y, x).
-/
def T : ℕ → R → R → R
| n, x, y => (y - y^2) * (x - x^2) * P n y x
/- helper function
Uₙ₋₁(x,y) = (x + y - 1) [(y + 1)(x - x²)Pₙ₋₁(y + 2, x)
+ (x + 1)(y - y²) Pₙ₋₁(y, x + 2)]
-/
def U : ℕ → R → R → R
| n, x, y => (x + y - 1) *((y + 1)*(x - x^2) * P n (y + 2) x
+ (x + 1) * (y - y^2) * P n y (x + 2))
theorem bulgaria1998_p8 (n : ℕ) (x y : R) : P n x y = P n y x := by
-- Follows the proof in _Mathematical Olympiads 1998-1999_
-- by Titu Andreescu and Zuming Feng
-- We induct on n. For n = 1,2 the result is evident.
-- So we take n > 1 and suppose that the result is true for
-- Pₙ₋₁(x,y) and Pₙ₋₂(x,y).
revert x y
induction n using Nat.strong_induction_on with | h n ih =>
cases n with | zero => intros; rfl | succ n =>
cases n with | zero => intros; dsimp only [P]; ring | succ n =>
-- in the informal proof at this point, we're trying to
-- prove the end result at n+1.
-- In our formal version, that corresponds to proving the result for
-- n.succ.succ
/- We have
Pₙ₊₁(x,y) = (x + y - 1)(y + 1)Pₙ(x,y+2) + (y - y²)Pₙ(x,y)
= (x + y - 1)(y + 1)Pₙ(y+2,x) + (y - y²)Pₙ(y,x)
-/
have ih1 := ih n.succ (lt_add_one n.succ)
have h1 : ∀ x y : R, P n.succ.succ x y =
(x + y - 1) * (y + 1) * (P n.succ (y + 2) x) +
(y - y^2) * (P n.succ y x) := by
intro x y
calc P (n.succ.succ) x y
= (x + y - 1) * (y + 1) * (P n.succ x (y + 2)) +
(y - y^2) * (P n.succ x y) := rfl
_ = (x + y - 1) * (y + 1) * (P n.succ (y + 2) x) +
(y - y^2) * (P n.succ y x) := by rw [ih1 x y, ih1 x (y+2)]
have h2 : ∀ x y : R, (x + y - 1) * (y + 1) * P n.succ (y + 2) x
= S n x y + (x + y - 1)* (y + 1) * (x - x^2)* P n (y+2) x := by
intro x y; dsimp only [S, P]; ring
have h_s_symm : ∀ m : ℕ, m < n.succ.succ → ∀ x y : R, S m x y = S m y x := by
intro m hm x y; dsimp only [S]; rw [ih m hm (x + 2) (y + 2)]; ring
have h4 : ∀ x y : R, (y - y^2) * P n.succ y x =
(y - y^2) * (x + y -1) * (x + 1) * P n y (x + 2) + T n x y := by
intro x y; dsimp only [T, P]; ring
have h_t_symm : ∀ m : ℕ, m < n.succ.succ → ∀ x y : R, T m x y = T m y x := by
intro m hm x y; dsimp only[T]; rw [ih m hm x y]; ring
have h_u_symm : ∀ m : ℕ, m < n.succ.succ → ∀ x y : R, U m x y = U m y x := by
intro m hm x y; dsimp only [U]; rw [ih m hm (y+2) x, ih m hm (x+2) y]; ring
have h7 : ∀ x y : R, P n.succ.succ x y = S n x y + T n x y + U n x y := by
intro x y; rw [h1 x y, h2 x y, h4 x y]; dsimp only [U]; ring
have h8 : n < n.succ := lt_add_one n
have h9 : n < n.succ.succ := Nat.lt_succ_of_lt h8
intro x y
calc P n.succ.succ x y
= S n x y + T n x y + U n x y := h7 x y
_ = S n y x + T n x y + U n x y := by rw [h_s_symm n h9 x y]
_ = S n y x + T n y x + U n x y := by rw [h_t_symm n h9 x y]
_ = S n y x + T n y x + U n y x := by rw [h_u_symm n h9 x y]
_ = P n.succ.succ y x := (h7 y x).symm
end Bulgaria1998P8
| true | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# Bulgarian Mathematical Olympiad 1998, Problem 8
The polynomials Pₙ(x,y) for n = 1, 2, ... are defined by P₁(x,y) = 1 and
Pₙ₊₁(x,y) = (x + y - 1)(y + 1)Pₙ(x,y+2) + (y - y²)Pₙ(x,y)
Prove that Pₙ(x,y) = Pₙ(y,x) for all x,y,n.
-/
namespace Bulgaria1998P8
variable {R : Type} [CommRing R]
def P : ℕ → R → R → R
| 0, _, _ => 1
| n+1, x, y => (x + y - 1) * (y + 1) * P n x (y + 2) + (y - y^2) * P n x y
/- helper function
Sₙ₋₁(x,y) = [(x + y)² - 1](y + 1)(x + 1)Pₙ₋₁(y+2, x+2).
-/
def S : ℕ → R → R → R
| n, x, y => ((x + y)^2 - 1) * (y + 1) * (x + 1) * P n (y + 2) (x + 2)
/- helper function
Tₙ₋₁(x,y) = (y - y²)(x - x²)Pₙ₋₁(y, x).
-/
def T : ℕ → R → R → R
| n, x, y => (y - y^2) * (x - x^2) * P n y x
/- helper function
Uₙ₋₁(x,y) = (x + y - 1) [(y + 1)(x - x²)Pₙ₋₁(y + 2, x)
+ (x + 1)(y - y²) Pₙ₋₁(y, x + 2)]
-/
def U : ℕ → R → R → R
| n, x, y => (x + y - 1) *((y + 1)*(x - x^2) * P n (y + 2) x
+ (x + 1) * (y - y^2) * P n y (x + 2))
theorem bulgaria1998_p8 (n : ℕ) (x y : R) : P n x y = P n y x := by
-- Follows the proof in _Mathematical Olympiads 1998-1999_
-- by Titu Andreescu and Zuming Feng
-- We induct on n. For n = 1,2 the result is evident.
-- So we take n > 1 and suppose that the result is true for
-- Pₙ₋₁(x,y) and Pₙ₋₂(x,y).
revert x y
induction n using Nat.strong_induction_on with | h n ih =>
cases n with | zero => intros; rfl | succ n =>
cases n with | zero => intros; dsimp only [P]; ring | succ n =>
-- in the informal proof at this point, we're trying to
-- prove the end result at n+1.
-- In our formal version, that corresponds to proving the result for
-- n.succ.succ
/- We have
Pₙ₊₁(x,y) = (x + y - 1)(y + 1)Pₙ(x,y+2) + (y - y²)Pₙ(x,y)
= (x + y - 1)(y + 1)Pₙ(y+2,x) + (y - y²)Pₙ(y,x)
-/
have ih1 := ih n.succ (lt_add_one n.succ)
have h1 : ∀ x y : R, P n.succ.succ x y =
(x + y - 1) * (y + 1) * (P n.succ (y + 2) x) +
(y - y^2) * (P n.succ y x) := by
intro x y
calc P (n.succ.succ) x y
= (x + y - 1) * (y + 1) * (P n.succ x (y + 2)) +
(y - y^2) * (P n.succ x y) := rfl
_ = (x + y - 1) * (y + 1) * (P n.succ (y + 2) x) +
(y - y^2) * (P n.succ y x) := by rw [ih1 x y, ih1 x (y+2)]
have h2 : ∀ x y : R, (x + y - 1) * (y + 1) * P n.succ (y + 2) x
= S n x y + (x + y - 1)* (y + 1) * (x - x^2)* P n (y+2) x := by
intro x y; dsimp only [S, P]; ring
have h_s_symm : ∀ m : ℕ, m < n.succ.succ → ∀ x y : R, S m x y = S m y x := by
intro m hm x y; dsimp only [S]; rw [ih m hm (x + 2) (y + 2)]; ring
have h4 : ∀ x y : R, (y - y^2) * P n.succ y x =
(y - y^2) * (x + y -1) * (x + 1) * P n y (x + 2) + T n x y := by
intro x y; dsimp only [T, P]; ring
have h_t_symm : ∀ m : ℕ, m < n.succ.succ → ∀ x y : R, T m x y = T m y x := by
intro m hm x y; dsimp only[T]; rw [ih m hm x y]; ring
have h_u_symm : ∀ m : ℕ, m < n.succ.succ → ∀ x y : R, U m x y = U m y x := by
intro m hm x y; dsimp only [U]; rw [ih m hm (y+2) x, ih m hm (x+2) y]; ring
have h7 : ∀ x y : R, P n.succ.succ x y = S n x y + T n x y + U n x y := by
intro x y; rw [h1 x y, h2 x y, h4 x y]; dsimp only [U]; ring
have h8 : n < n.succ := lt_add_one n
have h9 : n < n.succ.succ := Nat.lt_succ_of_lt h8
intro x y
calc P n.succ.succ x y
= S n x y + T n x y + U n x y := h7 x y
_ = S n y x + T n x y + U n x y := by rw [h_s_symm n h9 x y]
_ = S n y x + T n y x + U n x y := by rw [h_t_symm n h9 x y]
_ = S n y x + T n y x + U n y x := by rw [h_u_symm n h9 x y]
_ = P n.succ.succ y x := (h7 y x).symm
end Bulgaria1998P8 | null | v4.29.0-rc6 | test | [
"competition"
] | null | {"filename": "Bulgaria1998P8.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 600.0, "latency_s": 1.7539, "verified_at": "2026-03-26T18:15:57.465676+00:00"}} | true | true | false | 1.7539 |
compfiles_CIIM2022P6 | compfiles | Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# Iberoamerican Interuniversity Mathematics Competition 2022, Problem 6
Given a positive integer m, let d(m) be the number of postive
divisors of m. Show that for every positive integer n, one
has
d((n + 1)!) ≤ 2d(n!).
-/
namespace CIIM2022P6
def d : ℕ → ℕ
| m => (Nat.divisors m).card
theorem ciim2022_p6 (n : ℕ) (hn : 0 < n) :
d (Nat.factorial (n + 1)) ≤ 2 * d (Nat.factorial n) := by
sorry
end CIIM2022P6 | /- | /-
Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# Iberoamerican Interuniversity Mathematics Competition 2022, Problem 6
Given a positive integer m, let d(m) be the number of postive
divisors of m. Show that for every positive integer n, one
has
d((n + 1)!) ≤ 2d(n!).
-/
namespace CIIM2022P6
def d : ℕ → ℕ
| m => (Nat.divisors m).card
theorem ciim2022_p6 (n : ℕ) (hn : 0 < n) :
d (Nat.factorial (n + 1)) ≤ 2 * d (Nat.factorial n) := by
sorry
end CIIM2022P6
| false | null | null | v4.29.0-rc6 | test | [
"competition"
] | null | {"filename": "CIIM2022P6.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": true, "errors": [], "timeout_s": 600.0, "latency_s": 0.0288, "verified_at": "2026-03-26T18:15:56.085817+00:00"}} | false | true | true | 0.0288 |
compfiles_Canada1998P3 | compfiles | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
Canadian Mathematical Olympiad 1998, Problem 3
Let n be a natural number such that n ≥ 2. Show that
(1/(n + 1))(1 + 1/3 + ... + 1/(2n - 1)) > (1/n)(1/2 + 1/4 + ... + 1/2n).
-/
namespace Canada1998P3
theorem canada1998_p3 (n : ℕ) (hn : 2 ≤ n) :
(1/(n:ℝ)) * ∑ i ∈ Finset.range n, (1/(2 * (i:ℝ) + 2)) <
(1/((n:ℝ) + 1)) * ∑ i ∈ Finset.range n, (1/(2 * (i:ℝ) + 1)) := by
-- Follows the proof in _Mathematical Olympiads 1998-1999_
-- by Titu Andreescu and Zuming Feng
cases n with | zero => norm_num at hn | succ n =>
cases n with | zero => norm_num at hn | succ n =>
revert hn
intro h2; clear h2
-- We prove
-- (n + 1)(1/2 + 1/4 + ... + 1/2n) < n(1 + 1/3 + ... + 1/(2n - 1))
-- by induction.
suffices
((n.succ.succ:ℝ) + 1) * ∑ i ∈ Finset.range n.succ.succ, (1/(2 * (i:ℝ) + 2)) <
(n.succ.succ:ℝ) * ∑ i ∈ Finset.range n.succ.succ, (1/(2 * (i:ℝ) + 1))
by rw [div_mul_eq_mul_div₀, one_mul, div_mul_eq_mul_div₀, one_mul]
apply (div_lt_div_iff₀ (by positivity) (by positivity)).mpr
linarith
induction n with
| zero =>
-- Base case: when n = 2, we have 8/3 > 9/4.
norm_num
| succ m ih =>
let k := m.succ.succ
-- Inductive case: suppose claim is true for k ≥ 2. Then we have
-- k (1 + 1/3 + ... 1/(2k - 1)) > (k + 1)(1/2 + 1/4 + ... + 1/2k).
-- Note that
-- (1 + 1/3 + ... + 1/(2k-1)) + (k+1)/(2k+1)
-- = (1/2 + 1/3 + ... + 1/(2k-1)) + 1/2 + (k+1)/(2k+1)
-- > (1/2 + 1/4 + ... + 1/2k) + 1/2 + (k+1)/(2k+1)
-- > (1/2 + 1/4 + ... + 1/2k) + (k + 1)/(2k + 2) + 1/(2k+1)
-- > (1/2 + 1/4 + ... + 1/2k) + (k + 2)/(2k + 2).
have h1 : (1:ℝ) / (2 * ↑(0:ℕ) + 1) = 1 := by norm_num
have h2 : ∀ k' ∈ Finset.range (m + 1), (1:ℝ) / (2 * ↑(k' + 1) + 1 + 1) <
(1:ℝ) / (2 * ↑(k' + 1) + 1) := by
intro k' _
apply div_lt_div_of_pos_left zero_lt_one
· positivity
· exact lt_add_one _
have h3 : (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1)) + (k+1)/(2 * k + 1)
= _ := rfl
nth_rewrite 1 [Finset.sum_range_succ'] at h3
rw [h1, add_assoc] at h3
have h4 : Finset.Nonempty (Finset.range (m + 1)) := Finset.nonempty_range_add_one
have h5 := Finset.sum_lt_sum_of_nonempty h4 h2
norm_cast at h5
have h6 : (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1 + 1)) = _ := rfl
nth_rewrite 1 [Finset.sum_range_succ'] at h6
have h7' : (2:ℝ) * (k:ℝ) ≥ 4 := by
have hh2' : k ≥ 2 := Nat.succ_le_succ (Nat.succ_le_succ (Nat.zero_le m))
have hh2 : (k:ℝ) ≥ 2 := by exact_mod_cast hh2'
calc
(2:ℝ) * (k:ℝ) ≥ (2:ℝ) * 2 := mul_le_mul_of_nonneg_left hh2 zero_le_two
_ = 4 := by norm_num
have h7 : 1 / (2 * (k:ℝ) + 2) < 1 / 2 := by apply div_lt_div₀' <;> linarith
have h8 : ((k:ℝ)+1)/(2 * (k:ℝ) + 2) < ((k:ℝ)+1)/(2 * (k:ℝ) + 1) :=
by apply div_lt_div₀' <;> linarith
have h9 :=
-- (1 + 1/3 + ... + 1/(2k-1)) + (k+1)/(2k+1)
calc (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1)) + (k+1)/(2 * k + 1)
-- = (1/3 + ... + 1/(2k-1)) + (1 + (k+1)/(2k+1))
= (∑i ∈ Finset.range (m+1), 1 / (2 * ((i + 1):ℝ) + 1))
+ (1 + (k+1)/(2 * k + 1)) := by rw [←h3]; norm_cast
-- TODO shouldn't need casting?
-- > (1/4 + ... + 1/2k) + (1 + (k+1)/(2k+1))
_ > (∑i ∈ Finset.range (m+1), 1 / (2 * ((i + 1):ℝ) + 1 + 1))
+ (1 + (k+1)/(2 * k + 1)) := by norm_cast; linarith
_ = (∑i ∈ Finset.range (m+1), 1 / (2 * ((i + 1):ℝ) + 1 + 1))
+ (1/2 + 1/2 + (k+1)/(2 * k + 1)) := by ring
_ = (∑i ∈ Finset.range (m+1), 1 / (2 * ((i + 1):ℝ) + 1 + 1))
+ 1/2 + (1/2 + (k+1)/(2 * k + 1)) := by ring
_ = (∑i ∈ Finset.range (m+1), 1 / (2 * ((i + 1):ℝ) + 1 + 1))
+ 1/(2 *(((0:ℕ)):ℝ) + 1 + 1) + (1/2 + (k+1)/(2 * k + 1)) :=
by norm_num
_ = (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1 + 1)) +
(1/2 + (k+1)/(2 * k + 1)) := by rw [←h6]; norm_cast
-- > (1/2 + 1/4 + ... + 1/2k) + (k + 1)/(2k + 2) + 1/(2k+1)
_ > (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1 + 1)) +
((k+1)/(2 * k + 2) + 1/(2 * k + 2)) := by linarith
-- = (1/2 + 1/4 + ... + 1/2k) + (k + 2)/(2k + 2).
_ = (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1 + 1)) +
(k+2)/(2 * k + 2) := by field
--
-- Then we are done because
-- (k + 1)(1 + 1/3 + ... + 1/(2k - 1) + 1/(2k + 1))
-- = k (1 + 1/3 + ... + 1/(2k - 1))
-- + (1 + 1/3 + ... + 1/(2k - 1)) + (k + 1)/(2k + 1)
-- > k (1 + 1/3 + ... + 1/(2k - 1))
-- + (1/2 + 1/4 + ... + 1/2k)) + (k + 2)/(2k + 2)
-- (by h9, proved above)
-- > (k + 2)(1/2 + 1/4 + ... + 1/(2k + 2)).
have :=
calc (k + 1) * (∑i ∈ Finset.range k.succ, 1 / (2 * (i:ℝ) + 1))
= k * (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1)) +
((∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1)) +
(k + 1) / (2 * k + 1)) := by
rw [Finset.sum_range_succ]; ring
_ > k * (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1)) +
((∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1 + 1)) +
(k + 2) / (2 * k + 2)) := add_lt_add_right h9 _
_ > (k + 1) * (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 2)) +
((∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1 + 1)) +
(k + 2) / (2 * k + 2)) := add_lt_add_left ih _
_ = (k + 1) * (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 2)) +
((∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 2)) +
(k + 2) / (2 * k + 2)) := by
congr; funext x; rw [add_assoc, show (1:ℝ) + 1 = 2 by norm_num]
_ = (k + 2) * ((∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 2)) +
1 / (2 * k + 2)) := by ring
_ = (k + 2) * (∑i ∈ Finset.range k.succ, 1 / (2 * (i:ℝ) + 2))
:= by rw [←Finset.sum_range_succ]
norm_cast at this
norm_cast
end Canada1998P3 | /- | /-
Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
Canadian Mathematical Olympiad 1998, Problem 3
Let n be a natural number such that n ≥ 2. Show that
(1/(n + 1))(1 + 1/3 + ... + 1/(2n - 1)) > (1/n)(1/2 + 1/4 + ... + 1/2n).
-/
namespace Canada1998P3
theorem canada1998_p3 (n : ℕ) (hn : 2 ≤ n) :
(1/(n:ℝ)) * ∑ i ∈ Finset.range n, (1/(2 * (i:ℝ) + 2)) <
(1/((n:ℝ) + 1)) * ∑ i ∈ Finset.range n, (1/(2 * (i:ℝ) + 1)) := by
-- Follows the proof in _Mathematical Olympiads 1998-1999_
-- by Titu Andreescu and Zuming Feng
cases n with | zero => norm_num at hn | succ n =>
cases n with | zero => norm_num at hn | succ n =>
revert hn
intro h2; clear h2
-- We prove
-- (n + 1)(1/2 + 1/4 + ... + 1/2n) < n(1 + 1/3 + ... + 1/(2n - 1))
-- by induction.
suffices
((n.succ.succ:ℝ) + 1) * ∑ i ∈ Finset.range n.succ.succ, (1/(2 * (i:ℝ) + 2)) <
(n.succ.succ:ℝ) * ∑ i ∈ Finset.range n.succ.succ, (1/(2 * (i:ℝ) + 1))
by rw [div_mul_eq_mul_div₀, one_mul, div_mul_eq_mul_div₀, one_mul]
apply (div_lt_div_iff₀ (by positivity) (by positivity)).mpr
linarith
induction n with
| zero =>
-- Base case: when n = 2, we have 8/3 > 9/4.
norm_num
| succ m ih =>
let k := m.succ.succ
-- Inductive case: suppose claim is true for k ≥ 2. Then we have
-- k (1 + 1/3 + ... 1/(2k - 1)) > (k + 1)(1/2 + 1/4 + ... + 1/2k).
-- Note that
-- (1 + 1/3 + ... + 1/(2k-1)) + (k+1)/(2k+1)
-- = (1/2 + 1/3 + ... + 1/(2k-1)) + 1/2 + (k+1)/(2k+1)
-- > (1/2 + 1/4 + ... + 1/2k) + 1/2 + (k+1)/(2k+1)
-- > (1/2 + 1/4 + ... + 1/2k) + (k + 1)/(2k + 2) + 1/(2k+1)
-- > (1/2 + 1/4 + ... + 1/2k) + (k + 2)/(2k + 2).
have h1 : (1:ℝ) / (2 * ↑(0:ℕ) + 1) = 1 := by norm_num
have h2 : ∀ k' ∈ Finset.range (m + 1), (1:ℝ) / (2 * ↑(k' + 1) + 1 + 1) <
(1:ℝ) / (2 * ↑(k' + 1) + 1) := by
intro k' _
apply div_lt_div_of_pos_left zero_lt_one
· positivity
· exact lt_add_one _
have h3 : (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1)) + (k+1)/(2 * k + 1)
= _ := rfl
nth_rewrite 1 [Finset.sum_range_succ'] at h3
rw [h1, add_assoc] at h3
have h4 : Finset.Nonempty (Finset.range (m + 1)) := Finset.nonempty_range_add_one
have h5 := Finset.sum_lt_sum_of_nonempty h4 h2
norm_cast at h5
have h6 : (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1 + 1)) = _ := rfl
nth_rewrite 1 [Finset.sum_range_succ'] at h6
have h7' : (2:ℝ) * (k:ℝ) ≥ 4 := by
have hh2' : k ≥ 2 := Nat.succ_le_succ (Nat.succ_le_succ (Nat.zero_le m))
have hh2 : (k:ℝ) ≥ 2 := by exact_mod_cast hh2'
calc
(2:ℝ) * (k:ℝ) ≥ (2:ℝ) * 2 := mul_le_mul_of_nonneg_left hh2 zero_le_two
_ = 4 := by norm_num
have h7 : 1 / (2 * (k:ℝ) + 2) < 1 / 2 := by apply div_lt_div₀' <;> linarith
have h8 : ((k:ℝ)+1)/(2 * (k:ℝ) + 2) < ((k:ℝ)+1)/(2 * (k:ℝ) + 1) :=
by apply div_lt_div₀' <;> linarith
have h9 :=
-- (1 + 1/3 + ... + 1/(2k-1)) + (k+1)/(2k+1)
calc (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1)) + (k+1)/(2 * k + 1)
-- = (1/3 + ... + 1/(2k-1)) + (1 + (k+1)/(2k+1))
= (∑i ∈ Finset.range (m+1), 1 / (2 * ((i + 1):ℝ) + 1))
+ (1 + (k+1)/(2 * k + 1)) := by rw [←h3]; norm_cast
-- TODO shouldn't need casting?
-- > (1/4 + ... + 1/2k) + (1 + (k+1)/(2k+1))
_ > (∑i ∈ Finset.range (m+1), 1 / (2 * ((i + 1):ℝ) + 1 + 1))
+ (1 + (k+1)/(2 * k + 1)) := by norm_cast; linarith
_ = (∑i ∈ Finset.range (m+1), 1 / (2 * ((i + 1):ℝ) + 1 + 1))
+ (1/2 + 1/2 + (k+1)/(2 * k + 1)) := by ring
_ = (∑i ∈ Finset.range (m+1), 1 / (2 * ((i + 1):ℝ) + 1 + 1))
+ 1/2 + (1/2 + (k+1)/(2 * k + 1)) := by ring
_ = (∑i ∈ Finset.range (m+1), 1 / (2 * ((i + 1):ℝ) + 1 + 1))
+ 1/(2 *(((0:ℕ)):ℝ) + 1 + 1) + (1/2 + (k+1)/(2 * k + 1)) :=
by norm_num
_ = (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1 + 1)) +
(1/2 + (k+1)/(2 * k + 1)) := by rw [←h6]; norm_cast
-- > (1/2 + 1/4 + ... + 1/2k) + (k + 1)/(2k + 2) + 1/(2k+1)
_ > (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1 + 1)) +
((k+1)/(2 * k + 2) + 1/(2 * k + 2)) := by linarith
-- = (1/2 + 1/4 + ... + 1/2k) + (k + 2)/(2k + 2).
_ = (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1 + 1)) +
(k+2)/(2 * k + 2) := by field
--
-- Then we are done because
-- (k + 1)(1 + 1/3 + ... + 1/(2k - 1) + 1/(2k + 1))
-- = k (1 + 1/3 + ... + 1/(2k - 1))
-- + (1 + 1/3 + ... + 1/(2k - 1)) + (k + 1)/(2k + 1)
-- > k (1 + 1/3 + ... + 1/(2k - 1))
-- + (1/2 + 1/4 + ... + 1/2k)) + (k + 2)/(2k + 2)
-- (by h9, proved above)
-- > (k + 2)(1/2 + 1/4 + ... + 1/(2k + 2)).
have :=
calc (k + 1) * (∑i ∈ Finset.range k.succ, 1 / (2 * (i:ℝ) + 1))
= k * (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1)) +
((∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1)) +
(k + 1) / (2 * k + 1)) := by
rw [Finset.sum_range_succ]; ring
_ > k * (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1)) +
((∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1 + 1)) +
(k + 2) / (2 * k + 2)) := add_lt_add_right h9 _
_ > (k + 1) * (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 2)) +
((∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1 + 1)) +
(k + 2) / (2 * k + 2)) := add_lt_add_left ih _
_ = (k + 1) * (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 2)) +
((∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 2)) +
(k + 2) / (2 * k + 2)) := by
congr; funext x; rw [add_assoc, show (1:ℝ) + 1 = 2 by norm_num]
_ = (k + 2) * ((∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 2)) +
1 / (2 * k + 2)) := by ring
_ = (k + 2) * (∑i ∈ Finset.range k.succ, 1 / (2 * (i:ℝ) + 2))
:= by rw [←Finset.sum_range_succ]
norm_cast at this
norm_cast
end Canada1998P3
| true | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
Canadian Mathematical Olympiad 1998, Problem 3
Let n be a natural number such that n ≥ 2. Show that
(1/(n + 1))(1 + 1/3 + ... + 1/(2n - 1)) > (1/n)(1/2 + 1/4 + ... + 1/2n).
-/
namespace Canada1998P3
theorem canada1998_p3 (n : ℕ) (hn : 2 ≤ n) :
(1/(n:ℝ)) * ∑ i ∈ Finset.range n, (1/(2 * (i:ℝ) + 2)) <
(1/((n:ℝ) + 1)) * ∑ i ∈ Finset.range n, (1/(2 * (i:ℝ) + 1)) := by
-- Follows the proof in _Mathematical Olympiads 1998-1999_
-- by Titu Andreescu and Zuming Feng
cases n with | zero => norm_num at hn | succ n =>
cases n with | zero => norm_num at hn | succ n =>
revert hn
intro h2; clear h2
-- We prove
-- (n + 1)(1/2 + 1/4 + ... + 1/2n) < n(1 + 1/3 + ... + 1/(2n - 1))
-- by induction.
suffices
((n.succ.succ:ℝ) + 1) * ∑ i ∈ Finset.range n.succ.succ, (1/(2 * (i:ℝ) + 2)) <
(n.succ.succ:ℝ) * ∑ i ∈ Finset.range n.succ.succ, (1/(2 * (i:ℝ) + 1))
by rw [div_mul_eq_mul_div₀, one_mul, div_mul_eq_mul_div₀, one_mul]
apply (div_lt_div_iff₀ (by positivity) (by positivity)).mpr
linarith
induction n with
| zero =>
-- Base case: when n = 2, we have 8/3 > 9/4.
norm_num
| succ m ih =>
let k := m.succ.succ
-- Inductive case: suppose claim is true for k ≥ 2. Then we have
-- k (1 + 1/3 + ... 1/(2k - 1)) > (k + 1)(1/2 + 1/4 + ... + 1/2k).
-- Note that
-- (1 + 1/3 + ... + 1/(2k-1)) + (k+1)/(2k+1)
-- = (1/2 + 1/3 + ... + 1/(2k-1)) + 1/2 + (k+1)/(2k+1)
-- > (1/2 + 1/4 + ... + 1/2k) + 1/2 + (k+1)/(2k+1)
-- > (1/2 + 1/4 + ... + 1/2k) + (k + 1)/(2k + 2) + 1/(2k+1)
-- > (1/2 + 1/4 + ... + 1/2k) + (k + 2)/(2k + 2).
have h1 : (1:ℝ) / (2 * ↑(0:ℕ) + 1) = 1 := by norm_num
have h2 : ∀ k' ∈ Finset.range (m + 1), (1:ℝ) / (2 * ↑(k' + 1) + 1 + 1) <
(1:ℝ) / (2 * ↑(k' + 1) + 1) := by
intro k' _
apply div_lt_div_of_pos_left zero_lt_one
· positivity
· exact lt_add_one _
have h3 : (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1)) + (k+1)/(2 * k + 1)
= _ := rfl
nth_rewrite 1 [Finset.sum_range_succ'] at h3
rw [h1, add_assoc] at h3
have h4 : Finset.Nonempty (Finset.range (m + 1)) := Finset.nonempty_range_add_one
have h5 := Finset.sum_lt_sum_of_nonempty h4 h2
norm_cast at h5
have h6 : (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1 + 1)) = _ := rfl
nth_rewrite 1 [Finset.sum_range_succ'] at h6
have h7' : (2:ℝ) * (k:ℝ) ≥ 4 := by
have hh2' : k ≥ 2 := Nat.succ_le_succ (Nat.succ_le_succ (Nat.zero_le m))
have hh2 : (k:ℝ) ≥ 2 := by exact_mod_cast hh2'
calc
(2:ℝ) * (k:ℝ) ≥ (2:ℝ) * 2 := mul_le_mul_of_nonneg_left hh2 zero_le_two
_ = 4 := by norm_num
have h7 : 1 / (2 * (k:ℝ) + 2) < 1 / 2 := by apply div_lt_div₀' <;> linarith
have h8 : ((k:ℝ)+1)/(2 * (k:ℝ) + 2) < ((k:ℝ)+1)/(2 * (k:ℝ) + 1) :=
by apply div_lt_div₀' <;> linarith
have h9 :=
-- (1 + 1/3 + ... + 1/(2k-1)) + (k+1)/(2k+1)
calc (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1)) + (k+1)/(2 * k + 1)
-- = (1/3 + ... + 1/(2k-1)) + (1 + (k+1)/(2k+1))
= (∑i ∈ Finset.range (m+1), 1 / (2 * ((i + 1):ℝ) + 1))
+ (1 + (k+1)/(2 * k + 1)) := by rw [←h3]; norm_cast
-- TODO shouldn't need casting?
-- > (1/4 + ... + 1/2k) + (1 + (k+1)/(2k+1))
_ > (∑i ∈ Finset.range (m+1), 1 / (2 * ((i + 1):ℝ) + 1 + 1))
+ (1 + (k+1)/(2 * k + 1)) := by norm_cast; linarith
_ = (∑i ∈ Finset.range (m+1), 1 / (2 * ((i + 1):ℝ) + 1 + 1))
+ (1/2 + 1/2 + (k+1)/(2 * k + 1)) := by ring
_ = (∑i ∈ Finset.range (m+1), 1 / (2 * ((i + 1):ℝ) + 1 + 1))
+ 1/2 + (1/2 + (k+1)/(2 * k + 1)) := by ring
_ = (∑i ∈ Finset.range (m+1), 1 / (2 * ((i + 1):ℝ) + 1 + 1))
+ 1/(2 *(((0:ℕ)):ℝ) + 1 + 1) + (1/2 + (k+1)/(2 * k + 1)) :=
by norm_num
_ = (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1 + 1)) +
(1/2 + (k+1)/(2 * k + 1)) := by rw [←h6]; norm_cast
-- > (1/2 + 1/4 + ... + 1/2k) + (k + 1)/(2k + 2) + 1/(2k+1)
_ > (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1 + 1)) +
((k+1)/(2 * k + 2) + 1/(2 * k + 2)) := by linarith
-- = (1/2 + 1/4 + ... + 1/2k) + (k + 2)/(2k + 2).
_ = (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1 + 1)) +
(k+2)/(2 * k + 2) := by field
--
-- Then we are done because
-- (k + 1)(1 + 1/3 + ... + 1/(2k - 1) + 1/(2k + 1))
-- = k (1 + 1/3 + ... + 1/(2k - 1))
-- + (1 + 1/3 + ... + 1/(2k - 1)) + (k + 1)/(2k + 1)
-- > k (1 + 1/3 + ... + 1/(2k - 1))
-- + (1/2 + 1/4 + ... + 1/2k)) + (k + 2)/(2k + 2)
-- (by h9, proved above)
-- > (k + 2)(1/2 + 1/4 + ... + 1/(2k + 2)).
have :=
calc (k + 1) * (∑i ∈ Finset.range k.succ, 1 / (2 * (i:ℝ) + 1))
= k * (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1)) +
((∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1)) +
(k + 1) / (2 * k + 1)) := by
rw [Finset.sum_range_succ]; ring
_ > k * (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1)) +
((∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1 + 1)) +
(k + 2) / (2 * k + 2)) := add_lt_add_right h9 _
_ > (k + 1) * (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 2)) +
((∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 1 + 1)) +
(k + 2) / (2 * k + 2)) := add_lt_add_left ih _
_ = (k + 1) * (∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 2)) +
((∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 2)) +
(k + 2) / (2 * k + 2)) := by
congr; funext x; rw [add_assoc, show (1:ℝ) + 1 = 2 by norm_num]
_ = (k + 2) * ((∑i ∈ Finset.range k, 1 / (2 * (i:ℝ) + 2)) +
1 / (2 * k + 2)) := by ring
_ = (k + 2) * (∑i ∈ Finset.range k.succ, 1 / (2 * (i:ℝ) + 2))
:= by rw [←Finset.sum_range_succ]
norm_cast at this
norm_cast
end Canada1998P3 | null | v4.29.0-rc6 | test | [
"competition"
] | null | {"filename": "Canada1998P3.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unknown constant 'Finset.nonempty_range_add_one'", "unsolved goals\nm : \u2115\nih :\n (\u2191m.succ.succ + 1) * \u2211 i \u2208 Finset.range m.succ.succ, 1 / (2 * \u2191i + 2) <\n \u2191m.succ.succ * \u2211 i \u2208 Finset.range m.succ.succ, 1 / (2 * \u2191i + 1)\nk : \u2115 := m.succ.succ\nh1 : 1 / (2 * \u21910 + 1) = 1\nh2 : \u2200 k' \u2208 Finset.range (m + 1), 1 / (2 * \u2191(k' + 1) + 1 + 1) < 1 / (2 * \u2191(k' + 1) + 1)\nh3 :\n \u2211 k \u2208 Finset.range (m + 1), 1 / (2 * \u2191(k + 1) + 1) + (1 + (\u2191k + 1) / (2 * \u2191k + 1)) =\n \u2211 i \u2208 Finset.range k, 1 / (2 * \u2191i + 1) + (\u2191k + 1) / (2 * \u2191k + 1)\nh4 : (Finset.range (m + 1)).Nonempty\nh5 : \u2211 x \u2208 Finset.range (m + 1), 1 / \u2191(2 * (x + 1) + 1 + 1) < \u2211 x \u2208 Finset.range (m + 1), 1 / \u2191(2 * (x + 1) + 1)\nh6 :\n \u2211 k \u2208 Finset.range (m + 1), 1 / (2 * \u2191(k + 1) + 1 + 1) + 1 / (2 * \u21910 + 1 + 1) =\n \u2211 i \u2208 Finset.range k, 1 / (2 * \u2191i + 1 + 1)\nh7' : 2 * \u2191k \u2265 4\nh7 : 1 / (2 * \u2191k + 2) < 1 / 2\nh8 : (\u2191k + 1) / (2 * \u2191k + 2) < (\u2191k + 1) / (2 * \u2191k + 1)\n\u22a2 \u2211 i \u2208 Finset.range k, 1 / (2 * \u2191i + 1 + 1) + ((\u2191k + 1) / (2 * \u2191k + 2) + 1 / (2 * \u2191k + 2)) =\n \u2211 i \u2208 Finset.range k, 1 / (2 * \u2191i + 1 + 1) + (\u2191k + 2) / (2 * \u2191k + 2)", "unsolved goals\ncase succ.succ.succ\nm : \u2115\nih :\n (\u2191m.succ.succ + 1) * \u2211 i \u2208 Finset.range m.succ.succ, 1 / (2 * \u2191i + 2) <\n \u2191m.succ.succ * \u2211 i \u2208 Finset.range m.succ.succ, 1 / (2 * \u2191i + 1)\nk : \u2115 := m.succ.succ\nh1 : 1 / (2 * \u21910 + 1) = 1\nh2 : \u2200 k' \u2208 Finset.range (m + 1), 1 / (2 * \u2191(k' + 1) + 1 + 1) < 1 / (2 * \u2191(k' + 1) + 1)\nh3 :\n \u2211 k \u2208 Finset.range (m + 1), 1 / (2 * \u2191(k + 1) + 1) + (1 + (\u2191k + 1) / (2 * \u2191k + 1)) =\n \u2211 i \u2208 Finset.range k, 1 / (2 * \u2191i + 1) + (\u2191k + 1) / (2 * \u2191k + 1)\nh4 : (Finset.range (m + 1)).Nonempty\nh5 : \u2211 x \u2208 Finset.range (m + 1), 1 / \u2191(2 * (x + 1) + 1 + 1) < \u2211 x \u2208 Finset.range (m + 1), 1 / \u2191(2 * (x + 1) + 1)\nh6 :\n \u2211 k \u2208 Finset.range (m + 1), 1 / (2 * \u2191(k + 1) + 1 + 1) + 1 / (2 * \u21910 + 1 + 1) =\n \u2211 i \u2208 Finset.range k, 1 / (2 * \u2191i + 1 + 1)\nh7' : 2 * \u2191k \u2265 4\nh7 : 1 / (2 * \u2191k + 2) < 1 / 2\nh8 : (\u2191k + 1) / (2 * \u2191k + 2) < (\u2191k + 1) / (2 * \u2191k + 1)\nh9 :\n \u2211 i \u2208 Finset.range k, 1 / (2 * \u2191i + 1) + (\u2191k + 1) / (2 * \u2191k + 1) >\n \u2211 i \u2208 Finset.range k, 1 / (2 * \u2191i + 1 + 1) + (\u2191k + 2) / (2 * \u2191k + 2)\n\u22a2 (\u2191(m + 1).succ.succ + 1) * \u2211 i \u2208 Finset.range (m + 1).succ.succ, 1 / (2 * \u2191i + 2) <\n \u2191(m + 1).succ.succ * \u2211 i \u2208 Finset.range (m + 1).succ.succ, 1 / (2 * \u2191i + 1)"], "timeout_s": 600.0, "latency_s": 5.2525, "verified_at": "2026-03-26T18:16:01.338447+00:00"}} | false | true | false | 5.2525 |
compfiles_Canada1998P5 | compfiles | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
Canadian Mathematical Olympiad 1998, Problem 5
Let m be a positive integer. Define the sequence {aₙ} by a₀ = 0,
a₁ = m, and aₙ₊₁ = m²aₙ - aₙ₋₁ for n ≥ 1. Prove that an ordered pair
(a,b) of nonegative integers, with a ≤ b, is a solution of the equation
(a² + b²) / (ab + 1) = m²
if an only if (a,b) = (aₙ,aₙ₊₁) for some n ≥ 0.
-/
namespace Canada1998P5
def A (m : ℕ) (hm : 0 < m) : ℕ → ℤ
| 0 => 0
| 1 => (↑m)
| n + 2 => (m : ℤ)^2 * A m hm (n + 1) - A m hm n
theorem canada1998_p5 (m : ℕ) (hm : 0 < m) (a b : ℕ) (hab : a ≤ b) :
a^2 + b^2 = m^2 * (a * b + 1) ↔
∃ n : ℕ, (a:ℤ) = A m hm n ∧ (b:ℤ) = A m hm (n + 1) := by
sorry
end Canada1998P5 | /- | /-
Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
Canadian Mathematical Olympiad 1998, Problem 5
Let m be a positive integer. Define the sequence {aₙ} by a₀ = 0,
a₁ = m, and aₙ₊₁ = m²aₙ - aₙ₋₁ for n ≥ 1. Prove that an ordered pair
(a,b) of nonegative integers, with a ≤ b, is a solution of the equation
(a² + b²) / (ab + 1) = m²
if an only if (a,b) = (aₙ,aₙ₊₁) for some n ≥ 0.
-/
namespace Canada1998P5
def A (m : ℕ) (hm : 0 < m) : ℕ → ℤ
| 0 => 0
| 1 => (↑m)
| n + 2 => (m : ℤ)^2 * A m hm (n + 1) - A m hm n
theorem canada1998_p5 (m : ℕ) (hm : 0 < m) (a b : ℕ) (hab : a ≤ b) :
a^2 + b^2 = m^2 * (a * b + 1) ↔
∃ n : ℕ, (a:ℤ) = A m hm n ∧ (b:ℤ) = A m hm (n + 1) := by
sorry
end Canada1998P5
| false | null | null | v4.29.0-rc6 | test | [
"competition"
] | null | {"filename": "Canada1998P5.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": true, "errors": [], "timeout_s": 600.0, "latency_s": 0.0672, "verified_at": "2026-03-26T18:15:56.404638+00:00"}} | false | true | true | 0.0672 |
compfiles_Egmo2023P1 | compfiles | Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Ansar Azharov
-/
import Mathlib
/-!
# European Girls' Mathematical Olympiad 2023, Problem 1
There are n ≥ 3 positive real numbers a_1, a_2, . . . , a_n. For each 1 ≤ i ≤ n we let
b_i = (a_(i-1) + a_(i+1)) / a_i (here we define a_0 to be a_n and a_(n+1) to be a_1).
Assume that for all i and j in the range 1 to n, we have a_i ≤ a_j if and only if b_i ≤ b_j.
Prove that a_1 = a_2 = ... = a_n.
-/
namespace Egmo2023P1
theorem egmo2023_p1 (n : ℕ) [NeZero n] (_ : n ≥ 3) (a : Fin n → ℝ) (ha : ∀ i, a i > 0)
(b : Fin n → ℝ) (hb : ∀ i, b i = (a (i - 1) + a (i + 1)) / (a i))
(h : ∀ i j, a i ≤ a j ↔ b i ≤ b j) : ∀ i j, a i = a j := by
-- The solution was adapted from here: https://www.youtube.com/watch?v=PNFh789P31E.
-- Note that indexing starts from 0 in the formalized statement.
obtain ⟨m, hm⟩ := Finite.exists_min a
obtain ⟨M, hM⟩ := Finite.exists_max a
have h1 : b m ≥ 2 := calc b m
_ ≥ (a m + a m) / (a m) := by
rw [hb m]
gcongr
· exact le_of_lt (ha m)
· exact hm (m - 1)
· exact hm (m + 1)
_ ≥ 2 := by
rw [← two_mul, mul_div_cancel_right₀]
positivity [ha m]
have h2 : b M ≤ 2 := calc b M
_ ≤ (a M + a M) / (a M) := by
rw [hb M]
gcongr
· exact le_of_lt (ha M)
· exact hM (M - 1)
· exact hM (M + 1)
_ ≤ 2 := by
rw [← two_mul, mul_div_cancel_right₀]
positivity [ha M]
have h3 : ∀ i, b i = 2 := by
intro i
apply eq_of_le_of_ge
· exact le_trans ((h i M).mp (hM i)) h2
· exact le_trans h1 ((h m i).mp (hm i))
intro i j
apply eq_of_le_of_ge
· rw [h i j, h3 i, h3 j]
· rw [h j i, h3 j, h3 i]
end Egmo2023P1 | /- | /-
Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Ansar Azharov
-/
import Mathlib
/-!
# European Girls' Mathematical Olympiad 2023, Problem 1
There are n ≥ 3 positive real numbers a_1, a_2, . . . , a_n. For each 1 ≤ i ≤ n we let
b_i = (a_(i-1) + a_(i+1)) / a_i (here we define a_0 to be a_n and a_(n+1) to be a_1).
Assume that for all i and j in the range 1 to n, we have a_i ≤ a_j if and only if b_i ≤ b_j.
Prove that a_1 = a_2 = ... = a_n.
-/
namespace Egmo2023P1
theorem egmo2023_p1 (n : ℕ) [NeZero n] (_ : n ≥ 3) (a : Fin n → ℝ) (ha : ∀ i, a i > 0)
(b : Fin n → ℝ) (hb : ∀ i, b i = (a (i - 1) + a (i + 1)) / (a i))
(h : ∀ i j, a i ≤ a j ↔ b i ≤ b j) : ∀ i j, a i = a j := by
-- The solution was adapted from here: https://www.youtube.com/watch?v=PNFh789P31E.
-- Note that indexing starts from 0 in the formalized statement.
obtain ⟨m, hm⟩ := Finite.exists_min a
obtain ⟨M, hM⟩ := Finite.exists_max a
have h1 : b m ≥ 2 := calc b m
_ ≥ (a m + a m) / (a m) := by
rw [hb m]
gcongr
· exact le_of_lt (ha m)
· exact hm (m - 1)
· exact hm (m + 1)
_ ≥ 2 := by
rw [← two_mul, mul_div_cancel_right₀]
positivity [ha m]
have h2 : b M ≤ 2 := calc b M
_ ≤ (a M + a M) / (a M) := by
rw [hb M]
gcongr
· exact le_of_lt (ha M)
· exact hM (M - 1)
· exact hM (M + 1)
_ ≤ 2 := by
rw [← two_mul, mul_div_cancel_right₀]
positivity [ha M]
have h3 : ∀ i, b i = 2 := by
intro i
apply eq_of_le_of_ge
· exact le_trans ((h i M).mp (hM i)) h2
· exact le_trans h1 ((h m i).mp (hm i))
intro i j
apply eq_of_le_of_ge
· rw [h i j, h3 i, h3 j]
· rw [h j i, h3 j, h3 i]
end Egmo2023P1
| true | Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Ansar Azharov
-/
import Mathlib
/-!
# European Girls' Mathematical Olympiad 2023, Problem 1
There are n ≥ 3 positive real numbers a_1, a_2, . . . , a_n. For each 1 ≤ i ≤ n we let
b_i = (a_(i-1) + a_(i+1)) / a_i (here we define a_0 to be a_n and a_(n+1) to be a_1).
Assume that for all i and j in the range 1 to n, we have a_i ≤ a_j if and only if b_i ≤ b_j.
Prove that a_1 = a_2 = ... = a_n.
-/
namespace Egmo2023P1
theorem egmo2023_p1 (n : ℕ) [NeZero n] (_ : n ≥ 3) (a : Fin n → ℝ) (ha : ∀ i, a i > 0)
(b : Fin n → ℝ) (hb : ∀ i, b i = (a (i - 1) + a (i + 1)) / (a i))
(h : ∀ i j, a i ≤ a j ↔ b i ≤ b j) : ∀ i j, a i = a j := by
-- The solution was adapted from here: https://www.youtube.com/watch?v=PNFh789P31E.
-- Note that indexing starts from 0 in the formalized statement.
obtain ⟨m, hm⟩ := Finite.exists_min a
obtain ⟨M, hM⟩ := Finite.exists_max a
have h1 : b m ≥ 2 := calc b m
_ ≥ (a m + a m) / (a m) := by
rw [hb m]
gcongr
· exact le_of_lt (ha m)
· exact hm (m - 1)
· exact hm (m + 1)
_ ≥ 2 := by
rw [← two_mul, mul_div_cancel_right₀]
positivity [ha m]
have h2 : b M ≤ 2 := calc b M
_ ≤ (a M + a M) / (a M) := by
rw [hb M]
gcongr
· exact le_of_lt (ha M)
· exact hM (M - 1)
· exact hM (M + 1)
_ ≤ 2 := by
rw [← two_mul, mul_div_cancel_right₀]
positivity [ha M]
have h3 : ∀ i, b i = 2 := by
intro i
apply eq_of_le_of_ge
· exact le_trans ((h i M).mp (hM i)) h2
· exact le_trans h1 ((h m i).mp (hm i))
intro i j
apply eq_of_le_of_ge
· rw [h i j, h3 i, h3 j]
· rw [h j i, h3 j, h3 i]
end Egmo2023P1 | null | v4.29.0-rc6 | test | [
"competition"
] | null | {"filename": "Egmo2023P1.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["failed to prove positivity/nonnegativity/nonzeroness", "unsolved goals\ncase intro.intro\nn : \u2115\ninst\u271d : NeZero n\nx\u271d : n \u2265 3\na : Fin n \u2192 \u211d\nha : \u2200 (i : Fin n), a i > 0\nb : Fin n \u2192 \u211d\nhb : \u2200 (i : Fin n), b i = (a (i - 1) + a (i + 1)) / a i\nh : \u2200 (i j : Fin n), a i \u2264 a j \u2194 b i \u2264 b j\nm : Fin n\nhm : \u2200 (x : Fin n), a m \u2264 a x\nM : Fin n\nhM : \u2200 (x : Fin n), a x \u2264 a M\nh1 : b m \u2265 2\n\u22a2 \u2200 (i j : Fin n), a i = a j", "unexpected token '['; expected command"], "timeout_s": 600.0, "latency_s": 0.2509, "verified_at": "2026-03-26T18:15:56.655693+00:00"}} | false | true | false | 0.2509 |
compfiles_Hungary1998P6 | compfiles | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# Hungarian Mathematical Olympiad 1998, Problem 6
Let x, y, z be integers with z > 1. Show that
(x + 1)² + (x + 2)² + ... + (x + 99)² ≠ yᶻ.
-/
namespace Hungary1998P6
lemma sum_range_square_mul_six (n : ℕ) :
(∑i ∈ Finset.range n, (i + 1)^2) * 6 = n * (n + 1) * (2 * n + 1) := by
induction n with
| zero => rfl
| succ n ih =>
rw [Finset.sum_range_succ, add_mul, ih]
ring
lemma sum_range_square (n : ℕ) :
∑i ∈ Finset.range n, (i + 1)^2 = n * (n + 1) * (2 * n + 1)/6 :=
by rw [← sum_range_square_mul_six n, Nat.mul_div_cancel]
norm_num
lemma cast_sum_square (n : ℕ) :
∑i ∈ Finset.range n, ((i:ℤ)+1)^2 =
(((∑i ∈ Finset.range n, (i+1)^2) : ℕ) : ℤ) := by norm_cast
theorem hungary1998_p6 (x y : ℤ) (z : ℕ) (hz : 1 < z) :
∑ i ∈ Finset.range 99, (x + i + 1)^2 ≠ y^z := by
-- Follows the proof in _Mathematical Olympiads 1998-1999_
-- by Titu Andreescu and Zuming Feng.
-- Suppose (x + 1)² + (x + 2)² + ... + (x + 99)² = yᶻ.
intro he
-- We notice that
-- y^z = (x + 1)² + (x + 2)² + ... + (x + 99)²
-- = 99x² + 2(1 + 2 + ... + 99)x + (1² + 2² + ... + 99²)
-- = 99x² + 2[(99 ⬝ 100)/2]x + (99 ⬝ 100 ⬝ 199)/6
-- = 33(3x² + 300x + 50 ⬝ 199).
have h2 : ∑ i ∈ Finset.range 99, x^2 = 99 * x^2 := by norm_num
have h4 : ∑ i ∈ Finset.range 99, ((i:ℤ) + 1) =
∑ i ∈ Finset.range 100, (i:ℤ) := by
rw [Finset.sum_range_succ']
simp [Finset.sum_range_succ]
have h5 : ∑ i ∈ Finset.range 100, (i:ℤ) = 99 * 100 / 2 := by
rw [←Nat.cast_sum, Finset.sum_range_id]; decide
have h6 : ∑ i ∈ Finset.range 99, ((i:ℤ) + 1)^2 = (99 * 100 * 199)/6 := by
rw [cast_sum_square, sum_range_square]; decide
have hnn1 : (99:ℤ) * 100 / 2 = 99 * 50 := by decide
have hnn2 : ((99:ℤ) * 100 * 199)/6 = 33 * 50 * 199 := by decide
have h7 := calc y^z
= ∑ i ∈ Finset.range 99, ((x + i) + 1)^2 := he.symm
_ = ∑ i ∈ Finset.range 99,
(x^2 + 2 * x * ((i:ℤ) + 1) + ((i:ℤ) + 1)^2) :=
by with_reducible congr; funext; ring
_ = ∑ i ∈ Finset.range 99, (x^2 + 2 * x * ((i:ℤ) + 1)) +
∑ i ∈ Finset.range 99, ((i:ℤ) + 1)^2 := Finset.sum_add_distrib
_ = ∑ i ∈ Finset.range 99, x^2 +
∑ i ∈ Finset.range 99, (2 * x * ((i:ℤ) + 1)) +
∑ i ∈ Finset.range 99, (((i:ℤ) + 1)^2) := by rw [Finset.sum_add_distrib]
_ = 99 * x^2 + 2 * x * (99 * 100 / 2) + (99 * 100 * 199)/6
:= by rw [h2, ←Finset.mul_sum, h4, h5, h6]
_ = 3 * (11 * (3 * x^2 + 300 * x + 50 * 199)) := by rw [hnn1, hnn2]; ring
-- which implies that 3∣y.
have h8 : 3 ∣ y^z := Dvd.intro _ (Eq.symm h7)
have h9 : 3 ∣ y := Prime.dvd_of_dvd_pow Int.prime_three h8
obtain ⟨k, hk⟩ := h9
rw [hk] at h7
cases z with | zero => exact Nat.not_lt_zero 1 hz | succ z =>
cases z with | zero => exact Nat.lt_asymm hz hz | succ z =>
rw [pow_succ, pow_succ] at h7
-- Since z ≥ 2, 3²∣yᶻ, but 3² does not divide
-- 33(3x² + 300x + 50 ⬝ 199), contradiction.
omega
end Hungary1998P6 | /- | /-
Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# Hungarian Mathematical Olympiad 1998, Problem 6
Let x, y, z be integers with z > 1. Show that
(x + 1)² + (x + 2)² + ... + (x + 99)² ≠ yᶻ.
-/
namespace Hungary1998P6
lemma sum_range_square_mul_six (n : ℕ) :
(∑i ∈ Finset.range n, (i + 1)^2) * 6 = n * (n + 1) * (2 * n + 1) := by
induction n with
| zero => rfl
| succ n ih =>
rw [Finset.sum_range_succ, add_mul, ih]
ring
lemma sum_range_square (n : ℕ) :
∑i ∈ Finset.range n, (i + 1)^2 = n * (n + 1) * (2 * n + 1)/6 :=
by rw [← sum_range_square_mul_six n, Nat.mul_div_cancel]
norm_num
lemma cast_sum_square (n : ℕ) :
∑i ∈ Finset.range n, ((i:ℤ)+1)^2 =
(((∑i ∈ Finset.range n, (i+1)^2) : ℕ) : ℤ) := by norm_cast
theorem hungary1998_p6 (x y : ℤ) (z : ℕ) (hz : 1 < z) :
∑ i ∈ Finset.range 99, (x + i + 1)^2 ≠ y^z := by
-- Follows the proof in _Mathematical Olympiads 1998-1999_
-- by Titu Andreescu and Zuming Feng.
-- Suppose (x + 1)² + (x + 2)² + ... + (x + 99)² = yᶻ.
intro he
-- We notice that
-- y^z = (x + 1)² + (x + 2)² + ... + (x + 99)²
-- = 99x² + 2(1 + 2 + ... + 99)x + (1² + 2² + ... + 99²)
-- = 99x² + 2[(99 ⬝ 100)/2]x + (99 ⬝ 100 ⬝ 199)/6
-- = 33(3x² + 300x + 50 ⬝ 199).
have h2 : ∑ i ∈ Finset.range 99, x^2 = 99 * x^2 := by norm_num
have h4 : ∑ i ∈ Finset.range 99, ((i:ℤ) + 1) =
∑ i ∈ Finset.range 100, (i:ℤ) := by
rw [Finset.sum_range_succ']
simp [Finset.sum_range_succ]
have h5 : ∑ i ∈ Finset.range 100, (i:ℤ) = 99 * 100 / 2 := by
rw [←Nat.cast_sum, Finset.sum_range_id]; decide
have h6 : ∑ i ∈ Finset.range 99, ((i:ℤ) + 1)^2 = (99 * 100 * 199)/6 := by
rw [cast_sum_square, sum_range_square]; decide
have hnn1 : (99:ℤ) * 100 / 2 = 99 * 50 := by decide
have hnn2 : ((99:ℤ) * 100 * 199)/6 = 33 * 50 * 199 := by decide
have h7 := calc y^z
= ∑ i ∈ Finset.range 99, ((x + i) + 1)^2 := he.symm
_ = ∑ i ∈ Finset.range 99,
(x^2 + 2 * x * ((i:ℤ) + 1) + ((i:ℤ) + 1)^2) :=
by with_reducible congr; funext; ring
_ = ∑ i ∈ Finset.range 99, (x^2 + 2 * x * ((i:ℤ) + 1)) +
∑ i ∈ Finset.range 99, ((i:ℤ) + 1)^2 := Finset.sum_add_distrib
_ = ∑ i ∈ Finset.range 99, x^2 +
∑ i ∈ Finset.range 99, (2 * x * ((i:ℤ) + 1)) +
∑ i ∈ Finset.range 99, (((i:ℤ) + 1)^2) := by rw [Finset.sum_add_distrib]
_ = 99 * x^2 + 2 * x * (99 * 100 / 2) + (99 * 100 * 199)/6
:= by rw [h2, ←Finset.mul_sum, h4, h5, h6]
_ = 3 * (11 * (3 * x^2 + 300 * x + 50 * 199)) := by rw [hnn1, hnn2]; ring
-- which implies that 3∣y.
have h8 : 3 ∣ y^z := Dvd.intro _ (Eq.symm h7)
have h9 : 3 ∣ y := Prime.dvd_of_dvd_pow Int.prime_three h8
obtain ⟨k, hk⟩ := h9
rw [hk] at h7
cases z with | zero => exact Nat.not_lt_zero 1 hz | succ z =>
cases z with | zero => exact Nat.lt_asymm hz hz | succ z =>
rw [pow_succ, pow_succ] at h7
-- Since z ≥ 2, 3²∣yᶻ, but 3² does not divide
-- 33(3x² + 300x + 50 ⬝ 199), contradiction.
omega
end Hungary1998P6
| true | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# Hungarian Mathematical Olympiad 1998, Problem 6
Let x, y, z be integers with z > 1. Show that
(x + 1)² + (x + 2)² + ... + (x + 99)² ≠ yᶻ.
-/
namespace Hungary1998P6
lemma sum_range_square_mul_six (n : ℕ) :
(∑i ∈ Finset.range n, (i + 1)^2) * 6 = n * (n + 1) * (2 * n + 1) := by
induction n with
| zero => rfl
| succ n ih =>
rw [Finset.sum_range_succ, add_mul, ih]
ring
lemma sum_range_square (n : ℕ) :
∑i ∈ Finset.range n, (i + 1)^2 = n * (n + 1) * (2 * n + 1)/6 :=
by rw [← sum_range_square_mul_six n, Nat.mul_div_cancel]
norm_num
lemma cast_sum_square (n : ℕ) :
∑i ∈ Finset.range n, ((i:ℤ)+1)^2 =
(((∑i ∈ Finset.range n, (i+1)^2) : ℕ) : ℤ) := by norm_cast
theorem hungary1998_p6 (x y : ℤ) (z : ℕ) (hz : 1 < z) :
∑ i ∈ Finset.range 99, (x + i + 1)^2 ≠ y^z := by
-- Follows the proof in _Mathematical Olympiads 1998-1999_
-- by Titu Andreescu and Zuming Feng.
-- Suppose (x + 1)² + (x + 2)² + ... + (x + 99)² = yᶻ.
intro he
-- We notice that
-- y^z = (x + 1)² + (x + 2)² + ... + (x + 99)²
-- = 99x² + 2(1 + 2 + ... + 99)x + (1² + 2² + ... + 99²)
-- = 99x² + 2[(99 ⬝ 100)/2]x + (99 ⬝ 100 ⬝ 199)/6
-- = 33(3x² + 300x + 50 ⬝ 199).
have h2 : ∑ i ∈ Finset.range 99, x^2 = 99 * x^2 := by norm_num
have h4 : ∑ i ∈ Finset.range 99, ((i:ℤ) + 1) =
∑ i ∈ Finset.range 100, (i:ℤ) := by
rw [Finset.sum_range_succ']
simp [Finset.sum_range_succ]
have h5 : ∑ i ∈ Finset.range 100, (i:ℤ) = 99 * 100 / 2 := by
rw [←Nat.cast_sum, Finset.sum_range_id]; decide
have h6 : ∑ i ∈ Finset.range 99, ((i:ℤ) + 1)^2 = (99 * 100 * 199)/6 := by
rw [cast_sum_square, sum_range_square]; decide
have hnn1 : (99:ℤ) * 100 / 2 = 99 * 50 := by decide
have hnn2 : ((99:ℤ) * 100 * 199)/6 = 33 * 50 * 199 := by decide
have h7 := calc y^z
= ∑ i ∈ Finset.range 99, ((x + i) + 1)^2 := he.symm
_ = ∑ i ∈ Finset.range 99,
(x^2 + 2 * x * ((i:ℤ) + 1) + ((i:ℤ) + 1)^2) :=
by with_reducible congr; funext; ring
_ = ∑ i ∈ Finset.range 99, (x^2 + 2 * x * ((i:ℤ) + 1)) +
∑ i ∈ Finset.range 99, ((i:ℤ) + 1)^2 := Finset.sum_add_distrib
_ = ∑ i ∈ Finset.range 99, x^2 +
∑ i ∈ Finset.range 99, (2 * x * ((i:ℤ) + 1)) +
∑ i ∈ Finset.range 99, (((i:ℤ) + 1)^2) := by rw [Finset.sum_add_distrib]
_ = 99 * x^2 + 2 * x * (99 * 100 / 2) + (99 * 100 * 199)/6
:= by rw [h2, ←Finset.mul_sum, h4, h5, h6]
_ = 3 * (11 * (3 * x^2 + 300 * x + 50 * 199)) := by rw [hnn1, hnn2]; ring
-- which implies that 3∣y.
have h8 : 3 ∣ y^z := Dvd.intro _ (Eq.symm h7)
have h9 : 3 ∣ y := Prime.dvd_of_dvd_pow Int.prime_three h8
obtain ⟨k, hk⟩ := h9
rw [hk] at h7
cases z with | zero => exact Nat.not_lt_zero 1 hz | succ z =>
cases z with | zero => exact Nat.lt_asymm hz hz | succ z =>
rw [pow_succ, pow_succ] at h7
-- Since z ≥ 2, 3²∣yᶻ, but 3² does not divide
-- 33(3x² + 300x + 50 ⬝ 199), contradiction.
omega
end Hungary1998P6 | null | v4.29.0-rc6 | test | [
"competition"
] | null | {"filename": "Hungary1998P6.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unsolved goals\ncase intro.succ.succ\nx y : \u2124\nh2 : \u2211 i \u2208 Finset.range 99, x ^ 2 = 99 * x ^ 2\nh4 : \u2211 i \u2208 Finset.range 99, (\u2191i + 1) = \u2211 i \u2208 Finset.range 100, \u2191i\nh5 : \u2211 i \u2208 Finset.range 100, \u2191i = 99 * 100 / 2\nh6 : \u2211 i \u2208 Finset.range 99, (\u2191i + 1) ^ 2 = 99 * 100 * 199 / 6\nhnn1 : 99 * 100 / 2 = 99 * 50\nhnn2 : 99 * 100 * 199 / 6 = 33 * 50 * 199\nk : \u2124\nhk : y = 3 * k\nz : \u2115\nhz : 1 < z + 1 + 1\nhe : \u2211 i \u2208 Finset.range 99, (x + \u2191i + 1) ^ 2 = y ^ (z + 1 + 1)\nh8 : 3 \u2223 y ^ (z + 1 + 1)\nh7 : (3 * k) ^ z * (3 * k) * (3 * k) = 3 * (11 * (3 * x ^ 2 + 300 * x + 50 * 199))\n\u22a2 False"], "timeout_s": 600.0, "latency_s": 1.7075, "verified_at": "2026-03-26T18:15:58.363303+00:00"}} | false | true | false | 1.7075 |
compfiles_Imo1959P1 | compfiles | Copyright (c) 2020 Kevin Lacker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Lacker
-/
import Mathlib
/-!
# International Mathematical Olympiad 1959, Problem 1.
Prove that the fraction `(21n+4)/(14n+3)` is irreducible for every
natural number `n`.
-/
namespace Imo1959P1
lemma calculation
(n k : ℕ)
(h1 : k ∣ 21 * n + 4)
(h2 : k ∣ 14 * n + 3) :
k ∣ 1 := by
have h3 : k ∣ 2 * (21 * n + 4) := h1.mul_left 2
have h4 : k ∣ 3 * (14 * n + 3) := h2.mul_left 3
have h5 : 3 * (14 * n + 3) = 2 * (21 * n + 4) + 1 := by ring
exact (Nat.dvd_add_right h3).mp (h5 ▸ h4)
/-
Since Lean doesn't have a concept of "irreducible fractions" per se,
we just formalize this as saying the numerator and denominator are
relatively prime.
-/
theorem imo1959_p1 : ∀ n : ℕ, Nat.Coprime (21 * n + 4) (14 * n + 3) :=
fun n => Nat.coprime_of_dvd' <| λ k _ h1 h2 => calculation n k h1 h2
end Imo1959P1 | /- | /-
Copyright (c) 2020 Kevin Lacker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Lacker
-/
import Mathlib
/-!
# International Mathematical Olympiad 1959, Problem 1.
Prove that the fraction `(21n+4)/(14n+3)` is irreducible for every
natural number `n`.
-/
namespace Imo1959P1
lemma calculation
(n k : ℕ)
(h1 : k ∣ 21 * n + 4)
(h2 : k ∣ 14 * n + 3) :
k ∣ 1 := by
have h3 : k ∣ 2 * (21 * n + 4) := h1.mul_left 2
have h4 : k ∣ 3 * (14 * n + 3) := h2.mul_left 3
have h5 : 3 * (14 * n + 3) = 2 * (21 * n + 4) + 1 := by ring
exact (Nat.dvd_add_right h3).mp (h5 ▸ h4)
/-
Since Lean doesn't have a concept of "irreducible fractions" per se,
we just formalize this as saying the numerator and denominator are
relatively prime.
-/
theorem imo1959_p1 : ∀ n : ℕ, Nat.Coprime (21 * n + 4) (14 * n + 3) :=
fun n => Nat.coprime_of_dvd' <| λ k _ h1 h2 => calculation n k h1 h2
end Imo1959P1
| true | Copyright (c) 2020 Kevin Lacker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Lacker
-/
import Mathlib
/-!
# International Mathematical Olympiad 1959, Problem 1.
Prove that the fraction `(21n+4)/(14n+3)` is irreducible for every
natural number `n`.
-/
namespace Imo1959P1
lemma calculation
(n k : ℕ)
(h1 : k ∣ 21 * n + 4)
(h2 : k ∣ 14 * n + 3) :
k ∣ 1 := by
have h3 : k ∣ 2 * (21 * n + 4) := h1.mul_left 2
have h4 : k ∣ 3 * (14 * n + 3) := h2.mul_left 3
have h5 : 3 * (14 * n + 3) = 2 * (21 * n + 4) + 1 := by ring
exact (Nat.dvd_add_right h3).mp (h5 ▸ h4)
/-
Since Lean doesn't have a concept of "irreducible fractions" per se,
we just formalize this as saying the numerator and denominator are
relatively prime.
-/
theorem imo1959_p1 : ∀ n : ℕ, Nat.Coprime (21 * n + 4) (14 * n + 3) :=
fun n => Nat.coprime_of_dvd' <| λ k _ h1 h2 => calculation n k h1 h2
end Imo1959P1 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1959P1.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 600.0, "latency_s": 0.0842, "verified_at": "2026-03-26T18:15:57.549955+00:00"}} | true | true | false | 0.0842 |
compfiles_Imo1959P2 | compfiles | Copyright (c) 2024 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib
/-!
# International Mathematical Olympiad 1959, Problem 2
For what real values of x is
√(x+√(2x-1)) + √(x-√(2x-1)) = A,
given:
(a) A = √2
(b) A = 1
(c) A = 2,
where only non-negative real numbers are admitted for square roots?
-/
open Set Real
namespace Imo1959P2
def IsGood (x A : ℝ) : Prop :=
sqrt (x + sqrt (2 * x - 1)) + sqrt (x - sqrt (2 * x - 1)) = A ∧ 0 ≤ 2 * x - 1 ∧
0 ≤ x + sqrt (2 * x - 1) ∧ 0 ≤ x - sqrt (2 * x - 1)
variable {x A : ℝ}
/-
We follow second solution from the
[Art of Problem Solving](https://artofproblemsolving.com/wiki/index.php/1959_IMO_Problems/Problem_2)
website.
Namely, we rewrite the equation as $\sqrt{2x-1}+1+|\sqrt{2x-1}-1|=A\sqrt{2}$,
then consider the cases $\sqrt{2x-1}\le 1$ and $1 < \sqrt{2x-1}$ separately.
-/
theorem isGood_iff : IsGood x A ↔
sqrt (2 * x - 1) + 1 + |sqrt (2 * x - 1) - 1| = A * sqrt 2 ∧ 1 / 2 ≤ x := by
cases le_or_gt (1 / 2) x with
| inl hx =>
have hx' : 0 ≤ 2 * x - 1 := by linarith
have h₁ : x + sqrt (2 * x - 1) = (sqrt (2 * x - 1) + 1) ^ 2 / 2 := by
rw [add_sq, sq_sqrt hx']; field_simp; ring
have h₂ : x - sqrt (2 * x - 1) = (sqrt (2 * x - 1) - 1) ^ 2 / 2 := by
rw [sub_sq, sq_sqrt hx']; field_simp; ring
simp only [IsGood, *, div_nonneg (sq_nonneg _) (zero_le_two (α := ℝ)), sqrt_div (sq_nonneg _),
and_true]
rw [sqrt_sq, sqrt_sq_eq_abs] <;> [skip; positivity]
field_simp
| inr hx =>
have : 2 * x - 1 < 0 := by linarith
simp only [IsGood, this.not_ge, hx.not_ge]; simp
theorem IsGood.one_half_le (h : IsGood x A) : 1 / 2 ≤ x := (isGood_iff.1 h).2
theorem sqrt_two_mul_sub_one_le_one : sqrt (2 * x - 1) ≤ 1 ↔ x ≤ 1 := by
simp [sqrt_le_iff, ← two_mul]
theorem isGood_iff_eq_sqrt_two (hx : x ∈ Icc (1 / 2) 1) : IsGood x A ↔ A = sqrt 2 := by
have : sqrt (2 * x - 1) ≤ 1 := sqrt_two_mul_sub_one_le_one.2 hx.2
simp only [isGood_iff, hx.1, abs_sub_comm _ (1 : ℝ), abs_of_nonneg (sub_nonneg.2 this), and_true]
suffices 2 = A * sqrt 2 ↔ A = sqrt 2 by convert this using 2; ring
rw [← div_eq_iff, div_sqrt, eq_comm]
positivity
theorem isGood_iff_eq_sqrt (hx : 1 < x) : IsGood x A ↔ A = sqrt (4 * x - 2) := by
have h₁ : 1 < sqrt (2 * x - 1) := by simpa only [← not_le, sqrt_two_mul_sub_one_le_one] using hx
have h₂ : 1 / 2 ≤ x := by linarith
simp only [isGood_iff, h₂, abs_of_pos (sub_pos.2 h₁), add_add_sub_cancel, and_true]
rw [← mul_two, ← div_eq_iff (by positivity), mul_div_assoc, div_sqrt, ← sqrt_mul' _ zero_le_two,
eq_comm]
ring_nf
theorem IsGood.sqrt_two_lt_of_one_lt (h : IsGood x A) (hx : 1 < x) : sqrt 2 < A := by
rw [(isGood_iff_eq_sqrt hx).1 h]
refine sqrt_lt_sqrt zero_le_two ?_
linarith
theorem IsGood.eq_sqrt_two_iff_le_one (h : IsGood x A) : A = sqrt 2 ↔ x ≤ 1 :=
⟨fun hA ↦ not_lt.1 fun hx ↦ (h.sqrt_two_lt_of_one_lt hx).ne' hA, fun hx ↦
(isGood_iff_eq_sqrt_two ⟨h.one_half_le, hx⟩).1 h⟩
theorem IsGood.sqrt_two_lt_iff_one_lt (h : IsGood x A) : sqrt 2 < A ↔ 1 < x :=
⟨fun hA ↦ not_le.1 fun hx ↦ hA.ne' <| h.eq_sqrt_two_iff_le_one.2 hx, h.sqrt_two_lt_of_one_lt⟩
theorem IsGood.sqrt_two_le (h : IsGood x A) : sqrt 2 ≤ A :=
(le_or_gt x 1).elim (fun hx ↦ (h.eq_sqrt_two_iff_le_one.2 hx).ge) fun hx ↦
(h.sqrt_two_lt_of_one_lt hx).le
theorem isGood_iff_of_sqrt_two_lt (hA : sqrt 2 < A) : IsGood x A ↔ x = (A / 2) ^ 2 + 1 / 2 := by
have : 0 < A := lt_trans (by simp) hA
constructor
· intro h
have hx : 1 < x := by rwa [h.sqrt_two_lt_iff_one_lt] at hA
rw [isGood_iff_eq_sqrt hx, eq_comm, sqrt_eq_iff_eq_sq] at h <;> linarith
· rintro rfl
rw [isGood_iff_eq_sqrt]
· conv_lhs => rw [← sqrt_sq this.le]
ring_nf
· rw [sqrt_lt' this] at hA
linarith
abbrev solution_set_sqrt2 : Set ℝ := Icc (1 / 2) 1
theorem imo1959_p2a : IsGood x (sqrt 2) ↔ x ∈ solution_set_sqrt2 := by
refine ⟨fun h ↦ ?_, fun h ↦ (isGood_iff_eq_sqrt_two h).2 rfl⟩
exact ⟨h.one_half_le, not_lt.1 fun h₁ ↦ (h.sqrt_two_lt_of_one_lt h₁).false⟩
abbrev solution_set_one : Set ℝ := ∅
theorem imo1959_p2b : IsGood x 1 ↔ x ∈ solution_set_one := by
have not_isGood_one : ¬IsGood x 1 := fun h ↦
h.sqrt_two_le.not_gt <| (lt_sqrt zero_le_one).2 (by norm_num)
exact iff_of_false not_isGood_one fun a ↦ a
abbrev solution_set_two : Set ℝ := { 3 / 2 }
theorem imo1959_p2c : IsGood x 2 ↔ x ∈ solution_set_two := by
rw [mem_singleton_iff]
exact
(isGood_iff_of_sqrt_two_lt <| (sqrt_lt' two_pos).2 (by norm_num)).trans <| by norm_num
end Imo1959P2 | /- | /-
Copyright (c) 2024 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib
/-!
# International Mathematical Olympiad 1959, Problem 2
For what real values of x is
√(x+√(2x-1)) + √(x-√(2x-1)) = A,
given:
(a) A = √2
(b) A = 1
(c) A = 2,
where only non-negative real numbers are admitted for square roots?
-/
open Set Real
namespace Imo1959P2
def IsGood (x A : ℝ) : Prop :=
sqrt (x + sqrt (2 * x - 1)) + sqrt (x - sqrt (2 * x - 1)) = A ∧ 0 ≤ 2 * x - 1 ∧
0 ≤ x + sqrt (2 * x - 1) ∧ 0 ≤ x - sqrt (2 * x - 1)
variable {x A : ℝ}
/-
We follow second solution from the
[Art of Problem Solving](https://artofproblemsolving.com/wiki/index.php/1959_IMO_Problems/Problem_2)
website.
Namely, we rewrite the equation as $\sqrt{2x-1}+1+|\sqrt{2x-1}-1|=A\sqrt{2}$,
then consider the cases $\sqrt{2x-1}\le 1$ and $1 < \sqrt{2x-1}$ separately.
-/
theorem isGood_iff : IsGood x A ↔
sqrt (2 * x - 1) + 1 + |sqrt (2 * x - 1) - 1| = A * sqrt 2 ∧ 1 / 2 ≤ x := by
cases le_or_gt (1 / 2) x with
| inl hx =>
have hx' : 0 ≤ 2 * x - 1 := by linarith
have h₁ : x + sqrt (2 * x - 1) = (sqrt (2 * x - 1) + 1) ^ 2 / 2 := by
rw [add_sq, sq_sqrt hx']; field_simp; ring
have h₂ : x - sqrt (2 * x - 1) = (sqrt (2 * x - 1) - 1) ^ 2 / 2 := by
rw [sub_sq, sq_sqrt hx']; field_simp; ring
simp only [IsGood, *, div_nonneg (sq_nonneg _) (zero_le_two (α := ℝ)), sqrt_div (sq_nonneg _),
and_true]
rw [sqrt_sq, sqrt_sq_eq_abs] <;> [skip; positivity]
field_simp
| inr hx =>
have : 2 * x - 1 < 0 := by linarith
simp only [IsGood, this.not_ge, hx.not_ge]; simp
theorem IsGood.one_half_le (h : IsGood x A) : 1 / 2 ≤ x := (isGood_iff.1 h).2
theorem sqrt_two_mul_sub_one_le_one : sqrt (2 * x - 1) ≤ 1 ↔ x ≤ 1 := by
simp [sqrt_le_iff, ← two_mul]
theorem isGood_iff_eq_sqrt_two (hx : x ∈ Icc (1 / 2) 1) : IsGood x A ↔ A = sqrt 2 := by
have : sqrt (2 * x - 1) ≤ 1 := sqrt_two_mul_sub_one_le_one.2 hx.2
simp only [isGood_iff, hx.1, abs_sub_comm _ (1 : ℝ), abs_of_nonneg (sub_nonneg.2 this), and_true]
suffices 2 = A * sqrt 2 ↔ A = sqrt 2 by convert this using 2; ring
rw [← div_eq_iff, div_sqrt, eq_comm]
positivity
theorem isGood_iff_eq_sqrt (hx : 1 < x) : IsGood x A ↔ A = sqrt (4 * x - 2) := by
have h₁ : 1 < sqrt (2 * x - 1) := by simpa only [← not_le, sqrt_two_mul_sub_one_le_one] using hx
have h₂ : 1 / 2 ≤ x := by linarith
simp only [isGood_iff, h₂, abs_of_pos (sub_pos.2 h₁), add_add_sub_cancel, and_true]
rw [← mul_two, ← div_eq_iff (by positivity), mul_div_assoc, div_sqrt, ← sqrt_mul' _ zero_le_two,
eq_comm]
ring_nf
theorem IsGood.sqrt_two_lt_of_one_lt (h : IsGood x A) (hx : 1 < x) : sqrt 2 < A := by
rw [(isGood_iff_eq_sqrt hx).1 h]
refine sqrt_lt_sqrt zero_le_two ?_
linarith
theorem IsGood.eq_sqrt_two_iff_le_one (h : IsGood x A) : A = sqrt 2 ↔ x ≤ 1 :=
⟨fun hA ↦ not_lt.1 fun hx ↦ (h.sqrt_two_lt_of_one_lt hx).ne' hA, fun hx ↦
(isGood_iff_eq_sqrt_two ⟨h.one_half_le, hx⟩).1 h⟩
theorem IsGood.sqrt_two_lt_iff_one_lt (h : IsGood x A) : sqrt 2 < A ↔ 1 < x :=
⟨fun hA ↦ not_le.1 fun hx ↦ hA.ne' <| h.eq_sqrt_two_iff_le_one.2 hx, h.sqrt_two_lt_of_one_lt⟩
theorem IsGood.sqrt_two_le (h : IsGood x A) : sqrt 2 ≤ A :=
(le_or_gt x 1).elim (fun hx ↦ (h.eq_sqrt_two_iff_le_one.2 hx).ge) fun hx ↦
(h.sqrt_two_lt_of_one_lt hx).le
theorem isGood_iff_of_sqrt_two_lt (hA : sqrt 2 < A) : IsGood x A ↔ x = (A / 2) ^ 2 + 1 / 2 := by
have : 0 < A := lt_trans (by simp) hA
constructor
· intro h
have hx : 1 < x := by rwa [h.sqrt_two_lt_iff_one_lt] at hA
rw [isGood_iff_eq_sqrt hx, eq_comm, sqrt_eq_iff_eq_sq] at h <;> linarith
· rintro rfl
rw [isGood_iff_eq_sqrt]
· conv_lhs => rw [← sqrt_sq this.le]
ring_nf
· rw [sqrt_lt' this] at hA
linarith
abbrev solution_set_sqrt2 : Set ℝ := Icc (1 / 2) 1
theorem imo1959_p2a : IsGood x (sqrt 2) ↔ x ∈ solution_set_sqrt2 := by
refine ⟨fun h ↦ ?_, fun h ↦ (isGood_iff_eq_sqrt_two h).2 rfl⟩
exact ⟨h.one_half_le, not_lt.1 fun h₁ ↦ (h.sqrt_two_lt_of_one_lt h₁).false⟩
abbrev solution_set_one : Set ℝ := ∅
theorem imo1959_p2b : IsGood x 1 ↔ x ∈ solution_set_one := by
have not_isGood_one : ¬IsGood x 1 := fun h ↦
h.sqrt_two_le.not_gt <| (lt_sqrt zero_le_one).2 (by norm_num)
exact iff_of_false not_isGood_one fun a ↦ a
abbrev solution_set_two : Set ℝ := { 3 / 2 }
theorem imo1959_p2c : IsGood x 2 ↔ x ∈ solution_set_two := by
rw [mem_singleton_iff]
exact
(isGood_iff_of_sqrt_two_lt <| (sqrt_lt' two_pos).2 (by norm_num)).trans <| by norm_num
end Imo1959P2
| true | Copyright (c) 2024 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib
/-!
# International Mathematical Olympiad 1959, Problem 2
For what real values of x is
√(x+√(2x-1)) + √(x-√(2x-1)) = A,
given:
(a) A = √2
(b) A = 1
(c) A = 2,
where only non-negative real numbers are admitted for square roots?
-/
open Set Real
namespace Imo1959P2
def IsGood (x A : ℝ) : Prop :=
sqrt (x + sqrt (2 * x - 1)) + sqrt (x - sqrt (2 * x - 1)) = A ∧ 0 ≤ 2 * x - 1 ∧
0 ≤ x + sqrt (2 * x - 1) ∧ 0 ≤ x - sqrt (2 * x - 1)
variable {x A : ℝ}
/-
We follow second solution from the
[Art of Problem Solving](https://artofproblemsolving.com/wiki/index.php/1959_IMO_Problems/Problem_2)
website.
Namely, we rewrite the equation as $\sqrt{2x-1}+1+|\sqrt{2x-1}-1|=A\sqrt{2}$,
then consider the cases $\sqrt{2x-1}\le 1$ and $1 < \sqrt{2x-1}$ separately.
-/
theorem isGood_iff : IsGood x A ↔
sqrt (2 * x - 1) + 1 + |sqrt (2 * x - 1) - 1| = A * sqrt 2 ∧ 1 / 2 ≤ x := by
cases le_or_gt (1 / 2) x with
| inl hx =>
have hx' : 0 ≤ 2 * x - 1 := by linarith
have h₁ : x + sqrt (2 * x - 1) = (sqrt (2 * x - 1) + 1) ^ 2 / 2 := by
rw [add_sq, sq_sqrt hx']; field_simp; ring
have h₂ : x - sqrt (2 * x - 1) = (sqrt (2 * x - 1) - 1) ^ 2 / 2 := by
rw [sub_sq, sq_sqrt hx']; field_simp; ring
simp only [IsGood, *, div_nonneg (sq_nonneg _) (zero_le_two (α := ℝ)), sqrt_div (sq_nonneg _),
and_true]
rw [sqrt_sq, sqrt_sq_eq_abs] <;> [skip; positivity]
field_simp
| inr hx =>
have : 2 * x - 1 < 0 := by linarith
simp only [IsGood, this.not_ge, hx.not_ge]; simp
theorem IsGood.one_half_le (h : IsGood x A) : 1 / 2 ≤ x := (isGood_iff.1 h).2
theorem sqrt_two_mul_sub_one_le_one : sqrt (2 * x - 1) ≤ 1 ↔ x ≤ 1 := by
simp [sqrt_le_iff, ← two_mul]
theorem isGood_iff_eq_sqrt_two (hx : x ∈ Icc (1 / 2) 1) : IsGood x A ↔ A = sqrt 2 := by
have : sqrt (2 * x - 1) ≤ 1 := sqrt_two_mul_sub_one_le_one.2 hx.2
simp only [isGood_iff, hx.1, abs_sub_comm _ (1 : ℝ), abs_of_nonneg (sub_nonneg.2 this), and_true]
suffices 2 = A * sqrt 2 ↔ A = sqrt 2 by convert this using 2; ring
rw [← div_eq_iff, div_sqrt, eq_comm]
positivity
theorem isGood_iff_eq_sqrt (hx : 1 < x) : IsGood x A ↔ A = sqrt (4 * x - 2) := by
have h₁ : 1 < sqrt (2 * x - 1) := by simpa only [← not_le, sqrt_two_mul_sub_one_le_one] using hx
have h₂ : 1 / 2 ≤ x := by linarith
simp only [isGood_iff, h₂, abs_of_pos (sub_pos.2 h₁), add_add_sub_cancel, and_true]
rw [← mul_two, ← div_eq_iff (by positivity), mul_div_assoc, div_sqrt, ← sqrt_mul' _ zero_le_two,
eq_comm]
ring_nf
theorem IsGood.sqrt_two_lt_of_one_lt (h : IsGood x A) (hx : 1 < x) : sqrt 2 < A := by
rw [(isGood_iff_eq_sqrt hx).1 h]
refine sqrt_lt_sqrt zero_le_two ?_
linarith
theorem IsGood.eq_sqrt_two_iff_le_one (h : IsGood x A) : A = sqrt 2 ↔ x ≤ 1 :=
⟨fun hA ↦ not_lt.1 fun hx ↦ (h.sqrt_two_lt_of_one_lt hx).ne' hA, fun hx ↦
(isGood_iff_eq_sqrt_two ⟨h.one_half_le, hx⟩).1 h⟩
theorem IsGood.sqrt_two_lt_iff_one_lt (h : IsGood x A) : sqrt 2 < A ↔ 1 < x :=
⟨fun hA ↦ not_le.1 fun hx ↦ hA.ne' <| h.eq_sqrt_two_iff_le_one.2 hx, h.sqrt_two_lt_of_one_lt⟩
theorem IsGood.sqrt_two_le (h : IsGood x A) : sqrt 2 ≤ A :=
(le_or_gt x 1).elim (fun hx ↦ (h.eq_sqrt_two_iff_le_one.2 hx).ge) fun hx ↦
(h.sqrt_two_lt_of_one_lt hx).le
theorem isGood_iff_of_sqrt_two_lt (hA : sqrt 2 < A) : IsGood x A ↔ x = (A / 2) ^ 2 + 1 / 2 := by
have : 0 < A := lt_trans (by simp) hA
constructor
· intro h
have hx : 1 < x := by rwa [h.sqrt_two_lt_iff_one_lt] at hA
rw [isGood_iff_eq_sqrt hx, eq_comm, sqrt_eq_iff_eq_sq] at h <;> linarith
· rintro rfl
rw [isGood_iff_eq_sqrt]
· conv_lhs => rw [← sqrt_sq this.le]
ring_nf
· rw [sqrt_lt' this] at hA
linarith
abbrev solution_set_sqrt2 : Set ℝ := Icc (1 / 2) 1
theorem imo1959_p2a : IsGood x (sqrt 2) ↔ x ∈ solution_set_sqrt2 := by
refine ⟨fun h ↦ ?_, fun h ↦ (isGood_iff_eq_sqrt_two h).2 rfl⟩
exact ⟨h.one_half_le, not_lt.1 fun h₁ ↦ (h.sqrt_two_lt_of_one_lt h₁).false⟩
abbrev solution_set_one : Set ℝ := ∅
theorem imo1959_p2b : IsGood x 1 ↔ x ∈ solution_set_one := by
have not_isGood_one : ¬IsGood x 1 := fun h ↦
h.sqrt_two_le.not_gt <| (lt_sqrt zero_le_one).2 (by norm_num)
exact iff_of_false not_isGood_one fun a ↦ a
abbrev solution_set_two : Set ℝ := { 3 / 2 }
theorem imo1959_p2c : IsGood x 2 ↔ x ∈ solution_set_two := by
rw [mem_singleton_iff]
exact
(isGood_iff_of_sqrt_two_lt <| (sqrt_lt' two_pos).2 (by norm_num)).trans <| by norm_num
end Imo1959P2 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1959P2.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown identifier 'sqrt'", "unknown identifier 'sqrt'", "unknown identifier 'sqrt'", "unknown identifier 'sqrt'", "function expected at\n sqrt\nterm has type\n ?m.449", "function expected at\n sqrt\nterm has type\n ?m.449", "function expected at\n sqrt\nterm has type\n ?m.449", "function expected at\n sqrt\nterm has type\n x\u271d", "function expected at\n sqrt\nterm has type\n x\u271d", "unknown identifier 'sq_sqrt'", "function expected at\n sqrt\nterm has type\n x\u271d", "function expected at\n sqrt\nterm has type\n x\u271d", "unknown identifier 'sq_sqrt'", "unknown identifier 'sqrt_div'", "unknown identifier 'sqrt_sq'", "don't know how to synthesize placeholder\ncontext:\nx A : \u211d\nh : IsGood x A\n\u22a2 ?m.27224 one_half_le h", "don't know how to synthesize placeholder\ncontext:\nx A : \u211d\nh : IsGood x A\n\u22a2 Sort ?u.27207", "function expected at\n sqrt\nterm has type\n ?m.27237", "unknown identifier 'sqrt_le_iff'", "unsolved goals\nx : \u211d\nx\u271d : Sort u_1\nsqrt : x\u271d\n\u22a2 sorry () \u2264 1 \u2194 x \u2264 1", "function expected at\n Icc\nterm has type\n ?m.31210", "function expected at\n sqrt\nterm has type\n ?m.31497", "function expected at\n sqrt\nterm has type\n x\u271d", "unsolved goals\nx A : \u211d\nx\u271d\u00b9 : Sort u_1\nIcc : x\u271d\u00b9\nx\u271d : Sort u_2\nsqrt : x\u271d\nhx : x \u2208 sorry\n\u22a2 IsGood x A \u2194 A = sorry", "function expected at\n sqrt\nterm has type\n ?m.33921", "function expected at\n sqrt\nterm has type\n x\u271d", "failed to synthesize\n AddGroup \u2115\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n AddGroup \u2115\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "simp made no progress", "function expected at\n sqrt\nterm has type\n ?m.38109", "unsolved goals\nx A : \u211d\nx\u271d : Sort u_1\nsqrt : x\u271d\nh : IsGood x A\nhx : 1 < x\n\u22a2 sorry < A", "function expected at\n sqrt\nterm has type\n ?m.38605", "unknown identifier 'isGood_iff_eq_sqrt_two'", "function expected at\n sqrt\nterm has type\n ?m.39281", "function expected at\n sqrt\nterm has type\n ?m.39960", "function expected at\n sqrt\nterm has type\n ?m.40540", "unsolved goals\nx A : \u211d\nx\u271d : Sort u_1\nsqrt : x\u271d\nhA : sorry < A\n\u22a2 0 < sorry ()", "unsolved goals\nx A : \u211d\nx\u271d : Sort u_1\nsqrt : x\u271d\nhA : sorry < A\nthis : 0 < A\nh : IsGood x A\n\u22a2 Sort ?u.44022\n\nx A : \u211d\nx\u271d : Sort u_1\nsqrt : x\u271d\nhA : sorry < A\nthis : 0 < A\nh : IsGood x A\n\u22a2 ?m.44030", "unknown identifier 'sqrt_eq_iff_eq_sq'", "unknown identifier 'sqrt_sq'", "tactic 'rewrite' failed, equality or iff proof expected\n ?m.44184\nA : \u211d\nx\u271d : Sort u_1\nsqrt : x\u271d\nhA : sorry < A\nthis : 0 < A\n| A", "unknown identifier 'sqrt_lt''", "unsolved goals\nA : \u211d\nx\u271d : Sort u_1\nsqrt : x\u271d\nhA : sorry < A\nthis : 0 < A\n\u22a2 Sort ?u.44149\n\nA : \u211d\nx\u271d : Sort u_1\nsqrt : x\u271d\nhA : sorry < A\nthis : 0 < A\n\u22a2 ?m.44152", "unknown identifier 'Icc'", "function expected at\n sqrt\nterm has type\n ?m.44210", "unknown identifier 'isGood_iff_eq_sqrt_two'", "unknown identifier 'lt_sqrt'", "unsolved goals\nx : \u211d\n\u22a2 IsGood x 1 \u2194 x \u2208 solution_set_one", "unknown identifier 'mem_singleton_iff'", "unsolved goals\nx : \u211d\n\u22a2 IsGood x 2 \u2194 x \u2208 solution_set_two"], "timeout_s": 600.0, "latency_s": 0.8435, "verified_at": "2026-03-26T18:15:58.393786+00:00"}} | false | true | false | 0.8435 |
compfiles_Imo1960P1 | compfiles | Copyright (c) 2020 Kevin Lacker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Lacker
-/
import Mathlib
/-!
# International Mathematical Olympiad 1960, Problem 1
Determine all three-digit numbers N having the property that N is divisible by 11, and
N/11 is equal to the sum of the squares of the digits of N.
-/
open Nat
namespace Imo1960P1
def sumOfSquares (L : List ℕ) : ℕ :=
(L.map fun x => x * x).sum
def ProblemPredicate (n : ℕ) : Prop :=
(Nat.digits 10 n).length = 3 ∧ 11 ∣ n ∧ n / 11 = sumOfSquares (Nat.digits 10 n)
abbrev SolutionPredicate (n : ℕ) : Prop :=
n = 550 ∨ n = 803
/-
Proving that three digit numbers are the ones in [100, 1000).
-/
theorem not_zero {n : ℕ} (h1 : ProblemPredicate n) : n ≠ 0 :=
have h2 : Nat.digits 10 n ≠ List.nil := List.ne_nil_of_length_eq_add_one h1.left
digits_ne_nil_iff_ne_zero.mp h2
theorem ge_100 {n : ℕ} (h1 : ProblemPredicate n) : 100 ≤ n := by
have h2 : 10 ^ 3 ≤ 10 * n := by
rw [← h1.left]
refine Nat.base_pow_length_digits_le 10 n ?_ (not_zero h1)
simp
linarith
theorem lt_1000 {n : ℕ} (h1 : ProblemPredicate n) : n < 1000 := by
have h2 : n < 10 ^ 3 := by
rw [← h1.left]
exact lt_base_pow_length_digits'
linarith
/-
We do an exhaustive search to show that all results are covered by `SolutionPredicate`.
-/
def SearchUpTo (c n : ℕ) : Prop :=
n = c * 11 ∧ ∀ m : ℕ, m < n → ProblemPredicate m → SolutionPredicate m
theorem searchUpTo_start : SearchUpTo 9 99 :=
⟨rfl, fun n h p => by linarith [ge_100 p]⟩
theorem searchUpTo_step {c n} (H : SearchUpTo c n) {c' n'} (ec : c + 1 = c') (en : n + 11 = n') {l}
(el : Nat.digits 10 n = l) (H' : c = sumOfSquares l → c = 50 ∨ c = 73) : SearchUpTo c' n' := by
subst ec; subst en; subst el
obtain ⟨rfl, H⟩ := H
refine ⟨by ring, fun m l p => ?_⟩
obtain ⟨h₁, ⟨m, rfl⟩, h₂⟩ := id p
by_cases h : 11 * m < c * 11; · exact H _ h p
omega
theorem searchUpTo_end {c} (H : SearchUpTo c 1001) {n : ℕ} (ppn : ProblemPredicate n) :
SolutionPredicate n :=
H.2 _ (by linarith [lt_1000 ppn]) ppn
theorem right_direction {n : ℕ} : ProblemPredicate n → SolutionPredicate n := by
have := searchUpTo_start
iterate 82
replace :=
searchUpTo_step this (by norm_num1; rfl) (by norm_num1; rfl) rfl
(by norm_num <;> decide)
exact searchUpTo_end this
/-
Now we just need to prove the equivalence, for the precise problem statement.
-/
theorem left_direction (n : ℕ) (spn : SolutionPredicate n) : ProblemPredicate n := by
rcases spn with (rfl | rfl) <;> exact ⟨by norm_num, by decide, by norm_num; rfl⟩
theorem imo1960_p1 (n : ℕ) : ProblemPredicate n ↔ SolutionPredicate n :=
⟨right_direction, left_direction n⟩
end Imo1960P1 | /- | /-
Copyright (c) 2020 Kevin Lacker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Lacker
-/
import Mathlib
/-!
# International Mathematical Olympiad 1960, Problem 1
Determine all three-digit numbers N having the property that N is divisible by 11, and
N/11 is equal to the sum of the squares of the digits of N.
-/
open Nat
namespace Imo1960P1
def sumOfSquares (L : List ℕ) : ℕ :=
(L.map fun x => x * x).sum
def ProblemPredicate (n : ℕ) : Prop :=
(Nat.digits 10 n).length = 3 ∧ 11 ∣ n ∧ n / 11 = sumOfSquares (Nat.digits 10 n)
abbrev SolutionPredicate (n : ℕ) : Prop :=
n = 550 ∨ n = 803
/-
Proving that three digit numbers are the ones in [100, 1000).
-/
theorem not_zero {n : ℕ} (h1 : ProblemPredicate n) : n ≠ 0 :=
have h2 : Nat.digits 10 n ≠ List.nil := List.ne_nil_of_length_eq_add_one h1.left
digits_ne_nil_iff_ne_zero.mp h2
theorem ge_100 {n : ℕ} (h1 : ProblemPredicate n) : 100 ≤ n := by
have h2 : 10 ^ 3 ≤ 10 * n := by
rw [← h1.left]
refine Nat.base_pow_length_digits_le 10 n ?_ (not_zero h1)
simp
linarith
theorem lt_1000 {n : ℕ} (h1 : ProblemPredicate n) : n < 1000 := by
have h2 : n < 10 ^ 3 := by
rw [← h1.left]
exact lt_base_pow_length_digits'
linarith
/-
We do an exhaustive search to show that all results are covered by `SolutionPredicate`.
-/
def SearchUpTo (c n : ℕ) : Prop :=
n = c * 11 ∧ ∀ m : ℕ, m < n → ProblemPredicate m → SolutionPredicate m
theorem searchUpTo_start : SearchUpTo 9 99 :=
⟨rfl, fun n h p => by linarith [ge_100 p]⟩
theorem searchUpTo_step {c n} (H : SearchUpTo c n) {c' n'} (ec : c + 1 = c') (en : n + 11 = n') {l}
(el : Nat.digits 10 n = l) (H' : c = sumOfSquares l → c = 50 ∨ c = 73) : SearchUpTo c' n' := by
subst ec; subst en; subst el
obtain ⟨rfl, H⟩ := H
refine ⟨by ring, fun m l p => ?_⟩
obtain ⟨h₁, ⟨m, rfl⟩, h₂⟩ := id p
by_cases h : 11 * m < c * 11; · exact H _ h p
omega
theorem searchUpTo_end {c} (H : SearchUpTo c 1001) {n : ℕ} (ppn : ProblemPredicate n) :
SolutionPredicate n :=
H.2 _ (by linarith [lt_1000 ppn]) ppn
theorem right_direction {n : ℕ} : ProblemPredicate n → SolutionPredicate n := by
have := searchUpTo_start
iterate 82
replace :=
searchUpTo_step this (by norm_num1; rfl) (by norm_num1; rfl) rfl
(by norm_num <;> decide)
exact searchUpTo_end this
/-
Now we just need to prove the equivalence, for the precise problem statement.
-/
theorem left_direction (n : ℕ) (spn : SolutionPredicate n) : ProblemPredicate n := by
rcases spn with (rfl | rfl) <;> exact ⟨by norm_num, by decide, by norm_num; rfl⟩
theorem imo1960_p1 (n : ℕ) : ProblemPredicate n ↔ SolutionPredicate n :=
⟨right_direction, left_direction n⟩
end Imo1960P1
| true | Copyright (c) 2020 Kevin Lacker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Lacker
-/
import Mathlib
/-!
# International Mathematical Olympiad 1960, Problem 1
Determine all three-digit numbers N having the property that N is divisible by 11, and
N/11 is equal to the sum of the squares of the digits of N.
-/
open Nat
namespace Imo1960P1
def sumOfSquares (L : List ℕ) : ℕ :=
(L.map fun x => x * x).sum
def ProblemPredicate (n : ℕ) : Prop :=
(Nat.digits 10 n).length = 3 ∧ 11 ∣ n ∧ n / 11 = sumOfSquares (Nat.digits 10 n)
abbrev SolutionPredicate (n : ℕ) : Prop :=
n = 550 ∨ n = 803
/-
Proving that three digit numbers are the ones in [100, 1000).
-/
theorem not_zero {n : ℕ} (h1 : ProblemPredicate n) : n ≠ 0 :=
have h2 : Nat.digits 10 n ≠ List.nil := List.ne_nil_of_length_eq_add_one h1.left
digits_ne_nil_iff_ne_zero.mp h2
theorem ge_100 {n : ℕ} (h1 : ProblemPredicate n) : 100 ≤ n := by
have h2 : 10 ^ 3 ≤ 10 * n := by
rw [← h1.left]
refine Nat.base_pow_length_digits_le 10 n ?_ (not_zero h1)
simp
linarith
theorem lt_1000 {n : ℕ} (h1 : ProblemPredicate n) : n < 1000 := by
have h2 : n < 10 ^ 3 := by
rw [← h1.left]
exact lt_base_pow_length_digits'
linarith
/-
We do an exhaustive search to show that all results are covered by `SolutionPredicate`.
-/
def SearchUpTo (c n : ℕ) : Prop :=
n = c * 11 ∧ ∀ m : ℕ, m < n → ProblemPredicate m → SolutionPredicate m
theorem searchUpTo_start : SearchUpTo 9 99 :=
⟨rfl, fun n h p => by linarith [ge_100 p]⟩
theorem searchUpTo_step {c n} (H : SearchUpTo c n) {c' n'} (ec : c + 1 = c') (en : n + 11 = n') {l}
(el : Nat.digits 10 n = l) (H' : c = sumOfSquares l → c = 50 ∨ c = 73) : SearchUpTo c' n' := by
subst ec; subst en; subst el
obtain ⟨rfl, H⟩ := H
refine ⟨by ring, fun m l p => ?_⟩
obtain ⟨h₁, ⟨m, rfl⟩, h₂⟩ := id p
by_cases h : 11 * m < c * 11; · exact H _ h p
omega
theorem searchUpTo_end {c} (H : SearchUpTo c 1001) {n : ℕ} (ppn : ProblemPredicate n) :
SolutionPredicate n :=
H.2 _ (by linarith [lt_1000 ppn]) ppn
theorem right_direction {n : ℕ} : ProblemPredicate n → SolutionPredicate n := by
have := searchUpTo_start
iterate 82
replace :=
searchUpTo_step this (by norm_num1; rfl) (by norm_num1; rfl) rfl
(by norm_num <;> decide)
exact searchUpTo_end this
/-
Now we just need to prove the equivalence, for the precise problem statement.
-/
theorem left_direction (n : ℕ) (spn : SolutionPredicate n) : ProblemPredicate n := by
rcases spn with (rfl | rfl) <;> exact ⟨by norm_num, by decide, by norm_num; rfl⟩
theorem imo1960_p1 (n : ℕ) : ProblemPredicate n ↔ SolutionPredicate n :=
⟨right_direction, left_direction n⟩
end Imo1960P1 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1960P1.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown identifier 'digits_ne_nil_iff_ne_zero.mp'", "unknown identifier 'lt_base_pow_length_digits''", "unknown tactic", "unsolved goals\ncase neg\nc : \u2115\nH' : c = sumOfSquares (Nat.digits 10 (c * 11)) \u2192 c = 50 \u2228 c = 73\nH : \u2200 m < c * 11, ProblemPredicate m \u2192 SolutionPredicate m\nm : \u2115\nl : 11 * m < c * 11 + 11\np : ProblemPredicate (11 * m)\nh\u2081 : (Nat.digits 10 (11 * m)).length = 3\nh\u2082 : 11 * m / 11 = sumOfSquares (Nat.digits 10 (11 * m))\nh : \u00ac11 * m < c * 11\n\u22a2 SolutionPredicate (11 * m)"], "timeout_s": 600.0, "latency_s": 4.1061, "verified_at": "2026-03-26T18:16:02.469585+00:00"}} | false | true | false | 4.1061 |
compfiles_Imo1960P2 | compfiles | Copyright (c) 2024 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib
/-!
# International Mathematical Olympiad 1960, Problem 2
For what values of the variable $x$ does the following inequality hold:
\[\dfrac{4x^2}{(1 - \sqrt {2x + 1})^2} < 2x + 9 \ ?\]
-/
open Real Set
namespace Imo1960Q2
/-- The predicate says that `x` satisfies the inequality
\[\dfrac{4x^2}{(1 - \sqrt {2x + 1})^2} < 2x + 9\]
and belongs to the domain of the function on the left-hand side.
-/
@[mk_iff isGood_iff']
structure IsGood (x : ℝ) : Prop where
/-- The number satisfies the inequality. -/
ineq : 4 * x ^ 2 / (1 - sqrt (2 * x + 1)) ^ 2 < 2 * x + 9
/-- The number belongs to the domain of \(\sqrt {2x + 1}\). -/
sqrt_dom : 0 ≤ 2 * x + 1
/-- The number belongs to the domain of the denominator. -/
denom_dom : (1 - sqrt (2 * x + 1)) ^ 2 ≠ 0
abbrev SolutionSet : Set ℝ := Ico (-1/2) (45/8) \ {0}
theorem imo1960_p2 {x} : IsGood x ↔ x ∈ SolutionSet := by
-- We follow the solution at
-- https://artofproblemsolving.com/wiki/index.php/1960_IMO_Problems/Problem_2
-- with minor modifications.
-- First, note that the denominator is equal to zero at `x = 0`, hence it's not a solution.
rcases eq_or_ne x 0 with rfl | hx
· simp [isGood_iff']
cases lt_or_ge x (-1/2) with
| inl hx2 =>
-- Next, if `x < -1/2`, then the square root is undefined.
have : 2 * x + 1 < 0 := by linarith
simp [hx2.not_ge, isGood_iff', this.not_ge]
| inr hx2 =>
-- Now, if `x ≥ -1/2`, `x ≠ 0`, then the expression is well-defined.
have hx2' : 0 ≤ 2 * x + 1 := by linarith
have H : 1 - sqrt (2 * x + 1) ≠ 0 := by
rw [sub_ne_zero, ne_comm, ne_eq, sqrt_eq_iff_eq_sq hx2' zero_le_one]
simpa
calc
-- Note that the fraction in the LHS is equal to `(1 + sqrt (2 * x + 1)) ^ 2`
IsGood x ↔ (1 + sqrt (2 * x + 1)) ^ 2 < 2 * x + 9 := by
have : 4 * x ^ 2 = (1 + sqrt (2 * x + 1)) ^ 2 * (1 - sqrt (2 * x + 1)) ^ 2 := by
rw [← mul_pow, ← sq_sub_sq, sq_sqrt hx2']
ring
simp [isGood_iff', *]
-- Simplify the inequality
_ ↔ sqrt (2 * x + 1) < 7 / 2 := by
rw [add_sq, sq_sqrt hx2']; constructor <;> intro <;> linarith
_ ↔ 2 * x + 1 < (7 / 2) ^ 2 := sqrt_lt' <| by positivity
_ ↔ x < 45 / 8 := by constructor <;> intro <;> linarith
_ ↔ x ∈ Ico (-1/2) (45/8) \ {0} := by simp [*]
end Imo1960Q2 | /- | /-
Copyright (c) 2024 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib
/-!
# International Mathematical Olympiad 1960, Problem 2
For what values of the variable $x$ does the following inequality hold:
\[\dfrac{4x^2}{(1 - \sqrt {2x + 1})^2} < 2x + 9 \ ?\]
-/
open Real Set
namespace Imo1960Q2
/-- The predicate says that `x` satisfies the inequality
\[\dfrac{4x^2}{(1 - \sqrt {2x + 1})^2} < 2x + 9\]
and belongs to the domain of the function on the left-hand side.
-/
@[mk_iff isGood_iff']
structure IsGood (x : ℝ) : Prop where
/-- The number satisfies the inequality. -/
ineq : 4 * x ^ 2 / (1 - sqrt (2 * x + 1)) ^ 2 < 2 * x + 9
/-- The number belongs to the domain of \(\sqrt {2x + 1}\). -/
sqrt_dom : 0 ≤ 2 * x + 1
/-- The number belongs to the domain of the denominator. -/
denom_dom : (1 - sqrt (2 * x + 1)) ^ 2 ≠ 0
abbrev SolutionSet : Set ℝ := Ico (-1/2) (45/8) \ {0}
theorem imo1960_p2 {x} : IsGood x ↔ x ∈ SolutionSet := by
-- We follow the solution at
-- https://artofproblemsolving.com/wiki/index.php/1960_IMO_Problems/Problem_2
-- with minor modifications.
-- First, note that the denominator is equal to zero at `x = 0`, hence it's not a solution.
rcases eq_or_ne x 0 with rfl | hx
· simp [isGood_iff']
cases lt_or_ge x (-1/2) with
| inl hx2 =>
-- Next, if `x < -1/2`, then the square root is undefined.
have : 2 * x + 1 < 0 := by linarith
simp [hx2.not_ge, isGood_iff', this.not_ge]
| inr hx2 =>
-- Now, if `x ≥ -1/2`, `x ≠ 0`, then the expression is well-defined.
have hx2' : 0 ≤ 2 * x + 1 := by linarith
have H : 1 - sqrt (2 * x + 1) ≠ 0 := by
rw [sub_ne_zero, ne_comm, ne_eq, sqrt_eq_iff_eq_sq hx2' zero_le_one]
simpa
calc
-- Note that the fraction in the LHS is equal to `(1 + sqrt (2 * x + 1)) ^ 2`
IsGood x ↔ (1 + sqrt (2 * x + 1)) ^ 2 < 2 * x + 9 := by
have : 4 * x ^ 2 = (1 + sqrt (2 * x + 1)) ^ 2 * (1 - sqrt (2 * x + 1)) ^ 2 := by
rw [← mul_pow, ← sq_sub_sq, sq_sqrt hx2']
ring
simp [isGood_iff', *]
-- Simplify the inequality
_ ↔ sqrt (2 * x + 1) < 7 / 2 := by
rw [add_sq, sq_sqrt hx2']; constructor <;> intro <;> linarith
_ ↔ 2 * x + 1 < (7 / 2) ^ 2 := sqrt_lt' <| by positivity
_ ↔ x < 45 / 8 := by constructor <;> intro <;> linarith
_ ↔ x ∈ Ico (-1/2) (45/8) \ {0} := by simp [*]
end Imo1960Q2
| true | Copyright (c) 2024 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib
/-!
# International Mathematical Olympiad 1960, Problem 2
For what values of the variable $x$ does the following inequality hold:
\[\dfrac{4x^2}{(1 - \sqrt {2x + 1})^2} < 2x + 9 \ ?\]
-/
open Real Set
namespace Imo1960Q2
/-- The predicate says that `x` satisfies the inequality
\[\dfrac{4x^2}{(1 - \sqrt {2x + 1})^2} < 2x + 9\]
and belongs to the domain of the function on the left-hand side.
-/
@[mk_iff isGood_iff']
structure IsGood (x : ℝ) : Prop where
/-- The number satisfies the inequality. -/
ineq : 4 * x ^ 2 / (1 - sqrt (2 * x + 1)) ^ 2 < 2 * x + 9
/-- The number belongs to the domain of \(\sqrt {2x + 1}\). -/
sqrt_dom : 0 ≤ 2 * x + 1
/-- The number belongs to the domain of the denominator. -/
denom_dom : (1 - sqrt (2 * x + 1)) ^ 2 ≠ 0
abbrev SolutionSet : Set ℝ := Ico (-1/2) (45/8) \ {0}
theorem imo1960_p2 {x} : IsGood x ↔ x ∈ SolutionSet := by
-- We follow the solution at
-- https://artofproblemsolving.com/wiki/index.php/1960_IMO_Problems/Problem_2
-- with minor modifications.
-- First, note that the denominator is equal to zero at `x = 0`, hence it's not a solution.
rcases eq_or_ne x 0 with rfl | hx
· simp [isGood_iff']
cases lt_or_ge x (-1/2) with
| inl hx2 =>
-- Next, if `x < -1/2`, then the square root is undefined.
have : 2 * x + 1 < 0 := by linarith
simp [hx2.not_ge, isGood_iff', this.not_ge]
| inr hx2 =>
-- Now, if `x ≥ -1/2`, `x ≠ 0`, then the expression is well-defined.
have hx2' : 0 ≤ 2 * x + 1 := by linarith
have H : 1 - sqrt (2 * x + 1) ≠ 0 := by
rw [sub_ne_zero, ne_comm, ne_eq, sqrt_eq_iff_eq_sq hx2' zero_le_one]
simpa
calc
-- Note that the fraction in the LHS is equal to `(1 + sqrt (2 * x + 1)) ^ 2`
IsGood x ↔ (1 + sqrt (2 * x + 1)) ^ 2 < 2 * x + 9 := by
have : 4 * x ^ 2 = (1 + sqrt (2 * x + 1)) ^ 2 * (1 - sqrt (2 * x + 1)) ^ 2 := by
rw [← mul_pow, ← sq_sub_sq, sq_sqrt hx2']
ring
simp [isGood_iff', *]
-- Simplify the inequality
_ ↔ sqrt (2 * x + 1) < 7 / 2 := by
rw [add_sq, sq_sqrt hx2']; constructor <;> intro <;> linarith
_ ↔ 2 * x + 1 < (7 / 2) ^ 2 := sqrt_lt' <| by positivity
_ ↔ x < 45 / 8 := by constructor <;> intro <;> linarith
_ ↔ x ∈ Ico (-1/2) (45/8) \ {0} := by simp [*]
end Imo1960Q2 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1960P2.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["function expected at\n sqrt\nterm has type\n ?m.67", "function expected at\n sqrt\nterm has type\n ?m.2102", "unknown identifier 'Ico'", "unsolved goals\ncase inl\n\u22a2 (\u2203 x, Nonempty x) \u2227 1 - sorry () = 0", "unsolved goals\ncase inr.inl\nx : \u211d\nhx : x \u2260 0\nhx2 : x < -1 / 2\nthis : 2 * x + 1 < 0\n\u22a2 x \u2208 sorry () \u2192 x = 0", "unknown identifier 'sqrt'", "tactic 'rewrite' failed, did not find instance of the pattern in the target expression\n ?m.28914 - ?m.28915 \u2260 0\nx : \u211d\nhx : x \u2260 0\nhx2 : -1 / 2 \u2264 x\nhx2' : 0 \u2264 2 * x + 1\n\u22a2 1 - sorry \u2260 0", "unknown identifier 'sqrt'", "unknown identifier 'sqrt'", "unknown identifier 'sqrt_lt''", "unknown identifier 'Ico'", "unknown identifier 'sqrt'", "unknown identifier 'sqrt'", "unknown identifier 'sq_sqrt'", "unsolved goals\nx : \u211d\nhx : x \u2260 0\nhx2 : -1 / 2 \u2264 x\nhx2' : 0 \u2264 2 * x + 1\nH : 1 - sorry \u2260 0\nthis : 4 * x ^ 2 = (1 + sorry) ^ 2 * (1 - sorry) ^ 2\n\u22a2 (\u2200 {x_1 : Sort u_1} {sqrt : x_1}, (1 + sorry ()) ^ 2 * (1 - sorry ()) ^ 2 / (1 - sorry ()) ^ 2 < 2 * x + 9) \u2194\n (1 + sorry ()) ^ 2 < 2 * x + 9", "unknown identifier 'sq_sqrt'", "unsolved goals\nx : \u211d\nhx : x \u2260 0\nhx2 : -1 / 2 \u2264 x\nhx2' : 0 \u2264 2 * x + 1\nH : 1 - sorry \u2260 0\n\u22a2 1 ^ 2 + 2 * 1 * sorry + sorry ^ 2 < 2 * x + 9 \u2194 sorry < 7 / 2", "unsolved goals\nx : \u211d\nhx : x \u2260 0\nhx2 : -1 / 2 \u2264 x\nhx2' : 0 \u2264 2 * x + 1\nH : 1 - sorry \u2260 0\n\u22a2 x < 45 / 8 \u2194 x \u2208 sorry () \\ {0}"], "timeout_s": 600.0, "latency_s": 1.6333, "verified_at": "2026-03-26T18:16:00.027331+00:00"}} | false | true | false | 1.6333 |
compfiles_Imo1961P1 | compfiles | Copyright (c) 2020 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw, Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1961, Problem 1.
Given constants a and b, solve the system of equations
x + y + z = a
x² + y² + z² = b²
xy = z²
for x,y,z. Give the conditions that a and b must satisfy so that
the solutions x,y,z are distinct positive numbers.
-/
namespace Imo1961P1
abbrev IsSolution (a b x y z : ℝ) : Prop :=
x + y + z = a ∧
x^2 + y^2 + z^2 = b^2 ∧
x * y = z^2
abbrev xyz_of_ab (a b : ℝ) : Set (ℝ × ℝ × ℝ) :=
{ p | let ⟨x,y,z⟩ := p
(a ≠ 0 ∧
z = (a^2 - b^2) / (2 * a) ∧
∀ m, (m - x) * (m - y) =
m^2 - (a^2 + b^2) / (2 * a) * m + ((a^2 - b^2) / (2 * a))^2) ∨ (a = 0 ∧ b = 0 ∧ x = 0 ∧ y = 0 ∧ z = 0) }
abbrev ab_that_make_xyz_positive_distinct : Set (ℝ × ℝ) :=
{ q | let ⟨a,b⟩ := q
0 < a ∧ b^2 < a^2 ∧ a^2 < 3 * b ^ 2 }
lemma aux_1
(x y z a b : ℝ)
(h₀ : 0 < x ∧ 0 < y ∧ 0 < z)
(h₁ : [x, y, z].Nodup)
(h₂ : x + y + z = a)
(h₃ : x^2 + y^2 + z^2 = b^2)
(h₄ : x * y = z^2) :
0 < a ∧ b^2 < a^2 ∧ a^2 < 3 * b^2 := by
have ha: 0 < a := by linarith
refine ⟨ha,?_⟩
have h₇: (x + y + z) * (x + y - z) = b ^ 2 := by
rw [← sq_sub_sq, ← h₄, add_sq]
linarith
have h₈: (x + y - z) = b ^ 2 / a := by
rw [h₂] at h₇
refine (eq_div_iff ?_).mpr ?_
· exact Ne.symm (ne_of_lt ha)
· rw [mul_comm] at h₇
exact h₇
have h₉: z = (a ^ 2 - b ^ 2) / (2 * a) := by
have g₀: x + y = (a + b ^ 2 / a) / 2 := by linarith
rw [g₀, add_div, div_div] at h₂
rw [sub_div, mul_comm 2 a, ← div_div, pow_two, mul_self_div_self]
linarith
have h₁₀: b ^ 2 < a ^ 2 := by
apply and_assoc.mpr at h₀
obtain ⟨-, hz⟩ := h₀
rw [h₉] at hz
apply div_pos_iff.mp at hz
refine lt_of_sub_pos ?_
obtain hzc | hzf := hz
· exact hzc.1
· exfalso
linarith
have h₁₁: y ^ 2 + (-(a ^ 2 + b ^ 2) / (2 * a)) * y + ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2 = 0 := by
have g₀: x + y = (a + b ^ 2 / a) / 2 := by linarith
rw [add_div, div_div] at g₀
have g₁: x = a / 2 + b ^ 2 / (a * 2) - y := by linarith
rw [g₁, h₉, sub_mul, add_mul, ← pow_two y] at h₄
rw [neg_add', sub_div, neg_div, pow_two a, mul_div_mul_right a 2 (by positivity), sub_mul, neg_mul]
rw [add_sub_assoc', ← sub_eq_add_neg, add_comm]
refine add_eq_of_eq_sub ?_
rw [zero_sub, ← pow_two a, ← h₄]
ring_nf
let aq : ℝ := 1
let bq : ℝ := (-(a ^ 2 + b ^ 2) / (2 * a))
let cq : ℝ := ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2
have haq : aq = 1 := by rfl
have hbq : bq = (-(a ^ 2 + b ^ 2) / (2 * a)) := by rfl
have hcq : cq = ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2 := by rfl
have h₁₂: aq * y ^ 2 + bq * y + cq = 0 := by
rw [one_mul]
exact h₁₁
rw [pow_two] at h₁₂
have h₁₃: (2 * aq * y + bq) ^ 2 = bq ^ 2 - 4 * aq * cq := by
rw [add_sq]
have g₀: (2 * aq * y) ^ 2 + 2 * (2 * aq * y) * bq = 4 * aq * (y ^ 2 + bq * y) := by
rw [haq, hbq]
ring_nf
have g₁: aq = 1 := by rfl
have g₂: y ^ 2 + bq * y = - cq := (neg_eq_of_add_eq_zero_left h₁₁).symm
rw [g₀, g₂]
linarith
let s : ℝ := ((3 * a ^ 2 - b ^ 2) * (3 * b ^ 2 - a ^ 2)) / (4 * a ^ 2)
have hs : s = ((3 * a ^ 2 - b ^ 2) * (3 * b ^ 2 - a ^ 2)) / (4 * a ^ 2) := by rfl
have h₁₄: discrim aq bq cq = s := by
have g₀: aq ≠ 0 := by exact Ne.symm (zero_ne_one' ℝ)
apply (quadratic_eq_zero_iff_discrim_eq_sq g₀ y).mp at h₁₂
rw [h₁₂, h₁₃]
rw [haq, hbq, hcq, hs]
ring_nf
rw [← one_mul (y ^ 2), pow_two] at h₁₁
apply (quadratic_eq_zero_iff_discrim_eq_sq one_ne_zero y).mp at h₁₁
constructor
· exact h₁₀
· by_contra! hc
have hc₀: (3 * b ^ 2 - a ^ 2) ≤ 0 := by linarith
have hc₁: 0 < (3 * a ^ 2 - b ^ 2) := by
refine sub_pos_of_lt ?_
refine lt_trans h₁₀ ?_
refine lt_mul_left ?_ (by norm_num1)
exact sq_pos_of_pos ha
have hc₂: (3 * a ^ 2 - b ^ 2) * (3 * b ^ 2 - a ^ 2) ≤ 0 := by
refine mul_nonpos_of_nonneg_of_nonpos ?_ hc₀
exact le_of_lt hc₁
have hc₃: s ≤ 0 := by
refine div_nonpos_iff.mpr ?_
right
constructor
· exact hc₂
· positivity
rw [← h₁₄] at hc₃
have h₁₅: aq ≠ 0 := by exact Ne.symm (zero_ne_one' ℝ)
by_cases hc₄: s < 0
· have hc₅: ∀ d:ℝ , discrim aq bq cq ≠ d ^ 2 := by
intro d
rw [h₁₄]
have hc₆: 0 ≤ d ^ 2 := by exact sq_nonneg d
linarith
exfalso
exact hc₅ ((2 : ℝ) * (1 : ℝ) * y + -(a ^ (2 : ℕ) + b ^ (2 : ℕ)) / ((2 : ℝ) * a)) h₁₁
· have hc₅: s = 0 := by linarith
grind
theorem imo1961_p1a (a b x y z : ℝ) :
⟨x,y,z⟩ ∈ xyz_of_ab a b ↔ IsSolution a b x y z := by
simp
constructor
· grind
· intro h₀
obtain ⟨h₀, h₁, h₂⟩ := h₀
have h₃: (x + y) ^ 2 - z ^ 2 = b ^ 2 := by
rw [add_sq, mul_assoc 2, h₂, ← h₁]
ring
by_cases ha₀: a = 0
· right
have hb₀ : b = 0 := by grind
rw [hb₀, zero_pow two_ne_zero, ← h₂, add_sq] at h₃
ring_nf at h₃
have h₄ : x ^ 3 = y ^ 3 := by grind
have h₅: x = y := by
refine (Odd.pow_inj ?_).mp h₄
exact Nat.odd_iff.mpr rfl
rw [← h₅] at h₃
have h₆ : x = 0 := by
ring_nf at h₃
refine (pow_eq_zero_iff two_ne_zero).mp ?_
refine eq_zero_of_ne_zero_of_mul_right_eq_zero ?_ h₃
exact three_ne_zero
bound
· left
refine ⟨ha₀, ?_⟩
have h₄: (x + y) ^ 2 - z ^ 2 = (x + y + z) * (x + y - z) := sq_sub_sq (x + y) z
have h₅: z = (a ^ 2 - b ^ 2) / (2 * a) := by grind
refine ⟨h₅, ?_⟩
intro m
rw [← h₅, ← h₂]
grind
theorem imo1961_p1b (a b x y z : ℝ) (h₀ : IsSolution a b x y z) :
⟨a,b⟩ ∈ ab_that_make_xyz_positive_distinct ↔
(0 < x ∧ 0 < y ∧ 0 < z ∧ [x,y,z].Nodup) := by
obtain ⟨h₀, h₁, h₂⟩ := h₀
constructor
· simp
intro h₃ h₄ h₅
rw [← h₀, ← h₁, add_sq, add_sq] at h₄ h₅
have h₆: 0 < x * y + (x + y) * z := by linarith
have h₇: x * y + (x + y) * z < (x ^ 2 + y ^ 2 + z ^ 2) := by linarith
rw [add_comm (x * y), h₂, pow_two, ← add_mul, h₀] at h₆
have hz₀: 0 < z := by exact (pos_iff_pos_of_mul_pos h₆).mp h₃
have h₈: 0 < x ∧ 0 < y := by
have hx₀: 0 < x * y := by rw [h₂]; exact sq_pos_of_pos hz₀
by_cases hx₁: 0 < x
· refine ⟨hx₁, ?_⟩
exact (pos_iff_pos_of_mul_pos hx₀).mp hx₁
· push_neg at hx₁
exfalso
have h₈₀: (x + y) ^ 2 - z ^ 2 = b ^ 2 := by
rw [add_sq, mul_assoc 2, h₂, ← h₁]
ring
have hy₀: y < 0 := by exact neg_of_mul_pos_right hx₀ hx₁
have h₈₁: z ^ 2 < (x + y) ^ 2 := by
refine lt_of_sub_pos ?_
rw [h₈₀, ← h₁]
positivity
have h₈₂: x + y + z < 0 := by
refine add_lt_of_lt_sub_left ?_
apply sq_lt_sq.mp at h₈₁
rw [zero_sub]
have hx₂ : x + y < 0 := by exact Right.add_neg_of_nonpos_of_neg hx₁ hy₀
rw [abs_of_pos hz₀, abs_of_neg hx₂] at h₈₁
exact h₈₁
order
refine ⟨h₈.1, h₈.2, ?_⟩
refine ⟨hz₀, ?_⟩
constructor
· constructor
· by_contra! hh₀
have hh₁: z = y := by
rw [hh₀, ← pow_two] at h₂
symm
refine (pow_left_inj₀ ?_ ?_ two_ne_zero).mp h₂
· exact le_of_lt h₈.2
· exact le_of_lt hz₀
rw [hh₀, hh₁] at h₇
linarith
· by_contra! hh₀
have hh₁: y = z := by
rw [hh₀, pow_two] at h₂
symm
apply mul_eq_mul_left_iff.mp at h₂
bound
rw [hh₀, hh₁] at h₇
linarith
· by_contra! hh₀
have hh₁: x = z := by
rw [hh₀, pow_two] at h₂
apply mul_eq_mul_right_iff.mp at h₂
bound
rw [hh₀, hh₁] at h₇
linarith
· intro h₃
simp
refine aux_1 x y z a b ?_ h₃.2.2.2 h₀ h₁ h₂
bound
end Imo1961P1 | /- | /-
Copyright (c) 2020 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw, Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1961, Problem 1.
Given constants a and b, solve the system of equations
x + y + z = a
x² + y² + z² = b²
xy = z²
for x,y,z. Give the conditions that a and b must satisfy so that
the solutions x,y,z are distinct positive numbers.
-/
namespace Imo1961P1
abbrev IsSolution (a b x y z : ℝ) : Prop :=
x + y + z = a ∧
x^2 + y^2 + z^2 = b^2 ∧
x * y = z^2
abbrev xyz_of_ab (a b : ℝ) : Set (ℝ × ℝ × ℝ) :=
{ p | let ⟨x,y,z⟩ := p
(a ≠ 0 ∧
z = (a^2 - b^2) / (2 * a) ∧
∀ m, (m - x) * (m - y) =
m^2 - (a^2 + b^2) / (2 * a) * m + ((a^2 - b^2) / (2 * a))^2) ∨ (a = 0 ∧ b = 0 ∧ x = 0 ∧ y = 0 ∧ z = 0) }
abbrev ab_that_make_xyz_positive_distinct : Set (ℝ × ℝ) :=
{ q | let ⟨a,b⟩ := q
0 < a ∧ b^2 < a^2 ∧ a^2 < 3 * b ^ 2 }
lemma aux_1
(x y z a b : ℝ)
(h₀ : 0 < x ∧ 0 < y ∧ 0 < z)
(h₁ : [x, y, z].Nodup)
(h₂ : x + y + z = a)
(h₃ : x^2 + y^2 + z^2 = b^2)
(h₄ : x * y = z^2) :
0 < a ∧ b^2 < a^2 ∧ a^2 < 3 * b^2 := by
have ha: 0 < a := by linarith
refine ⟨ha,?_⟩
have h₇: (x + y + z) * (x + y - z) = b ^ 2 := by
rw [← sq_sub_sq, ← h₄, add_sq]
linarith
have h₈: (x + y - z) = b ^ 2 / a := by
rw [h₂] at h₇
refine (eq_div_iff ?_).mpr ?_
· exact Ne.symm (ne_of_lt ha)
· rw [mul_comm] at h₇
exact h₇
have h₉: z = (a ^ 2 - b ^ 2) / (2 * a) := by
have g₀: x + y = (a + b ^ 2 / a) / 2 := by linarith
rw [g₀, add_div, div_div] at h₂
rw [sub_div, mul_comm 2 a, ← div_div, pow_two, mul_self_div_self]
linarith
have h₁₀: b ^ 2 < a ^ 2 := by
apply and_assoc.mpr at h₀
obtain ⟨-, hz⟩ := h₀
rw [h₉] at hz
apply div_pos_iff.mp at hz
refine lt_of_sub_pos ?_
obtain hzc | hzf := hz
· exact hzc.1
· exfalso
linarith
have h₁₁: y ^ 2 + (-(a ^ 2 + b ^ 2) / (2 * a)) * y + ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2 = 0 := by
have g₀: x + y = (a + b ^ 2 / a) / 2 := by linarith
rw [add_div, div_div] at g₀
have g₁: x = a / 2 + b ^ 2 / (a * 2) - y := by linarith
rw [g₁, h₉, sub_mul, add_mul, ← pow_two y] at h₄
rw [neg_add', sub_div, neg_div, pow_two a, mul_div_mul_right a 2 (by positivity), sub_mul, neg_mul]
rw [add_sub_assoc', ← sub_eq_add_neg, add_comm]
refine add_eq_of_eq_sub ?_
rw [zero_sub, ← pow_two a, ← h₄]
ring_nf
let aq : ℝ := 1
let bq : ℝ := (-(a ^ 2 + b ^ 2) / (2 * a))
let cq : ℝ := ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2
have haq : aq = 1 := by rfl
have hbq : bq = (-(a ^ 2 + b ^ 2) / (2 * a)) := by rfl
have hcq : cq = ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2 := by rfl
have h₁₂: aq * y ^ 2 + bq * y + cq = 0 := by
rw [one_mul]
exact h₁₁
rw [pow_two] at h₁₂
have h₁₃: (2 * aq * y + bq) ^ 2 = bq ^ 2 - 4 * aq * cq := by
rw [add_sq]
have g₀: (2 * aq * y) ^ 2 + 2 * (2 * aq * y) * bq = 4 * aq * (y ^ 2 + bq * y) := by
rw [haq, hbq]
ring_nf
have g₁: aq = 1 := by rfl
have g₂: y ^ 2 + bq * y = - cq := (neg_eq_of_add_eq_zero_left h₁₁).symm
rw [g₀, g₂]
linarith
let s : ℝ := ((3 * a ^ 2 - b ^ 2) * (3 * b ^ 2 - a ^ 2)) / (4 * a ^ 2)
have hs : s = ((3 * a ^ 2 - b ^ 2) * (3 * b ^ 2 - a ^ 2)) / (4 * a ^ 2) := by rfl
have h₁₄: discrim aq bq cq = s := by
have g₀: aq ≠ 0 := by exact Ne.symm (zero_ne_one' ℝ)
apply (quadratic_eq_zero_iff_discrim_eq_sq g₀ y).mp at h₁₂
rw [h₁₂, h₁₃]
rw [haq, hbq, hcq, hs]
ring_nf
rw [← one_mul (y ^ 2), pow_two] at h₁₁
apply (quadratic_eq_zero_iff_discrim_eq_sq one_ne_zero y).mp at h₁₁
constructor
· exact h₁₀
· by_contra! hc
have hc₀: (3 * b ^ 2 - a ^ 2) ≤ 0 := by linarith
have hc₁: 0 < (3 * a ^ 2 - b ^ 2) := by
refine sub_pos_of_lt ?_
refine lt_trans h₁₀ ?_
refine lt_mul_left ?_ (by norm_num1)
exact sq_pos_of_pos ha
have hc₂: (3 * a ^ 2 - b ^ 2) * (3 * b ^ 2 - a ^ 2) ≤ 0 := by
refine mul_nonpos_of_nonneg_of_nonpos ?_ hc₀
exact le_of_lt hc₁
have hc₃: s ≤ 0 := by
refine div_nonpos_iff.mpr ?_
right
constructor
· exact hc₂
· positivity
rw [← h₁₄] at hc₃
have h₁₅: aq ≠ 0 := by exact Ne.symm (zero_ne_one' ℝ)
by_cases hc₄: s < 0
· have hc₅: ∀ d:ℝ , discrim aq bq cq ≠ d ^ 2 := by
intro d
rw [h₁₄]
have hc₆: 0 ≤ d ^ 2 := by exact sq_nonneg d
linarith
exfalso
exact hc₅ ((2 : ℝ) * (1 : ℝ) * y + -(a ^ (2 : ℕ) + b ^ (2 : ℕ)) / ((2 : ℝ) * a)) h₁₁
· have hc₅: s = 0 := by linarith
grind
theorem imo1961_p1a (a b x y z : ℝ) :
⟨x,y,z⟩ ∈ xyz_of_ab a b ↔ IsSolution a b x y z := by
simp
constructor
· grind
· intro h₀
obtain ⟨h₀, h₁, h₂⟩ := h₀
have h₃: (x + y) ^ 2 - z ^ 2 = b ^ 2 := by
rw [add_sq, mul_assoc 2, h₂, ← h₁]
ring
by_cases ha₀: a = 0
· right
have hb₀ : b = 0 := by grind
rw [hb₀, zero_pow two_ne_zero, ← h₂, add_sq] at h₃
ring_nf at h₃
have h₄ : x ^ 3 = y ^ 3 := by grind
have h₅: x = y := by
refine (Odd.pow_inj ?_).mp h₄
exact Nat.odd_iff.mpr rfl
rw [← h₅] at h₃
have h₆ : x = 0 := by
ring_nf at h₃
refine (pow_eq_zero_iff two_ne_zero).mp ?_
refine eq_zero_of_ne_zero_of_mul_right_eq_zero ?_ h₃
exact three_ne_zero
bound
· left
refine ⟨ha₀, ?_⟩
have h₄: (x + y) ^ 2 - z ^ 2 = (x + y + z) * (x + y - z) := sq_sub_sq (x + y) z
have h₅: z = (a ^ 2 - b ^ 2) / (2 * a) := by grind
refine ⟨h₅, ?_⟩
intro m
rw [← h₅, ← h₂]
grind
theorem imo1961_p1b (a b x y z : ℝ) (h₀ : IsSolution a b x y z) :
⟨a,b⟩ ∈ ab_that_make_xyz_positive_distinct ↔
(0 < x ∧ 0 < y ∧ 0 < z ∧ [x,y,z].Nodup) := by
obtain ⟨h₀, h₁, h₂⟩ := h₀
constructor
· simp
intro h₃ h₄ h₅
rw [← h₀, ← h₁, add_sq, add_sq] at h₄ h₅
have h₆: 0 < x * y + (x + y) * z := by linarith
have h₇: x * y + (x + y) * z < (x ^ 2 + y ^ 2 + z ^ 2) := by linarith
rw [add_comm (x * y), h₂, pow_two, ← add_mul, h₀] at h₆
have hz₀: 0 < z := by exact (pos_iff_pos_of_mul_pos h₆).mp h₃
have h₈: 0 < x ∧ 0 < y := by
have hx₀: 0 < x * y := by rw [h₂]; exact sq_pos_of_pos hz₀
by_cases hx₁: 0 < x
· refine ⟨hx₁, ?_⟩
exact (pos_iff_pos_of_mul_pos hx₀).mp hx₁
· push_neg at hx₁
exfalso
have h₈₀: (x + y) ^ 2 - z ^ 2 = b ^ 2 := by
rw [add_sq, mul_assoc 2, h₂, ← h₁]
ring
have hy₀: y < 0 := by exact neg_of_mul_pos_right hx₀ hx₁
have h₈₁: z ^ 2 < (x + y) ^ 2 := by
refine lt_of_sub_pos ?_
rw [h₈₀, ← h₁]
positivity
have h₈₂: x + y + z < 0 := by
refine add_lt_of_lt_sub_left ?_
apply sq_lt_sq.mp at h₈₁
rw [zero_sub]
have hx₂ : x + y < 0 := by exact Right.add_neg_of_nonpos_of_neg hx₁ hy₀
rw [abs_of_pos hz₀, abs_of_neg hx₂] at h₈₁
exact h₈₁
order
refine ⟨h₈.1, h₈.2, ?_⟩
refine ⟨hz₀, ?_⟩
constructor
· constructor
· by_contra! hh₀
have hh₁: z = y := by
rw [hh₀, ← pow_two] at h₂
symm
refine (pow_left_inj₀ ?_ ?_ two_ne_zero).mp h₂
· exact le_of_lt h₈.2
· exact le_of_lt hz₀
rw [hh₀, hh₁] at h₇
linarith
· by_contra! hh₀
have hh₁: y = z := by
rw [hh₀, pow_two] at h₂
symm
apply mul_eq_mul_left_iff.mp at h₂
bound
rw [hh₀, hh₁] at h₇
linarith
· by_contra! hh₀
have hh₁: x = z := by
rw [hh₀, pow_two] at h₂
apply mul_eq_mul_right_iff.mp at h₂
bound
rw [hh₀, hh₁] at h₇
linarith
· intro h₃
simp
refine aux_1 x y z a b ?_ h₃.2.2.2 h₀ h₁ h₂
bound
end Imo1961P1
| true | Copyright (c) 2020 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw, Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1961, Problem 1.
Given constants a and b, solve the system of equations
x + y + z = a
x² + y² + z² = b²
xy = z²
for x,y,z. Give the conditions that a and b must satisfy so that
the solutions x,y,z are distinct positive numbers.
-/
namespace Imo1961P1
abbrev IsSolution (a b x y z : ℝ) : Prop :=
x + y + z = a ∧
x^2 + y^2 + z^2 = b^2 ∧
x * y = z^2
abbrev xyz_of_ab (a b : ℝ) : Set (ℝ × ℝ × ℝ) :=
{ p | let ⟨x,y,z⟩ := p
(a ≠ 0 ∧
z = (a^2 - b^2) / (2 * a) ∧
∀ m, (m - x) * (m - y) =
m^2 - (a^2 + b^2) / (2 * a) * m + ((a^2 - b^2) / (2 * a))^2) ∨ (a = 0 ∧ b = 0 ∧ x = 0 ∧ y = 0 ∧ z = 0) }
abbrev ab_that_make_xyz_positive_distinct : Set (ℝ × ℝ) :=
{ q | let ⟨a,b⟩ := q
0 < a ∧ b^2 < a^2 ∧ a^2 < 3 * b ^ 2 }
lemma aux_1
(x y z a b : ℝ)
(h₀ : 0 < x ∧ 0 < y ∧ 0 < z)
(h₁ : [x, y, z].Nodup)
(h₂ : x + y + z = a)
(h₃ : x^2 + y^2 + z^2 = b^2)
(h₄ : x * y = z^2) :
0 < a ∧ b^2 < a^2 ∧ a^2 < 3 * b^2 := by
have ha: 0 < a := by linarith
refine ⟨ha,?_⟩
have h₇: (x + y + z) * (x + y - z) = b ^ 2 := by
rw [← sq_sub_sq, ← h₄, add_sq]
linarith
have h₈: (x + y - z) = b ^ 2 / a := by
rw [h₂] at h₇
refine (eq_div_iff ?_).mpr ?_
· exact Ne.symm (ne_of_lt ha)
· rw [mul_comm] at h₇
exact h₇
have h₉: z = (a ^ 2 - b ^ 2) / (2 * a) := by
have g₀: x + y = (a + b ^ 2 / a) / 2 := by linarith
rw [g₀, add_div, div_div] at h₂
rw [sub_div, mul_comm 2 a, ← div_div, pow_two, mul_self_div_self]
linarith
have h₁₀: b ^ 2 < a ^ 2 := by
apply and_assoc.mpr at h₀
obtain ⟨-, hz⟩ := h₀
rw [h₉] at hz
apply div_pos_iff.mp at hz
refine lt_of_sub_pos ?_
obtain hzc | hzf := hz
· exact hzc.1
· exfalso
linarith
have h₁₁: y ^ 2 + (-(a ^ 2 + b ^ 2) / (2 * a)) * y + ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2 = 0 := by
have g₀: x + y = (a + b ^ 2 / a) / 2 := by linarith
rw [add_div, div_div] at g₀
have g₁: x = a / 2 + b ^ 2 / (a * 2) - y := by linarith
rw [g₁, h₉, sub_mul, add_mul, ← pow_two y] at h₄
rw [neg_add', sub_div, neg_div, pow_two a, mul_div_mul_right a 2 (by positivity), sub_mul, neg_mul]
rw [add_sub_assoc', ← sub_eq_add_neg, add_comm]
refine add_eq_of_eq_sub ?_
rw [zero_sub, ← pow_two a, ← h₄]
ring_nf
let aq : ℝ := 1
let bq : ℝ := (-(a ^ 2 + b ^ 2) / (2 * a))
let cq : ℝ := ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2
have haq : aq = 1 := by rfl
have hbq : bq = (-(a ^ 2 + b ^ 2) / (2 * a)) := by rfl
have hcq : cq = ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2 := by rfl
have h₁₂: aq * y ^ 2 + bq * y + cq = 0 := by
rw [one_mul]
exact h₁₁
rw [pow_two] at h₁₂
have h₁₃: (2 * aq * y + bq) ^ 2 = bq ^ 2 - 4 * aq * cq := by
rw [add_sq]
have g₀: (2 * aq * y) ^ 2 + 2 * (2 * aq * y) * bq = 4 * aq * (y ^ 2 + bq * y) := by
rw [haq, hbq]
ring_nf
have g₁: aq = 1 := by rfl
have g₂: y ^ 2 + bq * y = - cq := (neg_eq_of_add_eq_zero_left h₁₁).symm
rw [g₀, g₂]
linarith
let s : ℝ := ((3 * a ^ 2 - b ^ 2) * (3 * b ^ 2 - a ^ 2)) / (4 * a ^ 2)
have hs : s = ((3 * a ^ 2 - b ^ 2) * (3 * b ^ 2 - a ^ 2)) / (4 * a ^ 2) := by rfl
have h₁₄: discrim aq bq cq = s := by
have g₀: aq ≠ 0 := by exact Ne.symm (zero_ne_one' ℝ)
apply (quadratic_eq_zero_iff_discrim_eq_sq g₀ y).mp at h₁₂
rw [h₁₂, h₁₃]
rw [haq, hbq, hcq, hs]
ring_nf
rw [← one_mul (y ^ 2), pow_two] at h₁₁
apply (quadratic_eq_zero_iff_discrim_eq_sq one_ne_zero y).mp at h₁₁
constructor
· exact h₁₀
· by_contra! hc
have hc₀: (3 * b ^ 2 - a ^ 2) ≤ 0 := by linarith
have hc₁: 0 < (3 * a ^ 2 - b ^ 2) := by
refine sub_pos_of_lt ?_
refine lt_trans h₁₀ ?_
refine lt_mul_left ?_ (by norm_num1)
exact sq_pos_of_pos ha
have hc₂: (3 * a ^ 2 - b ^ 2) * (3 * b ^ 2 - a ^ 2) ≤ 0 := by
refine mul_nonpos_of_nonneg_of_nonpos ?_ hc₀
exact le_of_lt hc₁
have hc₃: s ≤ 0 := by
refine div_nonpos_iff.mpr ?_
right
constructor
· exact hc₂
· positivity
rw [← h₁₄] at hc₃
have h₁₅: aq ≠ 0 := by exact Ne.symm (zero_ne_one' ℝ)
by_cases hc₄: s < 0
· have hc₅: ∀ d:ℝ , discrim aq bq cq ≠ d ^ 2 := by
intro d
rw [h₁₄]
have hc₆: 0 ≤ d ^ 2 := by exact sq_nonneg d
linarith
exfalso
exact hc₅ ((2 : ℝ) * (1 : ℝ) * y + -(a ^ (2 : ℕ) + b ^ (2 : ℕ)) / ((2 : ℝ) * a)) h₁₁
· have hc₅: s = 0 := by linarith
grind
theorem imo1961_p1a (a b x y z : ℝ) :
⟨x,y,z⟩ ∈ xyz_of_ab a b ↔ IsSolution a b x y z := by
simp
constructor
· grind
· intro h₀
obtain ⟨h₀, h₁, h₂⟩ := h₀
have h₃: (x + y) ^ 2 - z ^ 2 = b ^ 2 := by
rw [add_sq, mul_assoc 2, h₂, ← h₁]
ring
by_cases ha₀: a = 0
· right
have hb₀ : b = 0 := by grind
rw [hb₀, zero_pow two_ne_zero, ← h₂, add_sq] at h₃
ring_nf at h₃
have h₄ : x ^ 3 = y ^ 3 := by grind
have h₅: x = y := by
refine (Odd.pow_inj ?_).mp h₄
exact Nat.odd_iff.mpr rfl
rw [← h₅] at h₃
have h₆ : x = 0 := by
ring_nf at h₃
refine (pow_eq_zero_iff two_ne_zero).mp ?_
refine eq_zero_of_ne_zero_of_mul_right_eq_zero ?_ h₃
exact three_ne_zero
bound
· left
refine ⟨ha₀, ?_⟩
have h₄: (x + y) ^ 2 - z ^ 2 = (x + y + z) * (x + y - z) := sq_sub_sq (x + y) z
have h₅: z = (a ^ 2 - b ^ 2) / (2 * a) := by grind
refine ⟨h₅, ?_⟩
intro m
rw [← h₅, ← h₂]
grind
theorem imo1961_p1b (a b x y z : ℝ) (h₀ : IsSolution a b x y z) :
⟨a,b⟩ ∈ ab_that_make_xyz_positive_distinct ↔
(0 < x ∧ 0 < y ∧ 0 < z ∧ [x,y,z].Nodup) := by
obtain ⟨h₀, h₁, h₂⟩ := h₀
constructor
· simp
intro h₃ h₄ h₅
rw [← h₀, ← h₁, add_sq, add_sq] at h₄ h₅
have h₆: 0 < x * y + (x + y) * z := by linarith
have h₇: x * y + (x + y) * z < (x ^ 2 + y ^ 2 + z ^ 2) := by linarith
rw [add_comm (x * y), h₂, pow_two, ← add_mul, h₀] at h₆
have hz₀: 0 < z := by exact (pos_iff_pos_of_mul_pos h₆).mp h₃
have h₈: 0 < x ∧ 0 < y := by
have hx₀: 0 < x * y := by rw [h₂]; exact sq_pos_of_pos hz₀
by_cases hx₁: 0 < x
· refine ⟨hx₁, ?_⟩
exact (pos_iff_pos_of_mul_pos hx₀).mp hx₁
· push_neg at hx₁
exfalso
have h₈₀: (x + y) ^ 2 - z ^ 2 = b ^ 2 := by
rw [add_sq, mul_assoc 2, h₂, ← h₁]
ring
have hy₀: y < 0 := by exact neg_of_mul_pos_right hx₀ hx₁
have h₈₁: z ^ 2 < (x + y) ^ 2 := by
refine lt_of_sub_pos ?_
rw [h₈₀, ← h₁]
positivity
have h₈₂: x + y + z < 0 := by
refine add_lt_of_lt_sub_left ?_
apply sq_lt_sq.mp at h₈₁
rw [zero_sub]
have hx₂ : x + y < 0 := by exact Right.add_neg_of_nonpos_of_neg hx₁ hy₀
rw [abs_of_pos hz₀, abs_of_neg hx₂] at h₈₁
exact h₈₁
order
refine ⟨h₈.1, h₈.2, ?_⟩
refine ⟨hz₀, ?_⟩
constructor
· constructor
· by_contra! hh₀
have hh₁: z = y := by
rw [hh₀, ← pow_two] at h₂
symm
refine (pow_left_inj₀ ?_ ?_ two_ne_zero).mp h₂
· exact le_of_lt h₈.2
· exact le_of_lt hz₀
rw [hh₀, hh₁] at h₇
linarith
· by_contra! hh₀
have hh₁: y = z := by
rw [hh₀, pow_two] at h₂
symm
apply mul_eq_mul_left_iff.mp at h₂
bound
rw [hh₀, hh₁] at h₇
linarith
· by_contra! hh₀
have hh₁: x = z := by
rw [hh₀, pow_two] at h₂
apply mul_eq_mul_right_iff.mp at h₂
bound
rw [hh₀, hh₁] at h₇
linarith
· intro h₃
simp
refine aux_1 x y z a b ?_ h₃.2.2.2 h₀ h₁ h₂
bound
end Imo1961P1 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1961P1.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["`grind` failed\ncase grind\nx y z a b : \u211d\nleft : 0 < x\nleft_1 : 0 < y\nright_1 : 0 < z\nh\u2081 : [x, y, z].Nodup\nh\u2082 : x + y + z = a\nh\u2083 : x ^ 2 + y ^ 2 + z ^ 2 = b ^ 2\nh\u2084 : x * y = z ^ 2\nha : 0 < a\nh\u2087 : (x + y + z) * (x + y - z) = b ^ 2\nh\u2088 : x + y - z = b ^ 2 / a\nh\u2089 : z = (a ^ 2 - b ^ 2) / (2 * a)\nh\u2081\u2080 : b ^ 2 < a ^ 2\nh\u2081\u2082 : 1 * (y * y) + -(a ^ 2 + b ^ 2) / (2 * a) * y + ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2 = 0\nh\u2081\u2083 :\n (2 * 1 * y + -(a ^ 2 + b ^ 2) / (2 * a)) ^ 2 =\n (-(a ^ 2 + b ^ 2) / (2 * a)) ^ 2 - 4 * 1 * ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2\nh\u2081\u2084 :\n discrim 1 (-(a ^ 2 + b ^ 2) / (2 * a)) (((a ^ 2 - b ^ 2) / (2 * a)) ^ 2) =\n (3 * a ^ 2 - b ^ 2) * (3 * b ^ 2 - a ^ 2) / (4 * a ^ 2)\nh\u2081\u2081 :\n discrim 1 (-(a ^ 2 + b ^ 2) / (2 * a)) (((a ^ 2 - b ^ 2) / (2 * a)) ^ 2) =\n (2 * 1 * y + -(a ^ 2 + b ^ 2) / (2 * a)) ^ 2\nhc : 3 * b ^ 2 \u2264 a ^ 2\nhc\u2080 : 3 * b ^ 2 - a ^ 2 \u2264 0\nhc\u2081 : 0 < 3 * a ^ 2 - b ^ 2\nhc\u2082 : (3 * a ^ 2 - b ^ 2) * (3 * b ^ 2 - a ^ 2) \u2264 0\nhc\u2083 : discrim 1 (-(a ^ 2 + b ^ 2) / (2 * a)) (((a ^ 2 - b ^ 2) / (2 * a)) ^ 2) \u2264 0\nh\u2081\u2085 : \u00ac1 = 0\nhc\u2084 : \u00ac(3 * a ^ 2 - b ^ 2) * (3 * b ^ 2 - a ^ 2) / (4 * a ^ 2) < 0\nhc\u2085 : (3 * a ^ 2 - b ^ 2) * (3 * b ^ 2 - a ^ 2) / (4 * a ^ 2) = 0\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] 0 < x\n [prop] 0 < y\n [prop] 0 < z\n [prop] [x, y, z].Nodup\n [prop] x + y + z = a\n [prop] x ^ 2 + y ^ 2 + z ^ 2 = b ^ 2\n [prop] x * y = z ^ 2\n [prop] 0 < a\n [prop] (x + y + z) * (x + y - z) = b ^ 2\n [prop] x + y - z = b ^ 2 / a\n [prop] z = (a ^ 2 - b ^ 2) / (2 * a)\n [prop] b ^ 2 < a ^ 2\n [prop] 1 * (y * y) + -(a ^ 2 + b ^ 2) / (2 * a) * y + ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2 = 0\n [prop] (2 * 1 * y + -(a ^ 2 + b ^ 2) / (2 * a)) ^ 2 =\n (-(a ^ 2 + b ^ 2) / (2 * a)) ^ 2 - 4 * 1 * ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2\n [prop] discrim 1 (-(a ^ 2 + b ^ 2) / (2 * a)) (((a ^ 2 - b ^ 2) / (2 * a)) ^ 2) =\n (3 * a ^ 2 - b ^ 2) * (3 * b ^ 2 - a ^ 2) / (4 * a ^ 2)\n [prop] discrim 1 (-(a ^ 2 + b ^ 2) / (2 * a)) (((a ^ 2 - b ^ 2) / (2 * a)) ^ 2) =\n (2 * 1 * y + -(a ^ 2 + b ^ 2) / (2 * a)) ^ 2\n [prop] 3 * b ^ 2 \u2264 a ^ 2\n [prop] 3 * b ^ 2 - a ^ 2 \u2264 0\n [prop] 0 < 3 * a ^ 2 - b ^ 2\n [prop] (3 * a ^ 2 - b ^ 2) * (3 * b ^ 2 - a ^ 2) \u2264 0\n [prop] discrim 1 (-(a ^ 2 + b ^ 2) / (2 * a)) (((a ^ 2 - b ^ 2) / (2 * a)) ^ 2) \u2264 0\n [prop] \u00ac1 = 0\n [prop] \u00ac(3 * a ^ 2 - b ^ 2) * (3 * b ^ 2 - a ^ 2) / (4 * a ^ 2) < 0\n [prop] (3 * a ^ 2 - b ^ 2) * (3 * b ^ 2 - a ^ 2) / (4 * a ^ 2) = 0\n [prop] [x, y, z].Nodup = (x \u2209 [y, z] \u2227 [y, z].Nodup)\n [prop] [y, z].Nodup = (y \u2209 [z] \u2227 [z].Nodup)\n [prop] x \u2208 [y, z] \u2192 1 \u2264 [y, z].length\n [prop] x \u2208 [z] \u2192 x \u2208 [y, z]\n [prop] (List.elem x [y, z] = true) = (x \u2208 [y, z])\n [prop] [z].Nodup = (z \u2209 [] \u2227 [].Nodup)\n [prop] x \u2208 [z] \u2192 1 \u2264 [z].length\n [prop] y \u2208 [z] \u2192 1 \u2264 [z].length\n [prop] x \u2208 [y, z] \u2192 x = y \u2228 x \u2208 [z]\n [prop] x \u2208 [] \u2192 x \u2208 [z]\n [prop] y \u2208 [] \u2192 y \u2208 [z]\n [prop] (List.elem x [z] = true) = (x \u2208 [z])\n [prop] (List.elem y [z] = true) = (y \u2208 [z])\n [prop] [y, z].length = [z].length + 1\n [prop] (List.elem x [y, z] = true) = (x = y \u2228 List.elem x [z] = true)\n [prop] (List.elem x [y, z] = true) = (x \u2208 [y, z])\n [prop] [].Nodup\n [prop] y \u2208 [] \u2192 1 \u2264 [].length\n [prop] x \u2208 [] \u2192 1 \u2264 [].length\n [prop] z \u2208 [] \u2192 1 \u2264 [].length\n [prop] y \u2208 [z] \u2192 y = z \u2228 y \u2208 []\n [prop] x \u2208 [z] \u2192 x = z \u2228 x \u2208 []\n [prop] (List.elem y [] = true) = (y \u2208 [])\n [prop] (List.elem x [] = true) = (x \u2208 [])\n [prop] (List.elem z [] = true) = (z \u2208 [])\n [prop] [z].length = [].length + 1\n [prop] (List.elem y [z] = true) = (y = z \u2228 List.elem y [] = true)\n [prop] (List.elem x [z] = true) = (x = z \u2228 List.elem x [] = true)\n [prop] (List.elem y [z] = true) = (y \u2208 [z])\n [prop] (List.elem x [z] = true) = (x \u2208 [z])\n [prop] [].length = 0\n [prop] (List.elem z [] = true) = (z \u2208 [])\n [prop] (List.elem x [] = true) = (x \u2208 [])\n [prop] (List.elem y [] = true) = (y \u2208 [])\n [prop] List.elem z [] = false\n [prop] List.elem x [] = false\n [prop] List.elem y [] = false\n [eqc] True propositions\n [prop] 0 < x\n [prop] 0 < y\n [prop] 0 < z\n [prop] [x, y, z].Nodup\n [prop] 0 < a\n [prop] (0 + 2).AtLeastTwo\n [prop] b ^ 2 < a ^ 2\n [prop] (2 + 2).AtLeastTwo\n [prop] (1 + 2).AtLeastTwo\n [prop] 3 * b ^ 2 \u2264 a ^ 2\n [prop] 3 * b ^ 2 - a ^ 2 \u2264 0\n [prop] 0 < 3 * a ^ 2 - b ^ 2\n [prop] (3 * a ^ 2 - b ^ 2) * (3 * b ^ 2 - a ^ 2) \u2264 0\n [prop] discrim 1 (-(a ^ 2 + b ^ 2) / (2 * a)) (((a ^ 2 - b ^ 2) / (2 * a)) ^ 2) \u2264 0\n [prop] [x, y, z].Nodup = (x \u2209 [y, z] \u2227 [y, z].Nodup)\n [prop] x \u2209 [y, z] \u2227 [y, z].Nodup\n [prop] [y, z].Nodup\n [prop] x \u2209 [y, z]\n [prop] [y, z].Nodup = (y \u2209 [z] \u2227 [z].Nodup)\n [prop] y \u2209 [z] \u2227 [z].Nodup\n [prop] [z].Nodup\n [prop] y \u2209 [z]\n [prop] x \u2208 [y, z] \u2192 1 \u2264 [y, z].length\n [prop] x \u2208 [z] \u2192 x \u2208 [y, z]\n [prop] (List.elem x [y, z] = true) = (x \u2208 [y, z])\n [prop] [z].Nodup = (z \u2209 [] \u2227 [].Nodup)\n [prop] z \u2209 [] \u2227 [].Nodup\n [prop] [].Nodup\n [prop] z \u2209 []\n [prop] x \u2208 [z] \u2192 1 \u2264 [z].length\n [prop] y \u2208 [z] \u2192 1 \u2264 [z].length\n [prop] x \u2208 [y, z] \u2192 x = y \u2228 x \u2208 [z]\n [prop] x \u2208 [] \u2192 x \u2208 [z]\n [prop] y \u2208 [] \u2192 y \u2208 [z]\n [prop] (List.elem x [z] = true) = (x \u2208 [z])\n [prop] (List.elem y [z] = true) = (y \u2208 [z])\n [prop] 1 \u2264 [y, z].length\n [prop] (List.elem x [y, z] = true) = (x = y \u2228 List.elem x [z] = true)\n [prop] y \u2208 [] \u2192 1 \u2264 [].length\n [prop] x \u2208 [] \u2192 1 \u2264 [].length\n [prop] z \u2208 [] \u2192 1 \u2264 [].length\n [prop] y \u2208 [z] \u2192 y = z \u2228 y \u2208 []\n [prop] x \u2208 [z] \u2192 x = z \u2228 x \u2208 []\n [prop] (List.elem y [] = true) = (y \u2208 [])\n [prop] (List.elem x [] = true) = (x \u2208 [])\n [prop] (List.elem z [] = true) = (z \u2208 [])\n [prop] (List.elem y [z] = true) = (y = z \u2228 List.elem y [] = true)\n [prop] (List.elem x [z] = true) = (x = z \u2228 List.elem x [] = true)\n [eqc] False propositions\n [prop] 1 = 0\n [prop] (3 * a ^ 2 - b ^ 2) * (3 * b ^ 2 - a ^ 2) / (4 * a ^ 2) < 0\n [prop] x \u2208 [y, z]\n [prop] y \u2208 [z]\n [prop] x \u2208 [z]\n [prop] List.elem x [y, z] = true\n [prop] z \u2208 []\n [prop] x \u2208 []\n [prop] y \u2208 []\n [prop] List.elem x [z] = true\n [prop] List.elem y [z] = true\n [prop] x = y \u2228 List.elem x [z] = true\n [prop] x = y\n [prop] x = y \u2228 x \u2208 [z]\n [prop] List.elem y [] = true\n [prop] List.elem x [] = true\n [prop] List.elem z [] = true\n [prop] y = z \u2228 List.elem y [] = true\n [prop] y = z\n [prop] y = z \u2228 y \u2208 []\n [prop] x = z \u2228 List.elem x [] = true\n [prop] x = z\n [prop] x = z \u2228 x \u2208 []\n [eqc] Equivalence classes\n [eqc] {\u2191[].length, \u21910}\n [eqc] {\u2191[z].length, \u2191([].length + 1)}\n [eqc] {[z].length, [].length + 1}\n [eqc] {\u2191[y, z].length, \u2191(0 + 2), \u2191([z].length + 1)}\n [eqc] {(2 * 1 * y + -(a ^ 2 + b ^ 2) / (2 * a)) ^ 2,\n (3 * a ^ 2 - b ^ 2) * (3 * b ^ 2 - a ^ 2) / (4 * a ^ 2),\n discrim 1 (-(a ^ 2 + b ^ 2) / (2 * a)) (((a ^ 2 - b ^ 2) / (2 * a)) ^ 2),\n 0,\n 1 * (y * y) + -(a ^ 2 + b ^ 2) / (2 * a) * y + ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2,\n (-(a ^ 2 + b ^ 2) / (2 * a)) ^ 2 - 4 * 1 * ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2}\n [eqc] {z, (a ^ 2 - b ^ 2) / (2 * a)}\n [eqc] {x + y - z, b ^ 2 / a}\n [eqc] {x ^ 2 + y ^ 2 + z ^ 2, (x + y + z) * (x + y - z), b ^ 2}\n [eqc] {x * y, ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2, z ^ 2}\n [eqc] {0 + 2, [z].length + 1, [y, z].length, 2}\n [eqc] {x + y + z, a}\n [eqc] {[].length, 0}\n [eqc] {List.elem x [y, z], List.elem x [z], List.elem y [z], List.elem y [], List.elem x [], List.elem z [], false}\n [ematch] E-matching patterns\n [thm] List.nodup_cons: [@List.Nodup #2 (@List.cons _ #1 #0)]\n [thm] List.nodup_nil: [@List.Nodup #0 (@List.nil _)]\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [thm] List.length_pos_of_mem: [@Membership.mem #3 (List _) _ #1 #2]\n [thm] List.eq_or_mem_of_mem_cons: [@Membership.mem #4 (List _) _ #1 #3, @List.cons _ #2 #1]\n [thm] List.mem_cons_self: [@Membership.mem #2 (List _) _ (@List.cons _ #1 #0) #1]\n [thm] List.mem_cons_of_mem: [@Membership.mem #4 (List _) _ (@List.cons _ #3 #1) #2]\n [thm] List.contains_iff_mem: [@Membership.mem #4 (List _) _ #1 #0]\n [thm] List.length_cons: [@List.length #2 (@List.cons _ #1 #0)]\n [thm] List.length_nil: [@List.length #0 (@List.nil _)]\n [thm] List.contains_cons: [@List.elem #4 #3 #1 (@List.cons _ #2 #0)]\n [thm] List.contains_eq_mem: [@List.elem #4 #3 #1 #0]\n [thm] List.elem_nil: [@List.elem #2 #0 #1 (@List.nil _)]\n [cutsat] Assignment satisfying linear constraints\n [assign] [].length := 0\n [assign] [y, z].length := 2\n [assign] [z].length := 1\n [assign] 0 := 0\n [assign] 1 := 1\n [assign] 2 := 2\n [assign] 3 := 3\n [assign] 4 := 4\n [ring] Ring `\u211d`\n [basis] Basis\n [_] x + y + z + -1 * a = 0\n [_] 2 * y ^ 2 + -1 * b ^ 2 + -2 * (y * a) + a ^ 2 + 2 * (y * ((a ^ 2 - b ^ 2) / (2 * a))) +\n -2 * (a * ((a ^ 2 - b ^ 2) / (2 * a))) +\n 2 * ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2 =\n 0\n [_] 2 * (y * a) + 2 * (y * (-(a ^ 2 + b ^ 2) / (2 * a))) + -2 * (y * ((a ^ 2 - b ^ 2) / (2 * a))) = 0\n [_] z + -1 * ((a ^ 2 - b ^ 2) / (2 * a)) = 0\n [_] b ^ 2 + -1 * a ^ 2 + 2 * (a * ((a ^ 2 - b ^ 2) / (2 * a))) = 0\n [_] 2 * (a * ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2) +\n 2 * (-(a ^ 2 + b ^ 2) / (2 * a) * ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2) +\n -2 * ((a ^ 2 - b ^ 2) / (2 * a)) ^ 3 =\n 0\n [_] (-(a ^ 2 + b ^ 2) / (2 * a)) ^ 2 + -4 * ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2 = 0\n [diseqs] Disequalities\n [_] \u00ac-2 * y + a + -1 * ((a ^ 2 - b ^ 2) / (2 * a)) = 0\n [_] \u00acy + -1 * ((a ^ 2 - b ^ 2) / (2 * a)) = 0\n [_] \u00ac-1 * y + a + -2 * ((a ^ 2 - b ^ 2) / (2 * a)) = 0\n [limits] Thresholds reached\n [limit] maximum number of E-matching rounds has been reached, threshold: `(ematch := 5)`\n[grind] Issues\n [issue] failed to convert to ring expression\n ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n [y, z]\n has type\n List \u211d : Type\n but is expected to have type\n Std.ExtDHashMap \u211d ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n [y, z]\n has type\n List \u211d : Type\n but is expected to have type\n Std.DHashMap \u211d ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n [z]\n has type\n List \u211d : Type\n but is expected to have type\n Std.ExtDHashMap \u211d ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n [z]\n has type\n List \u211d : Type\n but is expected to have type\n Std.ExtDHashMap \u211d ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n [z]\n has type\n List \u211d : Type\n but is expected to have type\n Std.DHashMap \u211d ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n [z]\n has type\n List \u211d : Type\n but is expected to have type\n Std.DHashMap \u211d ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n []\n has type\n List \u211d : Type\n but is expected to have type\n Std.ExtDHashMap \u211d ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n []\n has type\n List \u211d : Type\n but is expected to have type\n Std.ExtDHashMap \u211d ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n []\n has type\n List \u211d : Type\n but is expected to have type\n Std.ExtDHashMap \u211d ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n []\n has type\n List \u211d : Type\n but is expected to have type\n Std.DHashMap \u211d ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n []\n has type\n List \u211d : Type\n but is expected to have type\n Std.DHashMap \u211d ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n []\n has type\n List \u211d : Type\n but is expected to have type\n Std.DHashMap \u211d ?\u03b2 : Type\n[grind] Diagnostics\n [thm] E-Matching instances\n [thm] List.contains_eq_mem \u21a6 6\n [thm] List.contains_iff_mem \u21a6 6\n [thm] List.eq_or_mem_of_mem_cons \u21a6 6\n [thm] List.length_pos_of_mem \u21a6 6\n [thm] List.contains_cons \u21a6 3\n [thm] List.elem_nil \u21a6 3\n [thm] List.mem_cons_of_mem \u21a6 3\n [thm] List.nodup_cons \u21a6 3\n [thm] List.length_cons \u21a6 2\n [thm] List.length_nil \u21a6 1\n [thm] List.nodup_nil \u21a6 1", "`grind` failed\ncase grind.1.1\na b x y z : \u211d\nh_2 : \u00acx + y + z = a\nleft : \u00aca = 0\nleft_1 : z = (a ^ 2 - b ^ 2) / (2 * a)\nright_1 : \u2200 (m : \u211d), (m - x) * (m - y) = m ^ 2 - (a ^ 2 + b ^ 2) / (2 * a) * m + ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] (\u00aca = 0 \u2227\n z = (a ^ 2 - b ^ 2) / (2 * a) \u2227\n \u2200 (m : \u211d), (m - x) * (m - y) = m ^ 2 - (a ^ 2 + b ^ 2) / (2 * a) * m + ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2) \u2228\n a = 0 \u2227 b = 0 \u2227 x = 0 \u2227 y = 0 \u2227 z = 0\n [prop] \u00acx + y + z = a \u2228 \u00acx ^ 2 + y ^ 2 + z ^ 2 = b ^ 2 \u2228 \u00acx * y = z ^ 2\n [prop] \u00acx + y + z = a\n [prop] \u00aca = 0\n [prop] z = (a ^ 2 - b ^ 2) / (2 * a)\n [prop] \u2200 (m : \u211d), (m - x) * (m - y) = m ^ 2 - (a ^ 2 + b ^ 2) / (2 * a) * m + ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2\n [eqc] True propositions\n [prop] (\u00aca = 0 \u2227\n z = (a ^ 2 - b ^ 2) / (2 * a) \u2227\n \u2200 (m : \u211d), (m - x) * (m - y) = m ^ 2 - (a ^ 2 + b ^ 2) / (2 * a) * m + ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2) \u2228\n a = 0 \u2227 b = 0 \u2227 x = 0 \u2227 y = 0 \u2227 z = 0\n [prop] (0 + 2).AtLeastTwo\n [prop] \u00acx + y + z = a \u2228 \u00acx ^ 2 + y ^ 2 + z ^ 2 = b ^ 2 \u2228 \u00acx * y = z ^ 2\n [prop] \u00acx + y + z = a\n [prop] \u00aca = 0 \u2227\n z = (a ^ 2 - b ^ 2) / (2 * a) \u2227\n \u2200 (m : \u211d), (m - x) * (m - y) = m ^ 2 - (a ^ 2 + b ^ 2) / (2 * a) * m + ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2\n [prop] z = (a ^ 2 - b ^ 2) / (2 * a) \u2227\n \u2200 (m : \u211d), (m - x) * (m - y) = m ^ 2 - (a ^ 2 + b ^ 2) / (2 * a) * m + ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2\n [prop] \u2200 (m : \u211d), (m - x) * (m - y) = m ^ 2 - (a ^ 2 + b ^ 2) / (2 * a) * m + ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2\n [prop] z = (a ^ 2 - b ^ 2) / (2 * a)\n [prop] \u00aca = 0\n [eqc] False propositions\n [prop] x + y + z = a\n [prop] a = 0\n [prop] a = 0 \u2227 b = 0 \u2227 x = 0 \u2227 y = 0 \u2227 z = 0\n [eqc] Equivalence classes\n [eqc] {0 + 2, 2}\n [eqc] {z, (a ^ 2 - b ^ 2) / (2 * a)}\n [cases] Case analyses\n [cases] [1/2]: \u00acx + y + z = a \u2228 \u00acx ^ 2 + y ^ 2 + z ^ 2 = b ^ 2 \u2228 \u00acx * y = z ^ 2\n [cases] [1/2]: (\u00aca = 0 \u2227\n z = (a ^ 2 - b ^ 2) / (2 * a) \u2227\n \u2200 (m : \u211d), (m - x) * (m - y) = m ^ 2 - (a ^ 2 + b ^ 2) / (2 * a) * m + ((a ^ 2 - b ^ 2) / (2 * a)) ^ 2) \u2228\n a = 0 \u2227 b = 0 \u2227 x = 0 \u2227 y = 0 \u2227 z = 0\n [ematch] E-matching patterns\n [thm] local_0: [@HSub.hSub `[\u211d] `[\u211d] `[\u211d] `[instHSub] #0 `[x]]\n [thm] local_0: [@HSub.hSub `[\u211d] `[\u211d] `[\u211d] `[instHSub] #0 `[x]]\n [cutsat] Assignment satisfying linear constraints\n [assign] 0 := 0\n [assign] 2 := 2", "`grind` failed\ncase grind\na b x y z : \u211d\nh\u2080 : x + y + z = a\nh\u2081 : x ^ 2 + y ^ 2 + z ^ 2 = b ^ 2\nh\u2082 : x * y = z ^ 2\nh\u2083 : (x + y) ^ 2 - z ^ 2 = b ^ 2\nha\u2080 : a = 0\nh : \u00acb = 0\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] x + y + z = a\n [prop] x ^ 2 + y ^ 2 + z ^ 2 = b ^ 2\n [prop] x * y = z ^ 2\n [prop] (x + y) ^ 2 - z ^ 2 = b ^ 2\n [prop] a = 0\n [prop] \u00acb = 0\n [eqc] False propositions\n [prop] b = 0\n [eqc] Equivalence classes\n [eqc] {x ^ 2 + y ^ 2 + z ^ 2, (x + y) ^ 2 - z ^ 2, a, x + y + z, 0, b ^ 2}\n [eqc] {x * y, z ^ 2}\n [ring] Ring `\u211d`\n [basis] Basis\n [_] x + y + z = 0\n [_] 2 * y ^ 2 + 2 * (y * z) + 2 * z ^ 2 + -1 * b ^ 2 = 0\n [_] b ^ 2 = 0\n [diseqs] Disequalities\n [_] \u00acb = 0", "`grind` failed\ncase grind\na b x y z : \u211d\nh\u2080 : x + y + z = a\nh\u2081 : x ^ 2 + y ^ 2 + z ^ 2 = b ^ 2\nh\u2082 : x * y = z ^ 2\nha\u2080 : a = 0\nhb\u2080 : b = 0\nh\u2083 : x * y + x ^ 2 + y ^ 2 = 0\nh : \u00acx ^ 3 = y ^ 3\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] x + y + z = a\n [prop] x ^ 2 + y ^ 2 + z ^ 2 = b ^ 2\n [prop] x * y = z ^ 2\n [prop] a = 0\n [prop] b = 0\n [prop] x * y + x ^ 2 + y ^ 2 = 0\n [prop] \u00acx ^ 3 = y ^ 3\n [eqc] False propositions\n [prop] x ^ 3 = y ^ 3\n [eqc] Equivalence classes\n [eqc] {x * y, z ^ 2}\n [eqc] {x + y + z, 0, b, x * y + x ^ 2 + y ^ 2, b ^ 2, x ^ 2 + y ^ 2 + z ^ 2, a}\n [ring] Ring `\u211d`\n [basis] Basis\n [_] x + y + z = 0\n [_] 2 * y ^ 2 + 2 * (y * z) + 2 * z ^ 2 = 0\n [_] b = 0\n [diseqs] Disequalities\n [_] \u00ac-1 * (y ^ 2 * z) + -1 * (y * z ^ 2) + -1 * z ^ 3 = 0", "`grind` failed\ncase grind\na b x y z : \u211d\nh\u2080 : x + y + z = a\nh\u2081 : x ^ 2 + y ^ 2 + z ^ 2 = b ^ 2\nh\u2082 : x * y = z ^ 2\nh\u2083 : (x + y) ^ 2 - z ^ 2 = b ^ 2\nha\u2080 : \u00aca = 0\nh\u2084 : (x + y) ^ 2 - z ^ 2 = (x + y + z) * (x + y - z)\nh : \u00acz = (a ^ 2 - b ^ 2) / (2 * a)\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] x + y + z = a\n [prop] x ^ 2 + y ^ 2 + z ^ 2 = b ^ 2\n [prop] x * y = z ^ 2\n [prop] (x + y) ^ 2 - z ^ 2 = b ^ 2\n [prop] \u00aca = 0\n [prop] (x + y) ^ 2 - z ^ 2 = (x + y + z) * (x + y - z)\n [prop] \u00acz = (a ^ 2 - b ^ 2) / (2 * a)\n [eqc] True propositions\n [prop] (0 + 2).AtLeastTwo\n [eqc] False propositions\n [prop] a = 0\n [prop] z = (a ^ 2 - b ^ 2) / (2 * a)\n [eqc] Equivalence classes\n [eqc] {x ^ 2 + y ^ 2 + z ^ 2, (x + y) ^ 2 - z ^ 2, (x + y + z) * (x + y - z), b ^ 2}\n [eqc] {x * y, z ^ 2}\n [eqc] {0 + 2, 2}\n [eqc] {x + y + z, a}\n [cutsat] Assignment satisfying linear constraints\n [assign] 0 := 0\n [assign] 2 := 2\n [ring] Ring `\u211d`\n [basis] Basis\n [_] x ^ 2 + y ^ 2 + z ^ 2 + -1 * b ^ 2 = 0\n [_] x * y + -1 * z ^ 2 = 0\n [_] y ^ 3 + x * z ^ 2 + y * z ^ 2 + -1 * (y * b ^ 2) = 0\n [diseqs] Disequalities\n [_] \u00acx + y + z = 0", "`grind` failed\ncase grind\na b x y z : \u211d\nh\u2080 : x + y + z = a\nh\u2081 : x ^ 2 + y ^ 2 + z ^ 2 = b ^ 2\nh\u2082 : x * y = z ^ 2\nh\u2083 : (x + y) ^ 2 - z ^ 2 = b ^ 2\nha\u2080 : \u00aca = 0\nh\u2084 : (x + y) ^ 2 - z ^ 2 = (x + y + z) * (x + y - z)\nh\u2085 : z = (a ^ 2 - b ^ 2) / (2 * a)\nm : \u211d\nh : \u00ac(m - x) * (m - y) = m ^ 2 - (a ^ 2 + b ^ 2) / (2 * a) * m + x * y\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] x + y + z = a\n [prop] x ^ 2 + y ^ 2 + z ^ 2 = b ^ 2\n [prop] x * y = z ^ 2\n [prop] (x + y) ^ 2 - z ^ 2 = b ^ 2\n [prop] \u00aca = 0\n [prop] (x + y) ^ 2 - z ^ 2 = (x + y + z) * (x + y - z)\n [prop] z = (a ^ 2 - b ^ 2) / (2 * a)\n [prop] \u00ac(m - x) * (m - y) = m ^ 2 - (a ^ 2 + b ^ 2) / (2 * a) * m + x * y\n [eqc] True propositions\n [prop] (0 + 2).AtLeastTwo\n [eqc] False propositions\n [prop] a = 0\n [prop] (m - x) * (m - y) = m ^ 2 - (a ^ 2 + b ^ 2) / (2 * a) * m + x * y\n [eqc] Equivalence classes\n [eqc] {z, (a ^ 2 - b ^ 2) / (2 * a)}\n [eqc] {x ^ 2 + y ^ 2 + z ^ 2, (x + y) ^ 2 - z ^ 2, (x + y + z) * (x + y - z), b ^ 2}\n [eqc] {x * y, z ^ 2}\n [eqc] {0 + 2, 2}\n [eqc] {x + y + z, a}\n [cutsat] Assignment satisfying linear constraints\n [assign] 0 := 0\n [assign] 2 := 2\n [ring] Ring `\u211d`\n [basis] Basis\n [_] x ^ 2 + y ^ 2 + z ^ 2 + -1 * b ^ 2 = 0\n [_] x * y + -1 * z ^ 2 = 0\n [_] y ^ 3 + x * z ^ 2 + y * z ^ 2 + -1 * (y * b ^ 2) = 0\n [diseqs] Disequalities\n [_] \u00acx + y + z = 0\n [_] \u00ac-1 * (x * m) + -1 * (y * m) + m * ((a ^ 2 + b ^ 2) / (2 * a)) = 0"], "timeout_s": 600.0, "latency_s": 7.9973, "verified_at": "2026-03-26T18:16:08.025197+00:00"}} | false | true | false | 7.9973 |
compfiles_Imo1961P2 | compfiles | Copyright (c) 2025 lean-tom. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: lean-tom (with assistance from Gemini)
-/
import Mathlib
/-!
# International Mathematical Olympiad 1961, Problem 2
Let $a, b, c$ be the sides of a triangle, and $T$ its area. Prove:
$$ a^2 + b^2 + c^2 \ge 4\sqrt{3} T $$
Equality holds if and only if the triangle is equilateral.
-/
namespace Imo1961P2
/-
## Proof strategy
We use Heron's formula to express the area $T$ in terms of the sides $a, b, c$.
The inequality is then equivalent to the algebraic inequality:
$$(a^2 + b^2 + c^2)^2 \ge 48 T^2$$
Substituting Heron's formula leads to a sum of squares identity.
-/
/--
Helper lemma: The key algebraic identity for Weitzenböck's inequality.
(a^2 + b^2 + c^2)^2 - 48 T^2 = 2((a^2-b^2)^2 + (b^2-c^2)^2 + (c^2-a^2)^2)
-/
lemma weitzenbock_identity (a b c T : ℝ)
(h_area : 16 * T^2 = (a + b + c) * (a + b - c) * (a - b + c) * (-a + b + c)) :
(a^2 + b^2 + c^2)^2 - 48 * T^2 =
2 * ((a^2 - b^2)^2 + (b^2 - c^2)^2 + (c^2 - a^2)^2) := by
have h48T : 48 * T^2 = 3 * (16 * T^2) := by ring
rw [h48T, h_area]
ring
/--
**IMO 1961 P2 (Inequality Case)**
-/
theorem imo1961_p2a (a b c T : ℝ)
(h_pos_a : 0 < a) (h_pos_b : 0 < b) (h_pos_c : 0 < c)
(h_area : 16 * T^2 = (a + b + c) * (a + b - c) * (a - b + c) * (-a + b + c)) :
a^2 + b^2 + c^2 ≥ 4 * Real.sqrt 3 * T := by
-- Convert to squared form
apply nonneg_le_nonneg_of_sq_le_sq
· positivity
· ring_nf
rw [Real.sq_sqrt (by norm_num)]
ring_nf
-- Use the algebraic identity
have key_ident := weitzenbock_identity a b c T h_area
-- Pass to nlinarith with the identity and non-negativity of squares
linarith [key_ident, sq_nonneg (a^2 - b^2), sq_nonneg (b^2 - c^2), sq_nonneg (c^2 - a^2)]
/--
**IMO 1961 P2 (Equality Case)**
-/
theorem imo1961_p2b (a b c T : ℝ)
(h_pos_a : 0 < a) (h_pos_b : 0 < b) (h_pos_c : 0 < c) (h_pos_T : 0 < T)
(h_area : 16 * T^2 = (a + b + c) * (a + b - c) * (a - b + c) * (-a + b + c)) :
a^2 + b^2 + c^2 = 4 * Real.sqrt 3 * T ↔ a = b ∧ b = c := by
constructor
· -- (→) If equality holds, then a=b=c
intro h_eq
have key_ident := weitzenbock_identity a b c T h_area
-- Square the hypothesis
have h_sq : (a^2 + b^2 + c^2)^2 = 48 * T^2 := by
rw [h_eq, mul_pow, mul_pow, Real.sq_sqrt (by norm_num)]; ring
-- Combine with identity
rw [h_sq, sub_self] at key_ident
symm at key_ident
-- 2 * SumOfSquares = 0 implies each square is 0
rcases (mul_eq_zero.mp key_ident) with (contra | h_sum)
· norm_num at contra
· rw [add_eq_zero_iff_of_nonneg (by positivity) (by positivity)] at h_sum
rcases h_sum with ⟨h_ab_bc, h_ca⟩
rw [add_eq_zero_iff_of_nonneg (by positivity) (by positivity)] at h_ab_bc
rcases h_ab_bc with ⟨h_ab, h_bc⟩
-- Extract a=b and b=c
have ha : a = b := by
rw [sq_eq_zero_iff, sub_eq_zero, sq_eq_sq_iff_eq_or_eq_neg] at h_ab
cases h_ab <;> [assumption; linarith]
have hb : b = c := by
rw [sq_eq_zero_iff, sub_eq_zero, sq_eq_sq_iff_eq_or_eq_neg] at h_bc
cases h_bc <;> [assumption; linarith]
exact ⟨ha, hb⟩
· -- (←) If a=b=c, then equality holds
rintro ⟨rfl, rfl⟩
-- Prove (3a^2)^2 = (4√3 T)^2
ring_nf
suffices (a^2 * 3)^2 = (√3 * T * 4)^2 by
refine (sq_eq_sq_iff_eq_or_eq_neg.mp this).resolve_right ?_
intro h_contra
have : 0 < 3 * a^2 := by positivity
have : 4 * Real.sqrt 3 * T > 0 := by positivity
linarith
-- Calculation
rw [mul_pow, mul_pow, mul_pow, Real.sq_sqrt (by norm_num)]
ring_nf
ring_nf at h_area
calc
a ^ 4 * 9 = (a ^ 4 * 3) * 3 := by ring
_ = (T^2 * 16) * 3 := by rw [h_area]
_ = T ^ 2 * 48 := by ring
end Imo1961P2 | /- | /-
Copyright (c) 2025 lean-tom. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: lean-tom (with assistance from Gemini)
-/
import Mathlib
/-!
# International Mathematical Olympiad 1961, Problem 2
Let $a, b, c$ be the sides of a triangle, and $T$ its area. Prove:
$$ a^2 + b^2 + c^2 \ge 4\sqrt{3} T $$
Equality holds if and only if the triangle is equilateral.
-/
namespace Imo1961P2
/-
## Proof strategy
We use Heron's formula to express the area $T$ in terms of the sides $a, b, c$.
The inequality is then equivalent to the algebraic inequality:
$$(a^2 + b^2 + c^2)^2 \ge 48 T^2$$
Substituting Heron's formula leads to a sum of squares identity.
-/
/--
Helper lemma: The key algebraic identity for Weitzenböck's inequality.
(a^2 + b^2 + c^2)^2 - 48 T^2 = 2((a^2-b^2)^2 + (b^2-c^2)^2 + (c^2-a^2)^2)
-/
lemma weitzenbock_identity (a b c T : ℝ)
(h_area : 16 * T^2 = (a + b + c) * (a + b - c) * (a - b + c) * (-a + b + c)) :
(a^2 + b^2 + c^2)^2 - 48 * T^2 =
2 * ((a^2 - b^2)^2 + (b^2 - c^2)^2 + (c^2 - a^2)^2) := by
have h48T : 48 * T^2 = 3 * (16 * T^2) := by ring
rw [h48T, h_area]
ring
/--
**IMO 1961 P2 (Inequality Case)**
-/
theorem imo1961_p2a (a b c T : ℝ)
(h_pos_a : 0 < a) (h_pos_b : 0 < b) (h_pos_c : 0 < c)
(h_area : 16 * T^2 = (a + b + c) * (a + b - c) * (a - b + c) * (-a + b + c)) :
a^2 + b^2 + c^2 ≥ 4 * Real.sqrt 3 * T := by
-- Convert to squared form
apply nonneg_le_nonneg_of_sq_le_sq
· positivity
· ring_nf
rw [Real.sq_sqrt (by norm_num)]
ring_nf
-- Use the algebraic identity
have key_ident := weitzenbock_identity a b c T h_area
-- Pass to nlinarith with the identity and non-negativity of squares
linarith [key_ident, sq_nonneg (a^2 - b^2), sq_nonneg (b^2 - c^2), sq_nonneg (c^2 - a^2)]
/--
**IMO 1961 P2 (Equality Case)**
-/
theorem imo1961_p2b (a b c T : ℝ)
(h_pos_a : 0 < a) (h_pos_b : 0 < b) (h_pos_c : 0 < c) (h_pos_T : 0 < T)
(h_area : 16 * T^2 = (a + b + c) * (a + b - c) * (a - b + c) * (-a + b + c)) :
a^2 + b^2 + c^2 = 4 * Real.sqrt 3 * T ↔ a = b ∧ b = c := by
constructor
· -- (→) If equality holds, then a=b=c
intro h_eq
have key_ident := weitzenbock_identity a b c T h_area
-- Square the hypothesis
have h_sq : (a^2 + b^2 + c^2)^2 = 48 * T^2 := by
rw [h_eq, mul_pow, mul_pow, Real.sq_sqrt (by norm_num)]; ring
-- Combine with identity
rw [h_sq, sub_self] at key_ident
symm at key_ident
-- 2 * SumOfSquares = 0 implies each square is 0
rcases (mul_eq_zero.mp key_ident) with (contra | h_sum)
· norm_num at contra
· rw [add_eq_zero_iff_of_nonneg (by positivity) (by positivity)] at h_sum
rcases h_sum with ⟨h_ab_bc, h_ca⟩
rw [add_eq_zero_iff_of_nonneg (by positivity) (by positivity)] at h_ab_bc
rcases h_ab_bc with ⟨h_ab, h_bc⟩
-- Extract a=b and b=c
have ha : a = b := by
rw [sq_eq_zero_iff, sub_eq_zero, sq_eq_sq_iff_eq_or_eq_neg] at h_ab
cases h_ab <;> [assumption; linarith]
have hb : b = c := by
rw [sq_eq_zero_iff, sub_eq_zero, sq_eq_sq_iff_eq_or_eq_neg] at h_bc
cases h_bc <;> [assumption; linarith]
exact ⟨ha, hb⟩
· -- (←) If a=b=c, then equality holds
rintro ⟨rfl, rfl⟩
-- Prove (3a^2)^2 = (4√3 T)^2
ring_nf
suffices (a^2 * 3)^2 = (√3 * T * 4)^2 by
refine (sq_eq_sq_iff_eq_or_eq_neg.mp this).resolve_right ?_
intro h_contra
have : 0 < 3 * a^2 := by positivity
have : 4 * Real.sqrt 3 * T > 0 := by positivity
linarith
-- Calculation
rw [mul_pow, mul_pow, mul_pow, Real.sq_sqrt (by norm_num)]
ring_nf
ring_nf at h_area
calc
a ^ 4 * 9 = (a ^ 4 * 3) * 3 := by ring
_ = (T^2 * 16) * 3 := by rw [h_area]
_ = T ^ 2 * 48 := by ring
end Imo1961P2
| true | Copyright (c) 2025 lean-tom. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: lean-tom (with assistance from Gemini)
-/
import Mathlib
/-!
# International Mathematical Olympiad 1961, Problem 2
Let $a, b, c$ be the sides of a triangle, and $T$ its area. Prove:
$$ a^2 + b^2 + c^2 \ge 4\sqrt{3} T $$
Equality holds if and only if the triangle is equilateral.
-/
namespace Imo1961P2
/-
## Proof strategy
We use Heron's formula to express the area $T$ in terms of the sides $a, b, c$.
The inequality is then equivalent to the algebraic inequality:
$$(a^2 + b^2 + c^2)^2 \ge 48 T^2$$
Substituting Heron's formula leads to a sum of squares identity.
-/
/--
Helper lemma: The key algebraic identity for Weitzenböck's inequality.
(a^2 + b^2 + c^2)^2 - 48 T^2 = 2((a^2-b^2)^2 + (b^2-c^2)^2 + (c^2-a^2)^2)
-/
lemma weitzenbock_identity (a b c T : ℝ)
(h_area : 16 * T^2 = (a + b + c) * (a + b - c) * (a - b + c) * (-a + b + c)) :
(a^2 + b^2 + c^2)^2 - 48 * T^2 =
2 * ((a^2 - b^2)^2 + (b^2 - c^2)^2 + (c^2 - a^2)^2) := by
have h48T : 48 * T^2 = 3 * (16 * T^2) := by ring
rw [h48T, h_area]
ring
/--
**IMO 1961 P2 (Inequality Case)**
-/
theorem imo1961_p2a (a b c T : ℝ)
(h_pos_a : 0 < a) (h_pos_b : 0 < b) (h_pos_c : 0 < c)
(h_area : 16 * T^2 = (a + b + c) * (a + b - c) * (a - b + c) * (-a + b + c)) :
a^2 + b^2 + c^2 ≥ 4 * Real.sqrt 3 * T := by
-- Convert to squared form
apply nonneg_le_nonneg_of_sq_le_sq
· positivity
· ring_nf
rw [Real.sq_sqrt (by norm_num)]
ring_nf
-- Use the algebraic identity
have key_ident := weitzenbock_identity a b c T h_area
-- Pass to nlinarith with the identity and non-negativity of squares
linarith [key_ident, sq_nonneg (a^2 - b^2), sq_nonneg (b^2 - c^2), sq_nonneg (c^2 - a^2)]
/--
**IMO 1961 P2 (Equality Case)**
-/
theorem imo1961_p2b (a b c T : ℝ)
(h_pos_a : 0 < a) (h_pos_b : 0 < b) (h_pos_c : 0 < c) (h_pos_T : 0 < T)
(h_area : 16 * T^2 = (a + b + c) * (a + b - c) * (a - b + c) * (-a + b + c)) :
a^2 + b^2 + c^2 = 4 * Real.sqrt 3 * T ↔ a = b ∧ b = c := by
constructor
· -- (→) If equality holds, then a=b=c
intro h_eq
have key_ident := weitzenbock_identity a b c T h_area
-- Square the hypothesis
have h_sq : (a^2 + b^2 + c^2)^2 = 48 * T^2 := by
rw [h_eq, mul_pow, mul_pow, Real.sq_sqrt (by norm_num)]; ring
-- Combine with identity
rw [h_sq, sub_self] at key_ident
symm at key_ident
-- 2 * SumOfSquares = 0 implies each square is 0
rcases (mul_eq_zero.mp key_ident) with (contra | h_sum)
· norm_num at contra
· rw [add_eq_zero_iff_of_nonneg (by positivity) (by positivity)] at h_sum
rcases h_sum with ⟨h_ab_bc, h_ca⟩
rw [add_eq_zero_iff_of_nonneg (by positivity) (by positivity)] at h_ab_bc
rcases h_ab_bc with ⟨h_ab, h_bc⟩
-- Extract a=b and b=c
have ha : a = b := by
rw [sq_eq_zero_iff, sub_eq_zero, sq_eq_sq_iff_eq_or_eq_neg] at h_ab
cases h_ab <;> [assumption; linarith]
have hb : b = c := by
rw [sq_eq_zero_iff, sub_eq_zero, sq_eq_sq_iff_eq_or_eq_neg] at h_bc
cases h_bc <;> [assumption; linarith]
exact ⟨ha, hb⟩
· -- (←) If a=b=c, then equality holds
rintro ⟨rfl, rfl⟩
-- Prove (3a^2)^2 = (4√3 T)^2
ring_nf
suffices (a^2 * 3)^2 = (√3 * T * 4)^2 by
refine (sq_eq_sq_iff_eq_or_eq_neg.mp this).resolve_right ?_
intro h_contra
have : 0 < 3 * a^2 := by positivity
have : 4 * Real.sqrt 3 * T > 0 := by positivity
linarith
-- Calculation
rw [mul_pow, mul_pow, mul_pow, Real.sq_sqrt (by norm_num)]
ring_nf
ring_nf at h_area
calc
a ^ 4 * 9 = (a ^ 4 * 3) * 3 := by ring
_ = (T^2 * 16) * 3 := by rw [h_area]
_ = T ^ 2 * 48 := by ring
end Imo1961P2 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1961P2.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 600.0, "latency_s": 1.967, "verified_at": "2026-03-26T18:16:09.994999+00:00"}} | true | true | false | 1.967 |
compfiles_Imo1961P3 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib
/-!
# International Mathematical Olympiad 1961, Problem 3
Solve the equation
cosⁿ x - sinⁿ x = 1,
where n is a given positive integer.
-/
namespace Imo1961P3
open Real
abbrev solutionSet (n : ℕ+) : Set ℝ :=
{ x | (∃ k : ℤ, k * π = x) ∧ Even n.val ∨ (∃ k : ℤ, k * (2 * π) = x) ∧ Odd n.val ∨
(∃ k : ℤ, -(π / 2) + k * (2 * π) = x) ∧ Odd n.val }
theorem imo1961_p3 {n : ℕ} {x : ℝ} (npos : 0 < n) :
x ∈ solutionSet ⟨n, npos⟩ ↔
(cos x) ^ n - (sin x) ^ n = 1 := by
-- This solution is based on
-- https://artofproblemsolving.com/wiki/index.php/1961_IMO_Problems/Problem_3
have h₀ : n ≠ 0 := Nat.ne_zero_of_lt npos
constructor
· rintro (⟨⟨k, rfl⟩, hn⟩ | ⟨⟨k, rfl⟩, -⟩ | ⟨⟨k, rfl⟩, hn⟩)
· dsimp at hn
rw [sin_int_mul_pi, zero_pow h₀, sub_zero, ← hn.pow_abs, abs_cos_int_mul_pi, one_pow]
· have : sin (k * (2 * π)) = 0 := by simpa [mul_assoc] using sin_int_mul_pi (k * 2)
simp [h₀, this]
· dsimp at hn; simp [hn.neg_pow, h₀]
· intro h
rcases eq_or_ne (sin x) 0 with hsinx | hsinx
· rw [hsinx, zero_pow h₀, sub_zero, pow_eq_one_iff_of_ne_zero h₀, cos_eq_one_iff,
cos_eq_neg_one_iff] at h
rcases h with ⟨k, rfl⟩ | ⟨⟨k, rfl⟩, hn⟩
· cases n.even_or_odd with
| inl hn => refine .inl ⟨⟨k * 2, ?_⟩, hn⟩; simp [mul_assoc]
| inr hn => exact .inr <| .inl ⟨⟨_, rfl⟩, hn⟩
· exact .inl ⟨⟨2 * k + 1, by push_cast; ring⟩, hn⟩
· rcases eq_or_ne (cos x) 0 with hcosx | hcosx
· right; right
rw [hcosx, zero_pow h₀, zero_sub, ← neg_inj, neg_neg, pow_eq_neg_one_iff,
sin_eq_neg_one_iff] at h
exact h
· have hcos1 : |cos x| < 1 := by
rw [abs_cos_eq_sqrt_one_sub_sin_sq, sqrt_lt' one_pos]
simp [sq_pos_of_ne_zero hsinx]
have hsin1 : |sin x| < 1 := by
rw [abs_sin_eq_sqrt_one_sub_cos_sq, sqrt_lt' one_pos]
simp [sq_pos_of_ne_zero hcosx]
match n with
| 1 =>
rw [pow_one, pow_one, sub_eq_iff_eq_add] at h
have : 2 * sin x * cos x = 0 := by
simpa [h, add_sq, add_assoc, ← two_mul, mul_add, mul_assoc, ← sq]
using cos_sq_add_sin_sq x
simp [hsinx, hcosx] at this
| 2 =>
rw [← cos_sq_add_sin_sq x, sub_eq_add_neg, add_right_inj, CharZero.neg_eq_self_iff] at h
exact absurd (eq_zero_of_pow_eq_zero h) hsinx
| (n + 1 + 2) =>
set m := n + 1
refine absurd ?_ h.not_lt
calc
(cos x) ^ (m + 2) - (sin x) ^ (m + 2) ≤ |cos x| ^ (m + 2) + |sin x| ^ (m + 2) := by
simp only [← abs_pow, sub_eq_add_neg]
gcongr
exacts [le_abs_self _, neg_le_abs _]
_ = |cos x| ^ m * cos x ^ 2 + |sin x| ^ m * sin x ^ 2 := by simp [pow_add]
_ < 1 ^ m * cos x ^ 2 + 1 ^ m * sin x ^ 2 := by gcongr
_ = 1 := by simp
end Imo1961P3 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib
/-!
# International Mathematical Olympiad 1961, Problem 3
Solve the equation
cosⁿ x - sinⁿ x = 1,
where n is a given positive integer.
-/
namespace Imo1961P3
open Real
abbrev solutionSet (n : ℕ+) : Set ℝ :=
{ x | (∃ k : ℤ, k * π = x) ∧ Even n.val ∨ (∃ k : ℤ, k * (2 * π) = x) ∧ Odd n.val ∨
(∃ k : ℤ, -(π / 2) + k * (2 * π) = x) ∧ Odd n.val }
theorem imo1961_p3 {n : ℕ} {x : ℝ} (npos : 0 < n) :
x ∈ solutionSet ⟨n, npos⟩ ↔
(cos x) ^ n - (sin x) ^ n = 1 := by
-- This solution is based on
-- https://artofproblemsolving.com/wiki/index.php/1961_IMO_Problems/Problem_3
have h₀ : n ≠ 0 := Nat.ne_zero_of_lt npos
constructor
· rintro (⟨⟨k, rfl⟩, hn⟩ | ⟨⟨k, rfl⟩, -⟩ | ⟨⟨k, rfl⟩, hn⟩)
· dsimp at hn
rw [sin_int_mul_pi, zero_pow h₀, sub_zero, ← hn.pow_abs, abs_cos_int_mul_pi, one_pow]
· have : sin (k * (2 * π)) = 0 := by simpa [mul_assoc] using sin_int_mul_pi (k * 2)
simp [h₀, this]
· dsimp at hn; simp [hn.neg_pow, h₀]
· intro h
rcases eq_or_ne (sin x) 0 with hsinx | hsinx
· rw [hsinx, zero_pow h₀, sub_zero, pow_eq_one_iff_of_ne_zero h₀, cos_eq_one_iff,
cos_eq_neg_one_iff] at h
rcases h with ⟨k, rfl⟩ | ⟨⟨k, rfl⟩, hn⟩
· cases n.even_or_odd with
| inl hn => refine .inl ⟨⟨k * 2, ?_⟩, hn⟩; simp [mul_assoc]
| inr hn => exact .inr <| .inl ⟨⟨_, rfl⟩, hn⟩
· exact .inl ⟨⟨2 * k + 1, by push_cast; ring⟩, hn⟩
· rcases eq_or_ne (cos x) 0 with hcosx | hcosx
· right; right
rw [hcosx, zero_pow h₀, zero_sub, ← neg_inj, neg_neg, pow_eq_neg_one_iff,
sin_eq_neg_one_iff] at h
exact h
· have hcos1 : |cos x| < 1 := by
rw [abs_cos_eq_sqrt_one_sub_sin_sq, sqrt_lt' one_pos]
simp [sq_pos_of_ne_zero hsinx]
have hsin1 : |sin x| < 1 := by
rw [abs_sin_eq_sqrt_one_sub_cos_sq, sqrt_lt' one_pos]
simp [sq_pos_of_ne_zero hcosx]
match n with
| 1 =>
rw [pow_one, pow_one, sub_eq_iff_eq_add] at h
have : 2 * sin x * cos x = 0 := by
simpa [h, add_sq, add_assoc, ← two_mul, mul_add, mul_assoc, ← sq]
using cos_sq_add_sin_sq x
simp [hsinx, hcosx] at this
| 2 =>
rw [← cos_sq_add_sin_sq x, sub_eq_add_neg, add_right_inj, CharZero.neg_eq_self_iff] at h
exact absurd (eq_zero_of_pow_eq_zero h) hsinx
| (n + 1 + 2) =>
set m := n + 1
refine absurd ?_ h.not_lt
calc
(cos x) ^ (m + 2) - (sin x) ^ (m + 2) ≤ |cos x| ^ (m + 2) + |sin x| ^ (m + 2) := by
simp only [← abs_pow, sub_eq_add_neg]
gcongr
exacts [le_abs_self _, neg_le_abs _]
_ = |cos x| ^ m * cos x ^ 2 + |sin x| ^ m * sin x ^ 2 := by simp [pow_add]
_ < 1 ^ m * cos x ^ 2 + 1 ^ m * sin x ^ 2 := by gcongr
_ = 1 := by simp
end Imo1961P3
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib
/-!
# International Mathematical Olympiad 1961, Problem 3
Solve the equation
cosⁿ x - sinⁿ x = 1,
where n is a given positive integer.
-/
namespace Imo1961P3
open Real
abbrev solutionSet (n : ℕ+) : Set ℝ :=
{ x | (∃ k : ℤ, k * π = x) ∧ Even n.val ∨ (∃ k : ℤ, k * (2 * π) = x) ∧ Odd n.val ∨
(∃ k : ℤ, -(π / 2) + k * (2 * π) = x) ∧ Odd n.val }
theorem imo1961_p3 {n : ℕ} {x : ℝ} (npos : 0 < n) :
x ∈ solutionSet ⟨n, npos⟩ ↔
(cos x) ^ n - (sin x) ^ n = 1 := by
-- This solution is based on
-- https://artofproblemsolving.com/wiki/index.php/1961_IMO_Problems/Problem_3
have h₀ : n ≠ 0 := Nat.ne_zero_of_lt npos
constructor
· rintro (⟨⟨k, rfl⟩, hn⟩ | ⟨⟨k, rfl⟩, -⟩ | ⟨⟨k, rfl⟩, hn⟩)
· dsimp at hn
rw [sin_int_mul_pi, zero_pow h₀, sub_zero, ← hn.pow_abs, abs_cos_int_mul_pi, one_pow]
· have : sin (k * (2 * π)) = 0 := by simpa [mul_assoc] using sin_int_mul_pi (k * 2)
simp [h₀, this]
· dsimp at hn; simp [hn.neg_pow, h₀]
· intro h
rcases eq_or_ne (sin x) 0 with hsinx | hsinx
· rw [hsinx, zero_pow h₀, sub_zero, pow_eq_one_iff_of_ne_zero h₀, cos_eq_one_iff,
cos_eq_neg_one_iff] at h
rcases h with ⟨k, rfl⟩ | ⟨⟨k, rfl⟩, hn⟩
· cases n.even_or_odd with
| inl hn => refine .inl ⟨⟨k * 2, ?_⟩, hn⟩; simp [mul_assoc]
| inr hn => exact .inr <| .inl ⟨⟨_, rfl⟩, hn⟩
· exact .inl ⟨⟨2 * k + 1, by push_cast; ring⟩, hn⟩
· rcases eq_or_ne (cos x) 0 with hcosx | hcosx
· right; right
rw [hcosx, zero_pow h₀, zero_sub, ← neg_inj, neg_neg, pow_eq_neg_one_iff,
sin_eq_neg_one_iff] at h
exact h
· have hcos1 : |cos x| < 1 := by
rw [abs_cos_eq_sqrt_one_sub_sin_sq, sqrt_lt' one_pos]
simp [sq_pos_of_ne_zero hsinx]
have hsin1 : |sin x| < 1 := by
rw [abs_sin_eq_sqrt_one_sub_cos_sq, sqrt_lt' one_pos]
simp [sq_pos_of_ne_zero hcosx]
match n with
| 1 =>
rw [pow_one, pow_one, sub_eq_iff_eq_add] at h
have : 2 * sin x * cos x = 0 := by
simpa [h, add_sq, add_assoc, ← two_mul, mul_add, mul_assoc, ← sq]
using cos_sq_add_sin_sq x
simp [hsinx, hcosx] at this
| 2 =>
rw [← cos_sq_add_sin_sq x, sub_eq_add_neg, add_right_inj, CharZero.neg_eq_self_iff] at h
exact absurd (eq_zero_of_pow_eq_zero h) hsinx
| (n + 1 + 2) =>
set m := n + 1
refine absurd ?_ h.not_lt
calc
(cos x) ^ (m + 2) - (sin x) ^ (m + 2) ≤ |cos x| ^ (m + 2) + |sin x| ^ (m + 2) := by
simp only [← abs_pow, sub_eq_add_neg]
gcongr
exacts [le_abs_self _, neg_le_abs _]
_ = |cos x| ^ m * cos x ^ 2 + |sin x| ^ m * sin x ^ 2 := by simp [pow_add]
_ < 1 ^ m * cos x ^ 2 + 1 ^ m * sin x ^ 2 := by gcongr
_ = 1 := by simp
end Imo1961P3 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1961P3.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown identifier 'eq_zero_of_pow_eq_zero'"], "timeout_s": 600.0, "latency_s": 1.3206, "verified_at": "2026-03-26T18:16:09.348807+00:00"}} | false | true | false | 1.3206 |
compfiles_Imo1962P1 | compfiles | Copyright (c) 2020 Kevin Lacker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Lacker
-/
import Mathlib
/-!
# International Mathematical Olympiad 1962, Problem 1
Find the smallest natural number $n$ which has the following properties:
(a) Its decimal representation has 6 as the last digit.
(b) If the last digit 6 is erased and placed in front of the remaining digits,
the resulting number is four times as large as the original number $n$.
-/
namespace Imo1962P1
open Nat
def ProblemPredicate (n : ℕ) : Prop :=
(digits 10 n).headI = 6 ∧ ofDigits 10 ((digits 10 n).tail.concat 6) = 4 * n
/-!
First, it's inconvenient to work with digits, so let's simplify them out of the problem.
-/
abbrev ProblemPredicate' (c n : ℕ) : Prop :=
n = 10 * c + 6 ∧ 6 * 10 ^ (digits 10 c).length + c = 4 * n
theorem without_digits {n : ℕ} (h1 : ProblemPredicate n) : ∃ c : ℕ, ProblemPredicate' c n := by
use n / 10
cases n with
| zero => have h2 : ¬ProblemPredicate 0 := by norm_num [ProblemPredicate]
contradiction
| succ n =>
rw [ProblemPredicate, digits_def' (by decide : 2 ≤ 10) n.succ_pos, List.headI, List.tail_cons,
List.concat_eq_append] at h1
constructor
· rw [← h1.left, div_add_mod (n + 1) 10]
· rw [← h1.right, ofDigits_append, ofDigits_digits, ofDigits_singleton, add_comm, mul_comm]
/-!
Now we can eliminate possibilities for `(digits 10 c).length` until we get to the one that works.
-/
theorem case_0_digit {c n : ℕ} (h1 : (digits 10 c).length = 0) : ¬ProblemPredicate' c n := by
intro h2
have h3 : 6 * 10 ^ 0 + c = 6 * 10 ^ (digits 10 c).length + c := by rw [h1]
omega
theorem case_1_digit {c n : ℕ} (h1 : (digits 10 c).length = 1) : ¬ProblemPredicate' c n := by
intro h2
have h3 : 6 * 10 ^ 1 + c = 6 * 10 ^ (digits 10 c).length + c := by rw [h1]
omega
theorem case_2_digit {c n : ℕ} (h1 : (digits 10 c).length = 2) : ¬ProblemPredicate' c n := by
intro h2
have h3 : 6 * 10 ^ 2 + c = 6 * 10 ^ (digits 10 c).length + c := by rw [h1]
omega
theorem case_3_digit {c n : ℕ} (h1 : (digits 10 c).length = 3) : ¬ProblemPredicate' c n := by
intro h2
have h3 : 6 * 10 ^ 3 + c = 6 * 10 ^ (digits 10 c).length + c := by rw [h1]
omega
theorem case_4_digit {c n : ℕ} (h1 : (digits 10 c).length = 4) : ¬ProblemPredicate' c n := by
intro h2
have h3 : 6 * 10 ^ 4 + c = 6 * 10 ^ (digits 10 c).length + c := by rw [h1]
omega
/-- Putting this inline causes a deep recursion error, so we separate it out. -/
theorem helper_5_digit {c : ℤ} (h : 6 * 10 ^ 5 + c = 4 * (10 * c + 6)) : c = 15384 := by linarith
theorem case_5_digit {c n : ℕ} (h1 : (digits 10 c).length = 5) (h2 : ProblemPredicate' c n) :
c = 15384 := by
have h3 : 6 * 10 ^ 5 + c = 6 * 10 ^ (digits 10 c).length + c := by rw [h1]
omega
/-- `linarith` fails on numbers this large, so this lemma spells out some of the arithmetic
that normally would be automated.
-/
theorem case_more_digits {c n : ℕ} (h1 : (digits 10 c).length ≥ 6) (h2 : ProblemPredicate' c n) :
n ≥ 153846 := by
have h3 : c ≠ 0 := by
intro h4
have h5 : (digits 10 c).length = 0 := by simp [h4]
exact case_0_digit h5 h2
calc
n ≥ 10 * c := le.intro h2.left.symm
_ ≥ 10 ^ (digits 10 c).length := (base_pow_length_digits_le 10 c (by decide) h3)
_ ≥ 10 ^ 6 := pow_le_pow_right₀ (by decide) h1
_ ≥ 153846 := by norm_num
/-!
Now we combine these cases to show that 153846 is the smallest solution.
-/
theorem satisfied_by_153846 : ProblemPredicate 153846 := by
norm_num [ProblemPredicate]
decide
theorem no_smaller_solutions (n : ℕ) (h1 : ProblemPredicate n) : n ≥ 153846 := by
have ⟨c, h2⟩ := without_digits h1
have h3 : (digits 10 c).length < 6 ∨ (digits 10 c).length ≥ 6 := by apply lt_or_ge
cases h3 with
| inr h3 => exact case_more_digits h3 h2
| inl h3 =>
interval_cases h : (digits 10 c).length
· exfalso; exact case_0_digit h h2
· exfalso; exact case_1_digit h h2
· exfalso; exact case_2_digit h h2
· exfalso; exact case_3_digit h h2
· exfalso; exact case_4_digit h h2
· have h4 : c = 15384 := case_5_digit h h2
have h5 : n = 10 * 15384 + 6 := h4 ▸ h2.left
exact Nat.le_of_eq h5.symm
abbrev solution : ℕ := 153846
theorem imo1962_p1 : IsLeast {n | ProblemPredicate n} solution :=
⟨satisfied_by_153846, no_smaller_solutions⟩
end Imo1962P1 | /- | /-
Copyright (c) 2020 Kevin Lacker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Lacker
-/
import Mathlib
/-!
# International Mathematical Olympiad 1962, Problem 1
Find the smallest natural number $n$ which has the following properties:
(a) Its decimal representation has 6 as the last digit.
(b) If the last digit 6 is erased and placed in front of the remaining digits,
the resulting number is four times as large as the original number $n$.
-/
namespace Imo1962P1
open Nat
def ProblemPredicate (n : ℕ) : Prop :=
(digits 10 n).headI = 6 ∧ ofDigits 10 ((digits 10 n).tail.concat 6) = 4 * n
/-!
First, it's inconvenient to work with digits, so let's simplify them out of the problem.
-/
abbrev ProblemPredicate' (c n : ℕ) : Prop :=
n = 10 * c + 6 ∧ 6 * 10 ^ (digits 10 c).length + c = 4 * n
theorem without_digits {n : ℕ} (h1 : ProblemPredicate n) : ∃ c : ℕ, ProblemPredicate' c n := by
use n / 10
cases n with
| zero => have h2 : ¬ProblemPredicate 0 := by norm_num [ProblemPredicate]
contradiction
| succ n =>
rw [ProblemPredicate, digits_def' (by decide : 2 ≤ 10) n.succ_pos, List.headI, List.tail_cons,
List.concat_eq_append] at h1
constructor
· rw [← h1.left, div_add_mod (n + 1) 10]
· rw [← h1.right, ofDigits_append, ofDigits_digits, ofDigits_singleton, add_comm, mul_comm]
/-!
Now we can eliminate possibilities for `(digits 10 c).length` until we get to the one that works.
-/
theorem case_0_digit {c n : ℕ} (h1 : (digits 10 c).length = 0) : ¬ProblemPredicate' c n := by
intro h2
have h3 : 6 * 10 ^ 0 + c = 6 * 10 ^ (digits 10 c).length + c := by rw [h1]
omega
theorem case_1_digit {c n : ℕ} (h1 : (digits 10 c).length = 1) : ¬ProblemPredicate' c n := by
intro h2
have h3 : 6 * 10 ^ 1 + c = 6 * 10 ^ (digits 10 c).length + c := by rw [h1]
omega
theorem case_2_digit {c n : ℕ} (h1 : (digits 10 c).length = 2) : ¬ProblemPredicate' c n := by
intro h2
have h3 : 6 * 10 ^ 2 + c = 6 * 10 ^ (digits 10 c).length + c := by rw [h1]
omega
theorem case_3_digit {c n : ℕ} (h1 : (digits 10 c).length = 3) : ¬ProblemPredicate' c n := by
intro h2
have h3 : 6 * 10 ^ 3 + c = 6 * 10 ^ (digits 10 c).length + c := by rw [h1]
omega
theorem case_4_digit {c n : ℕ} (h1 : (digits 10 c).length = 4) : ¬ProblemPredicate' c n := by
intro h2
have h3 : 6 * 10 ^ 4 + c = 6 * 10 ^ (digits 10 c).length + c := by rw [h1]
omega
/-- Putting this inline causes a deep recursion error, so we separate it out. -/
theorem helper_5_digit {c : ℤ} (h : 6 * 10 ^ 5 + c = 4 * (10 * c + 6)) : c = 15384 := by linarith
theorem case_5_digit {c n : ℕ} (h1 : (digits 10 c).length = 5) (h2 : ProblemPredicate' c n) :
c = 15384 := by
have h3 : 6 * 10 ^ 5 + c = 6 * 10 ^ (digits 10 c).length + c := by rw [h1]
omega
/-- `linarith` fails on numbers this large, so this lemma spells out some of the arithmetic
that normally would be automated.
-/
theorem case_more_digits {c n : ℕ} (h1 : (digits 10 c).length ≥ 6) (h2 : ProblemPredicate' c n) :
n ≥ 153846 := by
have h3 : c ≠ 0 := by
intro h4
have h5 : (digits 10 c).length = 0 := by simp [h4]
exact case_0_digit h5 h2
calc
n ≥ 10 * c := le.intro h2.left.symm
_ ≥ 10 ^ (digits 10 c).length := (base_pow_length_digits_le 10 c (by decide) h3)
_ ≥ 10 ^ 6 := pow_le_pow_right₀ (by decide) h1
_ ≥ 153846 := by norm_num
/-!
Now we combine these cases to show that 153846 is the smallest solution.
-/
theorem satisfied_by_153846 : ProblemPredicate 153846 := by
norm_num [ProblemPredicate]
decide
theorem no_smaller_solutions (n : ℕ) (h1 : ProblemPredicate n) : n ≥ 153846 := by
have ⟨c, h2⟩ := without_digits h1
have h3 : (digits 10 c).length < 6 ∨ (digits 10 c).length ≥ 6 := by apply lt_or_ge
cases h3 with
| inr h3 => exact case_more_digits h3 h2
| inl h3 =>
interval_cases h : (digits 10 c).length
· exfalso; exact case_0_digit h h2
· exfalso; exact case_1_digit h h2
· exfalso; exact case_2_digit h h2
· exfalso; exact case_3_digit h h2
· exfalso; exact case_4_digit h h2
· have h4 : c = 15384 := case_5_digit h h2
have h5 : n = 10 * 15384 + 6 := h4 ▸ h2.left
exact Nat.le_of_eq h5.symm
abbrev solution : ℕ := 153846
theorem imo1962_p1 : IsLeast {n | ProblemPredicate n} solution :=
⟨satisfied_by_153846, no_smaller_solutions⟩
end Imo1962P1
| true | Copyright (c) 2020 Kevin Lacker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Lacker
-/
import Mathlib
/-!
# International Mathematical Olympiad 1962, Problem 1
Find the smallest natural number $n$ which has the following properties:
(a) Its decimal representation has 6 as the last digit.
(b) If the last digit 6 is erased and placed in front of the remaining digits,
the resulting number is four times as large as the original number $n$.
-/
namespace Imo1962P1
open Nat
def ProblemPredicate (n : ℕ) : Prop :=
(digits 10 n).headI = 6 ∧ ofDigits 10 ((digits 10 n).tail.concat 6) = 4 * n
/-!
First, it's inconvenient to work with digits, so let's simplify them out of the problem.
-/
abbrev ProblemPredicate' (c n : ℕ) : Prop :=
n = 10 * c + 6 ∧ 6 * 10 ^ (digits 10 c).length + c = 4 * n
theorem without_digits {n : ℕ} (h1 : ProblemPredicate n) : ∃ c : ℕ, ProblemPredicate' c n := by
use n / 10
cases n with
| zero => have h2 : ¬ProblemPredicate 0 := by norm_num [ProblemPredicate]
contradiction
| succ n =>
rw [ProblemPredicate, digits_def' (by decide : 2 ≤ 10) n.succ_pos, List.headI, List.tail_cons,
List.concat_eq_append] at h1
constructor
· rw [← h1.left, div_add_mod (n + 1) 10]
· rw [← h1.right, ofDigits_append, ofDigits_digits, ofDigits_singleton, add_comm, mul_comm]
/-!
Now we can eliminate possibilities for `(digits 10 c).length` until we get to the one that works.
-/
theorem case_0_digit {c n : ℕ} (h1 : (digits 10 c).length = 0) : ¬ProblemPredicate' c n := by
intro h2
have h3 : 6 * 10 ^ 0 + c = 6 * 10 ^ (digits 10 c).length + c := by rw [h1]
omega
theorem case_1_digit {c n : ℕ} (h1 : (digits 10 c).length = 1) : ¬ProblemPredicate' c n := by
intro h2
have h3 : 6 * 10 ^ 1 + c = 6 * 10 ^ (digits 10 c).length + c := by rw [h1]
omega
theorem case_2_digit {c n : ℕ} (h1 : (digits 10 c).length = 2) : ¬ProblemPredicate' c n := by
intro h2
have h3 : 6 * 10 ^ 2 + c = 6 * 10 ^ (digits 10 c).length + c := by rw [h1]
omega
theorem case_3_digit {c n : ℕ} (h1 : (digits 10 c).length = 3) : ¬ProblemPredicate' c n := by
intro h2
have h3 : 6 * 10 ^ 3 + c = 6 * 10 ^ (digits 10 c).length + c := by rw [h1]
omega
theorem case_4_digit {c n : ℕ} (h1 : (digits 10 c).length = 4) : ¬ProblemPredicate' c n := by
intro h2
have h3 : 6 * 10 ^ 4 + c = 6 * 10 ^ (digits 10 c).length + c := by rw [h1]
omega
/-- Putting this inline causes a deep recursion error, so we separate it out. -/
theorem helper_5_digit {c : ℤ} (h : 6 * 10 ^ 5 + c = 4 * (10 * c + 6)) : c = 15384 := by linarith
theorem case_5_digit {c n : ℕ} (h1 : (digits 10 c).length = 5) (h2 : ProblemPredicate' c n) :
c = 15384 := by
have h3 : 6 * 10 ^ 5 + c = 6 * 10 ^ (digits 10 c).length + c := by rw [h1]
omega
/-- `linarith` fails on numbers this large, so this lemma spells out some of the arithmetic
that normally would be automated.
-/
theorem case_more_digits {c n : ℕ} (h1 : (digits 10 c).length ≥ 6) (h2 : ProblemPredicate' c n) :
n ≥ 153846 := by
have h3 : c ≠ 0 := by
intro h4
have h5 : (digits 10 c).length = 0 := by simp [h4]
exact case_0_digit h5 h2
calc
n ≥ 10 * c := le.intro h2.left.symm
_ ≥ 10 ^ (digits 10 c).length := (base_pow_length_digits_le 10 c (by decide) h3)
_ ≥ 10 ^ 6 := pow_le_pow_right₀ (by decide) h1
_ ≥ 153846 := by norm_num
/-!
Now we combine these cases to show that 153846 is the smallest solution.
-/
theorem satisfied_by_153846 : ProblemPredicate 153846 := by
norm_num [ProblemPredicate]
decide
theorem no_smaller_solutions (n : ℕ) (h1 : ProblemPredicate n) : n ≥ 153846 := by
have ⟨c, h2⟩ := without_digits h1
have h3 : (digits 10 c).length < 6 ∨ (digits 10 c).length ≥ 6 := by apply lt_or_ge
cases h3 with
| inr h3 => exact case_more_digits h3 h2
| inl h3 =>
interval_cases h : (digits 10 c).length
· exfalso; exact case_0_digit h h2
· exfalso; exact case_1_digit h h2
· exfalso; exact case_2_digit h h2
· exfalso; exact case_3_digit h h2
· exfalso; exact case_4_digit h h2
· have h4 : c = 15384 := case_5_digit h h2
have h5 : n = 10 * 15384 + 6 := h4 ▸ h2.left
exact Nat.le_of_eq h5.symm
abbrev solution : ℕ := 153846
theorem imo1962_p1 : IsLeast {n | ProblemPredicate n} solution :=
⟨satisfied_by_153846, no_smaller_solutions⟩
end Imo1962P1 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1962P1.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 120, "latency_s": 2.0913, "verified_at": "2026-03-30T14:38:26.360701+00:00"}} | true | true | false | 2.0913 |
compfiles_Imo1962P2 | compfiles | Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1962, Problem 2
Determine all real numbers x which satisfy
√(3 - x) - √(x + 1) > 1/2.
-/
namespace Imo1962P2
lemma lemma1 (x : ℝ) :
(15 / 8) ^ 2 - (3 - x) * (x + 1) =
(x - (1 + Real.sqrt 31/8)) * (x - (1 - Real.sqrt 31/8)) := by
grind
lemma lemma2 {x : ℝ} (hx4 : 0 ≤ 3 - x) (hx5 : 0 ≤ x + 1) :
(Real.sqrt (3 - x) - Real.sqrt (x + 1)) ^ 2 = 4 - 2 * Real.sqrt ((3 - x) * (x + 1)) :=
calc
(Real.sqrt (3 - x) - Real.sqrt (x + 1)) ^ 2
= Real.sqrt (3 - x) ^2 - 2 * Real.sqrt (3 - x) * Real.sqrt (x + 1)
+ Real.sqrt (x + 1) ^2 := sub_sq _ _
_ = (3 - x) - 2 * Real.sqrt (3 - x) * Real.sqrt (x + 1)
+ (x + 1) := by rw [Real.sq_sqrt hx4, add_left_cancel_iff, Real.sq_sqrt hx5]
_ = 4 - 2 * (Real.sqrt (3 - x) * Real.sqrt (x + 1)) := by ring
_ = 4 - 2 * Real.sqrt ((3 - x) * (x + 1)) := by rw[←Real.sqrt_mul hx4]
abbrev SolutionSet : Set ℝ := Set.Ico (-1) (1 - √31 / 8)
theorem imo1962_p2 (x : ℝ) :
x ∈ SolutionSet ↔
x ≤ 3 ∧ -1 ≤ x ∧ 1/2 < √(3 - x) - √(x + 1) := by
-- https://prase.cz/kalva/imo/isoln/isoln622.html
rw [Set.mem_Ico]
constructor
· rintro ⟨hx1, hx2⟩
have hx4 : x ≤ 3 := by
have h1 : 0 < Real.sqrt 31 / 8 := by positivity
linarith only [hx2, h1]
have hx4' : 0 ≤ 3 - x := sub_nonneg.mpr hx4
have hx1' : 0 ≤ x + 1 := neg_le_iff_add_nonneg.mp hx1
refine ⟨hx4, hx1, ?_⟩
· have h30 : 0 ≤ Real.sqrt 31 / 8 := by positivity
have h3 : x + 1 < 3 - x := by linarith
suffices H : (1 / 2)^2 < (Real.sqrt (3 - x) - Real.sqrt (x + 1))^2
· have h31 : 0 ≤ Real.sqrt (3 - x) - Real.sqrt (x + 1) := by
rw [sub_nonneg (α := ℝ)]
apply le_of_lt
exact Real.sqrt_lt_sqrt hx1' h3
exact lt_of_pow_lt_pow_left₀ 2 h31 H
rw [lemma2 hx4' hx1', lt_sub_comm]
suffices H : Real.sqrt ((3 - x) * (x + 1)) < 15 / 8 by
linarith only [H]
suffices H : (Real.sqrt ((3 - x) * (x + 1)))^2 < (15/8)^2 from
lt_of_pow_lt_pow_left₀ 2 (by norm_num) H
rw [Real.sq_sqrt (by positivity)]
suffices H : 0 < (15 / 8) ^ 2 - (3 - x) * (x + 1) from sub_pos.mp H
rw [lemma1 x]
nlinarith
rintro ⟨hx1, hx2, hx3⟩
refine ⟨hx2, ?_⟩
have h0 : (0:ℝ) ≤ (1:ℝ) / 2 := by norm_num
have h1 := pow_lt_pow_left₀ hx3 h0 two_ne_zero
have hx4 : 0 ≤ 3 - x := sub_nonneg.mpr hx1
have hx5 : 0 ≤ x + 1 := neg_le_iff_add_nonneg.mp hx2
rw [lemma2 hx4 hx5] at h1
have h3 : Real.sqrt ((3 - x) * (x + 1)) < 15 / 8 := by linarith only [h1]
have h4 : 0 ≤ Real.sqrt ((3 - x) * (x + 1)) := Real.sqrt_nonneg _
have h5 := pow_lt_pow_left₀ h3 h4 two_ne_zero
rw [Real.sq_sqrt (by positivity)] at h5
replace h5 : 0 < (15 / 8) ^ 2 - (3 - x) * (x + 1) := sub_pos.mpr h5
rw [lemma1 x] at h5
obtain ⟨h6a, h6b⟩ | ⟨_, h7b⟩ := mul_pos_iff.mp h5
· have h40 : Real.sqrt (3 - x) - Real.sqrt (x + 1) < 0 := by
have h3 : 3 - x < x + 1 := by linarith
rw [sub_neg]
exact Real.sqrt_lt_sqrt hx4 h3
linarith
· exact sub_neg.mp h7b
end Imo1962P2 | /- | /-
Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1962, Problem 2
Determine all real numbers x which satisfy
√(3 - x) - √(x + 1) > 1/2.
-/
namespace Imo1962P2
lemma lemma1 (x : ℝ) :
(15 / 8) ^ 2 - (3 - x) * (x + 1) =
(x - (1 + Real.sqrt 31/8)) * (x - (1 - Real.sqrt 31/8)) := by
grind
lemma lemma2 {x : ℝ} (hx4 : 0 ≤ 3 - x) (hx5 : 0 ≤ x + 1) :
(Real.sqrt (3 - x) - Real.sqrt (x + 1)) ^ 2 = 4 - 2 * Real.sqrt ((3 - x) * (x + 1)) :=
calc
(Real.sqrt (3 - x) - Real.sqrt (x + 1)) ^ 2
= Real.sqrt (3 - x) ^2 - 2 * Real.sqrt (3 - x) * Real.sqrt (x + 1)
+ Real.sqrt (x + 1) ^2 := sub_sq _ _
_ = (3 - x) - 2 * Real.sqrt (3 - x) * Real.sqrt (x + 1)
+ (x + 1) := by rw [Real.sq_sqrt hx4, add_left_cancel_iff, Real.sq_sqrt hx5]
_ = 4 - 2 * (Real.sqrt (3 - x) * Real.sqrt (x + 1)) := by ring
_ = 4 - 2 * Real.sqrt ((3 - x) * (x + 1)) := by rw[←Real.sqrt_mul hx4]
abbrev SolutionSet : Set ℝ := Set.Ico (-1) (1 - √31 / 8)
theorem imo1962_p2 (x : ℝ) :
x ∈ SolutionSet ↔
x ≤ 3 ∧ -1 ≤ x ∧ 1/2 < √(3 - x) - √(x + 1) := by
-- https://prase.cz/kalva/imo/isoln/isoln622.html
rw [Set.mem_Ico]
constructor
· rintro ⟨hx1, hx2⟩
have hx4 : x ≤ 3 := by
have h1 : 0 < Real.sqrt 31 / 8 := by positivity
linarith only [hx2, h1]
have hx4' : 0 ≤ 3 - x := sub_nonneg.mpr hx4
have hx1' : 0 ≤ x + 1 := neg_le_iff_add_nonneg.mp hx1
refine ⟨hx4, hx1, ?_⟩
· have h30 : 0 ≤ Real.sqrt 31 / 8 := by positivity
have h3 : x + 1 < 3 - x := by linarith
suffices H : (1 / 2)^2 < (Real.sqrt (3 - x) - Real.sqrt (x + 1))^2
· have h31 : 0 ≤ Real.sqrt (3 - x) - Real.sqrt (x + 1) := by
rw [sub_nonneg (α := ℝ)]
apply le_of_lt
exact Real.sqrt_lt_sqrt hx1' h3
exact lt_of_pow_lt_pow_left₀ 2 h31 H
rw [lemma2 hx4' hx1', lt_sub_comm]
suffices H : Real.sqrt ((3 - x) * (x + 1)) < 15 / 8 by
linarith only [H]
suffices H : (Real.sqrt ((3 - x) * (x + 1)))^2 < (15/8)^2 from
lt_of_pow_lt_pow_left₀ 2 (by norm_num) H
rw [Real.sq_sqrt (by positivity)]
suffices H : 0 < (15 / 8) ^ 2 - (3 - x) * (x + 1) from sub_pos.mp H
rw [lemma1 x]
nlinarith
rintro ⟨hx1, hx2, hx3⟩
refine ⟨hx2, ?_⟩
have h0 : (0:ℝ) ≤ (1:ℝ) / 2 := by norm_num
have h1 := pow_lt_pow_left₀ hx3 h0 two_ne_zero
have hx4 : 0 ≤ 3 - x := sub_nonneg.mpr hx1
have hx5 : 0 ≤ x + 1 := neg_le_iff_add_nonneg.mp hx2
rw [lemma2 hx4 hx5] at h1
have h3 : Real.sqrt ((3 - x) * (x + 1)) < 15 / 8 := by linarith only [h1]
have h4 : 0 ≤ Real.sqrt ((3 - x) * (x + 1)) := Real.sqrt_nonneg _
have h5 := pow_lt_pow_left₀ h3 h4 two_ne_zero
rw [Real.sq_sqrt (by positivity)] at h5
replace h5 : 0 < (15 / 8) ^ 2 - (3 - x) * (x + 1) := sub_pos.mpr h5
rw [lemma1 x] at h5
obtain ⟨h6a, h6b⟩ | ⟨_, h7b⟩ := mul_pos_iff.mp h5
· have h40 : Real.sqrt (3 - x) - Real.sqrt (x + 1) < 0 := by
have h3 : 3 - x < x + 1 := by linarith
rw [sub_neg]
exact Real.sqrt_lt_sqrt hx4 h3
linarith
· exact sub_neg.mp h7b
end Imo1962P2
| true | Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1962, Problem 2
Determine all real numbers x which satisfy
√(3 - x) - √(x + 1) > 1/2.
-/
namespace Imo1962P2
lemma lemma1 (x : ℝ) :
(15 / 8) ^ 2 - (3 - x) * (x + 1) =
(x - (1 + Real.sqrt 31/8)) * (x - (1 - Real.sqrt 31/8)) := by
grind
lemma lemma2 {x : ℝ} (hx4 : 0 ≤ 3 - x) (hx5 : 0 ≤ x + 1) :
(Real.sqrt (3 - x) - Real.sqrt (x + 1)) ^ 2 = 4 - 2 * Real.sqrt ((3 - x) * (x + 1)) :=
calc
(Real.sqrt (3 - x) - Real.sqrt (x + 1)) ^ 2
= Real.sqrt (3 - x) ^2 - 2 * Real.sqrt (3 - x) * Real.sqrt (x + 1)
+ Real.sqrt (x + 1) ^2 := sub_sq _ _
_ = (3 - x) - 2 * Real.sqrt (3 - x) * Real.sqrt (x + 1)
+ (x + 1) := by rw [Real.sq_sqrt hx4, add_left_cancel_iff, Real.sq_sqrt hx5]
_ = 4 - 2 * (Real.sqrt (3 - x) * Real.sqrt (x + 1)) := by ring
_ = 4 - 2 * Real.sqrt ((3 - x) * (x + 1)) := by rw[←Real.sqrt_mul hx4]
abbrev SolutionSet : Set ℝ := Set.Ico (-1) (1 - √31 / 8)
theorem imo1962_p2 (x : ℝ) :
x ∈ SolutionSet ↔
x ≤ 3 ∧ -1 ≤ x ∧ 1/2 < √(3 - x) - √(x + 1) := by
-- https://prase.cz/kalva/imo/isoln/isoln622.html
rw [Set.mem_Ico]
constructor
· rintro ⟨hx1, hx2⟩
have hx4 : x ≤ 3 := by
have h1 : 0 < Real.sqrt 31 / 8 := by positivity
linarith only [hx2, h1]
have hx4' : 0 ≤ 3 - x := sub_nonneg.mpr hx4
have hx1' : 0 ≤ x + 1 := neg_le_iff_add_nonneg.mp hx1
refine ⟨hx4, hx1, ?_⟩
· have h30 : 0 ≤ Real.sqrt 31 / 8 := by positivity
have h3 : x + 1 < 3 - x := by linarith
suffices H : (1 / 2)^2 < (Real.sqrt (3 - x) - Real.sqrt (x + 1))^2
· have h31 : 0 ≤ Real.sqrt (3 - x) - Real.sqrt (x + 1) := by
rw [sub_nonneg (α := ℝ)]
apply le_of_lt
exact Real.sqrt_lt_sqrt hx1' h3
exact lt_of_pow_lt_pow_left₀ 2 h31 H
rw [lemma2 hx4' hx1', lt_sub_comm]
suffices H : Real.sqrt ((3 - x) * (x + 1)) < 15 / 8 by
linarith only [H]
suffices H : (Real.sqrt ((3 - x) * (x + 1)))^2 < (15/8)^2 from
lt_of_pow_lt_pow_left₀ 2 (by norm_num) H
rw [Real.sq_sqrt (by positivity)]
suffices H : 0 < (15 / 8) ^ 2 - (3 - x) * (x + 1) from sub_pos.mp H
rw [lemma1 x]
nlinarith
rintro ⟨hx1, hx2, hx3⟩
refine ⟨hx2, ?_⟩
have h0 : (0:ℝ) ≤ (1:ℝ) / 2 := by norm_num
have h1 := pow_lt_pow_left₀ hx3 h0 two_ne_zero
have hx4 : 0 ≤ 3 - x := sub_nonneg.mpr hx1
have hx5 : 0 ≤ x + 1 := neg_le_iff_add_nonneg.mp hx2
rw [lemma2 hx4 hx5] at h1
have h3 : Real.sqrt ((3 - x) * (x + 1)) < 15 / 8 := by linarith only [h1]
have h4 : 0 ≤ Real.sqrt ((3 - x) * (x + 1)) := Real.sqrt_nonneg _
have h5 := pow_lt_pow_left₀ h3 h4 two_ne_zero
rw [Real.sq_sqrt (by positivity)] at h5
replace h5 : 0 < (15 / 8) ^ 2 - (3 - x) * (x + 1) := sub_pos.mpr h5
rw [lemma1 x] at h5
obtain ⟨h6a, h6b⟩ | ⟨_, h7b⟩ := mul_pos_iff.mp h5
· have h40 : Real.sqrt (3 - x) - Real.sqrt (x + 1) < 0 := by
have h3 : 3 - x < x + 1 := by linarith
rw [sub_neg]
exact Real.sqrt_lt_sqrt hx4 h3
linarith
· exact sub_neg.mp h7b
end Imo1962P2 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1962P2.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["`grind` failed\ncase grind\nx : \u211d\nh : \u00ac(15 / 8) ^ 2 - (3 - x) * (x + 1) = (x - (1 + \u221a31 / 8)) * (x - (1 - \u221a31 / 8))\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] \u00ac(15 / 8) ^ 2 - (3 - x) * (x + 1) = (x - (1 + \u221a31 / 8)) * (x - (1 - \u221a31 / 8))\n [eqc] True propositions\n [prop] (29 + 2).AtLeastTwo\n [prop] (1 + 2).AtLeastTwo\n [prop] (6 + 2).AtLeastTwo\n [prop] (13 + 2).AtLeastTwo\n [eqc] False propositions\n [prop] (15 / 8) ^ 2 - (3 - x) * (x + 1) = (x - (1 + \u221a31 / 8)) * (x - (1 - \u221a31 / 8))\n [cutsat] Assignment satisfying linear constraints\n [assign] 1 := 1\n [assign] 3 := 3\n [assign] 8 := 8\n [assign] 15 := 15\n [assign] 31 := 31\n [ring] Ring `\u211d`\n [diseqs] Disequalities\n [_] \u00ac(15 / 8) ^ 2 + (\u221a31 / 8) ^ 2 + -4 = 0"], "timeout_s": 600.0, "latency_s": 2.5601, "verified_at": "2026-03-26T18:16:10.588628+00:00"}} | false | true | false | 2.5601 |
compfiles_Imo1962P4 | compfiles | Copyright (c) 2020 Kevin Lacker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Lacker, Heather Macbeth
-/
import Mathlib
/-!
# International Mathematics Olympiad 1962, Problem 4
Solve the equation
cos² x + cos² (2 * x) + cos² (3 * x) = 1.
-/
open Real
namespace Imo1962P4
def ProblemEquation (x : ℝ) : Prop :=
cos x ^ 2 + cos (2 * x) ^ 2 + cos (3 * x) ^ 2 = 1
abbrev solutionSet : Set ℝ :=
{x : ℝ | ∃ k : ℤ, x = (2 * ↑k + 1) * π / 4 ∨ x = (2 * ↑k + 1) * π / 6}
noncomputable section
/-
The key to solving this problem simply is that we can rewrite the equation as
a product of terms, shown in `alt_formula`, being equal to zero.
-/
def altFormula (x : ℝ) : ℝ :=
cos x * (cos x ^ 2 - 1 / 2) * cos (3 * x)
theorem cos_sum_equiv {x : ℝ} :
(cos x ^ 2 + cos (2 * x) ^ 2 + cos (3 * x) ^ 2 - 1) / 4 = altFormula x := by
simp only [Real.cos_two_mul, cos_three_mul, altFormula]
ring
theorem alt_equiv {x : ℝ} : ProblemEquation x ↔ altFormula x = 0 := by
rw [ProblemEquation, ← cos_sum_equiv, div_eq_zero_iff, sub_eq_zero]
norm_num
theorem finding_zeros {x : ℝ} : altFormula x = 0 ↔ cos x ^ 2 = 1 / 2 ∨ cos (3 * x) = 0 := by
simp only [altFormula, mul_assoc, mul_eq_zero, sub_eq_zero]
constructor
· rintro (h1 | h2)
· right
rw [cos_three_mul, h1]
ring
· exact h2
· exact Or.inr
/-
Now we can solve for `x` using basic-ish trigonometry.
-/
theorem solve_cos2_half {x : ℝ} : cos x ^ 2 = 1 / 2 ↔ ∃ k : ℤ, x = (2 * ↑k + 1) * π / 4 := by
rw [cos_sq]
simp only [add_eq_left, div_eq_zero_iff]
norm_num
rw [cos_eq_zero_iff]
constructor <;>
· rintro ⟨k, h⟩
use k
linarith
theorem solve_cos3x_0 {x : ℝ} : cos (3 * x) = 0 ↔ ∃ k : ℤ, x = (2 * ↑k + 1) * π / 6 := by
rw [cos_eq_zero_iff]
refine exists_congr fun k => ?_
constructor <;> intro <;> linarith
end
/-
The final theorem is now just gluing together our lemmas.
-/
theorem imo1962_p4 {x : ℝ} : ProblemEquation x ↔ x ∈ solutionSet := by
rw [alt_equiv, finding_zeros, solve_cos3x_0, solve_cos2_half]
exact exists_or.symm
end Imo1962P4 | /- | /-
Copyright (c) 2020 Kevin Lacker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Lacker, Heather Macbeth
-/
import Mathlib
/-!
# International Mathematics Olympiad 1962, Problem 4
Solve the equation
cos² x + cos² (2 * x) + cos² (3 * x) = 1.
-/
open Real
namespace Imo1962P4
def ProblemEquation (x : ℝ) : Prop :=
cos x ^ 2 + cos (2 * x) ^ 2 + cos (3 * x) ^ 2 = 1
abbrev solutionSet : Set ℝ :=
{x : ℝ | ∃ k : ℤ, x = (2 * ↑k + 1) * π / 4 ∨ x = (2 * ↑k + 1) * π / 6}
noncomputable section
/-
The key to solving this problem simply is that we can rewrite the equation as
a product of terms, shown in `alt_formula`, being equal to zero.
-/
def altFormula (x : ℝ) : ℝ :=
cos x * (cos x ^ 2 - 1 / 2) * cos (3 * x)
theorem cos_sum_equiv {x : ℝ} :
(cos x ^ 2 + cos (2 * x) ^ 2 + cos (3 * x) ^ 2 - 1) / 4 = altFormula x := by
simp only [Real.cos_two_mul, cos_three_mul, altFormula]
ring
theorem alt_equiv {x : ℝ} : ProblemEquation x ↔ altFormula x = 0 := by
rw [ProblemEquation, ← cos_sum_equiv, div_eq_zero_iff, sub_eq_zero]
norm_num
theorem finding_zeros {x : ℝ} : altFormula x = 0 ↔ cos x ^ 2 = 1 / 2 ∨ cos (3 * x) = 0 := by
simp only [altFormula, mul_assoc, mul_eq_zero, sub_eq_zero]
constructor
· rintro (h1 | h2)
· right
rw [cos_three_mul, h1]
ring
· exact h2
· exact Or.inr
/-
Now we can solve for `x` using basic-ish trigonometry.
-/
theorem solve_cos2_half {x : ℝ} : cos x ^ 2 = 1 / 2 ↔ ∃ k : ℤ, x = (2 * ↑k + 1) * π / 4 := by
rw [cos_sq]
simp only [add_eq_left, div_eq_zero_iff]
norm_num
rw [cos_eq_zero_iff]
constructor <;>
· rintro ⟨k, h⟩
use k
linarith
theorem solve_cos3x_0 {x : ℝ} : cos (3 * x) = 0 ↔ ∃ k : ℤ, x = (2 * ↑k + 1) * π / 6 := by
rw [cos_eq_zero_iff]
refine exists_congr fun k => ?_
constructor <;> intro <;> linarith
end
/-
The final theorem is now just gluing together our lemmas.
-/
theorem imo1962_p4 {x : ℝ} : ProblemEquation x ↔ x ∈ solutionSet := by
rw [alt_equiv, finding_zeros, solve_cos3x_0, solve_cos2_half]
exact exists_or.symm
end Imo1962P4
| true | Copyright (c) 2020 Kevin Lacker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Lacker, Heather Macbeth
-/
import Mathlib
/-!
# International Mathematics Olympiad 1962, Problem 4
Solve the equation
cos² x + cos² (2 * x) + cos² (3 * x) = 1.
-/
open Real
namespace Imo1962P4
def ProblemEquation (x : ℝ) : Prop :=
cos x ^ 2 + cos (2 * x) ^ 2 + cos (3 * x) ^ 2 = 1
abbrev solutionSet : Set ℝ :=
{x : ℝ | ∃ k : ℤ, x = (2 * ↑k + 1) * π / 4 ∨ x = (2 * ↑k + 1) * π / 6}
noncomputable section
/-
The key to solving this problem simply is that we can rewrite the equation as
a product of terms, shown in `alt_formula`, being equal to zero.
-/
def altFormula (x : ℝ) : ℝ :=
cos x * (cos x ^ 2 - 1 / 2) * cos (3 * x)
theorem cos_sum_equiv {x : ℝ} :
(cos x ^ 2 + cos (2 * x) ^ 2 + cos (3 * x) ^ 2 - 1) / 4 = altFormula x := by
simp only [Real.cos_two_mul, cos_three_mul, altFormula]
ring
theorem alt_equiv {x : ℝ} : ProblemEquation x ↔ altFormula x = 0 := by
rw [ProblemEquation, ← cos_sum_equiv, div_eq_zero_iff, sub_eq_zero]
norm_num
theorem finding_zeros {x : ℝ} : altFormula x = 0 ↔ cos x ^ 2 = 1 / 2 ∨ cos (3 * x) = 0 := by
simp only [altFormula, mul_assoc, mul_eq_zero, sub_eq_zero]
constructor
· rintro (h1 | h2)
· right
rw [cos_three_mul, h1]
ring
· exact h2
· exact Or.inr
/-
Now we can solve for `x` using basic-ish trigonometry.
-/
theorem solve_cos2_half {x : ℝ} : cos x ^ 2 = 1 / 2 ↔ ∃ k : ℤ, x = (2 * ↑k + 1) * π / 4 := by
rw [cos_sq]
simp only [add_eq_left, div_eq_zero_iff]
norm_num
rw [cos_eq_zero_iff]
constructor <;>
· rintro ⟨k, h⟩
use k
linarith
theorem solve_cos3x_0 {x : ℝ} : cos (3 * x) = 0 ↔ ∃ k : ℤ, x = (2 * ↑k + 1) * π / 6 := by
rw [cos_eq_zero_iff]
refine exists_congr fun k => ?_
constructor <;> intro <;> linarith
end
/-
The final theorem is now just gluing together our lemmas.
-/
theorem imo1962_p4 {x : ℝ} : ProblemEquation x ↔ x ∈ solutionSet := by
rw [alt_equiv, finding_zeros, solve_cos3x_0, solve_cos2_half]
exact exists_or.symm
end Imo1962P4 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1962P4.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown identifier 'cos'", "unknown identifier 'cos'", "unknown identifier 'cos'", "unknown identifier '\u03c0'", "unknown identifier '\u03c0'", "unknown identifier 'cos'", "unknown identifier 'cos'", "unknown identifier 'cos'", "function expected at\n cos\nterm has type\n ?m.10057", "function expected at\n cos\nterm has type\n ?m.10057", "function expected at\n cos\nterm has type\n ?m.10057", "unknown identifier 'cos_three_mul'", "Try this: ring_nf", "unsolved goals\nx\u271d : Sort u_1\ncos : x\u271d\nx : \u211d\n\u22a2 -1 / 4 + sorry ^ 2 * (3 / 4) = sorry ^ 2 * (-1 / 2) + sorry ^ 4", "unsolved goals\nx : \u211d\n\u22a2 sorry () ^ 2 + sorry () ^ 2 + sorry () ^ 2 = 1 \u2194 sorry () ^ 2 + sorry () ^ 2 + sorry () ^ 2 = 1\n\nx : \u211d\n\u22a2 Sort ?u.18629\n\nx : \u211d\n\u22a2 ?m.18630", "function expected at\n cos\nterm has type\n ?m.20476", "function expected at\n cos\nterm has type\n ?m.20476", "unknown identifier 'cos_three_mul'", "function expected at\n cos\nterm has type\n ?m.25804", "unknown identifier 'cos_sq'", "unsolved goals\nx\u271d : Sort u_1\ncos : x\u271d\n\u03c0 x : \u211d\n\u22a2 sorry ^ 2 = 1 / 2 \u2194 \u2203 k, x = (2 * \u2191k + 1) * \u03c0 / 4", "function expected at\n cos\nterm has type\n ?m.29071", "unknown identifier 'cos_eq_zero_iff'", "unsolved goals\nx\u271d : Sort u_1\ncos : x\u271d\n\u03c0 x : \u211d\n\u22a2 sorry = 0 \u2194 \u2203 k, x = (2 * \u2191k + 1) * \u03c0 / 6", "unsolved goals\nx : \u211d\n\u22a2 Sort ?u.30277\n\nx : \u211d\n\u22a2 ?m.30278\n\nx : \u211d\n\u22a2 Sort ?u.30251\n\nx : \u211d\n\u22a2 ?m.30252\n\nx : \u211d\n\u22a2 Sort ?u.30240\n\nx : \u211d\n\u22a2 ?m.30241"], "timeout_s": 600.0, "latency_s": 0.7208, "verified_at": "2026-03-26T18:16:09.311765+00:00"}} | false | true | false | 0.7208 |
compfiles_Imo1963P1 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Hongyu Ouyang
-/
import Mathlib
/-!
# International Mathematical Olympiad 1963, Problem 1
Find all real roots of the equation
√(x²-p) + 2√(x²-1) = x
where *p* is a real parameter.
-/
namespace Imo1963P1
lemma iff_comm {a b c : Prop} : (a → c) → (b → c) → (c → (a ↔ b)) → (a ↔ b) := by
grind
abbrev f (p : ℝ) : Set ℝ :=
if p ≥ 0 ∧ p ≤ (4 : ℝ) / 3
then { (4 - p) / (2 * Real.sqrt (4 - 2 * p)) }
else ∅
theorem imo1963_p1 : ∀ (p x : ℝ), (x ^ 2 - p) ≥ 0 → (x ^ 2 - 1) ≥ 0 →
(Real.sqrt (x ^ 2 - p) + 2 * Real.sqrt (x ^ 2 - 1) = x ↔ (x ∈ f p)) := by
intro p x h1 h2
simp only [f, ge_iff_le, Set.mem_ite_empty_right, Set.mem_singleton_iff]
apply @iff_comm (c := x ≥ 0)
· intro h; rw [←h]; positivity
· rintro ⟨⟨-, hx12⟩, rfl⟩
apply le_of_lt
apply div_pos_iff.mpr
left
constructor
· linarith
· simp only [Nat.ofNat_pos, mul_pos_iff_of_pos_left, Real.sqrt_pos]
linarith
intro xge0
trans (Real.sqrt (x ^ 2 - p) + 2 * Real.sqrt (x ^ 2 - 1)) ^ 2 = x ^ 2
· refine Iff.symm (sq_eq_sq₀ ?ha ?hb) <;> positivity
rw [add_sq]
rw [Real.sq_sqrt h1]
rw [mul_pow]
rw [Real.sq_sqrt h2]
trans Real.sqrt (x ^ 2 - p) * Real.sqrt (x ^ 2 - 1) = (p + 4 - 4 * x ^ 2) / (4 : ℝ)
· constructor
· intro h; linear_combination (1 / (4 : ℝ)) * h
· intro h; linear_combination (4 : ℝ) * h
apply @iff_comm (c := p + 4 - 4 * x ^ 2 ≥ 0)
· intro h; rw [ge_iff_le]
apply (div_le_div_iff_of_pos_right (by norm_num : (0 : ℝ) < (4 : ℝ))).mp
norm_num; rw [←h]; positivity
· rintro ⟨hx, rfl⟩
have tmp : 0 < (4 - 2 * p) := by linarith only [hx]
rw [div_pow, mul_pow, Real.sq_sqrt (le_of_lt tmp)]; norm_num
rw [←mul_le_mul_iff_left₀ tmp, mul_assoc, div_mul]
have := tmp.ne.symm
rw [mul_div_cancel_right₀ _ tmp.ne.symm]
nlinarith
intro xp
trans (Real.sqrt (x ^ 2 - p) * Real.sqrt (x ^ 2 - (1 : ℝ))) ^ 2 =
((p + (4 : ℝ) - (4 : ℝ) * x ^ 2) / (4 : ℝ)) ^ 2
· symm; apply sq_eq_sq₀ <;> positivity
rw [mul_pow, Real.sq_sqrt h1, Real.sq_sqrt h2]
rw [div_pow]
norm_num
conv => lhs; rw [←mul_right_cancel_iff_of_pos (by norm_num : (0 : ℝ) < (16 : ℝ))]; norm_num
rw [sub_sq, mul_pow, ←pow_mul];
simp only [mul_add, add_mul, mul_sub_left_distrib, mul_sub_right_distrib]; norm_num
rw [←pow_add]; norm_num
trans x ^ 2 * 4 * (4 - 2 * p) = (p - 4) ^ 2
· constructor
· intro h; linear_combination (norm := (field_simp; ring_nf)) 1 * h
· intro h; linear_combination (norm := (field_simp; ring_nf)) 1 * h
apply @iff_comm (c := p < 2)
· intro; linarith
· intro ⟨⟨_, _⟩, _⟩; linarith
intro hp
have tmp : (4 - 2 * p) > 0 := by linarith
trans x ^ 2 = (p - 4) ^ 2 / (4 * (4 - 2 * p))
· field_simp
rw [(by ring : (p - (4 : ℝ)) ^ (2 : ℕ) = ((4 : ℝ) - p) ^ (2 : ℕ))]
have tmp2 :
((4 : ℝ) - p) ^ (2 : ℕ) / ((4 : ℝ) * ((4 : ℝ) - (2 : ℝ) * p)) =
(((4 : ℝ) - p) / ((2 : ℝ) * Real.sqrt ((4 : ℝ) - (2 : ℝ) * p))) ^ 2 := by
rw [div_pow, mul_pow, Real.sq_sqrt]
· norm_num
· exact le_of_lt tmp
rw [tmp2,
sq_eq_sq₀ xge0 (le_of_lt
(by apply div_pos
· linarith
positivity))]
constructor
· intro hx
refine ⟨?_, hx⟩
rw [hx, ←tmp2] at xp
simp only [ge_iff_le, sub_nonneg] at xp
rw [←mul_le_mul_iff_left₀ (by positivity : (0 < ((4 : ℝ) * ((4 : ℝ) - (2 : ℝ) * p))))] at xp
rw [mul_div] at xp
rw [div_mul_cancel₀ _ (by positivity)] at xp
ring_nf at xp
rw [pow_two] at xp
by_cases hp2 : p ≤ (4 / 3 : ℝ)
· refine ⟨?_, hp2⟩
nlinarith only [xp, hp2]
· nlinarith only [xp, hp2]
· intro ⟨_, hx⟩; exact hx
end Imo1963P1 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Hongyu Ouyang
-/
import Mathlib
/-!
# International Mathematical Olympiad 1963, Problem 1
Find all real roots of the equation
√(x²-p) + 2√(x²-1) = x
where *p* is a real parameter.
-/
namespace Imo1963P1
lemma iff_comm {a b c : Prop} : (a → c) → (b → c) → (c → (a ↔ b)) → (a ↔ b) := by
grind
abbrev f (p : ℝ) : Set ℝ :=
if p ≥ 0 ∧ p ≤ (4 : ℝ) / 3
then { (4 - p) / (2 * Real.sqrt (4 - 2 * p)) }
else ∅
theorem imo1963_p1 : ∀ (p x : ℝ), (x ^ 2 - p) ≥ 0 → (x ^ 2 - 1) ≥ 0 →
(Real.sqrt (x ^ 2 - p) + 2 * Real.sqrt (x ^ 2 - 1) = x ↔ (x ∈ f p)) := by
intro p x h1 h2
simp only [f, ge_iff_le, Set.mem_ite_empty_right, Set.mem_singleton_iff]
apply @iff_comm (c := x ≥ 0)
· intro h; rw [←h]; positivity
· rintro ⟨⟨-, hx12⟩, rfl⟩
apply le_of_lt
apply div_pos_iff.mpr
left
constructor
· linarith
· simp only [Nat.ofNat_pos, mul_pos_iff_of_pos_left, Real.sqrt_pos]
linarith
intro xge0
trans (Real.sqrt (x ^ 2 - p) + 2 * Real.sqrt (x ^ 2 - 1)) ^ 2 = x ^ 2
· refine Iff.symm (sq_eq_sq₀ ?ha ?hb) <;> positivity
rw [add_sq]
rw [Real.sq_sqrt h1]
rw [mul_pow]
rw [Real.sq_sqrt h2]
trans Real.sqrt (x ^ 2 - p) * Real.sqrt (x ^ 2 - 1) = (p + 4 - 4 * x ^ 2) / (4 : ℝ)
· constructor
· intro h; linear_combination (1 / (4 : ℝ)) * h
· intro h; linear_combination (4 : ℝ) * h
apply @iff_comm (c := p + 4 - 4 * x ^ 2 ≥ 0)
· intro h; rw [ge_iff_le]
apply (div_le_div_iff_of_pos_right (by norm_num : (0 : ℝ) < (4 : ℝ))).mp
norm_num; rw [←h]; positivity
· rintro ⟨hx, rfl⟩
have tmp : 0 < (4 - 2 * p) := by linarith only [hx]
rw [div_pow, mul_pow, Real.sq_sqrt (le_of_lt tmp)]; norm_num
rw [←mul_le_mul_iff_left₀ tmp, mul_assoc, div_mul]
have := tmp.ne.symm
rw [mul_div_cancel_right₀ _ tmp.ne.symm]
nlinarith
intro xp
trans (Real.sqrt (x ^ 2 - p) * Real.sqrt (x ^ 2 - (1 : ℝ))) ^ 2 =
((p + (4 : ℝ) - (4 : ℝ) * x ^ 2) / (4 : ℝ)) ^ 2
· symm; apply sq_eq_sq₀ <;> positivity
rw [mul_pow, Real.sq_sqrt h1, Real.sq_sqrt h2]
rw [div_pow]
norm_num
conv => lhs; rw [←mul_right_cancel_iff_of_pos (by norm_num : (0 : ℝ) < (16 : ℝ))]; norm_num
rw [sub_sq, mul_pow, ←pow_mul];
simp only [mul_add, add_mul, mul_sub_left_distrib, mul_sub_right_distrib]; norm_num
rw [←pow_add]; norm_num
trans x ^ 2 * 4 * (4 - 2 * p) = (p - 4) ^ 2
· constructor
· intro h; linear_combination (norm := (field_simp; ring_nf)) 1 * h
· intro h; linear_combination (norm := (field_simp; ring_nf)) 1 * h
apply @iff_comm (c := p < 2)
· intro; linarith
· intro ⟨⟨_, _⟩, _⟩; linarith
intro hp
have tmp : (4 - 2 * p) > 0 := by linarith
trans x ^ 2 = (p - 4) ^ 2 / (4 * (4 - 2 * p))
· field_simp
rw [(by ring : (p - (4 : ℝ)) ^ (2 : ℕ) = ((4 : ℝ) - p) ^ (2 : ℕ))]
have tmp2 :
((4 : ℝ) - p) ^ (2 : ℕ) / ((4 : ℝ) * ((4 : ℝ) - (2 : ℝ) * p)) =
(((4 : ℝ) - p) / ((2 : ℝ) * Real.sqrt ((4 : ℝ) - (2 : ℝ) * p))) ^ 2 := by
rw [div_pow, mul_pow, Real.sq_sqrt]
· norm_num
· exact le_of_lt tmp
rw [tmp2,
sq_eq_sq₀ xge0 (le_of_lt
(by apply div_pos
· linarith
positivity))]
constructor
· intro hx
refine ⟨?_, hx⟩
rw [hx, ←tmp2] at xp
simp only [ge_iff_le, sub_nonneg] at xp
rw [←mul_le_mul_iff_left₀ (by positivity : (0 < ((4 : ℝ) * ((4 : ℝ) - (2 : ℝ) * p))))] at xp
rw [mul_div] at xp
rw [div_mul_cancel₀ _ (by positivity)] at xp
ring_nf at xp
rw [pow_two] at xp
by_cases hp2 : p ≤ (4 / 3 : ℝ)
· refine ⟨?_, hp2⟩
nlinarith only [xp, hp2]
· nlinarith only [xp, hp2]
· intro ⟨_, hx⟩; exact hx
end Imo1963P1
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Hongyu Ouyang
-/
import Mathlib
/-!
# International Mathematical Olympiad 1963, Problem 1
Find all real roots of the equation
√(x²-p) + 2√(x²-1) = x
where *p* is a real parameter.
-/
namespace Imo1963P1
lemma iff_comm {a b c : Prop} : (a → c) → (b → c) → (c → (a ↔ b)) → (a ↔ b) := by
grind
abbrev f (p : ℝ) : Set ℝ :=
if p ≥ 0 ∧ p ≤ (4 : ℝ) / 3
then { (4 - p) / (2 * Real.sqrt (4 - 2 * p)) }
else ∅
theorem imo1963_p1 : ∀ (p x : ℝ), (x ^ 2 - p) ≥ 0 → (x ^ 2 - 1) ≥ 0 →
(Real.sqrt (x ^ 2 - p) + 2 * Real.sqrt (x ^ 2 - 1) = x ↔ (x ∈ f p)) := by
intro p x h1 h2
simp only [f, ge_iff_le, Set.mem_ite_empty_right, Set.mem_singleton_iff]
apply @iff_comm (c := x ≥ 0)
· intro h; rw [←h]; positivity
· rintro ⟨⟨-, hx12⟩, rfl⟩
apply le_of_lt
apply div_pos_iff.mpr
left
constructor
· linarith
· simp only [Nat.ofNat_pos, mul_pos_iff_of_pos_left, Real.sqrt_pos]
linarith
intro xge0
trans (Real.sqrt (x ^ 2 - p) + 2 * Real.sqrt (x ^ 2 - 1)) ^ 2 = x ^ 2
· refine Iff.symm (sq_eq_sq₀ ?ha ?hb) <;> positivity
rw [add_sq]
rw [Real.sq_sqrt h1]
rw [mul_pow]
rw [Real.sq_sqrt h2]
trans Real.sqrt (x ^ 2 - p) * Real.sqrt (x ^ 2 - 1) = (p + 4 - 4 * x ^ 2) / (4 : ℝ)
· constructor
· intro h; linear_combination (1 / (4 : ℝ)) * h
· intro h; linear_combination (4 : ℝ) * h
apply @iff_comm (c := p + 4 - 4 * x ^ 2 ≥ 0)
· intro h; rw [ge_iff_le]
apply (div_le_div_iff_of_pos_right (by norm_num : (0 : ℝ) < (4 : ℝ))).mp
norm_num; rw [←h]; positivity
· rintro ⟨hx, rfl⟩
have tmp : 0 < (4 - 2 * p) := by linarith only [hx]
rw [div_pow, mul_pow, Real.sq_sqrt (le_of_lt tmp)]; norm_num
rw [←mul_le_mul_iff_left₀ tmp, mul_assoc, div_mul]
have := tmp.ne.symm
rw [mul_div_cancel_right₀ _ tmp.ne.symm]
nlinarith
intro xp
trans (Real.sqrt (x ^ 2 - p) * Real.sqrt (x ^ 2 - (1 : ℝ))) ^ 2 =
((p + (4 : ℝ) - (4 : ℝ) * x ^ 2) / (4 : ℝ)) ^ 2
· symm; apply sq_eq_sq₀ <;> positivity
rw [mul_pow, Real.sq_sqrt h1, Real.sq_sqrt h2]
rw [div_pow]
norm_num
conv => lhs; rw [←mul_right_cancel_iff_of_pos (by norm_num : (0 : ℝ) < (16 : ℝ))]; norm_num
rw [sub_sq, mul_pow, ←pow_mul];
simp only [mul_add, add_mul, mul_sub_left_distrib, mul_sub_right_distrib]; norm_num
rw [←pow_add]; norm_num
trans x ^ 2 * 4 * (4 - 2 * p) = (p - 4) ^ 2
· constructor
· intro h; linear_combination (norm := (field_simp; ring_nf)) 1 * h
· intro h; linear_combination (norm := (field_simp; ring_nf)) 1 * h
apply @iff_comm (c := p < 2)
· intro; linarith
· intro ⟨⟨_, _⟩, _⟩; linarith
intro hp
have tmp : (4 - 2 * p) > 0 := by linarith
trans x ^ 2 = (p - 4) ^ 2 / (4 * (4 - 2 * p))
· field_simp
rw [(by ring : (p - (4 : ℝ)) ^ (2 : ℕ) = ((4 : ℝ) - p) ^ (2 : ℕ))]
have tmp2 :
((4 : ℝ) - p) ^ (2 : ℕ) / ((4 : ℝ) * ((4 : ℝ) - (2 : ℝ) * p)) =
(((4 : ℝ) - p) / ((2 : ℝ) * Real.sqrt ((4 : ℝ) - (2 : ℝ) * p))) ^ 2 := by
rw [div_pow, mul_pow, Real.sq_sqrt]
· norm_num
· exact le_of_lt tmp
rw [tmp2,
sq_eq_sq₀ xge0 (le_of_lt
(by apply div_pos
· linarith
positivity))]
constructor
· intro hx
refine ⟨?_, hx⟩
rw [hx, ←tmp2] at xp
simp only [ge_iff_le, sub_nonneg] at xp
rw [←mul_le_mul_iff_left₀ (by positivity : (0 < ((4 : ℝ) * ((4 : ℝ) - (2 : ℝ) * p))))] at xp
rw [mul_div] at xp
rw [div_mul_cancel₀ _ (by positivity)] at xp
ring_nf at xp
rw [pow_two] at xp
by_cases hp2 : p ≤ (4 / 3 : ℝ)
· refine ⟨?_, hp2⟩
nlinarith only [xp, hp2]
· nlinarith only [xp, hp2]
· intro ⟨_, hx⟩; exact hx
end Imo1963P1 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1963P1.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown identifier 'mul_le_mul_iff_left\u2080'", "unsolved goals\np x : \u211d\nh1 : x ^ 2 - p \u2265 0\nh2 : x ^ 2 - 1 \u2265 0\nxge0 : x \u2265 0\nxp : p + 4 - 4 * x ^ 2 \u2265 0\nhp : p < 2\ntmp : 4 - 2 * p > 0\n\u22a2 x ^ 2 * 4 * (4 - 2 * p) = (p - 4) ^ 2 \u2194 x ^ 2 * (4 * (4 - 2 * p)) = (p - 4) ^ 2", "unknown identifier 'mul_le_mul_iff_left\u2080'"], "timeout_s": 600.0, "latency_s": 3.498, "verified_at": "2026-03-26T18:16:12.809922+00:00"}} | false | true | false | 3.498 |
compfiles_Imo1963P4 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Maximiliano Onofre-Martínez
-/
import Mathlib
/-!
# International Mathematical Olympiad 1963, Problem 4
Find all solutions x₁,x₂,x₃,x₄,x₅ of the system
x₅ + x₂ = yx₁
x₁ + x₃ = yx₂
x₂ + x₄ = yx₃
x₃ + x₅ = yx₄
x₄ + x₁ = yx₅
where y is a parameter.
-/
namespace Imo1963P4
abbrev SolutionSet (y : ℝ) : Set (ℝ × ℝ × ℝ × ℝ × ℝ) :=
{(x₁, x₂, x₃, x₄, x₅) |
(x₁ = 0 ∧ x₂ = 0 ∧ x₃ = 0 ∧ x₄ = 0 ∧ x₅ = 0) ∨
(x₁ = x₂ ∧ x₂ = x₃ ∧ x₃ = x₄ ∧ x₄ = x₅ ∧ y = 2) ∨
(y^2 + y - 1 = 0 ∧ ∃ s t,
x₁ = s ∧
x₂ = t ∧
x₃ = y * t - s ∧
x₄ = -(y * t) - y * s ∧
x₅ = y * s - t)}
theorem imo1963_p4 (x₁ x₂ x₃ x₄ x₅ y : ℝ) :
(x₁, x₂, x₃, x₄, x₅) ∈ SolutionSet y ↔
(x₅ + x₂ = y * x₁ ∧
x₁ + x₃ = y * x₂ ∧
x₂ + x₄ = y * x₃ ∧
x₃ + x₅ = y * x₄ ∧
x₄ + x₁ = y * x₅) := by
grind
end Imo1963P4 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Maximiliano Onofre-Martínez
-/
import Mathlib
/-!
# International Mathematical Olympiad 1963, Problem 4
Find all solutions x₁,x₂,x₃,x₄,x₅ of the system
x₅ + x₂ = yx₁
x₁ + x₃ = yx₂
x₂ + x₄ = yx₃
x₃ + x₅ = yx₄
x₄ + x₁ = yx₅
where y is a parameter.
-/
namespace Imo1963P4
abbrev SolutionSet (y : ℝ) : Set (ℝ × ℝ × ℝ × ℝ × ℝ) :=
{(x₁, x₂, x₃, x₄, x₅) |
(x₁ = 0 ∧ x₂ = 0 ∧ x₃ = 0 ∧ x₄ = 0 ∧ x₅ = 0) ∨
(x₁ = x₂ ∧ x₂ = x₃ ∧ x₃ = x₄ ∧ x₄ = x₅ ∧ y = 2) ∨
(y^2 + y - 1 = 0 ∧ ∃ s t,
x₁ = s ∧
x₂ = t ∧
x₃ = y * t - s ∧
x₄ = -(y * t) - y * s ∧
x₅ = y * s - t)}
theorem imo1963_p4 (x₁ x₂ x₃ x₄ x₅ y : ℝ) :
(x₁, x₂, x₃, x₄, x₅) ∈ SolutionSet y ↔
(x₅ + x₂ = y * x₁ ∧
x₁ + x₃ = y * x₂ ∧
x₂ + x₄ = y * x₃ ∧
x₃ + x₅ = y * x₄ ∧
x₄ + x₁ = y * x₅) := by
grind
end Imo1963P4
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Maximiliano Onofre-Martínez
-/
import Mathlib
/-!
# International Mathematical Olympiad 1963, Problem 4
Find all solutions x₁,x₂,x₃,x₄,x₅ of the system
x₅ + x₂ = yx₁
x₁ + x₃ = yx₂
x₂ + x₄ = yx₃
x₃ + x₅ = yx₄
x₄ + x₁ = yx₅
where y is a parameter.
-/
namespace Imo1963P4
abbrev SolutionSet (y : ℝ) : Set (ℝ × ℝ × ℝ × ℝ × ℝ) :=
{(x₁, x₂, x₃, x₄, x₅) |
(x₁ = 0 ∧ x₂ = 0 ∧ x₃ = 0 ∧ x₄ = 0 ∧ x₅ = 0) ∨
(x₁ = x₂ ∧ x₂ = x₃ ∧ x₃ = x₄ ∧ x₄ = x₅ ∧ y = 2) ∨
(y^2 + y - 1 = 0 ∧ ∃ s t,
x₁ = s ∧
x₂ = t ∧
x₃ = y * t - s ∧
x₄ = -(y * t) - y * s ∧
x₅ = y * s - t)}
theorem imo1963_p4 (x₁ x₂ x₃ x₄ x₅ y : ℝ) :
(x₁, x₂, x₃, x₄, x₅) ∈ SolutionSet y ↔
(x₅ + x₂ = y * x₁ ∧
x₁ + x₃ = y * x₂ ∧
x₂ + x₄ = y * x₃ ∧
x₃ + x₅ = y * x₄ ∧
x₄ + x₁ = y * x₅) := by
grind
end Imo1963P4 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1963P4.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["`grind` failed\ncase grind.1.1\nx\u2081 x\u2082 x\u2083 x\u2084 x\u2085 y : \u211d\nh :\n ((x\u2081, x\u2082, x\u2083, x\u2084, x\u2085) \u2208\n {x |\n x.1 = 0 \u2227 x.2.1 = 0 \u2227 x.2.2.1 = 0 \u2227 x.2.2.2.1 = 0 \u2227 x.2.2.2.2 = 0 \u2228\n x.1 = x.2.1 \u2227 x.2.1 = x.2.2.1 \u2227 x.2.2.1 = x.2.2.2.1 \u2227 x.2.2.2.1 = x.2.2.2.2 \u2227 y = 2 \u2228\n y ^ 2 + y - 1 = 0 \u2227\n \u2203 s,\n x.1 = s \u2227\n \u2203 x_1,\n x.2.1 = x_1 \u2227 x.2.2.1 = y * x_1 - s \u2227 x.2.2.2.1 = -(y * x_1) - y * s \u2227 x.2.2.2.2 = y * s - x_1}) =\n (\u00acx\u2085 + x\u2082 = y * x\u2081 \u2228 \u00acx\u2081 + x\u2083 = y * x\u2082 \u2228 \u00acx\u2082 + x\u2084 = y * x\u2083 \u2228 \u00acx\u2083 + x\u2085 = y * x\u2084 \u2228 \u00acx\u2084 + x\u2081 = y * x\u2085)\nleft :\n (x\u2081, x\u2082, x\u2083, x\u2084, x\u2085) \u2208\n {x |\n x.1 = 0 \u2227 x.2.1 = 0 \u2227 x.2.2.1 = 0 \u2227 x.2.2.2.1 = 0 \u2227 x.2.2.2.2 = 0 \u2228\n x.1 = x.2.1 \u2227 x.2.1 = x.2.2.1 \u2227 x.2.2.1 = x.2.2.2.1 \u2227 x.2.2.2.1 = x.2.2.2.2 \u2227 y = 2 \u2228\n y ^ 2 + y - 1 = 0 \u2227\n \u2203 s,\n x.1 = s \u2227\n \u2203 x_1, x.2.1 = x_1 \u2227 x.2.2.1 = y * x_1 - s \u2227 x.2.2.2.1 = -(y * x_1) - y * s \u2227 x.2.2.2.2 = y * s - x_1}\nright : \u00acx\u2085 + x\u2082 = y * x\u2081 \u2228 \u00acx\u2081 + x\u2083 = y * x\u2082 \u2228 \u00acx\u2082 + x\u2084 = y * x\u2083 \u2228 \u00acx\u2083 + x\u2085 = y * x\u2084 \u2228 \u00acx\u2084 + x\u2081 = y * x\u2085\nh_2 : \u00acx\u2085 + x\u2082 = y * x\u2081\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] ((x\u2081, x\u2082, x\u2083, x\u2084, x\u2085) \u2208\n {x |\n x.1 = 0 \u2227 x.2.1 = 0 \u2227 x.2.2.1 = 0 \u2227 x.2.2.2.1 = 0 \u2227 x.2.2.2.2 = 0 \u2228\n x.1 = x.2.1 \u2227 x.2.1 = x.2.2.1 \u2227 x.2.2.1 = x.2.2.2.1 \u2227 x.2.2.2.1 = x.2.2.2.2 \u2227 y = 2 \u2228\n y ^ 2 + y - 1 = 0 \u2227\n \u2203 s,\n x.1 = s \u2227\n \u2203 x_1,\n x.2.1 = x_1 \u2227\n x.2.2.1 = y * x_1 - s \u2227 x.2.2.2.1 = -(y * x_1) - y * s \u2227 x.2.2.2.2 = y * s - x_1}) =\n (\u00acx\u2085 + x\u2082 = y * x\u2081 \u2228 \u00acx\u2081 + x\u2083 = y * x\u2082 \u2228 \u00acx\u2082 + x\u2084 = y * x\u2083 \u2228 \u00acx\u2083 + x\u2085 = y * x\u2084 \u2228 \u00acx\u2084 + x\u2081 = y * x\u2085)\n [prop] (x\u2081, x\u2082, x\u2083, x\u2084, x\u2085) \u2208\n {x |\n x.1 = 0 \u2227 x.2.1 = 0 \u2227 x.2.2.1 = 0 \u2227 x.2.2.2.1 = 0 \u2227 x.2.2.2.2 = 0 \u2228\n x.1 = x.2.1 \u2227 x.2.1 = x.2.2.1 \u2227 x.2.2.1 = x.2.2.2.1 \u2227 x.2.2.2.1 = x.2.2.2.2 \u2227 y = 2 \u2228\n y ^ 2 + y - 1 = 0 \u2227\n \u2203 s,\n x.1 = s \u2227\n \u2203 x_1,\n x.2.1 = x_1 \u2227 x.2.2.1 = y * x_1 - s \u2227 x.2.2.2.1 = -(y * x_1) - y * s \u2227 x.2.2.2.2 = y * s - x_1}\n [prop] \u00acx\u2085 + x\u2082 = y * x\u2081 \u2228 \u00acx\u2081 + x\u2083 = y * x\u2082 \u2228 \u00acx\u2082 + x\u2084 = y * x\u2083 \u2228 \u00acx\u2083 + x\u2085 = y * x\u2084 \u2228 \u00acx\u2084 + x\u2081 = y * x\u2085\n [prop] \u00acx\u2085 + x\u2082 = y * x\u2081\n [eqc] True propositions\n [prop] ((x\u2081, x\u2082, x\u2083, x\u2084, x\u2085) \u2208\n {x |\n x.1 = 0 \u2227 x.2.1 = 0 \u2227 x.2.2.1 = 0 \u2227 x.2.2.2.1 = 0 \u2227 x.2.2.2.2 = 0 \u2228\n x.1 = x.2.1 \u2227 x.2.1 = x.2.2.1 \u2227 x.2.2.1 = x.2.2.2.1 \u2227 x.2.2.2.1 = x.2.2.2.2 \u2227 y = 2 \u2228\n y ^ 2 + y - 1 = 0 \u2227\n \u2203 s,\n x.1 = s \u2227\n \u2203 x_1,\n x.2.1 = x_1 \u2227\n x.2.2.1 = y * x_1 - s \u2227 x.2.2.2.1 = -(y * x_1) - y * s \u2227 x.2.2.2.2 = y * s - x_1}) =\n (\u00acx\u2085 + x\u2082 = y * x\u2081 \u2228 \u00acx\u2081 + x\u2083 = y * x\u2082 \u2228 \u00acx\u2082 + x\u2084 = y * x\u2083 \u2228 \u00acx\u2083 + x\u2085 = y * x\u2084 \u2228 \u00acx\u2084 + x\u2081 = y * x\u2085)\n [prop] \u00acx\u2085 + x\u2082 = y * x\u2081 \u2228 \u00acx\u2081 + x\u2083 = y * x\u2082 \u2228 \u00acx\u2082 + x\u2084 = y * x\u2083 \u2228 \u00acx\u2083 + x\u2085 = y * x\u2084 \u2228 \u00acx\u2084 + x\u2081 = y * x\u2085\n [prop] (x\u2081, x\u2082, x\u2083, x\u2084, x\u2085) \u2208\n {x |\n x.1 = 0 \u2227 x.2.1 = 0 \u2227 x.2.2.1 = 0 \u2227 x.2.2.2.1 = 0 \u2227 x.2.2.2.2 = 0 \u2228\n x.1 = x.2.1 \u2227 x.2.1 = x.2.2.1 \u2227 x.2.2.1 = x.2.2.2.1 \u2227 x.2.2.2.1 = x.2.2.2.2 \u2227 y = 2 \u2228\n y ^ 2 + y - 1 = 0 \u2227\n \u2203 s,\n x.1 = s \u2227\n \u2203 x_1,\n x.2.1 = x_1 \u2227 x.2.2.1 = y * x_1 - s \u2227 x.2.2.2.1 = -(y * x_1) - y * s \u2227 x.2.2.2.2 = y * s - x_1}\n [prop] \u00acx\u2085 + x\u2082 = y * x\u2081\n [eqc] False propositions\n [prop] x\u2085 + x\u2082 = y * x\u2081\n [cases] Case analyses\n [cases] [1/2]: ((x\u2081, x\u2082, x\u2083, x\u2084, x\u2085) \u2208\n {x |\n x.1 = 0 \u2227 x.2.1 = 0 \u2227 x.2.2.1 = 0 \u2227 x.2.2.2.1 = 0 \u2227 x.2.2.2.2 = 0 \u2228\n x.1 = x.2.1 \u2227 x.2.1 = x.2.2.1 \u2227 x.2.2.1 = x.2.2.2.1 \u2227 x.2.2.2.1 = x.2.2.2.2 \u2227 y = 2 \u2228\n y ^ 2 + y - 1 = 0 \u2227\n \u2203 s,\n x.1 = s \u2227\n \u2203 x_1,\n x.2.1 = x_1 \u2227\n x.2.2.1 = y * x_1 - s \u2227 x.2.2.2.1 = -(y * x_1) - y * s \u2227 x.2.2.2.2 = y * s - x_1}) =\n (\u00acx\u2085 + x\u2082 = y * x\u2081 \u2228 \u00acx\u2081 + x\u2083 = y * x\u2082 \u2228 \u00acx\u2082 + x\u2084 = y * x\u2083 \u2228 \u00acx\u2083 + x\u2085 = y * x\u2084 \u2228 \u00acx\u2084 + x\u2081 = y * x\u2085)\n [cases] [1/2]: \u00acx\u2085 + x\u2082 = y * x\u2081 \u2228 \u00acx\u2081 + x\u2083 = y * x\u2082 \u2228 \u00acx\u2082 + x\u2084 = y * x\u2083 \u2228 \u00acx\u2083 + x\u2085 = y * x\u2084 \u2228 \u00acx\u2084 + x\u2081 = y * x\u2085\n [ematch] E-matching patterns\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [ring] Ring `\u211d`\n [diseqs] Disequalities\n [_] \u00ac-1 * (y * x\u2081) + x\u2085 + x\u2082 = 0\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n {x |\n x.1 = 0 \u2227 x.2.1 = 0 \u2227 x.2.2.1 = 0 \u2227 x.2.2.2.1 = 0 \u2227 x.2.2.2.2 = 0 \u2228\n x.1 = x.2.1 \u2227 x.2.1 = x.2.2.1 \u2227 x.2.2.1 = x.2.2.2.1 \u2227 x.2.2.2.1 = x.2.2.2.2 \u2227 y = 2 \u2228\n y ^ 2 + y - 1 = 0 \u2227\n \u2203 s,\n x.1 = s \u2227\n \u2203 x_1,\n x.2.1 = x_1 \u2227 x.2.2.1 = y * x_1 - s \u2227 x.2.2.2.1 = -(y * x_1) - y * s \u2227 x.2.2.2.2 = y * s - x_1}\n has type\n Set (\u211d \u00d7 \u211d \u00d7 \u211d \u00d7 \u211d \u00d7 \u211d) : Type\n but is expected to have type\n Std.ExtDHashMap (\u211d \u00d7 \u211d \u00d7 \u211d \u00d7 \u211d \u00d7 \u211d) ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n {x |\n x.1 = 0 \u2227 x.2.1 = 0 \u2227 x.2.2.1 = 0 \u2227 x.2.2.2.1 = 0 \u2227 x.2.2.2.2 = 0 \u2228\n x.1 = x.2.1 \u2227 x.2.1 = x.2.2.1 \u2227 x.2.2.1 = x.2.2.2.1 \u2227 x.2.2.2.1 = x.2.2.2.2 \u2227 y = 2 \u2228\n y ^ 2 + y - 1 = 0 \u2227\n \u2203 s,\n x.1 = s \u2227\n \u2203 x_1,\n x.2.1 = x_1 \u2227 x.2.2.1 = y * x_1 - s \u2227 x.2.2.2.1 = -(y * x_1) - y * s \u2227 x.2.2.2.2 = y * s - x_1}\n has type\n Set (\u211d \u00d7 \u211d \u00d7 \u211d \u00d7 \u211d \u00d7 \u211d) : Type\n but is expected to have type\n Std.DHashMap (\u211d \u00d7 \u211d \u00d7 \u211d \u00d7 \u211d \u00d7 \u211d) ?\u03b2 : Type"], "timeout_s": 600.0, "latency_s": 0.2304, "verified_at": "2026-03-26T18:16:09.579448+00:00"}} | false | true | false | 0.2304 |
compfiles_Imo1963P5 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Hongyu Ouyang
-/
import Mathlib
/-!
# International Mathematical Olympiad 1963, Problem 5
Prove that cos(π/7) - cos(2π/7) + cos(3π/7) = 1/2.
-/
namespace Imo1963P5
open scoped Real
theorem imo1963_p5 :
Real.cos (π/7) - Real.cos (2*π/7) + Real.cos (3*π/7) = 1/2 := by
rw [show (2*π/7) = π - (5*π/7) by linarith]
rw [Real.cos_pi_sub]
simp only [sub_neg_eq_add]
have h : 2 * Real.sin (π / 7) ≠ 0 := by
simp only [ne_eq, mul_eq_zero, OfNat.ofNat_ne_zero, false_or]
apply ne_of_gt
apply Real.sin_pos_of_pos_of_lt_pi
· positivity
trans 1
· rw [div_lt_one (by norm_num)]
linarith only [Real.pi_le_four]
· linarith only [Real.pi_gt_three]
apply (mul_right_inj' h).mp
rw [left_distrib, left_distrib]
have prod_sum : ∀ (x y : ℝ),
2 * Real.sin x * Real.cos y = Real.sin (x + y) - Real.sin (y - x) := by
intro x y
rw [Real.sin_add, Real.sin_sub]
linarith only
rw [prod_sum, prod_sum, prod_sum]
rw [show (π / 7 + π / 7) = 2 * π / 7 by linarith only]
rw [show (π / 7 - π / 7) = 0 by simp]
rw [show (π / 7 + 5 * π / 7) = 6 * π / 7 by linarith only]
rw [show (5 * π / 7 - π / 7) = 4 * π / 7 by linarith only]
rw [show (π / 7 + 3 * π / 7) = 4 * π / 7 by linarith only]
rw [show (3 * π / 7 - π / 7) = 2 * π / 7 by linarith only]
rw [Real.sin_zero]
ring_nf
rw [← Real.sin_pi_sub]
congr
ring
end Imo1963P5 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Hongyu Ouyang
-/
import Mathlib
/-!
# International Mathematical Olympiad 1963, Problem 5
Prove that cos(π/7) - cos(2π/7) + cos(3π/7) = 1/2.
-/
namespace Imo1963P5
open scoped Real
theorem imo1963_p5 :
Real.cos (π/7) - Real.cos (2*π/7) + Real.cos (3*π/7) = 1/2 := by
rw [show (2*π/7) = π - (5*π/7) by linarith]
rw [Real.cos_pi_sub]
simp only [sub_neg_eq_add]
have h : 2 * Real.sin (π / 7) ≠ 0 := by
simp only [ne_eq, mul_eq_zero, OfNat.ofNat_ne_zero, false_or]
apply ne_of_gt
apply Real.sin_pos_of_pos_of_lt_pi
· positivity
trans 1
· rw [div_lt_one (by norm_num)]
linarith only [Real.pi_le_four]
· linarith only [Real.pi_gt_three]
apply (mul_right_inj' h).mp
rw [left_distrib, left_distrib]
have prod_sum : ∀ (x y : ℝ),
2 * Real.sin x * Real.cos y = Real.sin (x + y) - Real.sin (y - x) := by
intro x y
rw [Real.sin_add, Real.sin_sub]
linarith only
rw [prod_sum, prod_sum, prod_sum]
rw [show (π / 7 + π / 7) = 2 * π / 7 by linarith only]
rw [show (π / 7 - π / 7) = 0 by simp]
rw [show (π / 7 + 5 * π / 7) = 6 * π / 7 by linarith only]
rw [show (5 * π / 7 - π / 7) = 4 * π / 7 by linarith only]
rw [show (π / 7 + 3 * π / 7) = 4 * π / 7 by linarith only]
rw [show (3 * π / 7 - π / 7) = 2 * π / 7 by linarith only]
rw [Real.sin_zero]
ring_nf
rw [← Real.sin_pi_sub]
congr
ring
end Imo1963P5
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Hongyu Ouyang
-/
import Mathlib
/-!
# International Mathematical Olympiad 1963, Problem 5
Prove that cos(π/7) - cos(2π/7) + cos(3π/7) = 1/2.
-/
namespace Imo1963P5
open scoped Real
theorem imo1963_p5 :
Real.cos (π/7) - Real.cos (2*π/7) + Real.cos (3*π/7) = 1/2 := by
rw [show (2*π/7) = π - (5*π/7) by linarith]
rw [Real.cos_pi_sub]
simp only [sub_neg_eq_add]
have h : 2 * Real.sin (π / 7) ≠ 0 := by
simp only [ne_eq, mul_eq_zero, OfNat.ofNat_ne_zero, false_or]
apply ne_of_gt
apply Real.sin_pos_of_pos_of_lt_pi
· positivity
trans 1
· rw [div_lt_one (by norm_num)]
linarith only [Real.pi_le_four]
· linarith only [Real.pi_gt_three]
apply (mul_right_inj' h).mp
rw [left_distrib, left_distrib]
have prod_sum : ∀ (x y : ℝ),
2 * Real.sin x * Real.cos y = Real.sin (x + y) - Real.sin (y - x) := by
intro x y
rw [Real.sin_add, Real.sin_sub]
linarith only
rw [prod_sum, prod_sum, prod_sum]
rw [show (π / 7 + π / 7) = 2 * π / 7 by linarith only]
rw [show (π / 7 - π / 7) = 0 by simp]
rw [show (π / 7 + 5 * π / 7) = 6 * π / 7 by linarith only]
rw [show (5 * π / 7 - π / 7) = 4 * π / 7 by linarith only]
rw [show (π / 7 + 3 * π / 7) = 4 * π / 7 by linarith only]
rw [show (3 * π / 7 - π / 7) = 2 * π / 7 by linarith only]
rw [Real.sin_zero]
ring_nf
rw [← Real.sin_pi_sub]
congr
ring
end Imo1963P5 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1963P5.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 600.0, "latency_s": 1.3886, "verified_at": "2026-03-26T18:16:10.968197+00:00"}} | true | true | false | 1.3886 |
compfiles_Imo1964P1 | compfiles | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw, Anand Rao, Harald Carlens
-/
import Mathlib
/-!
# International Mathematical Olympiad 1964, Problem 1
(a) Find all natural numbers n for which 2ⁿ - 1 is divisible by 7.
(b) Prove that there is no positive integer n for which 2ⁿ + 1 is divisible by 7.
-/
namespace Imo1964P1
abbrev solution_set : Set ℕ := { n | n % 3 = 0 }
theorem imo_1964_p1a (n : ℕ) : n ∈ solution_set ↔ 2^n ≡ 1 [MOD 7] := by
constructor
· intro hn
obtain ⟨m, hm⟩ := Nat.dvd_of_mod_eq_zero hn
change 2^n % 7 = 1
rw [hm, Nat.pow_mul, Nat.pow_mod]
norm_num
· intro hn
change n % 3 = 0
change 2^n % 7 = 1 at hn
rw [(Nat.div_add_mod' n 3).symm] at hn
rw [pow_add, pow_mul', Nat.mul_mod, Nat.pow_mod] at hn
mod_cases H : n % 3
· exact H
· rw [H] at hn; norm_num at hn
· rw [H] at hn; norm_num at hn
theorem imo_1964_p1b (n : ℕ) : ¬ 7 ∣ (2^n + 1) := by
/-
Following https://prase.cz/kalva/imo/isoln/isoln641.html:
Let n = 3m + k; k = 0, 1, or 2.
2^3 = 1 (mod 7).
Hence
2^3m + 1 = 2 (mod 7),
2^(3m+1) + 1 = 3 (mod 7), and
2^(3m + 2) + 1 = 5 (mod 7).
-/
intro h
apply Nat.mod_eq_zero_of_dvd at h
have h1: 2 ^ 3 % 7 = 1 := by rfl
mod_cases h2 : n % 3 <;> rw [←Nat.div_add_mod n 3, h2] at h
· rw [Nat.zero_mod, add_zero, Nat.add_mod, Nat.pow_mod, pow_mul,
Nat.pow_mod, h1, one_pow (M := ℕ)] at h
contradiction
· rw [Nat.add_mod, pow_add, pow_mul, Nat.mul_mod, Nat.pow_mod, h1, one_pow (M := ℕ)] at h
contradiction
· rw [Nat.add_mod, pow_add, pow_mul, Nat.mul_mod, Nat.pow_mod, h1, one_pow (M := ℕ)] at h
contradiction
/- An alternative proof, heavily golfed. The statement here is slightly modified from
the original one. -/
theorem imo_1964_p1b' : ∀ (n : ℕ), (2 ^ n + 1) % 7 ≠ 0
| 0 | 1 | 2 => by decide
| n + 3 => by
rw [pow_add, Nat.add_mod, Nat.mul_mod, show 2 ^ 3 % 7 = 1 by rfl]
simp [imo_1964_p1b' n]
end Imo1964P1 | /- | /-
Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw, Anand Rao, Harald Carlens
-/
import Mathlib
/-!
# International Mathematical Olympiad 1964, Problem 1
(a) Find all natural numbers n for which 2ⁿ - 1 is divisible by 7.
(b) Prove that there is no positive integer n for which 2ⁿ + 1 is divisible by 7.
-/
namespace Imo1964P1
abbrev solution_set : Set ℕ := { n | n % 3 = 0 }
theorem imo_1964_p1a (n : ℕ) : n ∈ solution_set ↔ 2^n ≡ 1 [MOD 7] := by
constructor
· intro hn
obtain ⟨m, hm⟩ := Nat.dvd_of_mod_eq_zero hn
change 2^n % 7 = 1
rw [hm, Nat.pow_mul, Nat.pow_mod]
norm_num
· intro hn
change n % 3 = 0
change 2^n % 7 = 1 at hn
rw [(Nat.div_add_mod' n 3).symm] at hn
rw [pow_add, pow_mul', Nat.mul_mod, Nat.pow_mod] at hn
mod_cases H : n % 3
· exact H
· rw [H] at hn; norm_num at hn
· rw [H] at hn; norm_num at hn
theorem imo_1964_p1b (n : ℕ) : ¬ 7 ∣ (2^n + 1) := by
/-
Following https://prase.cz/kalva/imo/isoln/isoln641.html:
Let n = 3m + k; k = 0, 1, or 2.
2^3 = 1 (mod 7).
Hence
2^3m + 1 = 2 (mod 7),
2^(3m+1) + 1 = 3 (mod 7), and
2^(3m + 2) + 1 = 5 (mod 7).
-/
intro h
apply Nat.mod_eq_zero_of_dvd at h
have h1: 2 ^ 3 % 7 = 1 := by rfl
mod_cases h2 : n % 3 <;> rw [←Nat.div_add_mod n 3, h2] at h
· rw [Nat.zero_mod, add_zero, Nat.add_mod, Nat.pow_mod, pow_mul,
Nat.pow_mod, h1, one_pow (M := ℕ)] at h
contradiction
· rw [Nat.add_mod, pow_add, pow_mul, Nat.mul_mod, Nat.pow_mod, h1, one_pow (M := ℕ)] at h
contradiction
· rw [Nat.add_mod, pow_add, pow_mul, Nat.mul_mod, Nat.pow_mod, h1, one_pow (M := ℕ)] at h
contradiction
/- An alternative proof, heavily golfed. The statement here is slightly modified from
the original one. -/
theorem imo_1964_p1b' : ∀ (n : ℕ), (2 ^ n + 1) % 7 ≠ 0
| 0 | 1 | 2 => by decide
| n + 3 => by
rw [pow_add, Nat.add_mod, Nat.mul_mod, show 2 ^ 3 % 7 = 1 by rfl]
simp [imo_1964_p1b' n]
end Imo1964P1
| true | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw, Anand Rao, Harald Carlens
-/
import Mathlib
/-!
# International Mathematical Olympiad 1964, Problem 1
(a) Find all natural numbers n for which 2ⁿ - 1 is divisible by 7.
(b) Prove that there is no positive integer n for which 2ⁿ + 1 is divisible by 7.
-/
namespace Imo1964P1
abbrev solution_set : Set ℕ := { n | n % 3 = 0 }
theorem imo_1964_p1a (n : ℕ) : n ∈ solution_set ↔ 2^n ≡ 1 [MOD 7] := by
constructor
· intro hn
obtain ⟨m, hm⟩ := Nat.dvd_of_mod_eq_zero hn
change 2^n % 7 = 1
rw [hm, Nat.pow_mul, Nat.pow_mod]
norm_num
· intro hn
change n % 3 = 0
change 2^n % 7 = 1 at hn
rw [(Nat.div_add_mod' n 3).symm] at hn
rw [pow_add, pow_mul', Nat.mul_mod, Nat.pow_mod] at hn
mod_cases H : n % 3
· exact H
· rw [H] at hn; norm_num at hn
· rw [H] at hn; norm_num at hn
theorem imo_1964_p1b (n : ℕ) : ¬ 7 ∣ (2^n + 1) := by
/-
Following https://prase.cz/kalva/imo/isoln/isoln641.html:
Let n = 3m + k; k = 0, 1, or 2.
2^3 = 1 (mod 7).
Hence
2^3m + 1 = 2 (mod 7),
2^(3m+1) + 1 = 3 (mod 7), and
2^(3m + 2) + 1 = 5 (mod 7).
-/
intro h
apply Nat.mod_eq_zero_of_dvd at h
have h1: 2 ^ 3 % 7 = 1 := by rfl
mod_cases h2 : n % 3 <;> rw [←Nat.div_add_mod n 3, h2] at h
· rw [Nat.zero_mod, add_zero, Nat.add_mod, Nat.pow_mod, pow_mul,
Nat.pow_mod, h1, one_pow (M := ℕ)] at h
contradiction
· rw [Nat.add_mod, pow_add, pow_mul, Nat.mul_mod, Nat.pow_mod, h1, one_pow (M := ℕ)] at h
contradiction
· rw [Nat.add_mod, pow_add, pow_mul, Nat.mul_mod, Nat.pow_mod, h1, one_pow (M := ℕ)] at h
contradiction
/- An alternative proof, heavily golfed. The statement here is slightly modified from
the original one. -/
theorem imo_1964_p1b' : ∀ (n : ℕ), (2 ^ n + 1) % 7 ≠ 0
| 0 | 1 | 2 => by decide
| n + 3 => by
rw [pow_add, Nat.add_mod, Nat.mul_mod, show 2 ^ 3 % 7 = 1 by rfl]
simp [imo_1964_p1b' n]
end Imo1964P1 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1964P1.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 600.0, "latency_s": 0.3715, "verified_at": "2026-03-26T18:16:10.366632+00:00"}} | true | true | false | 0.3715 |
compfiles_Imo1964P2 | compfiles | Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1964, Problem 2
Suppose that a,b,c are the side lengths of a triangle. Prove that
a²(b + c - a) + b²(c + a - b) + c²(a + b - c) ≤ 3abc.
-/
namespace Imo1964P2
-- TODO: get this into mathlib in some form
lemma schur {a b c : ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) (hc : 0 ≤ c) :
0 ≤ a * (a - b) * (a - c) + b * (b - a) * (b - c) + c * (c - a) * (c - b) := by
-- from https://artofproblemsolving.com/wiki/index.php/Schur%27s_Inequality
wlog Hcb : c ≤ b with h1
· have h3 : b ≤ c := le_of_not_ge Hcb
linarith [h1 ha hc hb h3]
wlog Hba : b ≤ a with h2
· have h4 : a ≤ b := le_of_not_ge Hba
obtain hca | hac : c ≤ a ∨ a ≤ c := le_total c a
· have := h2 hb ha hc hca h4
linarith only [this]
· have := h2 hb hc ha hac Hcb
linarith only [this]
have h5 : a * (a - b) * (a - c) + b * (b - a) * (b - c) =
(a - b) * (a * (a - c) - b * (b - c)) := by ring
have h6 : 0 ≤ (a - b) * (a * (a - c) - b * (b - c)) := by bound
rw [← h5] at h6
have h12 : 0 ≤ (c - a) * (c - b) := by nlinarith only [Hba, Hcb]
have h13 : 0 ≤ c * (c - a) * (c - b) := by nlinarith only [hc, h12]
positivity
theorem imo1964_p2
(T : Affine.Triangle ℝ (EuclideanSpace ℝ (Fin 2)))
(a b c : ℝ)
(ha : a = dist (T.points 1) (T.points 2))
(hb : b = dist (T.points 2) (T.points 0))
(hc : c = dist (T.points 0) (T.points 1)) :
a^2 * (b + c - a) + b^2 * (c + a - b) + c^2 * (a + b - c) ≤
3 * a * b * c := by
-- solution 3 from
-- https://artofproblemsolving.com/wiki/index.php/1964_IMO_Problems/Problem_2
-- The only thing we need to know about a,b,c is that they
-- are nonnegative.
have ha' : 0 ≤ dist (T.points 1) (T.points 2) := dist_nonneg
rw [←ha] at ha'; clear ha
have hb' : 0 ≤ dist (T.points 2) (T.points 0) := dist_nonneg
rw [←hb] at hb'; clear hb
have hc' : 0 ≤ dist (T.points 0) (T.points 1) := dist_nonneg
rw [←hc] at hc'; clear hc
clear T
have h1 :
3 * a * b * c - (a^2 * (b + c - a) + b^2 * (c + a - b) + c^2 * (a + b - c)) =
a * (a - b) * (a - c) + b * (b - a) * (b - c) + c * (c - a) * (c - b) := by
ring
suffices 0 ≤
3 * a * b * c - (a^2 * (b + c - a) + b^2 * (c + a - b) + c^2 * (a + b - c)) from
sub_nonneg.mp this
rw [h1]
exact schur ha' hb' hc'
end Imo1964P2 | /- | /-
Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1964, Problem 2
Suppose that a,b,c are the side lengths of a triangle. Prove that
a²(b + c - a) + b²(c + a - b) + c²(a + b - c) ≤ 3abc.
-/
namespace Imo1964P2
-- TODO: get this into mathlib in some form
lemma schur {a b c : ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) (hc : 0 ≤ c) :
0 ≤ a * (a - b) * (a - c) + b * (b - a) * (b - c) + c * (c - a) * (c - b) := by
-- from https://artofproblemsolving.com/wiki/index.php/Schur%27s_Inequality
wlog Hcb : c ≤ b with h1
· have h3 : b ≤ c := le_of_not_ge Hcb
linarith [h1 ha hc hb h3]
wlog Hba : b ≤ a with h2
· have h4 : a ≤ b := le_of_not_ge Hba
obtain hca | hac : c ≤ a ∨ a ≤ c := le_total c a
· have := h2 hb ha hc hca h4
linarith only [this]
· have := h2 hb hc ha hac Hcb
linarith only [this]
have h5 : a * (a - b) * (a - c) + b * (b - a) * (b - c) =
(a - b) * (a * (a - c) - b * (b - c)) := by ring
have h6 : 0 ≤ (a - b) * (a * (a - c) - b * (b - c)) := by bound
rw [← h5] at h6
have h12 : 0 ≤ (c - a) * (c - b) := by nlinarith only [Hba, Hcb]
have h13 : 0 ≤ c * (c - a) * (c - b) := by nlinarith only [hc, h12]
positivity
theorem imo1964_p2
(T : Affine.Triangle ℝ (EuclideanSpace ℝ (Fin 2)))
(a b c : ℝ)
(ha : a = dist (T.points 1) (T.points 2))
(hb : b = dist (T.points 2) (T.points 0))
(hc : c = dist (T.points 0) (T.points 1)) :
a^2 * (b + c - a) + b^2 * (c + a - b) + c^2 * (a + b - c) ≤
3 * a * b * c := by
-- solution 3 from
-- https://artofproblemsolving.com/wiki/index.php/1964_IMO_Problems/Problem_2
-- The only thing we need to know about a,b,c is that they
-- are nonnegative.
have ha' : 0 ≤ dist (T.points 1) (T.points 2) := dist_nonneg
rw [←ha] at ha'; clear ha
have hb' : 0 ≤ dist (T.points 2) (T.points 0) := dist_nonneg
rw [←hb] at hb'; clear hb
have hc' : 0 ≤ dist (T.points 0) (T.points 1) := dist_nonneg
rw [←hc] at hc'; clear hc
clear T
have h1 :
3 * a * b * c - (a^2 * (b + c - a) + b^2 * (c + a - b) + c^2 * (a + b - c)) =
a * (a - b) * (a - c) + b * (b - a) * (b - c) + c * (c - a) * (c - b) := by
ring
suffices 0 ≤
3 * a * b * c - (a^2 * (b + c - a) + b^2 * (c + a - b) + c^2 * (a + b - c)) from
sub_nonneg.mp this
rw [h1]
exact schur ha' hb' hc'
end Imo1964P2
| true | Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1964, Problem 2
Suppose that a,b,c are the side lengths of a triangle. Prove that
a²(b + c - a) + b²(c + a - b) + c²(a + b - c) ≤ 3abc.
-/
namespace Imo1964P2
-- TODO: get this into mathlib in some form
lemma schur {a b c : ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) (hc : 0 ≤ c) :
0 ≤ a * (a - b) * (a - c) + b * (b - a) * (b - c) + c * (c - a) * (c - b) := by
-- from https://artofproblemsolving.com/wiki/index.php/Schur%27s_Inequality
wlog Hcb : c ≤ b with h1
· have h3 : b ≤ c := le_of_not_ge Hcb
linarith [h1 ha hc hb h3]
wlog Hba : b ≤ a with h2
· have h4 : a ≤ b := le_of_not_ge Hba
obtain hca | hac : c ≤ a ∨ a ≤ c := le_total c a
· have := h2 hb ha hc hca h4
linarith only [this]
· have := h2 hb hc ha hac Hcb
linarith only [this]
have h5 : a * (a - b) * (a - c) + b * (b - a) * (b - c) =
(a - b) * (a * (a - c) - b * (b - c)) := by ring
have h6 : 0 ≤ (a - b) * (a * (a - c) - b * (b - c)) := by bound
rw [← h5] at h6
have h12 : 0 ≤ (c - a) * (c - b) := by nlinarith only [Hba, Hcb]
have h13 : 0 ≤ c * (c - a) * (c - b) := by nlinarith only [hc, h12]
positivity
theorem imo1964_p2
(T : Affine.Triangle ℝ (EuclideanSpace ℝ (Fin 2)))
(a b c : ℝ)
(ha : a = dist (T.points 1) (T.points 2))
(hb : b = dist (T.points 2) (T.points 0))
(hc : c = dist (T.points 0) (T.points 1)) :
a^2 * (b + c - a) + b^2 * (c + a - b) + c^2 * (a + b - c) ≤
3 * a * b * c := by
-- solution 3 from
-- https://artofproblemsolving.com/wiki/index.php/1964_IMO_Problems/Problem_2
-- The only thing we need to know about a,b,c is that they
-- are nonnegative.
have ha' : 0 ≤ dist (T.points 1) (T.points 2) := dist_nonneg
rw [←ha] at ha'; clear ha
have hb' : 0 ≤ dist (T.points 2) (T.points 0) := dist_nonneg
rw [←hb] at hb'; clear hb
have hc' : 0 ≤ dist (T.points 0) (T.points 1) := dist_nonneg
rw [←hc] at hc'; clear hc
clear T
have h1 :
3 * a * b * c - (a^2 * (b + c - a) + b^2 * (c + a - b) + c^2 * (a + b - c)) =
a * (a - b) * (a - c) + b * (b - a) * (b - c) + c * (c - a) * (c - b) := by
ring
suffices 0 ≤
3 * a * b * c - (a^2 * (b + c - a) + b^2 * (c + a - b) + c^2 * (a + b - c)) from
sub_nonneg.mp this
rw [h1]
exact schur ha' hb' hc'
end Imo1964P2 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1964P2.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 600.0, "latency_s": 1.1175, "verified_at": "2026-03-26T18:16:11.484202+00:00"}} | true | true | false | 1.1175 |
compfiles_Imo1964P4 | compfiles | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Aesop
import Mathlib
/-!
# International Mathematical Olympiad 1964, Problem 4
Seventeen people correspond by mail with one another -- each one with
all the rest. In their letters only three different topics are
discussed. Each pair of correspondents deals with only one of the topics.
Prove that there are at least three people who write to each other
about the same topic.
-/
namespace Imo1964P4
/--
Smaller version of the problem, with 6 (or more) people and 2 topics.
-/
theorem lemma1
(Person Topic : Type)
[Fintype Person] [DecidableEq Person]
[Fintype Topic] [DecidableEq Topic]
(card_person : 5 < Fintype.card Person)
(card_topic : Fintype.card Topic = 2)
(discusses : Person → Person → Topic)
(discussion_sym : ∀ p1 p2 : Person, discusses p1 p2 = discusses p2 p1) :
∃ t : Topic, ∃ s : Finset Person,
2 < s.card ∧
∀ p1 ∈ s, ∀ p2 ∈ s, p1 ≠ p2 → discusses p1 p2 = t := by
-- Choose a person p2.
have p2 : Person := Nonempty.some (Fintype.card_pos_iff.mp (by omega))
let Person' := {p3 // p3 ≠ p2}
have hfcα : 4 < Fintype.card Person' := by
rw [Fintype.card_subtype_compl, Fintype.card_ofSubsingleton]
exact lt_tsub_of_add_lt_left card_person
have h1 : Fintype.card Topic * 2 < Fintype.card Person' := by omega
-- By the pigeonhole principle, there must be some topic t2 such that the
-- size of the set {p3 // p3 ≠ p2 ∧ discusses p2 p3 = t2} is at least 3.
have h2 := Fintype.exists_lt_card_fiber_of_mul_lt_card
(fun (p3: Person') ↦ discusses p2 p3.val) h1
obtain ⟨t2, ht2⟩ := h2
-- Call that set α.
let α := (Finset.filter (fun (x : Person') ↦ discusses p2 ↑x = t2) Finset.univ)
-- If any pair of people p4 p5 in α discusses topic t2, then we are done.
-- So the people in α must all discuss only the remaining one topic t3.
let Topic' := {t3 // t3 ≠ t2}
have h4 : Fintype.card Topic' = 1 := by
simp [Fintype.card_subtype_compl, card_topic, Topic']
-- let t3 be the other element of Topic
obtain ⟨t3, ht3⟩ := Fintype.card_eq_one_iff.mp h4
by_cases h6 : ∃ p3 p4 : α, p3 ≠ p4 ∧ discusses p3.val p4.val = t2
· obtain ⟨p3, p4, hp1, hp2⟩ := h6
use t2
-- the set we want is {p2,p3,p4}
let s1 : Finset Person := {p3.val.val}
let s2 : Finset Person := Finset.cons p4.val s1
(by rw [Finset.mem_singleton]; intro hp
exact (hp1 (Subtype.val_injective
(Subtype.val_injective hp)).symm).elim)
let s3 : Finset Person := Finset.cons p2 s2 (by grind)
use s3
grind
· push_neg at h6
use t3
let α' := Finset.map ⟨λ (x :Person') => x.val, Subtype.coe_injective⟩ α
use α'
constructor
· rw [Finset.card_map]; exact ht2
· intro p3' hp3' p4' hp4' hp3p4'
rw [Finset.mem_map] at hp3' hp4'
obtain ⟨⟨p3, p3_ne⟩, p3_mem_α, p3_eq⟩ := hp3'
obtain ⟨⟨p4, p4_ne⟩, p4_mem_α, p4_eq⟩ := hp4'
dsimp at p3_eq p4_eq
rw [←p3_eq, ←p4_eq]
have hne : p3 ≠ p4 := by rwa [p3_eq, p4_eq]
have h8 := h6 ⟨⟨p3, p3_ne⟩, p3_mem_α⟩ ⟨⟨p4, p4_ne⟩, p4_mem_α⟩
(by simp[hne, Person'])
let t3': Topic' := ⟨discusses p3 p4, h8⟩
have h9 := ht3 t3'
rw [←h9]
theorem imo1964_p4
(Person Topic : Type)
[Fintype Person] [DecidableEq Person]
[Fintype Topic] [DecidableEq Topic]
(card_person : Fintype.card Person = 17)
(card_topic : Fintype.card Topic = 3)
(discusses : Person → Person → Topic)
(discussion_sym : ∀ p1 p2 : Person, discusses p1 p2 = discusses p2 p1) :
∃ t : Topic, ∃ s : Finset Person,
2 < s.card ∧
∀ p1 ∈ s, ∀ p2 ∈ s, p1 ≠ p2 → discusses p1 p2 = t := by
-- Choose a person p1.
have p1 : Person := Nonempty.some (Fintype.card_pos_iff.mp (by omega))
let Person' := {p2 // p2 ≠ p1}
-- By the pigeonhole principle, there must be some topic t1 such
-- that the size of the set {p2 // p2 ≠ p1 ∧ discusses p1 p2 = t1}
-- is at least 6.
have hfcα : Fintype.card Person' = 16 := by
simp [Fintype.card_subtype_compl, card_person, Person']
have h1 : Fintype.card Topic * 5 < Fintype.card Person' := by
rw [hfcα, card_topic]; norm_num
have h2 := Fintype.exists_lt_card_fiber_of_mul_lt_card
(fun (p2: Person') ↦ discusses p1 p2.val) h1
clear h1
obtain ⟨t1, ht1⟩ := h2
-- Call that set α.
let α := (Finset.filter (fun (x : Person') ↦ discusses p1 ↑x = t1) Finset.univ)
have cardα : 5 < Fintype.card α := by rw [Fintype.card_coe]; exact ht1;
-- If any pair of people p2 p3 in α discusses topic t1, then we are done.
by_cases h6 : ∃ p2 p3 : α, p2 ≠ p3 ∧ discusses p2.val p3.val = t1
· obtain ⟨p3, p4, hp1, hp2⟩ := h6
use t1
-- the set we want is {p1,p3,p4}
let s1 : Finset Person := {p3.val.val}
have hs1 : ¬ p4.val.val ∈ s1 := by
rw [Finset.mem_singleton]; intro hp
exact (hp1 (Subtype.val_injective (Subtype.val_injective hp)).symm).elim
let s2 : Finset Person := Finset.cons p4.val s1 hs1
have hs2 : ¬ p1 ∈ s2 := by
rw [Finset.mem_cons, Finset.mem_singleton]; intro hp
cases hp with
| inl hp => exact (p4.val.property.symm hp).elim
| inr hp => exact (p3.val.property.symm hp).elim
let s3 : Finset Person := Finset.cons p1 s2 hs2
use s3
grind
· -- So the people in α must all discuss only the remaining two topics.
push_neg at h6
let Topic' := {t2 // t2 ≠ t1}
have h3 : Fintype Topic' := Fintype.ofFinite Topic'
have h4 : Fintype.card Topic' = 2 := by
simp [Fintype.card_subtype_compl, card_topic, Topic']
have t0 : Topic' := Nonempty.some (Fintype.card_pos_iff.mp (by positivity))
let discusses' : α → α → Topic' :=
fun (p2 p3 : α) ↦
if heq : p2 = p3 then t0
else
⟨discusses p2.val p3.val, h6 ⟨p2, p2.property⟩ ⟨p3, p3.property⟩ heq⟩
have discusses_sym' :
∀ (p1 p2 : { x // x ∈ α }), discusses' p1 p2 = discusses' p2 p1 := by
intro p3 p4
simp only [discusses']
split_ifs with hf1 hf2 hf3
· rfl
· exact (hf2 hf1.symm).elim
· exact (hf1 hf3.symm).elim
· simp[discussion_sym]
have h5 := lemma1 α Topic' cardα h4 discusses' discusses_sym'
obtain ⟨t2, s, hs1, hs2⟩ := h5
use t2
let s' := Finset.map ⟨λ (x : α) => x.val.val,
fun x y hxy ↦ Subtype.coe_injective (Subtype.coe_injective hxy)⟩ s
use s'
constructor
· rwa [Finset.card_map]
· intro p3 hp3 p4 hp4 hp34
rw [Finset.mem_map] at hp3 hp4
obtain ⟨⟨⟨p3', p3_mem_person'⟩, p3_mem_α⟩, p3_mem_s, hp3eq⟩ := hp3
obtain ⟨⟨⟨p4', p4_mem_person'⟩, p4_mem_α⟩, p4_mem_s, hp4eq⟩ := hp4
dsimp at hp3eq hp4eq
rw [←hp3eq, ←hp4eq]
have hne : p3' ≠ p4' := by rwa[hp3eq, hp4eq]
have h6 := hs2 ⟨⟨p3', p3_mem_person'⟩, p3_mem_α⟩ p3_mem_s
⟨⟨p4', p4_mem_person'⟩, p4_mem_α⟩ p4_mem_s
(by simp [hne, Person'])
simp [hne, Person', discusses'] at h6
exact (congrArg Subtype.val h6)
end Imo1964P4 | /- | /-
Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Aesop
import Mathlib
/-!
# International Mathematical Olympiad 1964, Problem 4
Seventeen people correspond by mail with one another -- each one with
all the rest. In their letters only three different topics are
discussed. Each pair of correspondents deals with only one of the topics.
Prove that there are at least three people who write to each other
about the same topic.
-/
namespace Imo1964P4
/--
Smaller version of the problem, with 6 (or more) people and 2 topics.
-/
theorem lemma1
(Person Topic : Type)
[Fintype Person] [DecidableEq Person]
[Fintype Topic] [DecidableEq Topic]
(card_person : 5 < Fintype.card Person)
(card_topic : Fintype.card Topic = 2)
(discusses : Person → Person → Topic)
(discussion_sym : ∀ p1 p2 : Person, discusses p1 p2 = discusses p2 p1) :
∃ t : Topic, ∃ s : Finset Person,
2 < s.card ∧
∀ p1 ∈ s, ∀ p2 ∈ s, p1 ≠ p2 → discusses p1 p2 = t := by
-- Choose a person p2.
have p2 : Person := Nonempty.some (Fintype.card_pos_iff.mp (by omega))
let Person' := {p3 // p3 ≠ p2}
have hfcα : 4 < Fintype.card Person' := by
rw [Fintype.card_subtype_compl, Fintype.card_ofSubsingleton]
exact lt_tsub_of_add_lt_left card_person
have h1 : Fintype.card Topic * 2 < Fintype.card Person' := by omega
-- By the pigeonhole principle, there must be some topic t2 such that the
-- size of the set {p3 // p3 ≠ p2 ∧ discusses p2 p3 = t2} is at least 3.
have h2 := Fintype.exists_lt_card_fiber_of_mul_lt_card
(fun (p3: Person') ↦ discusses p2 p3.val) h1
obtain ⟨t2, ht2⟩ := h2
-- Call that set α.
let α := (Finset.filter (fun (x : Person') ↦ discusses p2 ↑x = t2) Finset.univ)
-- If any pair of people p4 p5 in α discusses topic t2, then we are done.
-- So the people in α must all discuss only the remaining one topic t3.
let Topic' := {t3 // t3 ≠ t2}
have h4 : Fintype.card Topic' = 1 := by
simp [Fintype.card_subtype_compl, card_topic, Topic']
-- let t3 be the other element of Topic
obtain ⟨t3, ht3⟩ := Fintype.card_eq_one_iff.mp h4
by_cases h6 : ∃ p3 p4 : α, p3 ≠ p4 ∧ discusses p3.val p4.val = t2
· obtain ⟨p3, p4, hp1, hp2⟩ := h6
use t2
-- the set we want is {p2,p3,p4}
let s1 : Finset Person := {p3.val.val}
let s2 : Finset Person := Finset.cons p4.val s1
(by rw [Finset.mem_singleton]; intro hp
exact (hp1 (Subtype.val_injective
(Subtype.val_injective hp)).symm).elim)
let s3 : Finset Person := Finset.cons p2 s2 (by grind)
use s3
grind
· push_neg at h6
use t3
let α' := Finset.map ⟨λ (x :Person') => x.val, Subtype.coe_injective⟩ α
use α'
constructor
· rw [Finset.card_map]; exact ht2
· intro p3' hp3' p4' hp4' hp3p4'
rw [Finset.mem_map] at hp3' hp4'
obtain ⟨⟨p3, p3_ne⟩, p3_mem_α, p3_eq⟩ := hp3'
obtain ⟨⟨p4, p4_ne⟩, p4_mem_α, p4_eq⟩ := hp4'
dsimp at p3_eq p4_eq
rw [←p3_eq, ←p4_eq]
have hne : p3 ≠ p4 := by rwa [p3_eq, p4_eq]
have h8 := h6 ⟨⟨p3, p3_ne⟩, p3_mem_α⟩ ⟨⟨p4, p4_ne⟩, p4_mem_α⟩
(by simp[hne, Person'])
let t3': Topic' := ⟨discusses p3 p4, h8⟩
have h9 := ht3 t3'
rw [←h9]
theorem imo1964_p4
(Person Topic : Type)
[Fintype Person] [DecidableEq Person]
[Fintype Topic] [DecidableEq Topic]
(card_person : Fintype.card Person = 17)
(card_topic : Fintype.card Topic = 3)
(discusses : Person → Person → Topic)
(discussion_sym : ∀ p1 p2 : Person, discusses p1 p2 = discusses p2 p1) :
∃ t : Topic, ∃ s : Finset Person,
2 < s.card ∧
∀ p1 ∈ s, ∀ p2 ∈ s, p1 ≠ p2 → discusses p1 p2 = t := by
-- Choose a person p1.
have p1 : Person := Nonempty.some (Fintype.card_pos_iff.mp (by omega))
let Person' := {p2 // p2 ≠ p1}
-- By the pigeonhole principle, there must be some topic t1 such
-- that the size of the set {p2 // p2 ≠ p1 ∧ discusses p1 p2 = t1}
-- is at least 6.
have hfcα : Fintype.card Person' = 16 := by
simp [Fintype.card_subtype_compl, card_person, Person']
have h1 : Fintype.card Topic * 5 < Fintype.card Person' := by
rw [hfcα, card_topic]; norm_num
have h2 := Fintype.exists_lt_card_fiber_of_mul_lt_card
(fun (p2: Person') ↦ discusses p1 p2.val) h1
clear h1
obtain ⟨t1, ht1⟩ := h2
-- Call that set α.
let α := (Finset.filter (fun (x : Person') ↦ discusses p1 ↑x = t1) Finset.univ)
have cardα : 5 < Fintype.card α := by rw [Fintype.card_coe]; exact ht1;
-- If any pair of people p2 p3 in α discusses topic t1, then we are done.
by_cases h6 : ∃ p2 p3 : α, p2 ≠ p3 ∧ discusses p2.val p3.val = t1
· obtain ⟨p3, p4, hp1, hp2⟩ := h6
use t1
-- the set we want is {p1,p3,p4}
let s1 : Finset Person := {p3.val.val}
have hs1 : ¬ p4.val.val ∈ s1 := by
rw [Finset.mem_singleton]; intro hp
exact (hp1 (Subtype.val_injective (Subtype.val_injective hp)).symm).elim
let s2 : Finset Person := Finset.cons p4.val s1 hs1
have hs2 : ¬ p1 ∈ s2 := by
rw [Finset.mem_cons, Finset.mem_singleton]; intro hp
cases hp with
| inl hp => exact (p4.val.property.symm hp).elim
| inr hp => exact (p3.val.property.symm hp).elim
let s3 : Finset Person := Finset.cons p1 s2 hs2
use s3
grind
· -- So the people in α must all discuss only the remaining two topics.
push_neg at h6
let Topic' := {t2 // t2 ≠ t1}
have h3 : Fintype Topic' := Fintype.ofFinite Topic'
have h4 : Fintype.card Topic' = 2 := by
simp [Fintype.card_subtype_compl, card_topic, Topic']
have t0 : Topic' := Nonempty.some (Fintype.card_pos_iff.mp (by positivity))
let discusses' : α → α → Topic' :=
fun (p2 p3 : α) ↦
if heq : p2 = p3 then t0
else
⟨discusses p2.val p3.val, h6 ⟨p2, p2.property⟩ ⟨p3, p3.property⟩ heq⟩
have discusses_sym' :
∀ (p1 p2 : { x // x ∈ α }), discusses' p1 p2 = discusses' p2 p1 := by
intro p3 p4
simp only [discusses']
split_ifs with hf1 hf2 hf3
· rfl
· exact (hf2 hf1.symm).elim
· exact (hf1 hf3.symm).elim
· simp[discussion_sym]
have h5 := lemma1 α Topic' cardα h4 discusses' discusses_sym'
obtain ⟨t2, s, hs1, hs2⟩ := h5
use t2
let s' := Finset.map ⟨λ (x : α) => x.val.val,
fun x y hxy ↦ Subtype.coe_injective (Subtype.coe_injective hxy)⟩ s
use s'
constructor
· rwa [Finset.card_map]
· intro p3 hp3 p4 hp4 hp34
rw [Finset.mem_map] at hp3 hp4
obtain ⟨⟨⟨p3', p3_mem_person'⟩, p3_mem_α⟩, p3_mem_s, hp3eq⟩ := hp3
obtain ⟨⟨⟨p4', p4_mem_person'⟩, p4_mem_α⟩, p4_mem_s, hp4eq⟩ := hp4
dsimp at hp3eq hp4eq
rw [←hp3eq, ←hp4eq]
have hne : p3' ≠ p4' := by rwa[hp3eq, hp4eq]
have h6 := hs2 ⟨⟨p3', p3_mem_person'⟩, p3_mem_α⟩ p3_mem_s
⟨⟨p4', p4_mem_person'⟩, p4_mem_α⟩ p4_mem_s
(by simp [hne, Person'])
simp [hne, Person', discusses'] at h6
exact (congrArg Subtype.val h6)
end Imo1964P4
| true | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Aesop
import Mathlib
/-!
# International Mathematical Olympiad 1964, Problem 4
Seventeen people correspond by mail with one another -- each one with
all the rest. In their letters only three different topics are
discussed. Each pair of correspondents deals with only one of the topics.
Prove that there are at least three people who write to each other
about the same topic.
-/
namespace Imo1964P4
/--
Smaller version of the problem, with 6 (or more) people and 2 topics.
-/
theorem lemma1
(Person Topic : Type)
[Fintype Person] [DecidableEq Person]
[Fintype Topic] [DecidableEq Topic]
(card_person : 5 < Fintype.card Person)
(card_topic : Fintype.card Topic = 2)
(discusses : Person → Person → Topic)
(discussion_sym : ∀ p1 p2 : Person, discusses p1 p2 = discusses p2 p1) :
∃ t : Topic, ∃ s : Finset Person,
2 < s.card ∧
∀ p1 ∈ s, ∀ p2 ∈ s, p1 ≠ p2 → discusses p1 p2 = t := by
-- Choose a person p2.
have p2 : Person := Nonempty.some (Fintype.card_pos_iff.mp (by omega))
let Person' := {p3 // p3 ≠ p2}
have hfcα : 4 < Fintype.card Person' := by
rw [Fintype.card_subtype_compl, Fintype.card_ofSubsingleton]
exact lt_tsub_of_add_lt_left card_person
have h1 : Fintype.card Topic * 2 < Fintype.card Person' := by omega
-- By the pigeonhole principle, there must be some topic t2 such that the
-- size of the set {p3 // p3 ≠ p2 ∧ discusses p2 p3 = t2} is at least 3.
have h2 := Fintype.exists_lt_card_fiber_of_mul_lt_card
(fun (p3: Person') ↦ discusses p2 p3.val) h1
obtain ⟨t2, ht2⟩ := h2
-- Call that set α.
let α := (Finset.filter (fun (x : Person') ↦ discusses p2 ↑x = t2) Finset.univ)
-- If any pair of people p4 p5 in α discusses topic t2, then we are done.
-- So the people in α must all discuss only the remaining one topic t3.
let Topic' := {t3 // t3 ≠ t2}
have h4 : Fintype.card Topic' = 1 := by
simp [Fintype.card_subtype_compl, card_topic, Topic']
-- let t3 be the other element of Topic
obtain ⟨t3, ht3⟩ := Fintype.card_eq_one_iff.mp h4
by_cases h6 : ∃ p3 p4 : α, p3 ≠ p4 ∧ discusses p3.val p4.val = t2
· obtain ⟨p3, p4, hp1, hp2⟩ := h6
use t2
-- the set we want is {p2,p3,p4}
let s1 : Finset Person := {p3.val.val}
let s2 : Finset Person := Finset.cons p4.val s1
(by rw [Finset.mem_singleton]; intro hp
exact (hp1 (Subtype.val_injective
(Subtype.val_injective hp)).symm).elim)
let s3 : Finset Person := Finset.cons p2 s2 (by grind)
use s3
grind
· push_neg at h6
use t3
let α' := Finset.map ⟨λ (x :Person') => x.val, Subtype.coe_injective⟩ α
use α'
constructor
· rw [Finset.card_map]; exact ht2
· intro p3' hp3' p4' hp4' hp3p4'
rw [Finset.mem_map] at hp3' hp4'
obtain ⟨⟨p3, p3_ne⟩, p3_mem_α, p3_eq⟩ := hp3'
obtain ⟨⟨p4, p4_ne⟩, p4_mem_α, p4_eq⟩ := hp4'
dsimp at p3_eq p4_eq
rw [←p3_eq, ←p4_eq]
have hne : p3 ≠ p4 := by rwa [p3_eq, p4_eq]
have h8 := h6 ⟨⟨p3, p3_ne⟩, p3_mem_α⟩ ⟨⟨p4, p4_ne⟩, p4_mem_α⟩
(by simp[hne, Person'])
let t3': Topic' := ⟨discusses p3 p4, h8⟩
have h9 := ht3 t3'
rw [←h9]
theorem imo1964_p4
(Person Topic : Type)
[Fintype Person] [DecidableEq Person]
[Fintype Topic] [DecidableEq Topic]
(card_person : Fintype.card Person = 17)
(card_topic : Fintype.card Topic = 3)
(discusses : Person → Person → Topic)
(discussion_sym : ∀ p1 p2 : Person, discusses p1 p2 = discusses p2 p1) :
∃ t : Topic, ∃ s : Finset Person,
2 < s.card ∧
∀ p1 ∈ s, ∀ p2 ∈ s, p1 ≠ p2 → discusses p1 p2 = t := by
-- Choose a person p1.
have p1 : Person := Nonempty.some (Fintype.card_pos_iff.mp (by omega))
let Person' := {p2 // p2 ≠ p1}
-- By the pigeonhole principle, there must be some topic t1 such
-- that the size of the set {p2 // p2 ≠ p1 ∧ discusses p1 p2 = t1}
-- is at least 6.
have hfcα : Fintype.card Person' = 16 := by
simp [Fintype.card_subtype_compl, card_person, Person']
have h1 : Fintype.card Topic * 5 < Fintype.card Person' := by
rw [hfcα, card_topic]; norm_num
have h2 := Fintype.exists_lt_card_fiber_of_mul_lt_card
(fun (p2: Person') ↦ discusses p1 p2.val) h1
clear h1
obtain ⟨t1, ht1⟩ := h2
-- Call that set α.
let α := (Finset.filter (fun (x : Person') ↦ discusses p1 ↑x = t1) Finset.univ)
have cardα : 5 < Fintype.card α := by rw [Fintype.card_coe]; exact ht1;
-- If any pair of people p2 p3 in α discusses topic t1, then we are done.
by_cases h6 : ∃ p2 p3 : α, p2 ≠ p3 ∧ discusses p2.val p3.val = t1
· obtain ⟨p3, p4, hp1, hp2⟩ := h6
use t1
-- the set we want is {p1,p3,p4}
let s1 : Finset Person := {p3.val.val}
have hs1 : ¬ p4.val.val ∈ s1 := by
rw [Finset.mem_singleton]; intro hp
exact (hp1 (Subtype.val_injective (Subtype.val_injective hp)).symm).elim
let s2 : Finset Person := Finset.cons p4.val s1 hs1
have hs2 : ¬ p1 ∈ s2 := by
rw [Finset.mem_cons, Finset.mem_singleton]; intro hp
cases hp with
| inl hp => exact (p4.val.property.symm hp).elim
| inr hp => exact (p3.val.property.symm hp).elim
let s3 : Finset Person := Finset.cons p1 s2 hs2
use s3
grind
· -- So the people in α must all discuss only the remaining two topics.
push_neg at h6
let Topic' := {t2 // t2 ≠ t1}
have h3 : Fintype Topic' := Fintype.ofFinite Topic'
have h4 : Fintype.card Topic' = 2 := by
simp [Fintype.card_subtype_compl, card_topic, Topic']
have t0 : Topic' := Nonempty.some (Fintype.card_pos_iff.mp (by positivity))
let discusses' : α → α → Topic' :=
fun (p2 p3 : α) ↦
if heq : p2 = p3 then t0
else
⟨discusses p2.val p3.val, h6 ⟨p2, p2.property⟩ ⟨p3, p3.property⟩ heq⟩
have discusses_sym' :
∀ (p1 p2 : { x // x ∈ α }), discusses' p1 p2 = discusses' p2 p1 := by
intro p3 p4
simp only [discusses']
split_ifs with hf1 hf2 hf3
· rfl
· exact (hf2 hf1.symm).elim
· exact (hf1 hf3.symm).elim
· simp[discussion_sym]
have h5 := lemma1 α Topic' cardα h4 discusses' discusses_sym'
obtain ⟨t2, s, hs1, hs2⟩ := h5
use t2
let s' := Finset.map ⟨λ (x : α) => x.val.val,
fun x y hxy ↦ Subtype.coe_injective (Subtype.coe_injective hxy)⟩ s
use s'
constructor
· rwa [Finset.card_map]
· intro p3 hp3 p4 hp4 hp34
rw [Finset.mem_map] at hp3 hp4
obtain ⟨⟨⟨p3', p3_mem_person'⟩, p3_mem_α⟩, p3_mem_s, hp3eq⟩ := hp3
obtain ⟨⟨⟨p4', p4_mem_person'⟩, p4_mem_α⟩, p4_mem_s, hp4eq⟩ := hp4
dsimp at hp3eq hp4eq
rw [←hp3eq, ←hp4eq]
have hne : p3' ≠ p4' := by rwa[hp3eq, hp4eq]
have h6 := hs2 ⟨⟨p3', p3_mem_person'⟩, p3_mem_α⟩ p3_mem_s
⟨⟨p4', p4_mem_person'⟩, p4_mem_α⟩ p4_mem_s
(by simp [hne, Person'])
simp [hne, Person', discusses'] at h6
exact (congrArg Subtype.val h6)
end Imo1964P4 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1964P4.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unsolved goals\nPerson Topic : Type\ninst\u271d\u00b3 : Fintype Person\ninst\u271d\u00b2 : DecidableEq Person\ninst\u271d\u00b9 : Fintype Topic\ninst\u271d : DecidableEq Topic\ncard_person : 5 < Fintype.card Person\ncard_topic : Fintype.card Topic = 2\ndiscusses : Person \u2192 Person \u2192 Topic\ndiscussion_sym : \u2200 (p1 p2 : Person), discusses p1 p2 = discusses p2 p1\n\u22a2 0 < Fintype.card Person", "unsolved goals\nPerson Topic : Type\ninst\u271d\u00b3 : Fintype Person\ninst\u271d\u00b2 : DecidableEq Person\ninst\u271d\u00b9 : Fintype Topic\ninst\u271d : DecidableEq Topic\ncard_person : 5 < Fintype.card Person\ncard_topic : Fintype.card Topic = 2\ndiscusses : Person \u2192 Person \u2192 Topic\ndiscussion_sym : \u2200 (p1 p2 : Person), discusses p1 p2 = discusses p2 p1\np2 : Person\n\u22a2 \u2203 t s, 2 < s.card \u2227 \u2200 p1 \u2208 s, \u2200 p2 \u2208 s, p1 \u2260 p2 \u2192 discusses p1 p2 = t", "unexpected identifier; expected command", "unknown tactic", "unsolved goals\nPerson Topic : Type\ninst\u271d\u00b3 : Fintype Person\ninst\u271d\u00b2 : DecidableEq Person\ninst\u271d\u00b9 : Fintype Topic\ninst\u271d : DecidableEq Topic\ncard_person : Fintype.card Person = 17\ncard_topic : Fintype.card Topic = 3\ndiscusses : Person \u2192 Person \u2192 Topic\ndiscussion_sym : \u2200 (p1 p2 : Person), discusses p1 p2 = discusses p2 p1\n\u22a2 0 < Fintype.card Person", "unsolved goals\nPerson Topic : Type\ninst\u271d\u00b3 : Fintype Person\ninst\u271d\u00b2 : DecidableEq Person\ninst\u271d\u00b9 : Fintype Topic\ninst\u271d : DecidableEq Topic\ncard_person : Fintype.card Person = 17\ncard_topic : Fintype.card Topic = 3\ndiscusses : Person \u2192 Person \u2192 Topic\ndiscussion_sym : \u2200 (p1 p2 : Person), discusses p1 p2 = discusses p2 p1\np1 : Person\n\u22a2 \u2203 t s, 2 < s.card \u2227 \u2200 p1 \u2208 s, \u2200 p2 \u2208 s, p1 \u2260 p2 \u2192 discusses p1 p2 = t"], "timeout_s": 600.0, "latency_s": 0.068, "verified_at": "2026-03-26T18:16:10.656800+00:00"}} | false | true | false | 0.068 |
compfiles_Imo1965P1 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad
-/
import Mathlib
/-!
# International Mathematical Olympiad 1965, Problem 1
Determine all values x in the interval 0 ≤ x ≤ 2π which
satisfy the inequality
2 cos x ≤ |√(1 + sin 2x) − √(1 − sin 2x)| ≤ √2.
-/
namespace Imo1965P1
open Real Set
abbrev the_answer : Set ℝ := Icc (π/4) (7*π/4)
theorem imo1965_p1 :
{x ∈ Icc 0 (2*π) |
|√(1 + sin (2*x)) - √(1 - sin (2*x))| ∈ Icc (2 * cos x) √2}
= the_answer := by
-- We follow https://artofproblemsolving.com/wiki/index.php/1965_IMO_Problems/Problem_1.
have h0 : ∀ x, (√(1 + sin (2*x)) - √(1 - sin (2*x)))^2 = 2 - 2*|cos (2*x)| := by
intro x
rw [←sqrt_sq_eq_abs (cos (2 * x)), cos_sq', sub_sq, sq_sqrt, sq_sqrt, mul_assoc,
←sqrt_mul]
· ring_nf
repeat { linarith [sin_le_one (2 * x), neg_one_le_sin (2 * x)] }
have : ∀ x, |√(1 + sin (2*x)) - √(1 - sin (2*x))| ≤ √2 := by
intro x
apply nonneg_le_nonneg_of_sq_le_sq (by norm_num)
simp [←pow_two, h0]
simp only [Set.mem_Icc]
simp_rw [this, and_true]
symm; ext x; constructor
· dsimp
rw [the_answer]; rintro ⟨h1, h2⟩
constructor
· constructor <;> linarith
have : x ∈ Ico (π/4) (π / 2) ∪ Icc (π/2) (3*π/2) ∪ Ioc (3*π/2) (7*π/4) := by
simp only [mem_Icc, mem_union, mem_Ico, mem_Ioc]
rcases lt_or_ge x (π/2) with h3 | h3 <;>
rcases le_or_gt x (3*π/2) with h4 | h4 <;> simp [*]
rcases this with (⟨_, h4⟩ | ⟨h3, h4⟩) | ⟨h3, _⟩
· have cos2x_nonpos : cos (2*x) ≤ 0 := by
apply cos_nonpos_of_pi_div_two_le_of_le <;> linarith
have cosx_nonneg : 0 ≤ cos x := by
apply cos_nonneg_of_neg_pi_div_two_le_of_le <;> linarith
have cosx2_nonneg : 0 ≤ 2 * cos x := by linarith
rw [←abs_of_nonneg cosx2_nonneg, ←sq_le_sq, h0, abs_of_nonpos cos2x_nonpos, cos_two_mul]
linarith
· trans 0; swap;
· simp
suffices cos x ≤ 0 by linarith
apply cos_nonpos_of_pi_div_two_le_of_le h3
linarith
· have cos2x_nonpos : cos (2*x) ≤ 0 := by
rw [←cos_neg, ←cos_add_two_pi, ←cos_add_two_pi]
apply cos_nonpos_of_pi_div_two_le_of_le <;> linarith
have cosx_nonneg : 0 ≤ cos x := by
rw [←cos_neg, ←cos_add_two_pi]
apply cos_nonneg_of_neg_pi_div_two_le_of_le <;> linarith
have cosx2_nonneg : 0 ≤ 2 * cos x := by linarith
rw [←abs_of_nonneg cosx2_nonneg, ←sq_le_sq, h0, abs_of_nonpos cos2x_nonpos, cos_two_mul]
linarith
rintro ⟨⟨h1, h2⟩, h3⟩
by_contra h4
rw [the_answer, mem_Icc, not_and_or] at h4; push_neg at h4
have cos2x_nonneg : 0 ≤ cos (2*x) := by
rcases h4 with h4 | h4
· apply cos_nonneg_of_neg_pi_div_two_le_of_le <;> linarith
· rw [←cos_sub_two_pi, ←cos_sub_two_pi]
apply cos_nonneg_of_neg_pi_div_two_le_of_le <;> linarith
have cosx_nonneg : 0 ≤ cos x := by
rcases h4 with h4 | h4
· apply cos_nonneg_of_neg_pi_div_two_le_of_le <;> linarith
· rw [←cos_neg, ←cos_add_two_pi]
apply cos_nonneg_of_neg_pi_div_two_le_of_le <;> linarith
have cosx2_nonneg : 0 ≤ 2 * cos x := by linarith
rw [←abs_of_nonneg cosx2_nonneg, ←sq_le_sq, h0, abs_of_nonneg cos2x_nonneg, cos_two_mul] at h3
ring_nf at h3
suffices (cos (π/4))^2 < (cos x)^2 by
rw [cos_pi_div_four, div_pow] at this; norm_num at this
linarith
rw [sq_lt_sq, abs_of_nonneg cosx_nonneg, abs_of_nonneg]
swap
· simp [cos_pi_div_four]; positivity
rcases h4 with h5 | h5
· apply cos_lt_cos_of_nonneg_of_le_pi_div_two h1 (by linarith) h5
rw [←cos_neg x, ←cos_add_two_pi (-x)]
apply cos_lt_cos_of_nonneg_of_le_pi_div_two <;> linarith | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad
-/
import Mathlib
/-!
# International Mathematical Olympiad 1965, Problem 1
Determine all values x in the interval 0 ≤ x ≤ 2π which
satisfy the inequality
2 cos x ≤ |√(1 + sin 2x) − √(1 − sin 2x)| ≤ √2.
-/
namespace Imo1965P1
open Real Set
abbrev the_answer : Set ℝ := Icc (π/4) (7*π/4)
theorem imo1965_p1 :
{x ∈ Icc 0 (2*π) |
|√(1 + sin (2*x)) - √(1 - sin (2*x))| ∈ Icc (2 * cos x) √2}
= the_answer := by
-- We follow https://artofproblemsolving.com/wiki/index.php/1965_IMO_Problems/Problem_1.
have h0 : ∀ x, (√(1 + sin (2*x)) - √(1 - sin (2*x)))^2 = 2 - 2*|cos (2*x)| := by
intro x
rw [←sqrt_sq_eq_abs (cos (2 * x)), cos_sq', sub_sq, sq_sqrt, sq_sqrt, mul_assoc,
←sqrt_mul]
· ring_nf
repeat { linarith [sin_le_one (2 * x), neg_one_le_sin (2 * x)] }
have : ∀ x, |√(1 + sin (2*x)) - √(1 - sin (2*x))| ≤ √2 := by
intro x
apply nonneg_le_nonneg_of_sq_le_sq (by norm_num)
simp [←pow_two, h0]
simp only [Set.mem_Icc]
simp_rw [this, and_true]
symm; ext x; constructor
· dsimp
rw [the_answer]; rintro ⟨h1, h2⟩
constructor
· constructor <;> linarith
have : x ∈ Ico (π/4) (π / 2) ∪ Icc (π/2) (3*π/2) ∪ Ioc (3*π/2) (7*π/4) := by
simp only [mem_Icc, mem_union, mem_Ico, mem_Ioc]
rcases lt_or_ge x (π/2) with h3 | h3 <;>
rcases le_or_gt x (3*π/2) with h4 | h4 <;> simp [*]
rcases this with (⟨_, h4⟩ | ⟨h3, h4⟩) | ⟨h3, _⟩
· have cos2x_nonpos : cos (2*x) ≤ 0 := by
apply cos_nonpos_of_pi_div_two_le_of_le <;> linarith
have cosx_nonneg : 0 ≤ cos x := by
apply cos_nonneg_of_neg_pi_div_two_le_of_le <;> linarith
have cosx2_nonneg : 0 ≤ 2 * cos x := by linarith
rw [←abs_of_nonneg cosx2_nonneg, ←sq_le_sq, h0, abs_of_nonpos cos2x_nonpos, cos_two_mul]
linarith
· trans 0; swap;
· simp
suffices cos x ≤ 0 by linarith
apply cos_nonpos_of_pi_div_two_le_of_le h3
linarith
· have cos2x_nonpos : cos (2*x) ≤ 0 := by
rw [←cos_neg, ←cos_add_two_pi, ←cos_add_two_pi]
apply cos_nonpos_of_pi_div_two_le_of_le <;> linarith
have cosx_nonneg : 0 ≤ cos x := by
rw [←cos_neg, ←cos_add_two_pi]
apply cos_nonneg_of_neg_pi_div_two_le_of_le <;> linarith
have cosx2_nonneg : 0 ≤ 2 * cos x := by linarith
rw [←abs_of_nonneg cosx2_nonneg, ←sq_le_sq, h0, abs_of_nonpos cos2x_nonpos, cos_two_mul]
linarith
rintro ⟨⟨h1, h2⟩, h3⟩
by_contra h4
rw [the_answer, mem_Icc, not_and_or] at h4; push_neg at h4
have cos2x_nonneg : 0 ≤ cos (2*x) := by
rcases h4 with h4 | h4
· apply cos_nonneg_of_neg_pi_div_two_le_of_le <;> linarith
· rw [←cos_sub_two_pi, ←cos_sub_two_pi]
apply cos_nonneg_of_neg_pi_div_two_le_of_le <;> linarith
have cosx_nonneg : 0 ≤ cos x := by
rcases h4 with h4 | h4
· apply cos_nonneg_of_neg_pi_div_two_le_of_le <;> linarith
· rw [←cos_neg, ←cos_add_two_pi]
apply cos_nonneg_of_neg_pi_div_two_le_of_le <;> linarith
have cosx2_nonneg : 0 ≤ 2 * cos x := by linarith
rw [←abs_of_nonneg cosx2_nonneg, ←sq_le_sq, h0, abs_of_nonneg cos2x_nonneg, cos_two_mul] at h3
ring_nf at h3
suffices (cos (π/4))^2 < (cos x)^2 by
rw [cos_pi_div_four, div_pow] at this; norm_num at this
linarith
rw [sq_lt_sq, abs_of_nonneg cosx_nonneg, abs_of_nonneg]
swap
· simp [cos_pi_div_four]; positivity
rcases h4 with h5 | h5
· apply cos_lt_cos_of_nonneg_of_le_pi_div_two h1 (by linarith) h5
rw [←cos_neg x, ←cos_add_two_pi (-x)]
apply cos_lt_cos_of_nonneg_of_le_pi_div_two <;> linarith
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad
-/
import Mathlib
/-!
# International Mathematical Olympiad 1965, Problem 1
Determine all values x in the interval 0 ≤ x ≤ 2π which
satisfy the inequality
2 cos x ≤ |√(1 + sin 2x) − √(1 − sin 2x)| ≤ √2.
-/
namespace Imo1965P1
open Real Set
abbrev the_answer : Set ℝ := Icc (π/4) (7*π/4)
theorem imo1965_p1 :
{x ∈ Icc 0 (2*π) |
|√(1 + sin (2*x)) - √(1 - sin (2*x))| ∈ Icc (2 * cos x) √2}
= the_answer := by
-- We follow https://artofproblemsolving.com/wiki/index.php/1965_IMO_Problems/Problem_1.
have h0 : ∀ x, (√(1 + sin (2*x)) - √(1 - sin (2*x)))^2 = 2 - 2*|cos (2*x)| := by
intro x
rw [←sqrt_sq_eq_abs (cos (2 * x)), cos_sq', sub_sq, sq_sqrt, sq_sqrt, mul_assoc,
←sqrt_mul]
· ring_nf
repeat { linarith [sin_le_one (2 * x), neg_one_le_sin (2 * x)] }
have : ∀ x, |√(1 + sin (2*x)) - √(1 - sin (2*x))| ≤ √2 := by
intro x
apply nonneg_le_nonneg_of_sq_le_sq (by norm_num)
simp [←pow_two, h0]
simp only [Set.mem_Icc]
simp_rw [this, and_true]
symm; ext x; constructor
· dsimp
rw [the_answer]; rintro ⟨h1, h2⟩
constructor
· constructor <;> linarith
have : x ∈ Ico (π/4) (π / 2) ∪ Icc (π/2) (3*π/2) ∪ Ioc (3*π/2) (7*π/4) := by
simp only [mem_Icc, mem_union, mem_Ico, mem_Ioc]
rcases lt_or_ge x (π/2) with h3 | h3 <;>
rcases le_or_gt x (3*π/2) with h4 | h4 <;> simp [*]
rcases this with (⟨_, h4⟩ | ⟨h3, h4⟩) | ⟨h3, _⟩
· have cos2x_nonpos : cos (2*x) ≤ 0 := by
apply cos_nonpos_of_pi_div_two_le_of_le <;> linarith
have cosx_nonneg : 0 ≤ cos x := by
apply cos_nonneg_of_neg_pi_div_two_le_of_le <;> linarith
have cosx2_nonneg : 0 ≤ 2 * cos x := by linarith
rw [←abs_of_nonneg cosx2_nonneg, ←sq_le_sq, h0, abs_of_nonpos cos2x_nonpos, cos_two_mul]
linarith
· trans 0; swap;
· simp
suffices cos x ≤ 0 by linarith
apply cos_nonpos_of_pi_div_two_le_of_le h3
linarith
· have cos2x_nonpos : cos (2*x) ≤ 0 := by
rw [←cos_neg, ←cos_add_two_pi, ←cos_add_two_pi]
apply cos_nonpos_of_pi_div_two_le_of_le <;> linarith
have cosx_nonneg : 0 ≤ cos x := by
rw [←cos_neg, ←cos_add_two_pi]
apply cos_nonneg_of_neg_pi_div_two_le_of_le <;> linarith
have cosx2_nonneg : 0 ≤ 2 * cos x := by linarith
rw [←abs_of_nonneg cosx2_nonneg, ←sq_le_sq, h0, abs_of_nonpos cos2x_nonpos, cos_two_mul]
linarith
rintro ⟨⟨h1, h2⟩, h3⟩
by_contra h4
rw [the_answer, mem_Icc, not_and_or] at h4; push_neg at h4
have cos2x_nonneg : 0 ≤ cos (2*x) := by
rcases h4 with h4 | h4
· apply cos_nonneg_of_neg_pi_div_two_le_of_le <;> linarith
· rw [←cos_sub_two_pi, ←cos_sub_two_pi]
apply cos_nonneg_of_neg_pi_div_two_le_of_le <;> linarith
have cosx_nonneg : 0 ≤ cos x := by
rcases h4 with h4 | h4
· apply cos_nonneg_of_neg_pi_div_two_le_of_le <;> linarith
· rw [←cos_neg, ←cos_add_two_pi]
apply cos_nonneg_of_neg_pi_div_two_le_of_le <;> linarith
have cosx2_nonneg : 0 ≤ 2 * cos x := by linarith
rw [←abs_of_nonneg cosx2_nonneg, ←sq_le_sq, h0, abs_of_nonneg cos2x_nonneg, cos_two_mul] at h3
ring_nf at h3
suffices (cos (π/4))^2 < (cos x)^2 by
rw [cos_pi_div_four, div_pow] at this; norm_num at this
linarith
rw [sq_lt_sq, abs_of_nonneg cosx_nonneg, abs_of_nonneg]
swap
· simp [cos_pi_div_four]; positivity
rcases h4 with h5 | h5
· apply cos_lt_cos_of_nonneg_of_le_pi_div_two h1 (by linarith) h5
rw [←cos_neg x, ←cos_add_two_pi (-x)]
apply cos_lt_cos_of_nonneg_of_le_pi_div_two <;> linarith | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1965P1.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 600.0, "latency_s": 5.5324, "verified_at": "2026-03-26T18:16:16.189337+00:00"}} | true | true | false | 5.5324 |
compfiles_Imo1965P2 | compfiles | Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1965, Problem 2
Suppose that
a₁₁x₁ + a₁₂x₂ + a₁₃x₃ = 0
a₂₁x₁ + a₂₂x₂ + a₂₃x₃ = 0
a₃₁x₁ + a₃₂x₂ + a₃₃x₃ = 0
where
(A) a₁₁, a₂₂, a₃₃ are positive
(B) the remaining aᵢⱼ are negative
(C) in each row i, the sum of the coefficients aᵢⱼ is positive.
Prove that x₁ = x₂ = x₃ = 0.
-/
namespace Imo1965P2
abbrev propEqs (x : Fin 3 → ℝ) (a : Fin 3 → Fin 3 → ℝ) : Prop :=
∀ i, ∑ j : Fin 3, (a i j * x j) = 0
lemma lemma0 (x : Fin 3 → ℝ) (a : Fin 3 → Fin 3 → ℝ) (p : Fin 3 → Fin 3)
(hp : p.Bijective)
(he : propEqs x a) : propEqs (x ∘ p) (fun i j ↦ a (p i) (p j)) := by
intro i
dsimp
have hi := he (p i)
rwa [Function.Bijective.sum_comp hp (fun j ↦ a (p i) j * x j)]
abbrev propsAB (a : Fin 3 → Fin 3 → ℝ) : Prop :=
∀ i j, if i = j then 0 < a i j else a i j < 0
lemma lemma1 (a : Fin 3 → Fin 3 → ℝ) (p : Fin 3 → Fin 3)
(hp : p.Bijective)
(hab : propsAB a) :
propsAB (fun i j ↦ a (p i) (p j)) := by
intro i j
have h0 := hab (p i) (p j)
split_ifs with h1
· subst h1
simp only [reduceIte] at h0
exact h0
· have h2 : p i ≠ p j := fun a ↦ h1 (hp.1 a)
simp only [h2] at h0
exact h0
lemma lemma2 (a : Fin 3 → Fin 3 → ℝ)
(p : Fin 3 → Fin 3)
(hp : p.Bijective)
(hc : ∀ i, 0 < ∑ j : Fin 3, a i j) :
∀ i, 0 < ∑ j : Fin 3, a (p i) (p j) := by
intro i
rw [Function.Bijective.sum_comp hp]
exact hc (p i)
theorem imo1965_p2 (x : Fin 3 → ℝ) (a : Fin 3 → Fin 3 → ℝ)
(heqs : ∀ i, ∑ j : Fin 3, (a i j * x j) = 0)
(hab : ∀ i j, if i = j then 0 < a i j else a i j < 0)
(hc : ∀ i, 0 < ∑ j : Fin 3, a i j)
: ∀ i, x i = 0 := by
-- https://prase.cz/kalva/imo/isoln/isoln652.html
-- wlog, |x 0| ≥ |x 1| and |x 0| ≥ |x 2|.
wlog h1 : |x 1| ≤ |x 0| with H
· let p : Fin 3 → Fin 3 := ![1, 0, 2]
have hp : p.Bijective := by decide
have h2 := H (x ∘ p) (fun i j ↦ a (p i) (p j))
(lemma0 x a p hp heqs)
(lemma1 _ p hp hab)
(lemma2 _ p hp hc)
(le_of_not_ge h1)
intro i
fin_cases i
· exact h2 1
· exact h2 0
· exact h2 2
wlog h2 : |x 2| ≤ |x 0| with H
· have h2' : |x 0| ≤ |x 2| := le_of_not_ge h2
have h3 : |x 1| ≤ |x 2| := ge_trans h2' h1
let p : Fin 3 → Fin 3 := ![2, 0, 1]
have hp : p.Bijective := by decide
have h4 := H (x ∘ p) (fun i j ↦ a (p i) (p j))
(lemma0 x a p hp heqs)
(lemma1 _ p hp hab)
(lemma2 _ p hp hc)
h2' h3
intro i
fin_cases i
· exact h4 1
· exact h4 2
· exact h4 0
have h3' : 0 < a 0 1 + a 0 2 + a 0 0 := by
have h4 : ∑ j : Fin 3, a 0 j = a 0 1 + a 0 2 + a 0 0 := by
rw [Fin.sum_univ_three, add_rotate]
rw [←h4]
exact hc 0
have h4 : - a 0 1 + - a 0 2 < a 0 0 := by linarith only [h3']
have h5 : 0 < - a 0 1 := neg_pos.mpr (hab 0 1)
have h6 : 0 < - a 0 2 := neg_pos.mpr (hab 0 2)
have h10 : 0 < a 0 0 := hab 0 0
have h3 : |-a 0 1| + |-a 0 2| < |a 0 0| := by
rw [abs_of_pos h5, abs_of_pos h6, abs_of_pos h10]
exact h4
have h7 := heqs 0
rw [Fin.sum_univ_three] at h7
by_contra! H
obtain ⟨k, hk⟩ := H
have h8 : 0 < |x k| := abs_pos.mpr hk
have h9 : 0 < |x 0| := by
(obtain rfl | rfl | rfl : k = 0 ∨ k = 1 ∨ k = 2 := by fin_cases k <;> aesop)
<;> linarith only [h1, h2, h8]
replace h7 : a 0 0 * x 0 = - a 0 1 * x 1 + - a 0 2 * x 2 := by linarith only [h7]
apply_fun (|·|) at h7
have h11 := calc
|a 0 0| * |x 0|
= |a 0 0 * x 0| := (abs_mul _ _).symm
_ = _ := h7
_ ≤ |-a 0 1 * x 1| + |-a 0 2 * x 2| := abs_add_le _ _
_ = |-a 0 1| * |x 1| + |-a 0 2| * |x 2| := by simp only [abs_mul]
_ ≤ |-a 0 1| * |x 0| + |-a 0 2| * |x 0| := by gcongr
_ = (|-a 0 1| + |-a 0 2|) * |x 0| := (add_mul _ _ _).symm
have h12 : |a 0 0| ≤ |-a 0 1| + |-a 0 2| := (mul_le_mul_iff_left₀ h9).mp h11
exact not_lt.mpr h12 h3
end Imo1965P2 | /- | /-
Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1965, Problem 2
Suppose that
a₁₁x₁ + a₁₂x₂ + a₁₃x₃ = 0
a₂₁x₁ + a₂₂x₂ + a₂₃x₃ = 0
a₃₁x₁ + a₃₂x₂ + a₃₃x₃ = 0
where
(A) a₁₁, a₂₂, a₃₃ are positive
(B) the remaining aᵢⱼ are negative
(C) in each row i, the sum of the coefficients aᵢⱼ is positive.
Prove that x₁ = x₂ = x₃ = 0.
-/
namespace Imo1965P2
abbrev propEqs (x : Fin 3 → ℝ) (a : Fin 3 → Fin 3 → ℝ) : Prop :=
∀ i, ∑ j : Fin 3, (a i j * x j) = 0
lemma lemma0 (x : Fin 3 → ℝ) (a : Fin 3 → Fin 3 → ℝ) (p : Fin 3 → Fin 3)
(hp : p.Bijective)
(he : propEqs x a) : propEqs (x ∘ p) (fun i j ↦ a (p i) (p j)) := by
intro i
dsimp
have hi := he (p i)
rwa [Function.Bijective.sum_comp hp (fun j ↦ a (p i) j * x j)]
abbrev propsAB (a : Fin 3 → Fin 3 → ℝ) : Prop :=
∀ i j, if i = j then 0 < a i j else a i j < 0
lemma lemma1 (a : Fin 3 → Fin 3 → ℝ) (p : Fin 3 → Fin 3)
(hp : p.Bijective)
(hab : propsAB a) :
propsAB (fun i j ↦ a (p i) (p j)) := by
intro i j
have h0 := hab (p i) (p j)
split_ifs with h1
· subst h1
simp only [reduceIte] at h0
exact h0
· have h2 : p i ≠ p j := fun a ↦ h1 (hp.1 a)
simp only [h2] at h0
exact h0
lemma lemma2 (a : Fin 3 → Fin 3 → ℝ)
(p : Fin 3 → Fin 3)
(hp : p.Bijective)
(hc : ∀ i, 0 < ∑ j : Fin 3, a i j) :
∀ i, 0 < ∑ j : Fin 3, a (p i) (p j) := by
intro i
rw [Function.Bijective.sum_comp hp]
exact hc (p i)
theorem imo1965_p2 (x : Fin 3 → ℝ) (a : Fin 3 → Fin 3 → ℝ)
(heqs : ∀ i, ∑ j : Fin 3, (a i j * x j) = 0)
(hab : ∀ i j, if i = j then 0 < a i j else a i j < 0)
(hc : ∀ i, 0 < ∑ j : Fin 3, a i j)
: ∀ i, x i = 0 := by
-- https://prase.cz/kalva/imo/isoln/isoln652.html
-- wlog, |x 0| ≥ |x 1| and |x 0| ≥ |x 2|.
wlog h1 : |x 1| ≤ |x 0| with H
· let p : Fin 3 → Fin 3 := ![1, 0, 2]
have hp : p.Bijective := by decide
have h2 := H (x ∘ p) (fun i j ↦ a (p i) (p j))
(lemma0 x a p hp heqs)
(lemma1 _ p hp hab)
(lemma2 _ p hp hc)
(le_of_not_ge h1)
intro i
fin_cases i
· exact h2 1
· exact h2 0
· exact h2 2
wlog h2 : |x 2| ≤ |x 0| with H
· have h2' : |x 0| ≤ |x 2| := le_of_not_ge h2
have h3 : |x 1| ≤ |x 2| := ge_trans h2' h1
let p : Fin 3 → Fin 3 := ![2, 0, 1]
have hp : p.Bijective := by decide
have h4 := H (x ∘ p) (fun i j ↦ a (p i) (p j))
(lemma0 x a p hp heqs)
(lemma1 _ p hp hab)
(lemma2 _ p hp hc)
h2' h3
intro i
fin_cases i
· exact h4 1
· exact h4 2
· exact h4 0
have h3' : 0 < a 0 1 + a 0 2 + a 0 0 := by
have h4 : ∑ j : Fin 3, a 0 j = a 0 1 + a 0 2 + a 0 0 := by
rw [Fin.sum_univ_three, add_rotate]
rw [←h4]
exact hc 0
have h4 : - a 0 1 + - a 0 2 < a 0 0 := by linarith only [h3']
have h5 : 0 < - a 0 1 := neg_pos.mpr (hab 0 1)
have h6 : 0 < - a 0 2 := neg_pos.mpr (hab 0 2)
have h10 : 0 < a 0 0 := hab 0 0
have h3 : |-a 0 1| + |-a 0 2| < |a 0 0| := by
rw [abs_of_pos h5, abs_of_pos h6, abs_of_pos h10]
exact h4
have h7 := heqs 0
rw [Fin.sum_univ_three] at h7
by_contra! H
obtain ⟨k, hk⟩ := H
have h8 : 0 < |x k| := abs_pos.mpr hk
have h9 : 0 < |x 0| := by
(obtain rfl | rfl | rfl : k = 0 ∨ k = 1 ∨ k = 2 := by fin_cases k <;> aesop)
<;> linarith only [h1, h2, h8]
replace h7 : a 0 0 * x 0 = - a 0 1 * x 1 + - a 0 2 * x 2 := by linarith only [h7]
apply_fun (|·|) at h7
have h11 := calc
|a 0 0| * |x 0|
= |a 0 0 * x 0| := (abs_mul _ _).symm
_ = _ := h7
_ ≤ |-a 0 1 * x 1| + |-a 0 2 * x 2| := abs_add_le _ _
_ = |-a 0 1| * |x 1| + |-a 0 2| * |x 2| := by simp only [abs_mul]
_ ≤ |-a 0 1| * |x 0| + |-a 0 2| * |x 0| := by gcongr
_ = (|-a 0 1| + |-a 0 2|) * |x 0| := (add_mul _ _ _).symm
have h12 : |a 0 0| ≤ |-a 0 1| + |-a 0 2| := (mul_le_mul_iff_left₀ h9).mp h11
exact not_lt.mpr h12 h3
end Imo1965P2
| true | Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1965, Problem 2
Suppose that
a₁₁x₁ + a₁₂x₂ + a₁₃x₃ = 0
a₂₁x₁ + a₂₂x₂ + a₂₃x₃ = 0
a₃₁x₁ + a₃₂x₂ + a₃₃x₃ = 0
where
(A) a₁₁, a₂₂, a₃₃ are positive
(B) the remaining aᵢⱼ are negative
(C) in each row i, the sum of the coefficients aᵢⱼ is positive.
Prove that x₁ = x₂ = x₃ = 0.
-/
namespace Imo1965P2
abbrev propEqs (x : Fin 3 → ℝ) (a : Fin 3 → Fin 3 → ℝ) : Prop :=
∀ i, ∑ j : Fin 3, (a i j * x j) = 0
lemma lemma0 (x : Fin 3 → ℝ) (a : Fin 3 → Fin 3 → ℝ) (p : Fin 3 → Fin 3)
(hp : p.Bijective)
(he : propEqs x a) : propEqs (x ∘ p) (fun i j ↦ a (p i) (p j)) := by
intro i
dsimp
have hi := he (p i)
rwa [Function.Bijective.sum_comp hp (fun j ↦ a (p i) j * x j)]
abbrev propsAB (a : Fin 3 → Fin 3 → ℝ) : Prop :=
∀ i j, if i = j then 0 < a i j else a i j < 0
lemma lemma1 (a : Fin 3 → Fin 3 → ℝ) (p : Fin 3 → Fin 3)
(hp : p.Bijective)
(hab : propsAB a) :
propsAB (fun i j ↦ a (p i) (p j)) := by
intro i j
have h0 := hab (p i) (p j)
split_ifs with h1
· subst h1
simp only [reduceIte] at h0
exact h0
· have h2 : p i ≠ p j := fun a ↦ h1 (hp.1 a)
simp only [h2] at h0
exact h0
lemma lemma2 (a : Fin 3 → Fin 3 → ℝ)
(p : Fin 3 → Fin 3)
(hp : p.Bijective)
(hc : ∀ i, 0 < ∑ j : Fin 3, a i j) :
∀ i, 0 < ∑ j : Fin 3, a (p i) (p j) := by
intro i
rw [Function.Bijective.sum_comp hp]
exact hc (p i)
theorem imo1965_p2 (x : Fin 3 → ℝ) (a : Fin 3 → Fin 3 → ℝ)
(heqs : ∀ i, ∑ j : Fin 3, (a i j * x j) = 0)
(hab : ∀ i j, if i = j then 0 < a i j else a i j < 0)
(hc : ∀ i, 0 < ∑ j : Fin 3, a i j)
: ∀ i, x i = 0 := by
-- https://prase.cz/kalva/imo/isoln/isoln652.html
-- wlog, |x 0| ≥ |x 1| and |x 0| ≥ |x 2|.
wlog h1 : |x 1| ≤ |x 0| with H
· let p : Fin 3 → Fin 3 := ![1, 0, 2]
have hp : p.Bijective := by decide
have h2 := H (x ∘ p) (fun i j ↦ a (p i) (p j))
(lemma0 x a p hp heqs)
(lemma1 _ p hp hab)
(lemma2 _ p hp hc)
(le_of_not_ge h1)
intro i
fin_cases i
· exact h2 1
· exact h2 0
· exact h2 2
wlog h2 : |x 2| ≤ |x 0| with H
· have h2' : |x 0| ≤ |x 2| := le_of_not_ge h2
have h3 : |x 1| ≤ |x 2| := ge_trans h2' h1
let p : Fin 3 → Fin 3 := ![2, 0, 1]
have hp : p.Bijective := by decide
have h4 := H (x ∘ p) (fun i j ↦ a (p i) (p j))
(lemma0 x a p hp heqs)
(lemma1 _ p hp hab)
(lemma2 _ p hp hc)
h2' h3
intro i
fin_cases i
· exact h4 1
· exact h4 2
· exact h4 0
have h3' : 0 < a 0 1 + a 0 2 + a 0 0 := by
have h4 : ∑ j : Fin 3, a 0 j = a 0 1 + a 0 2 + a 0 0 := by
rw [Fin.sum_univ_three, add_rotate]
rw [←h4]
exact hc 0
have h4 : - a 0 1 + - a 0 2 < a 0 0 := by linarith only [h3']
have h5 : 0 < - a 0 1 := neg_pos.mpr (hab 0 1)
have h6 : 0 < - a 0 2 := neg_pos.mpr (hab 0 2)
have h10 : 0 < a 0 0 := hab 0 0
have h3 : |-a 0 1| + |-a 0 2| < |a 0 0| := by
rw [abs_of_pos h5, abs_of_pos h6, abs_of_pos h10]
exact h4
have h7 := heqs 0
rw [Fin.sum_univ_three] at h7
by_contra! H
obtain ⟨k, hk⟩ := H
have h8 : 0 < |x k| := abs_pos.mpr hk
have h9 : 0 < |x 0| := by
(obtain rfl | rfl | rfl : k = 0 ∨ k = 1 ∨ k = 2 := by fin_cases k <;> aesop)
<;> linarith only [h1, h2, h8]
replace h7 : a 0 0 * x 0 = - a 0 1 * x 1 + - a 0 2 * x 2 := by linarith only [h7]
apply_fun (|·|) at h7
have h11 := calc
|a 0 0| * |x 0|
= |a 0 0 * x 0| := (abs_mul _ _).symm
_ = _ := h7
_ ≤ |-a 0 1 * x 1| + |-a 0 2 * x 2| := abs_add_le _ _
_ = |-a 0 1| * |x 1| + |-a 0 2| * |x 2| := by simp only [abs_mul]
_ ≤ |-a 0 1| * |x 0| + |-a 0 2| * |x 0| := by gcongr
_ = (|-a 0 1| + |-a 0 2|) * |x 0| := (add_mul _ _ _).symm
have h12 : |a 0 0| ≤ |-a 0 1| + |-a 0 2| := (mul_le_mul_iff_left₀ h9).mp h11
exact not_lt.mpr h12 h3
end Imo1965P2 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1965P2.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown identifier 'mul_le_mul_iff_left\u2080'"], "timeout_s": 600.0, "latency_s": 2.4826, "verified_at": "2026-03-26T18:16:13.450914+00:00"}} | false | true | false | 2.4826 |
compfiles_Imo1965P4 | compfiles | Copyright (c) 2025 The Compfiles Authors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Rydh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1965, Problem 4
Find all sets of four real numbers x₁, x₂, x₃, x₄ such that the sum of any one
and the product of the other three is equal to 2.
-/
namespace Imo1965P4
abbrev solution : Set (Multiset ℝ) := {{1, 1, 1, 1}, {-1, -1, -1, 3}}
lemma cubic {x : ℝ} (h : x^3 + x - 2 = 0) : x = 1 := by
by_cases h : x = 1
· exact h
· nlinarith [sq_nonneg (x + 1/2)]
lemma multiset_erase {α : Type} [DecidableEq α] {s s' : Multiset α} (a : α) (ha : a ∈ s) :
s.erase a = s' → s = a ::ₘ s' := fun _ ↦ by grind only [Multiset.cons_erase ha]
-- Simple lemmas about the order of elements in a specific multiset
syntax "multiset_order_tactic" : tactic
macro_rules
| `(tactic| multiset_order_tactic) => `(tactic| (
ext x
by_cases h1 : x = 3 <;> simp [h1, show 3 ≠ (-1 : ℝ) by norm_num]
by_cases h2 : x = -1 <;> simp [h1, h2, show (-1 : ℝ) ≠ 3 by norm_num]))
lemma multiset_order₁ : ({3, -1, -1, -1} : Multiset ℝ) = {-1, -1, -1, 3} := by multiset_order_tactic
lemma multiset_order₂ : ({-1, 3, -1, -1} : Multiset ℝ) = {-1, -1, -1, 3} := by multiset_order_tactic
theorem imo1965_p4 : { S | S.card = 4 ∧ ∀ x ∈ S, x + (S.erase x).prod = 2 } = solution := by
-- Solution based on https://prase.cz/kalva/imo/isoln/isoln654.html
ext S
constructor
· intro ⟨hcard, hprod⟩
have hS_nonempty : S ≠ ∅ := Multiset.card_pos.mp (by positivity)
set t := S.prod
have h_quadratic : ∀ x ∈ S, x^2 - 2*x + t = 0 := fun x hx ↦ by grind [Multiset.prod_erase hx]
have ⟨x₁, hx₁⟩ := Multiset.exists_mem_of_ne_zero hS_nonempty
by_cases h : ∀ x ∈ S, x = x₁
--- First case: all elements are equal
· have hS : S = {x₁, x₁, x₁, x₁} := by
ext y
by_cases hy : y = x₁
· have : Multiset.count x₁ S = 4 := by grind only [Multiset.count_eq_card]
simp [hy, this]
· have : Multiset.count y S = 0 := by grind only [Multiset.count_eq_zero]
simp [hy, this]
have h_t_eq_1 : t = 1 := by
have ht_eq : t = x₁ ^ 4 := by simp [t, hS, Multiset.prod_singleton]; ring
have hx₁_ne_zero : x₁ ≠ 0 := by
by_contra hz
have : (S.erase x₁).prod = x₁^3 := by
simp [hS, Multiset.prod_singleton]
ring
grind
have h_cubic : x₁^3 + x₁ - 2 = 0 := by grind
have h_x1_eq_1 : x₁ = 1 := cubic h_cubic
grind
have h_x_eq_1 : ∀ x ∈ S, x = 1 := by grind
grind
--- Second case: at least one element x₂ are not equal to x₁
· -- Extract the other three elements x₂, x₃, x₄
simp at h
have ⟨x₂, hx₂, hx₂_ne_x₁⟩ := h
set S₁ := S.erase x₁
have hx₂_mem_S₁ : x₂ ∈ S₁ := (Multiset.mem_erase_of_ne hx₂_ne_x₁).mpr hx₂
set S₂ := S₁.erase x₂
have hS₂_card : S₂.card = 2 := by grind only [Multiset.card_erase_add_one]
obtain ⟨x₃, hx₃⟩ := Multiset.exists_mem_of_ne_zero (Multiset.card_pos.mp (by rw [hS₂_card]; norm_num))
have hx₃_mem_S : x₃ ∈ S := by grind only [Multiset.mem_erase_of_ne, Multiset.mem_of_mem_erase]
set S₃ := S₂.erase x₃
have hS₃_card : S₃.card = 1 := by grind only [Multiset.card_erase_add_one]
obtain ⟨x₄, hS₃_eq⟩ := Multiset.card_eq_one.mp hS₃_card
have hx₄_mem_S : x₄ ∈ S := by grind only [Multiset.erase_comm, Multiset.card_eq_zero, Multiset.erase_of_notMem, Multiset.erase_singleton]
have hS : S = {x₁, x₂, x₃, x₄} := multiset_erase x₁ hx₁ (multiset_erase x₂ hx₂_mem_S₁ (multiset_erase x₃ hx₃ hS₃_eq))
have ht_prod : t = x₁ * x₂ * x₃ * x₄ := by
simp [t, hS, Multiset.prod_singleton]
ring
have h_t_ne_zero : t ≠ 0 := by
by_contra ht_zero
have h_sols : ∀ x ∈ S, x = 0 ∨ x = 2 := fun _ _ ↦ by grind
obtain ⟨x, hx, hx_eq_zero⟩ : ∃ x ∈ S, x = 0 := by grind
have h_ne_zero : ∀ y ∈ S.erase 0, y ≠ 0 := by
intro y hy
by_contra hy_zero
rw [hy_zero] at hy
have : (S.erase 0).prod = 0 := Multiset.prod_eq_zero hy
grind
have : ∀ y ∈ S.erase 0, y = 2 := fun y hy ↦ (h_sols y (Multiset.mem_of_mem_erase hy)).resolve_left (fun h_zero ↦ h_ne_zero y hy h_zero)
have h_S_erase : S.erase 0 = {2, 2, 2} := by
ext y
by_cases hy : y = 2
· have count_eq : Multiset.count 2 (S.erase 0) = (S.erase 0).card := Multiset.count_eq_card.mpr (by grind)
simp [hy, count_eq]
grind +suggestions
· simp [hy]
grind
replace : (S.erase 0).prod = 2*2*2 := by
simp [h_S_erase, Multiset.prod_singleton]
ring
have hprod_zero := hprod 0 (by grind)
linarith
have ht_eq_1_sol : t = 1 → S ∈ solution := fun _ ↦ (by grind)
have h_x₃x₄_eq_one : x₃ * x₄ = 1 := by grind
by_cases h_eq : x₃ = x₄
· have : x₄ = 1 ∨ x₄ = -1 := by grind
cases' this with h₄_eq_1 h₄_eq_neg1
· exact ht_eq_1_sol (by grind)
· have h_either : (x₁ = -1 ∧ x₂ = 3) ∨ (x₁ = 3 ∧ x₂ = -1) := by grind
have h_S_eq : S = {-1, -1, -1, 3} := by
rcases h_either with ⟨h1, h2⟩ | ⟨h1, h2⟩ <;> rw [hS, h_eq, h₄_eq_neg1, h1, h2]
· exact multiset_order₂
· exact multiset_order₁
grind
· have h_x₃x₄_eq_t : x₃ * x₄ = t := by grind
exact ht_eq_1_sol (by grind)
--- Proof that all sets in the solution satisfy the condition
· intro hS
rcases hS with heq | heq <;> rw [heq] <;> norm_num [Multiset.mem_cons, Multiset.mem_singleton, Multiset.erase_cons_head]
end Imo1965P4 | /- | /-
Copyright (c) 2025 The Compfiles Authors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Rydh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1965, Problem 4
Find all sets of four real numbers x₁, x₂, x₃, x₄ such that the sum of any one
and the product of the other three is equal to 2.
-/
namespace Imo1965P4
abbrev solution : Set (Multiset ℝ) := {{1, 1, 1, 1}, {-1, -1, -1, 3}}
lemma cubic {x : ℝ} (h : x^3 + x - 2 = 0) : x = 1 := by
by_cases h : x = 1
· exact h
· nlinarith [sq_nonneg (x + 1/2)]
lemma multiset_erase {α : Type} [DecidableEq α] {s s' : Multiset α} (a : α) (ha : a ∈ s) :
s.erase a = s' → s = a ::ₘ s' := fun _ ↦ by grind only [Multiset.cons_erase ha]
-- Simple lemmas about the order of elements in a specific multiset
syntax "multiset_order_tactic" : tactic
macro_rules
| `(tactic| multiset_order_tactic) => `(tactic| (
ext x
by_cases h1 : x = 3 <;> simp [h1, show 3 ≠ (-1 : ℝ) by norm_num]
by_cases h2 : x = -1 <;> simp [h1, h2, show (-1 : ℝ) ≠ 3 by norm_num]))
lemma multiset_order₁ : ({3, -1, -1, -1} : Multiset ℝ) = {-1, -1, -1, 3} := by multiset_order_tactic
lemma multiset_order₂ : ({-1, 3, -1, -1} : Multiset ℝ) = {-1, -1, -1, 3} := by multiset_order_tactic
theorem imo1965_p4 : { S | S.card = 4 ∧ ∀ x ∈ S, x + (S.erase x).prod = 2 } = solution := by
-- Solution based on https://prase.cz/kalva/imo/isoln/isoln654.html
ext S
constructor
· intro ⟨hcard, hprod⟩
have hS_nonempty : S ≠ ∅ := Multiset.card_pos.mp (by positivity)
set t := S.prod
have h_quadratic : ∀ x ∈ S, x^2 - 2*x + t = 0 := fun x hx ↦ by grind [Multiset.prod_erase hx]
have ⟨x₁, hx₁⟩ := Multiset.exists_mem_of_ne_zero hS_nonempty
by_cases h : ∀ x ∈ S, x = x₁
--- First case: all elements are equal
· have hS : S = {x₁, x₁, x₁, x₁} := by
ext y
by_cases hy : y = x₁
· have : Multiset.count x₁ S = 4 := by grind only [Multiset.count_eq_card]
simp [hy, this]
· have : Multiset.count y S = 0 := by grind only [Multiset.count_eq_zero]
simp [hy, this]
have h_t_eq_1 : t = 1 := by
have ht_eq : t = x₁ ^ 4 := by simp [t, hS, Multiset.prod_singleton]; ring
have hx₁_ne_zero : x₁ ≠ 0 := by
by_contra hz
have : (S.erase x₁).prod = x₁^3 := by
simp [hS, Multiset.prod_singleton]
ring
grind
have h_cubic : x₁^3 + x₁ - 2 = 0 := by grind
have h_x1_eq_1 : x₁ = 1 := cubic h_cubic
grind
have h_x_eq_1 : ∀ x ∈ S, x = 1 := by grind
grind
--- Second case: at least one element x₂ are not equal to x₁
· -- Extract the other three elements x₂, x₃, x₄
simp at h
have ⟨x₂, hx₂, hx₂_ne_x₁⟩ := h
set S₁ := S.erase x₁
have hx₂_mem_S₁ : x₂ ∈ S₁ := (Multiset.mem_erase_of_ne hx₂_ne_x₁).mpr hx₂
set S₂ := S₁.erase x₂
have hS₂_card : S₂.card = 2 := by grind only [Multiset.card_erase_add_one]
obtain ⟨x₃, hx₃⟩ := Multiset.exists_mem_of_ne_zero (Multiset.card_pos.mp (by rw [hS₂_card]; norm_num))
have hx₃_mem_S : x₃ ∈ S := by grind only [Multiset.mem_erase_of_ne, Multiset.mem_of_mem_erase]
set S₃ := S₂.erase x₃
have hS₃_card : S₃.card = 1 := by grind only [Multiset.card_erase_add_one]
obtain ⟨x₄, hS₃_eq⟩ := Multiset.card_eq_one.mp hS₃_card
have hx₄_mem_S : x₄ ∈ S := by grind only [Multiset.erase_comm, Multiset.card_eq_zero, Multiset.erase_of_notMem, Multiset.erase_singleton]
have hS : S = {x₁, x₂, x₃, x₄} := multiset_erase x₁ hx₁ (multiset_erase x₂ hx₂_mem_S₁ (multiset_erase x₃ hx₃ hS₃_eq))
have ht_prod : t = x₁ * x₂ * x₃ * x₄ := by
simp [t, hS, Multiset.prod_singleton]
ring
have h_t_ne_zero : t ≠ 0 := by
by_contra ht_zero
have h_sols : ∀ x ∈ S, x = 0 ∨ x = 2 := fun _ _ ↦ by grind
obtain ⟨x, hx, hx_eq_zero⟩ : ∃ x ∈ S, x = 0 := by grind
have h_ne_zero : ∀ y ∈ S.erase 0, y ≠ 0 := by
intro y hy
by_contra hy_zero
rw [hy_zero] at hy
have : (S.erase 0).prod = 0 := Multiset.prod_eq_zero hy
grind
have : ∀ y ∈ S.erase 0, y = 2 := fun y hy ↦ (h_sols y (Multiset.mem_of_mem_erase hy)).resolve_left (fun h_zero ↦ h_ne_zero y hy h_zero)
have h_S_erase : S.erase 0 = {2, 2, 2} := by
ext y
by_cases hy : y = 2
· have count_eq : Multiset.count 2 (S.erase 0) = (S.erase 0).card := Multiset.count_eq_card.mpr (by grind)
simp [hy, count_eq]
grind +suggestions
· simp [hy]
grind
replace : (S.erase 0).prod = 2*2*2 := by
simp [h_S_erase, Multiset.prod_singleton]
ring
have hprod_zero := hprod 0 (by grind)
linarith
have ht_eq_1_sol : t = 1 → S ∈ solution := fun _ ↦ (by grind)
have h_x₃x₄_eq_one : x₃ * x₄ = 1 := by grind
by_cases h_eq : x₃ = x₄
· have : x₄ = 1 ∨ x₄ = -1 := by grind
cases' this with h₄_eq_1 h₄_eq_neg1
· exact ht_eq_1_sol (by grind)
· have h_either : (x₁ = -1 ∧ x₂ = 3) ∨ (x₁ = 3 ∧ x₂ = -1) := by grind
have h_S_eq : S = {-1, -1, -1, 3} := by
rcases h_either with ⟨h1, h2⟩ | ⟨h1, h2⟩ <;> rw [hS, h_eq, h₄_eq_neg1, h1, h2]
· exact multiset_order₂
· exact multiset_order₁
grind
· have h_x₃x₄_eq_t : x₃ * x₄ = t := by grind
exact ht_eq_1_sol (by grind)
--- Proof that all sets in the solution satisfy the condition
· intro hS
rcases hS with heq | heq <;> rw [heq] <;> norm_num [Multiset.mem_cons, Multiset.mem_singleton, Multiset.erase_cons_head]
end Imo1965P4
| true | Copyright (c) 2025 The Compfiles Authors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Rydh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1965, Problem 4
Find all sets of four real numbers x₁, x₂, x₃, x₄ such that the sum of any one
and the product of the other three is equal to 2.
-/
namespace Imo1965P4
abbrev solution : Set (Multiset ℝ) := {{1, 1, 1, 1}, {-1, -1, -1, 3}}
lemma cubic {x : ℝ} (h : x^3 + x - 2 = 0) : x = 1 := by
by_cases h : x = 1
· exact h
· nlinarith [sq_nonneg (x + 1/2)]
lemma multiset_erase {α : Type} [DecidableEq α] {s s' : Multiset α} (a : α) (ha : a ∈ s) :
s.erase a = s' → s = a ::ₘ s' := fun _ ↦ by grind only [Multiset.cons_erase ha]
-- Simple lemmas about the order of elements in a specific multiset
syntax "multiset_order_tactic" : tactic
macro_rules
| `(tactic| multiset_order_tactic) => `(tactic| (
ext x
by_cases h1 : x = 3 <;> simp [h1, show 3 ≠ (-1 : ℝ) by norm_num]
by_cases h2 : x = -1 <;> simp [h1, h2, show (-1 : ℝ) ≠ 3 by norm_num]))
lemma multiset_order₁ : ({3, -1, -1, -1} : Multiset ℝ) = {-1, -1, -1, 3} := by multiset_order_tactic
lemma multiset_order₂ : ({-1, 3, -1, -1} : Multiset ℝ) = {-1, -1, -1, 3} := by multiset_order_tactic
theorem imo1965_p4 : { S | S.card = 4 ∧ ∀ x ∈ S, x + (S.erase x).prod = 2 } = solution := by
-- Solution based on https://prase.cz/kalva/imo/isoln/isoln654.html
ext S
constructor
· intro ⟨hcard, hprod⟩
have hS_nonempty : S ≠ ∅ := Multiset.card_pos.mp (by positivity)
set t := S.prod
have h_quadratic : ∀ x ∈ S, x^2 - 2*x + t = 0 := fun x hx ↦ by grind [Multiset.prod_erase hx]
have ⟨x₁, hx₁⟩ := Multiset.exists_mem_of_ne_zero hS_nonempty
by_cases h : ∀ x ∈ S, x = x₁
--- First case: all elements are equal
· have hS : S = {x₁, x₁, x₁, x₁} := by
ext y
by_cases hy : y = x₁
· have : Multiset.count x₁ S = 4 := by grind only [Multiset.count_eq_card]
simp [hy, this]
· have : Multiset.count y S = 0 := by grind only [Multiset.count_eq_zero]
simp [hy, this]
have h_t_eq_1 : t = 1 := by
have ht_eq : t = x₁ ^ 4 := by simp [t, hS, Multiset.prod_singleton]; ring
have hx₁_ne_zero : x₁ ≠ 0 := by
by_contra hz
have : (S.erase x₁).prod = x₁^3 := by
simp [hS, Multiset.prod_singleton]
ring
grind
have h_cubic : x₁^3 + x₁ - 2 = 0 := by grind
have h_x1_eq_1 : x₁ = 1 := cubic h_cubic
grind
have h_x_eq_1 : ∀ x ∈ S, x = 1 := by grind
grind
--- Second case: at least one element x₂ are not equal to x₁
· -- Extract the other three elements x₂, x₃, x₄
simp at h
have ⟨x₂, hx₂, hx₂_ne_x₁⟩ := h
set S₁ := S.erase x₁
have hx₂_mem_S₁ : x₂ ∈ S₁ := (Multiset.mem_erase_of_ne hx₂_ne_x₁).mpr hx₂
set S₂ := S₁.erase x₂
have hS₂_card : S₂.card = 2 := by grind only [Multiset.card_erase_add_one]
obtain ⟨x₃, hx₃⟩ := Multiset.exists_mem_of_ne_zero (Multiset.card_pos.mp (by rw [hS₂_card]; norm_num))
have hx₃_mem_S : x₃ ∈ S := by grind only [Multiset.mem_erase_of_ne, Multiset.mem_of_mem_erase]
set S₃ := S₂.erase x₃
have hS₃_card : S₃.card = 1 := by grind only [Multiset.card_erase_add_one]
obtain ⟨x₄, hS₃_eq⟩ := Multiset.card_eq_one.mp hS₃_card
have hx₄_mem_S : x₄ ∈ S := by grind only [Multiset.erase_comm, Multiset.card_eq_zero, Multiset.erase_of_notMem, Multiset.erase_singleton]
have hS : S = {x₁, x₂, x₃, x₄} := multiset_erase x₁ hx₁ (multiset_erase x₂ hx₂_mem_S₁ (multiset_erase x₃ hx₃ hS₃_eq))
have ht_prod : t = x₁ * x₂ * x₃ * x₄ := by
simp [t, hS, Multiset.prod_singleton]
ring
have h_t_ne_zero : t ≠ 0 := by
by_contra ht_zero
have h_sols : ∀ x ∈ S, x = 0 ∨ x = 2 := fun _ _ ↦ by grind
obtain ⟨x, hx, hx_eq_zero⟩ : ∃ x ∈ S, x = 0 := by grind
have h_ne_zero : ∀ y ∈ S.erase 0, y ≠ 0 := by
intro y hy
by_contra hy_zero
rw [hy_zero] at hy
have : (S.erase 0).prod = 0 := Multiset.prod_eq_zero hy
grind
have : ∀ y ∈ S.erase 0, y = 2 := fun y hy ↦ (h_sols y (Multiset.mem_of_mem_erase hy)).resolve_left (fun h_zero ↦ h_ne_zero y hy h_zero)
have h_S_erase : S.erase 0 = {2, 2, 2} := by
ext y
by_cases hy : y = 2
· have count_eq : Multiset.count 2 (S.erase 0) = (S.erase 0).card := Multiset.count_eq_card.mpr (by grind)
simp [hy, count_eq]
grind +suggestions
· simp [hy]
grind
replace : (S.erase 0).prod = 2*2*2 := by
simp [h_S_erase, Multiset.prod_singleton]
ring
have hprod_zero := hprod 0 (by grind)
linarith
have ht_eq_1_sol : t = 1 → S ∈ solution := fun _ ↦ (by grind)
have h_x₃x₄_eq_one : x₃ * x₄ = 1 := by grind
by_cases h_eq : x₃ = x₄
· have : x₄ = 1 ∨ x₄ = -1 := by grind
cases' this with h₄_eq_1 h₄_eq_neg1
· exact ht_eq_1_sol (by grind)
· have h_either : (x₁ = -1 ∧ x₂ = 3) ∨ (x₁ = 3 ∧ x₂ = -1) := by grind
have h_S_eq : S = {-1, -1, -1, 3} := by
rcases h_either with ⟨h1, h2⟩ | ⟨h1, h2⟩ <;> rw [hS, h_eq, h₄_eq_neg1, h1, h2]
· exact multiset_order₂
· exact multiset_order₁
grind
· have h_x₃x₄_eq_t : x₃ * x₄ = t := by grind
exact ht_eq_1_sol (by grind)
--- Proof that all sets in the solution satisfy the condition
· intro hS
rcases hS with heq | heq <;> rw [heq] <;> norm_num [Multiset.mem_cons, Multiset.mem_singleton, Multiset.erase_cons_head]
end Imo1965P4 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1965P4.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unexpected identifier; expected ']'", "unexpected identifier; expected ']'", "`grind` failed\ncase grind\nS : Multiset \u211d\nhcard : S.card = 4\nhprod : \u2200 x \u2208 S, x + (S.erase x).prod = 2\nhS_nonempty : \u00acS = \u2205\nx : \u211d\nhx : x \u2208 S\nh : \u00acx ^ 2 - 2 * x + S.prod = 0\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] S.card = 4\n [prop] \u2200 x \u2208 S, x + (S.erase x).prod = 2\n [prop] \u00acS = \u2205\n [prop] x \u2208 S\n [prop] \u00acx ^ 2 - 2 * x + S.prod = 0\n [prop] x \u2208 S \u2192 x + (S.erase x).prod = 2\n [eqc] True propositions\n [prop] \u2200 x \u2208 S, x + (S.erase x).prod = 2\n [prop] x \u2208 S\n [prop] (0 + 2).AtLeastTwo\n [prop] x \u2208 S \u2192 x + (S.erase x).prod = 2\n [prop] x + (S.erase x).prod = 2\n [eqc] False propositions\n [prop] S = \u2205\n [prop] x ^ 2 - 2 * x + S.prod = 0\n [eqc] Equivalence classes\n [eqc] {x + (S.erase x).prod, 2}\n [eqc] {0 + 2, 2}\n [eqc] {S.card, 4}\n [ematch] E-matching patterns\n [thm] Multiset.prod_erase: [@HMul.hMul #5 _ _ _ #2 (@Multiset.prod _ #4 (@Multiset.erase _ #1 #3 #2))]\n [thm] hprod: [@Membership.mem `[\u211d] `[Multiset \u211d] `[Multiset.instMembership] `[S] #1]\n [thm] hprod: [@Multiset.erase `[\u211d] `[Real.decidableEq] `[S] #1]\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [cutsat] Assignment satisfying linear constraints\n [assign] S.card := 4\n [assign] 0 := 0\n [assign] 2 := 2\n [ring] Ring `\u211d`\n [basis] Basis\n [_] x + (S.erase x).prod + -2 = 0\n [diseqs] Disequalities\n [_] \u00ac(S.erase x).prod ^ 2 + S.prod + -2 * (S.erase x).prod = 0\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n S\n has type\n Multiset \u211d : Type\n but is expected to have type\n Std.ExtDHashMap \u211d ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n S\n has type\n Multiset \u211d : Type\n but is expected to have type\n Std.DHashMap \u211d ?\u03b2 : Type", "unsolved goals\ncase h.mp\nS : Multiset \u211d\nhcard : S.card = 4\nhprod : \u2200 x \u2208 S, x + (S.erase x).prod = 2\nhS_nonempty : S \u2260 \u2205\nt : \u211d := S.prod\nh_quadratic : \u2200 x \u2208 S, x ^ 2 - 2 * x + t = 0\n\u22a2 S \u2208 solution", "unsolved goals\ncase h.mpr\nS : Multiset \u211d\n\u22a2 S \u2208 solution \u2192 S \u2208 {S | S.card = 4 \u2227 \u2200 x \u2208 S, x + (S.erase x).prod = 2}"], "timeout_s": 600.0, "latency_s": 1.5157, "verified_at": "2026-03-26T18:16:13.000077+00:00"}} | false | true | false | 1.5157 |
compfiles_Imo1966P1 | compfiles | Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Shalev Wengrowsky
-/
import Mathlib
/-!
# International Mathematical Olympiad 1966, Problem 1.
In a mathematical contest, three problems, A, B, C were posed. Among the
participants there were 25 students who solved at least one problem each.
Of all the contestants who did not solve problem A, the number who solved
B was twice the number who solved C. The number of students who solved
only problem A was one more than the number of students who solved A
and at least one other problem. Of all students who solved just one problem,
half did not solve problem A. How many students solved only problem B?
-/
namespace Imo1966P1
variable {U : Type*} [DecidableEq U]
-- outline of the proof, modified from https://prase.cz/kalva/imo/isoln/isoln661.html
example (a b c d e : ℕ)
(_ : a + b + c + d + e = 25)
(h2 : b + d = 2 * (c + d))
(h3 : a = 1 + 25 - a - b - c - d)
(h4 : a = b + c) : b = 6 := by omega
lemma lemma2 (A B : Finset U) : A = (A ∩ B) ∪ (A \ B) := by
ext x; simp; tauto
lemma lemma4 (A B C : Finset U) :
(A ∩ B) \ C = (A \ C) ∩ (B \ C) := by
ext x; simp; tauto
lemma lemma5 (A B C : Finset U) :
(A \ B) ∩ C = (A \ B) ∩ (C \ B) := by
ext x; simp; tauto
abbrev solution : ℕ := 6
theorem imo1966_p1 (A B C : Finset U)
(h1 : (A ∪ B ∪ C).card = 25)
(h2 : (B \ A).card = 2 * (C \ A).card)
(h3 : ((A \ B) \ C).card = 1 + (A ∩ (B ∪ C)).card)
(h4 : ((A \ B) \ C).card = ((B \ A) \ C).card + ((C \ A) \ B).card) :
((B \ A) \ C).card = solution := by
let a := ((A \ B) \ C).card
let b := ((B \ A) \ C).card
let c := ((C \ A) \ B).card
let d := ((B ∩ C) \ A).card
let e := (A ∩ (B ∪ C)).card
have h_eq1_lemma : A ∪ B ∪ C =
(A \ B) \ C ∪ (B \ A) \ C ∪ (C \ A) \ B ∪ (B ∩ C) \ A ∪ A ∩ (B ∪ C) := by
ext x; simp; tauto
have h_eq1 : a + b + c + d + e = 25 := by {
simp [a, b, c, d, e]
repeat rw [← Finset.card_union_of_disjoint]
· grind
repeat {
intro S h1' h2'
simp at h1' h2' ⊢
ext x
constructor
· intro h3'
have h1' := h1' h3'
have h2' := h2' h3'
simp at h1' h2'
grind
· intro; grind
}
}
have h_eq2: b + d = 2 * (c + d) := by {
simp [b, c, d]
rw [lemma2 B C] at h2
rw [Finset.union_sdiff_distrib] at h2
rw [Finset.card_union_of_disjoint] at h2
· rw [sdiff_sdiff_comm, add_comm, h2]
rw [← Finset.card_union_of_disjoint]
· rw [Finset.inter_comm, lemma4]
rw [← lemma5, Finset.union_comm, ← lemma2]
· unfold Disjoint
simp
grind
· refine Finset.disjoint_left.mpr ?_
grind
}
grind
end Imo1966P1 | /- | /-
Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Shalev Wengrowsky
-/
import Mathlib
/-!
# International Mathematical Olympiad 1966, Problem 1.
In a mathematical contest, three problems, A, B, C were posed. Among the
participants there were 25 students who solved at least one problem each.
Of all the contestants who did not solve problem A, the number who solved
B was twice the number who solved C. The number of students who solved
only problem A was one more than the number of students who solved A
and at least one other problem. Of all students who solved just one problem,
half did not solve problem A. How many students solved only problem B?
-/
namespace Imo1966P1
variable {U : Type*} [DecidableEq U]
-- outline of the proof, modified from https://prase.cz/kalva/imo/isoln/isoln661.html
example (a b c d e : ℕ)
(_ : a + b + c + d + e = 25)
(h2 : b + d = 2 * (c + d))
(h3 : a = 1 + 25 - a - b - c - d)
(h4 : a = b + c) : b = 6 := by omega
lemma lemma2 (A B : Finset U) : A = (A ∩ B) ∪ (A \ B) := by
ext x; simp; tauto
lemma lemma4 (A B C : Finset U) :
(A ∩ B) \ C = (A \ C) ∩ (B \ C) := by
ext x; simp; tauto
lemma lemma5 (A B C : Finset U) :
(A \ B) ∩ C = (A \ B) ∩ (C \ B) := by
ext x; simp; tauto
abbrev solution : ℕ := 6
theorem imo1966_p1 (A B C : Finset U)
(h1 : (A ∪ B ∪ C).card = 25)
(h2 : (B \ A).card = 2 * (C \ A).card)
(h3 : ((A \ B) \ C).card = 1 + (A ∩ (B ∪ C)).card)
(h4 : ((A \ B) \ C).card = ((B \ A) \ C).card + ((C \ A) \ B).card) :
((B \ A) \ C).card = solution := by
let a := ((A \ B) \ C).card
let b := ((B \ A) \ C).card
let c := ((C \ A) \ B).card
let d := ((B ∩ C) \ A).card
let e := (A ∩ (B ∪ C)).card
have h_eq1_lemma : A ∪ B ∪ C =
(A \ B) \ C ∪ (B \ A) \ C ∪ (C \ A) \ B ∪ (B ∩ C) \ A ∪ A ∩ (B ∪ C) := by
ext x; simp; tauto
have h_eq1 : a + b + c + d + e = 25 := by {
simp [a, b, c, d, e]
repeat rw [← Finset.card_union_of_disjoint]
· grind
repeat {
intro S h1' h2'
simp at h1' h2' ⊢
ext x
constructor
· intro h3'
have h1' := h1' h3'
have h2' := h2' h3'
simp at h1' h2'
grind
· intro; grind
}
}
have h_eq2: b + d = 2 * (c + d) := by {
simp [b, c, d]
rw [lemma2 B C] at h2
rw [Finset.union_sdiff_distrib] at h2
rw [Finset.card_union_of_disjoint] at h2
· rw [sdiff_sdiff_comm, add_comm, h2]
rw [← Finset.card_union_of_disjoint]
· rw [Finset.inter_comm, lemma4]
rw [← lemma5, Finset.union_comm, ← lemma2]
· unfold Disjoint
simp
grind
· refine Finset.disjoint_left.mpr ?_
grind
}
grind
end Imo1966P1
| true | Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Shalev Wengrowsky
-/
import Mathlib
/-!
# International Mathematical Olympiad 1966, Problem 1.
In a mathematical contest, three problems, A, B, C were posed. Among the
participants there were 25 students who solved at least one problem each.
Of all the contestants who did not solve problem A, the number who solved
B was twice the number who solved C. The number of students who solved
only problem A was one more than the number of students who solved A
and at least one other problem. Of all students who solved just one problem,
half did not solve problem A. How many students solved only problem B?
-/
namespace Imo1966P1
variable {U : Type*} [DecidableEq U]
-- outline of the proof, modified from https://prase.cz/kalva/imo/isoln/isoln661.html
example (a b c d e : ℕ)
(_ : a + b + c + d + e = 25)
(h2 : b + d = 2 * (c + d))
(h3 : a = 1 + 25 - a - b - c - d)
(h4 : a = b + c) : b = 6 := by omega
lemma lemma2 (A B : Finset U) : A = (A ∩ B) ∪ (A \ B) := by
ext x; simp; tauto
lemma lemma4 (A B C : Finset U) :
(A ∩ B) \ C = (A \ C) ∩ (B \ C) := by
ext x; simp; tauto
lemma lemma5 (A B C : Finset U) :
(A \ B) ∩ C = (A \ B) ∩ (C \ B) := by
ext x; simp; tauto
abbrev solution : ℕ := 6
theorem imo1966_p1 (A B C : Finset U)
(h1 : (A ∪ B ∪ C).card = 25)
(h2 : (B \ A).card = 2 * (C \ A).card)
(h3 : ((A \ B) \ C).card = 1 + (A ∩ (B ∪ C)).card)
(h4 : ((A \ B) \ C).card = ((B \ A) \ C).card + ((C \ A) \ B).card) :
((B \ A) \ C).card = solution := by
let a := ((A \ B) \ C).card
let b := ((B \ A) \ C).card
let c := ((C \ A) \ B).card
let d := ((B ∩ C) \ A).card
let e := (A ∩ (B ∪ C)).card
have h_eq1_lemma : A ∪ B ∪ C =
(A \ B) \ C ∪ (B \ A) \ C ∪ (C \ A) \ B ∪ (B ∩ C) \ A ∪ A ∩ (B ∪ C) := by
ext x; simp; tauto
have h_eq1 : a + b + c + d + e = 25 := by {
simp [a, b, c, d, e]
repeat rw [← Finset.card_union_of_disjoint]
· grind
repeat {
intro S h1' h2'
simp at h1' h2' ⊢
ext x
constructor
· intro h3'
have h1' := h1' h3'
have h2' := h2' h3'
simp at h1' h2'
grind
· intro; grind
}
}
have h_eq2: b + d = 2 * (c + d) := by {
simp [b, c, d]
rw [lemma2 B C] at h2
rw [Finset.union_sdiff_distrib] at h2
rw [Finset.card_union_of_disjoint] at h2
· rw [sdiff_sdiff_comm, add_comm, h2]
rw [← Finset.card_union_of_disjoint]
· rw [Finset.inter_comm, lemma4]
rw [← lemma5, Finset.union_comm, ← lemma2]
· unfold Disjoint
simp
grind
· refine Finset.disjoint_left.mpr ?_
grind
}
grind
end Imo1966P1 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1966P1.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unsolved goals\nU : Type u_1\ninst\u271d : DecidableEq U\na b c d e : \u2115\nx\u271d : a + b + c + d + e = 25\nh2 : b + d = 2 * (c + d)\nh3 : a = 1 + 25 - a - b - c - d\nh4 : a = b + c\n\u22a2 b = 6", "unsolved goals\nU : Type u_1\ninst\u271d : DecidableEq U\nA B C : Finset U\nh1 : (A \u222a B \u222a C).card = 25\nh2 : (B \\ A).card = 2 * (C \\ A).card\nh3 : ((A \\ B) \\ C).card = 1 + (A \u2229 (B \u222a C)).card\nh4 : ((A \\ B) \\ C).card = ((B \\ A) \\ C).card + ((C \\ A) \\ B).card\na : \u2115 := \u22ef\nb : \u2115 := \u22ef\nc : \u2115 := \u22ef\nd : \u2115 := \u22ef\ne : \u2115 := \u22ef\nh_eq1_lemma : A \u222a B \u222a C = (A \\ B) \\ C \u222a (B \\ A) \\ C \u222a (C \\ A) \\ B \u222a (B \u2229 C) \\ A \u222a A \u2229 (B \u222a C)\n\u22a2 Disjoint ((A \\ B) \\ C \u222a (B \\ A) \\ C \u222a (C \\ A) \\ B \u222a (B \u2229 C) \\ A) (A \u2229 (B \u222a C))\n\nU : Type u_1\ninst\u271d : DecidableEq U\nA B C : Finset U\nh1 : (A \u222a B \u222a C).card = 25\nh2 : (B \\ A).card = 2 * (C \\ A).card\nh3 : ((A \\ B) \\ C).card = 1 + (A \u2229 (B \u222a C)).card\nh4 : ((A \\ B) \\ C).card = ((B \\ A) \\ C).card + ((C \\ A) \\ B).card\na : \u2115 := \u22ef\nb : \u2115 := \u22ef\nc : \u2115 := \u22ef\nd : \u2115 := \u22ef\ne : \u2115 := \u22ef\nh_eq1_lemma : A \u222a B \u222a C = (A \\ B) \\ C \u222a (B \\ A) \\ C \u222a (C \\ A) \\ B \u222a (B \u2229 C) \\ A \u222a A \u2229 (B \u222a C)\n\u22a2 Disjoint ((A \\ B) \\ C \u222a (B \\ A) \\ C \u222a (C \\ A) \\ B) ((B \u2229 C) \\ A)\n\nU : Type u_1\ninst\u271d : DecidableEq U\nA B C : Finset U\nh1 : (A \u222a B \u222a C).card = 25\nh2 : (B \\ A).card = 2 * (C \\ A).card\nh3 : ((A \\ B) \\ C).card = 1 + (A \u2229 (B \u222a C)).card\nh4 : ((A \\ B) \\ C).card = ((B \\ A) \\ C).card + ((C \\ A) \\ B).card\na : \u2115 := \u22ef\nb : \u2115 := \u22ef\nc : \u2115 := \u22ef\nd : \u2115 := \u22ef\ne : \u2115 := \u22ef\nh_eq1_lemma : A \u222a B \u222a C = (A \\ B) \\ C \u222a (B \\ A) \\ C \u222a (C \\ A) \\ B \u222a (B \u2229 C) \\ A \u222a A \u2229 (B \u222a C)\n\u22a2 Disjoint ((A \\ B) \\ C \u222a (B \\ A) \\ C) ((C \\ A) \\ B)\n\nU : Type u_1\ninst\u271d : DecidableEq U\nA B C : Finset U\nh1 : (A \u222a B \u222a C).card = 25\nh2 : (B \\ A).card = 2 * (C \\ A).card\nh3 : ((A \\ B) \\ C).card = 1 + (A \u2229 (B \u222a C)).card\nh4 : ((A \\ B) \\ C).card = ((B \\ A) \\ C).card + ((C \\ A) \\ B).card\na : \u2115 := \u22ef\nb : \u2115 := \u22ef\nc : \u2115 := \u22ef\nd : \u2115 := \u22ef\ne : \u2115 := \u22ef\nh_eq1_lemma : A \u222a B \u222a C = (A \\ B) \\ C \u222a (B \\ A) \\ C \u222a (C \\ A) \\ B \u222a (B \u2229 C) \\ A \u222a A \u2229 (B \u222a C)\n\u22a2 Disjoint ((A \\ B) \\ C) ((B \\ A) \\ C)", "`grind` failed\ncase grind\nU : Type u_1\ninst : (a b : U) \u2192 Decidable (a = b)\nA B C : Finset U\nh1 : (A \u222a B \u222a C).card = 25\nh2 : ((B \u2229 C) \\ A).card + ((B \\ C) \\ A).card = 2 * (C \\ A).card\nh3 : ((A \\ B) \\ C).card = (A \u2229 (B \u222a C)).card + 1\nh4 : ((A \\ B) \\ C).card = ((B \\ A) \\ C).card + ((C \\ A) \\ B).card\nh_eq1_lemma : A \u222a B \u222a C = (A \\ B) \\ C \u222a (B \\ A) \\ C \u222a (C \\ A) \\ B \u222a (B \u2229 C) \\ A \u222a A \u2229 (B \u222a C)\nh_eq1 : (A \u2229 (B \u222a C)).card + ((B \u2229 C) \\ A).card + ((A \\ B) \\ C).card + ((B \\ A) \\ C).card + ((C \\ A) \\ B).card = 25\nx : Finset U\nh : x \u2286 (C \\ A) \\ B\nh_1 : x \u2286 (B \u2229 C) \\ A\nh_2 : \u00acx = \u2205\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] (A \u222a B \u222a C).card = 25\n [prop] ((B \u2229 C) \\ A).card + ((B \\ C) \\ A).card = 2 * (C \\ A).card\n [prop] ((A \\ B) \\ C).card = (A \u2229 (B \u222a C)).card + 1\n [prop] ((A \\ B) \\ C).card = ((B \\ A) \\ C).card + ((C \\ A) \\ B).card\n [prop] A \u222a B \u222a C = (A \\ B) \\ C \u222a (B \\ A) \\ C \u222a (C \\ A) \\ B \u222a (B \u2229 C) \\ A \u222a A \u2229 (B \u222a C)\n [prop] (A \u2229 (B \u222a C)).card + ((B \u2229 C) \\ A).card + ((A \\ B) \\ C).card + ((B \\ A) \\ C).card + ((C \\ A) \\ B).card = 25\n [prop] x \u2286 (C \\ A) \\ B\n [prop] x \u2286 (B \u2229 C) \\ A\n [prop] \u00acx = \u2205\n [eqc] True propositions\n [prop] x \u2286 (C \\ A) \\ B\n [prop] x \u2286 (B \u2229 C) \\ A\n [eqc] False propositions\n [prop] x = \u2205\n [eqc] Equivalence classes\n [eqc] {A \u222a B \u222a C, (A \\ B) \\ C \u222a (B \\ A) \\ C \u222a (C \\ A) \\ B \u222a (B \u2229 C) \\ A \u222a A \u2229 (B \u222a C)}\n [eqc] {\u2191(((B \\ A) \\ C).card + ((C \\ A) \\ B).card), \u2191((A \\ B) \\ C).card, \u2191((A \u2229 (B \u222a C)).card + 1)}\n [eqc] {((A \\ B) \\ C).card, ((B \\ A) \\ C).card + ((C \\ A) \\ B).card, (A \u2229 (B \u222a C)).card + 1}\n [eqc] {\u2191(((B \u2229 C) \\ A).card + ((B \\ C) \\ A).card), \u2191(2 * (C \\ A).card)}\n [eqc] {((B \u2229 C) \\ A).card + ((B \\ C) \\ A).card, 2 * (C \\ A).card}\n [eqc] {\u2191((A \u2229 (B \u222a C)).card + ((B \u2229 C) \\ A).card + ((A \\ B) \\ C).card + ((B \\ A) \\ C).card + ((C \\ A) \\ B).card),\n \u219125}\n [eqc] {(A \u222a B \u222a C).card,\n (A \u2229 (B \u222a C)).card + ((B \u2229 C) \\ A).card + ((A \\ B) \\ C).card + ((B \\ A) \\ C).card + ((C \\ A) \\ B).card,\n 25}\n [cutsat] Assignment satisfying linear constraints\n [assign] (A \u2229 (B \u222a C)).card := 7\n [assign] (C \\ A).card := 1\n [assign] ((B \u2229 C) \\ A).card := 2\n [assign] ((A \\ B) \\ C).card := 8\n [assign] ((B \\ A) \\ C).card := 0\n [assign] ((B \\ C) \\ A).card := 0\n [assign] ((C \\ A) \\ B).card := 8\n [assign] (A \u222a B \u222a C).card := 25", "`grind` failed\ncase grind\nU : Type u_1\ninst : (a b : U) \u2192 Decidable (a = b)\nA B C : Finset U\nh1 : (A \u222a B \u222a C).card = 25\nh2 : ((B \u2229 C) \\ A \u222a (B \\ C) \\ A).card = 2 * (C \\ A).card\nh3 : ((A \\ B) \\ C).card = (A \u2229 (B \u222a C)).card + 1\nh4 : ((A \\ B) \\ C).card = ((B \\ A) \\ C).card + ((C \\ A) \\ B).card\nh_eq1_lemma : A \u222a B \u222a C = (A \\ B) \\ C \u222a (B \\ A) \\ C \u222a (C \\ A) \\ B \u222a (B \u2229 C) \\ A \u222a A \u2229 (B \u222a C)\nh_eq1 : (A \u2229 (B \u222a C)).card + ((B \u2229 C) \\ A).card + ((A \\ B) \\ C).card + ((B \\ A) \\ C).card + ((C \\ A) \\ B).card = 25\na : U\nh : a \u2208 (B \u2229 C) \\ A\nh_1 : a \u2208 (B \\ C) \\ A\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] (A \u222a B \u222a C).card = 25\n [prop] ((B \u2229 C) \\ A \u222a (B \\ C) \\ A).card = 2 * (C \\ A).card\n [prop] ((A \\ B) \\ C).card = (A \u2229 (B \u222a C)).card + 1\n [prop] ((A \\ B) \\ C).card = ((B \\ A) \\ C).card + ((C \\ A) \\ B).card\n [prop] A \u222a B \u222a C = (A \\ B) \\ C \u222a (B \\ A) \\ C \u222a (C \\ A) \\ B \u222a (B \u2229 C) \\ A \u222a A \u2229 (B \u222a C)\n [prop] (A \u2229 (B \u222a C)).card + ((B \u2229 C) \\ A).card + ((A \\ B) \\ C).card + ((B \\ A) \\ C).card + ((C \\ A) \\ B).card = 25\n [prop] a \u2208 (B \u2229 C) \\ A\n [prop] a \u2208 (B \\ C) \\ A\n [eqc] True propositions\n [prop] a \u2208 (B \u2229 C) \\ A\n [prop] a \u2208 (B \\ C) \\ A\n [eqc] Equivalence classes\n [eqc] {A \u222a B \u222a C, (A \\ B) \\ C \u222a (B \\ A) \\ C \u222a (C \\ A) \\ B \u222a (B \u2229 C) \\ A \u222a A \u2229 (B \u222a C)}\n [eqc] {\u2191(((B \\ A) \\ C).card + ((C \\ A) \\ B).card), \u2191((A \\ B) \\ C).card, \u2191((A \u2229 (B \u222a C)).card + 1)}\n [eqc] {((A \\ B) \\ C).card, ((B \\ A) \\ C).card + ((C \\ A) \\ B).card, (A \u2229 (B \u222a C)).card + 1}\n [eqc] {((B \u2229 C) \\ A \u222a (B \\ C) \\ A).card, 2 * (C \\ A).card}\n [eqc] {\u2191((A \u2229 (B \u222a C)).card + ((B \u2229 C) \\ A).card + ((A \\ B) \\ C).card + ((B \\ A) \\ C).card + ((C \\ A) \\ B).card),\n \u219125}\n [eqc] {(A \u222a B \u222a C).card,\n (A \u2229 (B \u222a C)).card + ((B \u2229 C) \\ A).card + ((A \\ B) \\ C).card + ((B \\ A) \\ C).card + ((C \\ A) \\ B).card,\n 25}\n [ematch] E-matching patterns\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [cutsat] Assignment satisfying linear constraints\n [assign] (A \u2229 (B \u222a C)).card := 0\n [assign] (C \\ A).card := 0\n [assign] ((B \u2229 C) \\ A).card := 23\n [assign] ((A \\ B) \\ C).card := 1\n [assign] ((B \\ A) \\ C).card := 0\n [assign] ((C \\ A) \\ B).card := 1\n [assign] ((B \u2229 C) \\ A \u222a (B \\ C) \\ A).card := 0\n [assign] (A \u222a B \u222a C).card := 25\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n (B \\ C) \\ A\n has type\n Finset U : Type u_1\n but is expected to have type\n Std.ExtDHashMap U ?\u03b2 : Type (max u_1 ?u.175068)\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n (B \u2229 C) \\ A\n has type\n Finset U : Type u_1\n but is expected to have type\n Std.ExtDHashMap U ?\u03b2 : Type (max u_1 ?u.175084)\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n (B \\ C) \\ A\n has type\n Finset U : Type u_1\n but is expected to have type\n Std.DHashMap U ?\u03b2 : Type (max 0 u_1 ?u.175099)\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n (B \u2229 C) \\ A\n has type\n Finset U : Type u_1\n but is expected to have type\n Std.DHashMap U ?\u03b2 : Type (max 0 u_1 ?u.175112)"], "timeout_s": 600.0, "latency_s": 5.6142, "verified_at": "2026-03-26T18:16:18.424420+00:00"}} | false | true | false | 5.6142 |
compfiles_Imo1966P4 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Pedro Duailibe
-/
import Mathlib
/-!
# International Mathematical Olympiad 1966, Problem 4
Prove that for every natural number n and for every real
number x that is not of the form kπ/2ᵗ for t a non-negative
integer and k any integer,
1 / (sin 2x) + 1 / (sin 4x) + ... + 1 / (sin 2ⁿx) = cot x - cot 2ⁿ x.
-/
namespace Imo1966P4
theorem imo1966_p4 (n : ℕ) (x : ℝ)
(hx : ∀ t : ℕ, ∀ k : ℤ, x ≠ k * Real.pi / 2^t) :
∑ i ∈ Finset.range n, 1 / Real.sin (2^(i + 1) * x) =
Real.cot x - Real.cot (2^n * x) := by
induction n with
| zero =>
rw [Finset.range_zero, Finset.sum_empty, pow_zero, one_mul, sub_self]
| succ n ih =>
rw [Finset.sum_range_succ, ih]
let θ := 2 ^ n * x
have hθ : θ = 2 ^ n * x := by rfl
have h₀ : Real.sin (2^(n+1) * x) ≠ 0 := by
intro h
rw [Real.sin_eq_zero_iff] at h
obtain ⟨k, hk⟩ := h
apply hx (n+1) k
rw [eq_div_iff (pow_ne_zero (n+1) (by norm_num)), mul_comm, ← hk]
have h₁ : Real.sin θ ≠ 0 ∧ Real.cos θ ≠ 0 := by
rw [pow_succ, mul_comm (2^n) 2, mul_assoc, ← hθ] at h₀
rw [Real.sin_two_mul] at h₀
constructor
· rw [mul_comm 2, mul_assoc] at h₀
apply left_ne_zero_of_mul h₀
· exact right_ne_zero_of_mul h₀
have h : 1 / Real.sin (2 * θ) = Real.cot θ - Real.cot (2 * θ) := by
simp only [Real.cot_eq_cos_div_sin]
rw [Real.sin_two_mul, Real.cos_two_mul]
field_simp [h₁]
ring
rw [pow_succ, mul_comm (2^n) 2, mul_assoc, ← hθ, h]
abel
end Imo1966P4 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Pedro Duailibe
-/
import Mathlib
/-!
# International Mathematical Olympiad 1966, Problem 4
Prove that for every natural number n and for every real
number x that is not of the form kπ/2ᵗ for t a non-negative
integer and k any integer,
1 / (sin 2x) + 1 / (sin 4x) + ... + 1 / (sin 2ⁿx) = cot x - cot 2ⁿ x.
-/
namespace Imo1966P4
theorem imo1966_p4 (n : ℕ) (x : ℝ)
(hx : ∀ t : ℕ, ∀ k : ℤ, x ≠ k * Real.pi / 2^t) :
∑ i ∈ Finset.range n, 1 / Real.sin (2^(i + 1) * x) =
Real.cot x - Real.cot (2^n * x) := by
induction n with
| zero =>
rw [Finset.range_zero, Finset.sum_empty, pow_zero, one_mul, sub_self]
| succ n ih =>
rw [Finset.sum_range_succ, ih]
let θ := 2 ^ n * x
have hθ : θ = 2 ^ n * x := by rfl
have h₀ : Real.sin (2^(n+1) * x) ≠ 0 := by
intro h
rw [Real.sin_eq_zero_iff] at h
obtain ⟨k, hk⟩ := h
apply hx (n+1) k
rw [eq_div_iff (pow_ne_zero (n+1) (by norm_num)), mul_comm, ← hk]
have h₁ : Real.sin θ ≠ 0 ∧ Real.cos θ ≠ 0 := by
rw [pow_succ, mul_comm (2^n) 2, mul_assoc, ← hθ] at h₀
rw [Real.sin_two_mul] at h₀
constructor
· rw [mul_comm 2, mul_assoc] at h₀
apply left_ne_zero_of_mul h₀
· exact right_ne_zero_of_mul h₀
have h : 1 / Real.sin (2 * θ) = Real.cot θ - Real.cot (2 * θ) := by
simp only [Real.cot_eq_cos_div_sin]
rw [Real.sin_two_mul, Real.cos_two_mul]
field_simp [h₁]
ring
rw [pow_succ, mul_comm (2^n) 2, mul_assoc, ← hθ, h]
abel
end Imo1966P4
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Pedro Duailibe
-/
import Mathlib
/-!
# International Mathematical Olympiad 1966, Problem 4
Prove that for every natural number n and for every real
number x that is not of the form kπ/2ᵗ for t a non-negative
integer and k any integer,
1 / (sin 2x) + 1 / (sin 4x) + ... + 1 / (sin 2ⁿx) = cot x - cot 2ⁿ x.
-/
namespace Imo1966P4
theorem imo1966_p4 (n : ℕ) (x : ℝ)
(hx : ∀ t : ℕ, ∀ k : ℤ, x ≠ k * Real.pi / 2^t) :
∑ i ∈ Finset.range n, 1 / Real.sin (2^(i + 1) * x) =
Real.cot x - Real.cot (2^n * x) := by
induction n with
| zero =>
rw [Finset.range_zero, Finset.sum_empty, pow_zero, one_mul, sub_self]
| succ n ih =>
rw [Finset.sum_range_succ, ih]
let θ := 2 ^ n * x
have hθ : θ = 2 ^ n * x := by rfl
have h₀ : Real.sin (2^(n+1) * x) ≠ 0 := by
intro h
rw [Real.sin_eq_zero_iff] at h
obtain ⟨k, hk⟩ := h
apply hx (n+1) k
rw [eq_div_iff (pow_ne_zero (n+1) (by norm_num)), mul_comm, ← hk]
have h₁ : Real.sin θ ≠ 0 ∧ Real.cos θ ≠ 0 := by
rw [pow_succ, mul_comm (2^n) 2, mul_assoc, ← hθ] at h₀
rw [Real.sin_two_mul] at h₀
constructor
· rw [mul_comm 2, mul_assoc] at h₀
apply left_ne_zero_of_mul h₀
· exact right_ne_zero_of_mul h₀
have h : 1 / Real.sin (2 * θ) = Real.cot θ - Real.cot (2 * θ) := by
simp only [Real.cot_eq_cos_div_sin]
rw [Real.sin_two_mul, Real.cos_two_mul]
field_simp [h₁]
ring
rw [pow_succ, mul_comm (2^n) 2, mul_assoc, ← hθ, h]
abel
end Imo1966P4 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1966P4.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 600.0, "latency_s": 0.6322, "verified_at": "2026-03-26T18:16:13.632420+00:00"}} | true | true | false | 0.6322 |
compfiles_Imo1966P5 | compfiles | Copyright (c) 2025 Roozbeh Yousefzadeh. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh, Benpigchu
-/
import Mathlib
/-!
# International Mathematical Olympiad 1966, Problem 5
Solve the system of equations
|a_1 - a_2| x_2 +|a_1 - a_3| x_3 +|a_1 - a_4| x_4 = 1
|a_2 - a_1| x_1 +|a_2 - a_3| x_3 +|a_2 - a_4| x_4 = 1
|a_3 - a_1| x_1 +|a_3 - a_2| x_2 +|a_3 - a_4| x_4 = 1
|a_4 - a_1| x_1 +|a_4 - a_2| x_2 +|a_4 - a_3| x_3 = 1
where a_1, a_2, a_3, a_4 are four different real numbers.
-/
namespace Imo1966P5
noncomputable def raw_order {n : ℕ} (a : Fin n → ℝ) : Fin n → ℕ :=
fun i ↦ Finset.card {j | a j < a i}
lemma raw_order_lt {n : ℕ} (a : Fin n → ℝ) (i : Fin n)
: raw_order a i < n := by
rw [raw_order, ]
apply lt_of_le_of_ne
· apply card_finset_fin_le
· simp only [← Finset.card_fin n]
rw [ne_eq, Finset.card_filter_eq_iff]
push_neg
use i
constructor
· apply Finset.mem_univ
· rfl
noncomputable def order {n : ℕ} (a : Fin n → ℝ) : Fin n → Fin n :=
fun i ↦ ⟨raw_order a i, raw_order_lt a i⟩
lemma bijective_order {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: Function.Bijective (order a) := by
rw [Fintype.bijective_iff_injective_and_card]
constructor
· intro i j hij
contrapose! hij
wlog hij' : a i < a j generalizing i j
· symm
apply this hij.symm
exact lt_of_le_of_ne (not_lt.mp hij') (Ne.symm (ha.ne hij))
apply ne_of_lt
simp only [order, raw_order, Fin.mk_lt_mk]
apply Finset.card_lt_card
rw [Finset.ssubset_iff_exists_cons_subset]
use i
constructor
· simp
rw [Finset.insert_subset_iff]
constructor
· simp
exact hij'
· intro k hk
simp at hk ⊢
exact lt_trans hk hij'
· simp
· rfl
noncomputable def nth_smallest_index {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: Fin n → Fin n :=
Fintype.bijInv (bijective_order ha)
lemma bijective_nth_smallest_index {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: Function.Bijective (nth_smallest_index ha) := by
exact Fintype.bijective_bijInv (bijective_order ha)
lemma order_comp_nth_smallest_index_eq_id {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: order a ∘ nth_smallest_index ha = id := by
exact (Fintype.rightInverse_bijInv (bijective_order ha)).id
lemma nth_smallest_index_comp_order_eq_id {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: nth_smallest_index ha ∘ order a = id := by
exact (Fintype.leftInverse_bijInv (bijective_order ha)).id
noncomputable def nth_smallest {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: Fin n → ℝ := a ∘ (nth_smallest_index ha)
lemma nth_smallest_strictMono {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: StrictMono (nth_smallest ha) := by
intro i j hij
rw [nth_smallest, Function.comp_apply, Function.comp_apply]
contrapose! hij
rw [← id_eq j, ← id_eq i, ← order_comp_nth_smallest_index_eq_id ha]
rw [Function.comp_apply, Function.comp_apply]
set i' := nth_smallest_index ha i
set j' := nth_smallest_index ha j
rw [order, order, Fin.mk_le_mk, raw_order, raw_order]
apply Finset.card_le_card
intro k hk
simp at hk ⊢
exact lt_of_lt_of_le hk hij
lemma order_eq_id_of_strictMono {n : ℕ} {a : Fin n → ℝ} (ha : StrictMono a)
: order a = id := by
ext i
rw [order, Fin.val_mk, id, raw_order, ← Fin.card_Iio]
congr
ext j
simp
exact ha.lt_iff_lt
lemma nth_smallest_index_eq_id_of_strictMono {n : ℕ} {a : Fin n → ℝ} (ha : StrictMono a)
: nth_smallest_index ha.injective = id := by
rw [nth_smallest_index]
ext x
have h := Fintype.leftInverse_bijInv (bijective_order ha.injective)
rw [Function.LeftInverse] at h
nth_rw 2 [← h x]
congr
rw [order_eq_id_of_strictMono ha]
dsimp
lemma nth_smallest_nth_smallest_eq_nth_smallest {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: nth_smallest (nth_smallest_strictMono ha).injective = nth_smallest ha := by
rw [nth_smallest, nth_smallest_index_eq_id_of_strictMono (nth_smallest_strictMono ha)]
rw [Function.comp_id]
lemma order_nth_smallest_eq_id {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: order (nth_smallest ha) = id := by
apply order_eq_id_of_strictMono
exact nth_smallest_strictMono ha
noncomputable def solution_set_generalized {n : ℕ} (hn : 2 ≤ n)
{a : Fin n → ℝ} (ha : Function.Injective a) : Set ((Fin n → ℝ)) := {
fun i : Fin n ↦
if order a i = ⟨0, by omega⟩ ∨ order a i = ⟨n - 1, by omega⟩
then 1 / (nth_smallest ha ⟨n - 1, by omega⟩ - nth_smallest ha ⟨0, by omega⟩)
else 0
}
theorem imo1966_p5_generalized
{n : ℕ}
(hn : 2 ≤ n)
(x a : Fin n → ℝ)
(ha : Function.Injective a) :
(∀ i : Fin n, ∑ j : Fin n, abs (a i - a j) * x j = 1)
↔ x ∈ solution_set_generalized hn ha := by
wlog h_mono_a : StrictMono a generalizing a x
· set a' := nth_smallest ha with ha'
set x' := x ∘ nth_smallest_index ha with hx'
have h_mono_a' : StrictMono a' := nth_smallest_strictMono ha
have h' := this x' a' h_mono_a'.injective h_mono_a'
have h_iff_left : (∀ (i : Fin n), ∑ j, |a' i - a' j| * x' j = 1)
↔ (∀ (i : Fin n), ∑ j, |a i - a j| * x j = 1) := by
simp only [ha', hx', nth_smallest, Function.comp_apply]
constructor <;> intro h i
· rw [← Function.Bijective.sum_comp (bijective_nth_smallest_index ha)]
rw [← id_eq i, ← nth_smallest_index_comp_order_eq_id ha, Function.comp_apply]
exact h (order a i)
· rw [← Function.Bijective.sum_comp (bijective_order ha)]
simp only [← @Function.comp_apply _ _ _ (nth_smallest_index ha) (order a), nth_smallest_index_comp_order_eq_id]
exact h (nth_smallest_index ha i)
have h_iff_right : x' ∈ solution_set_generalized hn h_mono_a'.injective
↔ x ∈ solution_set_generalized hn ha := by
rw [solution_set_generalized, solution_set_generalized, Set.mem_singleton_iff, Set.mem_singleton_iff]
rw [nth_smallest_nth_smallest_eq_nth_smallest, hx']
constructor <;> intro h <;> ext i
· rw [← Function.comp_id x, ← nth_smallest_index_comp_order_eq_id ha]
rw [← Function.comp_assoc, h, ha']
rw [order_nth_smallest_eq_id]
simp
· rw [h, ha']
dsimp
rw [order_nth_smallest_eq_id, ← @Function.comp_apply _ _ _ (order a)]
rw [order_comp_nth_smallest_index_eq_id ha]
rw [h_iff_left, h_iff_right] at h'
exact h'
· rw [solution_set_generalized, Set.mem_singleton_iff]
rw [order_eq_id_of_strictMono h_mono_a]
rw [nth_smallest, nth_smallest_index_eq_id_of_strictMono h_mono_a]
dsimp
have h_abs : ∀ {i j : Fin n} , j ≤ i → |a i - a j|
= a i - a j := by
intro i j hij
apply abs_of_nonneg
rw [sub_nonneg]
exact h_mono_a.monotone hij
have h_abs' : ∀ {i j : Fin n} , i ≤ j → |a i - a j|
= a j - a i := by
intro i j hij
rw [abs_sub_comm]
exact h_abs hij
have h_set : ({i : Fin n | i = ⟨0, by omega⟩ ∨ i = ⟨n - 1, by omega⟩} : Finset _) = {⟨0, by omega⟩, ⟨n - 1, by omega⟩} := by
ext i
rw [Finset.mem_insert, Finset.mem_singleton, Finset.mem_filter]
rw [eq_true (Finset.mem_univ _), true_and]
have h_0 : 0 < a ⟨n - 1, by omega⟩ - a ⟨0, by omega⟩ := by
rw [sub_pos]
apply h_mono_a
rw [Fin.lt_def]
omega
constructor
· intro h
have h₁ : ∀ (i : Fin n) (hi : i < ⟨n - 1, by omega⟩),
(a ⟨↑i + 1, by omega⟩ - a i) ≠ 0 := by
intro i hi
apply ne_of_gt
rw [sub_pos]
apply h_mono_a
rw [Fin.lt_def]
omega
have h₂ : ∀ (i j : Fin n) (hi : i < ⟨n - 1, by omega⟩),
|a i - a j| - |a ⟨↑i + 1, by omega⟩ - a j|
= (a ⟨↑i + 1, by omega⟩ - a i) * (if j ≤ i then -1 else 1) := by
intro i j hi
by_cases! hij : j ≤ i
· rw [h_abs hij, h_abs (by rw [Fin.le_def]; omega), if_pos hij]
ring
· rw [h_abs' (by rw [Fin.le_def]; omega), h_abs' (Fin.mk_le_of_le_val hij), if_neg (by rw [Fin.le_def]; omega)]
ring
have h₃ : ∀ (i : Fin n) (hi : i < ⟨n - 1, by omega⟩),
∑ j, (a ⟨↑i + 1, by omega⟩ - a i) * ((if j ≤ i then -1 else 1) * x j)
= ∑ j, (|a i - a j| * x j - |a ⟨↑i + 1, by omega⟩ - a j| * x j) := by
intro i hi
apply Finset.sum_congr rfl
intro j _
rw [← mul_assoc, ← h₂ i j hi, sub_mul]
have h₄ : ∀ (i : Fin n) (hi : i < ⟨n - 1, by omega⟩),
∑ j, (if j ≤ i then -1 else 1) * x j = 0 := by
rintro i hi
apply eq_zero_of_ne_zero_of_mul_left_eq_zero (h₁ i hi)
rw [Finset.mul_sum, h₃ i hi, Finset.sum_sub_distrib]
rw [h i, h ⟨i.val + 1, by omega⟩]
norm_num
have h₅ : ∀ (i : Fin n) (hi_min : ⟨0, by omega⟩ < i) (hi_max : i < ⟨n - 1, by omega⟩),
∑ j, ((if j ≤ ⟨i.val - 1, by omega⟩ then -1 else 1) * x j - (if j ≤ i then -1 else 1) * x j)
= ∑ j, 2 *(if j = i then x j else 0) := by
intro i hi_min hi_max
apply Finset.sum_congr rfl
intro j _
by_cases! hij : j = i
· rw [hij, if_neg (by rw [Fin.le_def]; omega), if_pos (by rfl), if_pos (by rfl)]
ring
· by_cases! hij' : j < i
· rw [if_pos (by rw [Fin.le_def]; omega), if_pos (Fin.le_of_lt hij'), if_neg (by omega)]
ring
· rw [if_neg (by rw [Fin.le_def]; omega), if_neg (by rw [Fin.le_def]; omega), if_neg (by omega)]
ring
have h_mid : ∀ (i : Fin n) (hi_min : ⟨0, by omega⟩ < i) (hi_max : i < ⟨n - 1, by omega⟩),
x i = 0 := by
intro i hi_min hi_max
apply eq_zero_of_ne_zero_of_mul_left_eq_zero (by norm_num : (2 : ℝ) ≠ 0)
rw [← Fintype.sum_ite_eq' i x, Finset.mul_sum]
rw [← h₅ i hi_min hi_max, Finset.sum_sub_distrib]
rw [h₄ ⟨i.val - 1, by omega⟩ (by rw [Fin.lt_def]; omega), h₄ i hi_max]
norm_num
have h₆ : ∀ (i : Fin n), ∑ j, (if j = ⟨0, by omega⟩ ∨ j = ⟨n - 1, by omega⟩ then |a i - a j| * x j else 0) = 1 := by
intro i
rw [← h i]
apply Finset.sum_congr rfl
intro j _
by_cases hj : j = ⟨0, by omega⟩ ∨ j = ⟨n - 1, by omega⟩
· rw [if_pos hj]
· rw [if_neg hj]
symm
apply mul_eq_zero_of_right
rw [not_or, Fin.eq_mk_iff_val_eq, Fin.eq_mk_iff_val_eq] at hj
apply h_mid <;> rw [Fin.lt_def] <;> omega
ext i
by_cases hi : i = ⟨0, by omega⟩ ∨ i = ⟨n - 1, by omega⟩
· rw [if_pos hi]
rcases hi with hi|hi
· have h' := h₆ ⟨n - 1, by omega⟩
rw [Finset.sum_ite, Finset.sum_const_zero, add_zero] at h'
rw [h_set, Finset.sum_pair (by omega), sub_self] at h'
rw [abs_zero, zero_mul, add_zero, abs_of_pos h_0] at h'
rw [eq_div_iff (by positivity), hi, mul_comm]
exact h'
· have h' := h₆ ⟨0, by omega⟩
rw [Finset.sum_ite, Finset.sum_const_zero, add_zero] at h'
rw [h_set, Finset.sum_pair (by omega), sub_self] at h'
rw [abs_zero, zero_mul, zero_add, abs_sub_comm, abs_of_pos h_0] at h'
rw [eq_div_iff (by positivity), hi, mul_comm]
exact h'
· have hi' : ⟨0, by omega⟩ < i ∧ i < ⟨n - 1, by omega⟩ := by
rw [not_or, Fin.eq_mk_iff_val_eq, Fin.eq_mk_iff_val_eq] at hi
constructor <;> rw [Fin.lt_def] <;> omega
rw [h_mid i hi'.left hi'.right, if_neg hi]
· intro h i
rw [h]
dsimp
simp only [mul_ite, mul_zero]
rw [Finset.sum_ite, Finset.sum_const_zero, add_zero]
rw [h_set, Finset.sum_pair (by omega)]
have h_0 : ⟨0, by omega⟩ ≤ i := by
rw [Fin.le_def]
omega
have h_max : i ≤ ⟨n - 1, by omega⟩ := by
rw [Fin.le_def]
omega
rw [h_abs h_0]
rw [h_abs' h_max]
rw [← add_mul]
field_simp
ring
noncomputable abbrev solution_set {a : Fin 4 → ℝ}
(ha : Function.Injective a) : Set ((Fin 4 → ℝ)) :=
solution_set_generalized (by norm_num : 2 ≤ 4) ha
theorem imo1966_p5
(x a : Fin 4 → ℝ)
(ha : Function.Injective a) :
(∀ i : Fin 4, ∑ j : Fin 4, abs (a i - a j) * x j = 1)
↔ x ∈ solution_set ha := by
exact imo1966_p5_generalized (by norm_num : 2 ≤ 4) x a ha
end Imo1966P5 | /- | /-
Copyright (c) 2025 Roozbeh Yousefzadeh. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh, Benpigchu
-/
import Mathlib
/-!
# International Mathematical Olympiad 1966, Problem 5
Solve the system of equations
|a_1 - a_2| x_2 +|a_1 - a_3| x_3 +|a_1 - a_4| x_4 = 1
|a_2 - a_1| x_1 +|a_2 - a_3| x_3 +|a_2 - a_4| x_4 = 1
|a_3 - a_1| x_1 +|a_3 - a_2| x_2 +|a_3 - a_4| x_4 = 1
|a_4 - a_1| x_1 +|a_4 - a_2| x_2 +|a_4 - a_3| x_3 = 1
where a_1, a_2, a_3, a_4 are four different real numbers.
-/
namespace Imo1966P5
noncomputable def raw_order {n : ℕ} (a : Fin n → ℝ) : Fin n → ℕ :=
fun i ↦ Finset.card {j | a j < a i}
lemma raw_order_lt {n : ℕ} (a : Fin n → ℝ) (i : Fin n)
: raw_order a i < n := by
rw [raw_order, ]
apply lt_of_le_of_ne
· apply card_finset_fin_le
· simp only [← Finset.card_fin n]
rw [ne_eq, Finset.card_filter_eq_iff]
push_neg
use i
constructor
· apply Finset.mem_univ
· rfl
noncomputable def order {n : ℕ} (a : Fin n → ℝ) : Fin n → Fin n :=
fun i ↦ ⟨raw_order a i, raw_order_lt a i⟩
lemma bijective_order {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: Function.Bijective (order a) := by
rw [Fintype.bijective_iff_injective_and_card]
constructor
· intro i j hij
contrapose! hij
wlog hij' : a i < a j generalizing i j
· symm
apply this hij.symm
exact lt_of_le_of_ne (not_lt.mp hij') (Ne.symm (ha.ne hij))
apply ne_of_lt
simp only [order, raw_order, Fin.mk_lt_mk]
apply Finset.card_lt_card
rw [Finset.ssubset_iff_exists_cons_subset]
use i
constructor
· simp
rw [Finset.insert_subset_iff]
constructor
· simp
exact hij'
· intro k hk
simp at hk ⊢
exact lt_trans hk hij'
· simp
· rfl
noncomputable def nth_smallest_index {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: Fin n → Fin n :=
Fintype.bijInv (bijective_order ha)
lemma bijective_nth_smallest_index {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: Function.Bijective (nth_smallest_index ha) := by
exact Fintype.bijective_bijInv (bijective_order ha)
lemma order_comp_nth_smallest_index_eq_id {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: order a ∘ nth_smallest_index ha = id := by
exact (Fintype.rightInverse_bijInv (bijective_order ha)).id
lemma nth_smallest_index_comp_order_eq_id {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: nth_smallest_index ha ∘ order a = id := by
exact (Fintype.leftInverse_bijInv (bijective_order ha)).id
noncomputable def nth_smallest {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: Fin n → ℝ := a ∘ (nth_smallest_index ha)
lemma nth_smallest_strictMono {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: StrictMono (nth_smallest ha) := by
intro i j hij
rw [nth_smallest, Function.comp_apply, Function.comp_apply]
contrapose! hij
rw [← id_eq j, ← id_eq i, ← order_comp_nth_smallest_index_eq_id ha]
rw [Function.comp_apply, Function.comp_apply]
set i' := nth_smallest_index ha i
set j' := nth_smallest_index ha j
rw [order, order, Fin.mk_le_mk, raw_order, raw_order]
apply Finset.card_le_card
intro k hk
simp at hk ⊢
exact lt_of_lt_of_le hk hij
lemma order_eq_id_of_strictMono {n : ℕ} {a : Fin n → ℝ} (ha : StrictMono a)
: order a = id := by
ext i
rw [order, Fin.val_mk, id, raw_order, ← Fin.card_Iio]
congr
ext j
simp
exact ha.lt_iff_lt
lemma nth_smallest_index_eq_id_of_strictMono {n : ℕ} {a : Fin n → ℝ} (ha : StrictMono a)
: nth_smallest_index ha.injective = id := by
rw [nth_smallest_index]
ext x
have h := Fintype.leftInverse_bijInv (bijective_order ha.injective)
rw [Function.LeftInverse] at h
nth_rw 2 [← h x]
congr
rw [order_eq_id_of_strictMono ha]
dsimp
lemma nth_smallest_nth_smallest_eq_nth_smallest {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: nth_smallest (nth_smallest_strictMono ha).injective = nth_smallest ha := by
rw [nth_smallest, nth_smallest_index_eq_id_of_strictMono (nth_smallest_strictMono ha)]
rw [Function.comp_id]
lemma order_nth_smallest_eq_id {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: order (nth_smallest ha) = id := by
apply order_eq_id_of_strictMono
exact nth_smallest_strictMono ha
noncomputable def solution_set_generalized {n : ℕ} (hn : 2 ≤ n)
{a : Fin n → ℝ} (ha : Function.Injective a) : Set ((Fin n → ℝ)) := {
fun i : Fin n ↦
if order a i = ⟨0, by omega⟩ ∨ order a i = ⟨n - 1, by omega⟩
then 1 / (nth_smallest ha ⟨n - 1, by omega⟩ - nth_smallest ha ⟨0, by omega⟩)
else 0
}
theorem imo1966_p5_generalized
{n : ℕ}
(hn : 2 ≤ n)
(x a : Fin n → ℝ)
(ha : Function.Injective a) :
(∀ i : Fin n, ∑ j : Fin n, abs (a i - a j) * x j = 1)
↔ x ∈ solution_set_generalized hn ha := by
wlog h_mono_a : StrictMono a generalizing a x
· set a' := nth_smallest ha with ha'
set x' := x ∘ nth_smallest_index ha with hx'
have h_mono_a' : StrictMono a' := nth_smallest_strictMono ha
have h' := this x' a' h_mono_a'.injective h_mono_a'
have h_iff_left : (∀ (i : Fin n), ∑ j, |a' i - a' j| * x' j = 1)
↔ (∀ (i : Fin n), ∑ j, |a i - a j| * x j = 1) := by
simp only [ha', hx', nth_smallest, Function.comp_apply]
constructor <;> intro h i
· rw [← Function.Bijective.sum_comp (bijective_nth_smallest_index ha)]
rw [← id_eq i, ← nth_smallest_index_comp_order_eq_id ha, Function.comp_apply]
exact h (order a i)
· rw [← Function.Bijective.sum_comp (bijective_order ha)]
simp only [← @Function.comp_apply _ _ _ (nth_smallest_index ha) (order a), nth_smallest_index_comp_order_eq_id]
exact h (nth_smallest_index ha i)
have h_iff_right : x' ∈ solution_set_generalized hn h_mono_a'.injective
↔ x ∈ solution_set_generalized hn ha := by
rw [solution_set_generalized, solution_set_generalized, Set.mem_singleton_iff, Set.mem_singleton_iff]
rw [nth_smallest_nth_smallest_eq_nth_smallest, hx']
constructor <;> intro h <;> ext i
· rw [← Function.comp_id x, ← nth_smallest_index_comp_order_eq_id ha]
rw [← Function.comp_assoc, h, ha']
rw [order_nth_smallest_eq_id]
simp
· rw [h, ha']
dsimp
rw [order_nth_smallest_eq_id, ← @Function.comp_apply _ _ _ (order a)]
rw [order_comp_nth_smallest_index_eq_id ha]
rw [h_iff_left, h_iff_right] at h'
exact h'
· rw [solution_set_generalized, Set.mem_singleton_iff]
rw [order_eq_id_of_strictMono h_mono_a]
rw [nth_smallest, nth_smallest_index_eq_id_of_strictMono h_mono_a]
dsimp
have h_abs : ∀ {i j : Fin n} , j ≤ i → |a i - a j|
= a i - a j := by
intro i j hij
apply abs_of_nonneg
rw [sub_nonneg]
exact h_mono_a.monotone hij
have h_abs' : ∀ {i j : Fin n} , i ≤ j → |a i - a j|
= a j - a i := by
intro i j hij
rw [abs_sub_comm]
exact h_abs hij
have h_set : ({i : Fin n | i = ⟨0, by omega⟩ ∨ i = ⟨n - 1, by omega⟩} : Finset _) = {⟨0, by omega⟩, ⟨n - 1, by omega⟩} := by
ext i
rw [Finset.mem_insert, Finset.mem_singleton, Finset.mem_filter]
rw [eq_true (Finset.mem_univ _), true_and]
have h_0 : 0 < a ⟨n - 1, by omega⟩ - a ⟨0, by omega⟩ := by
rw [sub_pos]
apply h_mono_a
rw [Fin.lt_def]
omega
constructor
· intro h
have h₁ : ∀ (i : Fin n) (hi : i < ⟨n - 1, by omega⟩),
(a ⟨↑i + 1, by omega⟩ - a i) ≠ 0 := by
intro i hi
apply ne_of_gt
rw [sub_pos]
apply h_mono_a
rw [Fin.lt_def]
omega
have h₂ : ∀ (i j : Fin n) (hi : i < ⟨n - 1, by omega⟩),
|a i - a j| - |a ⟨↑i + 1, by omega⟩ - a j|
= (a ⟨↑i + 1, by omega⟩ - a i) * (if j ≤ i then -1 else 1) := by
intro i j hi
by_cases! hij : j ≤ i
· rw [h_abs hij, h_abs (by rw [Fin.le_def]; omega), if_pos hij]
ring
· rw [h_abs' (by rw [Fin.le_def]; omega), h_abs' (Fin.mk_le_of_le_val hij), if_neg (by rw [Fin.le_def]; omega)]
ring
have h₃ : ∀ (i : Fin n) (hi : i < ⟨n - 1, by omega⟩),
∑ j, (a ⟨↑i + 1, by omega⟩ - a i) * ((if j ≤ i then -1 else 1) * x j)
= ∑ j, (|a i - a j| * x j - |a ⟨↑i + 1, by omega⟩ - a j| * x j) := by
intro i hi
apply Finset.sum_congr rfl
intro j _
rw [← mul_assoc, ← h₂ i j hi, sub_mul]
have h₄ : ∀ (i : Fin n) (hi : i < ⟨n - 1, by omega⟩),
∑ j, (if j ≤ i then -1 else 1) * x j = 0 := by
rintro i hi
apply eq_zero_of_ne_zero_of_mul_left_eq_zero (h₁ i hi)
rw [Finset.mul_sum, h₃ i hi, Finset.sum_sub_distrib]
rw [h i, h ⟨i.val + 1, by omega⟩]
norm_num
have h₅ : ∀ (i : Fin n) (hi_min : ⟨0, by omega⟩ < i) (hi_max : i < ⟨n - 1, by omega⟩),
∑ j, ((if j ≤ ⟨i.val - 1, by omega⟩ then -1 else 1) * x j - (if j ≤ i then -1 else 1) * x j)
= ∑ j, 2 *(if j = i then x j else 0) := by
intro i hi_min hi_max
apply Finset.sum_congr rfl
intro j _
by_cases! hij : j = i
· rw [hij, if_neg (by rw [Fin.le_def]; omega), if_pos (by rfl), if_pos (by rfl)]
ring
· by_cases! hij' : j < i
· rw [if_pos (by rw [Fin.le_def]; omega), if_pos (Fin.le_of_lt hij'), if_neg (by omega)]
ring
· rw [if_neg (by rw [Fin.le_def]; omega), if_neg (by rw [Fin.le_def]; omega), if_neg (by omega)]
ring
have h_mid : ∀ (i : Fin n) (hi_min : ⟨0, by omega⟩ < i) (hi_max : i < ⟨n - 1, by omega⟩),
x i = 0 := by
intro i hi_min hi_max
apply eq_zero_of_ne_zero_of_mul_left_eq_zero (by norm_num : (2 : ℝ) ≠ 0)
rw [← Fintype.sum_ite_eq' i x, Finset.mul_sum]
rw [← h₅ i hi_min hi_max, Finset.sum_sub_distrib]
rw [h₄ ⟨i.val - 1, by omega⟩ (by rw [Fin.lt_def]; omega), h₄ i hi_max]
norm_num
have h₆ : ∀ (i : Fin n), ∑ j, (if j = ⟨0, by omega⟩ ∨ j = ⟨n - 1, by omega⟩ then |a i - a j| * x j else 0) = 1 := by
intro i
rw [← h i]
apply Finset.sum_congr rfl
intro j _
by_cases hj : j = ⟨0, by omega⟩ ∨ j = ⟨n - 1, by omega⟩
· rw [if_pos hj]
· rw [if_neg hj]
symm
apply mul_eq_zero_of_right
rw [not_or, Fin.eq_mk_iff_val_eq, Fin.eq_mk_iff_val_eq] at hj
apply h_mid <;> rw [Fin.lt_def] <;> omega
ext i
by_cases hi : i = ⟨0, by omega⟩ ∨ i = ⟨n - 1, by omega⟩
· rw [if_pos hi]
rcases hi with hi|hi
· have h' := h₆ ⟨n - 1, by omega⟩
rw [Finset.sum_ite, Finset.sum_const_zero, add_zero] at h'
rw [h_set, Finset.sum_pair (by omega), sub_self] at h'
rw [abs_zero, zero_mul, add_zero, abs_of_pos h_0] at h'
rw [eq_div_iff (by positivity), hi, mul_comm]
exact h'
· have h' := h₆ ⟨0, by omega⟩
rw [Finset.sum_ite, Finset.sum_const_zero, add_zero] at h'
rw [h_set, Finset.sum_pair (by omega), sub_self] at h'
rw [abs_zero, zero_mul, zero_add, abs_sub_comm, abs_of_pos h_0] at h'
rw [eq_div_iff (by positivity), hi, mul_comm]
exact h'
· have hi' : ⟨0, by omega⟩ < i ∧ i < ⟨n - 1, by omega⟩ := by
rw [not_or, Fin.eq_mk_iff_val_eq, Fin.eq_mk_iff_val_eq] at hi
constructor <;> rw [Fin.lt_def] <;> omega
rw [h_mid i hi'.left hi'.right, if_neg hi]
· intro h i
rw [h]
dsimp
simp only [mul_ite, mul_zero]
rw [Finset.sum_ite, Finset.sum_const_zero, add_zero]
rw [h_set, Finset.sum_pair (by omega)]
have h_0 : ⟨0, by omega⟩ ≤ i := by
rw [Fin.le_def]
omega
have h_max : i ≤ ⟨n - 1, by omega⟩ := by
rw [Fin.le_def]
omega
rw [h_abs h_0]
rw [h_abs' h_max]
rw [← add_mul]
field_simp
ring
noncomputable abbrev solution_set {a : Fin 4 → ℝ}
(ha : Function.Injective a) : Set ((Fin 4 → ℝ)) :=
solution_set_generalized (by norm_num : 2 ≤ 4) ha
theorem imo1966_p5
(x a : Fin 4 → ℝ)
(ha : Function.Injective a) :
(∀ i : Fin 4, ∑ j : Fin 4, abs (a i - a j) * x j = 1)
↔ x ∈ solution_set ha := by
exact imo1966_p5_generalized (by norm_num : 2 ≤ 4) x a ha
end Imo1966P5
| true | Copyright (c) 2025 Roozbeh Yousefzadeh. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh, Benpigchu
-/
import Mathlib
/-!
# International Mathematical Olympiad 1966, Problem 5
Solve the system of equations
|a_1 - a_2| x_2 +|a_1 - a_3| x_3 +|a_1 - a_4| x_4 = 1
|a_2 - a_1| x_1 +|a_2 - a_3| x_3 +|a_2 - a_4| x_4 = 1
|a_3 - a_1| x_1 +|a_3 - a_2| x_2 +|a_3 - a_4| x_4 = 1
|a_4 - a_1| x_1 +|a_4 - a_2| x_2 +|a_4 - a_3| x_3 = 1
where a_1, a_2, a_3, a_4 are four different real numbers.
-/
namespace Imo1966P5
noncomputable def raw_order {n : ℕ} (a : Fin n → ℝ) : Fin n → ℕ :=
fun i ↦ Finset.card {j | a j < a i}
lemma raw_order_lt {n : ℕ} (a : Fin n → ℝ) (i : Fin n)
: raw_order a i < n := by
rw [raw_order, ]
apply lt_of_le_of_ne
· apply card_finset_fin_le
· simp only [← Finset.card_fin n]
rw [ne_eq, Finset.card_filter_eq_iff]
push_neg
use i
constructor
· apply Finset.mem_univ
· rfl
noncomputable def order {n : ℕ} (a : Fin n → ℝ) : Fin n → Fin n :=
fun i ↦ ⟨raw_order a i, raw_order_lt a i⟩
lemma bijective_order {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: Function.Bijective (order a) := by
rw [Fintype.bijective_iff_injective_and_card]
constructor
· intro i j hij
contrapose! hij
wlog hij' : a i < a j generalizing i j
· symm
apply this hij.symm
exact lt_of_le_of_ne (not_lt.mp hij') (Ne.symm (ha.ne hij))
apply ne_of_lt
simp only [order, raw_order, Fin.mk_lt_mk]
apply Finset.card_lt_card
rw [Finset.ssubset_iff_exists_cons_subset]
use i
constructor
· simp
rw [Finset.insert_subset_iff]
constructor
· simp
exact hij'
· intro k hk
simp at hk ⊢
exact lt_trans hk hij'
· simp
· rfl
noncomputable def nth_smallest_index {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: Fin n → Fin n :=
Fintype.bijInv (bijective_order ha)
lemma bijective_nth_smallest_index {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: Function.Bijective (nth_smallest_index ha) := by
exact Fintype.bijective_bijInv (bijective_order ha)
lemma order_comp_nth_smallest_index_eq_id {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: order a ∘ nth_smallest_index ha = id := by
exact (Fintype.rightInverse_bijInv (bijective_order ha)).id
lemma nth_smallest_index_comp_order_eq_id {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: nth_smallest_index ha ∘ order a = id := by
exact (Fintype.leftInverse_bijInv (bijective_order ha)).id
noncomputable def nth_smallest {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: Fin n → ℝ := a ∘ (nth_smallest_index ha)
lemma nth_smallest_strictMono {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: StrictMono (nth_smallest ha) := by
intro i j hij
rw [nth_smallest, Function.comp_apply, Function.comp_apply]
contrapose! hij
rw [← id_eq j, ← id_eq i, ← order_comp_nth_smallest_index_eq_id ha]
rw [Function.comp_apply, Function.comp_apply]
set i' := nth_smallest_index ha i
set j' := nth_smallest_index ha j
rw [order, order, Fin.mk_le_mk, raw_order, raw_order]
apply Finset.card_le_card
intro k hk
simp at hk ⊢
exact lt_of_lt_of_le hk hij
lemma order_eq_id_of_strictMono {n : ℕ} {a : Fin n → ℝ} (ha : StrictMono a)
: order a = id := by
ext i
rw [order, Fin.val_mk, id, raw_order, ← Fin.card_Iio]
congr
ext j
simp
exact ha.lt_iff_lt
lemma nth_smallest_index_eq_id_of_strictMono {n : ℕ} {a : Fin n → ℝ} (ha : StrictMono a)
: nth_smallest_index ha.injective = id := by
rw [nth_smallest_index]
ext x
have h := Fintype.leftInverse_bijInv (bijective_order ha.injective)
rw [Function.LeftInverse] at h
nth_rw 2 [← h x]
congr
rw [order_eq_id_of_strictMono ha]
dsimp
lemma nth_smallest_nth_smallest_eq_nth_smallest {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: nth_smallest (nth_smallest_strictMono ha).injective = nth_smallest ha := by
rw [nth_smallest, nth_smallest_index_eq_id_of_strictMono (nth_smallest_strictMono ha)]
rw [Function.comp_id]
lemma order_nth_smallest_eq_id {n : ℕ} {a : Fin n → ℝ} (ha : Function.Injective a)
: order (nth_smallest ha) = id := by
apply order_eq_id_of_strictMono
exact nth_smallest_strictMono ha
noncomputable def solution_set_generalized {n : ℕ} (hn : 2 ≤ n)
{a : Fin n → ℝ} (ha : Function.Injective a) : Set ((Fin n → ℝ)) := {
fun i : Fin n ↦
if order a i = ⟨0, by omega⟩ ∨ order a i = ⟨n - 1, by omega⟩
then 1 / (nth_smallest ha ⟨n - 1, by omega⟩ - nth_smallest ha ⟨0, by omega⟩)
else 0
}
theorem imo1966_p5_generalized
{n : ℕ}
(hn : 2 ≤ n)
(x a : Fin n → ℝ)
(ha : Function.Injective a) :
(∀ i : Fin n, ∑ j : Fin n, abs (a i - a j) * x j = 1)
↔ x ∈ solution_set_generalized hn ha := by
wlog h_mono_a : StrictMono a generalizing a x
· set a' := nth_smallest ha with ha'
set x' := x ∘ nth_smallest_index ha with hx'
have h_mono_a' : StrictMono a' := nth_smallest_strictMono ha
have h' := this x' a' h_mono_a'.injective h_mono_a'
have h_iff_left : (∀ (i : Fin n), ∑ j, |a' i - a' j| * x' j = 1)
↔ (∀ (i : Fin n), ∑ j, |a i - a j| * x j = 1) := by
simp only [ha', hx', nth_smallest, Function.comp_apply]
constructor <;> intro h i
· rw [← Function.Bijective.sum_comp (bijective_nth_smallest_index ha)]
rw [← id_eq i, ← nth_smallest_index_comp_order_eq_id ha, Function.comp_apply]
exact h (order a i)
· rw [← Function.Bijective.sum_comp (bijective_order ha)]
simp only [← @Function.comp_apply _ _ _ (nth_smallest_index ha) (order a), nth_smallest_index_comp_order_eq_id]
exact h (nth_smallest_index ha i)
have h_iff_right : x' ∈ solution_set_generalized hn h_mono_a'.injective
↔ x ∈ solution_set_generalized hn ha := by
rw [solution_set_generalized, solution_set_generalized, Set.mem_singleton_iff, Set.mem_singleton_iff]
rw [nth_smallest_nth_smallest_eq_nth_smallest, hx']
constructor <;> intro h <;> ext i
· rw [← Function.comp_id x, ← nth_smallest_index_comp_order_eq_id ha]
rw [← Function.comp_assoc, h, ha']
rw [order_nth_smallest_eq_id]
simp
· rw [h, ha']
dsimp
rw [order_nth_smallest_eq_id, ← @Function.comp_apply _ _ _ (order a)]
rw [order_comp_nth_smallest_index_eq_id ha]
rw [h_iff_left, h_iff_right] at h'
exact h'
· rw [solution_set_generalized, Set.mem_singleton_iff]
rw [order_eq_id_of_strictMono h_mono_a]
rw [nth_smallest, nth_smallest_index_eq_id_of_strictMono h_mono_a]
dsimp
have h_abs : ∀ {i j : Fin n} , j ≤ i → |a i - a j|
= a i - a j := by
intro i j hij
apply abs_of_nonneg
rw [sub_nonneg]
exact h_mono_a.monotone hij
have h_abs' : ∀ {i j : Fin n} , i ≤ j → |a i - a j|
= a j - a i := by
intro i j hij
rw [abs_sub_comm]
exact h_abs hij
have h_set : ({i : Fin n | i = ⟨0, by omega⟩ ∨ i = ⟨n - 1, by omega⟩} : Finset _) = {⟨0, by omega⟩, ⟨n - 1, by omega⟩} := by
ext i
rw [Finset.mem_insert, Finset.mem_singleton, Finset.mem_filter]
rw [eq_true (Finset.mem_univ _), true_and]
have h_0 : 0 < a ⟨n - 1, by omega⟩ - a ⟨0, by omega⟩ := by
rw [sub_pos]
apply h_mono_a
rw [Fin.lt_def]
omega
constructor
· intro h
have h₁ : ∀ (i : Fin n) (hi : i < ⟨n - 1, by omega⟩),
(a ⟨↑i + 1, by omega⟩ - a i) ≠ 0 := by
intro i hi
apply ne_of_gt
rw [sub_pos]
apply h_mono_a
rw [Fin.lt_def]
omega
have h₂ : ∀ (i j : Fin n) (hi : i < ⟨n - 1, by omega⟩),
|a i - a j| - |a ⟨↑i + 1, by omega⟩ - a j|
= (a ⟨↑i + 1, by omega⟩ - a i) * (if j ≤ i then -1 else 1) := by
intro i j hi
by_cases! hij : j ≤ i
· rw [h_abs hij, h_abs (by rw [Fin.le_def]; omega), if_pos hij]
ring
· rw [h_abs' (by rw [Fin.le_def]; omega), h_abs' (Fin.mk_le_of_le_val hij), if_neg (by rw [Fin.le_def]; omega)]
ring
have h₃ : ∀ (i : Fin n) (hi : i < ⟨n - 1, by omega⟩),
∑ j, (a ⟨↑i + 1, by omega⟩ - a i) * ((if j ≤ i then -1 else 1) * x j)
= ∑ j, (|a i - a j| * x j - |a ⟨↑i + 1, by omega⟩ - a j| * x j) := by
intro i hi
apply Finset.sum_congr rfl
intro j _
rw [← mul_assoc, ← h₂ i j hi, sub_mul]
have h₄ : ∀ (i : Fin n) (hi : i < ⟨n - 1, by omega⟩),
∑ j, (if j ≤ i then -1 else 1) * x j = 0 := by
rintro i hi
apply eq_zero_of_ne_zero_of_mul_left_eq_zero (h₁ i hi)
rw [Finset.mul_sum, h₃ i hi, Finset.sum_sub_distrib]
rw [h i, h ⟨i.val + 1, by omega⟩]
norm_num
have h₅ : ∀ (i : Fin n) (hi_min : ⟨0, by omega⟩ < i) (hi_max : i < ⟨n - 1, by omega⟩),
∑ j, ((if j ≤ ⟨i.val - 1, by omega⟩ then -1 else 1) * x j - (if j ≤ i then -1 else 1) * x j)
= ∑ j, 2 *(if j = i then x j else 0) := by
intro i hi_min hi_max
apply Finset.sum_congr rfl
intro j _
by_cases! hij : j = i
· rw [hij, if_neg (by rw [Fin.le_def]; omega), if_pos (by rfl), if_pos (by rfl)]
ring
· by_cases! hij' : j < i
· rw [if_pos (by rw [Fin.le_def]; omega), if_pos (Fin.le_of_lt hij'), if_neg (by omega)]
ring
· rw [if_neg (by rw [Fin.le_def]; omega), if_neg (by rw [Fin.le_def]; omega), if_neg (by omega)]
ring
have h_mid : ∀ (i : Fin n) (hi_min : ⟨0, by omega⟩ < i) (hi_max : i < ⟨n - 1, by omega⟩),
x i = 0 := by
intro i hi_min hi_max
apply eq_zero_of_ne_zero_of_mul_left_eq_zero (by norm_num : (2 : ℝ) ≠ 0)
rw [← Fintype.sum_ite_eq' i x, Finset.mul_sum]
rw [← h₅ i hi_min hi_max, Finset.sum_sub_distrib]
rw [h₄ ⟨i.val - 1, by omega⟩ (by rw [Fin.lt_def]; omega), h₄ i hi_max]
norm_num
have h₆ : ∀ (i : Fin n), ∑ j, (if j = ⟨0, by omega⟩ ∨ j = ⟨n - 1, by omega⟩ then |a i - a j| * x j else 0) = 1 := by
intro i
rw [← h i]
apply Finset.sum_congr rfl
intro j _
by_cases hj : j = ⟨0, by omega⟩ ∨ j = ⟨n - 1, by omega⟩
· rw [if_pos hj]
· rw [if_neg hj]
symm
apply mul_eq_zero_of_right
rw [not_or, Fin.eq_mk_iff_val_eq, Fin.eq_mk_iff_val_eq] at hj
apply h_mid <;> rw [Fin.lt_def] <;> omega
ext i
by_cases hi : i = ⟨0, by omega⟩ ∨ i = ⟨n - 1, by omega⟩
· rw [if_pos hi]
rcases hi with hi|hi
· have h' := h₆ ⟨n - 1, by omega⟩
rw [Finset.sum_ite, Finset.sum_const_zero, add_zero] at h'
rw [h_set, Finset.sum_pair (by omega), sub_self] at h'
rw [abs_zero, zero_mul, add_zero, abs_of_pos h_0] at h'
rw [eq_div_iff (by positivity), hi, mul_comm]
exact h'
· have h' := h₆ ⟨0, by omega⟩
rw [Finset.sum_ite, Finset.sum_const_zero, add_zero] at h'
rw [h_set, Finset.sum_pair (by omega), sub_self] at h'
rw [abs_zero, zero_mul, zero_add, abs_sub_comm, abs_of_pos h_0] at h'
rw [eq_div_iff (by positivity), hi, mul_comm]
exact h'
· have hi' : ⟨0, by omega⟩ < i ∧ i < ⟨n - 1, by omega⟩ := by
rw [not_or, Fin.eq_mk_iff_val_eq, Fin.eq_mk_iff_val_eq] at hi
constructor <;> rw [Fin.lt_def] <;> omega
rw [h_mid i hi'.left hi'.right, if_neg hi]
· intro h i
rw [h]
dsimp
simp only [mul_ite, mul_zero]
rw [Finset.sum_ite, Finset.sum_const_zero, add_zero]
rw [h_set, Finset.sum_pair (by omega)]
have h_0 : ⟨0, by omega⟩ ≤ i := by
rw [Fin.le_def]
omega
have h_max : i ≤ ⟨n - 1, by omega⟩ := by
rw [Fin.le_def]
omega
rw [h_abs h_0]
rw [h_abs' h_max]
rw [← add_mul]
field_simp
ring
noncomputable abbrev solution_set {a : Fin 4 → ℝ}
(ha : Function.Injective a) : Set ((Fin 4 → ℝ)) :=
solution_set_generalized (by norm_num : 2 ≤ 4) ha
theorem imo1966_p5
(x a : Fin 4 → ℝ)
(ha : Function.Injective a) :
(∀ i : Fin 4, ∑ j : Fin 4, abs (a i - a j) * x j = 1)
↔ x ∈ solution_set ha := by
exact imo1966_p5_generalized (by norm_num : 2 ≤ 4) x a ha
end Imo1966P5 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1966P5.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unsolved goals\nn : \u2115\nhn : 2 \u2264 n\na : Fin n \u2192 \u211d\nha : Function.Injective a\ni : Fin n\n\u22a2 0 < n", "unknown tactic", "tactic 'rewrite' failed, did not find instance of the pattern in the target expression\n nth_smallest \u22ef\nn : \u2115\nhn : 2 \u2264 n\nx a : Fin n \u2192 \u211d\nha : Function.Injective a\nthis :\n \u2200 (x a : Fin n \u2192 \u211d) (ha : Function.Injective a),\n StrictMono a \u2192 ((\u2200 (i : Fin n), \u2211 j, |a i - a j| * x j = 1) \u2194 x \u2208 solution_set_generalized hn ha)\nh_mono_a : \u00acStrictMono a\na' : Fin n \u2192 \u211d := nth_smallest ha\nha' : a' = nth_smallest ha\nx' : Fin n \u2192 \u211d := x \u2218 nth_smallest_index ha\nhx' : x' = x \u2218 nth_smallest_index ha\nh_mono_a' : StrictMono a'\nh' : (\u2200 (i : Fin n), \u2211 j, |a' i - a' j| * x' j = 1) \u2194 x' \u2208 solution_set_generalized hn \u22ef\nh_iff_left : (\u2200 (i : Fin n), \u2211 j, |a' i - a' j| * x' j = 1) \u2194 \u2200 (i : Fin n), \u2211 j, |a i - a j| * x j = 1\n\u22a2 (x' = fun i => if order a' i = \u27e80, \u22ef\u27e9 then sorry else sorry) \u2194\n x = fun i => if order a i = \u27e80, \u22ef\u27e9 then sorry else sorry", "failed to rewrite using equation theorems for 'Imo1966P5.nth_smallest'."], "timeout_s": 600.0, "latency_s": 1.2552, "verified_at": "2026-03-26T18:16:19.682575+00:00"}} | false | true | false | 1.2552 |
compfiles_Imo1967P3 | compfiles | Copyright (c) 2025 Roozbeh Yousefzadeh. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1967, Problem 3
Let $k, m, n$ be natural numbers such that m + k + 1 is a prime greater
than n + 1. Let c(s) = s * (s+1). Prove that the product
(c(m+1) - c(k)) * (c(m+2) - c(k)) * ... * (c(m+n) - c(k)) is divisible
by the product c(1) * c(2) * ... * c(n).
-/
namespace Imo1967P3
lemma aux_1
(c : ℕ → ℕ)
(h₁ : ∀ (s : ℕ), c s = s * (s + 1)) :
∀ (a b : ℕ), c a - c b = (a - b) * (a + b + 1) := by
intro a b
rw [h₁, h₁]
have h_factor : a + a^2 - (b + b^2) = (a - b) * (a + b + 1) := by rw [tsub_mul]; grind
grind
lemma aux_1_mono
(c : ℕ → ℕ)
(h₁ : ∀ (s : ℕ), c s = s * (s + 1)) :
Monotone c := by
intro a b h
simp only [h₁]
have h1 : a * (a + 1) ≤ b * (a + 1) := Nat.mul_le_mul_right _ h
have h2 : b * (a + 1) ≤ b * (b + 1) := Nat.mul_le_mul_left _ (Nat.succ_le_succ h)
exact h1.trans h2
lemma aux_2 :
∀ (n m : ℕ), 0 < n → n.factorial ∣ ∏ i ∈ Finset.Icc 1 n, (m + i) := by
intro s t _
-- Product equals ascending factorial: (t+1)(t+2)...(t+s) = (t+1).ascFactorial s
have hprod : ∏ i ∈ Finset.Icc 1 s, (t + i) = (t + 1).ascFactorial s := by
rw [Nat.ascFactorial_eq_prod_range, ← Finset.Ico_succ_right_eq_Icc, Finset.prod_Ico_eq_prod_range]
apply Finset.prod_congr rfl; intro i _; ring
rw [hprod]
exact Nat.factorial_dvd_ascFactorial (t + 1) s
lemma aux_3
(k m n : ℕ)
(h₀ : 0 < k ∧ 0 < m ∧ 0 < n)
(h₁ : Nat.Prime (k + m + 1))
(h₂ : n + 1 < k + m + 1) :
(n + 1).factorial ∣ ∏ i ∈ Finset.Icc 1 n, (m + i + k + 1) := by
have h₃: ∀ (n m : ℕ), 0 < n → n.factorial ∣ ∏ i ∈ Finset.Icc 1 n, (m + i) := by
exact fun (n m : ℕ) (a : 0 < n) ↦ aux_2 n m a
have h₄: (n + (1 : ℕ)).factorial ∣ (k + m + 1) * (∏ i ∈ Finset.Icc (1 : ℕ) n, (m + i + k + (1 : ℕ))) := by
have hn₀ : 0 < n + 1 := by exact Nat.zero_lt_succ n
have h₈₁: ∀ i, m + i + k + (1 : ℕ) = m + k + (1 : ℕ) + i := by bound
have h₈₂: (k + m + 1) * (∏ i ∈ Finset.Icc (1 : ℕ) n, (m + i + k + (1 : ℕ))) = ∏ i ∈ Finset.Ico (0 : ℕ) (n + 1), (m + i + k + (1 : ℕ)) := by
simp_rw [h₈₁]
rw [Finset.prod_eq_prod_Ico_succ_bot hn₀ (fun i ↦ m + k + (1 : ℕ) + i)]
rw [add_zero, add_comm k m]
exact rfl
simp_rw [h₈₂]
have h₈₃: ∏ i ∈ Finset.Ico (0 : ℕ) (n + (1 : ℕ)), (m + i + k + (1 : ℕ)) = ∏ i ∈ Finset.Ico (1 : ℕ) (n + 2), (m + i + k) := by
rw [Finset.prod_Ico_eq_prod_range, Finset.prod_Ico_eq_prod_range]
simp
group
have h₈₄: ∏ i ∈ Finset.Ico (1 : ℕ) (n + (2 : ℕ)), (m + i + k) = ∏ i ∈ Finset.Icc (1 : ℕ) (n + (1 : ℕ)), (m + i + k) := by rfl
rw [h₈₃, h₈₄]
have h₈₅: ∀ i, m + i + k = m + k + i := by exact fun (i : ℕ) ↦ Nat.add_right_comm m i k
simp_rw [h₈₅]
exact h₃ (n + 1) (m + k) hn₀
refine Nat.Coprime.dvd_of_dvd_mul_left ?_ h₄
refine Nat.Coprime.symm ?_
exact Nat.Prime.coprime_factorial_of_lt h₁ h₂
lemma aux_4
(k m n : ℕ)
(_ : n ≤ k - (m + 1)) :
∏ i ∈ Finset.Icc 1 n, (k - (m + i)) = (k - (m + 1)).descFactorial n := by
rw [Nat.descFactorial_eq_prod_range, ← Finset.Ico_succ_right_eq_Icc, Finset.prod_Ico_eq_prod_range]
apply Finset.prod_congr rfl; intro i _; omega
theorem imo1967_p3
(k m n : ℕ)
(c : ℕ → ℕ)
(h₀ : 0 < k ∧ 0 < m ∧ 0 < n)
(h₁ : ∀ s, c s = s * (s + 1))
(h₂ : Nat.Prime (k + m + 1))
(h₃ : n + 1 < k + m + 1) :
(∏ i ∈ Finset.Icc 1 n, (↑(c i):ℤ)) ∣ (∏ i ∈ Finset.Icc 1 n, (((c (m + i)):ℤ) - ((c k):ℤ))) := by
have h₄: ∏ i ∈ Finset.Icc 1 n, (↑(c i):ℤ) = n.factorial * (n + 1).factorial := by
norm_cast
have h₄₀ : ∀ i, c i = i * (i + 1) := by
intro i
specialize h₁ i
simpa using h₁
simp_rw [h₄₀]
refine Nat.le_induction ?_ ?_ n h₀.2.2
· simp
· simp only [Nat.succ_eq_add_one, zero_add]
intro d hd₀ hd₁
rw [Finset.prod_Icc_succ_top (by omega), hd₁]
rw [Nat.factorial_succ (d + (1 : ℕ))]
rw [← mul_assoc, mul_comm _ (d + (1 : ℕ)), ← mul_assoc]
rw [← Nat.factorial_succ]
ring_nf
rw [h₄]
by_cases hk₀: k ≤ m
· have h₅: (∏ i ∈ Finset.Icc 1 n, (((c (m + i)):ℤ) - ((c k):ℤ))) = (∏ i ∈ Finset.Icc 1 n, (m + i + k + 1)) * (∏ i ∈ Finset.Icc 1 n, (m + i - k)) := by
have h₅₁: ∏ i ∈ Finset.Icc 1 n, (((c (m + i)):ℤ) - ((c k):ℤ)) = (↑(∏ i ∈ Finset.Icc 1 n, ((c (m + i)) - (c k))):ℤ) := by
rw [@Nat.cast_prod]
refine Finset.prod_congr rfl ?_
intro x hx₀
symm
refine Nat.cast_sub ?_
have hk_le_mx : k ≤ m + x := hk₀.trans (Nat.le_add_right _ _)
exact aux_1_mono c h₁ hk_le_mx
rw [h₅₁, ← Nat.cast_mul]
norm_cast
simp_rw [aux_1 c h₁]
rw [Nat.mul_comm]
exact Finset.prod_mul_distrib
have h₇: n.factorial ∣ (∏ i ∈ Finset.Icc 1 n, (m + i - k)) := by
have h₇₀: ∀ i, m + i - k = m - k + i := by
intro i
exact Nat.sub_add_comm hk₀
simp_rw [h₇₀]
exact aux_2 n (m - k) h₀.2.2
have h₈: (n + (1 : ℕ)).factorial ∣ (∏ i ∈ Finset.Icc (1 : ℕ) n, (m + i + k + (1 : ℕ))) := by
exact aux_3 k m n h₀ h₂ h₃
rw [h₅, mul_comm]
refine Nat.cast_dvd_cast ?_
exact Nat.mul_dvd_mul h₈ h₇
· push_neg at hk₀
by_cases hk₁: k ≤ m + n
· have h₆ : ∏ i ∈ Finset.Icc (1 : ℕ) n, ((↑(c (m + i)) : ℤ) - (↑(c k) : ℤ)) = 0 := by
refine Finset.prod_eq_zero_iff.mpr ?_
use (k - m)
constructor
· refine Finset.mem_Icc.mpr ?_
omega
· grind
rw [h₆]
exact Int.dvd_zero ((↑n.factorial : ℤ) * (↑(n + (1 : ℕ)).factorial : ℤ))
· push_neg at hk₁
have h₅: ∏ i ∈ Finset.Icc (1 : ℕ) n, ((↑(c (m + i)) : ℤ) - (↑(c k) : ℤ)) =
∏ i ∈ Finset.Icc (1 : ℕ) n, (((↑(c k) : ℤ) - (↑(c (m + i)) : ℤ)) * (-1:ℤ)) := by simp
have h₆: ∏ i ∈ Finset.Icc 1 n, ((↑(c k) : ℤ) - (↑(c (m + i)) : ℤ)) = (∏ i ∈ Finset.Icc 1 n, (k - (m + i))) * (∏ i ∈ Finset.Icc 1 n, (k + (m + i) + 1)) := by
have h₅₁: ∏ i ∈ Finset.Icc 1 n, (((c k):ℤ) - ((c (m + i)):ℤ)) = (↑(∏ i ∈ Finset.Icc 1 n, (c k - c (m + i))):ℤ) := by
rw [@Nat.cast_prod]
refine Finset.prod_congr rfl ?_
simp only [Finset.mem_Icc, and_imp]
intro x hx₀ hx₁
symm
refine Nat.cast_sub ?_
-- from x ≤ n and m + n < k, we get m + x ≤ k
have hmx_le_k : m + x ≤ k := by
have hx' : m + x ≤ m + n := Nat.add_le_add_left hx₁ m
exact le_of_lt (lt_of_le_of_lt hx' hk₁)
exact aux_1_mono c h₁ hmx_le_k
rw [h₅₁, ← Nat.cast_mul]
norm_cast
simp_rw [aux_1 c h₁]
exact Finset.prod_mul_distrib
rw [h₅, Finset.prod_mul_distrib, h₆]
have h₇: (↑n.factorial : ℤ) * (↑(n + 1).factorial : ℤ) ∣
(↑(∏ i ∈ Finset.Icc 1 n, (k - (m + i))) : ℤ) * (↑(∏ i ∈ Finset.Icc 1 n, (k + (m + i) + 1)) : ℤ) := by
rw [← Nat.cast_mul, ← Nat.cast_mul]
refine Nat.cast_dvd_cast ?_
refine Nat.mul_dvd_mul ?_ ?_
· have h₇₀: n ≤ k - (m + 1) := by omega
rw [aux_4 k m n h₇₀]
exact Nat.factorial_dvd_descFactorial (k - (m + 1)) n
· have h₇₀: ∏ i ∈ Finset.Icc 1 n, (k + (m + i) + 1) = ∏ i ∈ Finset.Icc 1 n, (m + i + k + 1) := by group
rw [h₇₀]
exact aux_3 k m n h₀ h₂ h₃
exact Dvd.dvd.mul_right h₇ (∏ x ∈ Finset.Icc 1 n, -1) | /- | /-
Copyright (c) 2025 Roozbeh Yousefzadeh. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1967, Problem 3
Let $k, m, n$ be natural numbers such that m + k + 1 is a prime greater
than n + 1. Let c(s) = s * (s+1). Prove that the product
(c(m+1) - c(k)) * (c(m+2) - c(k)) * ... * (c(m+n) - c(k)) is divisible
by the product c(1) * c(2) * ... * c(n).
-/
namespace Imo1967P3
lemma aux_1
(c : ℕ → ℕ)
(h₁ : ∀ (s : ℕ), c s = s * (s + 1)) :
∀ (a b : ℕ), c a - c b = (a - b) * (a + b + 1) := by
intro a b
rw [h₁, h₁]
have h_factor : a + a^2 - (b + b^2) = (a - b) * (a + b + 1) := by rw [tsub_mul]; grind
grind
lemma aux_1_mono
(c : ℕ → ℕ)
(h₁ : ∀ (s : ℕ), c s = s * (s + 1)) :
Monotone c := by
intro a b h
simp only [h₁]
have h1 : a * (a + 1) ≤ b * (a + 1) := Nat.mul_le_mul_right _ h
have h2 : b * (a + 1) ≤ b * (b + 1) := Nat.mul_le_mul_left _ (Nat.succ_le_succ h)
exact h1.trans h2
lemma aux_2 :
∀ (n m : ℕ), 0 < n → n.factorial ∣ ∏ i ∈ Finset.Icc 1 n, (m + i) := by
intro s t _
-- Product equals ascending factorial: (t+1)(t+2)...(t+s) = (t+1).ascFactorial s
have hprod : ∏ i ∈ Finset.Icc 1 s, (t + i) = (t + 1).ascFactorial s := by
rw [Nat.ascFactorial_eq_prod_range, ← Finset.Ico_succ_right_eq_Icc, Finset.prod_Ico_eq_prod_range]
apply Finset.prod_congr rfl; intro i _; ring
rw [hprod]
exact Nat.factorial_dvd_ascFactorial (t + 1) s
lemma aux_3
(k m n : ℕ)
(h₀ : 0 < k ∧ 0 < m ∧ 0 < n)
(h₁ : Nat.Prime (k + m + 1))
(h₂ : n + 1 < k + m + 1) :
(n + 1).factorial ∣ ∏ i ∈ Finset.Icc 1 n, (m + i + k + 1) := by
have h₃: ∀ (n m : ℕ), 0 < n → n.factorial ∣ ∏ i ∈ Finset.Icc 1 n, (m + i) := by
exact fun (n m : ℕ) (a : 0 < n) ↦ aux_2 n m a
have h₄: (n + (1 : ℕ)).factorial ∣ (k + m + 1) * (∏ i ∈ Finset.Icc (1 : ℕ) n, (m + i + k + (1 : ℕ))) := by
have hn₀ : 0 < n + 1 := by exact Nat.zero_lt_succ n
have h₈₁: ∀ i, m + i + k + (1 : ℕ) = m + k + (1 : ℕ) + i := by bound
have h₈₂: (k + m + 1) * (∏ i ∈ Finset.Icc (1 : ℕ) n, (m + i + k + (1 : ℕ))) = ∏ i ∈ Finset.Ico (0 : ℕ) (n + 1), (m + i + k + (1 : ℕ)) := by
simp_rw [h₈₁]
rw [Finset.prod_eq_prod_Ico_succ_bot hn₀ (fun i ↦ m + k + (1 : ℕ) + i)]
rw [add_zero, add_comm k m]
exact rfl
simp_rw [h₈₂]
have h₈₃: ∏ i ∈ Finset.Ico (0 : ℕ) (n + (1 : ℕ)), (m + i + k + (1 : ℕ)) = ∏ i ∈ Finset.Ico (1 : ℕ) (n + 2), (m + i + k) := by
rw [Finset.prod_Ico_eq_prod_range, Finset.prod_Ico_eq_prod_range]
simp
group
have h₈₄: ∏ i ∈ Finset.Ico (1 : ℕ) (n + (2 : ℕ)), (m + i + k) = ∏ i ∈ Finset.Icc (1 : ℕ) (n + (1 : ℕ)), (m + i + k) := by rfl
rw [h₈₃, h₈₄]
have h₈₅: ∀ i, m + i + k = m + k + i := by exact fun (i : ℕ) ↦ Nat.add_right_comm m i k
simp_rw [h₈₅]
exact h₃ (n + 1) (m + k) hn₀
refine Nat.Coprime.dvd_of_dvd_mul_left ?_ h₄
refine Nat.Coprime.symm ?_
exact Nat.Prime.coprime_factorial_of_lt h₁ h₂
lemma aux_4
(k m n : ℕ)
(_ : n ≤ k - (m + 1)) :
∏ i ∈ Finset.Icc 1 n, (k - (m + i)) = (k - (m + 1)).descFactorial n := by
rw [Nat.descFactorial_eq_prod_range, ← Finset.Ico_succ_right_eq_Icc, Finset.prod_Ico_eq_prod_range]
apply Finset.prod_congr rfl; intro i _; omega
theorem imo1967_p3
(k m n : ℕ)
(c : ℕ → ℕ)
(h₀ : 0 < k ∧ 0 < m ∧ 0 < n)
(h₁ : ∀ s, c s = s * (s + 1))
(h₂ : Nat.Prime (k + m + 1))
(h₃ : n + 1 < k + m + 1) :
(∏ i ∈ Finset.Icc 1 n, (↑(c i):ℤ)) ∣ (∏ i ∈ Finset.Icc 1 n, (((c (m + i)):ℤ) - ((c k):ℤ))) := by
have h₄: ∏ i ∈ Finset.Icc 1 n, (↑(c i):ℤ) = n.factorial * (n + 1).factorial := by
norm_cast
have h₄₀ : ∀ i, c i = i * (i + 1) := by
intro i
specialize h₁ i
simpa using h₁
simp_rw [h₄₀]
refine Nat.le_induction ?_ ?_ n h₀.2.2
· simp
· simp only [Nat.succ_eq_add_one, zero_add]
intro d hd₀ hd₁
rw [Finset.prod_Icc_succ_top (by omega), hd₁]
rw [Nat.factorial_succ (d + (1 : ℕ))]
rw [← mul_assoc, mul_comm _ (d + (1 : ℕ)), ← mul_assoc]
rw [← Nat.factorial_succ]
ring_nf
rw [h₄]
by_cases hk₀: k ≤ m
· have h₅: (∏ i ∈ Finset.Icc 1 n, (((c (m + i)):ℤ) - ((c k):ℤ))) = (∏ i ∈ Finset.Icc 1 n, (m + i + k + 1)) * (∏ i ∈ Finset.Icc 1 n, (m + i - k)) := by
have h₅₁: ∏ i ∈ Finset.Icc 1 n, (((c (m + i)):ℤ) - ((c k):ℤ)) = (↑(∏ i ∈ Finset.Icc 1 n, ((c (m + i)) - (c k))):ℤ) := by
rw [@Nat.cast_prod]
refine Finset.prod_congr rfl ?_
intro x hx₀
symm
refine Nat.cast_sub ?_
have hk_le_mx : k ≤ m + x := hk₀.trans (Nat.le_add_right _ _)
exact aux_1_mono c h₁ hk_le_mx
rw [h₅₁, ← Nat.cast_mul]
norm_cast
simp_rw [aux_1 c h₁]
rw [Nat.mul_comm]
exact Finset.prod_mul_distrib
have h₇: n.factorial ∣ (∏ i ∈ Finset.Icc 1 n, (m + i - k)) := by
have h₇₀: ∀ i, m + i - k = m - k + i := by
intro i
exact Nat.sub_add_comm hk₀
simp_rw [h₇₀]
exact aux_2 n (m - k) h₀.2.2
have h₈: (n + (1 : ℕ)).factorial ∣ (∏ i ∈ Finset.Icc (1 : ℕ) n, (m + i + k + (1 : ℕ))) := by
exact aux_3 k m n h₀ h₂ h₃
rw [h₅, mul_comm]
refine Nat.cast_dvd_cast ?_
exact Nat.mul_dvd_mul h₈ h₇
· push_neg at hk₀
by_cases hk₁: k ≤ m + n
· have h₆ : ∏ i ∈ Finset.Icc (1 : ℕ) n, ((↑(c (m + i)) : ℤ) - (↑(c k) : ℤ)) = 0 := by
refine Finset.prod_eq_zero_iff.mpr ?_
use (k - m)
constructor
· refine Finset.mem_Icc.mpr ?_
omega
· grind
rw [h₆]
exact Int.dvd_zero ((↑n.factorial : ℤ) * (↑(n + (1 : ℕ)).factorial : ℤ))
· push_neg at hk₁
have h₅: ∏ i ∈ Finset.Icc (1 : ℕ) n, ((↑(c (m + i)) : ℤ) - (↑(c k) : ℤ)) =
∏ i ∈ Finset.Icc (1 : ℕ) n, (((↑(c k) : ℤ) - (↑(c (m + i)) : ℤ)) * (-1:ℤ)) := by simp
have h₆: ∏ i ∈ Finset.Icc 1 n, ((↑(c k) : ℤ) - (↑(c (m + i)) : ℤ)) = (∏ i ∈ Finset.Icc 1 n, (k - (m + i))) * (∏ i ∈ Finset.Icc 1 n, (k + (m + i) + 1)) := by
have h₅₁: ∏ i ∈ Finset.Icc 1 n, (((c k):ℤ) - ((c (m + i)):ℤ)) = (↑(∏ i ∈ Finset.Icc 1 n, (c k - c (m + i))):ℤ) := by
rw [@Nat.cast_prod]
refine Finset.prod_congr rfl ?_
simp only [Finset.mem_Icc, and_imp]
intro x hx₀ hx₁
symm
refine Nat.cast_sub ?_
-- from x ≤ n and m + n < k, we get m + x ≤ k
have hmx_le_k : m + x ≤ k := by
have hx' : m + x ≤ m + n := Nat.add_le_add_left hx₁ m
exact le_of_lt (lt_of_le_of_lt hx' hk₁)
exact aux_1_mono c h₁ hmx_le_k
rw [h₅₁, ← Nat.cast_mul]
norm_cast
simp_rw [aux_1 c h₁]
exact Finset.prod_mul_distrib
rw [h₅, Finset.prod_mul_distrib, h₆]
have h₇: (↑n.factorial : ℤ) * (↑(n + 1).factorial : ℤ) ∣
(↑(∏ i ∈ Finset.Icc 1 n, (k - (m + i))) : ℤ) * (↑(∏ i ∈ Finset.Icc 1 n, (k + (m + i) + 1)) : ℤ) := by
rw [← Nat.cast_mul, ← Nat.cast_mul]
refine Nat.cast_dvd_cast ?_
refine Nat.mul_dvd_mul ?_ ?_
· have h₇₀: n ≤ k - (m + 1) := by omega
rw [aux_4 k m n h₇₀]
exact Nat.factorial_dvd_descFactorial (k - (m + 1)) n
· have h₇₀: ∏ i ∈ Finset.Icc 1 n, (k + (m + i) + 1) = ∏ i ∈ Finset.Icc 1 n, (m + i + k + 1) := by group
rw [h₇₀]
exact aux_3 k m n h₀ h₂ h₃
exact Dvd.dvd.mul_right h₇ (∏ x ∈ Finset.Icc 1 n, -1)
| true | Copyright (c) 2025 Roozbeh Yousefzadeh. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1967, Problem 3
Let $k, m, n$ be natural numbers such that m + k + 1 is a prime greater
than n + 1. Let c(s) = s * (s+1). Prove that the product
(c(m+1) - c(k)) * (c(m+2) - c(k)) * ... * (c(m+n) - c(k)) is divisible
by the product c(1) * c(2) * ... * c(n).
-/
namespace Imo1967P3
lemma aux_1
(c : ℕ → ℕ)
(h₁ : ∀ (s : ℕ), c s = s * (s + 1)) :
∀ (a b : ℕ), c a - c b = (a - b) * (a + b + 1) := by
intro a b
rw [h₁, h₁]
have h_factor : a + a^2 - (b + b^2) = (a - b) * (a + b + 1) := by rw [tsub_mul]; grind
grind
lemma aux_1_mono
(c : ℕ → ℕ)
(h₁ : ∀ (s : ℕ), c s = s * (s + 1)) :
Monotone c := by
intro a b h
simp only [h₁]
have h1 : a * (a + 1) ≤ b * (a + 1) := Nat.mul_le_mul_right _ h
have h2 : b * (a + 1) ≤ b * (b + 1) := Nat.mul_le_mul_left _ (Nat.succ_le_succ h)
exact h1.trans h2
lemma aux_2 :
∀ (n m : ℕ), 0 < n → n.factorial ∣ ∏ i ∈ Finset.Icc 1 n, (m + i) := by
intro s t _
-- Product equals ascending factorial: (t+1)(t+2)...(t+s) = (t+1).ascFactorial s
have hprod : ∏ i ∈ Finset.Icc 1 s, (t + i) = (t + 1).ascFactorial s := by
rw [Nat.ascFactorial_eq_prod_range, ← Finset.Ico_succ_right_eq_Icc, Finset.prod_Ico_eq_prod_range]
apply Finset.prod_congr rfl; intro i _; ring
rw [hprod]
exact Nat.factorial_dvd_ascFactorial (t + 1) s
lemma aux_3
(k m n : ℕ)
(h₀ : 0 < k ∧ 0 < m ∧ 0 < n)
(h₁ : Nat.Prime (k + m + 1))
(h₂ : n + 1 < k + m + 1) :
(n + 1).factorial ∣ ∏ i ∈ Finset.Icc 1 n, (m + i + k + 1) := by
have h₃: ∀ (n m : ℕ), 0 < n → n.factorial ∣ ∏ i ∈ Finset.Icc 1 n, (m + i) := by
exact fun (n m : ℕ) (a : 0 < n) ↦ aux_2 n m a
have h₄: (n + (1 : ℕ)).factorial ∣ (k + m + 1) * (∏ i ∈ Finset.Icc (1 : ℕ) n, (m + i + k + (1 : ℕ))) := by
have hn₀ : 0 < n + 1 := by exact Nat.zero_lt_succ n
have h₈₁: ∀ i, m + i + k + (1 : ℕ) = m + k + (1 : ℕ) + i := by bound
have h₈₂: (k + m + 1) * (∏ i ∈ Finset.Icc (1 : ℕ) n, (m + i + k + (1 : ℕ))) = ∏ i ∈ Finset.Ico (0 : ℕ) (n + 1), (m + i + k + (1 : ℕ)) := by
simp_rw [h₈₁]
rw [Finset.prod_eq_prod_Ico_succ_bot hn₀ (fun i ↦ m + k + (1 : ℕ) + i)]
rw [add_zero, add_comm k m]
exact rfl
simp_rw [h₈₂]
have h₈₃: ∏ i ∈ Finset.Ico (0 : ℕ) (n + (1 : ℕ)), (m + i + k + (1 : ℕ)) = ∏ i ∈ Finset.Ico (1 : ℕ) (n + 2), (m + i + k) := by
rw [Finset.prod_Ico_eq_prod_range, Finset.prod_Ico_eq_prod_range]
simp
group
have h₈₄: ∏ i ∈ Finset.Ico (1 : ℕ) (n + (2 : ℕ)), (m + i + k) = ∏ i ∈ Finset.Icc (1 : ℕ) (n + (1 : ℕ)), (m + i + k) := by rfl
rw [h₈₃, h₈₄]
have h₈₅: ∀ i, m + i + k = m + k + i := by exact fun (i : ℕ) ↦ Nat.add_right_comm m i k
simp_rw [h₈₅]
exact h₃ (n + 1) (m + k) hn₀
refine Nat.Coprime.dvd_of_dvd_mul_left ?_ h₄
refine Nat.Coprime.symm ?_
exact Nat.Prime.coprime_factorial_of_lt h₁ h₂
lemma aux_4
(k m n : ℕ)
(_ : n ≤ k - (m + 1)) :
∏ i ∈ Finset.Icc 1 n, (k - (m + i)) = (k - (m + 1)).descFactorial n := by
rw [Nat.descFactorial_eq_prod_range, ← Finset.Ico_succ_right_eq_Icc, Finset.prod_Ico_eq_prod_range]
apply Finset.prod_congr rfl; intro i _; omega
theorem imo1967_p3
(k m n : ℕ)
(c : ℕ → ℕ)
(h₀ : 0 < k ∧ 0 < m ∧ 0 < n)
(h₁ : ∀ s, c s = s * (s + 1))
(h₂ : Nat.Prime (k + m + 1))
(h₃ : n + 1 < k + m + 1) :
(∏ i ∈ Finset.Icc 1 n, (↑(c i):ℤ)) ∣ (∏ i ∈ Finset.Icc 1 n, (((c (m + i)):ℤ) - ((c k):ℤ))) := by
have h₄: ∏ i ∈ Finset.Icc 1 n, (↑(c i):ℤ) = n.factorial * (n + 1).factorial := by
norm_cast
have h₄₀ : ∀ i, c i = i * (i + 1) := by
intro i
specialize h₁ i
simpa using h₁
simp_rw [h₄₀]
refine Nat.le_induction ?_ ?_ n h₀.2.2
· simp
· simp only [Nat.succ_eq_add_one, zero_add]
intro d hd₀ hd₁
rw [Finset.prod_Icc_succ_top (by omega), hd₁]
rw [Nat.factorial_succ (d + (1 : ℕ))]
rw [← mul_assoc, mul_comm _ (d + (1 : ℕ)), ← mul_assoc]
rw [← Nat.factorial_succ]
ring_nf
rw [h₄]
by_cases hk₀: k ≤ m
· have h₅: (∏ i ∈ Finset.Icc 1 n, (((c (m + i)):ℤ) - ((c k):ℤ))) = (∏ i ∈ Finset.Icc 1 n, (m + i + k + 1)) * (∏ i ∈ Finset.Icc 1 n, (m + i - k)) := by
have h₅₁: ∏ i ∈ Finset.Icc 1 n, (((c (m + i)):ℤ) - ((c k):ℤ)) = (↑(∏ i ∈ Finset.Icc 1 n, ((c (m + i)) - (c k))):ℤ) := by
rw [@Nat.cast_prod]
refine Finset.prod_congr rfl ?_
intro x hx₀
symm
refine Nat.cast_sub ?_
have hk_le_mx : k ≤ m + x := hk₀.trans (Nat.le_add_right _ _)
exact aux_1_mono c h₁ hk_le_mx
rw [h₅₁, ← Nat.cast_mul]
norm_cast
simp_rw [aux_1 c h₁]
rw [Nat.mul_comm]
exact Finset.prod_mul_distrib
have h₇: n.factorial ∣ (∏ i ∈ Finset.Icc 1 n, (m + i - k)) := by
have h₇₀: ∀ i, m + i - k = m - k + i := by
intro i
exact Nat.sub_add_comm hk₀
simp_rw [h₇₀]
exact aux_2 n (m - k) h₀.2.2
have h₈: (n + (1 : ℕ)).factorial ∣ (∏ i ∈ Finset.Icc (1 : ℕ) n, (m + i + k + (1 : ℕ))) := by
exact aux_3 k m n h₀ h₂ h₃
rw [h₅, mul_comm]
refine Nat.cast_dvd_cast ?_
exact Nat.mul_dvd_mul h₈ h₇
· push_neg at hk₀
by_cases hk₁: k ≤ m + n
· have h₆ : ∏ i ∈ Finset.Icc (1 : ℕ) n, ((↑(c (m + i)) : ℤ) - (↑(c k) : ℤ)) = 0 := by
refine Finset.prod_eq_zero_iff.mpr ?_
use (k - m)
constructor
· refine Finset.mem_Icc.mpr ?_
omega
· grind
rw [h₆]
exact Int.dvd_zero ((↑n.factorial : ℤ) * (↑(n + (1 : ℕ)).factorial : ℤ))
· push_neg at hk₁
have h₅: ∏ i ∈ Finset.Icc (1 : ℕ) n, ((↑(c (m + i)) : ℤ) - (↑(c k) : ℤ)) =
∏ i ∈ Finset.Icc (1 : ℕ) n, (((↑(c k) : ℤ) - (↑(c (m + i)) : ℤ)) * (-1:ℤ)) := by simp
have h₆: ∏ i ∈ Finset.Icc 1 n, ((↑(c k) : ℤ) - (↑(c (m + i)) : ℤ)) = (∏ i ∈ Finset.Icc 1 n, (k - (m + i))) * (∏ i ∈ Finset.Icc 1 n, (k + (m + i) + 1)) := by
have h₅₁: ∏ i ∈ Finset.Icc 1 n, (((c k):ℤ) - ((c (m + i)):ℤ)) = (↑(∏ i ∈ Finset.Icc 1 n, (c k - c (m + i))):ℤ) := by
rw [@Nat.cast_prod]
refine Finset.prod_congr rfl ?_
simp only [Finset.mem_Icc, and_imp]
intro x hx₀ hx₁
symm
refine Nat.cast_sub ?_
-- from x ≤ n and m + n < k, we get m + x ≤ k
have hmx_le_k : m + x ≤ k := by
have hx' : m + x ≤ m + n := Nat.add_le_add_left hx₁ m
exact le_of_lt (lt_of_le_of_lt hx' hk₁)
exact aux_1_mono c h₁ hmx_le_k
rw [h₅₁, ← Nat.cast_mul]
norm_cast
simp_rw [aux_1 c h₁]
exact Finset.prod_mul_distrib
rw [h₅, Finset.prod_mul_distrib, h₆]
have h₇: (↑n.factorial : ℤ) * (↑(n + 1).factorial : ℤ) ∣
(↑(∏ i ∈ Finset.Icc 1 n, (k - (m + i))) : ℤ) * (↑(∏ i ∈ Finset.Icc 1 n, (k + (m + i) + 1)) : ℤ) := by
rw [← Nat.cast_mul, ← Nat.cast_mul]
refine Nat.cast_dvd_cast ?_
refine Nat.mul_dvd_mul ?_ ?_
· have h₇₀: n ≤ k - (m + 1) := by omega
rw [aux_4 k m n h₇₀]
exact Nat.factorial_dvd_descFactorial (k - (m + 1)) n
· have h₇₀: ∏ i ∈ Finset.Icc 1 n, (k + (m + i) + 1) = ∏ i ∈ Finset.Icc 1 n, (m + i + k + 1) := by group
rw [h₇₀]
exact aux_3 k m n h₀ h₂ h₃
exact Dvd.dvd.mul_right h₇ (∏ x ∈ Finset.Icc 1 n, -1) | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1967P3.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["`grind` failed\ncase grind.1.1.2\nc : \u2115 \u2192 \u2115\nh\u2081 : \u2200 (s : \u2115), c s = s * (s + 1)\na b : \u2115\nh : \u00aca + a ^ 2 - (b + b ^ 2) = a * (a + b + 1) - b * (a + b + 1)\nh_1 : -1 * \u2191a + \u2191b + -1 * \u2191(a ^ 2) + \u2191(b ^ 2) \u2264 0\nh_2 : -1 * (\u2191a * (\u2191a + \u2191b + 1)) + \u2191b * (\u2191a + \u2191b + 1) \u2264 0\nh_3 : \u00aca = b\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] \u2200 (s : \u2115), c s = s * (s + 1)\n [prop] \u00aca + a ^ 2 - (b + b ^ 2) = a * (a + b + 1) - b * (a + b + 1)\n [prop] \u2191(a * (a + b + 1) - b * (a + b + 1)) =\n if -1 * (\u2191a * (\u2191a + \u2191b + 1)) + \u2191b * (\u2191a + \u2191b + 1) \u2264 0 then \u2191a * (\u2191a + \u2191b + 1) + -1 * (\u2191b * (\u2191a + \u2191b + 1))\n else 0\n [prop] \u2191(a + a ^ 2 - (b + b ^ 2)) =\n if -1 * \u2191a + \u2191b + -1 * \u2191(a ^ 2) + \u2191(b ^ 2) \u2264 0 then \u2191a + -1 * \u2191b + \u2191(a ^ 2) + -1 * \u2191(b ^ 2) else 0\n [prop] -1 * \u2191a + \u2191b + -1 * \u2191(a ^ 2) + \u2191(b ^ 2) \u2264 0\n [prop] -1 * (\u2191a * (\u2191a + \u2191b + 1)) + \u2191b * (\u2191a + \u2191b + 1) \u2264 0\n [prop] \u00aca = b\n [eqc] True propositions\n [prop] \u2200 (s : \u2115), c s = s * (s + 1)\n [prop] -1 * \u2191a + \u2191b + -1 * \u2191(a ^ 2) + \u2191(b ^ 2) \u2264 0\n [prop] -1 * (\u2191a * (\u2191a + \u2191b + 1)) + \u2191b * (\u2191a + \u2191b + 1) \u2264 0\n [eqc] False propositions\n [prop] a + a ^ 2 - (b + b ^ 2) = a * (a + b + 1) - b * (a + b + 1)\n [prop] a = b\n [eqc] Equivalence classes\n [eqc] {\u2191(a + a ^ 2 - (b + b ^ 2)),\n \u2191a + -1 * \u2191b + \u2191(a ^ 2) + -1 * \u2191(b ^ 2),\n if -1 * \u2191a + \u2191b + -1 * \u2191(a ^ 2) + \u2191(b ^ 2) \u2264 0 then \u2191a + -1 * \u2191b + \u2191(a ^ 2) + -1 * \u2191(b ^ 2) else 0}\n [eqc] {\u2191(a * (a + b + 1) - b * (a + b + 1)),\n \u2191a * (\u2191a + \u2191b + 1) + -1 * (\u2191b * (\u2191a + \u2191b + 1)),\n if -1 * (\u2191a * (\u2191a + \u2191b + 1)) + \u2191b * (\u2191a + \u2191b + 1) \u2264 0 then \u2191a * (\u2191a + \u2191b + 1) + -1 * (\u2191b * (\u2191a + \u2191b + 1))\n else 0}\n [cases] Case analyses\n [cases] [1/2]: if -1 * \u2191a + \u2191b + -1 * \u2191(a ^ 2) + \u2191(b ^ 2) \u2264 0 then \u2191a + -1 * \u2191b + \u2191(a ^ 2) + -1 * \u2191(b ^ 2) else 0\n [cases] [1/2]: if -1 * (\u2191a * (\u2191a + \u2191b + 1)) + \u2191b * (\u2191a + \u2191b + 1) \u2264 0 then\n \u2191a * (\u2191a + \u2191b + 1) + -1 * (\u2191b * (\u2191a + \u2191b + 1))\n else 0\n [cases] [2/2]: a = b\n [ematch] E-matching patterns\n [thm] h\u2081: [c #0]\n [thm] h\u2081: [c #0]\n [cutsat] Assignment satisfying linear constraints\n [assign] a := 0\n [assign] b := 1\n [assign] \u300ca ^ 2\u300d := 1\n [assign] \u300cb ^ 2\u300d := 0", "`grind` failed\ncase grind.1.1.1.2\nc : \u2115 \u2192 \u2115\nh\u2081 : \u2200 (s : \u2115), c s = s * (s + 1)\na b : \u2115\nh_factor : a + a ^ 2 - (b + b ^ 2) = (a - b) * (a + b + 1)\nh : \u00aca * (a + 1) - b * (b + 1) = (a - b) * (a + b + 1)\nh_1 : -1 * (\u2191a * (\u2191a + 1)) + \u2191b * (\u2191b + 1) \u2264 0\nh_2 : -1 * \u2191a + \u2191b + -1 * \u2191(a ^ 2) + \u2191(b ^ 2) \u2264 0\nh_3 : -1 * \u2191a + \u2191b \u2264 0\nh_4 : \u00aca = b\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] \u2200 (s : \u2115), c s = s * (s + 1)\n [prop] a + a ^ 2 - (b + b ^ 2) = (a - b) * (a + b + 1)\n [prop] \u2191(a - b) = if -1 * \u2191a + \u2191b \u2264 0 then \u2191a + -1 * \u2191b else 0\n [prop] \u2191(a + a ^ 2 - (b + b ^ 2)) =\n if -1 * \u2191a + \u2191b + -1 * \u2191(a ^ 2) + \u2191(b ^ 2) \u2264 0 then \u2191a + -1 * \u2191b + \u2191(a ^ 2) + -1 * \u2191(b ^ 2) else 0\n [prop] \u00aca * (a + 1) - b * (b + 1) = (a - b) * (a + b + 1)\n [prop] \u2191(a * (a + 1) - b * (b + 1)) =\n if -1 * (\u2191a * (\u2191a + 1)) + \u2191b * (\u2191b + 1) \u2264 0 then \u2191a * (\u2191a + 1) + -1 * (\u2191b * (\u2191b + 1)) else 0\n [prop] -1 * (\u2191a * (\u2191a + 1)) + \u2191b * (\u2191b + 1) \u2264 0\n [prop] -1 * \u2191a + \u2191b + -1 * \u2191(a ^ 2) + \u2191(b ^ 2) \u2264 0\n [prop] -1 * \u2191a + \u2191b \u2264 0\n [prop] \u00aca = b\n [eqc] True propositions\n [prop] \u2200 (s : \u2115), c s = s * (s + 1)\n [prop] -1 * (\u2191a * (\u2191a + 1)) + \u2191b * (\u2191b + 1) \u2264 0\n [prop] -1 * \u2191a + \u2191b + -1 * \u2191(a ^ 2) + \u2191(b ^ 2) \u2264 0\n [prop] -1 * \u2191a + \u2191b \u2264 0\n [eqc] False propositions\n [prop] a * (a + 1) - b * (b + 1) = (a - b) * (a + b + 1)\n [prop] a = b\n [eqc] Equivalence classes\n [eqc] {\u2191(a * (a + 1) - b * (b + 1)),\n \u2191a * (\u2191a + 1) + -1 * (\u2191b * (\u2191b + 1)),\n if -1 * (\u2191a * (\u2191a + 1)) + \u2191b * (\u2191b + 1) \u2264 0 then \u2191a * (\u2191a + 1) + -1 * (\u2191b * (\u2191b + 1)) else 0}\n [eqc] {\u2191(a - b), \u2191a + -1 * \u2191b, if -1 * \u2191a + \u2191b \u2264 0 then \u2191a + -1 * \u2191b else 0}\n [eqc] {\u2191(a + a ^ 2 - (b + b ^ 2)),\n if -1 * \u2191a + \u2191b + -1 * \u2191(a ^ 2) + \u2191(b ^ 2) \u2264 0 then \u2191a + -1 * \u2191b + \u2191(a ^ 2) + -1 * \u2191(b ^ 2) else 0,\n \u2191a + -1 * \u2191b + \u2191(a ^ 2) + -1 * \u2191(b ^ 2),\n \u2191((a - b) * (a + b + 1))}\n [eqc] {a + a ^ 2 - (b + b ^ 2), (a - b) * (a + b + 1)}\n [cases] Case analyses\n [cases] [1/2]: if -1 * (\u2191a * (\u2191a + 1)) + \u2191b * (\u2191b + 1) \u2264 0 then \u2191a * (\u2191a + 1) + -1 * (\u2191b * (\u2191b + 1)) else 0\n [cases] [1/2]: if -1 * \u2191a + \u2191b + -1 * \u2191(a ^ 2) + \u2191(b ^ 2) \u2264 0 then \u2191a + -1 * \u2191b + \u2191(a ^ 2) + -1 * \u2191(b ^ 2) else 0\n [cases] [1/2]: if -1 * \u2191a + \u2191b \u2264 0 then \u2191a + -1 * \u2191b else 0\n [cases] [2/2]: a = b\n [ematch] E-matching patterns\n [thm] h\u2081: [c #0]\n [thm] h\u2081: [c #0]\n [cutsat] Assignment satisfying linear constraints\n [assign] a := 1\n [assign] b := 0\n [assign] \u300ca ^ 2\u300d := 0\n [assign] \u300cb ^ 2\u300d := 0", "unknown constant 'Nat.Prime.coprime_factorial_of_lt'", "unknown tactic", "unsolved goals\nk m n : \u2115\nx\u271d : n \u2264 k - (m + 1)\ni : \u2115\na\u271d : i \u2208 Finset.range (Order.succ n - 1)\n\u22a2 k - (m + (1 + i)) = k - (m + 1) - i", "unknown tactic", "unsolved goals\nk m n : \u2115\nc : \u2115 \u2192 \u2115\nh\u2080 : 0 < k \u2227 0 < m \u2227 0 < n\nh\u2081 : \u2200 (s : \u2115), c s = s * (s + 1)\nh\u2082 : Nat.Prime (k + m + 1)\nh\u2083 : n + 1 < k + m + 1\nh\u2084\u2080 : \u2200 (i : \u2115), c i = i * (i + 1)\nd : \u2115\nhd\u2080 : 1 \u2264 d\nhd\u2081 : \u220f x \u2208 Finset.Icc 1 d, x * (x + 1) = d.factorial * (d + 1).factorial\n\u22a2 1 \u2264 d + 1", "unsolved goals\ncase refine_2\nk m n : \u2115\nc : \u2115 \u2192 \u2115\nh\u2080 : 0 < k \u2227 0 < m \u2227 0 < n\nh\u2081 : \u2200 (s : \u2115), c s = s * (s + 1)\nh\u2082 : Nat.Prime (k + m + 1)\nh\u2083 : n + 1 < k + m + 1\nh\u2084\u2080 : \u2200 (i : \u2115), c i = i * (i + 1)\nd : \u2115\nhd\u2080 : 1 \u2264 d\nhd\u2081 : \u220f x \u2208 Finset.Icc 1 d, x * (x + 1) = d.factorial * (d + 1).factorial\n\u22a2 (\u220f k \u2208 Finset.Icc 1 d, k * (k + 1)) * ((d + 1) * (d + 1 + 1)) = (d + 1).factorial * (d + 1 + 1).factorial", "unsolved goals\nk m n : \u2115\nc : \u2115 \u2192 \u2115\nh\u2080 : 0 < k \u2227 0 < m \u2227 0 < n\nh\u2081 : \u2200 (s : \u2115), c s = s * (s + 1)\nh\u2082 : Nat.Prime (k + m + 1)\nh\u2083 : n + 1 < k + m + 1\nh\u2084 : \u220f i \u2208 Finset.Icc 1 n, \u2191(c i) = \u2191n.factorial * \u2191(n + 1).factorial\n\u22a2 \u220f i \u2208 Finset.Icc 1 n, \u2191(c i) \u2223 \u220f i \u2208 Finset.Icc 1 n, (\u2191(c (m + i)) - \u2191(c k))"], "timeout_s": 600.0, "latency_s": 1.4826, "verified_at": "2026-03-26T18:16:19.910454+00:00"}} | false | true | false | 1.4826 |
compfiles_Imo1967P5 | compfiles | Copyright (c) 2025 The Compfiles Authors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Rydh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1967, Problem 5
Consider the sequence {cₙ}, where
c₁ = a₁ + a₂ + ... + a₈
c₂ = a₁² + a₂² + ... + a₈²
...
cₙ = a₁ⁿ + a₂ⁿ + ... + a₈ⁿ
in which a₁, a₂, ..., a₈ are real numbers not all
equal to zero. Suppose that an infinite number of terms
of the sequence {cₙ} are equal to zero. Find all natural
numbers n such that cₙ = 0.
-/
namespace Imo1967P5
abbrev solution : (Fin 8 → ℝ) → Set ℕ := fun _ => { n | Odd n }
lemma odd_if_sum_eq_zero {α : Type*} {n : ℕ}
(I : Finset α)
(f : α → ℝ)
(h : ∃ α ∈ I, f α ≠ 0)
: ∑ i ∈ I, f i^n = 0 → Odd n := by
intro h2
obtain ⟨m, hm, hm2⟩ := h
by_contra! h_not_odd
have h_even := Nat.not_odd_iff_even.mp h_not_odd
have h_pos : 0 < ∑ i ∈ I, f i^n := by calc
0 < f m^n := Even.pow_pos h_even hm2
_ ≤ ∑ i ∈ I, f i^n := Finset.single_le_sum (fun i a ↦ Even.pow_nonneg h_even (f i)) hm
simp [h2] at h_pos
lemma aux_recursive (I : Finset (Fin 8)) (a : Fin 8 → ℝ)
(h₁ : Set.Infinite {n | ∑ i ∈ I, a i ^ n = 0})
(h₂ : ∃ i ∈ I, a i ≠ 0) :
∀ n, Odd n → ∑ i ∈ I, a i ^ n = 0 := by
by_cases! h_empty_I : I = ∅
· subst h_empty_I
intro _ _
rfl
· obtain ⟨imax⟩ := Finset.exists_max_image I (fun i ↦ |a i|) h_empty_I
let amax := |a imax|
have h_pos_amax : 0 < amax := by grind
-- Split the index set into those having the max absolute value (J) and those that do not (K)
let J := I.filter (fun i ↦ amax ≤ |a i|)
let K := I.filter (fun i ↦ |a i| < amax)
-- Sum over I can be split over K and J
have h_sum_union_eq_sum_disj : ∀ n, ∑ i ∈ I, a i^n = (∑ k ∈ K, a k^ n) + (∑ j ∈ J, a j ^ n) := by
intro n
have h_disj : Disjoint K J := by
apply Finset.disjoint_left.mpr
intro x hk hj
grind only [= Finset.mem_filter]
have : K ∪ J = I := by grind only [= Finset.mem_union, = Finset.mem_filter]
rw [← this]
exact Finset.sum_union h_disj
-- This is the core of the actual IMO theorem
-- We prove that for large N, the sum over J is large compared to the sum over K
-- From that we deduce that the sum over J must be zero for odd n, otherwise
-- the sum over I cannot be zero. We then use this to reduce the theorem to K
-- and apply the lemma recursively.
have h_sum_J_eq_zero_of_odd : ∀ n, Odd n → ∑ j ∈ J, a j ^ n = 0 := by
-- Prepare bound q for the terms in K
have hq : ∃ q : ℝ, 0 ≤ q ∧ q < amax ∧ ∀ k ∈ K, |a k| ≤ q := by
by_cases! h_empty_K : K = ∅
· use 0
grind
obtain ⟨kmax, h_kmax, _⟩ := Finset.exists_max_image K (fun k ↦ |a k|) h_empty_K
use |a kmax|
constructor
· exact abs_nonneg (a kmax)
constructor
· exact (Finset.mem_filter.mp h_kmax).2
trivial
obtain ⟨q, h_pos_q, h_q_lt_amax, h_ak_le_q⟩ := hq
-- Show that for large n, the bound for sum over K is small compared to amax^n
have h_eventually_dominated : ∀ᶠ n in Filter.atTop, 8 * q^n < amax^n := by
rw [Filter.eventually_atTop]
by_cases! h_case : q = 0
· use 1
intro N h_pos_N
simp [h_case, zero_pow (Nat.ne_zero_of_lt h_pos_N), pow_pos h_pos_amax N]
· have h_pos_q : 0 < q := Std.lt_of_le_of_ne h_pos_q (Ne.symm h_case)
have h_ratio_pos : 1 < amax / q := (one_lt_div₀ h_pos_q).mpr h_q_lt_amax
have := (tendsto_pow_atTop_atTop_of_one_lt h_ratio_pos).eventually_gt_atTop 8
obtain ⟨N, hlt⟩ := this.exists
use N
intro M h_M_ge_N
calc
8 * q^M < (amax / q)^N * q^M := by
apply mul_lt_mul_of_pos_right hlt
exact pow_pos h_pos_q M
_ ≤ (amax / q)^M * q^M := by
have : (amax / q)^N ≤ (amax / q)^M := (pow_le_pow_iff_right₀ h_ratio_pos).mpr h_M_ge_N
aesop
_ = amax^M := by
rw [← mul_pow]
congr
field_simp
-- Finally we are ready to obtain N where the sum over I is zero and the sum over K is small
have h_freq := Nat.frequently_atTop_iff_infinite.mpr h₁
obtain ⟨N, h_sum_I_pow_N_zero, h_bounds⟩ := (Filter.Frequently.and_eventually h_freq h_eventually_dominated).exists
-- N is odd since the sum over I is zero
have h_odd_N : Odd N := odd_if_sum_eq_zero I a h₂ h_sum_I_pow_N_zero
let p := fun i ↦ SignType.sign (a i)
-- The sum over J must be a multiple of amax^n (all terms have the same absolute value)
have h_sum_I_mult_amax : ∃ m : ℤ, ∀ n, Odd n → ∑ j ∈ J, a j^n = m * amax^n := by
have h_eq : ∀ j ∈ J, a j = (p j) * amax := by
intro j hj
have : |a j| = amax := by grind
rw [← this]
exact Eq.symm (sign_mul_abs (a j))
use ∑ j ∈ J, p j
intro n h_odd
have h_eq_pow_n : ∀ j ∈ J, a j^n = (p j) * amax^n := by
intro i hi
have hp_pow_odd_n : ∀ i n, Odd n → p i = p i^n := by
intro i n h_odd
exact (SignType.pow_odd (p i) h_odd).symm
calc
a i^n = ((p i) * amax)^n := by simp [h_eq i hi]
_ = p i^n * amax^n := mul_pow ↑(p i) amax n
_ = p i * amax^n := by
field_simp
norm_cast
rw [← hp_pow_odd_n i n h_odd]
rw [Int.cast_sum, Finset.sum_mul, Finset.sum_congr rfl]
simp only [SignType.intCast_cast]
intro i hi
exact h_eq_pow_n i hi
obtain ⟨m, hm⟩ := h_sum_I_mult_amax
-- First part of proving that m must be zero.
-- This corresponds to half of the a j = amax and half a j = -amax.
have hmIneq : |m| * amax^N < amax^N := by
have h_pow_ak_le_q : ∀ i ∈ K, |a i|^N ≤ q^N := by
intro i hI
exact (Odd.pow_le_pow h_odd_N).mpr (h_ak_le_q i hI)
calc
|m| * amax^N = |m * amax^N| := by simp [abs_mul, abs_of_pos (pow_pos h_pos_amax N)]
_ = |∑ k ∈ J, a k^N| := Eq.symm (congr_arg abs (hm N h_odd_N))
_ = |∑ k ∈ I, a k^N - ∑ k ∈ K, a k^N| := by simp [h_sum_union_eq_sum_disj N, add_comm]
_ = |∑ k ∈ K, a k^N| := by simp [h_sum_I_pow_N_zero]
_ ≤ ∑ k ∈ K, |a k^N| := Finset.abs_sum_le_sum_abs (fun i ↦ a i ^ N) K
_ = ∑ k ∈ K, |a k|^N := by simp
_ ≤ ∑ k ∈ K, q^N := by exact Finset.sum_le_sum h_pow_ak_le_q
_ = K.card * q^N := by simp
_ ≤ 8 * q^N := by
gcongr
simp only [Nat.cast_le_ofNat]
exact card_finset_fin_le K
_ < amax^N := RCLike.ofReal_lt_ofReal.mp h_bounds
-- Conclude that m = 0
have hmZero : m = 0 := by
field_simp [h_pos_amax] at hmIneq
norm_cast at hmIneq
exact Int.abs_lt_one_iff.mp hmIneq
-- Finally conclude that the sum over J is zero for all odd n
intro n h_odd
simp [hm n h_odd, hmZero]
-- Now proceed to prove that the sum over I is zero for all odd n
-- We split into two cases, since if all a k are zero, the infinite sum condition
-- does not imply that there are infinite number of odd n for which it holds.
by_cases! hai : ∀ k ∈ K, a k = 0
-- Simple case, all terms in sum over K are zero
· intro N h_odd_N
rw [h_sum_union_eq_sum_disj N]
have h_sum_K_zero : ∑ k ∈ K, a k^N = 0 := by
have h_terms_K_zero : ∀ k ∈ K, a k^N = 0 := by
intro k h_k
rw [hai k h_k]
have h_pos_N : 0 < N := Odd.pos h_odd_N
simp only [pow_eq_zero_iff', ne_eq, true_and]
exact Nat.ne_zero_of_lt h_pos_N
exact Finset.sum_eq_zero h_terms_K_zero
rw [h_sum_J_eq_zero_of_odd N h_odd_N, h_sum_K_zero, zero_add]
-- Interesting case, not all remaining a k are zero
· have h_inf_sum_K_zero : Set.Infinite {n | ∑ k ∈ K, a k^n = 0} := by
have hSame : {n | ∑ i ∈ I, a i^n = 0} = {n | ∑ k ∈ K, a k^n = 0} := by
ext N
simp only [Set.mem_setOf_eq]
constructor <;> intro hS
· have hOdd : Odd N := odd_if_sum_eq_zero I a h₂ hS
rw [h_sum_union_eq_sum_disj, h_sum_J_eq_zero_of_odd N hOdd, add_zero] at hS
exact hS
· have hOdd : Odd N := odd_if_sum_eq_zero K a hai hS
simp [h_sum_union_eq_sum_disj, h_sum_J_eq_zero_of_odd N hOdd, add_zero, hS]
simp [← hSame, h₁]
have h_rec := aux_recursive K a h_inf_sum_K_zero
have h_sum : ∀ n, Odd n → (∑ k ∈ K, a k ^ n) + (∑ k ∈ J, a k ^ n) = 0 := by
intro N h_odd
simp_all only [add_zero, J, K]
intro N h_odd
rw [h_sum_union_eq_sum_disj, h_sum N h_odd]
termination_by I.card
decreasing_by
have hTSubset : K ⊂ I := by grind
exact Finset.card_lt_card hTSubset
theorem imo1967_p5 (a : Fin 8 → ℝ)
(h₁ : Set.Infinite {n | ∑ i, a i ^ n = 0})
(h₂ : ¬∀ i, a i = 0) :
solution a = {n | ∑ i, a i ^ n = 0} := by
rw [solution]
ext N
let I : Finset (Fin 8) := Finset.univ
have h₃ : ∃ i ∈ I, a i ≠ 0 := by aesop
constructor
-- If N is odd, use the aux_recursive lemma to prove that the sum is zero
· intro h_odd
exact aux_recursive Finset.univ a h₁ h₃ N h_odd
-- If sum is zero, prove that N cannot be even (all terms would be non-negative, not all zero)
· intro h_zero_sum
exact odd_if_sum_eq_zero Finset.univ a h₃ h_zero_sum
end Imo1967P5 | /- | /-
Copyright (c) 2025 The Compfiles Authors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Rydh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1967, Problem 5
Consider the sequence {cₙ}, where
c₁ = a₁ + a₂ + ... + a₈
c₂ = a₁² + a₂² + ... + a₈²
...
cₙ = a₁ⁿ + a₂ⁿ + ... + a₈ⁿ
in which a₁, a₂, ..., a₈ are real numbers not all
equal to zero. Suppose that an infinite number of terms
of the sequence {cₙ} are equal to zero. Find all natural
numbers n such that cₙ = 0.
-/
namespace Imo1967P5
abbrev solution : (Fin 8 → ℝ) → Set ℕ := fun _ => { n | Odd n }
lemma odd_if_sum_eq_zero {α : Type*} {n : ℕ}
(I : Finset α)
(f : α → ℝ)
(h : ∃ α ∈ I, f α ≠ 0)
: ∑ i ∈ I, f i^n = 0 → Odd n := by
intro h2
obtain ⟨m, hm, hm2⟩ := h
by_contra! h_not_odd
have h_even := Nat.not_odd_iff_even.mp h_not_odd
have h_pos : 0 < ∑ i ∈ I, f i^n := by calc
0 < f m^n := Even.pow_pos h_even hm2
_ ≤ ∑ i ∈ I, f i^n := Finset.single_le_sum (fun i a ↦ Even.pow_nonneg h_even (f i)) hm
simp [h2] at h_pos
lemma aux_recursive (I : Finset (Fin 8)) (a : Fin 8 → ℝ)
(h₁ : Set.Infinite {n | ∑ i ∈ I, a i ^ n = 0})
(h₂ : ∃ i ∈ I, a i ≠ 0) :
∀ n, Odd n → ∑ i ∈ I, a i ^ n = 0 := by
by_cases! h_empty_I : I = ∅
· subst h_empty_I
intro _ _
rfl
· obtain ⟨imax⟩ := Finset.exists_max_image I (fun i ↦ |a i|) h_empty_I
let amax := |a imax|
have h_pos_amax : 0 < amax := by grind
-- Split the index set into those having the max absolute value (J) and those that do not (K)
let J := I.filter (fun i ↦ amax ≤ |a i|)
let K := I.filter (fun i ↦ |a i| < amax)
-- Sum over I can be split over K and J
have h_sum_union_eq_sum_disj : ∀ n, ∑ i ∈ I, a i^n = (∑ k ∈ K, a k^ n) + (∑ j ∈ J, a j ^ n) := by
intro n
have h_disj : Disjoint K J := by
apply Finset.disjoint_left.mpr
intro x hk hj
grind only [= Finset.mem_filter]
have : K ∪ J = I := by grind only [= Finset.mem_union, = Finset.mem_filter]
rw [← this]
exact Finset.sum_union h_disj
-- This is the core of the actual IMO theorem
-- We prove that for large N, the sum over J is large compared to the sum over K
-- From that we deduce that the sum over J must be zero for odd n, otherwise
-- the sum over I cannot be zero. We then use this to reduce the theorem to K
-- and apply the lemma recursively.
have h_sum_J_eq_zero_of_odd : ∀ n, Odd n → ∑ j ∈ J, a j ^ n = 0 := by
-- Prepare bound q for the terms in K
have hq : ∃ q : ℝ, 0 ≤ q ∧ q < amax ∧ ∀ k ∈ K, |a k| ≤ q := by
by_cases! h_empty_K : K = ∅
· use 0
grind
obtain ⟨kmax, h_kmax, _⟩ := Finset.exists_max_image K (fun k ↦ |a k|) h_empty_K
use |a kmax|
constructor
· exact abs_nonneg (a kmax)
constructor
· exact (Finset.mem_filter.mp h_kmax).2
trivial
obtain ⟨q, h_pos_q, h_q_lt_amax, h_ak_le_q⟩ := hq
-- Show that for large n, the bound for sum over K is small compared to amax^n
have h_eventually_dominated : ∀ᶠ n in Filter.atTop, 8 * q^n < amax^n := by
rw [Filter.eventually_atTop]
by_cases! h_case : q = 0
· use 1
intro N h_pos_N
simp [h_case, zero_pow (Nat.ne_zero_of_lt h_pos_N), pow_pos h_pos_amax N]
· have h_pos_q : 0 < q := Std.lt_of_le_of_ne h_pos_q (Ne.symm h_case)
have h_ratio_pos : 1 < amax / q := (one_lt_div₀ h_pos_q).mpr h_q_lt_amax
have := (tendsto_pow_atTop_atTop_of_one_lt h_ratio_pos).eventually_gt_atTop 8
obtain ⟨N, hlt⟩ := this.exists
use N
intro M h_M_ge_N
calc
8 * q^M < (amax / q)^N * q^M := by
apply mul_lt_mul_of_pos_right hlt
exact pow_pos h_pos_q M
_ ≤ (amax / q)^M * q^M := by
have : (amax / q)^N ≤ (amax / q)^M := (pow_le_pow_iff_right₀ h_ratio_pos).mpr h_M_ge_N
aesop
_ = amax^M := by
rw [← mul_pow]
congr
field_simp
-- Finally we are ready to obtain N where the sum over I is zero and the sum over K is small
have h_freq := Nat.frequently_atTop_iff_infinite.mpr h₁
obtain ⟨N, h_sum_I_pow_N_zero, h_bounds⟩ := (Filter.Frequently.and_eventually h_freq h_eventually_dominated).exists
-- N is odd since the sum over I is zero
have h_odd_N : Odd N := odd_if_sum_eq_zero I a h₂ h_sum_I_pow_N_zero
let p := fun i ↦ SignType.sign (a i)
-- The sum over J must be a multiple of amax^n (all terms have the same absolute value)
have h_sum_I_mult_amax : ∃ m : ℤ, ∀ n, Odd n → ∑ j ∈ J, a j^n = m * amax^n := by
have h_eq : ∀ j ∈ J, a j = (p j) * amax := by
intro j hj
have : |a j| = amax := by grind
rw [← this]
exact Eq.symm (sign_mul_abs (a j))
use ∑ j ∈ J, p j
intro n h_odd
have h_eq_pow_n : ∀ j ∈ J, a j^n = (p j) * amax^n := by
intro i hi
have hp_pow_odd_n : ∀ i n, Odd n → p i = p i^n := by
intro i n h_odd
exact (SignType.pow_odd (p i) h_odd).symm
calc
a i^n = ((p i) * amax)^n := by simp [h_eq i hi]
_ = p i^n * amax^n := mul_pow ↑(p i) amax n
_ = p i * amax^n := by
field_simp
norm_cast
rw [← hp_pow_odd_n i n h_odd]
rw [Int.cast_sum, Finset.sum_mul, Finset.sum_congr rfl]
simp only [SignType.intCast_cast]
intro i hi
exact h_eq_pow_n i hi
obtain ⟨m, hm⟩ := h_sum_I_mult_amax
-- First part of proving that m must be zero.
-- This corresponds to half of the a j = amax and half a j = -amax.
have hmIneq : |m| * amax^N < amax^N := by
have h_pow_ak_le_q : ∀ i ∈ K, |a i|^N ≤ q^N := by
intro i hI
exact (Odd.pow_le_pow h_odd_N).mpr (h_ak_le_q i hI)
calc
|m| * amax^N = |m * amax^N| := by simp [abs_mul, abs_of_pos (pow_pos h_pos_amax N)]
_ = |∑ k ∈ J, a k^N| := Eq.symm (congr_arg abs (hm N h_odd_N))
_ = |∑ k ∈ I, a k^N - ∑ k ∈ K, a k^N| := by simp [h_sum_union_eq_sum_disj N, add_comm]
_ = |∑ k ∈ K, a k^N| := by simp [h_sum_I_pow_N_zero]
_ ≤ ∑ k ∈ K, |a k^N| := Finset.abs_sum_le_sum_abs (fun i ↦ a i ^ N) K
_ = ∑ k ∈ K, |a k|^N := by simp
_ ≤ ∑ k ∈ K, q^N := by exact Finset.sum_le_sum h_pow_ak_le_q
_ = K.card * q^N := by simp
_ ≤ 8 * q^N := by
gcongr
simp only [Nat.cast_le_ofNat]
exact card_finset_fin_le K
_ < amax^N := RCLike.ofReal_lt_ofReal.mp h_bounds
-- Conclude that m = 0
have hmZero : m = 0 := by
field_simp [h_pos_amax] at hmIneq
norm_cast at hmIneq
exact Int.abs_lt_one_iff.mp hmIneq
-- Finally conclude that the sum over J is zero for all odd n
intro n h_odd
simp [hm n h_odd, hmZero]
-- Now proceed to prove that the sum over I is zero for all odd n
-- We split into two cases, since if all a k are zero, the infinite sum condition
-- does not imply that there are infinite number of odd n for which it holds.
by_cases! hai : ∀ k ∈ K, a k = 0
-- Simple case, all terms in sum over K are zero
· intro N h_odd_N
rw [h_sum_union_eq_sum_disj N]
have h_sum_K_zero : ∑ k ∈ K, a k^N = 0 := by
have h_terms_K_zero : ∀ k ∈ K, a k^N = 0 := by
intro k h_k
rw [hai k h_k]
have h_pos_N : 0 < N := Odd.pos h_odd_N
simp only [pow_eq_zero_iff', ne_eq, true_and]
exact Nat.ne_zero_of_lt h_pos_N
exact Finset.sum_eq_zero h_terms_K_zero
rw [h_sum_J_eq_zero_of_odd N h_odd_N, h_sum_K_zero, zero_add]
-- Interesting case, not all remaining a k are zero
· have h_inf_sum_K_zero : Set.Infinite {n | ∑ k ∈ K, a k^n = 0} := by
have hSame : {n | ∑ i ∈ I, a i^n = 0} = {n | ∑ k ∈ K, a k^n = 0} := by
ext N
simp only [Set.mem_setOf_eq]
constructor <;> intro hS
· have hOdd : Odd N := odd_if_sum_eq_zero I a h₂ hS
rw [h_sum_union_eq_sum_disj, h_sum_J_eq_zero_of_odd N hOdd, add_zero] at hS
exact hS
· have hOdd : Odd N := odd_if_sum_eq_zero K a hai hS
simp [h_sum_union_eq_sum_disj, h_sum_J_eq_zero_of_odd N hOdd, add_zero, hS]
simp [← hSame, h₁]
have h_rec := aux_recursive K a h_inf_sum_K_zero
have h_sum : ∀ n, Odd n → (∑ k ∈ K, a k ^ n) + (∑ k ∈ J, a k ^ n) = 0 := by
intro N h_odd
simp_all only [add_zero, J, K]
intro N h_odd
rw [h_sum_union_eq_sum_disj, h_sum N h_odd]
termination_by I.card
decreasing_by
have hTSubset : K ⊂ I := by grind
exact Finset.card_lt_card hTSubset
theorem imo1967_p5 (a : Fin 8 → ℝ)
(h₁ : Set.Infinite {n | ∑ i, a i ^ n = 0})
(h₂ : ¬∀ i, a i = 0) :
solution a = {n | ∑ i, a i ^ n = 0} := by
rw [solution]
ext N
let I : Finset (Fin 8) := Finset.univ
have h₃ : ∃ i ∈ I, a i ≠ 0 := by aesop
constructor
-- If N is odd, use the aux_recursive lemma to prove that the sum is zero
· intro h_odd
exact aux_recursive Finset.univ a h₁ h₃ N h_odd
-- If sum is zero, prove that N cannot be even (all terms would be non-negative, not all zero)
· intro h_zero_sum
exact odd_if_sum_eq_zero Finset.univ a h₃ h_zero_sum
end Imo1967P5
| true | Copyright (c) 2025 The Compfiles Authors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Rydh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1967, Problem 5
Consider the sequence {cₙ}, where
c₁ = a₁ + a₂ + ... + a₈
c₂ = a₁² + a₂² + ... + a₈²
...
cₙ = a₁ⁿ + a₂ⁿ + ... + a₈ⁿ
in which a₁, a₂, ..., a₈ are real numbers not all
equal to zero. Suppose that an infinite number of terms
of the sequence {cₙ} are equal to zero. Find all natural
numbers n such that cₙ = 0.
-/
namespace Imo1967P5
abbrev solution : (Fin 8 → ℝ) → Set ℕ := fun _ => { n | Odd n }
lemma odd_if_sum_eq_zero {α : Type*} {n : ℕ}
(I : Finset α)
(f : α → ℝ)
(h : ∃ α ∈ I, f α ≠ 0)
: ∑ i ∈ I, f i^n = 0 → Odd n := by
intro h2
obtain ⟨m, hm, hm2⟩ := h
by_contra! h_not_odd
have h_even := Nat.not_odd_iff_even.mp h_not_odd
have h_pos : 0 < ∑ i ∈ I, f i^n := by calc
0 < f m^n := Even.pow_pos h_even hm2
_ ≤ ∑ i ∈ I, f i^n := Finset.single_le_sum (fun i a ↦ Even.pow_nonneg h_even (f i)) hm
simp [h2] at h_pos
lemma aux_recursive (I : Finset (Fin 8)) (a : Fin 8 → ℝ)
(h₁ : Set.Infinite {n | ∑ i ∈ I, a i ^ n = 0})
(h₂ : ∃ i ∈ I, a i ≠ 0) :
∀ n, Odd n → ∑ i ∈ I, a i ^ n = 0 := by
by_cases! h_empty_I : I = ∅
· subst h_empty_I
intro _ _
rfl
· obtain ⟨imax⟩ := Finset.exists_max_image I (fun i ↦ |a i|) h_empty_I
let amax := |a imax|
have h_pos_amax : 0 < amax := by grind
-- Split the index set into those having the max absolute value (J) and those that do not (K)
let J := I.filter (fun i ↦ amax ≤ |a i|)
let K := I.filter (fun i ↦ |a i| < amax)
-- Sum over I can be split over K and J
have h_sum_union_eq_sum_disj : ∀ n, ∑ i ∈ I, a i^n = (∑ k ∈ K, a k^ n) + (∑ j ∈ J, a j ^ n) := by
intro n
have h_disj : Disjoint K J := by
apply Finset.disjoint_left.mpr
intro x hk hj
grind only [= Finset.mem_filter]
have : K ∪ J = I := by grind only [= Finset.mem_union, = Finset.mem_filter]
rw [← this]
exact Finset.sum_union h_disj
-- This is the core of the actual IMO theorem
-- We prove that for large N, the sum over J is large compared to the sum over K
-- From that we deduce that the sum over J must be zero for odd n, otherwise
-- the sum over I cannot be zero. We then use this to reduce the theorem to K
-- and apply the lemma recursively.
have h_sum_J_eq_zero_of_odd : ∀ n, Odd n → ∑ j ∈ J, a j ^ n = 0 := by
-- Prepare bound q for the terms in K
have hq : ∃ q : ℝ, 0 ≤ q ∧ q < amax ∧ ∀ k ∈ K, |a k| ≤ q := by
by_cases! h_empty_K : K = ∅
· use 0
grind
obtain ⟨kmax, h_kmax, _⟩ := Finset.exists_max_image K (fun k ↦ |a k|) h_empty_K
use |a kmax|
constructor
· exact abs_nonneg (a kmax)
constructor
· exact (Finset.mem_filter.mp h_kmax).2
trivial
obtain ⟨q, h_pos_q, h_q_lt_amax, h_ak_le_q⟩ := hq
-- Show that for large n, the bound for sum over K is small compared to amax^n
have h_eventually_dominated : ∀ᶠ n in Filter.atTop, 8 * q^n < amax^n := by
rw [Filter.eventually_atTop]
by_cases! h_case : q = 0
· use 1
intro N h_pos_N
simp [h_case, zero_pow (Nat.ne_zero_of_lt h_pos_N), pow_pos h_pos_amax N]
· have h_pos_q : 0 < q := Std.lt_of_le_of_ne h_pos_q (Ne.symm h_case)
have h_ratio_pos : 1 < amax / q := (one_lt_div₀ h_pos_q).mpr h_q_lt_amax
have := (tendsto_pow_atTop_atTop_of_one_lt h_ratio_pos).eventually_gt_atTop 8
obtain ⟨N, hlt⟩ := this.exists
use N
intro M h_M_ge_N
calc
8 * q^M < (amax / q)^N * q^M := by
apply mul_lt_mul_of_pos_right hlt
exact pow_pos h_pos_q M
_ ≤ (amax / q)^M * q^M := by
have : (amax / q)^N ≤ (amax / q)^M := (pow_le_pow_iff_right₀ h_ratio_pos).mpr h_M_ge_N
aesop
_ = amax^M := by
rw [← mul_pow]
congr
field_simp
-- Finally we are ready to obtain N where the sum over I is zero and the sum over K is small
have h_freq := Nat.frequently_atTop_iff_infinite.mpr h₁
obtain ⟨N, h_sum_I_pow_N_zero, h_bounds⟩ := (Filter.Frequently.and_eventually h_freq h_eventually_dominated).exists
-- N is odd since the sum over I is zero
have h_odd_N : Odd N := odd_if_sum_eq_zero I a h₂ h_sum_I_pow_N_zero
let p := fun i ↦ SignType.sign (a i)
-- The sum over J must be a multiple of amax^n (all terms have the same absolute value)
have h_sum_I_mult_amax : ∃ m : ℤ, ∀ n, Odd n → ∑ j ∈ J, a j^n = m * amax^n := by
have h_eq : ∀ j ∈ J, a j = (p j) * amax := by
intro j hj
have : |a j| = amax := by grind
rw [← this]
exact Eq.symm (sign_mul_abs (a j))
use ∑ j ∈ J, p j
intro n h_odd
have h_eq_pow_n : ∀ j ∈ J, a j^n = (p j) * amax^n := by
intro i hi
have hp_pow_odd_n : ∀ i n, Odd n → p i = p i^n := by
intro i n h_odd
exact (SignType.pow_odd (p i) h_odd).symm
calc
a i^n = ((p i) * amax)^n := by simp [h_eq i hi]
_ = p i^n * amax^n := mul_pow ↑(p i) amax n
_ = p i * amax^n := by
field_simp
norm_cast
rw [← hp_pow_odd_n i n h_odd]
rw [Int.cast_sum, Finset.sum_mul, Finset.sum_congr rfl]
simp only [SignType.intCast_cast]
intro i hi
exact h_eq_pow_n i hi
obtain ⟨m, hm⟩ := h_sum_I_mult_amax
-- First part of proving that m must be zero.
-- This corresponds to half of the a j = amax and half a j = -amax.
have hmIneq : |m| * amax^N < amax^N := by
have h_pow_ak_le_q : ∀ i ∈ K, |a i|^N ≤ q^N := by
intro i hI
exact (Odd.pow_le_pow h_odd_N).mpr (h_ak_le_q i hI)
calc
|m| * amax^N = |m * amax^N| := by simp [abs_mul, abs_of_pos (pow_pos h_pos_amax N)]
_ = |∑ k ∈ J, a k^N| := Eq.symm (congr_arg abs (hm N h_odd_N))
_ = |∑ k ∈ I, a k^N - ∑ k ∈ K, a k^N| := by simp [h_sum_union_eq_sum_disj N, add_comm]
_ = |∑ k ∈ K, a k^N| := by simp [h_sum_I_pow_N_zero]
_ ≤ ∑ k ∈ K, |a k^N| := Finset.abs_sum_le_sum_abs (fun i ↦ a i ^ N) K
_ = ∑ k ∈ K, |a k|^N := by simp
_ ≤ ∑ k ∈ K, q^N := by exact Finset.sum_le_sum h_pow_ak_le_q
_ = K.card * q^N := by simp
_ ≤ 8 * q^N := by
gcongr
simp only [Nat.cast_le_ofNat]
exact card_finset_fin_le K
_ < amax^N := RCLike.ofReal_lt_ofReal.mp h_bounds
-- Conclude that m = 0
have hmZero : m = 0 := by
field_simp [h_pos_amax] at hmIneq
norm_cast at hmIneq
exact Int.abs_lt_one_iff.mp hmIneq
-- Finally conclude that the sum over J is zero for all odd n
intro n h_odd
simp [hm n h_odd, hmZero]
-- Now proceed to prove that the sum over I is zero for all odd n
-- We split into two cases, since if all a k are zero, the infinite sum condition
-- does not imply that there are infinite number of odd n for which it holds.
by_cases! hai : ∀ k ∈ K, a k = 0
-- Simple case, all terms in sum over K are zero
· intro N h_odd_N
rw [h_sum_union_eq_sum_disj N]
have h_sum_K_zero : ∑ k ∈ K, a k^N = 0 := by
have h_terms_K_zero : ∀ k ∈ K, a k^N = 0 := by
intro k h_k
rw [hai k h_k]
have h_pos_N : 0 < N := Odd.pos h_odd_N
simp only [pow_eq_zero_iff', ne_eq, true_and]
exact Nat.ne_zero_of_lt h_pos_N
exact Finset.sum_eq_zero h_terms_K_zero
rw [h_sum_J_eq_zero_of_odd N h_odd_N, h_sum_K_zero, zero_add]
-- Interesting case, not all remaining a k are zero
· have h_inf_sum_K_zero : Set.Infinite {n | ∑ k ∈ K, a k^n = 0} := by
have hSame : {n | ∑ i ∈ I, a i^n = 0} = {n | ∑ k ∈ K, a k^n = 0} := by
ext N
simp only [Set.mem_setOf_eq]
constructor <;> intro hS
· have hOdd : Odd N := odd_if_sum_eq_zero I a h₂ hS
rw [h_sum_union_eq_sum_disj, h_sum_J_eq_zero_of_odd N hOdd, add_zero] at hS
exact hS
· have hOdd : Odd N := odd_if_sum_eq_zero K a hai hS
simp [h_sum_union_eq_sum_disj, h_sum_J_eq_zero_of_odd N hOdd, add_zero, hS]
simp [← hSame, h₁]
have h_rec := aux_recursive K a h_inf_sum_K_zero
have h_sum : ∀ n, Odd n → (∑ k ∈ K, a k ^ n) + (∑ k ∈ J, a k ^ n) = 0 := by
intro N h_odd
simp_all only [add_zero, J, K]
intro N h_odd
rw [h_sum_union_eq_sum_disj, h_sum N h_odd]
termination_by I.card
decreasing_by
have hTSubset : K ⊂ I := by grind
exact Finset.card_lt_card hTSubset
theorem imo1967_p5 (a : Fin 8 → ℝ)
(h₁ : Set.Infinite {n | ∑ i, a i ^ n = 0})
(h₂ : ¬∀ i, a i = 0) :
solution a = {n | ∑ i, a i ^ n = 0} := by
rw [solution]
ext N
let I : Finset (Fin 8) := Finset.univ
have h₃ : ∃ i ∈ I, a i ≠ 0 := by aesop
constructor
-- If N is odd, use the aux_recursive lemma to prove that the sum is zero
· intro h_odd
exact aux_recursive Finset.univ a h₁ h₃ N h_odd
-- If sum is zero, prove that N cannot be even (all terms would be non-negative, not all zero)
· intro h_zero_sum
exact odd_if_sum_eq_zero Finset.univ a h₃ h_zero_sum
end Imo1967P5 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1967P5.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unsolved goals\nI : Finset (Fin 8)\na : Fin 8 \u2192 \u211d\nh\u2081 : {n | \u2211 i \u2208 I, a i ^ n = 0}.Infinite\nh\u2082 : \u2203 i \u2208 I, a i \u2260 0\n\u22a2 \u2200 (n : \u2115), Odd n \u2192 \u2211 i \u2208 I, a i ^ n = 0"], "timeout_s": 600.0, "latency_s": 0.2405, "verified_at": "2026-03-26T18:16:18.668301+00:00"}} | false | true | false | 0.2405 |
compfiles_Imo1968P2 | compfiles | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1968, Problem 2
Determine the set of natural numbers x such that
the product of the decimal digits of x is equal to x² - 10x - 22.
-/
namespace Imo1968P2
lemma lemma0 {α β : Type} {f : ℕ → α → β} (l : List α) (h2 : l ≠ []) :
List.getLast (List.mapIdx f l) (List.mapIdx_ne_nil_iff.mpr h2) =
f (l.dropLast).length (List.getLast l h2) := by
rw [List.getLast_mapIdx, List.length_dropLast]
lemma prod_digits_le {x b : ℕ} (hb : 2 ≤ b) (xpos : 0 < x) :
List.prod (Nat.digits b x) ≤ x := by
have h1 : Nat.digits b x ≠ [] :=
Nat.digits_ne_nil_iff_ne_zero.mpr (Nat.pos_iff_ne_zero.mp xpos)
rw [←List.dropLast_append_getLast h1, List.prod_append, List.prod_singleton]
have h3 := Nat.ofDigits_digits b x
rw [Nat.ofDigits_eq_sum_mapIdx] at h3
have h4 : List.mapIdx (fun i a => a * b ^ i) (Nat.digits b x) ≠ [] :=
List.mapIdx_ne_nil_iff.mpr h1
rw [←List.dropLast_append_getLast (List.mapIdx_ne_nil_iff.mpr h1),
List.sum_append, List.sum_singleton] at h3
have h6 : List.getLast (List.mapIdx (fun i a => a * b ^ i) (Nat.digits b x)) h4 ≤ x :=
by nth_rewrite 2 [←h3]; exact Nat.le_add_left _ _
have h7 : List.getLast (List.mapIdx (fun i a => a * b ^ i) (Nat.digits b x)) h4 =
b ^ (List.dropLast (Nat.digits b x)).length * List.getLast (Nat.digits b x) h1 := by
rw [lemma0 _ h1, mul_comm]
rw [h7] at h6; clear h7
have h8 : List.prod (List.dropLast (Nat.digits b x)) ≤
b^(List.length (List.dropLast (Nat.digits b x))) := by
have h10 : ∀ d ∈ List.dropLast (Nat.digits b x), d ≤ b := fun d hd ↦
Nat.le_of_lt (Nat.digits_lt_base hb (List.mem_of_mem_dropLast hd))
exact List.prod_le_pow_card (List.dropLast (Nat.digits b x)) b h10
exact mul_le_of_mul_le_right h6 h8
abbrev solution_set : Set ℕ := { 12 }
theorem imo1968_p2 (x : ℕ) :
x ∈ solution_set ↔
x^2 = 10 * x + 22 + (Nat.digits 10 x).prod := by
-- Follows Solution 1 at
-- https://artofproblemsolving.com/wiki/index.php/1968_IMO_Problems/Problem_2
constructor
· rintro rfl; norm_num
· intro hs
have h0 : 0 < x := (Nat.eq_zero_or_pos x).resolve_left (fun H ↦ by norm_num [H] at hs)
have h2 : x^2 ≤ 10 * x + 22 + x := le_add_of_le_add_left (le_of_eq hs)
(prod_digits_le (by norm_num) h0)
have h3 : x < 13 := by nlinarith
rw [Set.mem_singleton_iff]
interval_cases x <;> simp at hs ⊢
end Imo1968P2 | /- | /-
Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1968, Problem 2
Determine the set of natural numbers x such that
the product of the decimal digits of x is equal to x² - 10x - 22.
-/
namespace Imo1968P2
lemma lemma0 {α β : Type} {f : ℕ → α → β} (l : List α) (h2 : l ≠ []) :
List.getLast (List.mapIdx f l) (List.mapIdx_ne_nil_iff.mpr h2) =
f (l.dropLast).length (List.getLast l h2) := by
rw [List.getLast_mapIdx, List.length_dropLast]
lemma prod_digits_le {x b : ℕ} (hb : 2 ≤ b) (xpos : 0 < x) :
List.prod (Nat.digits b x) ≤ x := by
have h1 : Nat.digits b x ≠ [] :=
Nat.digits_ne_nil_iff_ne_zero.mpr (Nat.pos_iff_ne_zero.mp xpos)
rw [←List.dropLast_append_getLast h1, List.prod_append, List.prod_singleton]
have h3 := Nat.ofDigits_digits b x
rw [Nat.ofDigits_eq_sum_mapIdx] at h3
have h4 : List.mapIdx (fun i a => a * b ^ i) (Nat.digits b x) ≠ [] :=
List.mapIdx_ne_nil_iff.mpr h1
rw [←List.dropLast_append_getLast (List.mapIdx_ne_nil_iff.mpr h1),
List.sum_append, List.sum_singleton] at h3
have h6 : List.getLast (List.mapIdx (fun i a => a * b ^ i) (Nat.digits b x)) h4 ≤ x :=
by nth_rewrite 2 [←h3]; exact Nat.le_add_left _ _
have h7 : List.getLast (List.mapIdx (fun i a => a * b ^ i) (Nat.digits b x)) h4 =
b ^ (List.dropLast (Nat.digits b x)).length * List.getLast (Nat.digits b x) h1 := by
rw [lemma0 _ h1, mul_comm]
rw [h7] at h6; clear h7
have h8 : List.prod (List.dropLast (Nat.digits b x)) ≤
b^(List.length (List.dropLast (Nat.digits b x))) := by
have h10 : ∀ d ∈ List.dropLast (Nat.digits b x), d ≤ b := fun d hd ↦
Nat.le_of_lt (Nat.digits_lt_base hb (List.mem_of_mem_dropLast hd))
exact List.prod_le_pow_card (List.dropLast (Nat.digits b x)) b h10
exact mul_le_of_mul_le_right h6 h8
abbrev solution_set : Set ℕ := { 12 }
theorem imo1968_p2 (x : ℕ) :
x ∈ solution_set ↔
x^2 = 10 * x + 22 + (Nat.digits 10 x).prod := by
-- Follows Solution 1 at
-- https://artofproblemsolving.com/wiki/index.php/1968_IMO_Problems/Problem_2
constructor
· rintro rfl; norm_num
· intro hs
have h0 : 0 < x := (Nat.eq_zero_or_pos x).resolve_left (fun H ↦ by norm_num [H] at hs)
have h2 : x^2 ≤ 10 * x + 22 + x := le_add_of_le_add_left (le_of_eq hs)
(prod_digits_le (by norm_num) h0)
have h3 : x < 13 := by nlinarith
rw [Set.mem_singleton_iff]
interval_cases x <;> simp at hs ⊢
end Imo1968P2
| true | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1968, Problem 2
Determine the set of natural numbers x such that
the product of the decimal digits of x is equal to x² - 10x - 22.
-/
namespace Imo1968P2
lemma lemma0 {α β : Type} {f : ℕ → α → β} (l : List α) (h2 : l ≠ []) :
List.getLast (List.mapIdx f l) (List.mapIdx_ne_nil_iff.mpr h2) =
f (l.dropLast).length (List.getLast l h2) := by
rw [List.getLast_mapIdx, List.length_dropLast]
lemma prod_digits_le {x b : ℕ} (hb : 2 ≤ b) (xpos : 0 < x) :
List.prod (Nat.digits b x) ≤ x := by
have h1 : Nat.digits b x ≠ [] :=
Nat.digits_ne_nil_iff_ne_zero.mpr (Nat.pos_iff_ne_zero.mp xpos)
rw [←List.dropLast_append_getLast h1, List.prod_append, List.prod_singleton]
have h3 := Nat.ofDigits_digits b x
rw [Nat.ofDigits_eq_sum_mapIdx] at h3
have h4 : List.mapIdx (fun i a => a * b ^ i) (Nat.digits b x) ≠ [] :=
List.mapIdx_ne_nil_iff.mpr h1
rw [←List.dropLast_append_getLast (List.mapIdx_ne_nil_iff.mpr h1),
List.sum_append, List.sum_singleton] at h3
have h6 : List.getLast (List.mapIdx (fun i a => a * b ^ i) (Nat.digits b x)) h4 ≤ x :=
by nth_rewrite 2 [←h3]; exact Nat.le_add_left _ _
have h7 : List.getLast (List.mapIdx (fun i a => a * b ^ i) (Nat.digits b x)) h4 =
b ^ (List.dropLast (Nat.digits b x)).length * List.getLast (Nat.digits b x) h1 := by
rw [lemma0 _ h1, mul_comm]
rw [h7] at h6; clear h7
have h8 : List.prod (List.dropLast (Nat.digits b x)) ≤
b^(List.length (List.dropLast (Nat.digits b x))) := by
have h10 : ∀ d ∈ List.dropLast (Nat.digits b x), d ≤ b := fun d hd ↦
Nat.le_of_lt (Nat.digits_lt_base hb (List.mem_of_mem_dropLast hd))
exact List.prod_le_pow_card (List.dropLast (Nat.digits b x)) b h10
exact mul_le_of_mul_le_right h6 h8
abbrev solution_set : Set ℕ := { 12 }
theorem imo1968_p2 (x : ℕ) :
x ∈ solution_set ↔
x^2 = 10 * x + 22 + (Nat.digits 10 x).prod := by
-- Follows Solution 1 at
-- https://artofproblemsolving.com/wiki/index.php/1968_IMO_Problems/Problem_2
constructor
· rintro rfl; norm_num
· intro hs
have h0 : 0 < x := (Nat.eq_zero_or_pos x).resolve_left (fun H ↦ by norm_num [H] at hs)
have h2 : x^2 ≤ 10 * x + 22 + x := le_add_of_le_add_left (le_of_eq hs)
(prod_digits_le (by norm_num) h0)
have h3 : x < 13 := by nlinarith
rw [Set.mem_singleton_iff]
interval_cases x <;> simp at hs ⊢
end Imo1968P2 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1968P2.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 600.0, "latency_s": 0.9052, "verified_at": "2026-03-26T18:16:19.333115+00:00"}} | true | true | false | 0.9052 |
compfiles_Imo1968P3 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: John Maar
-/
import Mathlib
/-!
# International Mathematical Olympiad 1968, Problem 3
a, b, c are real with a non-zero. x1, x2, ... , xn satisfy the n equations:
a x_i^2 + b x_i + c = x_{i+1}, for 1 ≤ i < n
a x_n^2 + b x_n + c = x_1
Prove that the system has zero, 1 or >1 real solutions according as (b - 1)^2 - 4ac is <0, =0 or >0.
-/
namespace Imo1968P3
open Cardinal Finset
/- we define the solutionset as functions from ℕ to ℝ, that eventually vanish, as this allows summing over Finset.range
as opposed to summing over Fin n -/
def solution_set (n : ℕ) (a b c : ℝ) : Set (ℕ → ℝ) := {x : ℕ → ℝ |
(∀ i < n, a * (x i)^2 + b * (x i) + c = x (i+1)) ∧
(a * (x n)^2 + b * (x n) + c = x 0) ∧ (∀ i > n, x i = 0)}
def f (a b c : ℝ) : ℝ → ℝ := fun x ↦ a * x^2 + (b-1)* x + c
lemma f_continuous (a b c : ℝ) : Continuous (f a b c) := by unfold f; fun_prop
lemma IVT {g : ℝ → ℝ} (hg : Continuous g) {a b : ℝ} (ha : g a ≤ 0) (hb : g b ≥ 0) : ∃ z : ℝ, g z = 0 :=
(intermediate_value_uIcc hg.continuousOn (Set.mem_uIcc.mpr (.inl ⟨ha, hb⟩))).imp fun _ ⟨_, hz⟩ ↦ hz
lemma sol_structure_f (a b c : ℝ) (a_ne_zero : a ≠ 0) :
(discrim a (b-1) c < 0 → ¬ ∃ x : ℝ, f a b c x = 0) ∧
(discrim a (b-1) c = 0 → (∃ x : ℝ, f a b c x = 0 ∧ ∀ y : ℝ, f a b c y = 0 → y = x) ∧ ((∀ x : ℝ, f a b c x ≥ 0) ∨ ∀ x : ℝ, f a b c x ≤ 0)) ∧
(discrim a (b-1) c > 0 → ∃ x y : ℝ, x≠y ∧ f a b c x = 0 ∧ f a b c y = 0) := by
have f_quad : ∀ x, f a b c x = 0 ↔ a * (x * x) + (b - 1) * x + c = 0 :=
fun x => by constructor <;> (intro h; simp [f, sq] at h ⊢; linarith)
refine ⟨fun hd ⟨x, hx⟩ => ?_, fun hd => ⟨?_, ?_⟩, fun hd => ?_⟩
-- Part 1: discrim < 0 → no roots
· exact quadratic_ne_zero_of_discrim_ne_sq
(fun s hs => absurd (hs ▸ sq_nonneg s) (not_le.mpr hd)) x ((f_quad x).mp hx)
-- Part 2a: discrim = 0 → unique root
· obtain ⟨x, hx, huniq⟩ := (discrim_eq_zero_iff a_ne_zero).mp hd
exact ⟨x, (f_quad x).mpr hx, fun y hy => huniq y ((f_quad y).mp hy)⟩
-- Part 2b: discrim = 0 → sign condition
· have csq : c = (b-1)^2/(4*a) := by unfold discrim at hd; field_simp at hd ⊢; linarith
have key : ∀ x, f a b c x = a * (x + (b-1)/(2*a))^2 := by
intro x; simp [f, csq]; field_simp; ring
by_cases ha : (0 : ℝ) ≤ a
· left; intro x; rw [key]; exact mul_nonneg ha (sq_nonneg _)
· right; intro x; rw [key]; exact mul_nonpos_of_nonpos_of_nonneg (not_le.mp ha).le (sq_nonneg _)
-- Part 3: discrim > 0 → two distinct roots
· have ⟨s, hs⟩ : ∃ s : ℝ, discrim a (b-1) c = s * s :=
⟨Real.sqrt (discrim a (b-1) c), (Real.mul_self_sqrt hd.le).symm⟩
have hs_ne : s ≠ 0 := by rintro rfl; simp at hs; linarith
refine ⟨(-(b-1) + s) / (2*a), (-(b-1) - s) / (2*a), ?_, ?_, ?_⟩
· intro h; field_simp at h; exact hs_ne (by linarith)
· exact (f_quad _).mpr ((quadratic_eq_zero_iff a_ne_zero hs _).mpr (.inl (by ring)))
· exact (f_quad _).mpr ((quadratic_eq_zero_iff a_ne_zero hs _).mpr (.inr (by ring)))
lemma solution (n : ℕ) {a b c y : ℝ} (h : f a b c y = 0) : (fun i ↦ if i ∈ range (n+1) then y else 0) ∈ solution_set n a b c := by
let x := (fun i ↦ if i ∈ range (n+1) then y else 0)
show x ∈ solution_set n a b c
simp [solution_set]
constructor
· intro i hi
have claim1 : x i = y := by simp [x]; intro h; linarith
have claim2 : x (i+1) = y := by simp [x]; intro h; linarith
calc a * x i ^ 2 + b * x i + c = f a b c (x i) + x i := by simp [f]; ring
_ = f a b c y + y := by rw [claim1]
_ = x (i+1) := by rw [h, zero_add, claim2]
constructor
· have claim1 : x n = y := by simp [x]
have claim2 : x 0 = y := by simp [x]
calc a * x n ^ 2 + b * x n + c = f a b c (x n) + x n := by simp [f]; ring
_ = f a b c y + y := by rw [claim1]
_ = x 0 := by rw [h, zero_add, claim2]
intro i hi
simp [x]
intro hh
linarith
lemma sum_sol {n : ℕ} (a b c : ℝ) (x : ℕ → ℝ) : x ∈ solution_set n a b c → ∑ i∈ range (n+1), f a b c (x i) = 0 := by
intro h
unfold f
have := by calc
∑ i ∈ range (n+1), (a * x i ^ 2 + (b - 1) * x i + c) = ∑ i ∈ range (n+1), (a * x i ^ 2 + b * x i + c - x i) := by apply sum_congr (rfl); intro i _; ring
_ = ∑ i ∈ range (n+1), (a * x i ^ 2 + b * x i + c) - ∑ i ∈ range (n+1), x i := sum_sub_distrib (fun i ↦ a * x i ^ 2 + b * x i + c) x
rw [this]
apply sub_eq_zero.mpr
calc ∑ i ∈ range (n+1), (a * x i ^ 2 + b * x i + c) = ∑ i ∈ range n, (a * x i ^ 2 + b * x i + c) + (a * x n ^ 2 + b * x n + c) := sum_range_succ (fun i ↦ a * x i ^ 2 + b * x i + c) n
_ = ∑ i ∈ range n, (a * x i ^ 2 + b * x i + c) + x 0 := by rw [h.2.1]
_ = ∑ i ∈ range n, x (i+1) + x 0 := by apply add_right_cancel_iff.mpr; apply Finset.sum_congr rfl; intro i hi; rw [h.1 i (mem_range.mp hi)]
_ = ∑ i ∈ range (n+1), x i := Eq.symm (sum_range_succ' x n)
theorem imo1968_p3 {n : ℕ} (a b c : ℝ) (a_ne_zero : a ≠ 0) :
(discrim a (b-1) c < 0 → #(solution_set n a b c) = 0) ∧
(discrim a (b-1) c = 0 → #(solution_set n a b c) = 1) ∧
(discrim a (b-1) c > 0 → #(solution_set n a b c) > 1) := by
constructor
· intro h
apply mk_set_eq_zero_iff.mpr
apply Set.subset_empty_iff.mp
intro x hx
exfalso
have : (∀ y : ℝ, f a b c y > 0) ∨ (∀ y : ℝ, f a b c y < 0) := by
by_contra!
rcases this with ⟨⟨y1, hy1⟩, ⟨y2, hy2⟩⟩
apply (sol_structure_f a b c a_ne_zero).1 h
exact IVT (f_continuous a b c) hy1 hy2
rcases this with hf|hf
· have : ∑ i ∈ range (n+1), f a b c (x i) > 0 := by
have : (0 : ℝ) = ∑ i ∈ range (n+1), 0 := Eq.symm sum_const_zero
rw [this]
refine sum_lt_sum_of_nonempty ?_ fun i a ↦ hf (x i)
exact nonempty_range_add_one
have := sum_sol a b c x hx
linarith
have : ∑ i ∈ range (n+1), f a b c (x i) < 0 := by
have : (0 : ℝ) = ∑ i ∈ range (n+1), 0 := Eq.symm sum_const_zero
rw [this]
refine sum_lt_sum_of_nonempty ?_ fun i a ↦ hf (x i)
exact nonempty_range_add_one
have := sum_sol a b c x hx
linarith
constructor
· intro h
rcases ((sol_structure_f a b c a_ne_zero).2.1 h).1 with ⟨y, hy, claim1⟩
let x : ℕ → ℝ := fun i ↦ if i ∈ range (n+1) then y else 0
have hx : x ∈ solution_set n a b c := by apply solution _ hy
have sol_unique : ∀ y ∈ solution_set n a b c, y = x := by
intro z hz
ext i
unfold x
by_cases hh : i ∈ range (n+1)
· rw [if_pos hh]
apply claim1
by_contra!
have claim3 := sum_sol a b c z hz
rcases ((sol_structure_f a b c a_ne_zero).2.1 h).2 with claim2|claim2
· have : f a b c (z i) > 0 := Std.lt_of_le_of_ne (claim2 (z i)) (id (Ne.symm this))
have claim4 : ∑ i ∈ range (n + 1), f a b c (z i) > 0 := by
apply (sum_pos_iff_of_nonneg fun x a ↦ claim2 (z x)).mpr
use i
linarith
have : f a b c (z i) < 0 := Std.lt_of_le_of_ne (claim2 (z i)) (this)
have claim4 : ∑ i ∈ range (n + 1), f a b c (z i) < 0 := by
apply (sum_neg_iff_of_nonpos fun x a ↦ claim2 (z x)).mpr
use i
linarith
rw [if_neg hh]
apply hz.2.2 i
by_contra!
apply hh
exact mem_range.2 (Order.lt_add_one_iff.mpr this)
apply eq_one_iff_unique.mpr
apply and_comm.1
constructor
· apply nonempty_subtype.mpr
exact ⟨x, hx⟩
rw [Set.subsingleton_coe]
exact Set.subsingleton_of_forall_eq x sol_unique
intro h
rcases (sol_structure_f a b c a_ne_zero).2.2 h with ⟨y1, y2, hy_ne, hy1, hy2⟩
let x1 := (fun i ↦ if i ∈ range (n+1) then y1 else 0)
let x2 := (fun i ↦ if i ∈ range (n+1) then y2 else 0)
have x1_sol : x1 ∈ solution_set n a b c := solution n hy1
have x2_sol : x2 ∈ solution_set n a b c := solution n hy2
apply one_lt_iff_nontrivial.mpr
use ⟨x1, x1_sol⟩, ⟨x2, x2_sol⟩
intro hh
have : x1 = x2 := by calc x1 = (⟨x1, x1_sol⟩ : {z // z ∈ solution_set n a b c}).1 := rfl
_ = (⟨x2, x2_sol⟩ : {z // z ∈ solution_set n a b c}).1 := by rw [hh]
_ = x2 := rfl
apply hy_ne
calc y1 = x1 0 := by simp [x1]
_ = x2 0 := by rw [this]
_ = y2 := by simp [x2]
end Imo1968P3 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: John Maar
-/
import Mathlib
/-!
# International Mathematical Olympiad 1968, Problem 3
a, b, c are real with a non-zero. x1, x2, ... , xn satisfy the n equations:
a x_i^2 + b x_i + c = x_{i+1}, for 1 ≤ i < n
a x_n^2 + b x_n + c = x_1
Prove that the system has zero, 1 or >1 real solutions according as (b - 1)^2 - 4ac is <0, =0 or >0.
-/
namespace Imo1968P3
open Cardinal Finset
/- we define the solutionset as functions from ℕ to ℝ, that eventually vanish, as this allows summing over Finset.range
as opposed to summing over Fin n -/
def solution_set (n : ℕ) (a b c : ℝ) : Set (ℕ → ℝ) := {x : ℕ → ℝ |
(∀ i < n, a * (x i)^2 + b * (x i) + c = x (i+1)) ∧
(a * (x n)^2 + b * (x n) + c = x 0) ∧ (∀ i > n, x i = 0)}
def f (a b c : ℝ) : ℝ → ℝ := fun x ↦ a * x^2 + (b-1)* x + c
lemma f_continuous (a b c : ℝ) : Continuous (f a b c) := by unfold f; fun_prop
lemma IVT {g : ℝ → ℝ} (hg : Continuous g) {a b : ℝ} (ha : g a ≤ 0) (hb : g b ≥ 0) : ∃ z : ℝ, g z = 0 :=
(intermediate_value_uIcc hg.continuousOn (Set.mem_uIcc.mpr (.inl ⟨ha, hb⟩))).imp fun _ ⟨_, hz⟩ ↦ hz
lemma sol_structure_f (a b c : ℝ) (a_ne_zero : a ≠ 0) :
(discrim a (b-1) c < 0 → ¬ ∃ x : ℝ, f a b c x = 0) ∧
(discrim a (b-1) c = 0 → (∃ x : ℝ, f a b c x = 0 ∧ ∀ y : ℝ, f a b c y = 0 → y = x) ∧ ((∀ x : ℝ, f a b c x ≥ 0) ∨ ∀ x : ℝ, f a b c x ≤ 0)) ∧
(discrim a (b-1) c > 0 → ∃ x y : ℝ, x≠y ∧ f a b c x = 0 ∧ f a b c y = 0) := by
have f_quad : ∀ x, f a b c x = 0 ↔ a * (x * x) + (b - 1) * x + c = 0 :=
fun x => by constructor <;> (intro h; simp [f, sq] at h ⊢; linarith)
refine ⟨fun hd ⟨x, hx⟩ => ?_, fun hd => ⟨?_, ?_⟩, fun hd => ?_⟩
-- Part 1: discrim < 0 → no roots
· exact quadratic_ne_zero_of_discrim_ne_sq
(fun s hs => absurd (hs ▸ sq_nonneg s) (not_le.mpr hd)) x ((f_quad x).mp hx)
-- Part 2a: discrim = 0 → unique root
· obtain ⟨x, hx, huniq⟩ := (discrim_eq_zero_iff a_ne_zero).mp hd
exact ⟨x, (f_quad x).mpr hx, fun y hy => huniq y ((f_quad y).mp hy)⟩
-- Part 2b: discrim = 0 → sign condition
· have csq : c = (b-1)^2/(4*a) := by unfold discrim at hd; field_simp at hd ⊢; linarith
have key : ∀ x, f a b c x = a * (x + (b-1)/(2*a))^2 := by
intro x; simp [f, csq]; field_simp; ring
by_cases ha : (0 : ℝ) ≤ a
· left; intro x; rw [key]; exact mul_nonneg ha (sq_nonneg _)
· right; intro x; rw [key]; exact mul_nonpos_of_nonpos_of_nonneg (not_le.mp ha).le (sq_nonneg _)
-- Part 3: discrim > 0 → two distinct roots
· have ⟨s, hs⟩ : ∃ s : ℝ, discrim a (b-1) c = s * s :=
⟨Real.sqrt (discrim a (b-1) c), (Real.mul_self_sqrt hd.le).symm⟩
have hs_ne : s ≠ 0 := by rintro rfl; simp at hs; linarith
refine ⟨(-(b-1) + s) / (2*a), (-(b-1) - s) / (2*a), ?_, ?_, ?_⟩
· intro h; field_simp at h; exact hs_ne (by linarith)
· exact (f_quad _).mpr ((quadratic_eq_zero_iff a_ne_zero hs _).mpr (.inl (by ring)))
· exact (f_quad _).mpr ((quadratic_eq_zero_iff a_ne_zero hs _).mpr (.inr (by ring)))
lemma solution (n : ℕ) {a b c y : ℝ} (h : f a b c y = 0) : (fun i ↦ if i ∈ range (n+1) then y else 0) ∈ solution_set n a b c := by
let x := (fun i ↦ if i ∈ range (n+1) then y else 0)
show x ∈ solution_set n a b c
simp [solution_set]
constructor
· intro i hi
have claim1 : x i = y := by simp [x]; intro h; linarith
have claim2 : x (i+1) = y := by simp [x]; intro h; linarith
calc a * x i ^ 2 + b * x i + c = f a b c (x i) + x i := by simp [f]; ring
_ = f a b c y + y := by rw [claim1]
_ = x (i+1) := by rw [h, zero_add, claim2]
constructor
· have claim1 : x n = y := by simp [x]
have claim2 : x 0 = y := by simp [x]
calc a * x n ^ 2 + b * x n + c = f a b c (x n) + x n := by simp [f]; ring
_ = f a b c y + y := by rw [claim1]
_ = x 0 := by rw [h, zero_add, claim2]
intro i hi
simp [x]
intro hh
linarith
lemma sum_sol {n : ℕ} (a b c : ℝ) (x : ℕ → ℝ) : x ∈ solution_set n a b c → ∑ i∈ range (n+1), f a b c (x i) = 0 := by
intro h
unfold f
have := by calc
∑ i ∈ range (n+1), (a * x i ^ 2 + (b - 1) * x i + c) = ∑ i ∈ range (n+1), (a * x i ^ 2 + b * x i + c - x i) := by apply sum_congr (rfl); intro i _; ring
_ = ∑ i ∈ range (n+1), (a * x i ^ 2 + b * x i + c) - ∑ i ∈ range (n+1), x i := sum_sub_distrib (fun i ↦ a * x i ^ 2 + b * x i + c) x
rw [this]
apply sub_eq_zero.mpr
calc ∑ i ∈ range (n+1), (a * x i ^ 2 + b * x i + c) = ∑ i ∈ range n, (a * x i ^ 2 + b * x i + c) + (a * x n ^ 2 + b * x n + c) := sum_range_succ (fun i ↦ a * x i ^ 2 + b * x i + c) n
_ = ∑ i ∈ range n, (a * x i ^ 2 + b * x i + c) + x 0 := by rw [h.2.1]
_ = ∑ i ∈ range n, x (i+1) + x 0 := by apply add_right_cancel_iff.mpr; apply Finset.sum_congr rfl; intro i hi; rw [h.1 i (mem_range.mp hi)]
_ = ∑ i ∈ range (n+1), x i := Eq.symm (sum_range_succ' x n)
theorem imo1968_p3 {n : ℕ} (a b c : ℝ) (a_ne_zero : a ≠ 0) :
(discrim a (b-1) c < 0 → #(solution_set n a b c) = 0) ∧
(discrim a (b-1) c = 0 → #(solution_set n a b c) = 1) ∧
(discrim a (b-1) c > 0 → #(solution_set n a b c) > 1) := by
constructor
· intro h
apply mk_set_eq_zero_iff.mpr
apply Set.subset_empty_iff.mp
intro x hx
exfalso
have : (∀ y : ℝ, f a b c y > 0) ∨ (∀ y : ℝ, f a b c y < 0) := by
by_contra!
rcases this with ⟨⟨y1, hy1⟩, ⟨y2, hy2⟩⟩
apply (sol_structure_f a b c a_ne_zero).1 h
exact IVT (f_continuous a b c) hy1 hy2
rcases this with hf|hf
· have : ∑ i ∈ range (n+1), f a b c (x i) > 0 := by
have : (0 : ℝ) = ∑ i ∈ range (n+1), 0 := Eq.symm sum_const_zero
rw [this]
refine sum_lt_sum_of_nonempty ?_ fun i a ↦ hf (x i)
exact nonempty_range_add_one
have := sum_sol a b c x hx
linarith
have : ∑ i ∈ range (n+1), f a b c (x i) < 0 := by
have : (0 : ℝ) = ∑ i ∈ range (n+1), 0 := Eq.symm sum_const_zero
rw [this]
refine sum_lt_sum_of_nonempty ?_ fun i a ↦ hf (x i)
exact nonempty_range_add_one
have := sum_sol a b c x hx
linarith
constructor
· intro h
rcases ((sol_structure_f a b c a_ne_zero).2.1 h).1 with ⟨y, hy, claim1⟩
let x : ℕ → ℝ := fun i ↦ if i ∈ range (n+1) then y else 0
have hx : x ∈ solution_set n a b c := by apply solution _ hy
have sol_unique : ∀ y ∈ solution_set n a b c, y = x := by
intro z hz
ext i
unfold x
by_cases hh : i ∈ range (n+1)
· rw [if_pos hh]
apply claim1
by_contra!
have claim3 := sum_sol a b c z hz
rcases ((sol_structure_f a b c a_ne_zero).2.1 h).2 with claim2|claim2
· have : f a b c (z i) > 0 := Std.lt_of_le_of_ne (claim2 (z i)) (id (Ne.symm this))
have claim4 : ∑ i ∈ range (n + 1), f a b c (z i) > 0 := by
apply (sum_pos_iff_of_nonneg fun x a ↦ claim2 (z x)).mpr
use i
linarith
have : f a b c (z i) < 0 := Std.lt_of_le_of_ne (claim2 (z i)) (this)
have claim4 : ∑ i ∈ range (n + 1), f a b c (z i) < 0 := by
apply (sum_neg_iff_of_nonpos fun x a ↦ claim2 (z x)).mpr
use i
linarith
rw [if_neg hh]
apply hz.2.2 i
by_contra!
apply hh
exact mem_range.2 (Order.lt_add_one_iff.mpr this)
apply eq_one_iff_unique.mpr
apply and_comm.1
constructor
· apply nonempty_subtype.mpr
exact ⟨x, hx⟩
rw [Set.subsingleton_coe]
exact Set.subsingleton_of_forall_eq x sol_unique
intro h
rcases (sol_structure_f a b c a_ne_zero).2.2 h with ⟨y1, y2, hy_ne, hy1, hy2⟩
let x1 := (fun i ↦ if i ∈ range (n+1) then y1 else 0)
let x2 := (fun i ↦ if i ∈ range (n+1) then y2 else 0)
have x1_sol : x1 ∈ solution_set n a b c := solution n hy1
have x2_sol : x2 ∈ solution_set n a b c := solution n hy2
apply one_lt_iff_nontrivial.mpr
use ⟨x1, x1_sol⟩, ⟨x2, x2_sol⟩
intro hh
have : x1 = x2 := by calc x1 = (⟨x1, x1_sol⟩ : {z // z ∈ solution_set n a b c}).1 := rfl
_ = (⟨x2, x2_sol⟩ : {z // z ∈ solution_set n a b c}).1 := by rw [hh]
_ = x2 := rfl
apply hy_ne
calc y1 = x1 0 := by simp [x1]
_ = x2 0 := by rw [this]
_ = y2 := by simp [x2]
end Imo1968P3
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: John Maar
-/
import Mathlib
/-!
# International Mathematical Olympiad 1968, Problem 3
a, b, c are real with a non-zero. x1, x2, ... , xn satisfy the n equations:
a x_i^2 + b x_i + c = x_{i+1}, for 1 ≤ i < n
a x_n^2 + b x_n + c = x_1
Prove that the system has zero, 1 or >1 real solutions according as (b - 1)^2 - 4ac is <0, =0 or >0.
-/
namespace Imo1968P3
open Cardinal Finset
/- we define the solutionset as functions from ℕ to ℝ, that eventually vanish, as this allows summing over Finset.range
as opposed to summing over Fin n -/
def solution_set (n : ℕ) (a b c : ℝ) : Set (ℕ → ℝ) := {x : ℕ → ℝ |
(∀ i < n, a * (x i)^2 + b * (x i) + c = x (i+1)) ∧
(a * (x n)^2 + b * (x n) + c = x 0) ∧ (∀ i > n, x i = 0)}
def f (a b c : ℝ) : ℝ → ℝ := fun x ↦ a * x^2 + (b-1)* x + c
lemma f_continuous (a b c : ℝ) : Continuous (f a b c) := by unfold f; fun_prop
lemma IVT {g : ℝ → ℝ} (hg : Continuous g) {a b : ℝ} (ha : g a ≤ 0) (hb : g b ≥ 0) : ∃ z : ℝ, g z = 0 :=
(intermediate_value_uIcc hg.continuousOn (Set.mem_uIcc.mpr (.inl ⟨ha, hb⟩))).imp fun _ ⟨_, hz⟩ ↦ hz
lemma sol_structure_f (a b c : ℝ) (a_ne_zero : a ≠ 0) :
(discrim a (b-1) c < 0 → ¬ ∃ x : ℝ, f a b c x = 0) ∧
(discrim a (b-1) c = 0 → (∃ x : ℝ, f a b c x = 0 ∧ ∀ y : ℝ, f a b c y = 0 → y = x) ∧ ((∀ x : ℝ, f a b c x ≥ 0) ∨ ∀ x : ℝ, f a b c x ≤ 0)) ∧
(discrim a (b-1) c > 0 → ∃ x y : ℝ, x≠y ∧ f a b c x = 0 ∧ f a b c y = 0) := by
have f_quad : ∀ x, f a b c x = 0 ↔ a * (x * x) + (b - 1) * x + c = 0 :=
fun x => by constructor <;> (intro h; simp [f, sq] at h ⊢; linarith)
refine ⟨fun hd ⟨x, hx⟩ => ?_, fun hd => ⟨?_, ?_⟩, fun hd => ?_⟩
-- Part 1: discrim < 0 → no roots
· exact quadratic_ne_zero_of_discrim_ne_sq
(fun s hs => absurd (hs ▸ sq_nonneg s) (not_le.mpr hd)) x ((f_quad x).mp hx)
-- Part 2a: discrim = 0 → unique root
· obtain ⟨x, hx, huniq⟩ := (discrim_eq_zero_iff a_ne_zero).mp hd
exact ⟨x, (f_quad x).mpr hx, fun y hy => huniq y ((f_quad y).mp hy)⟩
-- Part 2b: discrim = 0 → sign condition
· have csq : c = (b-1)^2/(4*a) := by unfold discrim at hd; field_simp at hd ⊢; linarith
have key : ∀ x, f a b c x = a * (x + (b-1)/(2*a))^2 := by
intro x; simp [f, csq]; field_simp; ring
by_cases ha : (0 : ℝ) ≤ a
· left; intro x; rw [key]; exact mul_nonneg ha (sq_nonneg _)
· right; intro x; rw [key]; exact mul_nonpos_of_nonpos_of_nonneg (not_le.mp ha).le (sq_nonneg _)
-- Part 3: discrim > 0 → two distinct roots
· have ⟨s, hs⟩ : ∃ s : ℝ, discrim a (b-1) c = s * s :=
⟨Real.sqrt (discrim a (b-1) c), (Real.mul_self_sqrt hd.le).symm⟩
have hs_ne : s ≠ 0 := by rintro rfl; simp at hs; linarith
refine ⟨(-(b-1) + s) / (2*a), (-(b-1) - s) / (2*a), ?_, ?_, ?_⟩
· intro h; field_simp at h; exact hs_ne (by linarith)
· exact (f_quad _).mpr ((quadratic_eq_zero_iff a_ne_zero hs _).mpr (.inl (by ring)))
· exact (f_quad _).mpr ((quadratic_eq_zero_iff a_ne_zero hs _).mpr (.inr (by ring)))
lemma solution (n : ℕ) {a b c y : ℝ} (h : f a b c y = 0) : (fun i ↦ if i ∈ range (n+1) then y else 0) ∈ solution_set n a b c := by
let x := (fun i ↦ if i ∈ range (n+1) then y else 0)
show x ∈ solution_set n a b c
simp [solution_set]
constructor
· intro i hi
have claim1 : x i = y := by simp [x]; intro h; linarith
have claim2 : x (i+1) = y := by simp [x]; intro h; linarith
calc a * x i ^ 2 + b * x i + c = f a b c (x i) + x i := by simp [f]; ring
_ = f a b c y + y := by rw [claim1]
_ = x (i+1) := by rw [h, zero_add, claim2]
constructor
· have claim1 : x n = y := by simp [x]
have claim2 : x 0 = y := by simp [x]
calc a * x n ^ 2 + b * x n + c = f a b c (x n) + x n := by simp [f]; ring
_ = f a b c y + y := by rw [claim1]
_ = x 0 := by rw [h, zero_add, claim2]
intro i hi
simp [x]
intro hh
linarith
lemma sum_sol {n : ℕ} (a b c : ℝ) (x : ℕ → ℝ) : x ∈ solution_set n a b c → ∑ i∈ range (n+1), f a b c (x i) = 0 := by
intro h
unfold f
have := by calc
∑ i ∈ range (n+1), (a * x i ^ 2 + (b - 1) * x i + c) = ∑ i ∈ range (n+1), (a * x i ^ 2 + b * x i + c - x i) := by apply sum_congr (rfl); intro i _; ring
_ = ∑ i ∈ range (n+1), (a * x i ^ 2 + b * x i + c) - ∑ i ∈ range (n+1), x i := sum_sub_distrib (fun i ↦ a * x i ^ 2 + b * x i + c) x
rw [this]
apply sub_eq_zero.mpr
calc ∑ i ∈ range (n+1), (a * x i ^ 2 + b * x i + c) = ∑ i ∈ range n, (a * x i ^ 2 + b * x i + c) + (a * x n ^ 2 + b * x n + c) := sum_range_succ (fun i ↦ a * x i ^ 2 + b * x i + c) n
_ = ∑ i ∈ range n, (a * x i ^ 2 + b * x i + c) + x 0 := by rw [h.2.1]
_ = ∑ i ∈ range n, x (i+1) + x 0 := by apply add_right_cancel_iff.mpr; apply Finset.sum_congr rfl; intro i hi; rw [h.1 i (mem_range.mp hi)]
_ = ∑ i ∈ range (n+1), x i := Eq.symm (sum_range_succ' x n)
theorem imo1968_p3 {n : ℕ} (a b c : ℝ) (a_ne_zero : a ≠ 0) :
(discrim a (b-1) c < 0 → #(solution_set n a b c) = 0) ∧
(discrim a (b-1) c = 0 → #(solution_set n a b c) = 1) ∧
(discrim a (b-1) c > 0 → #(solution_set n a b c) > 1) := by
constructor
· intro h
apply mk_set_eq_zero_iff.mpr
apply Set.subset_empty_iff.mp
intro x hx
exfalso
have : (∀ y : ℝ, f a b c y > 0) ∨ (∀ y : ℝ, f a b c y < 0) := by
by_contra!
rcases this with ⟨⟨y1, hy1⟩, ⟨y2, hy2⟩⟩
apply (sol_structure_f a b c a_ne_zero).1 h
exact IVT (f_continuous a b c) hy1 hy2
rcases this with hf|hf
· have : ∑ i ∈ range (n+1), f a b c (x i) > 0 := by
have : (0 : ℝ) = ∑ i ∈ range (n+1), 0 := Eq.symm sum_const_zero
rw [this]
refine sum_lt_sum_of_nonempty ?_ fun i a ↦ hf (x i)
exact nonempty_range_add_one
have := sum_sol a b c x hx
linarith
have : ∑ i ∈ range (n+1), f a b c (x i) < 0 := by
have : (0 : ℝ) = ∑ i ∈ range (n+1), 0 := Eq.symm sum_const_zero
rw [this]
refine sum_lt_sum_of_nonempty ?_ fun i a ↦ hf (x i)
exact nonempty_range_add_one
have := sum_sol a b c x hx
linarith
constructor
· intro h
rcases ((sol_structure_f a b c a_ne_zero).2.1 h).1 with ⟨y, hy, claim1⟩
let x : ℕ → ℝ := fun i ↦ if i ∈ range (n+1) then y else 0
have hx : x ∈ solution_set n a b c := by apply solution _ hy
have sol_unique : ∀ y ∈ solution_set n a b c, y = x := by
intro z hz
ext i
unfold x
by_cases hh : i ∈ range (n+1)
· rw [if_pos hh]
apply claim1
by_contra!
have claim3 := sum_sol a b c z hz
rcases ((sol_structure_f a b c a_ne_zero).2.1 h).2 with claim2|claim2
· have : f a b c (z i) > 0 := Std.lt_of_le_of_ne (claim2 (z i)) (id (Ne.symm this))
have claim4 : ∑ i ∈ range (n + 1), f a b c (z i) > 0 := by
apply (sum_pos_iff_of_nonneg fun x a ↦ claim2 (z x)).mpr
use i
linarith
have : f a b c (z i) < 0 := Std.lt_of_le_of_ne (claim2 (z i)) (this)
have claim4 : ∑ i ∈ range (n + 1), f a b c (z i) < 0 := by
apply (sum_neg_iff_of_nonpos fun x a ↦ claim2 (z x)).mpr
use i
linarith
rw [if_neg hh]
apply hz.2.2 i
by_contra!
apply hh
exact mem_range.2 (Order.lt_add_one_iff.mpr this)
apply eq_one_iff_unique.mpr
apply and_comm.1
constructor
· apply nonempty_subtype.mpr
exact ⟨x, hx⟩
rw [Set.subsingleton_coe]
exact Set.subsingleton_of_forall_eq x sol_unique
intro h
rcases (sol_structure_f a b c a_ne_zero).2.2 h with ⟨y1, y2, hy_ne, hy1, hy2⟩
let x1 := (fun i ↦ if i ∈ range (n+1) then y1 else 0)
let x2 := (fun i ↦ if i ∈ range (n+1) then y2 else 0)
have x1_sol : x1 ∈ solution_set n a b c := solution n hy1
have x2_sol : x2 ∈ solution_set n a b c := solution n hy2
apply one_lt_iff_nontrivial.mpr
use ⟨x1, x1_sol⟩, ⟨x2, x2_sol⟩
intro hh
have : x1 = x2 := by calc x1 = (⟨x1, x1_sol⟩ : {z // z ∈ solution_set n a b c}).1 := rfl
_ = (⟨x2, x2_sol⟩ : {z // z ∈ solution_set n a b c}).1 := by rw [hh]
_ = x2 := rfl
apply hy_ne
calc y1 = x1 0 := by simp [x1]
_ = x2 0 := by rw [this]
_ = y2 := by simp [x2]
end Imo1968P3 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1968P3.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["function expected at\n sum_sub_distrib\nterm has type\n \u2211 x \u2208 ?m.122615, (?m.122616 x - ?m.122617 x) = \u2211 x \u2208 ?m.122615, ?m.122616 x - \u2211 x \u2208 ?m.122615, ?m.122617 x", "unknown identifier 'mk_set_eq_zero_iff.mpr'", "no goals to be solved", "unknown identifier 'Std.lt_of_le_of_ne'", "unknown identifier 'sum_pos_iff_of_nonneg'", "no goals to be solved", "unknown identifier 'Std.lt_of_le_of_ne'", "unknown identifier 'sum_neg_iff_of_nonpos'", "no goals to be solved"], "timeout_s": 600.0, "latency_s": 3.5939, "verified_at": "2026-03-26T18:16:22.262426+00:00"}} | false | true | false | 3.5939 |
compfiles_Imo1968P5 | compfiles | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1968, Problem 5
Let f be a real-valued function defined for all real numbers x such that,
for some positive constant a, the equation
f(x + a) = 1/2 + √(f(x) - (f(x))²)
holds for all x.
(a) Prove that the function f is periodic.
(b) For a = 1, give an example of a non-constant function with the required properties.
-/
namespace Imo1968P5
abbrev P (a : ℝ) (f : ℝ → ℝ) : Prop :=
0 < a ∧
∀ x, (f x)^2 ≤ f x ∧ f (x + a) = 1/2 + √(f x - (f x)^2)
theorem imo1968_p5a (f : ℝ → ℝ) (a : ℝ) (hf : P a f) :
∃ b, 0 < b ∧ f.Periodic b := by
-- https://artofproblemsolving.com/wiki/index.php/1968_IMO_Problems/Problem_5
obtain ⟨hf1, hf2⟩ := hf
use 2 * a
constructor
· positivity
have h1 : ∀ x, 1 / 2 ≤ f (x + a) := fun x ↦ by
rw [(hf2 x).2, le_add_iff_nonneg_right]
exact Real.sqrt_nonneg (f x - f x ^ 2)
have h2 : ∀ x, 0 ≤ f (x + a) - 1/2 := fun x ↦ sub_nonneg.mpr (h1 x)
have h3 : ∀ x, f (x + a) * (1 - f (x + a)) = (f x - 1/2) ^2 := fun x ↦ by
have h6 : f (x + a) * (1 - f (x + a)) =
-((f (x + a) - 1/2)^2 - (1/2)^2) := by ring
rw [h6]
obtain ⟨hf2x1, hf2x2⟩ := hf2 x
rw [hf2x2, add_sub_cancel_left]
have h7 : 0 ≤ f x - f x ^ 2 := sub_nonneg.mpr hf2x1
rw [Real.sq_sqrt h7]
ring
intro x
obtain ⟨_, ha2⟩ := hf2 (x + a)
have h4 : f (x + a) - f (x + a) ^ 2 = f (x + a) * (1 - f (x + a)) := by ring
rw [two_mul, ←add_assoc, ha2, h4]
rw [h3]
rw [Real.sqrt_sq_eq_abs]
have h2' := abs_of_nonneg (h2 (x-a))
rw [sub_add_cancel] at h2'
exact add_eq_of_eq_sub' h2'
noncomputable abbrev solution_func : ℝ → ℝ := fun x ↦
if Even ⌊x⌋ then 1 else 1/2
theorem imo1968_p5b :
P 1 solution_func ∧ ¬∃c, solution_func = Function.const ℝ c := by
-- https://artofproblemsolving.com/wiki/index.php/1968_IMO_Problems/Problem_5
constructor
· constructor
· exact Real.zero_lt_one
· intro x
obtain heven | hodd := Classical.em (Even ⌊x⌋)
· have h1 : ¬ Even (⌊x⌋ + 1) :=
Int.not_even_iff_odd.mpr (Even.add_one heven)
simp [solution_func, h1, heven]
· norm_num [solution_func, Int.even_add_one.mpr hodd, hodd]
· rintro ⟨c, hc⟩
have h1 : Function.const ℝ c 0 = c := rfl
rw [←hc] at h1
have h1' : Function.const ℝ c 1 = c := rfl
rw [←hc] at h1'
have h2 : solution_func 0 = 1 := by simp
have h3 : c = 1 := h1.symm.trans h2
have h4 : solution_func 1 = 1/2 := by
have h6 : ¬ Even ⌊(1:ℝ)⌋ := by simp
exact if_neg h6
have h5 : c = 1/2 := h1'.symm.trans h4
rw [h3] at h5
norm_num at h5
end Imo1968P5 | /- | /-
Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1968, Problem 5
Let f be a real-valued function defined for all real numbers x such that,
for some positive constant a, the equation
f(x + a) = 1/2 + √(f(x) - (f(x))²)
holds for all x.
(a) Prove that the function f is periodic.
(b) For a = 1, give an example of a non-constant function with the required properties.
-/
namespace Imo1968P5
abbrev P (a : ℝ) (f : ℝ → ℝ) : Prop :=
0 < a ∧
∀ x, (f x)^2 ≤ f x ∧ f (x + a) = 1/2 + √(f x - (f x)^2)
theorem imo1968_p5a (f : ℝ → ℝ) (a : ℝ) (hf : P a f) :
∃ b, 0 < b ∧ f.Periodic b := by
-- https://artofproblemsolving.com/wiki/index.php/1968_IMO_Problems/Problem_5
obtain ⟨hf1, hf2⟩ := hf
use 2 * a
constructor
· positivity
have h1 : ∀ x, 1 / 2 ≤ f (x + a) := fun x ↦ by
rw [(hf2 x).2, le_add_iff_nonneg_right]
exact Real.sqrt_nonneg (f x - f x ^ 2)
have h2 : ∀ x, 0 ≤ f (x + a) - 1/2 := fun x ↦ sub_nonneg.mpr (h1 x)
have h3 : ∀ x, f (x + a) * (1 - f (x + a)) = (f x - 1/2) ^2 := fun x ↦ by
have h6 : f (x + a) * (1 - f (x + a)) =
-((f (x + a) - 1/2)^2 - (1/2)^2) := by ring
rw [h6]
obtain ⟨hf2x1, hf2x2⟩ := hf2 x
rw [hf2x2, add_sub_cancel_left]
have h7 : 0 ≤ f x - f x ^ 2 := sub_nonneg.mpr hf2x1
rw [Real.sq_sqrt h7]
ring
intro x
obtain ⟨_, ha2⟩ := hf2 (x + a)
have h4 : f (x + a) - f (x + a) ^ 2 = f (x + a) * (1 - f (x + a)) := by ring
rw [two_mul, ←add_assoc, ha2, h4]
rw [h3]
rw [Real.sqrt_sq_eq_abs]
have h2' := abs_of_nonneg (h2 (x-a))
rw [sub_add_cancel] at h2'
exact add_eq_of_eq_sub' h2'
noncomputable abbrev solution_func : ℝ → ℝ := fun x ↦
if Even ⌊x⌋ then 1 else 1/2
theorem imo1968_p5b :
P 1 solution_func ∧ ¬∃c, solution_func = Function.const ℝ c := by
-- https://artofproblemsolving.com/wiki/index.php/1968_IMO_Problems/Problem_5
constructor
· constructor
· exact Real.zero_lt_one
· intro x
obtain heven | hodd := Classical.em (Even ⌊x⌋)
· have h1 : ¬ Even (⌊x⌋ + 1) :=
Int.not_even_iff_odd.mpr (Even.add_one heven)
simp [solution_func, h1, heven]
· norm_num [solution_func, Int.even_add_one.mpr hodd, hodd]
· rintro ⟨c, hc⟩
have h1 : Function.const ℝ c 0 = c := rfl
rw [←hc] at h1
have h1' : Function.const ℝ c 1 = c := rfl
rw [←hc] at h1'
have h2 : solution_func 0 = 1 := by simp
have h3 : c = 1 := h1.symm.trans h2
have h4 : solution_func 1 = 1/2 := by
have h6 : ¬ Even ⌊(1:ℝ)⌋ := by simp
exact if_neg h6
have h5 : c = 1/2 := h1'.symm.trans h4
rw [h3] at h5
norm_num at h5
end Imo1968P5
| true | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1968, Problem 5
Let f be a real-valued function defined for all real numbers x such that,
for some positive constant a, the equation
f(x + a) = 1/2 + √(f(x) - (f(x))²)
holds for all x.
(a) Prove that the function f is periodic.
(b) For a = 1, give an example of a non-constant function with the required properties.
-/
namespace Imo1968P5
abbrev P (a : ℝ) (f : ℝ → ℝ) : Prop :=
0 < a ∧
∀ x, (f x)^2 ≤ f x ∧ f (x + a) = 1/2 + √(f x - (f x)^2)
theorem imo1968_p5a (f : ℝ → ℝ) (a : ℝ) (hf : P a f) :
∃ b, 0 < b ∧ f.Periodic b := by
-- https://artofproblemsolving.com/wiki/index.php/1968_IMO_Problems/Problem_5
obtain ⟨hf1, hf2⟩ := hf
use 2 * a
constructor
· positivity
have h1 : ∀ x, 1 / 2 ≤ f (x + a) := fun x ↦ by
rw [(hf2 x).2, le_add_iff_nonneg_right]
exact Real.sqrt_nonneg (f x - f x ^ 2)
have h2 : ∀ x, 0 ≤ f (x + a) - 1/2 := fun x ↦ sub_nonneg.mpr (h1 x)
have h3 : ∀ x, f (x + a) * (1 - f (x + a)) = (f x - 1/2) ^2 := fun x ↦ by
have h6 : f (x + a) * (1 - f (x + a)) =
-((f (x + a) - 1/2)^2 - (1/2)^2) := by ring
rw [h6]
obtain ⟨hf2x1, hf2x2⟩ := hf2 x
rw [hf2x2, add_sub_cancel_left]
have h7 : 0 ≤ f x - f x ^ 2 := sub_nonneg.mpr hf2x1
rw [Real.sq_sqrt h7]
ring
intro x
obtain ⟨_, ha2⟩ := hf2 (x + a)
have h4 : f (x + a) - f (x + a) ^ 2 = f (x + a) * (1 - f (x + a)) := by ring
rw [two_mul, ←add_assoc, ha2, h4]
rw [h3]
rw [Real.sqrt_sq_eq_abs]
have h2' := abs_of_nonneg (h2 (x-a))
rw [sub_add_cancel] at h2'
exact add_eq_of_eq_sub' h2'
noncomputable abbrev solution_func : ℝ → ℝ := fun x ↦
if Even ⌊x⌋ then 1 else 1/2
theorem imo1968_p5b :
P 1 solution_func ∧ ¬∃c, solution_func = Function.const ℝ c := by
-- https://artofproblemsolving.com/wiki/index.php/1968_IMO_Problems/Problem_5
constructor
· constructor
· exact Real.zero_lt_one
· intro x
obtain heven | hodd := Classical.em (Even ⌊x⌋)
· have h1 : ¬ Even (⌊x⌋ + 1) :=
Int.not_even_iff_odd.mpr (Even.add_one heven)
simp [solution_func, h1, heven]
· norm_num [solution_func, Int.even_add_one.mpr hodd, hodd]
· rintro ⟨c, hc⟩
have h1 : Function.const ℝ c 0 = c := rfl
rw [←hc] at h1
have h1' : Function.const ℝ c 1 = c := rfl
rw [←hc] at h1'
have h2 : solution_func 0 = 1 := by simp
have h3 : c = 1 := h1.symm.trans h2
have h4 : solution_func 1 = 1/2 := by
have h6 : ¬ Even ⌊(1:ℝ)⌋ := by simp
exact if_neg h6
have h5 : c = 1/2 := h1'.symm.trans h4
rw [h3] at h5
norm_num at h5
end Imo1968P5 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1968P5.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 600.0, "latency_s": 0.9404, "verified_at": "2026-03-26T18:16:20.273627+00:00"}} | true | true | false | 0.9404 |
compfiles_Imo1968P6 | compfiles | Copyright (c) 2026 lean-tom. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: lean-tom (with assistance from Gemini)
-/
import Mathlib
/-!
# International Mathematical Olympiad 1968, Problem 6
For every natural number n, evaluate the sum
∑_{k=0}^{∞} [(n + 2^k) / 2^(k+1)]
where [x] denotes the greatest integer less than or equal to x.
-/
namespace Imo1968P6
-- Lemma for the telescoping term structure
lemma term_telescope (n k : ℕ) :
(n + 2^k) / 2^(k+1) = n / 2^k - n / 2^(k+1) := by
rw [pow_succ, ← Nat.div_div_eq_div_mul]
have h_pos : 0 < 2^k := pow_pos (by norm_num) k
rw [Nat.add_div_right n h_pos]
-- Use the identity (a + 1) / 2 = a - a / 2
have identity (a : ℕ) : (a + 1) / 2 = a - a / 2 := by omega
rw [identity]
rw [Nat.div_div_eq_div_mul, ← pow_succ]
/--
The answer is n. We pull this into a `determine` statement as required.
-/
abbrev n_ans (n : ℕ) : ℕ := n
theorem imo1968_p6 (n : ℕ) : ∑' k, (n + 2^k) / 2^(k+1) = n_ans n := by
-- Proof starts here. We first unfold the answer definition.
unfold n_ans
-- We truncate the sum at k_max = n + 1, since terms are zero afterwards.
let k_max := n + 1
have sum_eq_finite : ∑' k, (n + 2^k) / 2^(k+1) =
∑ k ∈ Finset.range k_max, (n + 2^k) / 2^(k+1) := by
apply tsum_eq_sum
intro k hk
simp only [Finset.mem_range, not_lt] at hk
apply Nat.div_eq_of_lt
calc
n + 2^k < 2^k + 2^k := by
apply add_lt_add_left
calc
n < 2^n := n.lt_two_pow_self
_ < 2^(n + 1) := Nat.pow_lt_pow_right (by norm_num) (by omega)
_ ≤ 2^k_max := le_refl _
_ ≤ 2^k := Nat.pow_le_pow_right (by norm_num) hk
_ = 2^(k+1) := by rw [pow_succ, mul_two]
rw [sum_eq_finite]
-- Rewrite the sum using the telescoping lemma
have sum_rewrite : ∑ k ∈ Finset.range k_max, (n + 2^k) / 2^(k+1) =
∑ k ∈ Finset.range k_max, (n / 2^k - n / 2^(k+1)) := by
apply Finset.sum_congr rfl
intro k hk
rw [term_telescope]
rw [sum_rewrite]
-- Prove the telescoping sum formula for natural numbers (requiring decreasing terms)
have telescoping (m : ℕ) : ∑ k ∈ Finset.range m, (n / 2^k - n / 2^(k+1)) = n - n / 2^m := by
induction m with
| zero => simp
| succ m hm =>
rw [Finset.sum_range_succ, hm, Nat.sub_add_sub_cancel]
· apply Nat.div_le_self
· gcongr
· norm_num
· norm_num
rw [telescoping k_max]
-- Show that the remainder term is zero
have term_vanish : n / 2^k_max = 0 := by
apply Nat.div_eq_of_lt
calc
n < 2^n := n.lt_two_pow_self
_ < 2^(n+1) := Nat.pow_lt_pow_right (by norm_num) (by omega)
rw [term_vanish, Nat.sub_zero]
end Imo1968P6 | /- | /-
Copyright (c) 2026 lean-tom. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: lean-tom (with assistance from Gemini)
-/
import Mathlib
/-!
# International Mathematical Olympiad 1968, Problem 6
For every natural number n, evaluate the sum
∑_{k=0}^{∞} [(n + 2^k) / 2^(k+1)]
where [x] denotes the greatest integer less than or equal to x.
-/
namespace Imo1968P6
-- Lemma for the telescoping term structure
lemma term_telescope (n k : ℕ) :
(n + 2^k) / 2^(k+1) = n / 2^k - n / 2^(k+1) := by
rw [pow_succ, ← Nat.div_div_eq_div_mul]
have h_pos : 0 < 2^k := pow_pos (by norm_num) k
rw [Nat.add_div_right n h_pos]
-- Use the identity (a + 1) / 2 = a - a / 2
have identity (a : ℕ) : (a + 1) / 2 = a - a / 2 := by omega
rw [identity]
rw [Nat.div_div_eq_div_mul, ← pow_succ]
/--
The answer is n. We pull this into a `determine` statement as required.
-/
abbrev n_ans (n : ℕ) : ℕ := n
theorem imo1968_p6 (n : ℕ) : ∑' k, (n + 2^k) / 2^(k+1) = n_ans n := by
-- Proof starts here. We first unfold the answer definition.
unfold n_ans
-- We truncate the sum at k_max = n + 1, since terms are zero afterwards.
let k_max := n + 1
have sum_eq_finite : ∑' k, (n + 2^k) / 2^(k+1) =
∑ k ∈ Finset.range k_max, (n + 2^k) / 2^(k+1) := by
apply tsum_eq_sum
intro k hk
simp only [Finset.mem_range, not_lt] at hk
apply Nat.div_eq_of_lt
calc
n + 2^k < 2^k + 2^k := by
apply add_lt_add_left
calc
n < 2^n := n.lt_two_pow_self
_ < 2^(n + 1) := Nat.pow_lt_pow_right (by norm_num) (by omega)
_ ≤ 2^k_max := le_refl _
_ ≤ 2^k := Nat.pow_le_pow_right (by norm_num) hk
_ = 2^(k+1) := by rw [pow_succ, mul_two]
rw [sum_eq_finite]
-- Rewrite the sum using the telescoping lemma
have sum_rewrite : ∑ k ∈ Finset.range k_max, (n + 2^k) / 2^(k+1) =
∑ k ∈ Finset.range k_max, (n / 2^k - n / 2^(k+1)) := by
apply Finset.sum_congr rfl
intro k hk
rw [term_telescope]
rw [sum_rewrite]
-- Prove the telescoping sum formula for natural numbers (requiring decreasing terms)
have telescoping (m : ℕ) : ∑ k ∈ Finset.range m, (n / 2^k - n / 2^(k+1)) = n - n / 2^m := by
induction m with
| zero => simp
| succ m hm =>
rw [Finset.sum_range_succ, hm, Nat.sub_add_sub_cancel]
· apply Nat.div_le_self
· gcongr
· norm_num
· norm_num
rw [telescoping k_max]
-- Show that the remainder term is zero
have term_vanish : n / 2^k_max = 0 := by
apply Nat.div_eq_of_lt
calc
n < 2^n := n.lt_two_pow_self
_ < 2^(n+1) := Nat.pow_lt_pow_right (by norm_num) (by omega)
rw [term_vanish, Nat.sub_zero]
end Imo1968P6
| true | Copyright (c) 2026 lean-tom. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: lean-tom (with assistance from Gemini)
-/
import Mathlib
/-!
# International Mathematical Olympiad 1968, Problem 6
For every natural number n, evaluate the sum
∑_{k=0}^{∞} [(n + 2^k) / 2^(k+1)]
where [x] denotes the greatest integer less than or equal to x.
-/
namespace Imo1968P6
-- Lemma for the telescoping term structure
lemma term_telescope (n k : ℕ) :
(n + 2^k) / 2^(k+1) = n / 2^k - n / 2^(k+1) := by
rw [pow_succ, ← Nat.div_div_eq_div_mul]
have h_pos : 0 < 2^k := pow_pos (by norm_num) k
rw [Nat.add_div_right n h_pos]
-- Use the identity (a + 1) / 2 = a - a / 2
have identity (a : ℕ) : (a + 1) / 2 = a - a / 2 := by omega
rw [identity]
rw [Nat.div_div_eq_div_mul, ← pow_succ]
/--
The answer is n. We pull this into a `determine` statement as required.
-/
abbrev n_ans (n : ℕ) : ℕ := n
theorem imo1968_p6 (n : ℕ) : ∑' k, (n + 2^k) / 2^(k+1) = n_ans n := by
-- Proof starts here. We first unfold the answer definition.
unfold n_ans
-- We truncate the sum at k_max = n + 1, since terms are zero afterwards.
let k_max := n + 1
have sum_eq_finite : ∑' k, (n + 2^k) / 2^(k+1) =
∑ k ∈ Finset.range k_max, (n + 2^k) / 2^(k+1) := by
apply tsum_eq_sum
intro k hk
simp only [Finset.mem_range, not_lt] at hk
apply Nat.div_eq_of_lt
calc
n + 2^k < 2^k + 2^k := by
apply add_lt_add_left
calc
n < 2^n := n.lt_two_pow_self
_ < 2^(n + 1) := Nat.pow_lt_pow_right (by norm_num) (by omega)
_ ≤ 2^k_max := le_refl _
_ ≤ 2^k := Nat.pow_le_pow_right (by norm_num) hk
_ = 2^(k+1) := by rw [pow_succ, mul_two]
rw [sum_eq_finite]
-- Rewrite the sum using the telescoping lemma
have sum_rewrite : ∑ k ∈ Finset.range k_max, (n + 2^k) / 2^(k+1) =
∑ k ∈ Finset.range k_max, (n / 2^k - n / 2^(k+1)) := by
apply Finset.sum_congr rfl
intro k hk
rw [term_telescope]
rw [sum_rewrite]
-- Prove the telescoping sum formula for natural numbers (requiring decreasing terms)
have telescoping (m : ℕ) : ∑ k ∈ Finset.range m, (n / 2^k - n / 2^(k+1)) = n - n / 2^m := by
induction m with
| zero => simp
| succ m hm =>
rw [Finset.sum_range_succ, hm, Nat.sub_add_sub_cancel]
· apply Nat.div_le_self
· gcongr
· norm_num
· norm_num
rw [telescoping k_max]
-- Show that the remainder term is zero
have term_vanish : n / 2^k_max = 0 := by
apply Nat.div_eq_of_lt
calc
n < 2^n := n.lt_two_pow_self
_ < 2^(n+1) := Nat.pow_lt_pow_right (by norm_num) (by omega)
rw [term_vanish, Nat.sub_zero]
end Imo1968P6 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1968P6.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unsolved goals\nn k : \u2115\nh_pos : 0 < 2 ^ k\na : \u2115\n\u22a2 (a + 1) / 2 = a - a / 2", "unsolved goals\nn k : \u2115\nh_pos : 0 < 2 ^ k\nidentity : \u2200 (a : \u2115), (a + 1) / 2 = a - a / 2\n\u22a2 (n / 2 ^ k + 1) / 2 = n / 2 ^ k - n / (2 ^ k * 2)", "unknown tactic", "tactic 'apply' failed, could not unify the conclusion of `@add_lt_add_left`\n ?a + ?b < ?a + ?c\nwith the goal\n n + 2 ^ k < 2 ^ k + 2 ^ k\n\nNote: The full type of `@add_lt_add_left` is\n \u2200 {\u03b1 : Type ?u.12276} [inst : Add \u03b1] [inst_1 : LT \u03b1] [AddLeftStrictMono \u03b1] {b c : \u03b1}, b < c \u2192 \u2200 (a : \u03b1), a + b < a + c\nn : \u2115\nk_max : \u2115 := n + 1\nk : \u2115\nhk : k_max \u2264 k\n\u22a2 n + 2 ^ k < 2 ^ k + 2 ^ k", "unsolved goals\ncase hf.h\u2080.calc.step\nn : \u2115\nk_max : \u2115 := n + 1\nk : \u2115\nhk : k_max \u2264 k\n\u22a2 2 ^ k + 2 ^ k < 2 ^ (k + 1)", "unsolved goals\nn : \u2115\nk_max : \u2115 := n + 1\nsum_eq_finite : \u2211' (k : \u2115), (n + 2 ^ k) / 2 ^ (k + 1) = \u2211 k \u2208 Finset.range k_max, (n + 2 ^ k) / 2 ^ (k + 1)\n\u22a2 \u2211' (k : \u2115), (n + 2 ^ k) / 2 ^ (k + 1) = n"], "timeout_s": 600.0, "latency_s": 0.1854, "verified_at": "2026-03-26T18:16:19.868211+00:00"}} | false | true | false | 0.1854 |
compfiles_Imo1969P1 | compfiles | Copyright (c) 2020 Kevin Lacker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Lacker
-/
import Mathlib
/-!
# International Mathematical Olympiad 1969, Problem 1
Prove that there are infinitely many natural numbers a with the following property:
the number z = n⁴ + a is not prime for any natural number n.
-/
open Int Nat
namespace Imo1969P1
/-- `goodNats` is the set of natural numbers satisfying the condition in the problem
statement, namely the `a : ℕ` such that `n^4 + a` is not prime for any `n : ℕ`. -/
def goodNats : Set ℕ :=
{a : ℕ | ∀ n : ℕ, ¬Nat.Prime (n ^ 4 + a)}
/--
The key to the solution is that you can factor $z$ into the product of two polynomials,
if $a = 4*m^4$. This is Sophie Germain's identity, called `pow_four_add_four_mul_pow_four`
in mathlib.
-/
theorem factorization {m n : ℤ} :
((n - m) ^ 2 + m ^ 2) * ((n + m) ^ 2 + m ^ 2) = n ^ 4 + 4 * m ^ 4 :=
pow_four_add_four_mul_pow_four.symm
/-
To show that the product is not prime, we need to show each of the factors is at least 2,
which `nlinarith` can solve since they are each expressed as a sum of squares.
-/
theorem left_factor_large {m : ℤ} (n : ℤ) (h : 1 < m) : 1 < (n - m) ^ 2 + m ^ 2 := by nlinarith
theorem right_factor_large {m : ℤ} (n : ℤ) (h : 1 < m) : 1 < (n + m) ^ 2 + m ^ 2 := by nlinarith
/-
The factorization is over the integers, but we need the nonprimality over the natural numbers.
-/
theorem int_large {m : ℤ} (h : 1 < m) : 1 < m.natAbs := by
exact_mod_cast lt_of_lt_of_le h le_natAbs
theorem not_prime_of_int_mul' {m n : ℤ} {c : ℕ} (hm : 1 < m) (hn : 1 < n) (hc : m * n = (c : ℤ)) :
¬Nat.Prime c :=
not_prime_of_int_mul (int_large hm).ne' (int_large hn).ne' hc
/-- Every natural number of the form `n^4 + 4*m^4` is not prime. -/
theorem polynomial_not_prime {m : ℕ} (h1 : 1 < m) (n : ℕ) : ¬Nat.Prime (n ^ 4 + 4 * m ^ 4) := by
have h2 : 1 < (m : ℤ) := Int.ofNat_lt.mpr h1
refine not_prime_of_int_mul' (left_factor_large (n : ℤ) h2) (right_factor_large (n : ℤ) h2) ?_
apply factorization
/-- We define $a_{choice}(b) := 4*(2+b)^4$, so that we can take $m = 2+b$ in `polynomial_not_prime`.
-/
def aChoice (b : ℕ) : ℕ := 4 * (2 + b) ^ 4
theorem aChoice_good (b : ℕ) : aChoice b ∈ goodNats :=
polynomial_not_prime (show 1 < 2 + b by omega)
/-- `aChoice` is a strictly monotone function; this is easily proven by chaining together lemmas
in the `strictMono` namespace. -/
theorem aChoice_strictMono : StrictMono aChoice :=
((strictMono_id.const_add 2).nat_pow (by decide)).const_mul (by decide)
/- We conclude by using the fact that `aChoice` is an injective function from the natural numbers
to the set `goodNats`. -/
theorem imo1969_p1 : Set.Infinite {a : ℕ | ∀ n : ℕ, ¬Nat.Prime (n ^ 4 + a)} :=
Set.infinite_of_injective_forall_mem aChoice_strictMono.injective aChoice_good
end Imo1969P1 | /- | /-
Copyright (c) 2020 Kevin Lacker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Lacker
-/
import Mathlib
/-!
# International Mathematical Olympiad 1969, Problem 1
Prove that there are infinitely many natural numbers a with the following property:
the number z = n⁴ + a is not prime for any natural number n.
-/
open Int Nat
namespace Imo1969P1
/-- `goodNats` is the set of natural numbers satisfying the condition in the problem
statement, namely the `a : ℕ` such that `n^4 + a` is not prime for any `n : ℕ`. -/
def goodNats : Set ℕ :=
{a : ℕ | ∀ n : ℕ, ¬Nat.Prime (n ^ 4 + a)}
/--
The key to the solution is that you can factor $z$ into the product of two polynomials,
if $a = 4*m^4$. This is Sophie Germain's identity, called `pow_four_add_four_mul_pow_four`
in mathlib.
-/
theorem factorization {m n : ℤ} :
((n - m) ^ 2 + m ^ 2) * ((n + m) ^ 2 + m ^ 2) = n ^ 4 + 4 * m ^ 4 :=
pow_four_add_four_mul_pow_four.symm
/-
To show that the product is not prime, we need to show each of the factors is at least 2,
which `nlinarith` can solve since they are each expressed as a sum of squares.
-/
theorem left_factor_large {m : ℤ} (n : ℤ) (h : 1 < m) : 1 < (n - m) ^ 2 + m ^ 2 := by nlinarith
theorem right_factor_large {m : ℤ} (n : ℤ) (h : 1 < m) : 1 < (n + m) ^ 2 + m ^ 2 := by nlinarith
/-
The factorization is over the integers, but we need the nonprimality over the natural numbers.
-/
theorem int_large {m : ℤ} (h : 1 < m) : 1 < m.natAbs := by
exact_mod_cast lt_of_lt_of_le h le_natAbs
theorem not_prime_of_int_mul' {m n : ℤ} {c : ℕ} (hm : 1 < m) (hn : 1 < n) (hc : m * n = (c : ℤ)) :
¬Nat.Prime c :=
not_prime_of_int_mul (int_large hm).ne' (int_large hn).ne' hc
/-- Every natural number of the form `n^4 + 4*m^4` is not prime. -/
theorem polynomial_not_prime {m : ℕ} (h1 : 1 < m) (n : ℕ) : ¬Nat.Prime (n ^ 4 + 4 * m ^ 4) := by
have h2 : 1 < (m : ℤ) := Int.ofNat_lt.mpr h1
refine not_prime_of_int_mul' (left_factor_large (n : ℤ) h2) (right_factor_large (n : ℤ) h2) ?_
apply factorization
/-- We define $a_{choice}(b) := 4*(2+b)^4$, so that we can take $m = 2+b$ in `polynomial_not_prime`.
-/
def aChoice (b : ℕ) : ℕ := 4 * (2 + b) ^ 4
theorem aChoice_good (b : ℕ) : aChoice b ∈ goodNats :=
polynomial_not_prime (show 1 < 2 + b by omega)
/-- `aChoice` is a strictly monotone function; this is easily proven by chaining together lemmas
in the `strictMono` namespace. -/
theorem aChoice_strictMono : StrictMono aChoice :=
((strictMono_id.const_add 2).nat_pow (by decide)).const_mul (by decide)
/- We conclude by using the fact that `aChoice` is an injective function from the natural numbers
to the set `goodNats`. -/
theorem imo1969_p1 : Set.Infinite {a : ℕ | ∀ n : ℕ, ¬Nat.Prime (n ^ 4 + a)} :=
Set.infinite_of_injective_forall_mem aChoice_strictMono.injective aChoice_good
end Imo1969P1
| true | Copyright (c) 2020 Kevin Lacker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Lacker
-/
import Mathlib
/-!
# International Mathematical Olympiad 1969, Problem 1
Prove that there are infinitely many natural numbers a with the following property:
the number z = n⁴ + a is not prime for any natural number n.
-/
open Int Nat
namespace Imo1969P1
/-- `goodNats` is the set of natural numbers satisfying the condition in the problem
statement, namely the `a : ℕ` such that `n^4 + a` is not prime for any `n : ℕ`. -/
def goodNats : Set ℕ :=
{a : ℕ | ∀ n : ℕ, ¬Nat.Prime (n ^ 4 + a)}
/--
The key to the solution is that you can factor $z$ into the product of two polynomials,
if $a = 4*m^4$. This is Sophie Germain's identity, called `pow_four_add_four_mul_pow_four`
in mathlib.
-/
theorem factorization {m n : ℤ} :
((n - m) ^ 2 + m ^ 2) * ((n + m) ^ 2 + m ^ 2) = n ^ 4 + 4 * m ^ 4 :=
pow_four_add_four_mul_pow_four.symm
/-
To show that the product is not prime, we need to show each of the factors is at least 2,
which `nlinarith` can solve since they are each expressed as a sum of squares.
-/
theorem left_factor_large {m : ℤ} (n : ℤ) (h : 1 < m) : 1 < (n - m) ^ 2 + m ^ 2 := by nlinarith
theorem right_factor_large {m : ℤ} (n : ℤ) (h : 1 < m) : 1 < (n + m) ^ 2 + m ^ 2 := by nlinarith
/-
The factorization is over the integers, but we need the nonprimality over the natural numbers.
-/
theorem int_large {m : ℤ} (h : 1 < m) : 1 < m.natAbs := by
exact_mod_cast lt_of_lt_of_le h le_natAbs
theorem not_prime_of_int_mul' {m n : ℤ} {c : ℕ} (hm : 1 < m) (hn : 1 < n) (hc : m * n = (c : ℤ)) :
¬Nat.Prime c :=
not_prime_of_int_mul (int_large hm).ne' (int_large hn).ne' hc
/-- Every natural number of the form `n^4 + 4*m^4` is not prime. -/
theorem polynomial_not_prime {m : ℕ} (h1 : 1 < m) (n : ℕ) : ¬Nat.Prime (n ^ 4 + 4 * m ^ 4) := by
have h2 : 1 < (m : ℤ) := Int.ofNat_lt.mpr h1
refine not_prime_of_int_mul' (left_factor_large (n : ℤ) h2) (right_factor_large (n : ℤ) h2) ?_
apply factorization
/-- We define $a_{choice}(b) := 4*(2+b)^4$, so that we can take $m = 2+b$ in `polynomial_not_prime`.
-/
def aChoice (b : ℕ) : ℕ := 4 * (2 + b) ^ 4
theorem aChoice_good (b : ℕ) : aChoice b ∈ goodNats :=
polynomial_not_prime (show 1 < 2 + b by omega)
/-- `aChoice` is a strictly monotone function; this is easily proven by chaining together lemmas
in the `strictMono` namespace. -/
theorem aChoice_strictMono : StrictMono aChoice :=
((strictMono_id.const_add 2).nat_pow (by decide)).const_mul (by decide)
/- We conclude by using the fact that `aChoice` is an injective function from the natural numbers
to the set `goodNats`. -/
theorem imo1969_p1 : Set.Infinite {a : ℕ | ∀ n : ℕ, ¬Nat.Prime (n ^ 4 + a)} :=
Set.infinite_of_injective_forall_mem aChoice_strictMono.injective aChoice_good
end Imo1969P1 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1969P1.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown identifier 'le_natAbs'", "mod_cast has type\n (1 : \u2124) < ?m.11843 : Prop\nbut is expected to have type\n (1 : \u2115) < m.natAbs : Prop", "unknown identifier 'not_prime_of_int_mul'", "unknown tactic", "unsolved goals\nb : \u2115\n\u22a2 1 < 2 + b"], "timeout_s": 600.0, "latency_s": 0.6132, "verified_at": "2026-03-26T18:16:20.481545+00:00"}} | false | true | false | 0.6132 |
compfiles_Imo1969P2 | compfiles | Copyright (c) 2023 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1969, Problem 2
Let a₁, a₂, ..., aₙ be real constants, x be a real variable, and
f(x) = cos(a₁ + x) + (1/2)cos(a₂ + x) + (1/4)cos(a₃ + x) + ...
+ (1/2ⁿ⁻¹)cos(aₙ + x).
Given that f(x₁) = f(x₂) = 0 for some x₁, x₂, prove that
x₂ - x₁ = mπ for some integer m.
-/
namespace Imo1969P2
open scoped Real
theorem imo1969_p2
(x₁ x₂ : ℝ)
(n : ℕ)
(a : ℕ → ℝ)
(f : ℝ → ℝ)
(h₁ : ∀ x, f x = ∑ i ∈ Finset.range n, (Real.cos (a i + x)) / (2^i))
(h₂ : f x₂ = 0)
(h₃ : f x₁ = 0)
(h₄: ∑ i ∈ Finset.range n, (Real.cos (a i) / (2 ^ i)) ≠ 0) :
∃ m : ℤ, x₂ - x₁ = m * π := by
let Ccos := ∑ i ∈ Finset.range n, (Real.cos (a i) / (2 ^ i))
let Csin := ∑ i ∈ Finset.range n, (Real.sin (a i) / (2 ^ i))
have hCcos: Ccos = ∑ i ∈ Finset.range n, (Real.cos (a i) / (2 ^ i)) := rfl
have hCsin: Csin = ∑ i ∈ Finset.range n, (Real.sin (a i) / (2 ^ i)) := rfl
have h₅: ∀ x, f x = Ccos * Real.cos x - Csin * Real.sin x := by
intro x
rw [h₁ x]
have h₅₀: ∑ i ∈ Finset.range n, (Real.cos (a i + x) / 2 ^ i)
= ∑ i ∈ Finset.range n,
(((Real.cos (a i) * Real.cos (x) - Real.sin (a i) * Real.sin (x)) / (2^i))) := by
refine Finset.sum_congr (by rfl) ?_
intro i _
rw [Real.cos_add]
rw [h₅₀]
ring_nf
rw [Finset.sum_sub_distrib]
have h₅₂: ∑ i ∈ Finset.range n, Real.cos (a i) * Real.cos x * (2⁻¹) ^ i
= ∑ i ∈ Finset.range n, (Real.cos (a i) * (2⁻¹) ^ i) * Real.cos x := by
refine Finset.sum_congr (by rfl) ?_
intro i _
ring
have h₅₃: ∑ x_1 ∈ Finset.range n, Real.sin (a x_1) * Real.sin x * (2⁻¹) ^ x_1
= ∑ x_1 ∈ Finset.range n, ((Real.sin (a x_1) * (2⁻¹) ^ x_1) * Real.sin x) := by
refine Finset.sum_congr (by rfl) ?_
intro i _
ring
rw [h₅₂, ← Finset.sum_mul _ _ (Real.cos x)]
rw [h₅₃, ← Finset.sum_mul _ _ (Real.sin x)]
ring_nf at hCcos
ring_nf at hCsin
rw [hCcos, hCsin]
ring
have h₆: (∃ x, (f x = 0 ∧ Real.cos x = 0)) → ∀ y, f y = Ccos * Real.cos y := by
intro g₀
obtain ⟨x, hx₀, hx₁⟩ := g₀
have g₁: ∑ i ∈ Finset.range n, (Real.sin (a i) / (2 ^ i)) = 0 := by
rw [h₅ x, hx₁] at hx₀
simp at hx₀
obtain hx₂ | hx₃ := hx₀
· exact hx₂
· exfalso
apply Real.sin_eq_zero_iff_cos_eq.mp at hx₃
obtain hx₃ | hx₄ := hx₃
· linarith
· linarith
intro y
rw [h₅ y]
have g₂: Csin = 0 := by linarith
rw [g₂, zero_mul]
exact sub_zero (Ccos * Real.cos y)
by_cases hmn: (Real.cos x₂ = 0) ∨ (Real.cos x₁ = 0)
· have h₇: ∀ (x : ℝ), f x = Ccos * Real.cos x := by
refine h₆ ?_
obtain hm | hn := hmn
· use x₂
· use x₁
have h₈: ∀ x, f x = 0 → Real.cos x = 0 := by
intro x hx₀
rw [h₇ x] at hx₀
refine eq_zero_of_ne_zero_of_mul_left_eq_zero ?_ hx₀
exact h₄
have hm₀: ∃ t:ℤ , x₂ = (2 * ↑ t + 1) * π / 2 := by
refine Real.cos_eq_zero_iff.mp ?_
exact h₈ x₂ h₂
have hn₀: ∃ t:ℤ , x₁ = (2 * ↑ t + 1) * π / 2 := by
refine Real.cos_eq_zero_iff.mp ?_
exact h₈ x₁ h₃
obtain ⟨tm, hm₁⟩ := hm₀
obtain ⟨tn, hn₁⟩ := hn₀
rw [hm₁, hn₁]
use (tm - tn)
rw [Int.cast_sub]
ring_nf
· push_neg at hmn
have h₇: Real.tan x₂ = Real.tan x₁ := by
have h₇₀: ∀ (x:ℝ), (f x = 0 ∧ Real.cos x ≠ 0) → Real.tan x = Ccos / Csin := by
intro x hx₀
rw [Real.tan_eq_sin_div_cos]
symm
refine (div_eq_div_iff ?_ ?_).mp ?_
· simp
exact hx₀.2
· grind
· rw [h₅ x, sub_eq_zero] at hx₀
simp only [div_inv_eq_mul, mul_comm (Real.sin x) _]
exact hx₀.1
have h₇₁: Real.tan x₂ = Ccos / Csin := h₇₀ x₂ ⟨h₂, hmn.1⟩
have h₇₂: Real.tan x₁ = Ccos / Csin := h₇₀ x₁ ⟨h₃, hmn.2⟩
rw [h₇₁, h₇₂]
have h₈: Real.sin (x₂ - x₁) = 0 := by
have h₈₂: Real.sin (x₂ - x₁) / (Real.cos x₂ * Real.cos x₁) = 0 := by
rw [Real.sin_sub]
rw [← div_sub_div (Real.sin x₂) (Real.sin x₁) hmn.1 hmn.2]
simp only [← Real.tan_eq_sin_div_cos]
exact sub_eq_zero_of_eq h₇
have h_nonzero : Real.cos x₂ * Real.cos x₁ ≠ 0 := mul_ne_zero hmn.1 hmn.2
rw [div_eq_zero_iff, or_iff_left h_nonzero] at h₈₂
exact h₈₂
apply Real.sin_eq_zero_iff.mp at h₈
let ⟨t, ht⟩ := h₈
use t
exact ht.symm
end Imo1969P2 | /- | /-
Copyright (c) 2023 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1969, Problem 2
Let a₁, a₂, ..., aₙ be real constants, x be a real variable, and
f(x) = cos(a₁ + x) + (1/2)cos(a₂ + x) + (1/4)cos(a₃ + x) + ...
+ (1/2ⁿ⁻¹)cos(aₙ + x).
Given that f(x₁) = f(x₂) = 0 for some x₁, x₂, prove that
x₂ - x₁ = mπ for some integer m.
-/
namespace Imo1969P2
open scoped Real
theorem imo1969_p2
(x₁ x₂ : ℝ)
(n : ℕ)
(a : ℕ → ℝ)
(f : ℝ → ℝ)
(h₁ : ∀ x, f x = ∑ i ∈ Finset.range n, (Real.cos (a i + x)) / (2^i))
(h₂ : f x₂ = 0)
(h₃ : f x₁ = 0)
(h₄: ∑ i ∈ Finset.range n, (Real.cos (a i) / (2 ^ i)) ≠ 0) :
∃ m : ℤ, x₂ - x₁ = m * π := by
let Ccos := ∑ i ∈ Finset.range n, (Real.cos (a i) / (2 ^ i))
let Csin := ∑ i ∈ Finset.range n, (Real.sin (a i) / (2 ^ i))
have hCcos: Ccos = ∑ i ∈ Finset.range n, (Real.cos (a i) / (2 ^ i)) := rfl
have hCsin: Csin = ∑ i ∈ Finset.range n, (Real.sin (a i) / (2 ^ i)) := rfl
have h₅: ∀ x, f x = Ccos * Real.cos x - Csin * Real.sin x := by
intro x
rw [h₁ x]
have h₅₀: ∑ i ∈ Finset.range n, (Real.cos (a i + x) / 2 ^ i)
= ∑ i ∈ Finset.range n,
(((Real.cos (a i) * Real.cos (x) - Real.sin (a i) * Real.sin (x)) / (2^i))) := by
refine Finset.sum_congr (by rfl) ?_
intro i _
rw [Real.cos_add]
rw [h₅₀]
ring_nf
rw [Finset.sum_sub_distrib]
have h₅₂: ∑ i ∈ Finset.range n, Real.cos (a i) * Real.cos x * (2⁻¹) ^ i
= ∑ i ∈ Finset.range n, (Real.cos (a i) * (2⁻¹) ^ i) * Real.cos x := by
refine Finset.sum_congr (by rfl) ?_
intro i _
ring
have h₅₃: ∑ x_1 ∈ Finset.range n, Real.sin (a x_1) * Real.sin x * (2⁻¹) ^ x_1
= ∑ x_1 ∈ Finset.range n, ((Real.sin (a x_1) * (2⁻¹) ^ x_1) * Real.sin x) := by
refine Finset.sum_congr (by rfl) ?_
intro i _
ring
rw [h₅₂, ← Finset.sum_mul _ _ (Real.cos x)]
rw [h₅₃, ← Finset.sum_mul _ _ (Real.sin x)]
ring_nf at hCcos
ring_nf at hCsin
rw [hCcos, hCsin]
ring
have h₆: (∃ x, (f x = 0 ∧ Real.cos x = 0)) → ∀ y, f y = Ccos * Real.cos y := by
intro g₀
obtain ⟨x, hx₀, hx₁⟩ := g₀
have g₁: ∑ i ∈ Finset.range n, (Real.sin (a i) / (2 ^ i)) = 0 := by
rw [h₅ x, hx₁] at hx₀
simp at hx₀
obtain hx₂ | hx₃ := hx₀
· exact hx₂
· exfalso
apply Real.sin_eq_zero_iff_cos_eq.mp at hx₃
obtain hx₃ | hx₄ := hx₃
· linarith
· linarith
intro y
rw [h₅ y]
have g₂: Csin = 0 := by linarith
rw [g₂, zero_mul]
exact sub_zero (Ccos * Real.cos y)
by_cases hmn: (Real.cos x₂ = 0) ∨ (Real.cos x₁ = 0)
· have h₇: ∀ (x : ℝ), f x = Ccos * Real.cos x := by
refine h₆ ?_
obtain hm | hn := hmn
· use x₂
· use x₁
have h₈: ∀ x, f x = 0 → Real.cos x = 0 := by
intro x hx₀
rw [h₇ x] at hx₀
refine eq_zero_of_ne_zero_of_mul_left_eq_zero ?_ hx₀
exact h₄
have hm₀: ∃ t:ℤ , x₂ = (2 * ↑ t + 1) * π / 2 := by
refine Real.cos_eq_zero_iff.mp ?_
exact h₈ x₂ h₂
have hn₀: ∃ t:ℤ , x₁ = (2 * ↑ t + 1) * π / 2 := by
refine Real.cos_eq_zero_iff.mp ?_
exact h₈ x₁ h₃
obtain ⟨tm, hm₁⟩ := hm₀
obtain ⟨tn, hn₁⟩ := hn₀
rw [hm₁, hn₁]
use (tm - tn)
rw [Int.cast_sub]
ring_nf
· push_neg at hmn
have h₇: Real.tan x₂ = Real.tan x₁ := by
have h₇₀: ∀ (x:ℝ), (f x = 0 ∧ Real.cos x ≠ 0) → Real.tan x = Ccos / Csin := by
intro x hx₀
rw [Real.tan_eq_sin_div_cos]
symm
refine (div_eq_div_iff ?_ ?_).mp ?_
· simp
exact hx₀.2
· grind
· rw [h₅ x, sub_eq_zero] at hx₀
simp only [div_inv_eq_mul, mul_comm (Real.sin x) _]
exact hx₀.1
have h₇₁: Real.tan x₂ = Ccos / Csin := h₇₀ x₂ ⟨h₂, hmn.1⟩
have h₇₂: Real.tan x₁ = Ccos / Csin := h₇₀ x₁ ⟨h₃, hmn.2⟩
rw [h₇₁, h₇₂]
have h₈: Real.sin (x₂ - x₁) = 0 := by
have h₈₂: Real.sin (x₂ - x₁) / (Real.cos x₂ * Real.cos x₁) = 0 := by
rw [Real.sin_sub]
rw [← div_sub_div (Real.sin x₂) (Real.sin x₁) hmn.1 hmn.2]
simp only [← Real.tan_eq_sin_div_cos]
exact sub_eq_zero_of_eq h₇
have h_nonzero : Real.cos x₂ * Real.cos x₁ ≠ 0 := mul_ne_zero hmn.1 hmn.2
rw [div_eq_zero_iff, or_iff_left h_nonzero] at h₈₂
exact h₈₂
apply Real.sin_eq_zero_iff.mp at h₈
let ⟨t, ht⟩ := h₈
use t
exact ht.symm
end Imo1969P2
| true | Copyright (c) 2023 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1969, Problem 2
Let a₁, a₂, ..., aₙ be real constants, x be a real variable, and
f(x) = cos(a₁ + x) + (1/2)cos(a₂ + x) + (1/4)cos(a₃ + x) + ...
+ (1/2ⁿ⁻¹)cos(aₙ + x).
Given that f(x₁) = f(x₂) = 0 for some x₁, x₂, prove that
x₂ - x₁ = mπ for some integer m.
-/
namespace Imo1969P2
open scoped Real
theorem imo1969_p2
(x₁ x₂ : ℝ)
(n : ℕ)
(a : ℕ → ℝ)
(f : ℝ → ℝ)
(h₁ : ∀ x, f x = ∑ i ∈ Finset.range n, (Real.cos (a i + x)) / (2^i))
(h₂ : f x₂ = 0)
(h₃ : f x₁ = 0)
(h₄: ∑ i ∈ Finset.range n, (Real.cos (a i) / (2 ^ i)) ≠ 0) :
∃ m : ℤ, x₂ - x₁ = m * π := by
let Ccos := ∑ i ∈ Finset.range n, (Real.cos (a i) / (2 ^ i))
let Csin := ∑ i ∈ Finset.range n, (Real.sin (a i) / (2 ^ i))
have hCcos: Ccos = ∑ i ∈ Finset.range n, (Real.cos (a i) / (2 ^ i)) := rfl
have hCsin: Csin = ∑ i ∈ Finset.range n, (Real.sin (a i) / (2 ^ i)) := rfl
have h₅: ∀ x, f x = Ccos * Real.cos x - Csin * Real.sin x := by
intro x
rw [h₁ x]
have h₅₀: ∑ i ∈ Finset.range n, (Real.cos (a i + x) / 2 ^ i)
= ∑ i ∈ Finset.range n,
(((Real.cos (a i) * Real.cos (x) - Real.sin (a i) * Real.sin (x)) / (2^i))) := by
refine Finset.sum_congr (by rfl) ?_
intro i _
rw [Real.cos_add]
rw [h₅₀]
ring_nf
rw [Finset.sum_sub_distrib]
have h₅₂: ∑ i ∈ Finset.range n, Real.cos (a i) * Real.cos x * (2⁻¹) ^ i
= ∑ i ∈ Finset.range n, (Real.cos (a i) * (2⁻¹) ^ i) * Real.cos x := by
refine Finset.sum_congr (by rfl) ?_
intro i _
ring
have h₅₃: ∑ x_1 ∈ Finset.range n, Real.sin (a x_1) * Real.sin x * (2⁻¹) ^ x_1
= ∑ x_1 ∈ Finset.range n, ((Real.sin (a x_1) * (2⁻¹) ^ x_1) * Real.sin x) := by
refine Finset.sum_congr (by rfl) ?_
intro i _
ring
rw [h₅₂, ← Finset.sum_mul _ _ (Real.cos x)]
rw [h₅₃, ← Finset.sum_mul _ _ (Real.sin x)]
ring_nf at hCcos
ring_nf at hCsin
rw [hCcos, hCsin]
ring
have h₆: (∃ x, (f x = 0 ∧ Real.cos x = 0)) → ∀ y, f y = Ccos * Real.cos y := by
intro g₀
obtain ⟨x, hx₀, hx₁⟩ := g₀
have g₁: ∑ i ∈ Finset.range n, (Real.sin (a i) / (2 ^ i)) = 0 := by
rw [h₅ x, hx₁] at hx₀
simp at hx₀
obtain hx₂ | hx₃ := hx₀
· exact hx₂
· exfalso
apply Real.sin_eq_zero_iff_cos_eq.mp at hx₃
obtain hx₃ | hx₄ := hx₃
· linarith
· linarith
intro y
rw [h₅ y]
have g₂: Csin = 0 := by linarith
rw [g₂, zero_mul]
exact sub_zero (Ccos * Real.cos y)
by_cases hmn: (Real.cos x₂ = 0) ∨ (Real.cos x₁ = 0)
· have h₇: ∀ (x : ℝ), f x = Ccos * Real.cos x := by
refine h₆ ?_
obtain hm | hn := hmn
· use x₂
· use x₁
have h₈: ∀ x, f x = 0 → Real.cos x = 0 := by
intro x hx₀
rw [h₇ x] at hx₀
refine eq_zero_of_ne_zero_of_mul_left_eq_zero ?_ hx₀
exact h₄
have hm₀: ∃ t:ℤ , x₂ = (2 * ↑ t + 1) * π / 2 := by
refine Real.cos_eq_zero_iff.mp ?_
exact h₈ x₂ h₂
have hn₀: ∃ t:ℤ , x₁ = (2 * ↑ t + 1) * π / 2 := by
refine Real.cos_eq_zero_iff.mp ?_
exact h₈ x₁ h₃
obtain ⟨tm, hm₁⟩ := hm₀
obtain ⟨tn, hn₁⟩ := hn₀
rw [hm₁, hn₁]
use (tm - tn)
rw [Int.cast_sub]
ring_nf
· push_neg at hmn
have h₇: Real.tan x₂ = Real.tan x₁ := by
have h₇₀: ∀ (x:ℝ), (f x = 0 ∧ Real.cos x ≠ 0) → Real.tan x = Ccos / Csin := by
intro x hx₀
rw [Real.tan_eq_sin_div_cos]
symm
refine (div_eq_div_iff ?_ ?_).mp ?_
· simp
exact hx₀.2
· grind
· rw [h₅ x, sub_eq_zero] at hx₀
simp only [div_inv_eq_mul, mul_comm (Real.sin x) _]
exact hx₀.1
have h₇₁: Real.tan x₂ = Ccos / Csin := h₇₀ x₂ ⟨h₂, hmn.1⟩
have h₇₂: Real.tan x₁ = Ccos / Csin := h₇₀ x₁ ⟨h₃, hmn.2⟩
rw [h₇₁, h₇₂]
have h₈: Real.sin (x₂ - x₁) = 0 := by
have h₈₂: Real.sin (x₂ - x₁) / (Real.cos x₂ * Real.cos x₁) = 0 := by
rw [Real.sin_sub]
rw [← div_sub_div (Real.sin x₂) (Real.sin x₁) hmn.1 hmn.2]
simp only [← Real.tan_eq_sin_div_cos]
exact sub_eq_zero_of_eq h₇
have h_nonzero : Real.cos x₂ * Real.cos x₁ ≠ 0 := mul_ne_zero hmn.1 hmn.2
rw [div_eq_zero_iff, or_iff_left h_nonzero] at h₈₂
exact h₈₂
apply Real.sin_eq_zero_iff.mp at h₈
let ⟨t, ht⟩ := h₈
use t
exact ht.symm
end Imo1969P2 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1969P2.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["`grind` failed\ncase grind.1.2.1.1\nx\u2081 x\u2082 : \u211d\nn : \u2115\na : \u2115 \u2192 \u211d\nf : \u211d \u2192 \u211d\nh\u2081 : \u2200 (x : \u211d), f x = \u2211 i \u2208 Finset.range n, Real.cos (a i + x) / 2 ^ i\nh\u2082 : f x\u2082 = 0\nh\u2083 : f x\u2081 = 0\nh\u2084 : \u00ac\u2211 i \u2208 Finset.range n, Real.cos (a i) / 2 ^ i = 0\nh\u2085 :\n \u2200 (x : \u211d),\n f x =\n (\u2211 i \u2208 Finset.range n, Real.cos (a i) / 2 ^ i) * Real.cos x -\n (\u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i) * Real.sin x\nh\u2086 : (\u2203 x, f x = 0 \u2227 Real.cos x = 0) \u2192 \u2200 (y : \u211d), f y = (\u2211 i \u2208 Finset.range n, Real.cos (a i) / 2 ^ i) * Real.cos y\nleft : \u00acReal.cos x\u2082 = 0\nright : \u00acReal.cos x\u2081 = 0\nx : \u211d\nleft_1 : f x = 0\nright_1 : \u00acReal.cos x = 0\nh : (\u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i)\u207b\u00b9 = 0\nh_1 : (fun i => Real.sin (a i) / 2 ^ i) = fun i => Real.cos (a i) / 2 ^ i\nh_2 : \u00ac(fun i => Real.cos (a i + x\u2082) / 2 ^ i) = fun i => Real.sin (a i) / 2 ^ i\nh_3 : (fun i => Real.cos (a i + x\u2082) / 2 ^ i) = fun i => Real.cos (a i + x) / 2 ^ i\nh_4 : (fun i => Real.cos (a i + x\u2082) / 2 ^ i) = fun i => Real.cos (a i + x\u2081) / 2 ^ i\nw : \u2115\nh_5 : \u00acReal.cos (a w + x\u2081) / 2 ^ w = Real.cos (a w) / 2 ^ w\nw_1 : \u2115\nh_6 : \u00acReal.cos (a w_1 + x\u2081) / 2 ^ w_1 = Real.sin (a w_1) / 2 ^ w_1\nw_2 : \u2115\nh_7 : \u00acReal.cos (a w_2 + x) / 2 ^ w_2 = Real.sin (a w_2) / 2 ^ w_2\nw_3 : \u2115\nh_8 : \u00acReal.cos (a w_3 + x\u2082) / 2 ^ w_3 = Real.cos (a w_3) / 2 ^ w_3\nw_4 : \u2115\nh_9 : \u00acReal.cos (a w_4 + x\u2082) / 2 ^ w_4 = Real.sin (a w_4) / 2 ^ w_4\nw_5 : \u2115\nh_10 : \u00acReal.cos (a w_5 + x) / 2 ^ w_5 = Real.cos (a w_5) / 2 ^ w_5\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] \u2200 (x : \u211d), f x = \u2211 i \u2208 Finset.range n, Real.cos (a i + x) / 2 ^ i\n [prop] f x\u2082 = 0\n [prop] f x\u2081 = 0\n [prop] \u00ac\u2211 i \u2208 Finset.range n, Real.cos (a i) / 2 ^ i = 0\n [prop] \u2200 (x : \u211d),\n f x =\n (\u2211 i \u2208 Finset.range n, Real.cos (a i) / 2 ^ i) * Real.cos x -\n (\u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i) * Real.sin x\n [prop] (\u2203 x, f x = 0 \u2227 Real.cos x = 0) \u2192\n \u2200 (y : \u211d), f y = (\u2211 i \u2208 Finset.range n, Real.cos (a i) / 2 ^ i) * Real.cos y\n [prop] \u00acReal.cos x\u2082 = 0\n [prop] \u00acReal.cos x\u2081 = 0\n [prop] f x = 0\n [prop] \u00acReal.cos x = 0\n [prop] (\u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i)\u207b\u00b9 = 0\n [prop] f x = \u2211 i \u2208 Finset.range n, Real.cos (a i + x) / 2 ^ i\n [prop] f x\u2081 = \u2211 i \u2208 Finset.range n, Real.cos (a i + x\u2081) / 2 ^ i\n [prop] f x\u2082 = \u2211 i \u2208 Finset.range n, Real.cos (a i + x\u2082) / 2 ^ i\n [prop] f x =\n (\u2211 i \u2208 Finset.range n, Real.cos (a i) / 2 ^ i) * Real.cos x -\n (\u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i) * Real.sin x\n [prop] f x\u2081 =\n (\u2211 i \u2208 Finset.range n, Real.cos (a i) / 2 ^ i) * Real.cos x\u2081 -\n (\u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i) * Real.sin x\u2081\n [prop] f x\u2082 =\n (\u2211 i \u2208 Finset.range n, Real.cos (a i) / 2 ^ i) * Real.cos x\u2082 -\n (\u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i) * Real.sin x\u2082\n [prop] (fun i => Real.sin (a i) / 2 ^ i) = fun i => Real.cos (a i) / 2 ^ i\n [prop] \u00ac(fun i => Real.cos (a i + x\u2082) / 2 ^ i) = fun i => Real.sin (a i) / 2 ^ i\n [prop] \u2203 x, \u00acReal.cos (a x + x\u2082) / 2 ^ x = Real.cos (a x) / 2 ^ x\n [prop] \u2203 x, \u00acReal.cos (a x + x\u2082) / 2 ^ x = Real.sin (a x) / 2 ^ x\n [prop] (fun i => Real.cos (a i + x\u2082) / 2 ^ i) = fun i => Real.cos (a i + x) / 2 ^ i\n [prop] \u2203 x_1, \u00acReal.cos (a x_1 + x) / 2 ^ x_1 = Real.sin (a x_1) / 2 ^ x_1\n [prop] \u2203 x_1, \u00acReal.cos (a x_1 + x) / 2 ^ x_1 = Real.cos (a x_1) / 2 ^ x_1\n [prop] (fun i => Real.cos (a i + x\u2082) / 2 ^ i) = fun i => Real.cos (a i + x\u2081) / 2 ^ i\n [prop] \u2203 x, \u00acReal.cos (a x + x\u2081) / 2 ^ x = Real.sin (a x) / 2 ^ x\n [prop] \u2203 x, \u00acReal.cos (a x + x\u2081) / 2 ^ x = Real.cos (a x) / 2 ^ x\n [prop] \u00acReal.cos (a w + x\u2081) / 2 ^ w = Real.cos (a w) / 2 ^ w\n [prop] \u00acReal.cos (a w_1 + x\u2081) / 2 ^ w_1 = Real.sin (a w_1) / 2 ^ w_1\n [prop] \u00acReal.cos (a w_2 + x) / 2 ^ w_2 = Real.sin (a w_2) / 2 ^ w_2\n [prop] \u00acReal.cos (a w_3 + x\u2082) / 2 ^ w_3 = Real.cos (a w_3) / 2 ^ w_3\n [prop] \u00acReal.cos (a w_4 + x\u2082) / 2 ^ w_4 = Real.sin (a w_4) / 2 ^ w_4\n [prop] \u00acReal.cos (a w_5 + x) / 2 ^ w_5 = Real.cos (a w_5) / 2 ^ w_5\n [eqc] True propositions\n [prop] \u2200 (x : \u211d), f x = \u2211 i \u2208 Finset.range n, Real.cos (a i + x) / 2 ^ i\n [prop] \u2200 (x : \u211d),\n f x =\n (\u2211 i \u2208 Finset.range n, Real.cos (a i) / 2 ^ i) * Real.cos x -\n (\u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i) * Real.sin x\n [prop] (\u2203 x, f x = 0 \u2227 Real.cos x = 0) \u2192\n \u2200 (y : \u211d), f y = (\u2211 i \u2208 Finset.range n, Real.cos (a i) / 2 ^ i) * Real.cos y\n [prop] (fun i => Real.sin (a i) / 2 ^ i) = fun i => Real.cos (a i) / 2 ^ i\n [prop] \u2203 x, \u00acReal.cos (a x + x\u2082) / 2 ^ x = Real.cos (a x) / 2 ^ x\n [prop] \u2203 x, \u00acReal.cos (a x + x\u2082) / 2 ^ x = Real.sin (a x) / 2 ^ x\n [prop] (fun i => Real.cos (a i + x\u2082) / 2 ^ i) = fun i => Real.cos (a i + x) / 2 ^ i\n [prop] \u2203 x_1, \u00acReal.cos (a x_1 + x) / 2 ^ x_1 = Real.sin (a x_1) / 2 ^ x_1\n [prop] \u2203 x_1, \u00acReal.cos (a x_1 + x) / 2 ^ x_1 = Real.cos (a x_1) / 2 ^ x_1\n [prop] (fun i => Real.cos (a i + x\u2081) / 2 ^ i) = fun i => Real.cos (a i + x) / 2 ^ i\n [prop] (fun i => Real.cos (a i + x\u2082) / 2 ^ i) = fun i => Real.cos (a i + x\u2081) / 2 ^ i\n [prop] \u2203 x, \u00acReal.cos (a x + x\u2081) / 2 ^ x = Real.sin (a x) / 2 ^ x\n [prop] \u2203 x, \u00acReal.cos (a x + x\u2081) / 2 ^ x = Real.cos (a x) / 2 ^ x\n [prop] (0 + 2).AtLeastTwo\n [eqc] False propositions\n [prop] \u2211 i \u2208 Finset.range n, Real.cos (a i) / 2 ^ i = 0\n [prop] Real.cos x\u2082 = 0\n [prop] Real.cos x\u2081 = 0\n [prop] Real.cos x = 0\n [prop] (fun i => Real.cos (a i + x\u2082) / 2 ^ i) = fun i => Real.cos (a i) / 2 ^ i\n [prop] (fun i => Real.cos (a i + x\u2082) / 2 ^ i) = fun i => Real.sin (a i) / 2 ^ i\n [prop] (fun i => Real.cos (a i + x) / 2 ^ i) = fun i => Real.cos (a i) / 2 ^ i\n [prop] (fun i => Real.cos (a i + x) / 2 ^ i) = fun i => Real.sin (a i) / 2 ^ i\n [prop] (fun i => Real.cos (a i + x\u2081) / 2 ^ i) = fun i => Real.cos (a i) / 2 ^ i\n [prop] (fun i => Real.cos (a i + x\u2081) / 2 ^ i) = fun i => Real.sin (a i) / 2 ^ i\n [prop] Real.cos (a w + x\u2081) / 2 ^ w = Real.cos (a w) / 2 ^ w\n [prop] Real.cos (a w_1 + x\u2081) / 2 ^ w_1 = Real.sin (a w_1) / 2 ^ w_1\n [prop] Real.cos (a w_2 + x) / 2 ^ w_2 = Real.sin (a w_2) / 2 ^ w_2\n [prop] Real.cos (a w_3 + x\u2082) / 2 ^ w_3 = Real.cos (a w_3) / 2 ^ w_3\n [prop] Real.cos (a w_4 + x\u2082) / 2 ^ w_4 = Real.sin (a w_4) / 2 ^ w_4\n [prop] Real.cos (a w_5 + x) / 2 ^ w_5 = Real.cos (a w_5) / 2 ^ w_5\n [eqc] Equivalence classes\n [eqc] {Eq fun i => Real.cos (a i + x\u2082) / 2 ^ i,\n Eq fun i => Real.cos (a i + x\u2081) / 2 ^ i,\n Eq fun i => Real.cos (a i + x) / 2 ^ i}\n [eqc] {fun i => Real.cos (a i + x\u2082) / 2 ^ i,\n fun i => Real.cos (a i + x\u2081) / 2 ^ i,\n fun i => Real.cos (a i + x) / 2 ^ i}\n [eqc] {fun i => Real.cos (a i + x\u2082) / 2 ^ i,\n fun i => Real.cos (a i + x\u2081) / 2 ^ i,\n fun i => Real.cos (a i + x) / 2 ^ i}\n [eqc] {fun i => Real.sin (a i) / 2 ^ i, fun i => Real.cos (a i) / 2 ^ i}\n [eqc] {\u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i, \u2211 i \u2208 Finset.range n, Real.cos (a i) / 2 ^ i}\n [eqc] {f x\u2082,\n f x\u2081,\n f x,\n (\u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i)\u207b\u00b9,\n \u2211 i \u2208 Finset.range n, Real.cos (a i + x) / 2 ^ i,\n \u2211 i \u2208 Finset.range n, Real.cos (a i + x\u2081) / 2 ^ i,\n \u2211 i \u2208 Finset.range n, Real.cos (a i + x\u2082) / 2 ^ i,\n (\u2211 i \u2208 Finset.range n, Real.cos (a i) / 2 ^ i) * Real.cos x -\n (\u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i) * Real.sin x,\n (\u2211 i \u2208 Finset.range n, Real.cos (a i) / 2 ^ i) * Real.cos x\u2081 -\n (\u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i) * Real.sin x\u2081,\n (\u2211 i \u2208 Finset.range n, Real.cos (a i) / 2 ^ i) * Real.cos x\u2082 -\n (\u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i) * Real.sin x\u2082,\n 0}\n [cases] Case analyses\n [cases] [1/2]: (fun i => Real.sin (a i) / 2 ^ i) = fun i => Real.cos (a i) / 2 ^ i\n [cases] [2/2]: (fun i => Real.cos (a i + x\u2082) / 2 ^ i) = fun i => Real.sin (a i) / 2 ^ i\n [cases] [1/2]: (fun i => Real.cos (a i + x\u2082) / 2 ^ i) = fun i => Real.cos (a i + x) / 2 ^ i\n [cases] [1/2]: (fun i => Real.cos (a i + x\u2082) / 2 ^ i) = fun i => Real.cos (a i + x\u2081) / 2 ^ i\n [cases] [1/1]: \u2203 x, \u00acReal.cos (a x + x\u2081) / 2 ^ x = Real.cos (a x) / 2 ^ x\n [cases] [1/1]: \u2203 x, \u00acReal.cos (a x + x\u2081) / 2 ^ x = Real.sin (a x) / 2 ^ x\n [cases] [1/1]: \u2203 x_1, \u00acReal.cos (a x_1 + x) / 2 ^ x_1 = Real.sin (a x_1) / 2 ^ x_1\n [cases] [1/1]: \u2203 x, \u00acReal.cos (a x + x\u2082) / 2 ^ x = Real.cos (a x) / 2 ^ x\n [cases] [1/1]: \u2203 x, \u00acReal.cos (a x + x\u2082) / 2 ^ x = Real.sin (a x) / 2 ^ x\n [cases] [1/1]: \u2203 x_1, \u00acReal.cos (a x_1 + x) / 2 ^ x_1 = Real.cos (a x_1) / 2 ^ x_1\n [ematch] E-matching patterns\n [thm] h\u2081: [f #0]\n [thm] h\u2081: [f #0]\n [thm] h\u2085: [f #0]\n [thm] h\u2085: [f #0]\n [cutsat] Assignment satisfying linear constraints\n [assign] n := 1\n [assign] w := 3\n [assign] w_1 := 4\n [assign] w_2 := 5\n [assign] w_3 := 6\n [assign] w_4 := 7\n [assign] w_5 := 8\n [assign] 0 := 0\n [assign] 2 := 2\n [ring] Ring `\u211d`\n [basis] Basis\n [_] \u2211 i \u2208 Finset.range n, Real.cos (a i) / 2 ^ i + -1 * \u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i = 0\n [_] Real.cos x * \u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i +\n -1 * ((\u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i) * Real.sin x) =\n 0\n [_] (\u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i) * Real.cos x\u2081 +\n -1 * ((\u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i) * Real.sin x\u2081) =\n 0\n [_] (\u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i) * Real.cos x\u2082 +\n -1 * ((\u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i) * Real.sin x\u2082) =\n 0\n [diseqs] Disequalities\n [_] \u00ac\u2211 i \u2208 Finset.range n, Real.sin (a i) / 2 ^ i = 0\n [_] \u00acReal.cos x = 0\n [_] \u00acReal.cos x\u2081 = 0\n [_] \u00acReal.cos x\u2082 = 0"], "timeout_s": 600.0, "latency_s": 4.2314, "verified_at": "2026-03-26T18:16:24.142232+00:00"}} | false | true | false | 4.2314 |
compfiles_Imo1970P3 | compfiles | Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Tomas Ortega
-/
import Mathlib
/-!
# International Mathematical Olympiad 1970, Problem 3
The real numbers a₀, a₁, a₂, ... satisfy 1 = a₀ ≤ a₁ ≤ a₂ ≤ ... . b₁, b₂, b₃, ... are defined by bₙ = ∑_{k=1}^{n} (1 - a_{k-1}/a_k)/√a_k.
(a) Prove that 0 ≤ bₙ < 2.
(b) Given c satisfying 0 ≤ c < 2, prove that we can find an so that bₙ > c for all sufficiently large n.
-/
namespace Imo1970P3
open scoped Real
/-- A sequence of real numbers satisfying the given conditions -/
structure IncreasingSequenceFromOne where
a : ℕ → ℝ
a_zero : a 0 = 1
a_mono : Monotone a
/-- The b_n sequence defined in terms of the a sequence -/
noncomputable def b_seq (seq : IncreasingSequenceFromOne) (n : ℕ) : ℝ :=
∑ k ∈ Finset.range n, (1 - seq.a k / seq.a (k + 1)) / √ (seq.a (k + 1))
def ValidBounds : Set ℝ :=
{ b | 0 ≤ b ∧ b < 2 }
/-- Helper: c_k = √(a_k) -/
noncomputable def c_seq (seq : IncreasingSequenceFromOne) (k : ℕ) : ℝ := Real.sqrt (seq.a k)
/-- All elements of the sequence are positive -/
lemma seq_pos (seq: IncreasingSequenceFromOne) : ∀ n, 0 < seq.a n := by
intro n
induction n with
| zero =>
rw [seq.a_zero]
exact zero_lt_one
| succ n ih =>
have h1 : seq.a n ≤ seq.a (n + 1) := seq.a_mono (Nat.le_succ n)
exact lt_of_lt_of_le ih h1
/-- Key lemma: each term is bounded by 2(1/c_{k-1} - 1/c_k) -/
lemma term_bound (seq : IncreasingSequenceFromOne) (k : ℕ) :
(1 - seq.a (k - 1) / seq.a k) / Real.sqrt (seq.a k) ≤
2 * (1 / c_seq seq (k - 1) - 1 / c_seq seq k) := by
-- Let c_k = √(a_k)
have ck_pos : ∀ j, 0 < c_seq seq j := fun j => Real.sqrt_pos.mpr (seq_pos seq j)
have ck_is_ak_squared: ∀ j, seq.a j = (c_seq seq j)^2 := by
intro j
simp [c_seq, Real.sq_sqrt (le_of_lt (seq_pos seq j))]
have hcseq : c_seq seq (k - 1) ≤ c_seq seq k := Real.sqrt_le_sqrt (seq.a_mono (Nat.sub_le k 1))
-- The term equals c_{k-1}²/c_k · (1/a_{k-1} - 1/a_k)
have h1 : (1 - seq.a (k - 1) / seq.a k) / Real.sqrt (seq.a k) = (c_seq seq (k - 1))^2 / c_seq seq k * (1 / seq.a (k - 1) - 1 / seq.a k) := by
simp [c_seq, Real.sq_sqrt (le_of_lt (seq_pos seq _))]
have haUnit : IsUnit (seq.a (k - 1)) := by
rw [isUnit_iff_ne_zero]
let j := k - 1
have hj : j = k-1 := rfl
rw [←hj]
have := seq_pos seq j
linarith
ring_nf
simp [field]
rw [IsUnit.div_mul_left haUnit]
exact inv_eq_one_div √(seq.a k)
-- Factor 1/a_{k-1} - 1/a_k using difference of squares
have h2 : 1 / seq.a (k - 1) - 1 / seq.a k =
(1 / c_seq seq (k - 1) + 1 / c_seq seq k) * (1 / c_seq seq (k - 1) - 1 / c_seq seq k) := by
rw [ck_is_ak_squared (k-1), ck_is_ak_squared k]
ring
-- Show c_{k-1}²/c_k · (1/c_{k-1} + 1/c_k) ≤ 2
have h3 : (c_seq seq (k - 1))^2 / c_seq seq k * (1 / c_seq seq (k - 1) + 1 / c_seq seq k) ≤ 2 := by
calc
_ = c_seq seq (k - 1) / c_seq seq k + (c_seq seq (k - 1) / c_seq seq k)^2 := by
have := ck_pos k
have := ck_pos (k - 1)
field_simp
_ ≤ 1 + 1 := by
apply add_le_add
· exact (div_le_one (ck_pos k)).mpr hcseq
· rw [sq_le_one_iff_abs_le_one, abs_div, abs_of_pos (ck_pos (k-1)), abs_of_pos (ck_pos k)]
exact (div_le_one (ck_pos k)).mpr hcseq
_ = 2 := one_add_one_eq_two
rw [h1, h2, ←mul_assoc]
apply mul_le_mul_of_nonneg_right h3
rw [sub_nonneg]
exact one_div_le_one_div_of_le (ck_pos (k - 1)) hcseq
theorem imo1970_p3 :
(∀ seq : IncreasingSequenceFromOne, ∀ n : ℕ, b_seq seq n ∈ ValidBounds) ∧
(∀ c ∈ ValidBounds, ∃ seq : IncreasingSequenceFromOne, ∃ N : ℕ,
∀ n ≥ N, b_seq seq n > c) := by
constructor
/-
Part (a): All b_n are in [0, 2)
Each term of the sum is non-negative, so b_n is non-negative. Let c_k = √a_k. Then the kth term = (1 - a_{k-1}/a_k)/√a_k = c_{k-1}²/c_k (1/a_{k-1} - 1/a_k) = c_{k-1}²/c_k (1/c_{k-1} + 1/c_k)(1/c_{k-1} - 1/c_k). But c_{k-1}²/c_k (1/c_{k-1} + 1/c_k) ≤ 2, so the kth term ≤ 2(1/c_{k-1} - 1/c_k). Hence b_n ≤ 2 - 2/c_n < 2.
-/
· intro seq n
constructor
· -- 0 ≤ b_n
apply Finset.sum_nonneg
intro k hk
have h1 : seq.a k ≤ seq.a (k + 1) := seq.a_mono (Nat.le_succ k)
have h2 : 0 < seq.a (k + 1) := seq_pos seq (k + 1)
have h3 : seq.a k / seq.a (k + 1) ≤ 1 := (div_le_one h2).mpr h1
exact div_nonneg (sub_nonneg.mpr h3) (Real.sqrt_nonneg _)
· -- b_n < 2
cases n with
| zero => simp only [b_seq, Finset.range_zero, Finset.sum_empty, zero_lt_two]
| succ n =>
-- Use telescoping sum
-- Change of index: the k-th term for k ≥ 1 is bounded by 2(1/√a_{k-1} - 1/√a_k)
have bound : b_seq seq (n + 1) ≤ 2 * (1 - 1 / c_seq seq (n + 1)) := by
-- Split the sum to handle k = 0 separately
have split_sum : b_seq seq (n + 1) =
(1 - seq.a 0 / seq.a 1) / Real.sqrt (seq.a 1) +
∑ k ∈ Finset.range n, (1 - seq.a (k + 1) / seq.a (k + 2)) / Real.sqrt (seq.a (k + 2)) := by
rw [b_seq, Finset.sum_range_succ', add_comm]
-- Apply term_bound to each term k ≥ 1
have sum_bound : ∑ k ∈ Finset.range n, (1 - seq.a (k + 1) / seq.a (k + 2)) / Real.sqrt (seq.a (k + 2)) ≤
2 * ∑ k ∈ Finset.range n, (1 / c_seq seq (k + 1) - 1 / c_seq seq (k + 2)) := by
rw [Finset.mul_sum]
apply Finset.sum_le_sum
intro k hk
exact term_bound seq (k + 2)
-- The sum telescopes
have telescoping : ∑ k ∈ Finset.range n, (1 / c_seq seq (k + 1) - 1 / c_seq seq (k + 2)) =
1 / c_seq seq 1 - 1 / c_seq seq (n + 1) :=
Finset.sum_range_sub' (fun i ↦ 1 / c_seq seq (i + 1)) n
-- Handle the k = 0 term
have first_term_bound : (1 - seq.a 0 / seq.a 1) / Real.sqrt (seq.a 1) ≤ 2 * (1 / c_seq seq 0 - 1 / c_seq seq 1) := by
convert term_bound seq 1 using 1
-- Combine everything
calc b_seq seq (n + 1)
= _ := split_sum
_ ≤ 2 * (1 / c_seq seq 0 - 1 / c_seq seq 1) + 2 * ∑ k ∈ Finset.range n, (1 / c_seq seq (k + 1) - 1 / c_seq seq (k + 2)) := add_le_add first_term_bound sum_bound
_ = 2 * (1 / c_seq seq 0 - 1 / c_seq seq 1) + 2 * (1 / c_seq seq 1 - 1 / c_seq seq (n + 1)) := by
rw [telescoping]
_ = 2 * (1 / c_seq seq 0 - 1 / c_seq seq (n + 1)) := by ring
_ = 2 * (1 - 1 / c_seq seq (n + 1)) := by
rw [c_seq, seq.a_zero, Real.sqrt_one]
simp only [ne_eq, one_ne_zero, not_false_eq_true, div_self, one_div]
-- Since c_seq seq (n + 1) > 0, we have 1 / c_seq seq (n + 1) > 0
have pos : 0 < 1 / c_seq seq (n + 1) := by
apply div_pos one_pos
exact Real.sqrt_pos.mpr (seq_pos seq (n + 1))
exact lt_of_le_of_lt bound (by linarith)
/-
Part (b): For each c ∈ [0, 2), there exists a sequence with b_n > c for large n
Note that we can use d = √(c/2) for the solution, unless c = 0, in which case we can use d = 1/2.
Let 1/√aₖ = d^k, where 0 < d < 1 is a constant, which we will choose later. Then the kth term is (1 - d²)d^k, so bₙ = d(1+d)(1 - d^n). Now take d such that d(1+d) > c, which we can do, since since d(1+d) tends to 2 when d tends to 1, and then take n sufficiently large so that bₙ > c.
-/
· intro c hc
obtain ⟨hc_nonneg, hc_lt_two⟩ := hc
have existsD : ∃ d : ℝ, 0 < d ∧ d < 1 ∧ d*(1 + d) > c := by
by_cases h : c = 0
· use 1 / 2
constructor
· exact one_half_pos
· constructor
· exact one_half_lt_one
· linarith
-- If c > 0, we can find a d such that d(1 + d) > c
· use √ (c / 2)
have hc : 0 < c := lt_of_le_of_ne hc_nonneg fun a ↦ h a.symm
have hc' : 0 < c / 2 := half_pos hc
have : c / 2 < 1 := by linarith
have hd : 0 < √ (c / 2) := Real.sqrt_pos.mpr hc'
constructor
· exact hd
· constructor
· -- square both sides
rwa [Real.sqrt_lt (le_of_lt hc') zero_le_one, one_pow]
· rw [mul_add, mul_one, Real.mul_self_sqrt (le_of_lt hc')]
suffices c / 2 < √(c / 2) by linarith
nth_rw 1 [show c / 2 = √(c / 2) ^ 2 by rw [Real.sq_sqrt (le_of_lt hc')]]
apply pow_lt_self_of_lt_one₀ hd _ one_lt_two
rwa [Real.sqrt_lt' zero_lt_one, one_pow]
obtain ⟨d, dpos, d_lt_one, d_bound⟩ := existsD
have d_nonneg : 0 ≤ d := le_of_lt dpos
have d_leq_one : d ≤ 1 := le_of_lt d_lt_one
have d_neq_one : d ≠ 1 := Ne.symm (ne_of_gt d_lt_one)
have one_minus_d_neq_zero : 1 - d ≠ 0 := sub_ne_zero_of_ne (id (Ne.symm d_neq_one))
have daux : d * (1 + d) > 0 := mul_pos dpos (add_pos one_pos dpos)
-- Define the geometric sequence aₙ = d^(-k/2)
let a_seq : IncreasingSequenceFromOne := {
a := fun k => d^(-(k:ℝ) * 2)
a_zero := by simp
a_mono := by
intro i j hij
aesop
}
use a_seq
let N := Nat.ceil (1 + Real.log (1 - c / (d * (1 + d))) / Real.log d)
use N
intro n hn
dsimp [b_seq, a_seq]
simp only [neg_mul, Nat.cast_add, Nat.cast_one, neg_add_rev, gt_iff_lt]
calc
c < d * (1 + d) * (1 - d ^ N) := by
-- divide both sides by d * (1 + d)
rw [←inv_mul_lt_iff₀ daux]
suffices d ^ N < 1 - (d * (1 + d))⁻¹ * c by linarith
rw [←Real.log_lt_log_iff]
· rw [Real.log_pow d N]
suffices Real.log (1 - (d * (1 + d))⁻¹ * c) / Real.log d < ↑N by
rwa [←div_lt_iff_of_neg (Real.log_neg dpos d_lt_one)]
calc
_ < 1 + Real.log (1 - (d * (1 + d))⁻¹ * c) / Real.log d := lt_one_add _
_ = 1 + Real.log (1 - c / (d * (1 + d))) / Real.log d := by field_simp
_ ≤ _ := by apply Nat.le_ceil
· exact pow_pos dpos N
· suffices (d * (1 + d))⁻¹ * c < 1 by linarith
rwa [inv_mul_lt_one₀ daux]
_ ≤ d * (1 + d) * (1 - d ^ (n:ℝ)) := by
norm_cast
apply mul_le_mul_of_nonneg_left _ (le_of_lt daux)
apply tsub_le_tsub (le_refl 1)
exact pow_le_pow_of_le_one d_nonneg d_leq_one hn
_ = ∑ x ∈ Finset.range n, (1 - d^2) * d^(x + 1) := by
rw [←Finset.mul_sum]
have : ∑ i ∈ Finset.range n, d ^ (i + 1) = d * ∑ i ∈ Finset.range n, d ^ i := by
rw [Finset.mul_sum]
congr
ring_nf
rw [this, geom_sum_eq d_neq_one n]
norm_cast
calc
_ = (1 - d ^ 2) * (d * ((1 - d ^ n) * (1 - d)⁻¹)) := by
field_simp
ring_nf
_ = (1 - d ^ 2) * (d * (-(1 - d ^ n) / -(1 - d))) := by rw [←div_eq_mul_inv, neg_div_neg_eq]
_ = _ := by ring_nf
_ = _ := by
congr
ext x
have : √(d ^ ((-1 + -(x:ℝ)) * 2)) = d ^ ((-1 + -(x:ℝ))) := by
rw [Real.sqrt_eq_rpow, ←Real.rpow_mul d_nonneg]
ring_nf
rw [this]
field_simp
calc
_ = (1 - d ^ 2) * (d ^ (x + 1) * d ^ (-(1 + (x:ℝ)))) * d ^ (-(1 + (x:ℝ)) * 2) := by ring_nf
_ = (1 - d ^ 2) * (d ^ ((-1 + -(x:ℝ)) * 2)) := by
suffices d ^ (x + 1) * d ^ (-(1 + (x:ℝ))) = 1 by
rw [this, mul_one, neg_add_rev, add_comm]
rw [Real.rpow_neg d_nonneg, add_comm]
norm_cast
field_simp
_ = _ := by
ring_nf
rw [add_comm]
suffices d ^ 2 * d ^ (-2 - (x:ℝ) * 2) = d ^ (-((x:ℝ ) * 2)) by
rw [this]
rfl
calc
_ = d ^ (2 + (-2 - (x:ℝ) * 2)) := by
rw [Real.rpow_add dpos, Real.rpow_ofNat]
_ = _ := by ring_nf
end Imo1970P3 | /- | /-
Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Tomas Ortega
-/
import Mathlib
/-!
# International Mathematical Olympiad 1970, Problem 3
The real numbers a₀, a₁, a₂, ... satisfy 1 = a₀ ≤ a₁ ≤ a₂ ≤ ... . b₁, b₂, b₃, ... are defined by bₙ = ∑_{k=1}^{n} (1 - a_{k-1}/a_k)/√a_k.
(a) Prove that 0 ≤ bₙ < 2.
(b) Given c satisfying 0 ≤ c < 2, prove that we can find an so that bₙ > c for all sufficiently large n.
-/
namespace Imo1970P3
open scoped Real
/-- A sequence of real numbers satisfying the given conditions -/
structure IncreasingSequenceFromOne where
a : ℕ → ℝ
a_zero : a 0 = 1
a_mono : Monotone a
/-- The b_n sequence defined in terms of the a sequence -/
noncomputable def b_seq (seq : IncreasingSequenceFromOne) (n : ℕ) : ℝ :=
∑ k ∈ Finset.range n, (1 - seq.a k / seq.a (k + 1)) / √ (seq.a (k + 1))
def ValidBounds : Set ℝ :=
{ b | 0 ≤ b ∧ b < 2 }
/-- Helper: c_k = √(a_k) -/
noncomputable def c_seq (seq : IncreasingSequenceFromOne) (k : ℕ) : ℝ := Real.sqrt (seq.a k)
/-- All elements of the sequence are positive -/
lemma seq_pos (seq: IncreasingSequenceFromOne) : ∀ n, 0 < seq.a n := by
intro n
induction n with
| zero =>
rw [seq.a_zero]
exact zero_lt_one
| succ n ih =>
have h1 : seq.a n ≤ seq.a (n + 1) := seq.a_mono (Nat.le_succ n)
exact lt_of_lt_of_le ih h1
/-- Key lemma: each term is bounded by 2(1/c_{k-1} - 1/c_k) -/
lemma term_bound (seq : IncreasingSequenceFromOne) (k : ℕ) :
(1 - seq.a (k - 1) / seq.a k) / Real.sqrt (seq.a k) ≤
2 * (1 / c_seq seq (k - 1) - 1 / c_seq seq k) := by
-- Let c_k = √(a_k)
have ck_pos : ∀ j, 0 < c_seq seq j := fun j => Real.sqrt_pos.mpr (seq_pos seq j)
have ck_is_ak_squared: ∀ j, seq.a j = (c_seq seq j)^2 := by
intro j
simp [c_seq, Real.sq_sqrt (le_of_lt (seq_pos seq j))]
have hcseq : c_seq seq (k - 1) ≤ c_seq seq k := Real.sqrt_le_sqrt (seq.a_mono (Nat.sub_le k 1))
-- The term equals c_{k-1}²/c_k · (1/a_{k-1} - 1/a_k)
have h1 : (1 - seq.a (k - 1) / seq.a k) / Real.sqrt (seq.a k) = (c_seq seq (k - 1))^2 / c_seq seq k * (1 / seq.a (k - 1) - 1 / seq.a k) := by
simp [c_seq, Real.sq_sqrt (le_of_lt (seq_pos seq _))]
have haUnit : IsUnit (seq.a (k - 1)) := by
rw [isUnit_iff_ne_zero]
let j := k - 1
have hj : j = k-1 := rfl
rw [←hj]
have := seq_pos seq j
linarith
ring_nf
simp [field]
rw [IsUnit.div_mul_left haUnit]
exact inv_eq_one_div √(seq.a k)
-- Factor 1/a_{k-1} - 1/a_k using difference of squares
have h2 : 1 / seq.a (k - 1) - 1 / seq.a k =
(1 / c_seq seq (k - 1) + 1 / c_seq seq k) * (1 / c_seq seq (k - 1) - 1 / c_seq seq k) := by
rw [ck_is_ak_squared (k-1), ck_is_ak_squared k]
ring
-- Show c_{k-1}²/c_k · (1/c_{k-1} + 1/c_k) ≤ 2
have h3 : (c_seq seq (k - 1))^2 / c_seq seq k * (1 / c_seq seq (k - 1) + 1 / c_seq seq k) ≤ 2 := by
calc
_ = c_seq seq (k - 1) / c_seq seq k + (c_seq seq (k - 1) / c_seq seq k)^2 := by
have := ck_pos k
have := ck_pos (k - 1)
field_simp
_ ≤ 1 + 1 := by
apply add_le_add
· exact (div_le_one (ck_pos k)).mpr hcseq
· rw [sq_le_one_iff_abs_le_one, abs_div, abs_of_pos (ck_pos (k-1)), abs_of_pos (ck_pos k)]
exact (div_le_one (ck_pos k)).mpr hcseq
_ = 2 := one_add_one_eq_two
rw [h1, h2, ←mul_assoc]
apply mul_le_mul_of_nonneg_right h3
rw [sub_nonneg]
exact one_div_le_one_div_of_le (ck_pos (k - 1)) hcseq
theorem imo1970_p3 :
(∀ seq : IncreasingSequenceFromOne, ∀ n : ℕ, b_seq seq n ∈ ValidBounds) ∧
(∀ c ∈ ValidBounds, ∃ seq : IncreasingSequenceFromOne, ∃ N : ℕ,
∀ n ≥ N, b_seq seq n > c) := by
constructor
/-
Part (a): All b_n are in [0, 2)
Each term of the sum is non-negative, so b_n is non-negative. Let c_k = √a_k. Then the kth term = (1 - a_{k-1}/a_k)/√a_k = c_{k-1}²/c_k (1/a_{k-1} - 1/a_k) = c_{k-1}²/c_k (1/c_{k-1} + 1/c_k)(1/c_{k-1} - 1/c_k). But c_{k-1}²/c_k (1/c_{k-1} + 1/c_k) ≤ 2, so the kth term ≤ 2(1/c_{k-1} - 1/c_k). Hence b_n ≤ 2 - 2/c_n < 2.
-/
· intro seq n
constructor
· -- 0 ≤ b_n
apply Finset.sum_nonneg
intro k hk
have h1 : seq.a k ≤ seq.a (k + 1) := seq.a_mono (Nat.le_succ k)
have h2 : 0 < seq.a (k + 1) := seq_pos seq (k + 1)
have h3 : seq.a k / seq.a (k + 1) ≤ 1 := (div_le_one h2).mpr h1
exact div_nonneg (sub_nonneg.mpr h3) (Real.sqrt_nonneg _)
· -- b_n < 2
cases n with
| zero => simp only [b_seq, Finset.range_zero, Finset.sum_empty, zero_lt_two]
| succ n =>
-- Use telescoping sum
-- Change of index: the k-th term for k ≥ 1 is bounded by 2(1/√a_{k-1} - 1/√a_k)
have bound : b_seq seq (n + 1) ≤ 2 * (1 - 1 / c_seq seq (n + 1)) := by
-- Split the sum to handle k = 0 separately
have split_sum : b_seq seq (n + 1) =
(1 - seq.a 0 / seq.a 1) / Real.sqrt (seq.a 1) +
∑ k ∈ Finset.range n, (1 - seq.a (k + 1) / seq.a (k + 2)) / Real.sqrt (seq.a (k + 2)) := by
rw [b_seq, Finset.sum_range_succ', add_comm]
-- Apply term_bound to each term k ≥ 1
have sum_bound : ∑ k ∈ Finset.range n, (1 - seq.a (k + 1) / seq.a (k + 2)) / Real.sqrt (seq.a (k + 2)) ≤
2 * ∑ k ∈ Finset.range n, (1 / c_seq seq (k + 1) - 1 / c_seq seq (k + 2)) := by
rw [Finset.mul_sum]
apply Finset.sum_le_sum
intro k hk
exact term_bound seq (k + 2)
-- The sum telescopes
have telescoping : ∑ k ∈ Finset.range n, (1 / c_seq seq (k + 1) - 1 / c_seq seq (k + 2)) =
1 / c_seq seq 1 - 1 / c_seq seq (n + 1) :=
Finset.sum_range_sub' (fun i ↦ 1 / c_seq seq (i + 1)) n
-- Handle the k = 0 term
have first_term_bound : (1 - seq.a 0 / seq.a 1) / Real.sqrt (seq.a 1) ≤ 2 * (1 / c_seq seq 0 - 1 / c_seq seq 1) := by
convert term_bound seq 1 using 1
-- Combine everything
calc b_seq seq (n + 1)
= _ := split_sum
_ ≤ 2 * (1 / c_seq seq 0 - 1 / c_seq seq 1) + 2 * ∑ k ∈ Finset.range n, (1 / c_seq seq (k + 1) - 1 / c_seq seq (k + 2)) := add_le_add first_term_bound sum_bound
_ = 2 * (1 / c_seq seq 0 - 1 / c_seq seq 1) + 2 * (1 / c_seq seq 1 - 1 / c_seq seq (n + 1)) := by
rw [telescoping]
_ = 2 * (1 / c_seq seq 0 - 1 / c_seq seq (n + 1)) := by ring
_ = 2 * (1 - 1 / c_seq seq (n + 1)) := by
rw [c_seq, seq.a_zero, Real.sqrt_one]
simp only [ne_eq, one_ne_zero, not_false_eq_true, div_self, one_div]
-- Since c_seq seq (n + 1) > 0, we have 1 / c_seq seq (n + 1) > 0
have pos : 0 < 1 / c_seq seq (n + 1) := by
apply div_pos one_pos
exact Real.sqrt_pos.mpr (seq_pos seq (n + 1))
exact lt_of_le_of_lt bound (by linarith)
/-
Part (b): For each c ∈ [0, 2), there exists a sequence with b_n > c for large n
Note that we can use d = √(c/2) for the solution, unless c = 0, in which case we can use d = 1/2.
Let 1/√aₖ = d^k, where 0 < d < 1 is a constant, which we will choose later. Then the kth term is (1 - d²)d^k, so bₙ = d(1+d)(1 - d^n). Now take d such that d(1+d) > c, which we can do, since since d(1+d) tends to 2 when d tends to 1, and then take n sufficiently large so that bₙ > c.
-/
· intro c hc
obtain ⟨hc_nonneg, hc_lt_two⟩ := hc
have existsD : ∃ d : ℝ, 0 < d ∧ d < 1 ∧ d*(1 + d) > c := by
by_cases h : c = 0
· use 1 / 2
constructor
· exact one_half_pos
· constructor
· exact one_half_lt_one
· linarith
-- If c > 0, we can find a d such that d(1 + d) > c
· use √ (c / 2)
have hc : 0 < c := lt_of_le_of_ne hc_nonneg fun a ↦ h a.symm
have hc' : 0 < c / 2 := half_pos hc
have : c / 2 < 1 := by linarith
have hd : 0 < √ (c / 2) := Real.sqrt_pos.mpr hc'
constructor
· exact hd
· constructor
· -- square both sides
rwa [Real.sqrt_lt (le_of_lt hc') zero_le_one, one_pow]
· rw [mul_add, mul_one, Real.mul_self_sqrt (le_of_lt hc')]
suffices c / 2 < √(c / 2) by linarith
nth_rw 1 [show c / 2 = √(c / 2) ^ 2 by rw [Real.sq_sqrt (le_of_lt hc')]]
apply pow_lt_self_of_lt_one₀ hd _ one_lt_two
rwa [Real.sqrt_lt' zero_lt_one, one_pow]
obtain ⟨d, dpos, d_lt_one, d_bound⟩ := existsD
have d_nonneg : 0 ≤ d := le_of_lt dpos
have d_leq_one : d ≤ 1 := le_of_lt d_lt_one
have d_neq_one : d ≠ 1 := Ne.symm (ne_of_gt d_lt_one)
have one_minus_d_neq_zero : 1 - d ≠ 0 := sub_ne_zero_of_ne (id (Ne.symm d_neq_one))
have daux : d * (1 + d) > 0 := mul_pos dpos (add_pos one_pos dpos)
-- Define the geometric sequence aₙ = d^(-k/2)
let a_seq : IncreasingSequenceFromOne := {
a := fun k => d^(-(k:ℝ) * 2)
a_zero := by simp
a_mono := by
intro i j hij
aesop
}
use a_seq
let N := Nat.ceil (1 + Real.log (1 - c / (d * (1 + d))) / Real.log d)
use N
intro n hn
dsimp [b_seq, a_seq]
simp only [neg_mul, Nat.cast_add, Nat.cast_one, neg_add_rev, gt_iff_lt]
calc
c < d * (1 + d) * (1 - d ^ N) := by
-- divide both sides by d * (1 + d)
rw [←inv_mul_lt_iff₀ daux]
suffices d ^ N < 1 - (d * (1 + d))⁻¹ * c by linarith
rw [←Real.log_lt_log_iff]
· rw [Real.log_pow d N]
suffices Real.log (1 - (d * (1 + d))⁻¹ * c) / Real.log d < ↑N by
rwa [←div_lt_iff_of_neg (Real.log_neg dpos d_lt_one)]
calc
_ < 1 + Real.log (1 - (d * (1 + d))⁻¹ * c) / Real.log d := lt_one_add _
_ = 1 + Real.log (1 - c / (d * (1 + d))) / Real.log d := by field_simp
_ ≤ _ := by apply Nat.le_ceil
· exact pow_pos dpos N
· suffices (d * (1 + d))⁻¹ * c < 1 by linarith
rwa [inv_mul_lt_one₀ daux]
_ ≤ d * (1 + d) * (1 - d ^ (n:ℝ)) := by
norm_cast
apply mul_le_mul_of_nonneg_left _ (le_of_lt daux)
apply tsub_le_tsub (le_refl 1)
exact pow_le_pow_of_le_one d_nonneg d_leq_one hn
_ = ∑ x ∈ Finset.range n, (1 - d^2) * d^(x + 1) := by
rw [←Finset.mul_sum]
have : ∑ i ∈ Finset.range n, d ^ (i + 1) = d * ∑ i ∈ Finset.range n, d ^ i := by
rw [Finset.mul_sum]
congr
ring_nf
rw [this, geom_sum_eq d_neq_one n]
norm_cast
calc
_ = (1 - d ^ 2) * (d * ((1 - d ^ n) * (1 - d)⁻¹)) := by
field_simp
ring_nf
_ = (1 - d ^ 2) * (d * (-(1 - d ^ n) / -(1 - d))) := by rw [←div_eq_mul_inv, neg_div_neg_eq]
_ = _ := by ring_nf
_ = _ := by
congr
ext x
have : √(d ^ ((-1 + -(x:ℝ)) * 2)) = d ^ ((-1 + -(x:ℝ))) := by
rw [Real.sqrt_eq_rpow, ←Real.rpow_mul d_nonneg]
ring_nf
rw [this]
field_simp
calc
_ = (1 - d ^ 2) * (d ^ (x + 1) * d ^ (-(1 + (x:ℝ)))) * d ^ (-(1 + (x:ℝ)) * 2) := by ring_nf
_ = (1 - d ^ 2) * (d ^ ((-1 + -(x:ℝ)) * 2)) := by
suffices d ^ (x + 1) * d ^ (-(1 + (x:ℝ))) = 1 by
rw [this, mul_one, neg_add_rev, add_comm]
rw [Real.rpow_neg d_nonneg, add_comm]
norm_cast
field_simp
_ = _ := by
ring_nf
rw [add_comm]
suffices d ^ 2 * d ^ (-2 - (x:ℝ) * 2) = d ^ (-((x:ℝ ) * 2)) by
rw [this]
rfl
calc
_ = d ^ (2 + (-2 - (x:ℝ) * 2)) := by
rw [Real.rpow_add dpos, Real.rpow_ofNat]
_ = _ := by ring_nf
end Imo1970P3
| true | Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Tomas Ortega
-/
import Mathlib
/-!
# International Mathematical Olympiad 1970, Problem 3
The real numbers a₀, a₁, a₂, ... satisfy 1 = a₀ ≤ a₁ ≤ a₂ ≤ ... . b₁, b₂, b₃, ... are defined by bₙ = ∑_{k=1}^{n} (1 - a_{k-1}/a_k)/√a_k.
(a) Prove that 0 ≤ bₙ < 2.
(b) Given c satisfying 0 ≤ c < 2, prove that we can find an so that bₙ > c for all sufficiently large n.
-/
namespace Imo1970P3
open scoped Real
/-- A sequence of real numbers satisfying the given conditions -/
structure IncreasingSequenceFromOne where
a : ℕ → ℝ
a_zero : a 0 = 1
a_mono : Monotone a
/-- The b_n sequence defined in terms of the a sequence -/
noncomputable def b_seq (seq : IncreasingSequenceFromOne) (n : ℕ) : ℝ :=
∑ k ∈ Finset.range n, (1 - seq.a k / seq.a (k + 1)) / √ (seq.a (k + 1))
def ValidBounds : Set ℝ :=
{ b | 0 ≤ b ∧ b < 2 }
/-- Helper: c_k = √(a_k) -/
noncomputable def c_seq (seq : IncreasingSequenceFromOne) (k : ℕ) : ℝ := Real.sqrt (seq.a k)
/-- All elements of the sequence are positive -/
lemma seq_pos (seq: IncreasingSequenceFromOne) : ∀ n, 0 < seq.a n := by
intro n
induction n with
| zero =>
rw [seq.a_zero]
exact zero_lt_one
| succ n ih =>
have h1 : seq.a n ≤ seq.a (n + 1) := seq.a_mono (Nat.le_succ n)
exact lt_of_lt_of_le ih h1
/-- Key lemma: each term is bounded by 2(1/c_{k-1} - 1/c_k) -/
lemma term_bound (seq : IncreasingSequenceFromOne) (k : ℕ) :
(1 - seq.a (k - 1) / seq.a k) / Real.sqrt (seq.a k) ≤
2 * (1 / c_seq seq (k - 1) - 1 / c_seq seq k) := by
-- Let c_k = √(a_k)
have ck_pos : ∀ j, 0 < c_seq seq j := fun j => Real.sqrt_pos.mpr (seq_pos seq j)
have ck_is_ak_squared: ∀ j, seq.a j = (c_seq seq j)^2 := by
intro j
simp [c_seq, Real.sq_sqrt (le_of_lt (seq_pos seq j))]
have hcseq : c_seq seq (k - 1) ≤ c_seq seq k := Real.sqrt_le_sqrt (seq.a_mono (Nat.sub_le k 1))
-- The term equals c_{k-1}²/c_k · (1/a_{k-1} - 1/a_k)
have h1 : (1 - seq.a (k - 1) / seq.a k) / Real.sqrt (seq.a k) = (c_seq seq (k - 1))^2 / c_seq seq k * (1 / seq.a (k - 1) - 1 / seq.a k) := by
simp [c_seq, Real.sq_sqrt (le_of_lt (seq_pos seq _))]
have haUnit : IsUnit (seq.a (k - 1)) := by
rw [isUnit_iff_ne_zero]
let j := k - 1
have hj : j = k-1 := rfl
rw [←hj]
have := seq_pos seq j
linarith
ring_nf
simp [field]
rw [IsUnit.div_mul_left haUnit]
exact inv_eq_one_div √(seq.a k)
-- Factor 1/a_{k-1} - 1/a_k using difference of squares
have h2 : 1 / seq.a (k - 1) - 1 / seq.a k =
(1 / c_seq seq (k - 1) + 1 / c_seq seq k) * (1 / c_seq seq (k - 1) - 1 / c_seq seq k) := by
rw [ck_is_ak_squared (k-1), ck_is_ak_squared k]
ring
-- Show c_{k-1}²/c_k · (1/c_{k-1} + 1/c_k) ≤ 2
have h3 : (c_seq seq (k - 1))^2 / c_seq seq k * (1 / c_seq seq (k - 1) + 1 / c_seq seq k) ≤ 2 := by
calc
_ = c_seq seq (k - 1) / c_seq seq k + (c_seq seq (k - 1) / c_seq seq k)^2 := by
have := ck_pos k
have := ck_pos (k - 1)
field_simp
_ ≤ 1 + 1 := by
apply add_le_add
· exact (div_le_one (ck_pos k)).mpr hcseq
· rw [sq_le_one_iff_abs_le_one, abs_div, abs_of_pos (ck_pos (k-1)), abs_of_pos (ck_pos k)]
exact (div_le_one (ck_pos k)).mpr hcseq
_ = 2 := one_add_one_eq_two
rw [h1, h2, ←mul_assoc]
apply mul_le_mul_of_nonneg_right h3
rw [sub_nonneg]
exact one_div_le_one_div_of_le (ck_pos (k - 1)) hcseq
theorem imo1970_p3 :
(∀ seq : IncreasingSequenceFromOne, ∀ n : ℕ, b_seq seq n ∈ ValidBounds) ∧
(∀ c ∈ ValidBounds, ∃ seq : IncreasingSequenceFromOne, ∃ N : ℕ,
∀ n ≥ N, b_seq seq n > c) := by
constructor
/-
Part (a): All b_n are in [0, 2)
Each term of the sum is non-negative, so b_n is non-negative. Let c_k = √a_k. Then the kth term = (1 - a_{k-1}/a_k)/√a_k = c_{k-1}²/c_k (1/a_{k-1} - 1/a_k) = c_{k-1}²/c_k (1/c_{k-1} + 1/c_k)(1/c_{k-1} - 1/c_k). But c_{k-1}²/c_k (1/c_{k-1} + 1/c_k) ≤ 2, so the kth term ≤ 2(1/c_{k-1} - 1/c_k). Hence b_n ≤ 2 - 2/c_n < 2.
-/
· intro seq n
constructor
· -- 0 ≤ b_n
apply Finset.sum_nonneg
intro k hk
have h1 : seq.a k ≤ seq.a (k + 1) := seq.a_mono (Nat.le_succ k)
have h2 : 0 < seq.a (k + 1) := seq_pos seq (k + 1)
have h3 : seq.a k / seq.a (k + 1) ≤ 1 := (div_le_one h2).mpr h1
exact div_nonneg (sub_nonneg.mpr h3) (Real.sqrt_nonneg _)
· -- b_n < 2
cases n with
| zero => simp only [b_seq, Finset.range_zero, Finset.sum_empty, zero_lt_two]
| succ n =>
-- Use telescoping sum
-- Change of index: the k-th term for k ≥ 1 is bounded by 2(1/√a_{k-1} - 1/√a_k)
have bound : b_seq seq (n + 1) ≤ 2 * (1 - 1 / c_seq seq (n + 1)) := by
-- Split the sum to handle k = 0 separately
have split_sum : b_seq seq (n + 1) =
(1 - seq.a 0 / seq.a 1) / Real.sqrt (seq.a 1) +
∑ k ∈ Finset.range n, (1 - seq.a (k + 1) / seq.a (k + 2)) / Real.sqrt (seq.a (k + 2)) := by
rw [b_seq, Finset.sum_range_succ', add_comm]
-- Apply term_bound to each term k ≥ 1
have sum_bound : ∑ k ∈ Finset.range n, (1 - seq.a (k + 1) / seq.a (k + 2)) / Real.sqrt (seq.a (k + 2)) ≤
2 * ∑ k ∈ Finset.range n, (1 / c_seq seq (k + 1) - 1 / c_seq seq (k + 2)) := by
rw [Finset.mul_sum]
apply Finset.sum_le_sum
intro k hk
exact term_bound seq (k + 2)
-- The sum telescopes
have telescoping : ∑ k ∈ Finset.range n, (1 / c_seq seq (k + 1) - 1 / c_seq seq (k + 2)) =
1 / c_seq seq 1 - 1 / c_seq seq (n + 1) :=
Finset.sum_range_sub' (fun i ↦ 1 / c_seq seq (i + 1)) n
-- Handle the k = 0 term
have first_term_bound : (1 - seq.a 0 / seq.a 1) / Real.sqrt (seq.a 1) ≤ 2 * (1 / c_seq seq 0 - 1 / c_seq seq 1) := by
convert term_bound seq 1 using 1
-- Combine everything
calc b_seq seq (n + 1)
= _ := split_sum
_ ≤ 2 * (1 / c_seq seq 0 - 1 / c_seq seq 1) + 2 * ∑ k ∈ Finset.range n, (1 / c_seq seq (k + 1) - 1 / c_seq seq (k + 2)) := add_le_add first_term_bound sum_bound
_ = 2 * (1 / c_seq seq 0 - 1 / c_seq seq 1) + 2 * (1 / c_seq seq 1 - 1 / c_seq seq (n + 1)) := by
rw [telescoping]
_ = 2 * (1 / c_seq seq 0 - 1 / c_seq seq (n + 1)) := by ring
_ = 2 * (1 - 1 / c_seq seq (n + 1)) := by
rw [c_seq, seq.a_zero, Real.sqrt_one]
simp only [ne_eq, one_ne_zero, not_false_eq_true, div_self, one_div]
-- Since c_seq seq (n + 1) > 0, we have 1 / c_seq seq (n + 1) > 0
have pos : 0 < 1 / c_seq seq (n + 1) := by
apply div_pos one_pos
exact Real.sqrt_pos.mpr (seq_pos seq (n + 1))
exact lt_of_le_of_lt bound (by linarith)
/-
Part (b): For each c ∈ [0, 2), there exists a sequence with b_n > c for large n
Note that we can use d = √(c/2) for the solution, unless c = 0, in which case we can use d = 1/2.
Let 1/√aₖ = d^k, where 0 < d < 1 is a constant, which we will choose later. Then the kth term is (1 - d²)d^k, so bₙ = d(1+d)(1 - d^n). Now take d such that d(1+d) > c, which we can do, since since d(1+d) tends to 2 when d tends to 1, and then take n sufficiently large so that bₙ > c.
-/
· intro c hc
obtain ⟨hc_nonneg, hc_lt_two⟩ := hc
have existsD : ∃ d : ℝ, 0 < d ∧ d < 1 ∧ d*(1 + d) > c := by
by_cases h : c = 0
· use 1 / 2
constructor
· exact one_half_pos
· constructor
· exact one_half_lt_one
· linarith
-- If c > 0, we can find a d such that d(1 + d) > c
· use √ (c / 2)
have hc : 0 < c := lt_of_le_of_ne hc_nonneg fun a ↦ h a.symm
have hc' : 0 < c / 2 := half_pos hc
have : c / 2 < 1 := by linarith
have hd : 0 < √ (c / 2) := Real.sqrt_pos.mpr hc'
constructor
· exact hd
· constructor
· -- square both sides
rwa [Real.sqrt_lt (le_of_lt hc') zero_le_one, one_pow]
· rw [mul_add, mul_one, Real.mul_self_sqrt (le_of_lt hc')]
suffices c / 2 < √(c / 2) by linarith
nth_rw 1 [show c / 2 = √(c / 2) ^ 2 by rw [Real.sq_sqrt (le_of_lt hc')]]
apply pow_lt_self_of_lt_one₀ hd _ one_lt_two
rwa [Real.sqrt_lt' zero_lt_one, one_pow]
obtain ⟨d, dpos, d_lt_one, d_bound⟩ := existsD
have d_nonneg : 0 ≤ d := le_of_lt dpos
have d_leq_one : d ≤ 1 := le_of_lt d_lt_one
have d_neq_one : d ≠ 1 := Ne.symm (ne_of_gt d_lt_one)
have one_minus_d_neq_zero : 1 - d ≠ 0 := sub_ne_zero_of_ne (id (Ne.symm d_neq_one))
have daux : d * (1 + d) > 0 := mul_pos dpos (add_pos one_pos dpos)
-- Define the geometric sequence aₙ = d^(-k/2)
let a_seq : IncreasingSequenceFromOne := {
a := fun k => d^(-(k:ℝ) * 2)
a_zero := by simp
a_mono := by
intro i j hij
aesop
}
use a_seq
let N := Nat.ceil (1 + Real.log (1 - c / (d * (1 + d))) / Real.log d)
use N
intro n hn
dsimp [b_seq, a_seq]
simp only [neg_mul, Nat.cast_add, Nat.cast_one, neg_add_rev, gt_iff_lt]
calc
c < d * (1 + d) * (1 - d ^ N) := by
-- divide both sides by d * (1 + d)
rw [←inv_mul_lt_iff₀ daux]
suffices d ^ N < 1 - (d * (1 + d))⁻¹ * c by linarith
rw [←Real.log_lt_log_iff]
· rw [Real.log_pow d N]
suffices Real.log (1 - (d * (1 + d))⁻¹ * c) / Real.log d < ↑N by
rwa [←div_lt_iff_of_neg (Real.log_neg dpos d_lt_one)]
calc
_ < 1 + Real.log (1 - (d * (1 + d))⁻¹ * c) / Real.log d := lt_one_add _
_ = 1 + Real.log (1 - c / (d * (1 + d))) / Real.log d := by field_simp
_ ≤ _ := by apply Nat.le_ceil
· exact pow_pos dpos N
· suffices (d * (1 + d))⁻¹ * c < 1 by linarith
rwa [inv_mul_lt_one₀ daux]
_ ≤ d * (1 + d) * (1 - d ^ (n:ℝ)) := by
norm_cast
apply mul_le_mul_of_nonneg_left _ (le_of_lt daux)
apply tsub_le_tsub (le_refl 1)
exact pow_le_pow_of_le_one d_nonneg d_leq_one hn
_ = ∑ x ∈ Finset.range n, (1 - d^2) * d^(x + 1) := by
rw [←Finset.mul_sum]
have : ∑ i ∈ Finset.range n, d ^ (i + 1) = d * ∑ i ∈ Finset.range n, d ^ i := by
rw [Finset.mul_sum]
congr
ring_nf
rw [this, geom_sum_eq d_neq_one n]
norm_cast
calc
_ = (1 - d ^ 2) * (d * ((1 - d ^ n) * (1 - d)⁻¹)) := by
field_simp
ring_nf
_ = (1 - d ^ 2) * (d * (-(1 - d ^ n) / -(1 - d))) := by rw [←div_eq_mul_inv, neg_div_neg_eq]
_ = _ := by ring_nf
_ = _ := by
congr
ext x
have : √(d ^ ((-1 + -(x:ℝ)) * 2)) = d ^ ((-1 + -(x:ℝ))) := by
rw [Real.sqrt_eq_rpow, ←Real.rpow_mul d_nonneg]
ring_nf
rw [this]
field_simp
calc
_ = (1 - d ^ 2) * (d ^ (x + 1) * d ^ (-(1 + (x:ℝ)))) * d ^ (-(1 + (x:ℝ)) * 2) := by ring_nf
_ = (1 - d ^ 2) * (d ^ ((-1 + -(x:ℝ)) * 2)) := by
suffices d ^ (x + 1) * d ^ (-(1 + (x:ℝ))) = 1 by
rw [this, mul_one, neg_add_rev, add_comm]
rw [Real.rpow_neg d_nonneg, add_comm]
norm_cast
field_simp
_ = _ := by
ring_nf
rw [add_comm]
suffices d ^ 2 * d ^ (-2 - (x:ℝ) * 2) = d ^ (-((x:ℝ ) * 2)) by
rw [this]
rfl
calc
_ = d ^ (2 + (-2 - (x:ℝ) * 2)) := by
rw [Real.rpow_add dpos, Real.rpow_ofNat]
_ = _ := by ring_nf
end Imo1970P3 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1970P3.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown identifier 'field'", "tactic 'rewrite' failed, did not find instance of the pattern in the target expression\n seq.a (k - 1) / (?m.20018 * seq.a (k - 1))\nseq : IncreasingSequenceFromOne\nk : \u2115\nck_pos : \u2200 (j : \u2115), 0 < c_seq seq j\nck_is_ak_squared : \u2200 (j : \u2115), seq.a j = c_seq seq j ^ 2\nhcseq : c_seq seq (k - 1) \u2264 c_seq seq k\nhaUnit : IsUnit (seq.a (k - 1))\n\u22a2 (\u221a(seq.a k))\u207b\u00b9 = seq.a (k - 1) * (\u221a(seq.a k))\u207b\u00b9 * (seq.a (k - 1))\u207b\u00b9", "unsolved goals\nseq : IncreasingSequenceFromOne\nk : \u2115\nck_pos : \u2200 (j : \u2115), 0 < c_seq seq j\nck_is_ak_squared : \u2200 (j : \u2115), seq.a j = c_seq seq j ^ 2\nhcseq : c_seq seq (k - 1) \u2264 c_seq seq k\nh1 :\n (1 - seq.a (k - 1) / seq.a k) / \u221a(seq.a k) = c_seq seq (k - 1) ^ 2 / c_seq seq k * (1 / seq.a (k - 1) - 1 / seq.a k)\nh2 :\n 1 / seq.a (k - 1) - 1 / seq.a k =\n (1 / c_seq seq (k - 1) + 1 / c_seq seq k) * (1 / c_seq seq (k - 1) - 1 / c_seq seq k)\nthis\u271d : 0 < c_seq seq k\nthis : 0 < c_seq seq (k - 1)\n\u22a2 c_seq seq (k - 1) ^ 2 * (c_seq seq k + c_seq seq (k - 1)) * (c_seq seq k * c_seq seq k ^ 2) =\n (c_seq seq (k - 1) * c_seq seq k ^ 2 + c_seq seq (k - 1) ^ 2 * c_seq seq k) *\n (c_seq seq k * (c_seq seq (k - 1) * c_seq seq k))"], "timeout_s": 600.0, "latency_s": 4.9862, "verified_at": "2026-03-26T18:16:25.259983+00:00"}} | false | true | false | 4.9862 |
compfiles_Imo1970P4 | compfiles | Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw, Adam Kurkiewicz
-/
import Mathlib
/-!
# International Mathematical Olympiad 1970, Problem 4
Determine the set of all positive integers n with the property that
the set {n, n + 1, n + 2, n + 3, n + 4, n + 5} can be partitioned
into two sets such that the product of the numbers in one set
equals the product of the numbers in the other set.
-/
namespace Imo1970P4
lemma card_opposite (s s' s'' : Finset ℕ) (predicate: ℕ → Prop)
[DecidablePred predicate] (filter : s' = (s.filter (λ x => predicate x)))
(opposite_filter: s'' = (s.filter (λ x => ¬ predicate x))) :
s'.card + s''.card = s.card := by
rw [filter]
rw [opposite_filter]
exact Finset.card_filter_add_card_filter_not predicate
lemma no_other_p_divisors_nearby (x : ℕ) (y : ℕ) (p : ℕ) (p_gt_5 : p > 5) (x_lt_y : x < y)
(close_by: ∃ k, k ≤ 5 ∧ x + k = y) (x_div_p : p ∣ x) : ¬ p ∣ y := by
obtain ⟨k, hk_le, rfl⟩ := close_by
have h_not_div_k : ¬ p ∣ k :=
Nat.not_dvd_of_pos_of_lt (Nat.lt_add_right_iff_pos.mp x_lt_y) (Nat.lt_of_le_of_lt hk_le p_gt_5)
simp_all [Nat.dvd_add_right]
lemma no_other_5_divisors_nearby (x : ℕ) (y : ℕ) (x_lt_y : x < y) (close_by: ∃ k, k ≤ 4 ∧ x + k = y) (x_div_p : 5 ∣ x) : ¬ (5 ∣ y) := by
omega
-- The next few functions apply the following logic from the Art of Problem Solving Solution 1
-- There are exactly three odd numbers in s
-- p > 5 is not a divisor of any of those three odd numbers
-- p = 5 is a divisor of at most one of those three odd numbers
-- p = 3 is a divisor of exactly one of those three odd numbers
-- because these numbers are odd, p = 2 is not a divisor of any of those odd numbers
-- p = 2, p = 3, p = 5 and p > 5 are all the prime numbers out there.
-- by pigeonhole principle, one odd number must not have any prime divisors
-- this number must be 1.
-- The only two intervals that contain 1 are {1, 2, 3, 4, 5, 6} and {0, 1, 2, 3, 4, 5}
lemma elems_in_interval_nearby (x y n : ℕ ) (s : Finset ℕ) (interval : s = Finset.Icc n (n + 5))
(x_in_s : x ∈ s) (y_in_s : y ∈ s) (x_lt_y : x < y) : ∃ k ≤ 5, x + k = y := by
simp_all only [Finset.mem_Icc]
use y - x
omega
lemma p_gt_five_not_divides (n : ℕ) (s1 s2 : Finset ℕ) (partition : s1 ∪ s2 = Finset.Icc n (n + 5)) (no_dups: s1 ∩ s2 = ∅)
(equal_products : ∏ m ∈ s1, m = ∏ m ∈ s2, m) (x : ℕ) (x_in_interval : x ∈ s1 ∪ s2)
(p : ℕ) (pp : Nat.Prime p) (p_gt_5 : p > 5) : ¬ (p ∣ x) := by
intro p_dvd_x
have x_in_s1_or_x_in_s2 : x ∈ s1 ∨ x ∈ s2 := Finset.mem_union.mp x_in_interval
cases x_in_s1_or_x_in_s2
case inl x_in_s1 =>
have p_dvd_prod_x : p ∣ ∏ m ∈ s1, m := by
have := Finset.dvd_prod_of_mem (λ n : ℕ => n) x_in_s1
exact Dvd.dvd.trans p_dvd_x this
have p_dvd_prod_y : p ∣ ∏ m ∈ s2, m := by
rw[equal_products] at p_dvd_prod_x
exact p_dvd_prod_x
have p_not_dvd_prod_y : ¬ p ∣ ∏ m ∈ s2, m := by
intro h
obtain ⟨y, ⟨y_in_s2, p_dvd_y⟩⟩ := Prime.exists_mem_finset_dvd pp.prime h
have s1_s2_disjoint : Disjoint s1 s2 := Finset.disjoint_iff_inter_eq_empty.mpr no_dups
have x_not_y : x ≠ y := (Finset.disjoint_iff_ne.mp s1_s2_disjoint) x x_in_s1 y y_in_s2
have x_lt_y_or_y_lt_x := Ne.lt_or_gt x_not_y
have y_in_interval : y ∈ s1 ∪ s2 := Finset.mem_union_right s1 y_in_s2
cases x_lt_y_or_y_lt_x
case inl x_lt_y =>
have := elems_in_interval_nearby x y n (s1 ∪ s2) partition x_in_interval y_in_interval x_lt_y
have nearby : ∃ k ≤ 5, x + k = y := this
have p_not_dvd_y := no_other_p_divisors_nearby x y p p_gt_5 x_lt_y nearby p_dvd_x
apply p_not_dvd_y
exact p_dvd_y
case inr y_lt_x =>
have := elems_in_interval_nearby y x n (s1 ∪ s2) partition y_in_interval x_in_interval y_lt_x
have nearby : ∃ k ≤ 5, y + k = x := this
have p_not_dvd_x := no_other_p_divisors_nearby y x p p_gt_5 y_lt_x nearby p_dvd_y
apply p_not_dvd_x
exact p_dvd_x
apply p_not_dvd_prod_y
exact p_dvd_prod_y
case inr x_in_s2 =>
have := Finset.dvd_prod_of_mem (λ n : ℕ => n) x_in_s2
simp only at this
have p_dvd_prod_x : p ∣ ∏ m ∈ s2, m := (Dvd.dvd.trans p_dvd_x this)
have p_dvd_prod_y : p ∣ ∏ m ∈ s1, m := by
rw[← equal_products] at p_dvd_prod_x
exact p_dvd_prod_x
have p_not_dvd_prod_y : ¬ p ∣ ∏ m ∈ s1, m := by
intro h
obtain ⟨y, ⟨y_in_s1, p_dvd_y⟩⟩ := Prime.exists_mem_finset_dvd pp.prime h
have : s2 ∩ s1 = ∅ := by
rw [← no_dups]
exact Finset.inter_comm s2 s1
have s2_s1_disjoint : Disjoint s2 s1 := Finset.disjoint_iff_inter_eq_empty.mpr this
have x_not_y : x ≠ y := (Finset.disjoint_iff_ne.mp s2_s1_disjoint) x x_in_s2 y y_in_s1
have x_lt_y_or_y_lt_x := Ne.lt_or_gt x_not_y
have y_in_interval : y ∈ s1 ∪ s2 := Finset.mem_union_left s2 y_in_s1
cases x_lt_y_or_y_lt_x
case inl x_lt_y =>
have := elems_in_interval_nearby x y n (s1 ∪ s2) partition x_in_interval y_in_interval x_lt_y
have nearby : ∃ k ≤ 5, x + k = y := this
have p_not_dvd_y := no_other_p_divisors_nearby x y p p_gt_5 x_lt_y nearby p_dvd_x
apply p_not_dvd_y
exact p_dvd_y
case inr y_lt_x =>
have := elems_in_interval_nearby y x n (s1 ∪ s2) partition y_in_interval x_in_interval y_lt_x
have nearby : ∃ k ≤ 5, y + k = x := this
have p_not_dvd_x := no_other_p_divisors_nearby y x p p_gt_5 y_lt_x nearby p_dvd_y
apply p_not_dvd_x
exact p_dvd_x
apply p_not_dvd_prod_y
exact p_dvd_prod_y
lemma odd_props (n : ℕ) (odd_s : Finset ℕ)
(s_odd_eq : odd_s = (Finset.Icc n (n + 5)).filter (λ x => Odd x)) :
∃ (a b c : ℕ), {a, b, c} = odd_s ∧ b = a + 2 ∧ c = b + 2 := by
by_cases h : Odd n
· have h2 := Odd.not_two_dvd_nat h
use n, n + 2, n + 4
simp_all only [Nat.two_dvd_ne_zero, and_self, and_true]
ext x
simp_all only [Finset.mem_insert, Finset.mem_singleton, Finset.mem_filter, Finset.mem_Icc]
apply Iff.intro <;> grind
· use n + 1, n + 3, n + 5
simp_all only [Nat.not_odd_iff_even, and_self, and_true]
have := Even.two_dvd h
ext x
simp_all only [Finset.mem_insert, Finset.mem_singleton, Finset.mem_filter, Finset.mem_Icc]
grind
lemma exactly_three_odd_numbers (n : ℕ) (odd_s : Finset ℕ)
(odd_s_eq: odd_s = (Finset.Icc n (n + 5)).filter (λ x => Odd x)): (odd_s).card = 3 := by
-- ∃ (a b c : ℕ), {a, b, c} = odd_s ∧ odd_s.card = 3
obtain ⟨x, y, z, ⟨left, ⟨y_eq, z_eq⟩⟩⟩ := odd_props n odd_s odd_s_eq
grind
lemma at_most_one (n : ℕ) (x y : ℕ)
(x_in_interval : x ∈ Finset.Icc n (n + 5)) (y_in_interval : y ∈ Finset.Icc n (n + 5))
(x_div_5 : 5 ∣ x )
(x_non_div_2 : ¬ 2 ∣ x)
(y_div_5 : 5 ∣ y )
(y_non_div_2 : ¬ 2 ∣ y) :
x = y := by
simp_all only [Finset.mem_Icc, Nat.two_dvd_ne_zero]
omega
lemma card_of_equal (s : Finset ℕ) : (∀ x ∈ s, ∀ y ∈ s, x = y) → s.card ≤ 1 := by
exact (@Finset.card_le_one ℕ s).mpr
lemma five_divides_odd_at_most_once (n : ℕ) (s odd_s : Finset ℕ) (partition : s = Finset.Icc n (n + 5))
(odd_s_eq: odd_s = s.filter (λ x => Odd x)) : (odd_s.filter (λ x => 5 ∣ x)).card ≤ 1 := by
have : (∀ x ∈ (odd_s.filter (λ x => 5 ∣ x)), ∀ y ∈ (odd_s.filter (λ y => 5 ∣ y)), x = y) → (odd_s.filter (λ x => 5 ∣ x)).card ≤ 1 := by
exact (card_of_equal) (odd_s.filter (λ x => 5 ∣ x))
apply this
rw [odd_s_eq]
intro x x_in y y_in
simp only [Finset.mem_filter] at x_in
obtain ⟨⟨X1, X2⟩, X3⟩ := x_in
simp only [Finset.mem_filter] at y_in
obtain ⟨⟨Y1, Y2⟩, Y3⟩ := y_in
apply at_most_one n
· rw[partition] at X1
exact X1
· rw[partition] at Y1
exact Y1
· exact X3
· exact Odd.not_two_dvd_nat X2
· exact Y3
· exact Odd.not_two_dvd_nat Y2
lemma unique_divisor (n : ZMod 3) (a b c : ℕ) (n_eq_a : n = a) (s : Finset ℕ) (s_eq : s = ({a, b, c} : Finset ℕ)) (b_eq: b = a + 2) (c_eq : c = b + 2) : ∃! a', a' ∈ s ∧ 3 ∣ a' := by
fin_cases n
· use a
have three_div_a : 3 ∣ a := by
apply (ZMod.natCast_eq_zero_iff a 3).mp
exact n_eq_a.symm
grind
· use b
have three_div_b : 3 ∣ b := by
simp_all only [Fin.mk_one]
apply (ZMod.natCast_eq_zero_iff (a + 2) 3).mp
simp_all only [Nat.cast_add, Nat.cast_ofNat]
rw [← n_eq_a]
rfl
constructor
· simp_all only [Fin.mk_one, Finset.mem_insert, add_eq_left, OfNat.ofNat_ne_zero, Finset.mem_singleton, left_eq_add, or_false, or_true, and_self]
· rintro o ⟨o_in_s, three_div_o⟩
rw[s_eq] at o_in_s
simp_all only [Fin.mk_one, Finset.mem_insert, Finset.mem_singleton]
omega
· use c
have three_div_c : 3 ∣ c := by
simp_all only [Nat.dvd_add_self_right]
apply (ZMod.natCast_eq_zero_iff (a + 1) 3).mp
simp_all only [Nat.cast_add, Nat.cast_one]
rw[← n_eq_a]
simp only [Nat.reduceAdd, Fin.reduceFinMk, Fin.isValue]
rfl
constructor
· simp_all only [Nat.dvd_add_self_right, Finset.mem_insert, add_eq_left, OfNat.ofNat_ne_zero, Finset.mem_singleton, or_true, and_self]
· rintro o ⟨o_in_s, three_div_o⟩
rw[s_eq] at o_in_s
simp_all only [Nat.dvd_add_self_right, Finset.mem_insert, Finset.mem_singleton]
omega
lemma card_1_of_exists_unique (s : Finset ℕ)
(predicate: ℕ → Prop)
[DecidablePred predicate]
(exists_unique : ∃! n ∈ s, predicate n) :
(Finset.filter (fun x ↦ predicate x) s).card = 1 := by
have := (@Finset.card_eq_one ℕ (Finset.filter (fun x ↦ predicate x) s)).mpr
apply this
obtain ⟨a', H⟩ := exists_unique
use a'
grind
lemma three_divides_odd_exactly_once (n : ℕ) (s odd_s : Finset ℕ) (partition : s = Finset.Icc n (n + 5))
(odd_s_eq: odd_s = s.filter (λ x => Odd x)) : (odd_s.filter (λ x => 3 ∣ x)).card = 1 := by
rw[partition] at odd_s_eq
obtain ⟨a, b, c, ⟨explicit_finset, b_comp, c_comp⟩⟩ := odd_props n odd_s odd_s_eq
rw[← partition] at odd_s_eq
rw[← explicit_finset]
have : (∃! a' ∈ ({a, b, c} : Finset ℕ), 3 ∣ a') → (Finset.filter (fun x ↦ 3 ∣ x) {a, b, c}).card = 1 := by
apply card_1_of_exists_unique
apply this
exact unique_divisor (↑a) a b c rfl {a, b, c} rfl b_comp c_comp
lemma empty_of_empty_subset (s : Finset ℕ) : s = {x_1 | x_1 ∈ (∅ : Finset ℕ) } → s = ∅ := by
simp only [Finset.notMem_empty, Set.setOf_false, Finset.coe_eq_empty, imp_self]
lemma enumerate_primes_le_5 (p : ℕ) (pp : p.Prime) (p_le_5 : p ≤ 5) : p ∈ ({2, 3, 5} : Finset ℕ) := by
by_contra H
simp only [Finset.mem_insert, Finset.mem_singleton, not_or] at H
obtain ⟨a, b, c⟩ := H
have := Nat.Prime.five_le_of_ne_two_of_ne_three pp
omega
lemma two_three_five_and_more_is_enough (x : ℕ) (two_does_not_divide : ¬ 2 ∣ x) (three_does_not_divide : ¬ 3 ∣ x) (five_does_not_divide : ¬ 5 ∣ x)
(p_gt_5_not_dvd : ∀ (p : ℕ), p.Prime → p > 5 → ¬p ∣ x):
¬ ∃ (p : ℕ), (p.Prime ∧ p ∣ x) := by
have p_le_5_not_dvd : ∀ (p : ℕ), p.Prime → p ≤ 5 → ¬ p ∣ x := by
intro p pp p_le_5 p_div_x
have p_subset : p ∈ ({2, 3, 5} : Finset ℕ) := enumerate_primes_le_5 p pp p_le_5
have : p = 2 ∨ p = 3 ∨ p = 5 := by
simp_all only [Nat.two_dvd_ne_zero, gt_iff_lt, Finset.mem_insert, Finset.mem_singleton]
cases this
case inl h =>
simp_all only [Nat.two_dvd_ne_zero, gt_iff_lt, Finset.mem_insert, Finset.mem_singleton, true_or]
omega
case inr h => grind
grind
lemma subsets_must_overlap_pigeonhole (s s1 s2 : Finset ℕ) (predicate_s1: ℕ → Prop) (predicate_s2 : ℕ → Prop)
[DecidablePred predicate_s1] [DecidablePred predicate_s2]
(s1_filter : s1 = (s.filter (λ x => predicate_s1 x)))
(s2_filter : s2 = (s.filter (λ x => predicate_s2 x)))
(a b c : ℕ) (total_size_exceeds: a + b > c)
(card_s : s.card = c) (card_s1 : s1.card = a) (card_s2 : s2.card = b):
∃ x ∈ s, predicate_s1 x ∧ predicate_s2 x := by
have s1_is_subset: s1 ⊆ s := by
rw[s1_filter]
apply Finset.filter_subset
have lift_x_in_s1 : ∀ x ∈ s, x ∈ s1 ↔ predicate_s1 x := by
rw[s1_filter]
intro x _
subst card_s
simp_all only [Finset.mem_filter, true_and]
have lift_x_in_s2 : ∀ x ∈ s, x ∈ s2 ↔ predicate_s2 x := by
rw[s2_filter]
intro x _
subst card_s
simp_all only [Finset.mem_filter, true_and]
apply not_forall_not.mp
intro h
simp only [not_and] at h
have step_1 : (∀ x ∈ s, predicate_s1 x → ¬predicate_s2 x) → (∀ x ∈ s, x ∈ s1 → ¬ x ∈ s2) := by
intro left x x_in_s predicate_s1_fulfills predicate_s2_fulfills
have part_1 := ((lift_x_in_s1 x x_in_s).mp predicate_s1_fulfills)
have part_2 := ((lift_x_in_s2 x x_in_s).mp predicate_s2_fulfills)
exact left x x_in_s part_1 part_2
have step_2 : (∀ x ∈ s, x ∈ s1 → x ∉ s2) → Disjoint s1 s2 := by
intro left
dsimp [Disjoint]
intro s3 rel1 rel2 a a_in_s3
have a_in_s1 := rel1 a_in_s3
have a_in_s2 := rel2 a_in_s3
have a_in_s : a ∈ s := s1_is_subset (rel1 a_in_s3)
exact absurd a_in_s2 (left a a_in_s a_in_s1)
have s1_s2_disjoint : Disjoint s1 s2 := by
apply step_2
apply step_1
exact h
have card_calc := Finset.card_union_of_disjoint s1_s2_disjoint
rw[card_s1] at card_calc
rw[card_s2] at card_calc
rw[← card_calc] at total_size_exceeds
rw[← card_s] at total_size_exceeds
have s1_s2_subset : (s1 ∪ s2) ⊆ s := by
intro a s1_or_s2
rcases Finset.mem_union.mp s1_or_s2 with left | left
· exact s1_is_subset left
· rw [s2_filter] at left; exact (Finset.mem_filter.mp left).1
have : (s1 ∪ s2).card ≤ s.card := by
apply Finset.card_le_card
exact s1_s2_subset
omega
lemma contains_one_or_zero (n : ℕ) (s1 s2 : Finset ℕ) (partition : s1 ∪ s2 = Finset.Icc n (n + 5)) (no_dups: s1 ∩ s2 = ∅)
(equal_products : ∏ m ∈ s1, m = ∏ m ∈ s2, m) : ∃ x ∈ (s1 ∪ s2), x = 1 ∨ x = 0 := by
let odd_s := (s1 ∪ s2).filter (λ x => Odd x)
let odd_div_by_5 := odd_s.filter (λ x => 5 ∣ x)
let odd_div_by_3 := odd_s.filter (λ x => 3 ∣ x)
let odd_non_div_by_5 := odd_s.filter (λ x => ¬ 5 ∣ x)
let odd_non_div_by_3 := odd_s.filter (λ x => ¬ 3 ∣ x)
have : odd_s = Finset.filter (fun x ↦ Odd x) (Finset.Icc n (n + 5)) := by
dsimp[odd_s]
rw[partition]
have three_odd_numbers := exactly_three_odd_numbers n odd_s this
have odd_div_by_3_card := three_divides_odd_exactly_once n (s1 ∪ s2) (odd_s) partition rfl
have odd_div_by_5_card := five_divides_odd_at_most_once n (s1 ∪ s2) (odd_s) partition rfl
have odd_div_by_5_exp_card : odd_div_by_5.card ≤ 1 := by
simp_all only [odd_s, odd_div_by_5]
have exactly_2_non_divisers_of_3 : odd_non_div_by_3.card = 2 := by
have := card_opposite odd_s odd_div_by_3 odd_non_div_by_3 (λ x => 3 ∣ x) rfl rfl
rw[three_odd_numbers] at this
rw[odd_div_by_3_card] at this
omega
have at_least_2_non_divisers_of_5 : odd_non_div_by_5.card ≥ 2 := by
have := card_opposite odd_s odd_div_by_5 odd_non_div_by_5 (fun x => 5 ∣ x) rfl rfl
rw[three_odd_numbers] at this
omega
let b := odd_non_div_by_5.card
have size_calculation : 2 + b > 3 := by
omega
have exists_odd_x_non_div_by_3_5 : ∃ x ∈ s1 ∪ s2, ¬ 3 ∣ x ∧ ¬ 5 ∣ x ∧ ¬ 2 ∣ x := by
obtain ⟨x, ⟨x_in_odd_s, non_div_3, non_div_5⟩⟩ := subsets_must_overlap_pigeonhole
odd_s odd_non_div_by_3 odd_non_div_by_5 (λ x => ¬ 3 ∣ x) (λ x => ¬ 5 ∣ x)
rfl rfl 2 b 3 size_calculation
three_odd_numbers exactly_2_non_divisers_of_3 rfl
use x
constructor
· simp_all only [Finset.mem_filter, odd_s]
· constructor
· exact non_div_3
grind
have exists_x_no_prime_divisors : ∃ x ∈ (s1 ∪ s2), ¬ ∃ (p : ℕ), Nat.Prime p ∧ p ∣ x := by
obtain ⟨x, x_in_s1_s2, non_div_3, non_div_5, non_div_2⟩ := exists_odd_x_non_div_by_3_5
use x
constructor
· exact x_in_s1_s2
· intro h
obtain ⟨p, ⟨pp, p_div⟩⟩ := h
have p_gt_5_not_dvd := p_gt_five_not_divides n s1 s2 partition no_dups equal_products x x_in_s1_s2
have to_apply := two_three_five_and_more_is_enough x non_div_2 non_div_3 non_div_5 p_gt_5_not_dvd
apply to_apply
use p
obtain ⟨x, ⟨x_in_s1_u_s2, no_prime⟩⟩ := exists_x_no_prime_divisors
use x
constructor
· exact x_in_s1_u_s2
· left
exact (Not.imp_symm Nat.exists_prime_and_dvd) no_prime
lemma n_eq_1_of_contains_one
(n : ℕ) (n_not_zero : n ≠ 0) (contains_one : 1 ∈ Finset.Icc n (n + 5)) : n = 1 := by
simp_all only [ne_eq, Finset.mem_Icc, le_add_iff_nonneg_left, zero_le, and_true]
omega
lemma diffs_of_disjoint (t s w : Finset ℕ) (t_subst_s : t ⊆ s) (disjoint: Disjoint t w) : t ⊆ s \ w := by
simp only [Finset.subset_sdiff, and_self, t_subst_s, disjoint]
lemma not_empty_subst_of_nonempty (t : Finset ℕ) (t_nonempty : t.Nonempty) : ¬ t ⊆ ∅ := by
rw [Finset.subset_empty]
exact t_nonempty.ne_empty
lemma mem_of_subst (k : ℕ) (t s : Finset ℕ) (k_in_t : k ∈ t) (t_subst_s : t ⊆ s) : k ∈ s := by
apply t_subst_s
simp_all only
lemma contradiction_of_finset_icc_1_6 (s1 s2 : Finset ℕ) (partition : s1 ∪ s2 = Finset.Icc 1 6)
(disjoint : s1 ∩ s2 = ∅) (eq_prod: ∏ m ∈ s1, m = ∏ m ∈ s2, m) : False := by
have : 5 ∈ s1 ∪ s2 := by
rw[partition]
simp only [Finset.mem_Icc, Nat.one_le_ofNat, Nat.reduceLeDiff, and_self]
simp only [Finset.mem_union] at this
cases this
· case inl five_in_s1 =>
have s2_in_s1_s2: s2 ⊆ s1 ∪ s2 := Finset.subset_union_right
have explicit_s2 : s2 ⊆ {1, 2, 3, 4, 6} := by
have five_not_in_s2 : Disjoint s2 {5} := by
have s1_s2_disjoint : Disjoint s1 s2 := Finset.disjoint_iff_inter_eq_empty.mpr disjoint
simp_all only [Finset.disjoint_singleton_right]
exact s1_s2_disjoint.notMem_of_mem_left_finset five_in_s1
have explicit_interval: Finset.Icc 1 6 = {1, 2, 3, 4, 5, 6} := by
rfl
have := diffs_of_disjoint s2 (s1 ∪ s2) {5} s2_in_s1_s2 five_not_in_s2
rw [partition] at this
rw[explicit_interval] at this
simp_all only [Finset.disjoint_singleton_right]
exact this
have others : ∀ k ∈ s2, ¬ 5 ∣ k := by
intro k k_in_s2
have k_in_explicit_s2 : k ∈ ({1, 2, 3, 4, 6} : Finset ℕ) := by
exact mem_of_subst k s2 {1, 2, 3, 4, 6} k_in_s2 explicit_s2
intro five_div_k
simp_all only [Finset.mem_insert, Finset.mem_singleton]
obtain rfl | rfl | rfl | rfl | rfl | rfl := k_in_explicit_s2 <;> contradiction
have five_div_prod_s1 := Finset.dvd_prod_of_mem (λ n : ℕ => n) five_in_s1
have five_div_prod_s2 : 5 ∣ ∏ m ∈ s2, m := by
rw[eq_prod] at five_div_prod_s1
exact five_div_prod_s1
obtain ⟨l, ⟨l_in_s2, five_div_l⟩⟩ :=
Prime.exists_mem_finset_dvd Nat.prime_five.prime five_div_prod_s2
exact others l l_in_s2 five_div_l
· case inr five_in_s2 =>
have s1_in_s2_s1: s1 ⊆ s2 ∪ s1 := Finset.subset_union_right
have explicit_s1 : s1 ⊆ {1, 2, 3, 4, 6} := by
have five_not_in_s1 : Disjoint s1 {5} := by
have : s2 ∩ s1 = ∅ := by
rw[Finset.inter_comm] at disjoint
exact disjoint
have s2_s1_disjoint : Disjoint s2 s1 := Finset.disjoint_iff_inter_eq_empty.mpr this
simp_all only [Finset.disjoint_singleton_right]
exact s2_s1_disjoint.notMem_of_mem_left_finset five_in_s2
have explicit_interval: Finset.Icc 1 6 = {1, 2, 3, 4, 5, 6} := by
rfl
have := diffs_of_disjoint s1 (s2 ∪ s1) {5} s1_in_s2_s1 five_not_in_s1
rw[Finset.union_comm] at this
rw [partition] at this
rw[explicit_interval] at this
simp_all only [Finset.disjoint_singleton_right]
exact this
have others : ∀ k ∈ s1, ¬ 5 ∣ k := by
intro k k_in_s1
have k_in_explicit_s1 : k ∈ ({1, 2, 3, 4, 6} : Finset ℕ) := by
exact mem_of_subst k s1 {1, 2, 3, 4, 6} k_in_s1 explicit_s1
intro five_div_k
simp_all only [Finset.mem_insert, Finset.mem_singleton]
omega
have five_div_prod_s2 := Finset.dvd_prod_of_mem (λ n : ℕ => n) five_in_s2
have five_div_prod_s1 : 5 ∣ ∏ m ∈ s1, m := by
rw[← eq_prod] at five_div_prod_s2
exact five_div_prod_s2
obtain ⟨l, ⟨l_in_s1, five_div_l⟩⟩ :=
Prime.exists_mem_finset_dvd Nat.prime_five.prime five_div_prod_s1
exact others l l_in_s1 five_div_l
lemma no_partitions (n : ℕ) (s1 s2 : Finset ℕ)
(partition : s1 ∪ s2 = Finset.Icc n (n + 5))
(no_dups : s1 ∩ s2 = ∅)
(eq_prod : ∏ m ∈ s1, m = ∏ m ∈ s2, m)
(n_not_zero : n ≠ 0) : False := by
obtain ⟨x, ⟨x_in_partition, x_eq_1⟩⟩ := contains_one_or_zero n s1 s2 partition no_dups eq_prod
rw[partition] at x_in_partition
cases x_eq_1
case inl h =>
rw[h] at x_in_partition
have n_eq_1 := n_eq_1_of_contains_one n n_not_zero x_in_partition
rw[n_eq_1] at partition
exact contradiction_of_finset_icc_1_6 s1 s2 partition no_dups eq_prod
case inr h =>
simp_all only [ne_eq, Finset.mem_Icc, nonpos_iff_eq_zero, le_add_iff_nonneg_left, zero_le, and_true]
lemma contradiction_of_in_empty (x : ℕ+) (s : Finset ℕ+) (s_empty: s = ∅) (x_in_s : x ∈ s) : False := by
subst s_empty
simp_all only [Finset.notMem_empty]
lemma n_plus_not_zero (n : ℕ+) : ∃(k : ℕ), n = k ∧ k ≠ 0 := by
simp_all only [ne_eq, exists_eq_left', PNat.ne_zero, not_false_eq_true]
abbrev SolutionSet : Finset ℕ+ := {}
theorem imo1970_p4 (n : ℕ+):
n ∈ SolutionSet ↔
∃ s1 s2 : Finset ℕ,
s1 ∪ s2 = Finset.Icc n.val (n.val + 5) ∧
s1 ∩ s2 = ∅ ∧
∏ m ∈ s1, m = ∏ m ∈ s2, m := by
apply Iff.intro
· intro n_in_solution_set
have no_solutions : SolutionSet = ∅ := by
simp_all only [Finset.notMem_empty]
exfalso
exact contradiction_of_in_empty n SolutionSet no_solutions n_in_solution_set
· intro H
obtain ⟨s1, s2, ⟨partition, no_dups, eq_prod⟩⟩ := H
obtain ⟨k, ⟨n_eq_k, k_not_zero⟩⟩ := n_plus_not_zero n
rw [n_eq_k] at partition
exfalso
exact no_partitions k s1 s2 partition no_dups eq_prod k_not_zero
end Imo1970P4 | /- | /-
Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw, Adam Kurkiewicz
-/
import Mathlib
/-!
# International Mathematical Olympiad 1970, Problem 4
Determine the set of all positive integers n with the property that
the set {n, n + 1, n + 2, n + 3, n + 4, n + 5} can be partitioned
into two sets such that the product of the numbers in one set
equals the product of the numbers in the other set.
-/
namespace Imo1970P4
lemma card_opposite (s s' s'' : Finset ℕ) (predicate: ℕ → Prop)
[DecidablePred predicate] (filter : s' = (s.filter (λ x => predicate x)))
(opposite_filter: s'' = (s.filter (λ x => ¬ predicate x))) :
s'.card + s''.card = s.card := by
rw [filter]
rw [opposite_filter]
exact Finset.card_filter_add_card_filter_not predicate
lemma no_other_p_divisors_nearby (x : ℕ) (y : ℕ) (p : ℕ) (p_gt_5 : p > 5) (x_lt_y : x < y)
(close_by: ∃ k, k ≤ 5 ∧ x + k = y) (x_div_p : p ∣ x) : ¬ p ∣ y := by
obtain ⟨k, hk_le, rfl⟩ := close_by
have h_not_div_k : ¬ p ∣ k :=
Nat.not_dvd_of_pos_of_lt (Nat.lt_add_right_iff_pos.mp x_lt_y) (Nat.lt_of_le_of_lt hk_le p_gt_5)
simp_all [Nat.dvd_add_right]
lemma no_other_5_divisors_nearby (x : ℕ) (y : ℕ) (x_lt_y : x < y) (close_by: ∃ k, k ≤ 4 ∧ x + k = y) (x_div_p : 5 ∣ x) : ¬ (5 ∣ y) := by
omega
-- The next few functions apply the following logic from the Art of Problem Solving Solution 1
-- There are exactly three odd numbers in s
-- p > 5 is not a divisor of any of those three odd numbers
-- p = 5 is a divisor of at most one of those three odd numbers
-- p = 3 is a divisor of exactly one of those three odd numbers
-- because these numbers are odd, p = 2 is not a divisor of any of those odd numbers
-- p = 2, p = 3, p = 5 and p > 5 are all the prime numbers out there.
-- by pigeonhole principle, one odd number must not have any prime divisors
-- this number must be 1.
-- The only two intervals that contain 1 are {1, 2, 3, 4, 5, 6} and {0, 1, 2, 3, 4, 5}
lemma elems_in_interval_nearby (x y n : ℕ ) (s : Finset ℕ) (interval : s = Finset.Icc n (n + 5))
(x_in_s : x ∈ s) (y_in_s : y ∈ s) (x_lt_y : x < y) : ∃ k ≤ 5, x + k = y := by
simp_all only [Finset.mem_Icc]
use y - x
omega
lemma p_gt_five_not_divides (n : ℕ) (s1 s2 : Finset ℕ) (partition : s1 ∪ s2 = Finset.Icc n (n + 5)) (no_dups: s1 ∩ s2 = ∅)
(equal_products : ∏ m ∈ s1, m = ∏ m ∈ s2, m) (x : ℕ) (x_in_interval : x ∈ s1 ∪ s2)
(p : ℕ) (pp : Nat.Prime p) (p_gt_5 : p > 5) : ¬ (p ∣ x) := by
intro p_dvd_x
have x_in_s1_or_x_in_s2 : x ∈ s1 ∨ x ∈ s2 := Finset.mem_union.mp x_in_interval
cases x_in_s1_or_x_in_s2
case inl x_in_s1 =>
have p_dvd_prod_x : p ∣ ∏ m ∈ s1, m := by
have := Finset.dvd_prod_of_mem (λ n : ℕ => n) x_in_s1
exact Dvd.dvd.trans p_dvd_x this
have p_dvd_prod_y : p ∣ ∏ m ∈ s2, m := by
rw[equal_products] at p_dvd_prod_x
exact p_dvd_prod_x
have p_not_dvd_prod_y : ¬ p ∣ ∏ m ∈ s2, m := by
intro h
obtain ⟨y, ⟨y_in_s2, p_dvd_y⟩⟩ := Prime.exists_mem_finset_dvd pp.prime h
have s1_s2_disjoint : Disjoint s1 s2 := Finset.disjoint_iff_inter_eq_empty.mpr no_dups
have x_not_y : x ≠ y := (Finset.disjoint_iff_ne.mp s1_s2_disjoint) x x_in_s1 y y_in_s2
have x_lt_y_or_y_lt_x := Ne.lt_or_gt x_not_y
have y_in_interval : y ∈ s1 ∪ s2 := Finset.mem_union_right s1 y_in_s2
cases x_lt_y_or_y_lt_x
case inl x_lt_y =>
have := elems_in_interval_nearby x y n (s1 ∪ s2) partition x_in_interval y_in_interval x_lt_y
have nearby : ∃ k ≤ 5, x + k = y := this
have p_not_dvd_y := no_other_p_divisors_nearby x y p p_gt_5 x_lt_y nearby p_dvd_x
apply p_not_dvd_y
exact p_dvd_y
case inr y_lt_x =>
have := elems_in_interval_nearby y x n (s1 ∪ s2) partition y_in_interval x_in_interval y_lt_x
have nearby : ∃ k ≤ 5, y + k = x := this
have p_not_dvd_x := no_other_p_divisors_nearby y x p p_gt_5 y_lt_x nearby p_dvd_y
apply p_not_dvd_x
exact p_dvd_x
apply p_not_dvd_prod_y
exact p_dvd_prod_y
case inr x_in_s2 =>
have := Finset.dvd_prod_of_mem (λ n : ℕ => n) x_in_s2
simp only at this
have p_dvd_prod_x : p ∣ ∏ m ∈ s2, m := (Dvd.dvd.trans p_dvd_x this)
have p_dvd_prod_y : p ∣ ∏ m ∈ s1, m := by
rw[← equal_products] at p_dvd_prod_x
exact p_dvd_prod_x
have p_not_dvd_prod_y : ¬ p ∣ ∏ m ∈ s1, m := by
intro h
obtain ⟨y, ⟨y_in_s1, p_dvd_y⟩⟩ := Prime.exists_mem_finset_dvd pp.prime h
have : s2 ∩ s1 = ∅ := by
rw [← no_dups]
exact Finset.inter_comm s2 s1
have s2_s1_disjoint : Disjoint s2 s1 := Finset.disjoint_iff_inter_eq_empty.mpr this
have x_not_y : x ≠ y := (Finset.disjoint_iff_ne.mp s2_s1_disjoint) x x_in_s2 y y_in_s1
have x_lt_y_or_y_lt_x := Ne.lt_or_gt x_not_y
have y_in_interval : y ∈ s1 ∪ s2 := Finset.mem_union_left s2 y_in_s1
cases x_lt_y_or_y_lt_x
case inl x_lt_y =>
have := elems_in_interval_nearby x y n (s1 ∪ s2) partition x_in_interval y_in_interval x_lt_y
have nearby : ∃ k ≤ 5, x + k = y := this
have p_not_dvd_y := no_other_p_divisors_nearby x y p p_gt_5 x_lt_y nearby p_dvd_x
apply p_not_dvd_y
exact p_dvd_y
case inr y_lt_x =>
have := elems_in_interval_nearby y x n (s1 ∪ s2) partition y_in_interval x_in_interval y_lt_x
have nearby : ∃ k ≤ 5, y + k = x := this
have p_not_dvd_x := no_other_p_divisors_nearby y x p p_gt_5 y_lt_x nearby p_dvd_y
apply p_not_dvd_x
exact p_dvd_x
apply p_not_dvd_prod_y
exact p_dvd_prod_y
lemma odd_props (n : ℕ) (odd_s : Finset ℕ)
(s_odd_eq : odd_s = (Finset.Icc n (n + 5)).filter (λ x => Odd x)) :
∃ (a b c : ℕ), {a, b, c} = odd_s ∧ b = a + 2 ∧ c = b + 2 := by
by_cases h : Odd n
· have h2 := Odd.not_two_dvd_nat h
use n, n + 2, n + 4
simp_all only [Nat.two_dvd_ne_zero, and_self, and_true]
ext x
simp_all only [Finset.mem_insert, Finset.mem_singleton, Finset.mem_filter, Finset.mem_Icc]
apply Iff.intro <;> grind
· use n + 1, n + 3, n + 5
simp_all only [Nat.not_odd_iff_even, and_self, and_true]
have := Even.two_dvd h
ext x
simp_all only [Finset.mem_insert, Finset.mem_singleton, Finset.mem_filter, Finset.mem_Icc]
grind
lemma exactly_three_odd_numbers (n : ℕ) (odd_s : Finset ℕ)
(odd_s_eq: odd_s = (Finset.Icc n (n + 5)).filter (λ x => Odd x)): (odd_s).card = 3 := by
-- ∃ (a b c : ℕ), {a, b, c} = odd_s ∧ odd_s.card = 3
obtain ⟨x, y, z, ⟨left, ⟨y_eq, z_eq⟩⟩⟩ := odd_props n odd_s odd_s_eq
grind
lemma at_most_one (n : ℕ) (x y : ℕ)
(x_in_interval : x ∈ Finset.Icc n (n + 5)) (y_in_interval : y ∈ Finset.Icc n (n + 5))
(x_div_5 : 5 ∣ x )
(x_non_div_2 : ¬ 2 ∣ x)
(y_div_5 : 5 ∣ y )
(y_non_div_2 : ¬ 2 ∣ y) :
x = y := by
simp_all only [Finset.mem_Icc, Nat.two_dvd_ne_zero]
omega
lemma card_of_equal (s : Finset ℕ) : (∀ x ∈ s, ∀ y ∈ s, x = y) → s.card ≤ 1 := by
exact (@Finset.card_le_one ℕ s).mpr
lemma five_divides_odd_at_most_once (n : ℕ) (s odd_s : Finset ℕ) (partition : s = Finset.Icc n (n + 5))
(odd_s_eq: odd_s = s.filter (λ x => Odd x)) : (odd_s.filter (λ x => 5 ∣ x)).card ≤ 1 := by
have : (∀ x ∈ (odd_s.filter (λ x => 5 ∣ x)), ∀ y ∈ (odd_s.filter (λ y => 5 ∣ y)), x = y) → (odd_s.filter (λ x => 5 ∣ x)).card ≤ 1 := by
exact (card_of_equal) (odd_s.filter (λ x => 5 ∣ x))
apply this
rw [odd_s_eq]
intro x x_in y y_in
simp only [Finset.mem_filter] at x_in
obtain ⟨⟨X1, X2⟩, X3⟩ := x_in
simp only [Finset.mem_filter] at y_in
obtain ⟨⟨Y1, Y2⟩, Y3⟩ := y_in
apply at_most_one n
· rw[partition] at X1
exact X1
· rw[partition] at Y1
exact Y1
· exact X3
· exact Odd.not_two_dvd_nat X2
· exact Y3
· exact Odd.not_two_dvd_nat Y2
lemma unique_divisor (n : ZMod 3) (a b c : ℕ) (n_eq_a : n = a) (s : Finset ℕ) (s_eq : s = ({a, b, c} : Finset ℕ)) (b_eq: b = a + 2) (c_eq : c = b + 2) : ∃! a', a' ∈ s ∧ 3 ∣ a' := by
fin_cases n
· use a
have three_div_a : 3 ∣ a := by
apply (ZMod.natCast_eq_zero_iff a 3).mp
exact n_eq_a.symm
grind
· use b
have three_div_b : 3 ∣ b := by
simp_all only [Fin.mk_one]
apply (ZMod.natCast_eq_zero_iff (a + 2) 3).mp
simp_all only [Nat.cast_add, Nat.cast_ofNat]
rw [← n_eq_a]
rfl
constructor
· simp_all only [Fin.mk_one, Finset.mem_insert, add_eq_left, OfNat.ofNat_ne_zero, Finset.mem_singleton, left_eq_add, or_false, or_true, and_self]
· rintro o ⟨o_in_s, three_div_o⟩
rw[s_eq] at o_in_s
simp_all only [Fin.mk_one, Finset.mem_insert, Finset.mem_singleton]
omega
· use c
have three_div_c : 3 ∣ c := by
simp_all only [Nat.dvd_add_self_right]
apply (ZMod.natCast_eq_zero_iff (a + 1) 3).mp
simp_all only [Nat.cast_add, Nat.cast_one]
rw[← n_eq_a]
simp only [Nat.reduceAdd, Fin.reduceFinMk, Fin.isValue]
rfl
constructor
· simp_all only [Nat.dvd_add_self_right, Finset.mem_insert, add_eq_left, OfNat.ofNat_ne_zero, Finset.mem_singleton, or_true, and_self]
· rintro o ⟨o_in_s, three_div_o⟩
rw[s_eq] at o_in_s
simp_all only [Nat.dvd_add_self_right, Finset.mem_insert, Finset.mem_singleton]
omega
lemma card_1_of_exists_unique (s : Finset ℕ)
(predicate: ℕ → Prop)
[DecidablePred predicate]
(exists_unique : ∃! n ∈ s, predicate n) :
(Finset.filter (fun x ↦ predicate x) s).card = 1 := by
have := (@Finset.card_eq_one ℕ (Finset.filter (fun x ↦ predicate x) s)).mpr
apply this
obtain ⟨a', H⟩ := exists_unique
use a'
grind
lemma three_divides_odd_exactly_once (n : ℕ) (s odd_s : Finset ℕ) (partition : s = Finset.Icc n (n + 5))
(odd_s_eq: odd_s = s.filter (λ x => Odd x)) : (odd_s.filter (λ x => 3 ∣ x)).card = 1 := by
rw[partition] at odd_s_eq
obtain ⟨a, b, c, ⟨explicit_finset, b_comp, c_comp⟩⟩ := odd_props n odd_s odd_s_eq
rw[← partition] at odd_s_eq
rw[← explicit_finset]
have : (∃! a' ∈ ({a, b, c} : Finset ℕ), 3 ∣ a') → (Finset.filter (fun x ↦ 3 ∣ x) {a, b, c}).card = 1 := by
apply card_1_of_exists_unique
apply this
exact unique_divisor (↑a) a b c rfl {a, b, c} rfl b_comp c_comp
lemma empty_of_empty_subset (s : Finset ℕ) : s = {x_1 | x_1 ∈ (∅ : Finset ℕ) } → s = ∅ := by
simp only [Finset.notMem_empty, Set.setOf_false, Finset.coe_eq_empty, imp_self]
lemma enumerate_primes_le_5 (p : ℕ) (pp : p.Prime) (p_le_5 : p ≤ 5) : p ∈ ({2, 3, 5} : Finset ℕ) := by
by_contra H
simp only [Finset.mem_insert, Finset.mem_singleton, not_or] at H
obtain ⟨a, b, c⟩ := H
have := Nat.Prime.five_le_of_ne_two_of_ne_three pp
omega
lemma two_three_five_and_more_is_enough (x : ℕ) (two_does_not_divide : ¬ 2 ∣ x) (three_does_not_divide : ¬ 3 ∣ x) (five_does_not_divide : ¬ 5 ∣ x)
(p_gt_5_not_dvd : ∀ (p : ℕ), p.Prime → p > 5 → ¬p ∣ x):
¬ ∃ (p : ℕ), (p.Prime ∧ p ∣ x) := by
have p_le_5_not_dvd : ∀ (p : ℕ), p.Prime → p ≤ 5 → ¬ p ∣ x := by
intro p pp p_le_5 p_div_x
have p_subset : p ∈ ({2, 3, 5} : Finset ℕ) := enumerate_primes_le_5 p pp p_le_5
have : p = 2 ∨ p = 3 ∨ p = 5 := by
simp_all only [Nat.two_dvd_ne_zero, gt_iff_lt, Finset.mem_insert, Finset.mem_singleton]
cases this
case inl h =>
simp_all only [Nat.two_dvd_ne_zero, gt_iff_lt, Finset.mem_insert, Finset.mem_singleton, true_or]
omega
case inr h => grind
grind
lemma subsets_must_overlap_pigeonhole (s s1 s2 : Finset ℕ) (predicate_s1: ℕ → Prop) (predicate_s2 : ℕ → Prop)
[DecidablePred predicate_s1] [DecidablePred predicate_s2]
(s1_filter : s1 = (s.filter (λ x => predicate_s1 x)))
(s2_filter : s2 = (s.filter (λ x => predicate_s2 x)))
(a b c : ℕ) (total_size_exceeds: a + b > c)
(card_s : s.card = c) (card_s1 : s1.card = a) (card_s2 : s2.card = b):
∃ x ∈ s, predicate_s1 x ∧ predicate_s2 x := by
have s1_is_subset: s1 ⊆ s := by
rw[s1_filter]
apply Finset.filter_subset
have lift_x_in_s1 : ∀ x ∈ s, x ∈ s1 ↔ predicate_s1 x := by
rw[s1_filter]
intro x _
subst card_s
simp_all only [Finset.mem_filter, true_and]
have lift_x_in_s2 : ∀ x ∈ s, x ∈ s2 ↔ predicate_s2 x := by
rw[s2_filter]
intro x _
subst card_s
simp_all only [Finset.mem_filter, true_and]
apply not_forall_not.mp
intro h
simp only [not_and] at h
have step_1 : (∀ x ∈ s, predicate_s1 x → ¬predicate_s2 x) → (∀ x ∈ s, x ∈ s1 → ¬ x ∈ s2) := by
intro left x x_in_s predicate_s1_fulfills predicate_s2_fulfills
have part_1 := ((lift_x_in_s1 x x_in_s).mp predicate_s1_fulfills)
have part_2 := ((lift_x_in_s2 x x_in_s).mp predicate_s2_fulfills)
exact left x x_in_s part_1 part_2
have step_2 : (∀ x ∈ s, x ∈ s1 → x ∉ s2) → Disjoint s1 s2 := by
intro left
dsimp [Disjoint]
intro s3 rel1 rel2 a a_in_s3
have a_in_s1 := rel1 a_in_s3
have a_in_s2 := rel2 a_in_s3
have a_in_s : a ∈ s := s1_is_subset (rel1 a_in_s3)
exact absurd a_in_s2 (left a a_in_s a_in_s1)
have s1_s2_disjoint : Disjoint s1 s2 := by
apply step_2
apply step_1
exact h
have card_calc := Finset.card_union_of_disjoint s1_s2_disjoint
rw[card_s1] at card_calc
rw[card_s2] at card_calc
rw[← card_calc] at total_size_exceeds
rw[← card_s] at total_size_exceeds
have s1_s2_subset : (s1 ∪ s2) ⊆ s := by
intro a s1_or_s2
rcases Finset.mem_union.mp s1_or_s2 with left | left
· exact s1_is_subset left
· rw [s2_filter] at left; exact (Finset.mem_filter.mp left).1
have : (s1 ∪ s2).card ≤ s.card := by
apply Finset.card_le_card
exact s1_s2_subset
omega
lemma contains_one_or_zero (n : ℕ) (s1 s2 : Finset ℕ) (partition : s1 ∪ s2 = Finset.Icc n (n + 5)) (no_dups: s1 ∩ s2 = ∅)
(equal_products : ∏ m ∈ s1, m = ∏ m ∈ s2, m) : ∃ x ∈ (s1 ∪ s2), x = 1 ∨ x = 0 := by
let odd_s := (s1 ∪ s2).filter (λ x => Odd x)
let odd_div_by_5 := odd_s.filter (λ x => 5 ∣ x)
let odd_div_by_3 := odd_s.filter (λ x => 3 ∣ x)
let odd_non_div_by_5 := odd_s.filter (λ x => ¬ 5 ∣ x)
let odd_non_div_by_3 := odd_s.filter (λ x => ¬ 3 ∣ x)
have : odd_s = Finset.filter (fun x ↦ Odd x) (Finset.Icc n (n + 5)) := by
dsimp[odd_s]
rw[partition]
have three_odd_numbers := exactly_three_odd_numbers n odd_s this
have odd_div_by_3_card := three_divides_odd_exactly_once n (s1 ∪ s2) (odd_s) partition rfl
have odd_div_by_5_card := five_divides_odd_at_most_once n (s1 ∪ s2) (odd_s) partition rfl
have odd_div_by_5_exp_card : odd_div_by_5.card ≤ 1 := by
simp_all only [odd_s, odd_div_by_5]
have exactly_2_non_divisers_of_3 : odd_non_div_by_3.card = 2 := by
have := card_opposite odd_s odd_div_by_3 odd_non_div_by_3 (λ x => 3 ∣ x) rfl rfl
rw[three_odd_numbers] at this
rw[odd_div_by_3_card] at this
omega
have at_least_2_non_divisers_of_5 : odd_non_div_by_5.card ≥ 2 := by
have := card_opposite odd_s odd_div_by_5 odd_non_div_by_5 (fun x => 5 ∣ x) rfl rfl
rw[three_odd_numbers] at this
omega
let b := odd_non_div_by_5.card
have size_calculation : 2 + b > 3 := by
omega
have exists_odd_x_non_div_by_3_5 : ∃ x ∈ s1 ∪ s2, ¬ 3 ∣ x ∧ ¬ 5 ∣ x ∧ ¬ 2 ∣ x := by
obtain ⟨x, ⟨x_in_odd_s, non_div_3, non_div_5⟩⟩ := subsets_must_overlap_pigeonhole
odd_s odd_non_div_by_3 odd_non_div_by_5 (λ x => ¬ 3 ∣ x) (λ x => ¬ 5 ∣ x)
rfl rfl 2 b 3 size_calculation
three_odd_numbers exactly_2_non_divisers_of_3 rfl
use x
constructor
· simp_all only [Finset.mem_filter, odd_s]
· constructor
· exact non_div_3
grind
have exists_x_no_prime_divisors : ∃ x ∈ (s1 ∪ s2), ¬ ∃ (p : ℕ), Nat.Prime p ∧ p ∣ x := by
obtain ⟨x, x_in_s1_s2, non_div_3, non_div_5, non_div_2⟩ := exists_odd_x_non_div_by_3_5
use x
constructor
· exact x_in_s1_s2
· intro h
obtain ⟨p, ⟨pp, p_div⟩⟩ := h
have p_gt_5_not_dvd := p_gt_five_not_divides n s1 s2 partition no_dups equal_products x x_in_s1_s2
have to_apply := two_three_five_and_more_is_enough x non_div_2 non_div_3 non_div_5 p_gt_5_not_dvd
apply to_apply
use p
obtain ⟨x, ⟨x_in_s1_u_s2, no_prime⟩⟩ := exists_x_no_prime_divisors
use x
constructor
· exact x_in_s1_u_s2
· left
exact (Not.imp_symm Nat.exists_prime_and_dvd) no_prime
lemma n_eq_1_of_contains_one
(n : ℕ) (n_not_zero : n ≠ 0) (contains_one : 1 ∈ Finset.Icc n (n + 5)) : n = 1 := by
simp_all only [ne_eq, Finset.mem_Icc, le_add_iff_nonneg_left, zero_le, and_true]
omega
lemma diffs_of_disjoint (t s w : Finset ℕ) (t_subst_s : t ⊆ s) (disjoint: Disjoint t w) : t ⊆ s \ w := by
simp only [Finset.subset_sdiff, and_self, t_subst_s, disjoint]
lemma not_empty_subst_of_nonempty (t : Finset ℕ) (t_nonempty : t.Nonempty) : ¬ t ⊆ ∅ := by
rw [Finset.subset_empty]
exact t_nonempty.ne_empty
lemma mem_of_subst (k : ℕ) (t s : Finset ℕ) (k_in_t : k ∈ t) (t_subst_s : t ⊆ s) : k ∈ s := by
apply t_subst_s
simp_all only
lemma contradiction_of_finset_icc_1_6 (s1 s2 : Finset ℕ) (partition : s1 ∪ s2 = Finset.Icc 1 6)
(disjoint : s1 ∩ s2 = ∅) (eq_prod: ∏ m ∈ s1, m = ∏ m ∈ s2, m) : False := by
have : 5 ∈ s1 ∪ s2 := by
rw[partition]
simp only [Finset.mem_Icc, Nat.one_le_ofNat, Nat.reduceLeDiff, and_self]
simp only [Finset.mem_union] at this
cases this
· case inl five_in_s1 =>
have s2_in_s1_s2: s2 ⊆ s1 ∪ s2 := Finset.subset_union_right
have explicit_s2 : s2 ⊆ {1, 2, 3, 4, 6} := by
have five_not_in_s2 : Disjoint s2 {5} := by
have s1_s2_disjoint : Disjoint s1 s2 := Finset.disjoint_iff_inter_eq_empty.mpr disjoint
simp_all only [Finset.disjoint_singleton_right]
exact s1_s2_disjoint.notMem_of_mem_left_finset five_in_s1
have explicit_interval: Finset.Icc 1 6 = {1, 2, 3, 4, 5, 6} := by
rfl
have := diffs_of_disjoint s2 (s1 ∪ s2) {5} s2_in_s1_s2 five_not_in_s2
rw [partition] at this
rw[explicit_interval] at this
simp_all only [Finset.disjoint_singleton_right]
exact this
have others : ∀ k ∈ s2, ¬ 5 ∣ k := by
intro k k_in_s2
have k_in_explicit_s2 : k ∈ ({1, 2, 3, 4, 6} : Finset ℕ) := by
exact mem_of_subst k s2 {1, 2, 3, 4, 6} k_in_s2 explicit_s2
intro five_div_k
simp_all only [Finset.mem_insert, Finset.mem_singleton]
obtain rfl | rfl | rfl | rfl | rfl | rfl := k_in_explicit_s2 <;> contradiction
have five_div_prod_s1 := Finset.dvd_prod_of_mem (λ n : ℕ => n) five_in_s1
have five_div_prod_s2 : 5 ∣ ∏ m ∈ s2, m := by
rw[eq_prod] at five_div_prod_s1
exact five_div_prod_s1
obtain ⟨l, ⟨l_in_s2, five_div_l⟩⟩ :=
Prime.exists_mem_finset_dvd Nat.prime_five.prime five_div_prod_s2
exact others l l_in_s2 five_div_l
· case inr five_in_s2 =>
have s1_in_s2_s1: s1 ⊆ s2 ∪ s1 := Finset.subset_union_right
have explicit_s1 : s1 ⊆ {1, 2, 3, 4, 6} := by
have five_not_in_s1 : Disjoint s1 {5} := by
have : s2 ∩ s1 = ∅ := by
rw[Finset.inter_comm] at disjoint
exact disjoint
have s2_s1_disjoint : Disjoint s2 s1 := Finset.disjoint_iff_inter_eq_empty.mpr this
simp_all only [Finset.disjoint_singleton_right]
exact s2_s1_disjoint.notMem_of_mem_left_finset five_in_s2
have explicit_interval: Finset.Icc 1 6 = {1, 2, 3, 4, 5, 6} := by
rfl
have := diffs_of_disjoint s1 (s2 ∪ s1) {5} s1_in_s2_s1 five_not_in_s1
rw[Finset.union_comm] at this
rw [partition] at this
rw[explicit_interval] at this
simp_all only [Finset.disjoint_singleton_right]
exact this
have others : ∀ k ∈ s1, ¬ 5 ∣ k := by
intro k k_in_s1
have k_in_explicit_s1 : k ∈ ({1, 2, 3, 4, 6} : Finset ℕ) := by
exact mem_of_subst k s1 {1, 2, 3, 4, 6} k_in_s1 explicit_s1
intro five_div_k
simp_all only [Finset.mem_insert, Finset.mem_singleton]
omega
have five_div_prod_s2 := Finset.dvd_prod_of_mem (λ n : ℕ => n) five_in_s2
have five_div_prod_s1 : 5 ∣ ∏ m ∈ s1, m := by
rw[← eq_prod] at five_div_prod_s2
exact five_div_prod_s2
obtain ⟨l, ⟨l_in_s1, five_div_l⟩⟩ :=
Prime.exists_mem_finset_dvd Nat.prime_five.prime five_div_prod_s1
exact others l l_in_s1 five_div_l
lemma no_partitions (n : ℕ) (s1 s2 : Finset ℕ)
(partition : s1 ∪ s2 = Finset.Icc n (n + 5))
(no_dups : s1 ∩ s2 = ∅)
(eq_prod : ∏ m ∈ s1, m = ∏ m ∈ s2, m)
(n_not_zero : n ≠ 0) : False := by
obtain ⟨x, ⟨x_in_partition, x_eq_1⟩⟩ := contains_one_or_zero n s1 s2 partition no_dups eq_prod
rw[partition] at x_in_partition
cases x_eq_1
case inl h =>
rw[h] at x_in_partition
have n_eq_1 := n_eq_1_of_contains_one n n_not_zero x_in_partition
rw[n_eq_1] at partition
exact contradiction_of_finset_icc_1_6 s1 s2 partition no_dups eq_prod
case inr h =>
simp_all only [ne_eq, Finset.mem_Icc, nonpos_iff_eq_zero, le_add_iff_nonneg_left, zero_le, and_true]
lemma contradiction_of_in_empty (x : ℕ+) (s : Finset ℕ+) (s_empty: s = ∅) (x_in_s : x ∈ s) : False := by
subst s_empty
simp_all only [Finset.notMem_empty]
lemma n_plus_not_zero (n : ℕ+) : ∃(k : ℕ), n = k ∧ k ≠ 0 := by
simp_all only [ne_eq, exists_eq_left', PNat.ne_zero, not_false_eq_true]
abbrev SolutionSet : Finset ℕ+ := {}
theorem imo1970_p4 (n : ℕ+):
n ∈ SolutionSet ↔
∃ s1 s2 : Finset ℕ,
s1 ∪ s2 = Finset.Icc n.val (n.val + 5) ∧
s1 ∩ s2 = ∅ ∧
∏ m ∈ s1, m = ∏ m ∈ s2, m := by
apply Iff.intro
· intro n_in_solution_set
have no_solutions : SolutionSet = ∅ := by
simp_all only [Finset.notMem_empty]
exfalso
exact contradiction_of_in_empty n SolutionSet no_solutions n_in_solution_set
· intro H
obtain ⟨s1, s2, ⟨partition, no_dups, eq_prod⟩⟩ := H
obtain ⟨k, ⟨n_eq_k, k_not_zero⟩⟩ := n_plus_not_zero n
rw [n_eq_k] at partition
exfalso
exact no_partitions k s1 s2 partition no_dups eq_prod k_not_zero
end Imo1970P4
| true | Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw, Adam Kurkiewicz
-/
import Mathlib
/-!
# International Mathematical Olympiad 1970, Problem 4
Determine the set of all positive integers n with the property that
the set {n, n + 1, n + 2, n + 3, n + 4, n + 5} can be partitioned
into two sets such that the product of the numbers in one set
equals the product of the numbers in the other set.
-/
namespace Imo1970P4
lemma card_opposite (s s' s'' : Finset ℕ) (predicate: ℕ → Prop)
[DecidablePred predicate] (filter : s' = (s.filter (λ x => predicate x)))
(opposite_filter: s'' = (s.filter (λ x => ¬ predicate x))) :
s'.card + s''.card = s.card := by
rw [filter]
rw [opposite_filter]
exact Finset.card_filter_add_card_filter_not predicate
lemma no_other_p_divisors_nearby (x : ℕ) (y : ℕ) (p : ℕ) (p_gt_5 : p > 5) (x_lt_y : x < y)
(close_by: ∃ k, k ≤ 5 ∧ x + k = y) (x_div_p : p ∣ x) : ¬ p ∣ y := by
obtain ⟨k, hk_le, rfl⟩ := close_by
have h_not_div_k : ¬ p ∣ k :=
Nat.not_dvd_of_pos_of_lt (Nat.lt_add_right_iff_pos.mp x_lt_y) (Nat.lt_of_le_of_lt hk_le p_gt_5)
simp_all [Nat.dvd_add_right]
lemma no_other_5_divisors_nearby (x : ℕ) (y : ℕ) (x_lt_y : x < y) (close_by: ∃ k, k ≤ 4 ∧ x + k = y) (x_div_p : 5 ∣ x) : ¬ (5 ∣ y) := by
omega
-- The next few functions apply the following logic from the Art of Problem Solving Solution 1
-- There are exactly three odd numbers in s
-- p > 5 is not a divisor of any of those three odd numbers
-- p = 5 is a divisor of at most one of those three odd numbers
-- p = 3 is a divisor of exactly one of those three odd numbers
-- because these numbers are odd, p = 2 is not a divisor of any of those odd numbers
-- p = 2, p = 3, p = 5 and p > 5 are all the prime numbers out there.
-- by pigeonhole principle, one odd number must not have any prime divisors
-- this number must be 1.
-- The only two intervals that contain 1 are {1, 2, 3, 4, 5, 6} and {0, 1, 2, 3, 4, 5}
lemma elems_in_interval_nearby (x y n : ℕ ) (s : Finset ℕ) (interval : s = Finset.Icc n (n + 5))
(x_in_s : x ∈ s) (y_in_s : y ∈ s) (x_lt_y : x < y) : ∃ k ≤ 5, x + k = y := by
simp_all only [Finset.mem_Icc]
use y - x
omega
lemma p_gt_five_not_divides (n : ℕ) (s1 s2 : Finset ℕ) (partition : s1 ∪ s2 = Finset.Icc n (n + 5)) (no_dups: s1 ∩ s2 = ∅)
(equal_products : ∏ m ∈ s1, m = ∏ m ∈ s2, m) (x : ℕ) (x_in_interval : x ∈ s1 ∪ s2)
(p : ℕ) (pp : Nat.Prime p) (p_gt_5 : p > 5) : ¬ (p ∣ x) := by
intro p_dvd_x
have x_in_s1_or_x_in_s2 : x ∈ s1 ∨ x ∈ s2 := Finset.mem_union.mp x_in_interval
cases x_in_s1_or_x_in_s2
case inl x_in_s1 =>
have p_dvd_prod_x : p ∣ ∏ m ∈ s1, m := by
have := Finset.dvd_prod_of_mem (λ n : ℕ => n) x_in_s1
exact Dvd.dvd.trans p_dvd_x this
have p_dvd_prod_y : p ∣ ∏ m ∈ s2, m := by
rw[equal_products] at p_dvd_prod_x
exact p_dvd_prod_x
have p_not_dvd_prod_y : ¬ p ∣ ∏ m ∈ s2, m := by
intro h
obtain ⟨y, ⟨y_in_s2, p_dvd_y⟩⟩ := Prime.exists_mem_finset_dvd pp.prime h
have s1_s2_disjoint : Disjoint s1 s2 := Finset.disjoint_iff_inter_eq_empty.mpr no_dups
have x_not_y : x ≠ y := (Finset.disjoint_iff_ne.mp s1_s2_disjoint) x x_in_s1 y y_in_s2
have x_lt_y_or_y_lt_x := Ne.lt_or_gt x_not_y
have y_in_interval : y ∈ s1 ∪ s2 := Finset.mem_union_right s1 y_in_s2
cases x_lt_y_or_y_lt_x
case inl x_lt_y =>
have := elems_in_interval_nearby x y n (s1 ∪ s2) partition x_in_interval y_in_interval x_lt_y
have nearby : ∃ k ≤ 5, x + k = y := this
have p_not_dvd_y := no_other_p_divisors_nearby x y p p_gt_5 x_lt_y nearby p_dvd_x
apply p_not_dvd_y
exact p_dvd_y
case inr y_lt_x =>
have := elems_in_interval_nearby y x n (s1 ∪ s2) partition y_in_interval x_in_interval y_lt_x
have nearby : ∃ k ≤ 5, y + k = x := this
have p_not_dvd_x := no_other_p_divisors_nearby y x p p_gt_5 y_lt_x nearby p_dvd_y
apply p_not_dvd_x
exact p_dvd_x
apply p_not_dvd_prod_y
exact p_dvd_prod_y
case inr x_in_s2 =>
have := Finset.dvd_prod_of_mem (λ n : ℕ => n) x_in_s2
simp only at this
have p_dvd_prod_x : p ∣ ∏ m ∈ s2, m := (Dvd.dvd.trans p_dvd_x this)
have p_dvd_prod_y : p ∣ ∏ m ∈ s1, m := by
rw[← equal_products] at p_dvd_prod_x
exact p_dvd_prod_x
have p_not_dvd_prod_y : ¬ p ∣ ∏ m ∈ s1, m := by
intro h
obtain ⟨y, ⟨y_in_s1, p_dvd_y⟩⟩ := Prime.exists_mem_finset_dvd pp.prime h
have : s2 ∩ s1 = ∅ := by
rw [← no_dups]
exact Finset.inter_comm s2 s1
have s2_s1_disjoint : Disjoint s2 s1 := Finset.disjoint_iff_inter_eq_empty.mpr this
have x_not_y : x ≠ y := (Finset.disjoint_iff_ne.mp s2_s1_disjoint) x x_in_s2 y y_in_s1
have x_lt_y_or_y_lt_x := Ne.lt_or_gt x_not_y
have y_in_interval : y ∈ s1 ∪ s2 := Finset.mem_union_left s2 y_in_s1
cases x_lt_y_or_y_lt_x
case inl x_lt_y =>
have := elems_in_interval_nearby x y n (s1 ∪ s2) partition x_in_interval y_in_interval x_lt_y
have nearby : ∃ k ≤ 5, x + k = y := this
have p_not_dvd_y := no_other_p_divisors_nearby x y p p_gt_5 x_lt_y nearby p_dvd_x
apply p_not_dvd_y
exact p_dvd_y
case inr y_lt_x =>
have := elems_in_interval_nearby y x n (s1 ∪ s2) partition y_in_interval x_in_interval y_lt_x
have nearby : ∃ k ≤ 5, y + k = x := this
have p_not_dvd_x := no_other_p_divisors_nearby y x p p_gt_5 y_lt_x nearby p_dvd_y
apply p_not_dvd_x
exact p_dvd_x
apply p_not_dvd_prod_y
exact p_dvd_prod_y
lemma odd_props (n : ℕ) (odd_s : Finset ℕ)
(s_odd_eq : odd_s = (Finset.Icc n (n + 5)).filter (λ x => Odd x)) :
∃ (a b c : ℕ), {a, b, c} = odd_s ∧ b = a + 2 ∧ c = b + 2 := by
by_cases h : Odd n
· have h2 := Odd.not_two_dvd_nat h
use n, n + 2, n + 4
simp_all only [Nat.two_dvd_ne_zero, and_self, and_true]
ext x
simp_all only [Finset.mem_insert, Finset.mem_singleton, Finset.mem_filter, Finset.mem_Icc]
apply Iff.intro <;> grind
· use n + 1, n + 3, n + 5
simp_all only [Nat.not_odd_iff_even, and_self, and_true]
have := Even.two_dvd h
ext x
simp_all only [Finset.mem_insert, Finset.mem_singleton, Finset.mem_filter, Finset.mem_Icc]
grind
lemma exactly_three_odd_numbers (n : ℕ) (odd_s : Finset ℕ)
(odd_s_eq: odd_s = (Finset.Icc n (n + 5)).filter (λ x => Odd x)): (odd_s).card = 3 := by
-- ∃ (a b c : ℕ), {a, b, c} = odd_s ∧ odd_s.card = 3
obtain ⟨x, y, z, ⟨left, ⟨y_eq, z_eq⟩⟩⟩ := odd_props n odd_s odd_s_eq
grind
lemma at_most_one (n : ℕ) (x y : ℕ)
(x_in_interval : x ∈ Finset.Icc n (n + 5)) (y_in_interval : y ∈ Finset.Icc n (n + 5))
(x_div_5 : 5 ∣ x )
(x_non_div_2 : ¬ 2 ∣ x)
(y_div_5 : 5 ∣ y )
(y_non_div_2 : ¬ 2 ∣ y) :
x = y := by
simp_all only [Finset.mem_Icc, Nat.two_dvd_ne_zero]
omega
lemma card_of_equal (s : Finset ℕ) : (∀ x ∈ s, ∀ y ∈ s, x = y) → s.card ≤ 1 := by
exact (@Finset.card_le_one ℕ s).mpr
lemma five_divides_odd_at_most_once (n : ℕ) (s odd_s : Finset ℕ) (partition : s = Finset.Icc n (n + 5))
(odd_s_eq: odd_s = s.filter (λ x => Odd x)) : (odd_s.filter (λ x => 5 ∣ x)).card ≤ 1 := by
have : (∀ x ∈ (odd_s.filter (λ x => 5 ∣ x)), ∀ y ∈ (odd_s.filter (λ y => 5 ∣ y)), x = y) → (odd_s.filter (λ x => 5 ∣ x)).card ≤ 1 := by
exact (card_of_equal) (odd_s.filter (λ x => 5 ∣ x))
apply this
rw [odd_s_eq]
intro x x_in y y_in
simp only [Finset.mem_filter] at x_in
obtain ⟨⟨X1, X2⟩, X3⟩ := x_in
simp only [Finset.mem_filter] at y_in
obtain ⟨⟨Y1, Y2⟩, Y3⟩ := y_in
apply at_most_one n
· rw[partition] at X1
exact X1
· rw[partition] at Y1
exact Y1
· exact X3
· exact Odd.not_two_dvd_nat X2
· exact Y3
· exact Odd.not_two_dvd_nat Y2
lemma unique_divisor (n : ZMod 3) (a b c : ℕ) (n_eq_a : n = a) (s : Finset ℕ) (s_eq : s = ({a, b, c} : Finset ℕ)) (b_eq: b = a + 2) (c_eq : c = b + 2) : ∃! a', a' ∈ s ∧ 3 ∣ a' := by
fin_cases n
· use a
have three_div_a : 3 ∣ a := by
apply (ZMod.natCast_eq_zero_iff a 3).mp
exact n_eq_a.symm
grind
· use b
have three_div_b : 3 ∣ b := by
simp_all only [Fin.mk_one]
apply (ZMod.natCast_eq_zero_iff (a + 2) 3).mp
simp_all only [Nat.cast_add, Nat.cast_ofNat]
rw [← n_eq_a]
rfl
constructor
· simp_all only [Fin.mk_one, Finset.mem_insert, add_eq_left, OfNat.ofNat_ne_zero, Finset.mem_singleton, left_eq_add, or_false, or_true, and_self]
· rintro o ⟨o_in_s, three_div_o⟩
rw[s_eq] at o_in_s
simp_all only [Fin.mk_one, Finset.mem_insert, Finset.mem_singleton]
omega
· use c
have three_div_c : 3 ∣ c := by
simp_all only [Nat.dvd_add_self_right]
apply (ZMod.natCast_eq_zero_iff (a + 1) 3).mp
simp_all only [Nat.cast_add, Nat.cast_one]
rw[← n_eq_a]
simp only [Nat.reduceAdd, Fin.reduceFinMk, Fin.isValue]
rfl
constructor
· simp_all only [Nat.dvd_add_self_right, Finset.mem_insert, add_eq_left, OfNat.ofNat_ne_zero, Finset.mem_singleton, or_true, and_self]
· rintro o ⟨o_in_s, three_div_o⟩
rw[s_eq] at o_in_s
simp_all only [Nat.dvd_add_self_right, Finset.mem_insert, Finset.mem_singleton]
omega
lemma card_1_of_exists_unique (s : Finset ℕ)
(predicate: ℕ → Prop)
[DecidablePred predicate]
(exists_unique : ∃! n ∈ s, predicate n) :
(Finset.filter (fun x ↦ predicate x) s).card = 1 := by
have := (@Finset.card_eq_one ℕ (Finset.filter (fun x ↦ predicate x) s)).mpr
apply this
obtain ⟨a', H⟩ := exists_unique
use a'
grind
lemma three_divides_odd_exactly_once (n : ℕ) (s odd_s : Finset ℕ) (partition : s = Finset.Icc n (n + 5))
(odd_s_eq: odd_s = s.filter (λ x => Odd x)) : (odd_s.filter (λ x => 3 ∣ x)).card = 1 := by
rw[partition] at odd_s_eq
obtain ⟨a, b, c, ⟨explicit_finset, b_comp, c_comp⟩⟩ := odd_props n odd_s odd_s_eq
rw[← partition] at odd_s_eq
rw[← explicit_finset]
have : (∃! a' ∈ ({a, b, c} : Finset ℕ), 3 ∣ a') → (Finset.filter (fun x ↦ 3 ∣ x) {a, b, c}).card = 1 := by
apply card_1_of_exists_unique
apply this
exact unique_divisor (↑a) a b c rfl {a, b, c} rfl b_comp c_comp
lemma empty_of_empty_subset (s : Finset ℕ) : s = {x_1 | x_1 ∈ (∅ : Finset ℕ) } → s = ∅ := by
simp only [Finset.notMem_empty, Set.setOf_false, Finset.coe_eq_empty, imp_self]
lemma enumerate_primes_le_5 (p : ℕ) (pp : p.Prime) (p_le_5 : p ≤ 5) : p ∈ ({2, 3, 5} : Finset ℕ) := by
by_contra H
simp only [Finset.mem_insert, Finset.mem_singleton, not_or] at H
obtain ⟨a, b, c⟩ := H
have := Nat.Prime.five_le_of_ne_two_of_ne_three pp
omega
lemma two_three_five_and_more_is_enough (x : ℕ) (two_does_not_divide : ¬ 2 ∣ x) (three_does_not_divide : ¬ 3 ∣ x) (five_does_not_divide : ¬ 5 ∣ x)
(p_gt_5_not_dvd : ∀ (p : ℕ), p.Prime → p > 5 → ¬p ∣ x):
¬ ∃ (p : ℕ), (p.Prime ∧ p ∣ x) := by
have p_le_5_not_dvd : ∀ (p : ℕ), p.Prime → p ≤ 5 → ¬ p ∣ x := by
intro p pp p_le_5 p_div_x
have p_subset : p ∈ ({2, 3, 5} : Finset ℕ) := enumerate_primes_le_5 p pp p_le_5
have : p = 2 ∨ p = 3 ∨ p = 5 := by
simp_all only [Nat.two_dvd_ne_zero, gt_iff_lt, Finset.mem_insert, Finset.mem_singleton]
cases this
case inl h =>
simp_all only [Nat.two_dvd_ne_zero, gt_iff_lt, Finset.mem_insert, Finset.mem_singleton, true_or]
omega
case inr h => grind
grind
lemma subsets_must_overlap_pigeonhole (s s1 s2 : Finset ℕ) (predicate_s1: ℕ → Prop) (predicate_s2 : ℕ → Prop)
[DecidablePred predicate_s1] [DecidablePred predicate_s2]
(s1_filter : s1 = (s.filter (λ x => predicate_s1 x)))
(s2_filter : s2 = (s.filter (λ x => predicate_s2 x)))
(a b c : ℕ) (total_size_exceeds: a + b > c)
(card_s : s.card = c) (card_s1 : s1.card = a) (card_s2 : s2.card = b):
∃ x ∈ s, predicate_s1 x ∧ predicate_s2 x := by
have s1_is_subset: s1 ⊆ s := by
rw[s1_filter]
apply Finset.filter_subset
have lift_x_in_s1 : ∀ x ∈ s, x ∈ s1 ↔ predicate_s1 x := by
rw[s1_filter]
intro x _
subst card_s
simp_all only [Finset.mem_filter, true_and]
have lift_x_in_s2 : ∀ x ∈ s, x ∈ s2 ↔ predicate_s2 x := by
rw[s2_filter]
intro x _
subst card_s
simp_all only [Finset.mem_filter, true_and]
apply not_forall_not.mp
intro h
simp only [not_and] at h
have step_1 : (∀ x ∈ s, predicate_s1 x → ¬predicate_s2 x) → (∀ x ∈ s, x ∈ s1 → ¬ x ∈ s2) := by
intro left x x_in_s predicate_s1_fulfills predicate_s2_fulfills
have part_1 := ((lift_x_in_s1 x x_in_s).mp predicate_s1_fulfills)
have part_2 := ((lift_x_in_s2 x x_in_s).mp predicate_s2_fulfills)
exact left x x_in_s part_1 part_2
have step_2 : (∀ x ∈ s, x ∈ s1 → x ∉ s2) → Disjoint s1 s2 := by
intro left
dsimp [Disjoint]
intro s3 rel1 rel2 a a_in_s3
have a_in_s1 := rel1 a_in_s3
have a_in_s2 := rel2 a_in_s3
have a_in_s : a ∈ s := s1_is_subset (rel1 a_in_s3)
exact absurd a_in_s2 (left a a_in_s a_in_s1)
have s1_s2_disjoint : Disjoint s1 s2 := by
apply step_2
apply step_1
exact h
have card_calc := Finset.card_union_of_disjoint s1_s2_disjoint
rw[card_s1] at card_calc
rw[card_s2] at card_calc
rw[← card_calc] at total_size_exceeds
rw[← card_s] at total_size_exceeds
have s1_s2_subset : (s1 ∪ s2) ⊆ s := by
intro a s1_or_s2
rcases Finset.mem_union.mp s1_or_s2 with left | left
· exact s1_is_subset left
· rw [s2_filter] at left; exact (Finset.mem_filter.mp left).1
have : (s1 ∪ s2).card ≤ s.card := by
apply Finset.card_le_card
exact s1_s2_subset
omega
lemma contains_one_or_zero (n : ℕ) (s1 s2 : Finset ℕ) (partition : s1 ∪ s2 = Finset.Icc n (n + 5)) (no_dups: s1 ∩ s2 = ∅)
(equal_products : ∏ m ∈ s1, m = ∏ m ∈ s2, m) : ∃ x ∈ (s1 ∪ s2), x = 1 ∨ x = 0 := by
let odd_s := (s1 ∪ s2).filter (λ x => Odd x)
let odd_div_by_5 := odd_s.filter (λ x => 5 ∣ x)
let odd_div_by_3 := odd_s.filter (λ x => 3 ∣ x)
let odd_non_div_by_5 := odd_s.filter (λ x => ¬ 5 ∣ x)
let odd_non_div_by_3 := odd_s.filter (λ x => ¬ 3 ∣ x)
have : odd_s = Finset.filter (fun x ↦ Odd x) (Finset.Icc n (n + 5)) := by
dsimp[odd_s]
rw[partition]
have three_odd_numbers := exactly_three_odd_numbers n odd_s this
have odd_div_by_3_card := three_divides_odd_exactly_once n (s1 ∪ s2) (odd_s) partition rfl
have odd_div_by_5_card := five_divides_odd_at_most_once n (s1 ∪ s2) (odd_s) partition rfl
have odd_div_by_5_exp_card : odd_div_by_5.card ≤ 1 := by
simp_all only [odd_s, odd_div_by_5]
have exactly_2_non_divisers_of_3 : odd_non_div_by_3.card = 2 := by
have := card_opposite odd_s odd_div_by_3 odd_non_div_by_3 (λ x => 3 ∣ x) rfl rfl
rw[three_odd_numbers] at this
rw[odd_div_by_3_card] at this
omega
have at_least_2_non_divisers_of_5 : odd_non_div_by_5.card ≥ 2 := by
have := card_opposite odd_s odd_div_by_5 odd_non_div_by_5 (fun x => 5 ∣ x) rfl rfl
rw[three_odd_numbers] at this
omega
let b := odd_non_div_by_5.card
have size_calculation : 2 + b > 3 := by
omega
have exists_odd_x_non_div_by_3_5 : ∃ x ∈ s1 ∪ s2, ¬ 3 ∣ x ∧ ¬ 5 ∣ x ∧ ¬ 2 ∣ x := by
obtain ⟨x, ⟨x_in_odd_s, non_div_3, non_div_5⟩⟩ := subsets_must_overlap_pigeonhole
odd_s odd_non_div_by_3 odd_non_div_by_5 (λ x => ¬ 3 ∣ x) (λ x => ¬ 5 ∣ x)
rfl rfl 2 b 3 size_calculation
three_odd_numbers exactly_2_non_divisers_of_3 rfl
use x
constructor
· simp_all only [Finset.mem_filter, odd_s]
· constructor
· exact non_div_3
grind
have exists_x_no_prime_divisors : ∃ x ∈ (s1 ∪ s2), ¬ ∃ (p : ℕ), Nat.Prime p ∧ p ∣ x := by
obtain ⟨x, x_in_s1_s2, non_div_3, non_div_5, non_div_2⟩ := exists_odd_x_non_div_by_3_5
use x
constructor
· exact x_in_s1_s2
· intro h
obtain ⟨p, ⟨pp, p_div⟩⟩ := h
have p_gt_5_not_dvd := p_gt_five_not_divides n s1 s2 partition no_dups equal_products x x_in_s1_s2
have to_apply := two_three_five_and_more_is_enough x non_div_2 non_div_3 non_div_5 p_gt_5_not_dvd
apply to_apply
use p
obtain ⟨x, ⟨x_in_s1_u_s2, no_prime⟩⟩ := exists_x_no_prime_divisors
use x
constructor
· exact x_in_s1_u_s2
· left
exact (Not.imp_symm Nat.exists_prime_and_dvd) no_prime
lemma n_eq_1_of_contains_one
(n : ℕ) (n_not_zero : n ≠ 0) (contains_one : 1 ∈ Finset.Icc n (n + 5)) : n = 1 := by
simp_all only [ne_eq, Finset.mem_Icc, le_add_iff_nonneg_left, zero_le, and_true]
omega
lemma diffs_of_disjoint (t s w : Finset ℕ) (t_subst_s : t ⊆ s) (disjoint: Disjoint t w) : t ⊆ s \ w := by
simp only [Finset.subset_sdiff, and_self, t_subst_s, disjoint]
lemma not_empty_subst_of_nonempty (t : Finset ℕ) (t_nonempty : t.Nonempty) : ¬ t ⊆ ∅ := by
rw [Finset.subset_empty]
exact t_nonempty.ne_empty
lemma mem_of_subst (k : ℕ) (t s : Finset ℕ) (k_in_t : k ∈ t) (t_subst_s : t ⊆ s) : k ∈ s := by
apply t_subst_s
simp_all only
lemma contradiction_of_finset_icc_1_6 (s1 s2 : Finset ℕ) (partition : s1 ∪ s2 = Finset.Icc 1 6)
(disjoint : s1 ∩ s2 = ∅) (eq_prod: ∏ m ∈ s1, m = ∏ m ∈ s2, m) : False := by
have : 5 ∈ s1 ∪ s2 := by
rw[partition]
simp only [Finset.mem_Icc, Nat.one_le_ofNat, Nat.reduceLeDiff, and_self]
simp only [Finset.mem_union] at this
cases this
· case inl five_in_s1 =>
have s2_in_s1_s2: s2 ⊆ s1 ∪ s2 := Finset.subset_union_right
have explicit_s2 : s2 ⊆ {1, 2, 3, 4, 6} := by
have five_not_in_s2 : Disjoint s2 {5} := by
have s1_s2_disjoint : Disjoint s1 s2 := Finset.disjoint_iff_inter_eq_empty.mpr disjoint
simp_all only [Finset.disjoint_singleton_right]
exact s1_s2_disjoint.notMem_of_mem_left_finset five_in_s1
have explicit_interval: Finset.Icc 1 6 = {1, 2, 3, 4, 5, 6} := by
rfl
have := diffs_of_disjoint s2 (s1 ∪ s2) {5} s2_in_s1_s2 five_not_in_s2
rw [partition] at this
rw[explicit_interval] at this
simp_all only [Finset.disjoint_singleton_right]
exact this
have others : ∀ k ∈ s2, ¬ 5 ∣ k := by
intro k k_in_s2
have k_in_explicit_s2 : k ∈ ({1, 2, 3, 4, 6} : Finset ℕ) := by
exact mem_of_subst k s2 {1, 2, 3, 4, 6} k_in_s2 explicit_s2
intro five_div_k
simp_all only [Finset.mem_insert, Finset.mem_singleton]
obtain rfl | rfl | rfl | rfl | rfl | rfl := k_in_explicit_s2 <;> contradiction
have five_div_prod_s1 := Finset.dvd_prod_of_mem (λ n : ℕ => n) five_in_s1
have five_div_prod_s2 : 5 ∣ ∏ m ∈ s2, m := by
rw[eq_prod] at five_div_prod_s1
exact five_div_prod_s1
obtain ⟨l, ⟨l_in_s2, five_div_l⟩⟩ :=
Prime.exists_mem_finset_dvd Nat.prime_five.prime five_div_prod_s2
exact others l l_in_s2 five_div_l
· case inr five_in_s2 =>
have s1_in_s2_s1: s1 ⊆ s2 ∪ s1 := Finset.subset_union_right
have explicit_s1 : s1 ⊆ {1, 2, 3, 4, 6} := by
have five_not_in_s1 : Disjoint s1 {5} := by
have : s2 ∩ s1 = ∅ := by
rw[Finset.inter_comm] at disjoint
exact disjoint
have s2_s1_disjoint : Disjoint s2 s1 := Finset.disjoint_iff_inter_eq_empty.mpr this
simp_all only [Finset.disjoint_singleton_right]
exact s2_s1_disjoint.notMem_of_mem_left_finset five_in_s2
have explicit_interval: Finset.Icc 1 6 = {1, 2, 3, 4, 5, 6} := by
rfl
have := diffs_of_disjoint s1 (s2 ∪ s1) {5} s1_in_s2_s1 five_not_in_s1
rw[Finset.union_comm] at this
rw [partition] at this
rw[explicit_interval] at this
simp_all only [Finset.disjoint_singleton_right]
exact this
have others : ∀ k ∈ s1, ¬ 5 ∣ k := by
intro k k_in_s1
have k_in_explicit_s1 : k ∈ ({1, 2, 3, 4, 6} : Finset ℕ) := by
exact mem_of_subst k s1 {1, 2, 3, 4, 6} k_in_s1 explicit_s1
intro five_div_k
simp_all only [Finset.mem_insert, Finset.mem_singleton]
omega
have five_div_prod_s2 := Finset.dvd_prod_of_mem (λ n : ℕ => n) five_in_s2
have five_div_prod_s1 : 5 ∣ ∏ m ∈ s1, m := by
rw[← eq_prod] at five_div_prod_s2
exact five_div_prod_s2
obtain ⟨l, ⟨l_in_s1, five_div_l⟩⟩ :=
Prime.exists_mem_finset_dvd Nat.prime_five.prime five_div_prod_s1
exact others l l_in_s1 five_div_l
lemma no_partitions (n : ℕ) (s1 s2 : Finset ℕ)
(partition : s1 ∪ s2 = Finset.Icc n (n + 5))
(no_dups : s1 ∩ s2 = ∅)
(eq_prod : ∏ m ∈ s1, m = ∏ m ∈ s2, m)
(n_not_zero : n ≠ 0) : False := by
obtain ⟨x, ⟨x_in_partition, x_eq_1⟩⟩ := contains_one_or_zero n s1 s2 partition no_dups eq_prod
rw[partition] at x_in_partition
cases x_eq_1
case inl h =>
rw[h] at x_in_partition
have n_eq_1 := n_eq_1_of_contains_one n n_not_zero x_in_partition
rw[n_eq_1] at partition
exact contradiction_of_finset_icc_1_6 s1 s2 partition no_dups eq_prod
case inr h =>
simp_all only [ne_eq, Finset.mem_Icc, nonpos_iff_eq_zero, le_add_iff_nonneg_left, zero_le, and_true]
lemma contradiction_of_in_empty (x : ℕ+) (s : Finset ℕ+) (s_empty: s = ∅) (x_in_s : x ∈ s) : False := by
subst s_empty
simp_all only [Finset.notMem_empty]
lemma n_plus_not_zero (n : ℕ+) : ∃(k : ℕ), n = k ∧ k ≠ 0 := by
simp_all only [ne_eq, exists_eq_left', PNat.ne_zero, not_false_eq_true]
abbrev SolutionSet : Finset ℕ+ := {}
theorem imo1970_p4 (n : ℕ+):
n ∈ SolutionSet ↔
∃ s1 s2 : Finset ℕ,
s1 ∪ s2 = Finset.Icc n.val (n.val + 5) ∧
s1 ∩ s2 = ∅ ∧
∏ m ∈ s1, m = ∏ m ∈ s2, m := by
apply Iff.intro
· intro n_in_solution_set
have no_solutions : SolutionSet = ∅ := by
simp_all only [Finset.notMem_empty]
exfalso
exact contradiction_of_in_empty n SolutionSet no_solutions n_in_solution_set
· intro H
obtain ⟨s1, s2, ⟨partition, no_dups, eq_prod⟩⟩ := H
obtain ⟨k, ⟨n_eq_k, k_not_zero⟩⟩ := n_plus_not_zero n
rw [n_eq_k] at partition
exfalso
exact no_partitions k s1 s2 partition no_dups eq_prod k_not_zero
end Imo1970P4 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1970P4.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown constant 'Finset.card_filter_add_card_filter_not'", "unknown tactic", "unsolved goals\nx y : \u2115\nx_lt_y : x < y\nclose_by : \u2203 k \u2264 4, x + k = y\nx_div_p : 5 \u2223 x\n\u22a2 \u00ac5 \u2223 y", "unknown tactic", "unsolved goals\ncase h\nx y n : \u2115\ns : Finset \u2115\ninterval : s = Finset.Icc n (n + 5)\nx_in_s : n \u2264 x \u2227 x \u2264 n + 5\ny_in_s : n \u2264 y \u2227 y \u2264 n + 5\nx_lt_y : x < y\n\u22a2 y - x \u2264 5 \u2227 x + (y - x) = y", "`grind` failed\ncase grind.2.2.2.1\nn : \u2115\nodd_s : Finset \u2115\ns_odd_eq : odd_s = {x \u2208 Finset.Icc n (n + 5) | Odd x}\nh : Odd n\nh2 : n % 2 = 1\nx : \u2115\nh_4 : \u00acOdd x\nh_6 : x = n + 2\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] odd_s = {x \u2208 Finset.Icc n (n + 5) | Odd x}\n [prop] Odd n\n [prop] n % 2 = 1\n [prop] \u2191n % 2 + -1 \u2264 0\n [prop] -1 * (\u2191n % 2) \u2264 0\n [prop] -1 * \u2191n + 2 * (\u2191n / 2) + \u2191n % 2 = 0\n [prop] x = n \u2228 x = n + 2 \u2228 x = n + 4\n [prop] x + 1 \u2264 n \u2228 n + 6 \u2264 x \u2228 \u00acOdd x\n [prop] n + 6 \u2264 x \u2228 \u00acOdd x\n [prop] \u00acOdd x\n [prop] x = n + 2 \u2228 x = n + 4\n [prop] x = n + 2\n [eqc] True propositions\n [prop] Odd n\n [prop] \u2191n % 2 + -1 \u2264 0\n [prop] -1 * (\u2191n % 2) \u2264 0\n [prop] x = n \u2228 x = n + 2 \u2228 x = n + 4\n [prop] x + 1 \u2264 n \u2228 n + 6 \u2264 x \u2228 \u00acOdd x\n [prop] n + 6 \u2264 x \u2228 \u00acOdd x\n [prop] \u00acOdd x\n [prop] x = n + 2 \u2228 x = n + 4\n [prop] x = n + 2\n [eqc] False propositions\n [prop] Odd x\n [prop] n + 6 \u2264 x\n [eqc] Equivalence classes\n [eqc] {\u2191x, \u2191(n + 2)}\n [eqc] {x, n + 2}\n [eqc] {-1 * \u2191n + 2 * (\u2191n / 2) + \u2191n % 2, 0}\n [eqc] {\u2191(n % 2), \u21911}\n [eqc] {n % 2, 1}\n [eqc] {fun x => Odd x, Odd}\n [eqc] {odd_s, {x \u2208 Finset.Icc n (n + 5) | Odd x}}\n [cases] Case analyses\n [cases] [2/2]: x + 1 \u2264 n \u2228 n + 6 \u2264 x \u2228 \u00acOdd x\n [cases] [2/2]: n + 6 \u2264 x \u2228 \u00acOdd x\n [cases] [2/2]: x = n \u2228 x = n + 2 \u2228 x = n + 4\n [cases] [1/2]: x = n + 2 \u2228 x = n + 4\n [cutsat] Assignment satisfying linear constraints\n [assign] n := 1\n [assign] x := 3\n [ring] Ring `\u2124`\n [basis] Basis\n [_] \u2191n + -2 * (\u2191n / 2) + -1 * (\u2191n % 2) = 0", "`grind` failed\ncase grind\nn : \u2115\nodd_s : Finset \u2115\ns_odd_eq : odd_s = {x \u2208 Finset.Icc n (n + 5) | Odd x}\nh : Odd n\nh2 : n % 2 = 1\nx : \u2115\nleft : n \u2264 x\nleft_1 : x \u2264 n + 5\nright_1 : Odd x\nleft_2 : \u00acx = n\nleft_3 : \u00acx = n + 2\nright_3 : \u00acx = n + 4\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] odd_s = {x \u2208 Finset.Icc n (n + 5) | Odd x}\n [prop] Odd n\n [prop] n % 2 = 1\n [prop] \u2191n % 2 + -1 \u2264 0\n [prop] -1 * (\u2191n % 2) \u2264 0\n [prop] -1 * \u2191n + 2 * (\u2191n / 2) + \u2191n % 2 = 0\n [prop] n \u2264 x\n [prop] x \u2264 n + 5\n [prop] Odd x\n [prop] \u00acx = n\n [prop] \u00acx = n + 2\n [prop] \u00acx = n + 4\n [eqc] True propositions\n [prop] Odd n\n [prop] \u2191n % 2 + -1 \u2264 0\n [prop] -1 * (\u2191n % 2) \u2264 0\n [prop] n \u2264 x\n [prop] x \u2264 n + 5\n [prop] Odd x\n [eqc] False propositions\n [prop] x = n\n [prop] x = n + 2\n [prop] x = n + 4\n [eqc] Equivalence classes\n [eqc] {-1 * \u2191n + 2 * (\u2191n / 2) + \u2191n % 2, 0}\n [eqc] {\u2191(n % 2), \u21911}\n [eqc] {n % 2, 1}\n [eqc] {fun x => Odd x, Odd}\n [eqc] {odd_s, {x \u2208 Finset.Icc n (n + 5) | Odd x}}\n [cutsat] Assignment satisfying linear constraints\n [assign] n := 1\n [assign] x := 12\n [ring] Ring `\u2124`\n [basis] Basis\n [_] \u2191n + -2 * (\u2191n / 2) + -1 * (\u2191n % 2) = 0", "`grind` failed\ncase grind.1.2.2.1\nn : \u2115\nodd_s : Finset \u2115\ns_odd_eq : odd_s = {x \u2208 Finset.Icc n (n + 5) | Odd x}\nh : Even n\nthis : 2 \u2223 n\nx : \u2115\nh_1 : (x = n + 1 \u2228 x = n + 3 \u2228 x = n + 5) = (x + 1 \u2264 n \u2228 n + 6 \u2264 x \u2228 \u00acOdd x)\nright : x + 1 \u2264 n \u2228 n + 6 \u2264 x \u2228 \u00acOdd x\nh_4 : \u00acOdd x\nh_5 : x = n + 1\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] odd_s = {x \u2208 Finset.Icc n (n + 5) | Odd x}\n [prop] Even n\n [prop] 2 \u2223 n\n [prop] (x = n + 1 \u2228 x = n + 3 \u2228 x = n + 5) = (x + 1 \u2264 n \u2228 n + 6 \u2264 x \u2228 \u00acOdd x)\n [prop] x = n + 1 \u2228 x = n + 3 \u2228 x = n + 5\n [prop] x + 1 \u2264 n \u2228 n + 6 \u2264 x \u2228 \u00acOdd x\n [prop] n + 6 \u2264 x \u2228 \u00acOdd x\n [prop] \u00acOdd x\n [prop] x = n + 1\n [eqc] True propositions\n [prop] Even n\n [prop] 2 \u2223 n\n [prop] (x = n + 1 \u2228 x = n + 3 \u2228 x = n + 5) = (x + 1 \u2264 n \u2228 n + 6 \u2264 x \u2228 \u00acOdd x)\n [prop] x + 1 \u2264 n \u2228 n + 6 \u2264 x \u2228 \u00acOdd x\n [prop] x = n + 1 \u2228 x = n + 3 \u2228 x = n + 5\n [prop] n + 6 \u2264 x \u2228 \u00acOdd x\n [prop] \u00acOdd x\n [prop] x = n + 1\n [eqc] False propositions\n [prop] Odd x\n [prop] n + 6 \u2264 x\n [eqc] Equivalence classes\n [eqc] {\u2191x, \u2191(n + 1)}\n [eqc] {x, n + 1}\n [eqc] {fun x => Odd x, Odd}\n [eqc] {odd_s, {x \u2208 Finset.Icc n (n + 5) | Odd x}}\n [cases] Case analyses\n [cases] [1/2]: (x = n + 1 \u2228 x = n + 3 \u2228 x = n + 5) = (x + 1 \u2264 n \u2228 n + 6 \u2264 x \u2228 \u00acOdd x)\n [cases] [2/2]: x + 1 \u2264 n \u2228 n + 6 \u2264 x \u2228 \u00acOdd x\n [cases] [2/2]: n + 6 \u2264 x \u2228 \u00acOdd x\n [cases] [1/2]: x = n + 1 \u2228 x = n + 3 \u2228 x = n + 5\n [cutsat] Assignment satisfying linear constraints\n [assign] n := 0\n [assign] x := 1\n [assign] \u300c2\u300d := 2", "`grind` failed\ncase grind\nn : \u2115\nodd_s : Finset \u2115\nodd_s_eq : odd_s = {x \u2208 Finset.Icc n (n + 5) | Odd x}\nx y z : \u2115\nleft : {x, y, z} = odd_s\ny_eq : y = x + 2\nz_eq : z = y + 2\nh : \u00acodd_s.card = 3\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] odd_s = {x \u2208 Finset.Icc n (n + 5) | Odd x}\n [prop] {x, y, z} = odd_s\n [prop] y = x + 2\n [prop] z = y + 2\n [prop] \u00acodd_s.card = 3\n [eqc] False propositions\n [prop] odd_s.card = 3\n [eqc] Equivalence classes\n [eqc] {z, y + 2}\n [eqc] {\u2191y, \u2191(x + 2)}\n [eqc] {y, x + 2}\n [eqc] {fun x => Odd x, Odd}\n [eqc] {odd_s, {x, y, z}, {x \u2208 Finset.Icc n (n + 5) | Odd x}}\n [cutsat] Assignment satisfying linear constraints\n [assign] n := 0\n [assign] x := 0\n [assign] y := 2\n [assign] z := 4\n [assign] odd_s.card := 1", "unknown tactic", "unsolved goals\nn x y : \u2115\nx_in_interval : n \u2264 x \u2227 x \u2264 n + 5\ny_in_interval : n \u2264 y \u2227 y \u2264 n + 5\nx_div_5 : 5 \u2223 x\nx_non_div_2 : x % 2 = 1\ny_div_5 : 5 \u2223 y\ny_non_div_2 : y % 2 = 1\n\u22a2 x = y", "unknown tactic", "unknown constant 'ZMod.natCast_eq_zero_iff'", "no goals to be solved", "`grind` failed\ncase grind.1\na b c : \u2115\ns : Finset \u2115\ns_eq : s = {a, b, c}\nb_eq : b = a + 2\nc_eq : c = b + 2\nn_eq_a : 0 = \u2191a\nthree_div_a : 3 \u2223 a\nh_1 : a \u2209 s\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] s = {a, b, c}\n [prop] b = a + 2\n [prop] c = b + 2\n [prop] 0 = \u2191a\n [prop] 3 \u2223 a\n [prop] a \u2209 s \u2228 \u00ac3 \u2223 a \u2228 \u2203 x \u2208 s, 3 \u2223 x \u2227 \u00acx = a\n [prop] a \u2209 s\n [eqc] True propositions\n [prop] Fact (Nat.Prime 3)\n [prop] 3 \u2223 a\n [prop] a \u2209 s \u2228 \u00ac3 \u2223 a \u2228 \u2203 x \u2208 s, 3 \u2223 x \u2227 \u00acx = a\n [prop] a \u2209 s\n [eqc] False propositions\n [prop] \u00ac3 \u2223 a\n [prop] a \u2208 s\n [eqc] Equivalence classes\n [eqc] {\u00ac3 \u2223 a \u2228 \u2203 x \u2208 s, 3 \u2223 x \u2227 \u00acx = a, \u2203 x \u2208 s, 3 \u2223 x \u2227 \u00acx = a}\n [eqc] {\u2191a, 0}\n [eqc] {c, b + 2}\n [eqc] {\u2191b, \u2191(a + 2)}\n [eqc] {b, a + 2}\n [eqc] {s, {a, b, c}}\n [cases] Case analyses\n [cases] [1/2]: a \u2209 s \u2228 \u00ac3 \u2223 a \u2228 \u2203 x \u2208 s, 3 \u2223 x \u2227 \u00acx = a\n [ematch] E-matching patterns\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [cutsat] Assignment satisfying linear constraints\n [assign] a := 0\n [assign] b := 2\n [assign] c := 4\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n s\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n s\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type", "unknown constant 'ZMod.natCast_eq_zero_iff'", "no goals to be solved", "unsolved goals\ncase h.right.intro\na b c : \u2115\ns : Finset \u2115\no : \u2115\ns_eq : s = {a, a + 2, a + 2 + 2}\nb_eq : b = a + 2\nc_eq : c = a + 2 + 2\nn_eq_a : 1 = \u2191a\nthree_div_b : 3 \u2223 a + 2\no_in_s : o = a \u2228 o = a + 2 \u2228 o = a + 2 + 2\nthree_div_o : 3 \u2223 o\n\u22a2 o = a + 2", "unsolved goals\ncase \u00ab2\u00bb\na b c : \u2115\ns : Finset \u2115\ns_eq : s = {a, b, c}\nb_eq : b = a + 2\nc_eq : c = b + 2\nn_eq_a : (fun i => i) \u27e82, \u22ef\u27e9 = \u2191a\n\u22a2 \u2203! a', a' \u2208 s \u2227 3 \u2223 a'", "`grind` failed\ncase grind\ns : Finset \u2115\npredicate : \u2115 \u2192 Prop\ninst : (a : \u2115) \u2192 Decidable (predicate a)\nthis : (\u2203 a, {x \u2208 s | predicate x} = {a}) \u2192 {x \u2208 s | predicate x}.card = 1\na' : \u2115\nleft : a' \u2208 s\nleft_1 : predicate a'\nright_1 : \u2200 (y : \u2115), y \u2208 s \u2227 predicate y \u2192 y = a'\nh : \u00ac{x \u2208 s | predicate x} = {a'}\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] (\u2203 a, {x \u2208 s | predicate x} = {a}) \u2192 {x \u2208 s | predicate x}.card = 1\n [prop] a' \u2208 s\n [prop] predicate a'\n [prop] \u2200 (y : \u2115), y \u2208 s \u2227 predicate y \u2192 y = a'\n [prop] \u00ac{x \u2208 s | predicate x} = {a'}\n [eqc] True propositions\n [prop] (\u2203 a, {x \u2208 s | predicate x} = {a}) \u2192 {x \u2208 s | predicate x}.card = 1\n [prop] a' \u2208 s\n [prop] predicate a'\n [prop] \u2200 (y : \u2115), y \u2208 s \u2227 predicate y \u2192 y = a'\n [eqc] False propositions\n [prop] {x \u2208 s | predicate x} = {a'}\n [eqc] Equivalence classes\n [eqc] {fun x => predicate x, predicate}\n [ematch] E-matching patterns\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [thm] right_1: [@Membership.mem `[\u2115] `[Finset \u2115] `[Finset.instMembership] `[s] #1]\n [thm] right_1: [@Membership.mem `[\u2115] `[Finset \u2115] `[Finset.instMembership] `[s] #1]\n [cutsat] Assignment satisfying linear constraints\n [assign] a' := 3\n [assign] {x \u2208 s | predicate x}.card := 2\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n s\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n s\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type", "unknown tactic", "unsolved goals\ncase intro.intro\np : \u2115\npp : Nat.Prime p\np_le_5 : p \u2264 5\na : \u00acp = 2\nb : \u00acp = 3\nc : \u00acp = 5\nthis : p \u2260 2 \u2192 p \u2260 3 \u2192 5 \u2264 p\n\u22a2 False", "unknown tactic", "unsolved goals\nx p : \u2115\ntwo_does_not_divide : x % 2 = 1\nthree_does_not_divide : \u00ac3 \u2223 x\nfive_does_not_divide : \u00ac5 \u2223 x\np_gt_5_not_dvd : \u2200 (p : \u2115), Nat.Prime p \u2192 5 < p \u2192 \u00acp \u2223 x\npp : Nat.Prime 2\np_le_5 : 2 \u2264 5\np_div_x : 2 \u2223 x\nh : p = 2\n\u22a2 False", "unsolved goals\ncase inr\nx : \u2115\ntwo_does_not_divide : \u00ac2 \u2223 x\nthree_does_not_divide : \u00ac3 \u2223 x\nfive_does_not_divide : \u00ac5 \u2223 x\np_gt_5_not_dvd : \u2200 (p : \u2115), Nat.Prime p \u2192 p > 5 \u2192 \u00acp \u2223 x\np : \u2115\npp : Nat.Prime p\np_le_5 : p \u2264 5\np_div_x : p \u2223 x\np_subset : p \u2208 {2, 3, 5}\nh\u271d : p = 3 \u2228 p = 5\n\u22a2 False", "unsolved goals\nx : \u2115\ntwo_does_not_divide : \u00ac2 \u2223 x\nthree_does_not_divide : \u00ac3 \u2223 x\nfive_does_not_divide : \u00ac5 \u2223 x\np_gt_5_not_dvd : \u2200 (p : \u2115), Nat.Prime p \u2192 p > 5 \u2192 \u00acp \u2223 x\np_le_5_not_dvd : \u2200 (p : \u2115), Nat.Prime p \u2192 p \u2264 5 \u2192 \u00acp \u2223 x\n\u22a2 \u00ac\u2203 p, Nat.Prime p \u2227 p \u2223 x", "unknown tactic", "unsolved goals\ns s1 s2 : Finset \u2115\npredicate_s1 predicate_s2 : \u2115 \u2192 Prop\ninst\u271d\u00b9 : DecidablePred predicate_s1\ninst\u271d : DecidablePred predicate_s2\ns1_filter : s1 = {x \u2208 s | predicate_s1 x}\ns2_filter : s2 = {x \u2208 s | predicate_s2 x}\na b c : \u2115\ntotal_size_exceeds : (s1 \u222a s2).card > s.card\ncard_s : s.card = c\ncard_s1 : s1.card = a\ncard_s2 : s2.card = b\ns1_is_subset : s1 \u2286 s\nlift_x_in_s1 : \u2200 x \u2208 s, x \u2208 s1 \u2194 predicate_s1 x\nlift_x_in_s2 : \u2200 x \u2208 s, x \u2208 s2 \u2194 predicate_s2 x\nh : \u2200 x \u2208 s, predicate_s1 x \u2192 \u00acpredicate_s2 x\nstep_1 : (\u2200 x \u2208 s, predicate_s1 x \u2192 \u00acpredicate_s2 x) \u2192 \u2200 x \u2208 s, x \u2208 s1 \u2192 x \u2209 s2\nstep_2 : (\u2200 x \u2208 s, x \u2208 s1 \u2192 x \u2209 s2) \u2192 Disjoint s1 s2\ns1_s2_disjoint : Disjoint s1 s2\ncard_calc : (s1 \u222a s2).card = a + b\ns1_s2_subset : s1 \u222a s2 \u2286 s\nthis : (s1 \u222a s2).card \u2264 s.card\n\u22a2 False", "unknown tactic", "unsolved goals\nn : \u2115\ns1 s2 : Finset \u2115\npartition : s1 \u222a s2 = Finset.Icc n (n + 5)\nno_dups : s1 \u2229 s2 = \u2205\nequal_products : \u220f m \u2208 s1, m = \u220f m \u2208 s2, m\nodd_s : Finset \u2115 := {x \u2208 s1 \u222a s2 | Odd x}\nodd_div_by_5 : Finset \u2115 := {x \u2208 odd_s | 5 \u2223 x}\nodd_div_by_3 : Finset \u2115 := {x \u2208 odd_s | 3 \u2223 x}\nodd_non_div_by_5 : Finset \u2115 := {x \u2208 odd_s | \u00ac5 \u2223 x}\nodd_non_div_by_3 : Finset \u2115 := {x \u2208 odd_s | \u00ac3 \u2223 x}\nthis\u271d : odd_s = {x \u2208 Finset.Icc n (n + 5) | Odd x}\nthree_odd_numbers : odd_s.card = 3\nodd_div_by_3_card : {x \u2208 odd_s | 3 \u2223 x}.card = 1\nodd_div_by_5_card : {x \u2208 odd_s | 5 \u2223 x}.card \u2264 1\nodd_div_by_5_exp_card : odd_div_by_5.card \u2264 1\nthis : 1 + odd_non_div_by_3.card = 3\n\u22a2 odd_non_div_by_3.card = 2", "unsolved goals\nn : \u2115\ns1 s2 : Finset \u2115\npartition : s1 \u222a s2 = Finset.Icc n (n + 5)\nno_dups : s1 \u2229 s2 = \u2205\nequal_products : \u220f m \u2208 s1, m = \u220f m \u2208 s2, m\nodd_s : Finset \u2115 := {x \u2208 s1 \u222a s2 | Odd x}\nodd_div_by_5 : Finset \u2115 := {x \u2208 odd_s | 5 \u2223 x}\nodd_div_by_3 : Finset \u2115 := {x \u2208 odd_s | 3 \u2223 x}\nodd_non_div_by_5 : Finset \u2115 := {x \u2208 odd_s | \u00ac5 \u2223 x}\nodd_non_div_by_3 : Finset \u2115 := {x \u2208 odd_s | \u00ac3 \u2223 x}\nthis : odd_s = {x \u2208 Finset.Icc n (n + 5) | Odd x}\nthree_odd_numbers : odd_s.card = 3\nodd_div_by_3_card : {x \u2208 odd_s | 3 \u2223 x}.card = 1\nodd_div_by_5_card : {x \u2208 odd_s | 5 \u2223 x}.card \u2264 1\nodd_div_by_5_exp_card : odd_div_by_5.card \u2264 1\nexactly_2_non_divisers_of_3 : odd_non_div_by_3.card = 2\n\u22a2 \u2203 x \u2208 s1 \u222a s2, x = 1 \u2228 x = 0", "unknown tactic", "unsolved goals\nn : \u2115\nn_not_zero : \u00acn = 0\ncontains_one : n \u2264 1\n\u22a2 n = 1", "unknown tactic", "unsolved goals\ns1 s2 : Finset \u2115\npartition : s1 \u222a s2 = Finset.Icc 1 6\ndisjoint : s1 \u2229 s2 = \u2205\neq_prod : \u220f m \u2208 s1, m = \u220f m \u2208 s2, m\nfive_in_s2 : 5 \u2208 s2\ns1_in_s2_s1 : s1 \u2286 s2 \u222a s1\nexplicit_s1 : s1 \u2286 {1, 2, 3, 4, 6}\nk : \u2115\nk_in_s1 : k \u2208 s1\nk_in_explicit_s1 : k = 1 \u2228 k = 2 \u2228 k = 3 \u2228 k = 4 \u2228 k = 6\nfive_div_k : 5 \u2223 k\n\u22a2 False", "unsolved goals\ns1 s2 : Finset \u2115\npartition : s1 \u222a s2 = Finset.Icc 1 6\ndisjoint : s1 \u2229 s2 = \u2205\neq_prod : \u220f m \u2208 s1, m = \u220f m \u2208 s2, m\nfive_in_s2 : 5 \u2208 s2\ns1_in_s2_s1 : s1 \u2286 s2 \u222a s1\nexplicit_s1 : s1 \u2286 {1, 2, 3, 4, 6}\nothers : \u2200 k \u2208 s1, \u00ac5 \u2223 k\n\u22a2 False"], "timeout_s": 600.0, "latency_s": 2.8468, "verified_at": "2026-03-26T18:16:23.328945+00:00"}} | false | true | false | 2.8468 |
compfiles_Imo1970P6 | compfiles | Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1970, Problem 6
In a plane there are 100 points, no three of which are collinear.
Consider all possible triangles having these points as vertices.
Prove that no more that 70% of these triangles are acute.
-/
namespace Imo1970P6
open scoped EuclideanGeometry
abbrev Pt := EuclideanSpace ℝ (Fin 2)
def AcuteTriangle (T : Affine.Triangle ℝ Pt) : Prop :=
∠ (T.points 1) (T.points 2) (T.points 3) < Real.pi / 2 ∧
∠ (T.points 2) (T.points 3) (T.points 1) < Real.pi / 2 ∧
∠ (T.points 3) (T.points 1) (T.points 2) < Real.pi / 2
theorem imo1970_p6
(P : Fin 100 → Pt)
(hP : ∀ a b c : Fin 100,
List.Nodup [a, b, c] → ¬ Collinear ℝ {P a, P b, P c}) :
let cardAll := Nat.card { t : Affine.Triangle ℝ Pt |
∃ a b c : Fin 100, ![P a, P b, P c] = t.points }
let cardAcute :=
Nat.card { t : Affine.Triangle ℝ Pt | ∃ a b c : Fin 100, ![P a, P b, P c] = t.points ∧
AcuteTriangle t }
(cardAcute : ℚ) / cardAll ≤ 7 / 10 := by
sorry
end Imo1970P6 | /- | /-
Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1970, Problem 6
In a plane there are 100 points, no three of which are collinear.
Consider all possible triangles having these points as vertices.
Prove that no more that 70% of these triangles are acute.
-/
namespace Imo1970P6
open scoped EuclideanGeometry
abbrev Pt := EuclideanSpace ℝ (Fin 2)
def AcuteTriangle (T : Affine.Triangle ℝ Pt) : Prop :=
∠ (T.points 1) (T.points 2) (T.points 3) < Real.pi / 2 ∧
∠ (T.points 2) (T.points 3) (T.points 1) < Real.pi / 2 ∧
∠ (T.points 3) (T.points 1) (T.points 2) < Real.pi / 2
theorem imo1970_p6
(P : Fin 100 → Pt)
(hP : ∀ a b c : Fin 100,
List.Nodup [a, b, c] → ¬ Collinear ℝ {P a, P b, P c}) :
let cardAll := Nat.card { t : Affine.Triangle ℝ Pt |
∃ a b c : Fin 100, ![P a, P b, P c] = t.points }
let cardAcute :=
Nat.card { t : Affine.Triangle ℝ Pt | ∃ a b c : Fin 100, ![P a, P b, P c] = t.points ∧
AcuteTriangle t }
(cardAcute : ℚ) / cardAll ≤ 7 / 10 := by
sorry
end Imo1970P6
| false | null | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1970P6.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": true, "errors": [], "timeout_s": 600.0, "latency_s": 0.253, "verified_at": "2026-03-26T18:16:22.515581+00:00"}} | false | true | true | 0.253 |
compfiles_Imo1971P1 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Francesco Cappetti
-/
import Mathlib
/-!
# International Mathematical Olympiad 1971, Problem 1
Prove that the following assertion is true for n = 3 and n = 5, and that it is
false for every other natural number n > 2:
If a1, a2, ..., an are arbitrary real numbers, then
(a1 − a2)(a1 − a3) · · · (a1 − an) + (a2 − a1)(a2 − a3) · · · (a2 − an)
+ · · · + (an − a1)(an − a2) · · · (an − an−1) ≥ 0
-/
namespace Imo1971P1
def E {n : ℕ} (a : Fin n → ℝ) : ℝ :=
∑ i, ∏ j ≠ i, (a i - a j)
def P (n : ℕ) : Prop :=
∀ (a : Fin n → ℝ), E a ≥ 0
-- This makes working with the sum easier and simp more powerful.
lemma prod_ne_eq_prod_ite {n : ℕ} {i : Fin n} {a : Fin n → ℝ} : ∏ j ≠ i, (a i - a j) = ∏ j, if j = i then 1 else a i - a j := by
rw [← Finset.mul_prod_erase Finset.univ _ (Finset.mem_univ i)]
grind [Finset.prod_congr]
-- A proof that E a = E b, where b is obtained by permuting a's indices.
lemma E_equiv_perm {n : ℕ} {a b : Fin n → ℝ} (h : ∃ σ : Equiv.Perm (Fin n), b = a ∘ σ) : E a = E b := by
obtain ⟨σ, hσ⟩ := h
simp [E]
apply Finset.sum_equiv (e := σ.symm) (by simp)
intro i hi
apply Finset.prod_equiv (e := σ.symm) (by simp)
intro j hj
simp [hσ, Equiv.apply_symm_apply]
-- This gets a permutation of the indices of a such that the resulting sequence is antitone.
-- Uses Tuple.sort (which gives monotone) composed with Fin.revPerm (which reverses) to get antitone.
lemma antitone_of_monotone_comp_rev {n : ℕ} (f : Fin n → ℝ) (σ : Equiv.Perm (Fin n))
(hm : Monotone (f ∘ σ)) : Antitone (f ∘ σ ∘ Fin.revPerm) := by
intro i j hij
simp only [Function.comp_apply]
exact hm (by simp [Fin.revPerm_apply, Fin.rev_le_rev, hij])
lemma exists_antitone_perm {n : ℕ} (a : Fin n → ℝ) :
∃ b, ∃ σ : Equiv.Perm (Fin n), b = a ∘ σ ∧ Antitone b := by
let σ : Equiv.Perm (Fin n) := Tuple.sort a * Fin.revPerm
use a ∘ σ, σ
constructor
· rfl
· simp only [σ, Equiv.Perm.coe_mul, Function.comp_def]
exact antitone_of_monotone_comp_rev a _ (Tuple.monotone_sort a)
theorem imo1971_p1 : P 3 ∧ P 5 ∧ ∀ n > 2, n ≠ 3 ∧ n ≠ 5 → ¬P n := by
-- Solution from https://artofproblemsolving.com/wiki/index.php/1971_IMO_Problems/Problem_1
-- Note that indices start from 0 in the formalization
-- Show that P is false for even n > 2
have h1 : ∀ n > 2, Even n → ¬P n := by
intro n n_gt_2 n_even
have n_pos : 0 < n := by omega
-- Rewriting now lets us decompose the sum later
rw [show n = n - 1 + 1 by omega]
simp [P]
-- Our counterexample
let a : Fin (n - 1 + 1) → ℝ := fun i ↦ if i = 0 then -1 else 0
use a
rw [E, Fin.sum_univ_succ]
-- Show that the first term is negative
have h₀ : ∏ j ≠ 0, (a 0 - a j) = -1 := by
rw [prod_ne_eq_prod_ite]
simp [Finset.prod, a, Odd.neg_one_pow (Nat.Even.sub_odd n_pos n_even odd_one)]
-- Show that the sum of the remaining terms is zero, by showing that every remaining term is zero
have h₁ : ∑ i : Fin (n - 1), ∏ j ≠ i.succ, (a i.succ - a j) = 0 := by
apply Finset.sum_eq_zero
intro i hi
rw [Finset.prod_eq_zero_iff]
by_cases hi' : i.succ = ⟨2, by linarith [Nat.sub_one_add_one_eq_of_pos n_pos]⟩
· use ⟨1, by linarith [Nat.sub_one_add_one_eq_of_pos n_pos]⟩
simp [hi', a]
· use ⟨2, by linarith [Nat.sub_one_add_one_eq_of_pos n_pos]⟩
simp [hi', a, eq_comm]
-- Close the goal
linarith
-- Show that P is false for n ≥ 7
have h2 : ∀ n ≥ 7, Odd n → ¬P n := by
intro n n_ge_7 n_odd
have n_pos : 4 ≤ n := by omega
-- Rewriting now lets us decompose the sum later
rw [show n = n - 4 + 4 by omega]
simp [P]
-- Our counterexample
let a : Fin (n - 4 + 4) → ℝ := fun i ↦ if i = 0 then 2 else if i = 1 ∨ i = 2 ∨ i = 3 then 1 else 3
use a
simp [E, Fin.sum_univ_succ]
-- Show that the first term is negative
have h₀ : ∏ j ≠ 0, (a 0 - a j) < 0 := by
rw [prod_ne_eq_prod_ite]
have h_0 : Fin.succ (2 : Fin (n - 4 + 3)) = 3 := rfl
have h_1 {i : Fin (n - 4)} : i.succ.succ.succ.succ ≠ 1 := not_eq_of_beq_eq_false rfl
have h_2 {i : Fin (n - 4)} : i.succ.succ.succ.succ ≠ 2 := not_eq_of_beq_eq_false rfl
have h_3 {i : Fin (n - 4)} : i.succ.succ.succ.succ ≠ 3 := not_eq_of_beq_eq_false rfl
simp [Fin.prod_univ_succ, a, h_0, h_1, h_2, h_3]
calc ((2 : ℝ) - 1) * ((2 - 1) * ((2 - 1) * (2 - 3) ^ (n - 4)))
_ = (-1) ^ (n - 4) := by norm_num
_ < 0 := by simp [(Nat.Odd.sub_even n_pos n_odd (show Even 4 by norm_num)).neg_one_pow]
-- Prove that the second, third and fourth terms are zero
have h₁ : ∏ j ≠ 1, (a 1 - a j) = 0 := by
rw [Finset.prod_eq_zero_iff]
use ⟨2, by omega⟩
simp [a]
norm_cast
have h₂ : ∏ j ≠ 2, (a 2 - a j) = 0 := by
rw [prod_ne_eq_prod_ite, Finset.prod_eq_zero_iff]
use ⟨1, by omega⟩
simp [a]
norm_cast
have h₃ : ∏ j ≠ Fin.succ 2, (a (Fin.succ 2) - a j) = 0 := by
rw [prod_ne_eq_prod_ite, Finset.prod_eq_zero_iff]
use ⟨1, by omega⟩
simp [a]
norm_cast
-- Show that the sum of the remaining terms is zero, by showing that every remaining term is zero
have h₄ : ∑ i : Fin (n - 4), ∏ j ≠ i.succ.succ.succ.succ, (a i.succ.succ.succ.succ - a j) = 0 := by
apply Finset.sum_eq_zero
intro i hi
apply Finset.prod_eq_zero_iff.mpr
by_cases hi' : i.succ.succ.succ.succ = ⟨4, by omega⟩
· use ⟨5, by omega⟩
simp [hi', a]
norm_cast
· use ⟨4, by omega⟩
simp [hi', a, eq_comm]
norm_cast
-- Close the goal
linarith
-- Case n = 3
constructor
· simp [P]
intro a
-- WLOG we assume that a is sorted in non-increasing order
wlog h : a 0 ≥ a 1 ∧ a 1 ≥ a 2
· -- We need to show that we can always "go back" to the sorted case
obtain ⟨b, ⟨σ, ⟨hσ, b_Antitone⟩⟩⟩ := exists_antitone_perm a
-- We can now prove that b is sorted
have b0_ge_b1 : b 0 ≥ b 1 := b_Antitone (by simp)
have b1_ge_b2 : b 1 ≥ b 2 := b_Antitone (by simp)
rw [E_equiv_perm ⟨σ, hσ⟩]
exact this h1 h2 b ⟨b0_ge_b1, b1_ge_b2⟩
· -- Unfold the expression, as n is small
simp [E, prod_ne_eq_prod_ite]
simp [Finset.sum, Finset.prod]
-- Show that the sum of the first two terms is non-negative
have h₁ : 0 ≤ (a 0 - a 1) * (a 0 - a 2) + (a 1 - a 0) * (a 1 - a 2) := by
rw [← sub_neg_eq_add, sub_nonneg]
calc -((a 1 - a 0) * (a 1 - a 2))
_ = (a 0 - a 1) * (a 1 - a 2) := by rw [← neg_sub, neg_mul, neg_neg]
_ ≤ (a 0 - a 1) * (a 0 - a 2) := by
apply mul_le_mul <;> linarith [h.1, h.2]
-- Show that the third term is also non-negative
have h₂ : 0 ≤ (a 2 - a 0) * (a 2 - a 1) := by apply mul_nonneg_of_nonpos_of_nonpos <;> linarith
-- Close the goal
linarith
-- Case n = 5
constructor
· simp [P]
-- WLOG we assume that a is sorted in non-increasing order
intro a
wlog h : a 0 ≥ a 1 ∧ a 1 ≥ a 2 ∧ a 2 ≥ a 3 ∧ a 3 ≥ a 4
· -- We need to show that we can always "go back" to the sorted case
obtain ⟨b, ⟨σ, ⟨hσ, b_Antitone⟩⟩⟩ := exists_antitone_perm a
-- We can now prove that b is sorted
have b0_ge_b1 : b 0 ≥ b 1 := b_Antitone (by simp)
have b1_ge_b2 : b 1 ≥ b 2 := b_Antitone (by simp)
have b2_ge_b3 : b 2 ≥ b 3 := b_Antitone (by simp)
have b3_ge_b4 : b 3 ≥ b 4 := b_Antitone (by simp)
rw [E_equiv_perm ⟨σ, hσ⟩]
exact this h1 h2 b ⟨b0_ge_b1, ⟨b1_ge_b2, ⟨b2_ge_b3, b3_ge_b4⟩⟩⟩
· -- Unfold the expression, as n is small
simp [E, prod_ne_eq_prod_ite]
simp [Finset.sum, Finset.prod]
-- Show that the sum of the first two terms is non-negative
have h₁ : 0 ≤ (a 0 - a 1) * ((a 0 - a 2) * ((a 0 - a 3) * (a 0 - a 4))) +
(a 1 - a 0) * ((a 1 - a 2) * ((a 1 - a 3) * (a 1 - a 4))) := by
rw [← neg_sub (a 0) (a 1), neg_mul, ← sub_eq_add_neg, ← mul_sub]
apply mul_nonneg
· linarith
· rw [sub_nonneg]
apply mul_le_mul
· linarith
· apply mul_le_mul <;> linarith
· apply mul_nonneg <;> linarith
· linarith
-- Show that the third term is non-negative
have h₂ : 0 ≤ (a 2 - a 0) * ((a 2 - a 1) * ((a 2 - a 3) * (a 2 - a 4))) := by
rw [← neg_sub (a 0) (a 2), ← neg_sub (a 1) (a 2), ← mul_assoc, neg_mul_neg]
apply mul_nonneg <;> apply mul_nonneg <;> linarith
-- Show that the sum of the last two terms is non-negative
have h₃ : 0 ≤ (a 3 - a 0) * ((a 3 - a 1) * ((a 3 - a 2) * (a 3 - a 4))) +
(a 4 - a 0) * ((a 4 - a 1) * ((a 4 - a 2) * (a 4 - a 3))) := by
simp [← mul_assoc]
rw [← neg_sub (a 3) (a 4), mul_neg, ← sub_eq_add_neg, ← sub_mul]
have hp : (a 3 - a 0) * (a 3 - a 1) * (a 3 - a 2) = -((a 0 - a 3) * (a 1 - a 3) * (a 2 - a 3)) := by linarith
have hq : (a 4 - a 0) * (a 4 - a 1) * (a 4 - a 2) = -((a 0 - a 4) * (a 1 - a 4) * (a 2 - a 4)) := by linarith
rw [hp, hq, sub_neg_eq_add, add_comm, ← sub_eq_add_neg]
apply mul_nonneg
· rw [sub_nonneg]
apply mul_le_mul
· apply mul_le_mul <;> linarith
· linarith
· linarith
· apply mul_nonneg <;> linarith
· linarith [h.2.2.2]
-- Close the goal
linarith
-- Case n > 2
· grind
end Imo1971P1 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Francesco Cappetti
-/
import Mathlib
/-!
# International Mathematical Olympiad 1971, Problem 1
Prove that the following assertion is true for n = 3 and n = 5, and that it is
false for every other natural number n > 2:
If a1, a2, ..., an are arbitrary real numbers, then
(a1 − a2)(a1 − a3) · · · (a1 − an) + (a2 − a1)(a2 − a3) · · · (a2 − an)
+ · · · + (an − a1)(an − a2) · · · (an − an−1) ≥ 0
-/
namespace Imo1971P1
def E {n : ℕ} (a : Fin n → ℝ) : ℝ :=
∑ i, ∏ j ≠ i, (a i - a j)
def P (n : ℕ) : Prop :=
∀ (a : Fin n → ℝ), E a ≥ 0
-- This makes working with the sum easier and simp more powerful.
lemma prod_ne_eq_prod_ite {n : ℕ} {i : Fin n} {a : Fin n → ℝ} : ∏ j ≠ i, (a i - a j) = ∏ j, if j = i then 1 else a i - a j := by
rw [← Finset.mul_prod_erase Finset.univ _ (Finset.mem_univ i)]
grind [Finset.prod_congr]
-- A proof that E a = E b, where b is obtained by permuting a's indices.
lemma E_equiv_perm {n : ℕ} {a b : Fin n → ℝ} (h : ∃ σ : Equiv.Perm (Fin n), b = a ∘ σ) : E a = E b := by
obtain ⟨σ, hσ⟩ := h
simp [E]
apply Finset.sum_equiv (e := σ.symm) (by simp)
intro i hi
apply Finset.prod_equiv (e := σ.symm) (by simp)
intro j hj
simp [hσ, Equiv.apply_symm_apply]
-- This gets a permutation of the indices of a such that the resulting sequence is antitone.
-- Uses Tuple.sort (which gives monotone) composed with Fin.revPerm (which reverses) to get antitone.
lemma antitone_of_monotone_comp_rev {n : ℕ} (f : Fin n → ℝ) (σ : Equiv.Perm (Fin n))
(hm : Monotone (f ∘ σ)) : Antitone (f ∘ σ ∘ Fin.revPerm) := by
intro i j hij
simp only [Function.comp_apply]
exact hm (by simp [Fin.revPerm_apply, Fin.rev_le_rev, hij])
lemma exists_antitone_perm {n : ℕ} (a : Fin n → ℝ) :
∃ b, ∃ σ : Equiv.Perm (Fin n), b = a ∘ σ ∧ Antitone b := by
let σ : Equiv.Perm (Fin n) := Tuple.sort a * Fin.revPerm
use a ∘ σ, σ
constructor
· rfl
· simp only [σ, Equiv.Perm.coe_mul, Function.comp_def]
exact antitone_of_monotone_comp_rev a _ (Tuple.monotone_sort a)
theorem imo1971_p1 : P 3 ∧ P 5 ∧ ∀ n > 2, n ≠ 3 ∧ n ≠ 5 → ¬P n := by
-- Solution from https://artofproblemsolving.com/wiki/index.php/1971_IMO_Problems/Problem_1
-- Note that indices start from 0 in the formalization
-- Show that P is false for even n > 2
have h1 : ∀ n > 2, Even n → ¬P n := by
intro n n_gt_2 n_even
have n_pos : 0 < n := by omega
-- Rewriting now lets us decompose the sum later
rw [show n = n - 1 + 1 by omega]
simp [P]
-- Our counterexample
let a : Fin (n - 1 + 1) → ℝ := fun i ↦ if i = 0 then -1 else 0
use a
rw [E, Fin.sum_univ_succ]
-- Show that the first term is negative
have h₀ : ∏ j ≠ 0, (a 0 - a j) = -1 := by
rw [prod_ne_eq_prod_ite]
simp [Finset.prod, a, Odd.neg_one_pow (Nat.Even.sub_odd n_pos n_even odd_one)]
-- Show that the sum of the remaining terms is zero, by showing that every remaining term is zero
have h₁ : ∑ i : Fin (n - 1), ∏ j ≠ i.succ, (a i.succ - a j) = 0 := by
apply Finset.sum_eq_zero
intro i hi
rw [Finset.prod_eq_zero_iff]
by_cases hi' : i.succ = ⟨2, by linarith [Nat.sub_one_add_one_eq_of_pos n_pos]⟩
· use ⟨1, by linarith [Nat.sub_one_add_one_eq_of_pos n_pos]⟩
simp [hi', a]
· use ⟨2, by linarith [Nat.sub_one_add_one_eq_of_pos n_pos]⟩
simp [hi', a, eq_comm]
-- Close the goal
linarith
-- Show that P is false for n ≥ 7
have h2 : ∀ n ≥ 7, Odd n → ¬P n := by
intro n n_ge_7 n_odd
have n_pos : 4 ≤ n := by omega
-- Rewriting now lets us decompose the sum later
rw [show n = n - 4 + 4 by omega]
simp [P]
-- Our counterexample
let a : Fin (n - 4 + 4) → ℝ := fun i ↦ if i = 0 then 2 else if i = 1 ∨ i = 2 ∨ i = 3 then 1 else 3
use a
simp [E, Fin.sum_univ_succ]
-- Show that the first term is negative
have h₀ : ∏ j ≠ 0, (a 0 - a j) < 0 := by
rw [prod_ne_eq_prod_ite]
have h_0 : Fin.succ (2 : Fin (n - 4 + 3)) = 3 := rfl
have h_1 {i : Fin (n - 4)} : i.succ.succ.succ.succ ≠ 1 := not_eq_of_beq_eq_false rfl
have h_2 {i : Fin (n - 4)} : i.succ.succ.succ.succ ≠ 2 := not_eq_of_beq_eq_false rfl
have h_3 {i : Fin (n - 4)} : i.succ.succ.succ.succ ≠ 3 := not_eq_of_beq_eq_false rfl
simp [Fin.prod_univ_succ, a, h_0, h_1, h_2, h_3]
calc ((2 : ℝ) - 1) * ((2 - 1) * ((2 - 1) * (2 - 3) ^ (n - 4)))
_ = (-1) ^ (n - 4) := by norm_num
_ < 0 := by simp [(Nat.Odd.sub_even n_pos n_odd (show Even 4 by norm_num)).neg_one_pow]
-- Prove that the second, third and fourth terms are zero
have h₁ : ∏ j ≠ 1, (a 1 - a j) = 0 := by
rw [Finset.prod_eq_zero_iff]
use ⟨2, by omega⟩
simp [a]
norm_cast
have h₂ : ∏ j ≠ 2, (a 2 - a j) = 0 := by
rw [prod_ne_eq_prod_ite, Finset.prod_eq_zero_iff]
use ⟨1, by omega⟩
simp [a]
norm_cast
have h₃ : ∏ j ≠ Fin.succ 2, (a (Fin.succ 2) - a j) = 0 := by
rw [prod_ne_eq_prod_ite, Finset.prod_eq_zero_iff]
use ⟨1, by omega⟩
simp [a]
norm_cast
-- Show that the sum of the remaining terms is zero, by showing that every remaining term is zero
have h₄ : ∑ i : Fin (n - 4), ∏ j ≠ i.succ.succ.succ.succ, (a i.succ.succ.succ.succ - a j) = 0 := by
apply Finset.sum_eq_zero
intro i hi
apply Finset.prod_eq_zero_iff.mpr
by_cases hi' : i.succ.succ.succ.succ = ⟨4, by omega⟩
· use ⟨5, by omega⟩
simp [hi', a]
norm_cast
· use ⟨4, by omega⟩
simp [hi', a, eq_comm]
norm_cast
-- Close the goal
linarith
-- Case n = 3
constructor
· simp [P]
intro a
-- WLOG we assume that a is sorted in non-increasing order
wlog h : a 0 ≥ a 1 ∧ a 1 ≥ a 2
· -- We need to show that we can always "go back" to the sorted case
obtain ⟨b, ⟨σ, ⟨hσ, b_Antitone⟩⟩⟩ := exists_antitone_perm a
-- We can now prove that b is sorted
have b0_ge_b1 : b 0 ≥ b 1 := b_Antitone (by simp)
have b1_ge_b2 : b 1 ≥ b 2 := b_Antitone (by simp)
rw [E_equiv_perm ⟨σ, hσ⟩]
exact this h1 h2 b ⟨b0_ge_b1, b1_ge_b2⟩
· -- Unfold the expression, as n is small
simp [E, prod_ne_eq_prod_ite]
simp [Finset.sum, Finset.prod]
-- Show that the sum of the first two terms is non-negative
have h₁ : 0 ≤ (a 0 - a 1) * (a 0 - a 2) + (a 1 - a 0) * (a 1 - a 2) := by
rw [← sub_neg_eq_add, sub_nonneg]
calc -((a 1 - a 0) * (a 1 - a 2))
_ = (a 0 - a 1) * (a 1 - a 2) := by rw [← neg_sub, neg_mul, neg_neg]
_ ≤ (a 0 - a 1) * (a 0 - a 2) := by
apply mul_le_mul <;> linarith [h.1, h.2]
-- Show that the third term is also non-negative
have h₂ : 0 ≤ (a 2 - a 0) * (a 2 - a 1) := by apply mul_nonneg_of_nonpos_of_nonpos <;> linarith
-- Close the goal
linarith
-- Case n = 5
constructor
· simp [P]
-- WLOG we assume that a is sorted in non-increasing order
intro a
wlog h : a 0 ≥ a 1 ∧ a 1 ≥ a 2 ∧ a 2 ≥ a 3 ∧ a 3 ≥ a 4
· -- We need to show that we can always "go back" to the sorted case
obtain ⟨b, ⟨σ, ⟨hσ, b_Antitone⟩⟩⟩ := exists_antitone_perm a
-- We can now prove that b is sorted
have b0_ge_b1 : b 0 ≥ b 1 := b_Antitone (by simp)
have b1_ge_b2 : b 1 ≥ b 2 := b_Antitone (by simp)
have b2_ge_b3 : b 2 ≥ b 3 := b_Antitone (by simp)
have b3_ge_b4 : b 3 ≥ b 4 := b_Antitone (by simp)
rw [E_equiv_perm ⟨σ, hσ⟩]
exact this h1 h2 b ⟨b0_ge_b1, ⟨b1_ge_b2, ⟨b2_ge_b3, b3_ge_b4⟩⟩⟩
· -- Unfold the expression, as n is small
simp [E, prod_ne_eq_prod_ite]
simp [Finset.sum, Finset.prod]
-- Show that the sum of the first two terms is non-negative
have h₁ : 0 ≤ (a 0 - a 1) * ((a 0 - a 2) * ((a 0 - a 3) * (a 0 - a 4))) +
(a 1 - a 0) * ((a 1 - a 2) * ((a 1 - a 3) * (a 1 - a 4))) := by
rw [← neg_sub (a 0) (a 1), neg_mul, ← sub_eq_add_neg, ← mul_sub]
apply mul_nonneg
· linarith
· rw [sub_nonneg]
apply mul_le_mul
· linarith
· apply mul_le_mul <;> linarith
· apply mul_nonneg <;> linarith
· linarith
-- Show that the third term is non-negative
have h₂ : 0 ≤ (a 2 - a 0) * ((a 2 - a 1) * ((a 2 - a 3) * (a 2 - a 4))) := by
rw [← neg_sub (a 0) (a 2), ← neg_sub (a 1) (a 2), ← mul_assoc, neg_mul_neg]
apply mul_nonneg <;> apply mul_nonneg <;> linarith
-- Show that the sum of the last two terms is non-negative
have h₃ : 0 ≤ (a 3 - a 0) * ((a 3 - a 1) * ((a 3 - a 2) * (a 3 - a 4))) +
(a 4 - a 0) * ((a 4 - a 1) * ((a 4 - a 2) * (a 4 - a 3))) := by
simp [← mul_assoc]
rw [← neg_sub (a 3) (a 4), mul_neg, ← sub_eq_add_neg, ← sub_mul]
have hp : (a 3 - a 0) * (a 3 - a 1) * (a 3 - a 2) = -((a 0 - a 3) * (a 1 - a 3) * (a 2 - a 3)) := by linarith
have hq : (a 4 - a 0) * (a 4 - a 1) * (a 4 - a 2) = -((a 0 - a 4) * (a 1 - a 4) * (a 2 - a 4)) := by linarith
rw [hp, hq, sub_neg_eq_add, add_comm, ← sub_eq_add_neg]
apply mul_nonneg
· rw [sub_nonneg]
apply mul_le_mul
· apply mul_le_mul <;> linarith
· linarith
· linarith
· apply mul_nonneg <;> linarith
· linarith [h.2.2.2]
-- Close the goal
linarith
-- Case n > 2
· grind
end Imo1971P1
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Francesco Cappetti
-/
import Mathlib
/-!
# International Mathematical Olympiad 1971, Problem 1
Prove that the following assertion is true for n = 3 and n = 5, and that it is
false for every other natural number n > 2:
If a1, a2, ..., an are arbitrary real numbers, then
(a1 − a2)(a1 − a3) · · · (a1 − an) + (a2 − a1)(a2 − a3) · · · (a2 − an)
+ · · · + (an − a1)(an − a2) · · · (an − an−1) ≥ 0
-/
namespace Imo1971P1
def E {n : ℕ} (a : Fin n → ℝ) : ℝ :=
∑ i, ∏ j ≠ i, (a i - a j)
def P (n : ℕ) : Prop :=
∀ (a : Fin n → ℝ), E a ≥ 0
-- This makes working with the sum easier and simp more powerful.
lemma prod_ne_eq_prod_ite {n : ℕ} {i : Fin n} {a : Fin n → ℝ} : ∏ j ≠ i, (a i - a j) = ∏ j, if j = i then 1 else a i - a j := by
rw [← Finset.mul_prod_erase Finset.univ _ (Finset.mem_univ i)]
grind [Finset.prod_congr]
-- A proof that E a = E b, where b is obtained by permuting a's indices.
lemma E_equiv_perm {n : ℕ} {a b : Fin n → ℝ} (h : ∃ σ : Equiv.Perm (Fin n), b = a ∘ σ) : E a = E b := by
obtain ⟨σ, hσ⟩ := h
simp [E]
apply Finset.sum_equiv (e := σ.symm) (by simp)
intro i hi
apply Finset.prod_equiv (e := σ.symm) (by simp)
intro j hj
simp [hσ, Equiv.apply_symm_apply]
-- This gets a permutation of the indices of a such that the resulting sequence is antitone.
-- Uses Tuple.sort (which gives monotone) composed with Fin.revPerm (which reverses) to get antitone.
lemma antitone_of_monotone_comp_rev {n : ℕ} (f : Fin n → ℝ) (σ : Equiv.Perm (Fin n))
(hm : Monotone (f ∘ σ)) : Antitone (f ∘ σ ∘ Fin.revPerm) := by
intro i j hij
simp only [Function.comp_apply]
exact hm (by simp [Fin.revPerm_apply, Fin.rev_le_rev, hij])
lemma exists_antitone_perm {n : ℕ} (a : Fin n → ℝ) :
∃ b, ∃ σ : Equiv.Perm (Fin n), b = a ∘ σ ∧ Antitone b := by
let σ : Equiv.Perm (Fin n) := Tuple.sort a * Fin.revPerm
use a ∘ σ, σ
constructor
· rfl
· simp only [σ, Equiv.Perm.coe_mul, Function.comp_def]
exact antitone_of_monotone_comp_rev a _ (Tuple.monotone_sort a)
theorem imo1971_p1 : P 3 ∧ P 5 ∧ ∀ n > 2, n ≠ 3 ∧ n ≠ 5 → ¬P n := by
-- Solution from https://artofproblemsolving.com/wiki/index.php/1971_IMO_Problems/Problem_1
-- Note that indices start from 0 in the formalization
-- Show that P is false for even n > 2
have h1 : ∀ n > 2, Even n → ¬P n := by
intro n n_gt_2 n_even
have n_pos : 0 < n := by omega
-- Rewriting now lets us decompose the sum later
rw [show n = n - 1 + 1 by omega]
simp [P]
-- Our counterexample
let a : Fin (n - 1 + 1) → ℝ := fun i ↦ if i = 0 then -1 else 0
use a
rw [E, Fin.sum_univ_succ]
-- Show that the first term is negative
have h₀ : ∏ j ≠ 0, (a 0 - a j) = -1 := by
rw [prod_ne_eq_prod_ite]
simp [Finset.prod, a, Odd.neg_one_pow (Nat.Even.sub_odd n_pos n_even odd_one)]
-- Show that the sum of the remaining terms is zero, by showing that every remaining term is zero
have h₁ : ∑ i : Fin (n - 1), ∏ j ≠ i.succ, (a i.succ - a j) = 0 := by
apply Finset.sum_eq_zero
intro i hi
rw [Finset.prod_eq_zero_iff]
by_cases hi' : i.succ = ⟨2, by linarith [Nat.sub_one_add_one_eq_of_pos n_pos]⟩
· use ⟨1, by linarith [Nat.sub_one_add_one_eq_of_pos n_pos]⟩
simp [hi', a]
· use ⟨2, by linarith [Nat.sub_one_add_one_eq_of_pos n_pos]⟩
simp [hi', a, eq_comm]
-- Close the goal
linarith
-- Show that P is false for n ≥ 7
have h2 : ∀ n ≥ 7, Odd n → ¬P n := by
intro n n_ge_7 n_odd
have n_pos : 4 ≤ n := by omega
-- Rewriting now lets us decompose the sum later
rw [show n = n - 4 + 4 by omega]
simp [P]
-- Our counterexample
let a : Fin (n - 4 + 4) → ℝ := fun i ↦ if i = 0 then 2 else if i = 1 ∨ i = 2 ∨ i = 3 then 1 else 3
use a
simp [E, Fin.sum_univ_succ]
-- Show that the first term is negative
have h₀ : ∏ j ≠ 0, (a 0 - a j) < 0 := by
rw [prod_ne_eq_prod_ite]
have h_0 : Fin.succ (2 : Fin (n - 4 + 3)) = 3 := rfl
have h_1 {i : Fin (n - 4)} : i.succ.succ.succ.succ ≠ 1 := not_eq_of_beq_eq_false rfl
have h_2 {i : Fin (n - 4)} : i.succ.succ.succ.succ ≠ 2 := not_eq_of_beq_eq_false rfl
have h_3 {i : Fin (n - 4)} : i.succ.succ.succ.succ ≠ 3 := not_eq_of_beq_eq_false rfl
simp [Fin.prod_univ_succ, a, h_0, h_1, h_2, h_3]
calc ((2 : ℝ) - 1) * ((2 - 1) * ((2 - 1) * (2 - 3) ^ (n - 4)))
_ = (-1) ^ (n - 4) := by norm_num
_ < 0 := by simp [(Nat.Odd.sub_even n_pos n_odd (show Even 4 by norm_num)).neg_one_pow]
-- Prove that the second, third and fourth terms are zero
have h₁ : ∏ j ≠ 1, (a 1 - a j) = 0 := by
rw [Finset.prod_eq_zero_iff]
use ⟨2, by omega⟩
simp [a]
norm_cast
have h₂ : ∏ j ≠ 2, (a 2 - a j) = 0 := by
rw [prod_ne_eq_prod_ite, Finset.prod_eq_zero_iff]
use ⟨1, by omega⟩
simp [a]
norm_cast
have h₃ : ∏ j ≠ Fin.succ 2, (a (Fin.succ 2) - a j) = 0 := by
rw [prod_ne_eq_prod_ite, Finset.prod_eq_zero_iff]
use ⟨1, by omega⟩
simp [a]
norm_cast
-- Show that the sum of the remaining terms is zero, by showing that every remaining term is zero
have h₄ : ∑ i : Fin (n - 4), ∏ j ≠ i.succ.succ.succ.succ, (a i.succ.succ.succ.succ - a j) = 0 := by
apply Finset.sum_eq_zero
intro i hi
apply Finset.prod_eq_zero_iff.mpr
by_cases hi' : i.succ.succ.succ.succ = ⟨4, by omega⟩
· use ⟨5, by omega⟩
simp [hi', a]
norm_cast
· use ⟨4, by omega⟩
simp [hi', a, eq_comm]
norm_cast
-- Close the goal
linarith
-- Case n = 3
constructor
· simp [P]
intro a
-- WLOG we assume that a is sorted in non-increasing order
wlog h : a 0 ≥ a 1 ∧ a 1 ≥ a 2
· -- We need to show that we can always "go back" to the sorted case
obtain ⟨b, ⟨σ, ⟨hσ, b_Antitone⟩⟩⟩ := exists_antitone_perm a
-- We can now prove that b is sorted
have b0_ge_b1 : b 0 ≥ b 1 := b_Antitone (by simp)
have b1_ge_b2 : b 1 ≥ b 2 := b_Antitone (by simp)
rw [E_equiv_perm ⟨σ, hσ⟩]
exact this h1 h2 b ⟨b0_ge_b1, b1_ge_b2⟩
· -- Unfold the expression, as n is small
simp [E, prod_ne_eq_prod_ite]
simp [Finset.sum, Finset.prod]
-- Show that the sum of the first two terms is non-negative
have h₁ : 0 ≤ (a 0 - a 1) * (a 0 - a 2) + (a 1 - a 0) * (a 1 - a 2) := by
rw [← sub_neg_eq_add, sub_nonneg]
calc -((a 1 - a 0) * (a 1 - a 2))
_ = (a 0 - a 1) * (a 1 - a 2) := by rw [← neg_sub, neg_mul, neg_neg]
_ ≤ (a 0 - a 1) * (a 0 - a 2) := by
apply mul_le_mul <;> linarith [h.1, h.2]
-- Show that the third term is also non-negative
have h₂ : 0 ≤ (a 2 - a 0) * (a 2 - a 1) := by apply mul_nonneg_of_nonpos_of_nonpos <;> linarith
-- Close the goal
linarith
-- Case n = 5
constructor
· simp [P]
-- WLOG we assume that a is sorted in non-increasing order
intro a
wlog h : a 0 ≥ a 1 ∧ a 1 ≥ a 2 ∧ a 2 ≥ a 3 ∧ a 3 ≥ a 4
· -- We need to show that we can always "go back" to the sorted case
obtain ⟨b, ⟨σ, ⟨hσ, b_Antitone⟩⟩⟩ := exists_antitone_perm a
-- We can now prove that b is sorted
have b0_ge_b1 : b 0 ≥ b 1 := b_Antitone (by simp)
have b1_ge_b2 : b 1 ≥ b 2 := b_Antitone (by simp)
have b2_ge_b3 : b 2 ≥ b 3 := b_Antitone (by simp)
have b3_ge_b4 : b 3 ≥ b 4 := b_Antitone (by simp)
rw [E_equiv_perm ⟨σ, hσ⟩]
exact this h1 h2 b ⟨b0_ge_b1, ⟨b1_ge_b2, ⟨b2_ge_b3, b3_ge_b4⟩⟩⟩
· -- Unfold the expression, as n is small
simp [E, prod_ne_eq_prod_ite]
simp [Finset.sum, Finset.prod]
-- Show that the sum of the first two terms is non-negative
have h₁ : 0 ≤ (a 0 - a 1) * ((a 0 - a 2) * ((a 0 - a 3) * (a 0 - a 4))) +
(a 1 - a 0) * ((a 1 - a 2) * ((a 1 - a 3) * (a 1 - a 4))) := by
rw [← neg_sub (a 0) (a 1), neg_mul, ← sub_eq_add_neg, ← mul_sub]
apply mul_nonneg
· linarith
· rw [sub_nonneg]
apply mul_le_mul
· linarith
· apply mul_le_mul <;> linarith
· apply mul_nonneg <;> linarith
· linarith
-- Show that the third term is non-negative
have h₂ : 0 ≤ (a 2 - a 0) * ((a 2 - a 1) * ((a 2 - a 3) * (a 2 - a 4))) := by
rw [← neg_sub (a 0) (a 2), ← neg_sub (a 1) (a 2), ← mul_assoc, neg_mul_neg]
apply mul_nonneg <;> apply mul_nonneg <;> linarith
-- Show that the sum of the last two terms is non-negative
have h₃ : 0 ≤ (a 3 - a 0) * ((a 3 - a 1) * ((a 3 - a 2) * (a 3 - a 4))) +
(a 4 - a 0) * ((a 4 - a 1) * ((a 4 - a 2) * (a 4 - a 3))) := by
simp [← mul_assoc]
rw [← neg_sub (a 3) (a 4), mul_neg, ← sub_eq_add_neg, ← sub_mul]
have hp : (a 3 - a 0) * (a 3 - a 1) * (a 3 - a 2) = -((a 0 - a 3) * (a 1 - a 3) * (a 2 - a 3)) := by linarith
have hq : (a 4 - a 0) * (a 4 - a 1) * (a 4 - a 2) = -((a 0 - a 4) * (a 1 - a 4) * (a 2 - a 4)) := by linarith
rw [hp, hq, sub_neg_eq_add, add_comm, ← sub_eq_add_neg]
apply mul_nonneg
· rw [sub_nonneg]
apply mul_le_mul
· apply mul_le_mul <;> linarith
· linarith
· linarith
· apply mul_nonneg <;> linarith
· linarith [h.2.2.2]
-- Close the goal
linarith
-- Case n > 2
· grind
end Imo1971P1 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1971P1.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["`grind` failed\ncase grind.2.1.1.1\nn : \u2115\ni : Fin n\na : Fin n \u2192 \u211d\nh : \u00ac\u220f j \u2208 Finset.univ.erase i, (a i - a j) = 1 * \u220f x \u2208 Finset.univ.erase i, if x = i then 1 else a i - a x\nh_1 : \u00ac(fun x => if x = i then 1 else a i - a x) = fun j => a i - a j\nw : Fin n\nh_2 : \u00ac(if w = i then 1 else a i - a w) = a i - a w\nh_3 : w = i\nw_1 : Fin n\nleft : w_1 \u2208 Finset.univ.erase i\nright : \u00aca i - a w_1 = if w_1 = i then 1 else a i - a w_1\nw_2 : Fin n\nleft_1 : w_2 \u2208 Finset.univ.erase i\nright_1 : \u00ac(if w_2 = i then 1 else a i - a w_2) = a i - a w_2\nh_6 : w_2 = i\nh_7 : w_1 = i\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] \u00ac\u220f j \u2208 Finset.univ.erase i, (a i - a j) = 1 * \u220f x \u2208 Finset.univ.erase i, if x = i then 1 else a i - a x\n [prop] (\u2203 a_1 \u2208 Finset.univ.erase i, \u00ac(if a_1 = i then 1 else a i - a a_1) = a i - a a_1) \u2228\n (\u220f x \u2208 Finset.univ.erase i, if x = i then 1 else a i - a x) = \u220f j \u2208 Finset.univ.erase i, (a i - a j)\n [prop] (\u2203 a_1 \u2208 Finset.univ.erase i, \u00aca i - a a_1 = if a_1 = i then 1 else a i - a a_1) \u2228\n \u220f j \u2208 Finset.univ.erase i, (a i - a j) = \u220f x \u2208 Finset.univ.erase i, if x = i then 1 else a i - a x\n [prop] \u00ac(fun x => if x = i then 1 else a i - a x) = fun j => a i - a j\n [prop] \u2203 x, \u00ac(if x = i then 1 else a i - a x) = a i - a x\n [prop] \u00ac(if w = i then 1 else a i - a w) = a i - a w\n [prop] w = i\n [prop] w_1 \u2208 Finset.univ.erase i\n [prop] \u00aca i - a w_1 = if w_1 = i then 1 else a i - a w_1\n [prop] w_2 \u2208 Finset.univ.erase i\n [prop] \u00ac(if w_2 = i then 1 else a i - a w_2) = a i - a w_2\n [prop] w_2 = i\n [prop] w_1 = i\n [eqc] True propositions\n [prop] (\u2203 a_1 \u2208 Finset.univ.erase i, \u00ac(if a_1 = i then 1 else a i - a a_1) = a i - a a_1) \u2228\n (\u220f x \u2208 Finset.univ.erase i, if x = i then 1 else a i - a x) = \u220f j \u2208 Finset.univ.erase i, (a i - a j)\n [prop] (\u2203 a_1 \u2208 Finset.univ.erase i, \u00aca i - a a_1 = if a_1 = i then 1 else a i - a a_1) \u2228\n \u220f j \u2208 Finset.univ.erase i, (a i - a j) = \u220f x \u2208 Finset.univ.erase i, if x = i then 1 else a i - a x\n [prop] \u2203 x, \u00ac(if x = i then 1 else a i - a x) = a i - a x\n [prop] w = i\n [prop] \u2203 a_1 \u2208 Finset.univ.erase i, \u00aca i - a a_1 = if a_1 = i then 1 else a i - a a_1\n [prop] \u2203 a_1 \u2208 Finset.univ.erase i, \u00ac(if a_1 = i then 1 else a i - a a_1) = a i - a a_1\n [prop] w_1 \u2208 Finset.univ.erase i\n [prop] w_2 \u2208 Finset.univ.erase i\n [prop] w_2 = i\n [prop] w_1 = i\n [eqc] False propositions\n [prop] \u220f j \u2208 Finset.univ.erase i, (a i - a j) = 1 * \u220f x \u2208 Finset.univ.erase i, if x = i then 1 else a i - a x\n [prop] (fun x => if x = i then 1 else a i - a x) = fun j => a i - a j\n [prop] (if w = i then 1 else a i - a w) = a i - a w\n [prop] (\u220f x \u2208 Finset.univ.erase i, if x = i then 1 else a i - a x) = \u220f j \u2208 Finset.univ.erase i, (a i - a j)\n [prop] \u220f j \u2208 Finset.univ.erase i, (a i - a j) = \u220f x \u2208 Finset.univ.erase i, if x = i then 1 else a i - a x\n [prop] a i - a w_1 = if w_1 = i then 1 else a i - a w_1\n [prop] (if w_2 = i then 1 else a i - a w_2) = a i - a w_2\n [eqc] Equivalence classes\n [eqc] {a w, a w_2, a w_1, a i}\n [eqc] {a i - a w_2, a i - a w_1, a i - a w}\n [eqc] {1 * \u220f x \u2208 Finset.univ.erase i, if x = i then 1 else a i - a x,\n \u220f x \u2208 Finset.univ.erase i, if x = i then 1 else a i - a x}\n [eqc] {if w = i then 1 else a i - a w, if w_2 = i then 1 else a i - a w_2, if w_1 = i then 1 else a i - a w_1, 1}\n [eqc] {w, w_2, w_1, i}\n [cases] Case analyses\n [cases] [2/2]: (fun x => if x = i then 1 else a i - a x) = fun j => a i - a j\n [cases] [1/1]: \u2203 x, \u00ac(if x = i then 1 else a i - a x) = a i - a x\n [cases] [1/2]: if w = i then 1 else a i - a w\n [cases] [1/1]: \u2203 a_1 \u2208 Finset.univ.erase i, \u00aca i - a a_1 = if a_1 = i then 1 else a i - a a_1\n [cases] [1/1]: \u2203 a_1 \u2208 Finset.univ.erase i, \u00ac(if a_1 = i then 1 else a i - a a_1) = a i - a a_1\n [cases] [1/2]: if w_2 = i then 1 else a i - a w_2\n [cases] [1/2]: if w_1 = i then 1 else a i - a w_1\n [ematch] E-matching patterns\n [thm] Finset.prod_congr: [@Finset.prod #8 #7 #4 #6 #3, @Finset.prod _ _ _ #5 #2]\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [ring] Ring `\u211d`\n [basis] Basis\n [_] a i + -1 * a w = 0\n [_] a w + -1 * a w_2 = 0\n [_] a w_1 + -1 * a w_2 = 0\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.univ.erase i\n has type\n Finset (Fin n) : Type\n but is expected to have type\n Std.ExtDHashMap (Fin n) ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.univ.erase i\n has type\n Finset (Fin n) : Type\n but is expected to have type\n Std.DHashMap (Fin n) ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.univ.erase i\n has type\n Finset (Fin n) : Type\n but is expected to have type\n Std.ExtDHashMap (Fin n) ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.univ.erase i\n has type\n Finset (Fin n) : Type\n but is expected to have type\n Std.DHashMap (Fin n) ?\u03b2 : Type\n[grind] Diagnostics\n [thm] E-Matching instances\n [thm] Finset.prod_congr \u21a6 4", "unknown tactic", "unsolved goals\nn : \u2115\nn_gt_2 : n > 2\nn_even : Even n\n\u22a2 0 < n", "unsolved goals\nn : \u2115\nn_gt_2 : n > 2\nn_even : Even n\nn_pos : 0 < n\n\u22a2 \u00acP n", "unsolved goals\nh1 : \u2200 n > 2, Even n \u2192 \u00acP n\n\u22a2 P 3 \u2227 P 5 \u2227 \u2200 n > 2, n \u2260 3 \u2227 n \u2260 5 \u2192 \u00acP n"], "timeout_s": 600.0, "latency_s": 0.8554, "verified_at": "2026-03-26T18:16:23.371220+00:00"}} | false | true | false | 0.8554 |
compfiles_Imo1971P3 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1971, Problem 3
Prove that we can find an infinite set of positive integers of the form 2^n - 3
(where n is a positive integer) every pair of which are relatively prime.
-/
namespace Imo1971P3
/-!
We follow the revised solution from https://artofproblemsolving.com/wiki/index.php/1971_IMO_Problems/Problem_3 by pf02.
-/
def pairwise_coprime_f (s : Set ℕ) : Prop := s.Pairwise fun m n ↦ Nat.Coprime (2 ^ n - 3) (2 ^ m - 3)
def a (n : ℕ) : ℕ := match n with
| 0 => 3
| n+1 => (a n) * ∏ p ∈ (2 ^ (a n) - 3).primeFactors, (p-1)
theorem a_ge_and_A_odd (n : ℕ) : 3 ≤ a n ∧ Odd (2 ^ (a n) - 3) := by
fun_induction a with
| case1 =>
and_intros
· rfl
· exact Nat.odd_iff.mpr rfl
| case2 n ih =>
have h : 3 ≤ 2 ^ (a n * ∏ p ∈ (2 ^ a n - 3).primeFactors, (p - 1)) := by
have : 0 < ∏ p ∈ (2 ^ a n - 3).primeFactors, (p - 1) := by
rw [Nat.lt_iff_add_one_le]
apply Finset.one_le_prod'
· simp only [Nat.mem_primeFactors, ne_eq, and_imp]
intro x xp _ _
exact Nat.le_sub_one_of_lt xp.two_le
refine (Nat.clog_le_iff_le_pow one_lt_two).mp ?_
rw [show Nat.clog 2 3 = 2 by rfl]
nlinarith
and_intros
· apply le_mul_of_le_mul_right _ ih.left
rw [le_mul_iff_one_le_right (by simp)]
omega
· rw [Nat.odd_sub', iff_true_left, Nat.even_pow']
· simp
· refine Nat.mul_ne_zero ?_ ?_
· omega
· omega
· exact Nat.odd_iff.mpr rfl
· exact h
theorem A_ge' (n : ℕ) : 8 ≤ 2 ^ a n := by
refine (Nat.clog_le_iff_le_pow one_lt_two).mp ?_
rw [show Nat.clog 2 8 = 3 by rfl]
exact (a_ge_and_A_odd _).left
theorem a_strictMono : StrictMono a := by
refine strictMono_nat_of_lt_succ ?_
intro n
have := a_ge_and_A_odd n
nth_rw 2 [a.eq_def]
refine (Nat.lt_mul_iff_one_lt_right ?_).mpr ?_
· omega
· refine (Finset.one_lt_prod_iff_of_one_le ?_).mpr ?_
· simp only [Nat.mem_primeFactors, ne_eq, and_imp]
intro x xp _ _
exact Nat.le_sub_one_of_lt xp.two_le
· let ⟨p, ph1, ph2, ph3⟩ := (@Nat.four_dvd_or_exists_odd_prime_and_dvd_of_two_lt (2 ^ a n - 3) ?_ ).resolve_left ?_
· use p
and_intros
· simp [ph1, ph2]
grind only [= Nat.odd_iff]
· grind only [= Nat.odd_iff, Nat.Prime.two_le (ph1)]
· have := A_ge' n
omega
· grind only [= Nat.odd_iff]
theorem a_prime_lemma (n1 n2 p : ℕ) (h1 : n1 < n2) (h2 : p ∣ 2 ^ (a n1) - 3) (h3 : Nat.Prime p) : p - 1 ∣ a n2 := by
fun_induction a n2
· simp at h1
· expose_names
by_cases n1=n
· subst n
apply Nat.dvd_mul_left_of_dvd
apply Finset.dvd_prod_of_mem
simp [h3, h2]
grind only [= Nat.odd_iff, a_ge_and_A_odd n1]
· replace ih1 := ih1 (by omega)
exact Nat.dvd_mul_right_of_dvd ih1 _
theorem a_pairwise_coprime : pairwise_coprime_f (Set.range a) := by
intro x1 hx1 x2 hx2 ne
let ⟨i1, hi1⟩ := hx1
let ⟨i2, hi2⟩ := hx2
wlog w : i1 < i2
· have w' : i1 > i2 := by grind only
have := @this x2 hx2 x1 hx1 ne.symm i2 hi2 i1 hi1 w'
exact Nat.coprime_comm.mp this
rw [Nat.coprime_iff_gcd_eq_one]
by_contra!
obtain ⟨p, php, ph1, ph2⟩ : ∃ p, Nat.Prime p ∧ p ∣ (2 ^ (a i1) - 3) ∧ p ∣ (2 ^ (a i2) - 3) := by
let ⟨p, h1, h2⟩ := Nat.exists_prime_and_dvd this
use p
and_intros
· exact h1
· apply dvd_trans h2
rw [<-hi1]
exact Nat.gcd_dvd_right _ _
· apply dvd_trans h2
rw [<-hi2]
exact Nat.gcd_dvd_left _ _
have pOdd : Odd p := by
apply Odd.of_dvd_nat _ ph1
apply (a_ge_and_A_odd _).right
have := a_prime_lemma _ _ p w ph1 php
rw [dvd_iff_exists_eq_mul_left] at this
let ⟨b, bh⟩ := this
let B : ℤ := 2^(a i2) - 1
have : ↑p ∣ B := by
unfold B
rw [bh, pow_mul]
apply Int.prime_dvd_pow_sub_one php
refine IsCoprime.pow_left ?_
rw [<-Nat.cast_ofNat, Nat.isCoprime_iff_coprime]
apply pOdd.coprime_two_left
have : ↑p ∣ B - (2 ^ a i2 - 3) := by
zify at ph2
rw [Nat.cast_sub, Nat.cast_pow] at ph2
· apply dvd_sub <;> trivial
· have := A_ge' i2
omega
unfold B at this
simp only [sub_sub_sub_cancel_left, Int.reduceSub] at this
norm_cast at this
rw [Nat.dvd_prime_two_le Nat.prime_two (Nat.Prime.two_le php)] at this
subst p
contradiction
theorem imo1971_p3 :
∃ s : Set ℕ+,
s.Infinite ∧
s.Pairwise fun m n ↦ Nat.Coprime (2 ^ n.val - 3) (2 ^ m.val - 3) := by
use {⟨a n, Nat.zero_lt_of_lt (a_ge_and_A_odd n).left⟩ | n : ℕ}
and_intros
· apply Set.infinite_range_of_injective
apply StrictMono.injective
apply a_strictMono
· intro x hx y hy ne
apply a_pairwise_coprime <;> aesop
end Imo1971P3 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1971, Problem 3
Prove that we can find an infinite set of positive integers of the form 2^n - 3
(where n is a positive integer) every pair of which are relatively prime.
-/
namespace Imo1971P3
/-!
We follow the revised solution from https://artofproblemsolving.com/wiki/index.php/1971_IMO_Problems/Problem_3 by pf02.
-/
def pairwise_coprime_f (s : Set ℕ) : Prop := s.Pairwise fun m n ↦ Nat.Coprime (2 ^ n - 3) (2 ^ m - 3)
def a (n : ℕ) : ℕ := match n with
| 0 => 3
| n+1 => (a n) * ∏ p ∈ (2 ^ (a n) - 3).primeFactors, (p-1)
theorem a_ge_and_A_odd (n : ℕ) : 3 ≤ a n ∧ Odd (2 ^ (a n) - 3) := by
fun_induction a with
| case1 =>
and_intros
· rfl
· exact Nat.odd_iff.mpr rfl
| case2 n ih =>
have h : 3 ≤ 2 ^ (a n * ∏ p ∈ (2 ^ a n - 3).primeFactors, (p - 1)) := by
have : 0 < ∏ p ∈ (2 ^ a n - 3).primeFactors, (p - 1) := by
rw [Nat.lt_iff_add_one_le]
apply Finset.one_le_prod'
· simp only [Nat.mem_primeFactors, ne_eq, and_imp]
intro x xp _ _
exact Nat.le_sub_one_of_lt xp.two_le
refine (Nat.clog_le_iff_le_pow one_lt_two).mp ?_
rw [show Nat.clog 2 3 = 2 by rfl]
nlinarith
and_intros
· apply le_mul_of_le_mul_right _ ih.left
rw [le_mul_iff_one_le_right (by simp)]
omega
· rw [Nat.odd_sub', iff_true_left, Nat.even_pow']
· simp
· refine Nat.mul_ne_zero ?_ ?_
· omega
· omega
· exact Nat.odd_iff.mpr rfl
· exact h
theorem A_ge' (n : ℕ) : 8 ≤ 2 ^ a n := by
refine (Nat.clog_le_iff_le_pow one_lt_two).mp ?_
rw [show Nat.clog 2 8 = 3 by rfl]
exact (a_ge_and_A_odd _).left
theorem a_strictMono : StrictMono a := by
refine strictMono_nat_of_lt_succ ?_
intro n
have := a_ge_and_A_odd n
nth_rw 2 [a.eq_def]
refine (Nat.lt_mul_iff_one_lt_right ?_).mpr ?_
· omega
· refine (Finset.one_lt_prod_iff_of_one_le ?_).mpr ?_
· simp only [Nat.mem_primeFactors, ne_eq, and_imp]
intro x xp _ _
exact Nat.le_sub_one_of_lt xp.two_le
· let ⟨p, ph1, ph2, ph3⟩ := (@Nat.four_dvd_or_exists_odd_prime_and_dvd_of_two_lt (2 ^ a n - 3) ?_ ).resolve_left ?_
· use p
and_intros
· simp [ph1, ph2]
grind only [= Nat.odd_iff]
· grind only [= Nat.odd_iff, Nat.Prime.two_le (ph1)]
· have := A_ge' n
omega
· grind only [= Nat.odd_iff]
theorem a_prime_lemma (n1 n2 p : ℕ) (h1 : n1 < n2) (h2 : p ∣ 2 ^ (a n1) - 3) (h3 : Nat.Prime p) : p - 1 ∣ a n2 := by
fun_induction a n2
· simp at h1
· expose_names
by_cases n1=n
· subst n
apply Nat.dvd_mul_left_of_dvd
apply Finset.dvd_prod_of_mem
simp [h3, h2]
grind only [= Nat.odd_iff, a_ge_and_A_odd n1]
· replace ih1 := ih1 (by omega)
exact Nat.dvd_mul_right_of_dvd ih1 _
theorem a_pairwise_coprime : pairwise_coprime_f (Set.range a) := by
intro x1 hx1 x2 hx2 ne
let ⟨i1, hi1⟩ := hx1
let ⟨i2, hi2⟩ := hx2
wlog w : i1 < i2
· have w' : i1 > i2 := by grind only
have := @this x2 hx2 x1 hx1 ne.symm i2 hi2 i1 hi1 w'
exact Nat.coprime_comm.mp this
rw [Nat.coprime_iff_gcd_eq_one]
by_contra!
obtain ⟨p, php, ph1, ph2⟩ : ∃ p, Nat.Prime p ∧ p ∣ (2 ^ (a i1) - 3) ∧ p ∣ (2 ^ (a i2) - 3) := by
let ⟨p, h1, h2⟩ := Nat.exists_prime_and_dvd this
use p
and_intros
· exact h1
· apply dvd_trans h2
rw [<-hi1]
exact Nat.gcd_dvd_right _ _
· apply dvd_trans h2
rw [<-hi2]
exact Nat.gcd_dvd_left _ _
have pOdd : Odd p := by
apply Odd.of_dvd_nat _ ph1
apply (a_ge_and_A_odd _).right
have := a_prime_lemma _ _ p w ph1 php
rw [dvd_iff_exists_eq_mul_left] at this
let ⟨b, bh⟩ := this
let B : ℤ := 2^(a i2) - 1
have : ↑p ∣ B := by
unfold B
rw [bh, pow_mul]
apply Int.prime_dvd_pow_sub_one php
refine IsCoprime.pow_left ?_
rw [<-Nat.cast_ofNat, Nat.isCoprime_iff_coprime]
apply pOdd.coprime_two_left
have : ↑p ∣ B - (2 ^ a i2 - 3) := by
zify at ph2
rw [Nat.cast_sub, Nat.cast_pow] at ph2
· apply dvd_sub <;> trivial
· have := A_ge' i2
omega
unfold B at this
simp only [sub_sub_sub_cancel_left, Int.reduceSub] at this
norm_cast at this
rw [Nat.dvd_prime_two_le Nat.prime_two (Nat.Prime.two_le php)] at this
subst p
contradiction
theorem imo1971_p3 :
∃ s : Set ℕ+,
s.Infinite ∧
s.Pairwise fun m n ↦ Nat.Coprime (2 ^ n.val - 3) (2 ^ m.val - 3) := by
use {⟨a n, Nat.zero_lt_of_lt (a_ge_and_A_odd n).left⟩ | n : ℕ}
and_intros
· apply Set.infinite_range_of_injective
apply StrictMono.injective
apply a_strictMono
· intro x hx y hy ne
apply a_pairwise_coprime <;> aesop
end Imo1971P3
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1971, Problem 3
Prove that we can find an infinite set of positive integers of the form 2^n - 3
(where n is a positive integer) every pair of which are relatively prime.
-/
namespace Imo1971P3
/-!
We follow the revised solution from https://artofproblemsolving.com/wiki/index.php/1971_IMO_Problems/Problem_3 by pf02.
-/
def pairwise_coprime_f (s : Set ℕ) : Prop := s.Pairwise fun m n ↦ Nat.Coprime (2 ^ n - 3) (2 ^ m - 3)
def a (n : ℕ) : ℕ := match n with
| 0 => 3
| n+1 => (a n) * ∏ p ∈ (2 ^ (a n) - 3).primeFactors, (p-1)
theorem a_ge_and_A_odd (n : ℕ) : 3 ≤ a n ∧ Odd (2 ^ (a n) - 3) := by
fun_induction a with
| case1 =>
and_intros
· rfl
· exact Nat.odd_iff.mpr rfl
| case2 n ih =>
have h : 3 ≤ 2 ^ (a n * ∏ p ∈ (2 ^ a n - 3).primeFactors, (p - 1)) := by
have : 0 < ∏ p ∈ (2 ^ a n - 3).primeFactors, (p - 1) := by
rw [Nat.lt_iff_add_one_le]
apply Finset.one_le_prod'
· simp only [Nat.mem_primeFactors, ne_eq, and_imp]
intro x xp _ _
exact Nat.le_sub_one_of_lt xp.two_le
refine (Nat.clog_le_iff_le_pow one_lt_two).mp ?_
rw [show Nat.clog 2 3 = 2 by rfl]
nlinarith
and_intros
· apply le_mul_of_le_mul_right _ ih.left
rw [le_mul_iff_one_le_right (by simp)]
omega
· rw [Nat.odd_sub', iff_true_left, Nat.even_pow']
· simp
· refine Nat.mul_ne_zero ?_ ?_
· omega
· omega
· exact Nat.odd_iff.mpr rfl
· exact h
theorem A_ge' (n : ℕ) : 8 ≤ 2 ^ a n := by
refine (Nat.clog_le_iff_le_pow one_lt_two).mp ?_
rw [show Nat.clog 2 8 = 3 by rfl]
exact (a_ge_and_A_odd _).left
theorem a_strictMono : StrictMono a := by
refine strictMono_nat_of_lt_succ ?_
intro n
have := a_ge_and_A_odd n
nth_rw 2 [a.eq_def]
refine (Nat.lt_mul_iff_one_lt_right ?_).mpr ?_
· omega
· refine (Finset.one_lt_prod_iff_of_one_le ?_).mpr ?_
· simp only [Nat.mem_primeFactors, ne_eq, and_imp]
intro x xp _ _
exact Nat.le_sub_one_of_lt xp.two_le
· let ⟨p, ph1, ph2, ph3⟩ := (@Nat.four_dvd_or_exists_odd_prime_and_dvd_of_two_lt (2 ^ a n - 3) ?_ ).resolve_left ?_
· use p
and_intros
· simp [ph1, ph2]
grind only [= Nat.odd_iff]
· grind only [= Nat.odd_iff, Nat.Prime.two_le (ph1)]
· have := A_ge' n
omega
· grind only [= Nat.odd_iff]
theorem a_prime_lemma (n1 n2 p : ℕ) (h1 : n1 < n2) (h2 : p ∣ 2 ^ (a n1) - 3) (h3 : Nat.Prime p) : p - 1 ∣ a n2 := by
fun_induction a n2
· simp at h1
· expose_names
by_cases n1=n
· subst n
apply Nat.dvd_mul_left_of_dvd
apply Finset.dvd_prod_of_mem
simp [h3, h2]
grind only [= Nat.odd_iff, a_ge_and_A_odd n1]
· replace ih1 := ih1 (by omega)
exact Nat.dvd_mul_right_of_dvd ih1 _
theorem a_pairwise_coprime : pairwise_coprime_f (Set.range a) := by
intro x1 hx1 x2 hx2 ne
let ⟨i1, hi1⟩ := hx1
let ⟨i2, hi2⟩ := hx2
wlog w : i1 < i2
· have w' : i1 > i2 := by grind only
have := @this x2 hx2 x1 hx1 ne.symm i2 hi2 i1 hi1 w'
exact Nat.coprime_comm.mp this
rw [Nat.coprime_iff_gcd_eq_one]
by_contra!
obtain ⟨p, php, ph1, ph2⟩ : ∃ p, Nat.Prime p ∧ p ∣ (2 ^ (a i1) - 3) ∧ p ∣ (2 ^ (a i2) - 3) := by
let ⟨p, h1, h2⟩ := Nat.exists_prime_and_dvd this
use p
and_intros
· exact h1
· apply dvd_trans h2
rw [<-hi1]
exact Nat.gcd_dvd_right _ _
· apply dvd_trans h2
rw [<-hi2]
exact Nat.gcd_dvd_left _ _
have pOdd : Odd p := by
apply Odd.of_dvd_nat _ ph1
apply (a_ge_and_A_odd _).right
have := a_prime_lemma _ _ p w ph1 php
rw [dvd_iff_exists_eq_mul_left] at this
let ⟨b, bh⟩ := this
let B : ℤ := 2^(a i2) - 1
have : ↑p ∣ B := by
unfold B
rw [bh, pow_mul]
apply Int.prime_dvd_pow_sub_one php
refine IsCoprime.pow_left ?_
rw [<-Nat.cast_ofNat, Nat.isCoprime_iff_coprime]
apply pOdd.coprime_two_left
have : ↑p ∣ B - (2 ^ a i2 - 3) := by
zify at ph2
rw [Nat.cast_sub, Nat.cast_pow] at ph2
· apply dvd_sub <;> trivial
· have := A_ge' i2
omega
unfold B at this
simp only [sub_sub_sub_cancel_left, Int.reduceSub] at this
norm_cast at this
rw [Nat.dvd_prime_two_le Nat.prime_two (Nat.Prime.two_le php)] at this
subst p
contradiction
theorem imo1971_p3 :
∃ s : Set ℕ+,
s.Infinite ∧
s.Pairwise fun m n ↦ Nat.Coprime (2 ^ n.val - 3) (2 ^ m.val - 3) := by
use {⟨a n, Nat.zero_lt_of_lt (a_ge_and_A_odd n).left⟩ | n : ℕ}
and_intros
· apply Set.infinite_range_of_injective
apply StrictMono.injective
apply a_strictMono
· intro x hx y hy ne
apply a_pairwise_coprime <;> aesop
end Imo1971P3 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1971P3.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unknown constant 'Nat.clog_le_iff_le_pow'", "no goals to be solved", "unsolved goals\nn : \u2115\nih : 3 \u2264 a n \u2227 Odd (2 ^ a n - 3)\nh : 3 \u2264 2 ^ (a n * \u220f p \u2208 (2 ^ a n - 3).primeFactors, (p - 1))\n\u22a2 1 \u2264 \u220f p \u2208 (2 ^ a n - 3).primeFactors, (p - 1)", "unsolved goals\ncase case2.refine_2\nn : \u2115\nih : 3 \u2264 a n \u2227 Odd (2 ^ a n - 3)\nh : 3 \u2264 2 ^ (a n * \u220f p \u2208 (2 ^ a n - 3).primeFactors, (p - 1))\n\u22a2 Odd (2 ^ (a n * \u220f p \u2208 (2 ^ a n - 3).primeFactors, (p - 1)) - 3)", "unknown constant 'Nat.clog_le_iff_le_pow'", "no goals to be solved", "unknown tactic", "unsolved goals\ncase refine_1\nn : \u2115\nthis : 3 \u2264 a n \u2227 Odd (2 ^ a n - 3)\n\u22a2 0 < a n", "unsolved goals\ncase refine_2\nn : \u2115\nthis : 3 \u2264 a n \u2227 Odd (2 ^ a n - 3)\n\u22a2 1 < \u220f p \u2208 (2 ^ a n - 3).primeFactors, (p - 1)", "unexpected identifier; expected ']'", "unsolved goals\ncase neg\nn1 p : \u2115\nh2 : p \u2223 2 ^ a n1 - 3\nh3 : Nat.Prime p\nn : \u2115\nih1 : n1 < n \u2192 p - 1 \u2223 a n\nh1 : n1 < n.succ\nh\u271d : \u00acn1 = n\n\u22a2 p - 1 \u2223 a n * \u220f p \u2208 (2 ^ a n - 3).primeFactors, (p - 1)", "unknown tactic", "unknown constant 'Int.prime_dvd_pow_sub_one'", "no goals to be solved", "unsolved goals\nx1 : \u2115\nhx1 : x1 \u2208 Set.range a\nx2 : \u2115\nhx2 : x2 \u2208 Set.range a\nne : x1 \u2260 x2\ni1 : \u2115\nhi1 : a i1 = x1\ni2 : \u2115\nhi2 : a i2 = x2\nw : i1 < i2\nthis\u271d\u00b2 : (2 ^ x2 - 3).gcd (2 ^ x1 - 3) \u2260 1\np : \u2115\nphp : Nat.Prime p\nph1 : p \u2223 2 ^ a i1 - 3\npOdd : Odd p\nthis\u271d\u00b9 : \u2203 c, a i2 = c * (p - 1)\nb : \u2115\nbh : a i2 = b * (p - 1)\nB : \u2124 := 2 ^ a i2 - 1\nthis\u271d : \u2191p \u2223 B\nph2 : \u2191p \u2223 \u2191(2 ^ a i2 - 3)\nthis : 8 \u2264 2 ^ a i2\n\u22a2 3 \u2264 2 ^ a i2", "unsolved goals\ncase intro.intro.intro\nx1 : \u2115\nhx1 : x1 \u2208 Set.range a\nx2 : \u2115\nhx2 : x2 \u2208 Set.range a\nne : x1 \u2260 x2\ni1 : \u2115\nhi1 : a i1 = x1\ni2 : \u2115\nhi2 : a i2 = x2\nw : i1 < i2\nthis\u271d\u00b2 : (2 ^ x2 - 3).gcd (2 ^ x1 - 3) \u2260 1\np : \u2115\nphp : Nat.Prime p\nph1 : p \u2223 2 ^ a i1 - 3\nph2 : p \u2223 2 ^ a i2 - 3\npOdd : Odd p\nthis\u271d\u00b9 : \u2203 c, a i2 = c * (p - 1)\nb : \u2115\nbh : a i2 = b * (p - 1)\nB : \u2124 := 2 ^ a i2 - 1\nthis\u271d : \u2191p \u2223 B\nthis : \u2191p \u2223 B - (2 ^ a i2 - 3)\n\u22a2 False", "PANIC at Lean.MetavarContext.getDecl Lean.MetavarContext:430:17: unknown metavariable\nbacktrace:\n/app/repl/.lake/build/bin/repl(lean_panic+0xf5) [0x5645dac802e5]\n/app/repl/.lake/build/bin/repl(lean_panic_fn+0x15) [0x5645dac804c5]\n/app/repl/.lake/build/bin/repl(l___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_elimMVar+0x41) [0x5645d404dc21]\n/app/repl/.lake/build/bin/repl(l___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_elimApp+0xcc4) [0x5645d4047f14]\n/app/repl/.lake/build/bin/repl(l___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_visit+0x349) [0x5645d4048e29]\n/app/repl/.lake/build/bin/repl(l_Array_mapMUnsafe_map___at___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_elimApp___spec__8+0xbf) [0x5645d404c11f]\n/app/repl/.lake/build/bin/repl(l___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_elimApp+0xbe2) [0x5645d4047e32]\n/app/repl/.lake/build/bin/repl(l___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_visit+0x349) [0x5645d4048e29]\n/app/repl/.lake/build/bin/repl(l_Array_mapMUnsafe_map___at___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_elimApp___spec__8+0xbf) [0x5645d404c11f]\n/app/repl/.lake/build/bin/repl(l___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_elimApp+0xbe2) [0x5645d4047e32]\n/app/repl/.lake/build/bin/repl(l___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_visit+0x349) [0x5645d4048e29]\n/app/repl/.lake/build/bin/repl(l___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_elim+0x356) [0x5645d4044576]\n/app/repl/.lake/build/bin/repl(l_Lean_MetavarContext_MkBinding_elimMVarDeps+0x57) [0x5645d40574a7]\n/app/repl/.lake/build/bin/repl(l_Lean_MetavarContext_MkBinding_mkBinding+0x5b) [0x5645d405ad1b]\n/app/repl/.lake/build/bin/repl(l_Lean_MetavarContext_mkBinding+0x1c3) [0x5645d405baa3]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_mkLambdaFVars+0x352) [0x5645d41d9b62]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_eqResolution___lambda__1+0x844) [0x5645d8bfb424]\n/app/repl/.lake/build/bin/repl(lean_apply_6+0x924) [0x5645dac97064]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Basic_0__Lean_Meta_withNewFVar___rarg+0x2f5) [0x5645d42048d5]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Basic_0__Lean_Meta_withLocalDeclImp___rarg+0x31d) [0x5645d4204e6d]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_withLocalDecl___at_Lean_Meta_addPPExplicitToExposeDiff_visit___spec__4___rarg+0x21) [0x5645d442ce21]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_eqResolution+0x87) [0x5645d8bfc127]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_propagateForallPropDown+0x8ad) [0x5645d8beae8d]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_mkMethods___lambda__2+0x125) [0x5645d8bb38b5]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_mkMethods___lambda__2___boxed+0x2a) [0x5645d8bb4dda]\n/app/repl/.lake/build/bin/repl(lean_apply_10+0x9d4) [0x5645dac9d2b4]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_propagateDown+0x62) [0x5645d844cda2]\n/app/repl/.lake/build/bin/repl(l_List_forIn_x27_loop___at___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep_go___spec__1+0x192) [0x5645d875b2f2]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep_go___lambda__1+0x640) [0x5645d875d770]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep_go___lambda__2+0x3cad) [0x5645d8762cbd]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep_go___lambda__3+0x9fc) [0x5645d8767aac]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep_go___lambda__4+0xa9) [0x5645d876eb39]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep_go___lambda__5+0x1554) [0x5645d8770a94]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep_go+0x416) [0x5645d8774106]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep___lambda__6+0x545) [0x5645d877bb75]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep___lambda__7+0x8c9) [0x5645d877d619]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep___lambda__8+0x1ce) [0x5645d877f78e]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep+0x36d3) [0x5645d8783fd3]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqCore+0x132) [0x5645d878a802]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addFactStep_goFact+0x770) [0x5645d878d8a0]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addFactStep_go+0x3be) [0x5645d87902fe]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addFactStep___lambda__3+0x1e4) [0x5645d8790a74]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addFactStep+0x519) [0x5645d8791009]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_add___lambda__2+0x273) [0x5645d8794aa3]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_add+0x1c2) [0x5645d8794fc2]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_addHypothesis+0x2a8) [0x5645d8795558]\n/app/repl/.lake/build/bin/repl(l_Lean_Loop_forIn_loop___at_Lean_Meta_Grind_intros___spec__1___lambda__6+0xa6) [0x5645d8dd8bf6]\n/app/repl/.lake/build/bin/repl(l_Lean_Loop_forIn_loop___at_Lean_Meta_Grind_intros___spec__1___lambda__6___boxed+0x2a) [0x5645d8dea48a]\n/app/repl/.lake/build/bin/repl(lean_apply_10+0x708) [0x5645dac9cfe8]\n/app/repl/.lake/build/bin/repl(l_ReaderT_bind___at_Lean_Meta_Grind_liftGoalM___spec__2___rarg+0x303) [0x5645d8c162b3]\n/app/repl/.lake/build/bin/repl(lean_apply_5+0xbe7) [0x5645dac95237]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Basic_0__Lean_Meta_withMVarContextImp___rarg+0x203) [0x5645d420ffe3]\n/app/repl/.lake/build/bin/repl(l_Lean_MVarId_withContext___at_Lean_Meta_Grind_withCurrGoalContext___spec__1___rarg+0x56) [0x5645d8c15ae6]\n/app/repl/.lake/build/bin/repl(l_Lean_Loop_forIn_loop___at_Lean_Meta_Grind_intros___spec__1___lambda__7+0x76dd) [0x5645d8de0a9d]\n/app/repl/.lake/build/bin/repl(l_Lean_Loop_forIn_loop___at_Lean_Meta_Grind_intros___spec__1+0x4d6) [0x5645d8dea996]\n/app/repl/.lake/build/bin/repl(lean_apply_9+0x6af) [0x5645dac9bb6f]\n/app/repl/.lake/build/bin/repl(l_ReaderT_bind___at_Lean_Meta_Grind_liftGoalM___spec__2___rarg+0x10b) [0x5645d8c160bb]\n/app/repl/.lake/build/bin/repl(lean_apply_5+0xbe7) [0x5645dac95237]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Basic_0__Lean_Meta_withMVarContextImp___rarg+0x203) [0x5645d420ffe3]\n/app/repl/.lake/build/bin/repl(l_Lean_MVarId_withContext___at_Lean_Meta_Grind_withCurrGoalContext___spec__1___rarg+0x56) [0x5645d8c15ae6]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_intros+0x196) [0x5645d8decf76]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_solve_loop+0x102) [0x5645d8c0f2b2]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_solve_main+0x108) [0x5645d8c131c8]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_solve___lambda__2+0x47) [0x5645d8c13f07]\n/app/repl/.lake/build/bin/repl(lean_apply_9+0x240) [0x5645dac9b700]\n/app/repl/.lake/build/bin/repl(l_ReaderT_bind___at_Lean_Meta_Grind_GoalM_run_x27___spec__1___rarg+0x2c8) [0x5645d83e2958]\n/app/repl/.lake/build/bin/repl(lean_apply_5+0xaeb) [0x5645dac9513b]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Basic_0__Lean_Meta_withMVarContextImp___rarg+0x203) [0x5645d420ffe3]\n/app/repl/.lake/build/bin/repl(l_Lean_MVarId_withContext___at_Lean_Meta_Grind_GoalM_run___spec__1___rarg+0x51) [0x5645d83e23c1]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_solve+0x125) [0x5645d8c14395]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_main___lambda__2+0x874) [0x5645d8bcc3a4]\n/app/repl/.lake/build/bin/repl(lean_apply_8+0x595) [0x5645dac9a495]\n/app/repl/.lake/build/bin/repl(l_ReaderT_bind___at_Lean_Meta_Grind_GoalM_run_x27___spec__1___rarg+0xf5) [0x5645d83e2785]\n/app/repl/.lake/build/bin/repl(lean_apply_8+0x595) [0x5645dac9a495]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_GrindM_run___rarg+0x409) [0x5645d8bb6f59]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_main___lambda__4+0xd5) [0x5645d8bd2925]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_main___lambda__5+0x186) [0x5645d8bd2ad6]\n/app/repl/.lake/build/bin/repl(lean_apply_1+0xe2f) [0x5645dac8c5af]\n/app/repl/.lake/build/bin/repl(l_Lean_profileitIOUnsafe___rarg___lambda__1+0xe) [0x5645d3fa8bee]\n/app/repl/.lake/build/bin/repl(l_Lean_profileitIOUnsafe___rarg___lambda__1___boxed+0x9) [0x5645d3fa8e79]\n/app/repl/.lake/build/bin/repl(lean_apply_1+0xb5f) [0x5645dac8c2df]\n/app/repl/.lake/build/bin/repl(lean_profileit+0x83) [0x5645d3b81563]\n/app/repl/.lake/build/bin/repl(l_Lean_profileitIOUnsafe___rarg+0x64) [0x5645d3fa8d54]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_main+0xab) [0x5645d8bd2eab]\n/app/repl/.lake/build/bin/repl(l_Lean_Elab_Tactic_grind___lambda__3+0x4b4) [0x5645d82c2874]\n/app/repl/.lake/build/bin/repl(l_Lean_Elab_Tactic_grind___lambda__3___boxed+0x7d) [0x5645d82c41ed]\n/app/repl/.lake/build/bin/repl(lean_apply_5+0xef8) [0x5645dac95548]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Basic_0__Lean_Meta_withMVarContextImp___rarg+0x203) [0x5645d420ffe3]\n/app/repl/.lake/build/bin/repl(l_Lean_MVarId_withContext___at_Lean_Elab_Tactic_withMainContext___spec__1___rarg+0x56) [0x5645d5716306]\n/app/repl/.lake/build/bin/repl(l_Lean_Elab_Tactic_evalGrindCore___lambda__1+0x350) [0x5645d82c7820]\n/app/repl/.lake/build/bin/repl(lean_apply_5+0xef8) [0x5645dac95548]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Basic_0__Lean_Meta_withMVarContextImp___rarg+0x203) [0x5645d420ffe3]\n/app/repl/.lake/build/bin/repl(l_Lean_MVarId_withContext___at_Lean_Elab_Tactic_withMainContext___spec__1___rarg+0x56) [0x5645d5716306]\n/app/repl/.lake/build/bin/repl(l_Lean_Elab_Tactic_withMainContext___rarg+0x24d) [0x5645d571673d]\n/app/repl/.lake/build/bin/repl(l_Lean_Elab_Tactic_evalGrindCore+0x497) [0x5645d82c86f7]\n/app/repl/.lake/build/bin/repl(l_Lean_Elab_Tactic_evalGrind___lambda__1+0x29e) [0x5645d82e14ae]\n/app/repl/.lake/build/bin/repl(l_Lean_Elab_Tactic_evalGrind___lambda__2+0x1a4) [0x5645d82e1aa4]\n/app/repl/.lake/build/bin/repl(l_Lean_Elab_Tactic_evalGrind___lambda__3+0xd3) [0x5645d82e1dc3]\n/app/repl/.lake/build/bin/repl(l_Lean_Elab_Tactic_evalGrind+0x24b) [0x5645d82e23ab]\n/app/repl/.lake/build/bin/repl(lean_apply_9+0x86e) [0x5645dac9bd2e]\nPANIC at Lean.MetavarContext.getDecl Lean.MetavarContext:430:17: unknown metavariable\nbacktrace:\n/app/repl/.lake/build/bin/repl(lean_panic+0xf5) [0x5645dac802e5]\n/app/repl/.lake/build/bin/repl(lean_panic_fn+0x15) [0x5645dac804c5]\n/app/repl/.lake/build/bin/repl(l___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_elimMVar+0x41) [0x5645d404dc21]\n/app/repl/.lake/build/bin/repl(l___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_elimApp+0xcc4) [0x5645d4047f14]\n/app/repl/.lake/build/bin/repl(l___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_visit+0x349) [0x5645d4048e29]\n/app/repl/.lake/build/bin/repl(l_Array_mapMUnsafe_map___at___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_elimApp___spec__8+0xbf) [0x5645d404c11f]\n/app/repl/.lake/build/bin/repl(l___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_elimApp+0xbe2) [0x5645d4047e32]\n/app/repl/.lake/build/bin/repl(l___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_visit+0x349) [0x5645d4048e29]\n/app/repl/.lake/build/bin/repl(l_Array_mapMUnsafe_map___at___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_elimApp___spec__8+0xbf) [0x5645d404c11f]\n/app/repl/.lake/build/bin/repl(l___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_elimApp+0xbe2) [0x5645d4047e32]\n/app/repl/.lake/build/bin/repl(l___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_visit+0x349) [0x5645d4048e29]\n/app/repl/.lake/build/bin/repl(l___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_elim+0x356) [0x5645d4044576]\n/app/repl/.lake/build/bin/repl(l___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_visit+0x349) [0x5645d4048e29]\n/app/repl/.lake/build/bin/repl(l___private_Lean_MetavarContext_0__Lean_MetavarContext_MkBinding_elim+0x85a) [0x5645d4044a7a]\n/app/repl/.lake/build/bin/repl(l_Lean_MetavarContext_MkBinding_elimMVarDeps+0x57) [0x5645d40574a7]\n/app/repl/.lake/build/bin/repl(l_Lean_MetavarContext_MkBinding_mkBinding+0x5b) [0x5645d405ad1b]\n/app/repl/.lake/build/bin/repl(l_Lean_MetavarContext_mkBinding+0x1c3) [0x5645d405baa3]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_mkLambdaFVars+0x352) [0x5645d41d9b62]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_eqResolution___lambda__1+0x844) [0x5645d8bfb424]\n/app/repl/.lake/build/bin/repl(lean_apply_6+0x924) [0x5645dac97064]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Basic_0__Lean_Meta_withNewFVar___rarg+0x2f5) [0x5645d42048d5]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Basic_0__Lean_Meta_withLocalDeclImp___rarg+0x31d) [0x5645d4204e6d]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_withLocalDecl___at_Lean_Meta_addPPExplicitToExposeDiff_visit___spec__4___rarg+0x21) [0x5645d442ce21]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_eqResolution+0x87) [0x5645d8bfc127]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_propagateForallPropDown+0x8ad) [0x5645d8beae8d]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_mkMethods___lambda__2+0x125) [0x5645d8bb38b5]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_mkMethods___lambda__2___boxed+0x2a) [0x5645d8bb4dda]\n/app/repl/.lake/build/bin/repl(lean_apply_10+0x9d4) [0x5645dac9d2b4]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_propagateDown+0x62) [0x5645d844cda2]\n/app/repl/.lake/build/bin/repl(l_List_forIn_x27_loop___at___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep_go___spec__1+0x192) [0x5645d875b2f2]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep_go___lambda__1+0x640) [0x5645d875d770]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep_go___lambda__2+0x3cad) [0x5645d8762cbd]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep_go___lambda__3+0x9fc) [0x5645d8767aac]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep_go___lambda__4+0xa9) [0x5645d876eb39]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep_go___lambda__5+0x1554) [0x5645d8770a94]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep_go+0x416) [0x5645d8774106]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep___lambda__6+0x545) [0x5645d877bb75]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep___lambda__7+0x8c9) [0x5645d877d619]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep___lambda__8+0x1ce) [0x5645d877f78e]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqStep+0x36d3) [0x5645d8783fd3]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addEqCore+0x132) [0x5645d878a802]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addFactStep_goFact+0x770) [0x5645d878d8a0]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addFactStep_go+0x3be) [0x5645d87902fe]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addFactStep___lambda__3+0x1e4) [0x5645d8790a74]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Tactic_Grind_Core_0__Lean_Meta_Grind_addFactStep+0x519) [0x5645d8791009]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_add___lambda__2+0x273) [0x5645d8794aa3]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_add+0x1c2) [0x5645d8794fc2]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_addHypothesis+0x2a8) [0x5645d8795558]\n/app/repl/.lake/build/bin/repl(l_Lean_Loop_forIn_loop___at_Lean_Meta_Grind_intros___spec__1___lambda__6+0xa6) [0x5645d8dd8bf6]\n/app/repl/.lake/build/bin/repl(l_Lean_Loop_forIn_loop___at_Lean_Meta_Grind_intros___spec__1___lambda__6___boxed+0x2a) [0x5645d8dea48a]\n/app/repl/.lake/build/bin/repl(lean_apply_10+0x708) [0x5645dac9cfe8]\n/app/repl/.lake/build/bin/repl(l_ReaderT_bind___at_Lean_Meta_Grind_liftGoalM___spec__2___rarg+0x303) [0x5645d8c162b3]\n/app/repl/.lake/build/bin/repl(lean_apply_5+0xbe7) [0x5645dac95237]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Basic_0__Lean_Meta_withMVarContextImp___rarg+0x203) [0x5645d420ffe3]\n/app/repl/.lake/build/bin/repl(l_Lean_MVarId_withContext___at_Lean_Meta_Grind_withCurrGoalContext___spec__1___rarg+0x56) [0x5645d8c15ae6]\n/app/repl/.lake/build/bin/repl(l_Lean_Loop_forIn_loop___at_Lean_Meta_Grind_intros___spec__1___lambda__7+0x76dd) [0x5645d8de0a9d]\n/app/repl/.lake/build/bin/repl(l_Lean_Loop_forIn_loop___at_Lean_Meta_Grind_intros___spec__1+0x4d6) [0x5645d8dea996]\n/app/repl/.lake/build/bin/repl(lean_apply_9+0x6af) [0x5645dac9bb6f]\n/app/repl/.lake/build/bin/repl(l_ReaderT_bind___at_Lean_Meta_Grind_liftGoalM___spec__2___rarg+0x10b) [0x5645d8c160bb]\n/app/repl/.lake/build/bin/repl(lean_apply_5+0xbe7) [0x5645dac95237]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Basic_0__Lean_Meta_withMVarContextImp___rarg+0x203) [0x5645d420ffe3]\n/app/repl/.lake/build/bin/repl(l_Lean_MVarId_withContext___at_Lean_Meta_Grind_withCurrGoalContext___spec__1___rarg+0x56) [0x5645d8c15ae6]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_intros+0x196) [0x5645d8decf76]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_solve_loop+0x102) [0x5645d8c0f2b2]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_solve_main+0x108) [0x5645d8c131c8]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_solve___lambda__2+0x47) [0x5645d8c13f07]\n/app/repl/.lake/build/bin/repl(lean_apply_9+0x240) [0x5645dac9b700]\n/app/repl/.lake/build/bin/repl(l_ReaderT_bind___at_Lean_Meta_Grind_GoalM_run_x27___spec__1___rarg+0x2c8) [0x5645d83e2958]\n/app/repl/.lake/build/bin/repl(lean_apply_5+0xaeb) [0x5645dac9513b]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Basic_0__Lean_Meta_withMVarContextImp___rarg+0x203) [0x5645d420ffe3]\n/app/repl/.lake/build/bin/repl(l_Lean_MVarId_withContext___at_Lean_Meta_Grind_GoalM_run___spec__1___rarg+0x51) [0x5645d83e23c1]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_solve+0x125) [0x5645d8c14395]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_main___lambda__2+0x874) [0x5645d8bcc3a4]\n/app/repl/.lake/build/bin/repl(lean_apply_8+0x595) [0x5645dac9a495]\n/app/repl/.lake/build/bin/repl(l_ReaderT_bind___at_Lean_Meta_Grind_GoalM_run_x27___spec__1___rarg+0xf5) [0x5645d83e2785]\n/app/repl/.lake/build/bin/repl(lean_apply_8+0x595) [0x5645dac9a495]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_GrindM_run___rarg+0x409) [0x5645d8bb6f59]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_main___lambda__4+0xd5) [0x5645d8bd2925]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_main___lambda__5+0x186) [0x5645d8bd2ad6]\n/app/repl/.lake/build/bin/repl(lean_apply_1+0xe2f) [0x5645dac8c5af]\n/app/repl/.lake/build/bin/repl(l_Lean_profileitIOUnsafe___rarg___lambda__1+0xe) [0x5645d3fa8bee]\n/app/repl/.lake/build/bin/repl(l_Lean_profileitIOUnsafe___rarg___lambda__1___boxed+0x9) [0x5645d3fa8e79]\n/app/repl/.lake/build/bin/repl(lean_apply_1+0xb5f) [0x5645dac8c2df]\n/app/repl/.lake/build/bin/repl(lean_profileit+0x83) [0x5645d3b81563]\n/app/repl/.lake/build/bin/repl(l_Lean_profileitIOUnsafe___rarg+0x64) [0x5645d3fa8d54]\n/app/repl/.lake/build/bin/repl(l_Lean_Meta_Grind_main+0xab) [0x5645d8bd2eab]\n/app/repl/.lake/build/bin/repl(l_Lean_Elab_Tactic_grind___lambda__3+0x4b4) [0x5645d82c2874]\n/app/repl/.lake/build/bin/repl(l_Lean_Elab_Tactic_grind___lambda__3___boxed+0x7d) [0x5645d82c41ed]\n/app/repl/.lake/build/bin/repl(lean_apply_5+0xef8) [0x5645dac95548]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Basic_0__Lean_Meta_withMVarContextImp___rarg+0x203) [0x5645d420ffe3]\n/app/repl/.lake/build/bin/repl(l_Lean_MVarId_withContext___at_Lean_Elab_Tactic_withMainContext___spec__1___rarg+0x56) [0x5645d5716306]\n/app/repl/.lake/build/bin/repl(l_Lean_Elab_Tactic_evalGrindCore___lambda__1+0x350) [0x5645d82c7820]\n/app/repl/.lake/build/bin/repl(lean_apply_5+0xef8) [0x5645dac95548]\n/app/repl/.lake/build/bin/repl(l___private_Lean_Meta_Basic_0__Lean_Meta_withMVarContextImp___rarg+0x203) [0x5645d420ffe3]\n/app/repl/.lake/build/bin/repl(l_Lean_MVarId_withContext___at_Lean_Elab_Tactic_withMainContext___spec__1___rarg+0x56) [0x5645d5716306]\n/app/repl/.lake/build/bin/repl(l_Lean_Elab_Tactic_withMainContext___rarg+0x24d) [0x5645d571673d]\n/app/repl/.lake/build/bin/repl(l_Lean_Elab_Tactic_evalGrindCore+0x497) [0x5645d82c86f7]\n/app/repl/.lake/build/bin/repl(l_Lean_Elab_Tactic_evalGrind___lambda__1+0x29e) [0x5645d82e14ae]\n/app/repl/.lake/build/bin/repl(l_Lean_Elab_Tactic_evalGrind___lambda__2+0x1a4) [0x5645d82e1aa4]\n/app/repl/.lake/build/bin/repl(l_Lean_Elab_Tactic_evalGrind___lambda__3+0xd3) [0x5645d82e1dc3]"], "timeout_s": 600.0, "latency_s": 1.2488, "verified_at": "2026-03-26T18:16:24.578346+00:00"}} | false | true | false | 1.2488 |
compfiles_Imo1971P5 | compfiles | Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw, Benpigchu
-/
import Mathlib
/-!
# International Mathematical Olympiad 1971, Problem 5
Prove that for every natural number m there exists a nonempty finite
set S of points in the plane with the following property:
For every point s in S, there are exactly m points which are at a unit
distance from s.
-/
namespace Imo1971P5
open scoped EuclideanGeometry
abbrev Pt := EuclideanSpace ℝ (Fin 2)
lemma norm_one_infinity : {p : Pt | ‖p‖ = 1}.Infinite := by
suffices h : (Metric.sphere (0 : Pt) 1).Infinite by
convert h using 1; ext p; simp
apply IsPreconnected.infinite_of_nontrivial
· refine isPreconnected_sphere ?_ 0 1
rw [← Module.finrank_eq_rank (R := ℝ) (M := Pt), finrank_euclideanSpace_fin]
norm_num
· refine ⟨EuclideanSpace.single 0 1, by simp [PiLp.norm_single],
EuclideanSpace.single 1 1, by simp [PiLp.norm_single], ?_⟩
intro h
have : (EuclideanSpace.single 0 (1 : ℝ) : Pt) 1 = (EuclideanSpace.single 1 (1 : ℝ) : Pt) 1 :=
congr_arg (· 1) h
simp at this
universe u
lemma exists_three_of_infinite
{α : Type u} {s : Set α} (hs : s.Infinite)
: ∃ p q r : α, p ∈ s ∧ q ∈ s ∧ r ∈ s
∧ p ≠ q ∧ q ≠ r ∧ r ≠ p := by
obtain ⟨p, hp, q, hq, hpq⟩ := hs.nontrivial
obtain ⟨r, hr, hrpq⟩ := (hs.diff (Set.toFinite {p, q})).nonempty
simp only [Set.mem_insert_iff, Set.mem_singleton_iff, not_or] at hrpq
exact ⟨p, q, r, hp, hq, hr, hpq, fun h => hrpq.2 h.symm, fun h => hrpq.1 h⟩
lemma sphere_inter_finite
{s₁ s₂ : EuclideanGeometry.Sphere Pt} (hs : s₁ ≠ s₂) :
((s₁ : Set Pt) ∩ s₂).Finite := by
by_contra! h'
rcases exists_three_of_infinite h' with ⟨p, q, r, hp, hq, hr, hpq, hqr, hrp⟩
have hd : Module.finrank ℝ (EuclideanSpace ℝ (Fin 2)) = 2 := finrank_euclideanSpace_fin
rw [Set.mem_inter_iff, EuclideanGeometry.Sphere.mem_coe, EuclideanGeometry.Sphere.mem_coe] at hp hq hr
have h'' := EuclideanGeometry.eq_of_mem_sphere_of_mem_sphere_of_finrank_eq_two
hd hs hpq hp.left hq.left hr.left hp.right hq.right hr.right
grind only
lemma sphere_eq_sub_norm (o : Pt) (r : ℝ)
: {p : Pt | ‖p - o‖ = r} = (EuclideanGeometry.Sphere.mk o r : Set Pt) := by
ext p
rw [Set.mem_setOf_eq, mem_sphere_iff_norm]
lemma norm_one_inter_finite {s : Pt} (hs : s ≠ 0)
: ({p : Pt | ‖p - 0‖ = 1} ∩ {p : Pt | ‖p - s‖ = 1}).Finite := by
rw [sphere_eq_sub_norm 0 1, sphere_eq_sub_norm s 1]
apply sphere_inter_finite
rw [ne_eq, EuclideanGeometry.Sphere.ext_iff]
dsimp
rw [and_iff_left rfl, ← ne_eq]
symm
exact hs
lemma finite₁ {S : Set Pt} (hS : S.Finite)
: {p | ∃ s t, s ∈ S ∧ t ∈ S ∧ s - t = p}.Finite := by
have h' : {p | ∃ s t, s ∈ S ∧ t ∈ S ∧ s - t = p}
= ⋃ s ∈ S, ⋃ t ∈ S, {s - t} := by
ext p
simp
constructor <;> rintro ⟨s, hs, t, ht, hstp⟩ <;> use s <;> rw [and_iff_right hs]
<;> use t <;> rw [and_iff_right ht, hstp]
rw [h']
apply Set.Finite.biUnion hS
intro s hs
apply Set.Finite.biUnion hS
intro t ht
apply Set.finite_singleton
lemma finite₂ {S : Set Pt} (hS : S.Finite)
: {p : Pt | ∃ (s t : Pt), s ∈ S ∧ t ∈ S ∧ s ≠ t ∧ ‖p‖ = 1 ∧ dist s (t + p) = 1}.Finite := by
have h' : {p : Pt | ∃ (s t : Pt), s ∈ S ∧ t ∈ S ∧ s ≠ t ∧ ‖p‖ = 1 ∧ dist s (t + p) = 1}
= ⋃ s ∈ S, ⋃ t ∈ S, {p : Pt | s ≠ t ∧ ‖p‖ = 1 ∧ dist s (t + p) = 1} := by
ext p
simp
constructor <;> rintro ⟨s, hs, t, ht, hstp⟩ <;> use s <;> rw [and_iff_right hs]
<;> use t <;> rw [and_iff_right ht] <;> grind only
rw [h']
apply Set.Finite.biUnion hS
intro s hs
apply Set.Finite.biUnion hS
intro t ht
by_cases! hst : s = t
· have h'' : {p | s ≠ t ∧ ‖p‖ = 1 ∧ dist s (t + p) = 1} = ∅ := by
rw [Set.eq_empty_iff_forall_notMem]
intro p
contrapose! hst
dsimp at hst
exact hst.left
rw [h'']
exact Set.finite_empty
· have h'' : {p | s ≠ t ∧ ‖p‖ = 1 ∧ dist s (t + p) = 1}
= {p : Pt | ‖p - 0‖ = 1} ∩ {p : Pt | ‖p - (s - t)‖ = 1} := by
ext p
simp [- ne_eq]
rw [and_iff_right hst]
constructor <;> rintro ⟨hp₁, hp₂⟩ <;> rw [and_iff_right hp₁, ← hp₂]
<;> rw [← sub_add, dist_comm, dist_eq_norm] <;> abel_nf
rw [h'']
rw [← sub_eq_zero.ne] at hst
exact norm_one_inter_finite hst
theorem imo1971_p5 (m : ℕ) :
∃ S : Set Pt, S.Nonempty ∧ S.Finite ∧
∀ s ∈ S, {t ∈ S | dist s t = 1}.encard = m := by
induction' m with m h
· exact ⟨{0}, Set.singleton_nonempty _, Set.finite_singleton _, fun s hs => by
rw [Nat.cast_zero, Set.encard_eq_zero, Set.eq_empty_iff_forall_notMem]
rintro t ⟨ht, hst⟩
rw [Set.mem_singleton_iff] at hs ht
rw [hs, ht, dist_self] at hst; norm_num at hst⟩
· rcases h with ⟨S', hS'₁, hS'₂, hS'₃⟩
-- Pick d on the unit circle avoiding finitely many bad values
have hd_set := (norm_one_infinity.diff ((finite₁ hS'₂).union (finite₂ hS'₂))).nonempty
rw [← Set.diff_diff] at hd_set
obtain ⟨d, ⟨hd₁, hd₂⟩, hd₃⟩ := hd_set
dsimp at hd₁ hd₂ hd₃; push_neg at hd₂ hd₃
-- Define translated set S'' = S' + d
set f := fun p ↦ p + d with hf
set S'' := {p : Pt | ∃ p' ∈ S', p = p' + d} with hS''
have h'S'' : S'' = f '' S' := by
ext p; rw [Set.mem_image, hS'']; simp only [Set.mem_setOf_eq, hf]
constructor <;> rintro ⟨p', hp'₁, hp'₂⟩ <;> exact ⟨p', hp'₁, hp'₂.symm⟩
have hS''₁ : S''.Nonempty := by rw [h'S'', Set.image_nonempty]; exact hS'₁
have hS''₂ : S''.Finite := by rw [h'S'']; exact hS'₂.image _
have hf' : Function.Injective f := add_left_injective d
have hf'' : ∀ s ∈ S', {t | t ∈ f '' S' ∧ dist (f s) t = 1} =
f '' {t | t ∈ S' ∧ dist s t = 1} := by
intro s hs; ext t; simp only [Set.mem_setOf_eq, Set.mem_image, hf]
constructor
· rintro ⟨⟨t', ht', rfl⟩, hst⟩
exact ⟨t', ⟨ht', by rwa [dist_add_right] at hst⟩, rfl⟩
· rintro ⟨t', ⟨ht', hst⟩, rfl⟩
exact ⟨⟨t', ht', rfl⟩, by rw [dist_add_right]; exact hst⟩
have hS''₃ : ∀ s ∈ S'', {t | t ∈ S'' ∧ dist s t = 1}.encard = ↑m := by
intro s hs; rw [h'S''] at hs ⊢
obtain ⟨s', hs'S', rfl⟩ := hs
rw [← hS'₃ s' hs'S', hf'' s' hs'S', hf'.encard_image]
clear hf' hf'' h'S''
use S' ∪ S''
refine ⟨Set.union_nonempty.mpr (Or.inl hS'₁), hS'₂.union hS''₂, ?_⟩
intro s hs
wlog hsS' : s ∈ S' generalizing S' d
· have hsS'' : s ∈ S'' := (Set.mem_union _ _ _).mp hs |>.resolve_left hsS'
have hd'₁ : ‖-d‖ = 1 := by rw [norm_neg]; exact hd₁
have hd'₂ : ∀ (s t : Pt), s ∈ S'' → t ∈ S'' → s - t ≠ -d := by
intro s t hs ht
rcases hs with ⟨s', hs', hss'd⟩
rcases ht with ⟨t', ht', htt'd⟩
rw [hss'd, htt'd, ← neg_eq_iff_eq_neg.ne, (by abel : -(s' + d - (t' + d)) = t' - s')]
exact hd₂ t' s' ht' hs'
have hd'₃ : ∀ (s t : Pt), s ∈ S'' → t ∈ S'' → s ≠ t → ‖-d‖ = 1 →
dist s (t + -d) ≠ 1 := by
intro s t hs ht hst hd
rw [hS''] at hs ht
rcases hs with ⟨s', hs', hss'd⟩
rcases ht with ⟨t', ht', htt'd⟩
rw [hss'd, htt'd, ← sub_eq_add_neg, add_sub_cancel_right, dist_comm]
rw [hss'd, htt'd, add_right_cancel_iff.ne] at hst
exact hd₃ t' s' ht' hs' hst.symm hd₁
have hS'''_eq_S' : {p | ∃ p' ∈ S'', p = p' + -d} = S' := by
rw [hS'']; ext p; constructor
· rintro ⟨p', ⟨p'', hp''S', hp''⟩, hp'⟩
rw [hp', hp'', ← sub_eq_add_neg, add_sub_cancel_right]; exact hp''S'
· intro hp
exact ⟨p + d, ⟨p, hp, rfl⟩, by rw [← sub_eq_add_neg, add_sub_cancel_right]⟩
rw [← hS'''_eq_S'] at hS'₁ hS'₂ hS'₃ hs
rw [Set.union_comm] at hs
have h := this S'' hS''₁ hS''₂ hS''₃ (-d)
hd'₁ hd'₂ hd'₃ rfl rfl hS'₁ hS'₂ hS'₃ hs hsS''
rw [hS'''_eq_S', Set.union_comm] at h
exact h
-- Main case: s ∈ S'
have heq : {t | t ∈ S' ∪ S'' ∧ dist s t = 1} = {t | t ∈ S' ∧ dist s t = 1} ∪ {s + d} := by
ext t; rw [Set.mem_union, Set.mem_singleton_iff]
constructor
· rintro ⟨ht, hts⟩
rcases Set.mem_union _ _ _ |>.mp ht with htS' | htS''
· exact Or.inl ⟨htS', hts⟩
· right; rcases htS'' with ⟨s', hs'S', hts'd⟩
by_cases hss' : s = s'
· rw [hts'd, hss']
· exact absurd hts (by rw [hts'd]; exact hd₃ s s' hsS' hs'S' hss' hd₁)
· rintro (⟨htS', hts⟩ | rfl)
· exact ⟨Set.mem_union_left _ htS', hts⟩
· exact ⟨Set.mem_union_right _ ⟨s, hsS', rfl⟩,
by rw [dist_eq_norm', add_sub_cancel_left, hd₁]⟩
rw [heq]
have h_disj : Disjoint {t | t ∈ S' ∧ dist s t = 1} {s + d} := by
rw [Set.disjoint_singleton_right]
rintro ⟨hsd⟩
exact hd₂ (s + d) s hsd hsS' (by rw [add_sub_cancel_left])
rw [Set.encard_union_eq h_disj, Set.encard_singleton, hS'₃ s hsS', Nat.cast_add, Nat.cast_one]
end Imo1971P5 | /- | /-
Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw, Benpigchu
-/
import Mathlib
/-!
# International Mathematical Olympiad 1971, Problem 5
Prove that for every natural number m there exists a nonempty finite
set S of points in the plane with the following property:
For every point s in S, there are exactly m points which are at a unit
distance from s.
-/
namespace Imo1971P5
open scoped EuclideanGeometry
abbrev Pt := EuclideanSpace ℝ (Fin 2)
lemma norm_one_infinity : {p : Pt | ‖p‖ = 1}.Infinite := by
suffices h : (Metric.sphere (0 : Pt) 1).Infinite by
convert h using 1; ext p; simp
apply IsPreconnected.infinite_of_nontrivial
· refine isPreconnected_sphere ?_ 0 1
rw [← Module.finrank_eq_rank (R := ℝ) (M := Pt), finrank_euclideanSpace_fin]
norm_num
· refine ⟨EuclideanSpace.single 0 1, by simp [PiLp.norm_single],
EuclideanSpace.single 1 1, by simp [PiLp.norm_single], ?_⟩
intro h
have : (EuclideanSpace.single 0 (1 : ℝ) : Pt) 1 = (EuclideanSpace.single 1 (1 : ℝ) : Pt) 1 :=
congr_arg (· 1) h
simp at this
universe u
lemma exists_three_of_infinite
{α : Type u} {s : Set α} (hs : s.Infinite)
: ∃ p q r : α, p ∈ s ∧ q ∈ s ∧ r ∈ s
∧ p ≠ q ∧ q ≠ r ∧ r ≠ p := by
obtain ⟨p, hp, q, hq, hpq⟩ := hs.nontrivial
obtain ⟨r, hr, hrpq⟩ := (hs.diff (Set.toFinite {p, q})).nonempty
simp only [Set.mem_insert_iff, Set.mem_singleton_iff, not_or] at hrpq
exact ⟨p, q, r, hp, hq, hr, hpq, fun h => hrpq.2 h.symm, fun h => hrpq.1 h⟩
lemma sphere_inter_finite
{s₁ s₂ : EuclideanGeometry.Sphere Pt} (hs : s₁ ≠ s₂) :
((s₁ : Set Pt) ∩ s₂).Finite := by
by_contra! h'
rcases exists_three_of_infinite h' with ⟨p, q, r, hp, hq, hr, hpq, hqr, hrp⟩
have hd : Module.finrank ℝ (EuclideanSpace ℝ (Fin 2)) = 2 := finrank_euclideanSpace_fin
rw [Set.mem_inter_iff, EuclideanGeometry.Sphere.mem_coe, EuclideanGeometry.Sphere.mem_coe] at hp hq hr
have h'' := EuclideanGeometry.eq_of_mem_sphere_of_mem_sphere_of_finrank_eq_two
hd hs hpq hp.left hq.left hr.left hp.right hq.right hr.right
grind only
lemma sphere_eq_sub_norm (o : Pt) (r : ℝ)
: {p : Pt | ‖p - o‖ = r} = (EuclideanGeometry.Sphere.mk o r : Set Pt) := by
ext p
rw [Set.mem_setOf_eq, mem_sphere_iff_norm]
lemma norm_one_inter_finite {s : Pt} (hs : s ≠ 0)
: ({p : Pt | ‖p - 0‖ = 1} ∩ {p : Pt | ‖p - s‖ = 1}).Finite := by
rw [sphere_eq_sub_norm 0 1, sphere_eq_sub_norm s 1]
apply sphere_inter_finite
rw [ne_eq, EuclideanGeometry.Sphere.ext_iff]
dsimp
rw [and_iff_left rfl, ← ne_eq]
symm
exact hs
lemma finite₁ {S : Set Pt} (hS : S.Finite)
: {p | ∃ s t, s ∈ S ∧ t ∈ S ∧ s - t = p}.Finite := by
have h' : {p | ∃ s t, s ∈ S ∧ t ∈ S ∧ s - t = p}
= ⋃ s ∈ S, ⋃ t ∈ S, {s - t} := by
ext p
simp
constructor <;> rintro ⟨s, hs, t, ht, hstp⟩ <;> use s <;> rw [and_iff_right hs]
<;> use t <;> rw [and_iff_right ht, hstp]
rw [h']
apply Set.Finite.biUnion hS
intro s hs
apply Set.Finite.biUnion hS
intro t ht
apply Set.finite_singleton
lemma finite₂ {S : Set Pt} (hS : S.Finite)
: {p : Pt | ∃ (s t : Pt), s ∈ S ∧ t ∈ S ∧ s ≠ t ∧ ‖p‖ = 1 ∧ dist s (t + p) = 1}.Finite := by
have h' : {p : Pt | ∃ (s t : Pt), s ∈ S ∧ t ∈ S ∧ s ≠ t ∧ ‖p‖ = 1 ∧ dist s (t + p) = 1}
= ⋃ s ∈ S, ⋃ t ∈ S, {p : Pt | s ≠ t ∧ ‖p‖ = 1 ∧ dist s (t + p) = 1} := by
ext p
simp
constructor <;> rintro ⟨s, hs, t, ht, hstp⟩ <;> use s <;> rw [and_iff_right hs]
<;> use t <;> rw [and_iff_right ht] <;> grind only
rw [h']
apply Set.Finite.biUnion hS
intro s hs
apply Set.Finite.biUnion hS
intro t ht
by_cases! hst : s = t
· have h'' : {p | s ≠ t ∧ ‖p‖ = 1 ∧ dist s (t + p) = 1} = ∅ := by
rw [Set.eq_empty_iff_forall_notMem]
intro p
contrapose! hst
dsimp at hst
exact hst.left
rw [h'']
exact Set.finite_empty
· have h'' : {p | s ≠ t ∧ ‖p‖ = 1 ∧ dist s (t + p) = 1}
= {p : Pt | ‖p - 0‖ = 1} ∩ {p : Pt | ‖p - (s - t)‖ = 1} := by
ext p
simp [- ne_eq]
rw [and_iff_right hst]
constructor <;> rintro ⟨hp₁, hp₂⟩ <;> rw [and_iff_right hp₁, ← hp₂]
<;> rw [← sub_add, dist_comm, dist_eq_norm] <;> abel_nf
rw [h'']
rw [← sub_eq_zero.ne] at hst
exact norm_one_inter_finite hst
theorem imo1971_p5 (m : ℕ) :
∃ S : Set Pt, S.Nonempty ∧ S.Finite ∧
∀ s ∈ S, {t ∈ S | dist s t = 1}.encard = m := by
induction' m with m h
· exact ⟨{0}, Set.singleton_nonempty _, Set.finite_singleton _, fun s hs => by
rw [Nat.cast_zero, Set.encard_eq_zero, Set.eq_empty_iff_forall_notMem]
rintro t ⟨ht, hst⟩
rw [Set.mem_singleton_iff] at hs ht
rw [hs, ht, dist_self] at hst; norm_num at hst⟩
· rcases h with ⟨S', hS'₁, hS'₂, hS'₃⟩
-- Pick d on the unit circle avoiding finitely many bad values
have hd_set := (norm_one_infinity.diff ((finite₁ hS'₂).union (finite₂ hS'₂))).nonempty
rw [← Set.diff_diff] at hd_set
obtain ⟨d, ⟨hd₁, hd₂⟩, hd₃⟩ := hd_set
dsimp at hd₁ hd₂ hd₃; push_neg at hd₂ hd₃
-- Define translated set S'' = S' + d
set f := fun p ↦ p + d with hf
set S'' := {p : Pt | ∃ p' ∈ S', p = p' + d} with hS''
have h'S'' : S'' = f '' S' := by
ext p; rw [Set.mem_image, hS'']; simp only [Set.mem_setOf_eq, hf]
constructor <;> rintro ⟨p', hp'₁, hp'₂⟩ <;> exact ⟨p', hp'₁, hp'₂.symm⟩
have hS''₁ : S''.Nonempty := by rw [h'S'', Set.image_nonempty]; exact hS'₁
have hS''₂ : S''.Finite := by rw [h'S'']; exact hS'₂.image _
have hf' : Function.Injective f := add_left_injective d
have hf'' : ∀ s ∈ S', {t | t ∈ f '' S' ∧ dist (f s) t = 1} =
f '' {t | t ∈ S' ∧ dist s t = 1} := by
intro s hs; ext t; simp only [Set.mem_setOf_eq, Set.mem_image, hf]
constructor
· rintro ⟨⟨t', ht', rfl⟩, hst⟩
exact ⟨t', ⟨ht', by rwa [dist_add_right] at hst⟩, rfl⟩
· rintro ⟨t', ⟨ht', hst⟩, rfl⟩
exact ⟨⟨t', ht', rfl⟩, by rw [dist_add_right]; exact hst⟩
have hS''₃ : ∀ s ∈ S'', {t | t ∈ S'' ∧ dist s t = 1}.encard = ↑m := by
intro s hs; rw [h'S''] at hs ⊢
obtain ⟨s', hs'S', rfl⟩ := hs
rw [← hS'₃ s' hs'S', hf'' s' hs'S', hf'.encard_image]
clear hf' hf'' h'S''
use S' ∪ S''
refine ⟨Set.union_nonempty.mpr (Or.inl hS'₁), hS'₂.union hS''₂, ?_⟩
intro s hs
wlog hsS' : s ∈ S' generalizing S' d
· have hsS'' : s ∈ S'' := (Set.mem_union _ _ _).mp hs |>.resolve_left hsS'
have hd'₁ : ‖-d‖ = 1 := by rw [norm_neg]; exact hd₁
have hd'₂ : ∀ (s t : Pt), s ∈ S'' → t ∈ S'' → s - t ≠ -d := by
intro s t hs ht
rcases hs with ⟨s', hs', hss'd⟩
rcases ht with ⟨t', ht', htt'd⟩
rw [hss'd, htt'd, ← neg_eq_iff_eq_neg.ne, (by abel : -(s' + d - (t' + d)) = t' - s')]
exact hd₂ t' s' ht' hs'
have hd'₃ : ∀ (s t : Pt), s ∈ S'' → t ∈ S'' → s ≠ t → ‖-d‖ = 1 →
dist s (t + -d) ≠ 1 := by
intro s t hs ht hst hd
rw [hS''] at hs ht
rcases hs with ⟨s', hs', hss'd⟩
rcases ht with ⟨t', ht', htt'd⟩
rw [hss'd, htt'd, ← sub_eq_add_neg, add_sub_cancel_right, dist_comm]
rw [hss'd, htt'd, add_right_cancel_iff.ne] at hst
exact hd₃ t' s' ht' hs' hst.symm hd₁
have hS'''_eq_S' : {p | ∃ p' ∈ S'', p = p' + -d} = S' := by
rw [hS'']; ext p; constructor
· rintro ⟨p', ⟨p'', hp''S', hp''⟩, hp'⟩
rw [hp', hp'', ← sub_eq_add_neg, add_sub_cancel_right]; exact hp''S'
· intro hp
exact ⟨p + d, ⟨p, hp, rfl⟩, by rw [← sub_eq_add_neg, add_sub_cancel_right]⟩
rw [← hS'''_eq_S'] at hS'₁ hS'₂ hS'₃ hs
rw [Set.union_comm] at hs
have h := this S'' hS''₁ hS''₂ hS''₃ (-d)
hd'₁ hd'₂ hd'₃ rfl rfl hS'₁ hS'₂ hS'₃ hs hsS''
rw [hS'''_eq_S', Set.union_comm] at h
exact h
-- Main case: s ∈ S'
have heq : {t | t ∈ S' ∪ S'' ∧ dist s t = 1} = {t | t ∈ S' ∧ dist s t = 1} ∪ {s + d} := by
ext t; rw [Set.mem_union, Set.mem_singleton_iff]
constructor
· rintro ⟨ht, hts⟩
rcases Set.mem_union _ _ _ |>.mp ht with htS' | htS''
· exact Or.inl ⟨htS', hts⟩
· right; rcases htS'' with ⟨s', hs'S', hts'd⟩
by_cases hss' : s = s'
· rw [hts'd, hss']
· exact absurd hts (by rw [hts'd]; exact hd₃ s s' hsS' hs'S' hss' hd₁)
· rintro (⟨htS', hts⟩ | rfl)
· exact ⟨Set.mem_union_left _ htS', hts⟩
· exact ⟨Set.mem_union_right _ ⟨s, hsS', rfl⟩,
by rw [dist_eq_norm', add_sub_cancel_left, hd₁]⟩
rw [heq]
have h_disj : Disjoint {t | t ∈ S' ∧ dist s t = 1} {s + d} := by
rw [Set.disjoint_singleton_right]
rintro ⟨hsd⟩
exact hd₂ (s + d) s hsd hsS' (by rw [add_sub_cancel_left])
rw [Set.encard_union_eq h_disj, Set.encard_singleton, hS'₃ s hsS', Nat.cast_add, Nat.cast_one]
end Imo1971P5
| true | Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw, Benpigchu
-/
import Mathlib
/-!
# International Mathematical Olympiad 1971, Problem 5
Prove that for every natural number m there exists a nonempty finite
set S of points in the plane with the following property:
For every point s in S, there are exactly m points which are at a unit
distance from s.
-/
namespace Imo1971P5
open scoped EuclideanGeometry
abbrev Pt := EuclideanSpace ℝ (Fin 2)
lemma norm_one_infinity : {p : Pt | ‖p‖ = 1}.Infinite := by
suffices h : (Metric.sphere (0 : Pt) 1).Infinite by
convert h using 1; ext p; simp
apply IsPreconnected.infinite_of_nontrivial
· refine isPreconnected_sphere ?_ 0 1
rw [← Module.finrank_eq_rank (R := ℝ) (M := Pt), finrank_euclideanSpace_fin]
norm_num
· refine ⟨EuclideanSpace.single 0 1, by simp [PiLp.norm_single],
EuclideanSpace.single 1 1, by simp [PiLp.norm_single], ?_⟩
intro h
have : (EuclideanSpace.single 0 (1 : ℝ) : Pt) 1 = (EuclideanSpace.single 1 (1 : ℝ) : Pt) 1 :=
congr_arg (· 1) h
simp at this
universe u
lemma exists_three_of_infinite
{α : Type u} {s : Set α} (hs : s.Infinite)
: ∃ p q r : α, p ∈ s ∧ q ∈ s ∧ r ∈ s
∧ p ≠ q ∧ q ≠ r ∧ r ≠ p := by
obtain ⟨p, hp, q, hq, hpq⟩ := hs.nontrivial
obtain ⟨r, hr, hrpq⟩ := (hs.diff (Set.toFinite {p, q})).nonempty
simp only [Set.mem_insert_iff, Set.mem_singleton_iff, not_or] at hrpq
exact ⟨p, q, r, hp, hq, hr, hpq, fun h => hrpq.2 h.symm, fun h => hrpq.1 h⟩
lemma sphere_inter_finite
{s₁ s₂ : EuclideanGeometry.Sphere Pt} (hs : s₁ ≠ s₂) :
((s₁ : Set Pt) ∩ s₂).Finite := by
by_contra! h'
rcases exists_three_of_infinite h' with ⟨p, q, r, hp, hq, hr, hpq, hqr, hrp⟩
have hd : Module.finrank ℝ (EuclideanSpace ℝ (Fin 2)) = 2 := finrank_euclideanSpace_fin
rw [Set.mem_inter_iff, EuclideanGeometry.Sphere.mem_coe, EuclideanGeometry.Sphere.mem_coe] at hp hq hr
have h'' := EuclideanGeometry.eq_of_mem_sphere_of_mem_sphere_of_finrank_eq_two
hd hs hpq hp.left hq.left hr.left hp.right hq.right hr.right
grind only
lemma sphere_eq_sub_norm (o : Pt) (r : ℝ)
: {p : Pt | ‖p - o‖ = r} = (EuclideanGeometry.Sphere.mk o r : Set Pt) := by
ext p
rw [Set.mem_setOf_eq, mem_sphere_iff_norm]
lemma norm_one_inter_finite {s : Pt} (hs : s ≠ 0)
: ({p : Pt | ‖p - 0‖ = 1} ∩ {p : Pt | ‖p - s‖ = 1}).Finite := by
rw [sphere_eq_sub_norm 0 1, sphere_eq_sub_norm s 1]
apply sphere_inter_finite
rw [ne_eq, EuclideanGeometry.Sphere.ext_iff]
dsimp
rw [and_iff_left rfl, ← ne_eq]
symm
exact hs
lemma finite₁ {S : Set Pt} (hS : S.Finite)
: {p | ∃ s t, s ∈ S ∧ t ∈ S ∧ s - t = p}.Finite := by
have h' : {p | ∃ s t, s ∈ S ∧ t ∈ S ∧ s - t = p}
= ⋃ s ∈ S, ⋃ t ∈ S, {s - t} := by
ext p
simp
constructor <;> rintro ⟨s, hs, t, ht, hstp⟩ <;> use s <;> rw [and_iff_right hs]
<;> use t <;> rw [and_iff_right ht, hstp]
rw [h']
apply Set.Finite.biUnion hS
intro s hs
apply Set.Finite.biUnion hS
intro t ht
apply Set.finite_singleton
lemma finite₂ {S : Set Pt} (hS : S.Finite)
: {p : Pt | ∃ (s t : Pt), s ∈ S ∧ t ∈ S ∧ s ≠ t ∧ ‖p‖ = 1 ∧ dist s (t + p) = 1}.Finite := by
have h' : {p : Pt | ∃ (s t : Pt), s ∈ S ∧ t ∈ S ∧ s ≠ t ∧ ‖p‖ = 1 ∧ dist s (t + p) = 1}
= ⋃ s ∈ S, ⋃ t ∈ S, {p : Pt | s ≠ t ∧ ‖p‖ = 1 ∧ dist s (t + p) = 1} := by
ext p
simp
constructor <;> rintro ⟨s, hs, t, ht, hstp⟩ <;> use s <;> rw [and_iff_right hs]
<;> use t <;> rw [and_iff_right ht] <;> grind only
rw [h']
apply Set.Finite.biUnion hS
intro s hs
apply Set.Finite.biUnion hS
intro t ht
by_cases! hst : s = t
· have h'' : {p | s ≠ t ∧ ‖p‖ = 1 ∧ dist s (t + p) = 1} = ∅ := by
rw [Set.eq_empty_iff_forall_notMem]
intro p
contrapose! hst
dsimp at hst
exact hst.left
rw [h'']
exact Set.finite_empty
· have h'' : {p | s ≠ t ∧ ‖p‖ = 1 ∧ dist s (t + p) = 1}
= {p : Pt | ‖p - 0‖ = 1} ∩ {p : Pt | ‖p - (s - t)‖ = 1} := by
ext p
simp [- ne_eq]
rw [and_iff_right hst]
constructor <;> rintro ⟨hp₁, hp₂⟩ <;> rw [and_iff_right hp₁, ← hp₂]
<;> rw [← sub_add, dist_comm, dist_eq_norm] <;> abel_nf
rw [h'']
rw [← sub_eq_zero.ne] at hst
exact norm_one_inter_finite hst
theorem imo1971_p5 (m : ℕ) :
∃ S : Set Pt, S.Nonempty ∧ S.Finite ∧
∀ s ∈ S, {t ∈ S | dist s t = 1}.encard = m := by
induction' m with m h
· exact ⟨{0}, Set.singleton_nonempty _, Set.finite_singleton _, fun s hs => by
rw [Nat.cast_zero, Set.encard_eq_zero, Set.eq_empty_iff_forall_notMem]
rintro t ⟨ht, hst⟩
rw [Set.mem_singleton_iff] at hs ht
rw [hs, ht, dist_self] at hst; norm_num at hst⟩
· rcases h with ⟨S', hS'₁, hS'₂, hS'₃⟩
-- Pick d on the unit circle avoiding finitely many bad values
have hd_set := (norm_one_infinity.diff ((finite₁ hS'₂).union (finite₂ hS'₂))).nonempty
rw [← Set.diff_diff] at hd_set
obtain ⟨d, ⟨hd₁, hd₂⟩, hd₃⟩ := hd_set
dsimp at hd₁ hd₂ hd₃; push_neg at hd₂ hd₃
-- Define translated set S'' = S' + d
set f := fun p ↦ p + d with hf
set S'' := {p : Pt | ∃ p' ∈ S', p = p' + d} with hS''
have h'S'' : S'' = f '' S' := by
ext p; rw [Set.mem_image, hS'']; simp only [Set.mem_setOf_eq, hf]
constructor <;> rintro ⟨p', hp'₁, hp'₂⟩ <;> exact ⟨p', hp'₁, hp'₂.symm⟩
have hS''₁ : S''.Nonempty := by rw [h'S'', Set.image_nonempty]; exact hS'₁
have hS''₂ : S''.Finite := by rw [h'S'']; exact hS'₂.image _
have hf' : Function.Injective f := add_left_injective d
have hf'' : ∀ s ∈ S', {t | t ∈ f '' S' ∧ dist (f s) t = 1} =
f '' {t | t ∈ S' ∧ dist s t = 1} := by
intro s hs; ext t; simp only [Set.mem_setOf_eq, Set.mem_image, hf]
constructor
· rintro ⟨⟨t', ht', rfl⟩, hst⟩
exact ⟨t', ⟨ht', by rwa [dist_add_right] at hst⟩, rfl⟩
· rintro ⟨t', ⟨ht', hst⟩, rfl⟩
exact ⟨⟨t', ht', rfl⟩, by rw [dist_add_right]; exact hst⟩
have hS''₃ : ∀ s ∈ S'', {t | t ∈ S'' ∧ dist s t = 1}.encard = ↑m := by
intro s hs; rw [h'S''] at hs ⊢
obtain ⟨s', hs'S', rfl⟩ := hs
rw [← hS'₃ s' hs'S', hf'' s' hs'S', hf'.encard_image]
clear hf' hf'' h'S''
use S' ∪ S''
refine ⟨Set.union_nonempty.mpr (Or.inl hS'₁), hS'₂.union hS''₂, ?_⟩
intro s hs
wlog hsS' : s ∈ S' generalizing S' d
· have hsS'' : s ∈ S'' := (Set.mem_union _ _ _).mp hs |>.resolve_left hsS'
have hd'₁ : ‖-d‖ = 1 := by rw [norm_neg]; exact hd₁
have hd'₂ : ∀ (s t : Pt), s ∈ S'' → t ∈ S'' → s - t ≠ -d := by
intro s t hs ht
rcases hs with ⟨s', hs', hss'd⟩
rcases ht with ⟨t', ht', htt'd⟩
rw [hss'd, htt'd, ← neg_eq_iff_eq_neg.ne, (by abel : -(s' + d - (t' + d)) = t' - s')]
exact hd₂ t' s' ht' hs'
have hd'₃ : ∀ (s t : Pt), s ∈ S'' → t ∈ S'' → s ≠ t → ‖-d‖ = 1 →
dist s (t + -d) ≠ 1 := by
intro s t hs ht hst hd
rw [hS''] at hs ht
rcases hs with ⟨s', hs', hss'd⟩
rcases ht with ⟨t', ht', htt'd⟩
rw [hss'd, htt'd, ← sub_eq_add_neg, add_sub_cancel_right, dist_comm]
rw [hss'd, htt'd, add_right_cancel_iff.ne] at hst
exact hd₃ t' s' ht' hs' hst.symm hd₁
have hS'''_eq_S' : {p | ∃ p' ∈ S'', p = p' + -d} = S' := by
rw [hS'']; ext p; constructor
· rintro ⟨p', ⟨p'', hp''S', hp''⟩, hp'⟩
rw [hp', hp'', ← sub_eq_add_neg, add_sub_cancel_right]; exact hp''S'
· intro hp
exact ⟨p + d, ⟨p, hp, rfl⟩, by rw [← sub_eq_add_neg, add_sub_cancel_right]⟩
rw [← hS'''_eq_S'] at hS'₁ hS'₂ hS'₃ hs
rw [Set.union_comm] at hs
have h := this S'' hS''₁ hS''₂ hS''₃ (-d)
hd'₁ hd'₂ hd'₃ rfl rfl hS'₁ hS'₂ hS'₃ hs hsS''
rw [hS'''_eq_S', Set.union_comm] at h
exact h
-- Main case: s ∈ S'
have heq : {t | t ∈ S' ∪ S'' ∧ dist s t = 1} = {t | t ∈ S' ∧ dist s t = 1} ∪ {s + d} := by
ext t; rw [Set.mem_union, Set.mem_singleton_iff]
constructor
· rintro ⟨ht, hts⟩
rcases Set.mem_union _ _ _ |>.mp ht with htS' | htS''
· exact Or.inl ⟨htS', hts⟩
· right; rcases htS'' with ⟨s', hs'S', hts'd⟩
by_cases hss' : s = s'
· rw [hts'd, hss']
· exact absurd hts (by rw [hts'd]; exact hd₃ s s' hsS' hs'S' hss' hd₁)
· rintro (⟨htS', hts⟩ | rfl)
· exact ⟨Set.mem_union_left _ htS', hts⟩
· exact ⟨Set.mem_union_right _ ⟨s, hsS', rfl⟩,
by rw [dist_eq_norm', add_sub_cancel_left, hd₁]⟩
rw [heq]
have h_disj : Disjoint {t | t ∈ S' ∧ dist s t = 1} {s + d} := by
rw [Set.disjoint_singleton_right]
rintro ⟨hsd⟩
exact hd₂ (s + d) s hsd hsS' (by rw [add_sub_cancel_left])
rw [Set.encard_union_eq h_disj, Set.encard_singleton, hS'₃ s hsS', Nat.cast_add, Nat.cast_one]
end Imo1971P5 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1971P5.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown constant 'PiLp.norm_single'", "unknown constant 'PiLp.norm_single'", "unknown tactic", "unsolved goals\nS : Set Pt\nhS : S.Finite\nh' :\n {p | \u2203 s t, s \u2208 S \u2227 t \u2208 S \u2227 s \u2260 t \u2227 \u2016p\u2016 = 1 \u2227 dist s (t + p) = 1} =\n \u22c3 s \u2208 S, \u22c3 t \u2208 S, {p | s \u2260 t \u2227 \u2016p\u2016 = 1 \u2227 dist s (t + p) = 1}\ns : Pt\nhs : s \u2208 S\nt : Pt\nht : t \u2208 S\n\u22a2 {p | s \u2260 t \u2227 \u2016p\u2016 = 1 \u2227 dist s (t + p) = 1}.Finite"], "timeout_s": 600.0, "latency_s": 3.3947, "verified_at": "2026-03-26T18:16:26.766152+00:00"}} | false | true | false | 3.3947 |
compfiles_Imo1971P6 | compfiles | Copyright (c) 2026 lean-tom. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: lean-tom (with assistance from Gemini)
-/
import Mathlib
/-!
# International Mathematical Olympiad 1971, Problem 6
Let $A = (a_{ij})$ be an $n \times n$ matrix with non-negative integer entries.
Suppose that for all $i, j$, if $a_{ij} = 0$, then the sum of the elements in the
$i$-th row plus the sum of the elements in the $j$-th column is at least $n$.
Prove that the sum of all elements in the matrix is at least $n^2 / 2$.
-/
namespace Imo1971P6
open BigOperators Matrix
variable {n : ℕ} (A : Matrix (Fin n) (Fin n) ℕ)
-- Definitions of row sum, column sum, and total sum
def rowSum (i : Fin n) : ℕ := ∑ j, A i j
def colSum (j : Fin n) : ℕ := ∑ i, Aᵀ j i
def totalSum : ℕ := ∑ i, ∑ j, A i j
-- Basic lemmas connecting total sum to row/col sums
lemma totalSum_eq_rowSum_sum : totalSum A = ∑ i, rowSum A i := rfl
lemma totalSum_eq_colSum_sum : totalSum A = ∑ j, colSum A j := Finset.sum_comm
theorem totalSum_transpose_eq : totalSum A = totalSum Aᵀ := by
simp [totalSum, Matrix.transpose]
exact Finset.sum_comm
/-- Auxiliary lemma: The inequality holds if there exists a row with sum `x`
such that `x` is less than or equal to all row sums and column sums. -/
lemma aux {n : ℕ} (A : Matrix (Fin n) (Fin n) ℕ) (n_pos : 0 < n)
(h_cond : ∀ i j : Fin n, A i j = 0 → rowSum A i + colSum A j ≥ n)
(x : ℕ)
(h_min_row : ∀ i, x ≤ rowSum A i)
(h_min_col : ∀ j, x ≤ colSum A j)
(h_exists_row : ∃ i, rowSum A i = x) :
2 * totalSum A ≥ n^2 := by
obtain ⟨i₀, h_xi0⟩ := h_exists_row
by_cases h_x_large : n ≤ 2 * x
· -- Case 1: x ≥ n/2
have h_total_ge_nx : totalSum A ≥ n * x := calc
totalSum A = ∑ i, rowSum A i := totalSum_eq_rowSum_sum A
_ ≥ ∑ i, x := Finset.sum_le_sum (fun i _ => h_min_row i)
_ = n * x := by simp
zify at h_total_ge_nx h_x_large ⊢; nlinarith
· -- Case 2: x < n/2
push_neg at h_x_large
let Y := (Finset.univ : Finset (Fin n)).filter (fun j => A i₀ j ≠ 0)
let y := Y.card
have h_y_le_x : y ≤ x := by
rw [← h_xi0, rowSum]
calc y = ∑ j ∈ Y, 1 := by simp [y]
_ ≤ ∑ j ∈ Y, A i₀ j := Finset.sum_le_sum (fun j hj =>
Nat.one_le_iff_ne_zero.mpr (by simp [Y] at hj; exact hj))
_ ≤ ∑ j, A i₀ j := Finset.sum_le_sum_of_subset_of_nonneg
(Finset.subset_univ Y) (fun _ _ _ => Nat.zero_le _)
rw [totalSum_eq_colSum_sum A]
have h_split : ∑ j, colSum A j = (∑ j ∈ Y, colSum A j) + (∑ j ∈ Yᶜ, colSum A j) := by
rw [← Finset.sum_add_sum_compl Y]
rw [h_split]
have h_bound : (∑ j ∈ Y, colSum A j) + (∑ j ∈ Yᶜ, colSum A j) ≥ y * x + (n - y) * (n - x) := by
apply add_le_add
· have h_yx : y * x = ∑ j ∈ Y, x := by simp [y, Finset.sum_const]
rw [h_yx]; apply Finset.sum_le_sum; intro j _; exact h_min_col j
· have h_col_Yc (j : Fin n) (hj : j ∈ Yᶜ) : colSum A j ≥ n - x := by
have h_zero : A i₀ j = 0 := by simp [Y] at hj; exact hj
have h_app := h_cond i₀ j h_zero; rw [h_xi0] at h_app; omega
have h_nx : (n - y) * (n - x) = ∑ j ∈ Yᶜ, (n - x) := by simp [y, Finset.card_compl]
rw [h_nx]; exact Finset.sum_le_sum h_col_Yc
zify at h_y_le_x h_bound h_x_large ⊢
have h_nx_cast : (↑(n - x) : ℤ) = ↑n - ↑x := Int.ofNat_sub (by linarith)
have h_ny_cast : (↑(n - y) : ℤ) = ↑n - ↑y := Int.ofNat_sub (by linarith)
rw [h_nx_cast, h_ny_cast] at h_bound
nlinarith
theorem imo1971_p6 {n : ℕ} (A : Matrix (Fin n) (Fin n) ℕ) (n_pos : 0 < n)
(h_cond : ∀ i j : Fin n, A i j = 0 → rowSum A i + colSum A j ≥ n) :
2 * totalSum A ≥ n^2 := by
let S_vals := (Finset.univ.image (rowSum A)) ∪ (Finset.univ.image (colSum A))
have h_ne : S_vals.Nonempty := ⟨rowSum A ⟨0, n_pos⟩, by simp [S_vals]⟩
let x := S_vals.min' h_ne
-- x is less than or equal to all row sums and column sums
have h_min_row (i : Fin n) : x ≤ rowSum A i := by
apply Finset.min'_le S_vals; simp [S_vals]
have h_min_col (j : Fin n) : x ≤ colSum A j := by
apply Finset.min'_le S_vals; simp [S_vals]
have h_source := Finset.min'_mem S_vals h_ne
simp only [S_vals, Finset.mem_union] at h_source
rcases h_source with h_row | h_col
· -- Case A: The minimum x is a row sum
simp at h_row
exact aux A n_pos h_cond x h_min_row h_min_col h_row
· -- Case B: The minimum x is a column sum
simp only [Finset.mem_image] at h_col
rw [totalSum_transpose_eq A]
apply aux Aᵀ n_pos _ x
· intro i; simp [rowSum]; exact h_min_col i
· intro j; simp [colSum]; exact h_min_row j
· simp at h_col
change ∃ a, colSum A a = x at h_col
exact h_col
· intro i j hij
simp [rowSum, colSum] at hij ⊢
rw [add_comm]
exact h_cond j i hij
end Imo1971P6 | /- | /-
Copyright (c) 2026 lean-tom. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: lean-tom (with assistance from Gemini)
-/
import Mathlib
/-!
# International Mathematical Olympiad 1971, Problem 6
Let $A = (a_{ij})$ be an $n \times n$ matrix with non-negative integer entries.
Suppose that for all $i, j$, if $a_{ij} = 0$, then the sum of the elements in the
$i$-th row plus the sum of the elements in the $j$-th column is at least $n$.
Prove that the sum of all elements in the matrix is at least $n^2 / 2$.
-/
namespace Imo1971P6
open BigOperators Matrix
variable {n : ℕ} (A : Matrix (Fin n) (Fin n) ℕ)
-- Definitions of row sum, column sum, and total sum
def rowSum (i : Fin n) : ℕ := ∑ j, A i j
def colSum (j : Fin n) : ℕ := ∑ i, Aᵀ j i
def totalSum : ℕ := ∑ i, ∑ j, A i j
-- Basic lemmas connecting total sum to row/col sums
lemma totalSum_eq_rowSum_sum : totalSum A = ∑ i, rowSum A i := rfl
lemma totalSum_eq_colSum_sum : totalSum A = ∑ j, colSum A j := Finset.sum_comm
theorem totalSum_transpose_eq : totalSum A = totalSum Aᵀ := by
simp [totalSum, Matrix.transpose]
exact Finset.sum_comm
/-- Auxiliary lemma: The inequality holds if there exists a row with sum `x`
such that `x` is less than or equal to all row sums and column sums. -/
lemma aux {n : ℕ} (A : Matrix (Fin n) (Fin n) ℕ) (n_pos : 0 < n)
(h_cond : ∀ i j : Fin n, A i j = 0 → rowSum A i + colSum A j ≥ n)
(x : ℕ)
(h_min_row : ∀ i, x ≤ rowSum A i)
(h_min_col : ∀ j, x ≤ colSum A j)
(h_exists_row : ∃ i, rowSum A i = x) :
2 * totalSum A ≥ n^2 := by
obtain ⟨i₀, h_xi0⟩ := h_exists_row
by_cases h_x_large : n ≤ 2 * x
· -- Case 1: x ≥ n/2
have h_total_ge_nx : totalSum A ≥ n * x := calc
totalSum A = ∑ i, rowSum A i := totalSum_eq_rowSum_sum A
_ ≥ ∑ i, x := Finset.sum_le_sum (fun i _ => h_min_row i)
_ = n * x := by simp
zify at h_total_ge_nx h_x_large ⊢; nlinarith
· -- Case 2: x < n/2
push_neg at h_x_large
let Y := (Finset.univ : Finset (Fin n)).filter (fun j => A i₀ j ≠ 0)
let y := Y.card
have h_y_le_x : y ≤ x := by
rw [← h_xi0, rowSum]
calc y = ∑ j ∈ Y, 1 := by simp [y]
_ ≤ ∑ j ∈ Y, A i₀ j := Finset.sum_le_sum (fun j hj =>
Nat.one_le_iff_ne_zero.mpr (by simp [Y] at hj; exact hj))
_ ≤ ∑ j, A i₀ j := Finset.sum_le_sum_of_subset_of_nonneg
(Finset.subset_univ Y) (fun _ _ _ => Nat.zero_le _)
rw [totalSum_eq_colSum_sum A]
have h_split : ∑ j, colSum A j = (∑ j ∈ Y, colSum A j) + (∑ j ∈ Yᶜ, colSum A j) := by
rw [← Finset.sum_add_sum_compl Y]
rw [h_split]
have h_bound : (∑ j ∈ Y, colSum A j) + (∑ j ∈ Yᶜ, colSum A j) ≥ y * x + (n - y) * (n - x) := by
apply add_le_add
· have h_yx : y * x = ∑ j ∈ Y, x := by simp [y, Finset.sum_const]
rw [h_yx]; apply Finset.sum_le_sum; intro j _; exact h_min_col j
· have h_col_Yc (j : Fin n) (hj : j ∈ Yᶜ) : colSum A j ≥ n - x := by
have h_zero : A i₀ j = 0 := by simp [Y] at hj; exact hj
have h_app := h_cond i₀ j h_zero; rw [h_xi0] at h_app; omega
have h_nx : (n - y) * (n - x) = ∑ j ∈ Yᶜ, (n - x) := by simp [y, Finset.card_compl]
rw [h_nx]; exact Finset.sum_le_sum h_col_Yc
zify at h_y_le_x h_bound h_x_large ⊢
have h_nx_cast : (↑(n - x) : ℤ) = ↑n - ↑x := Int.ofNat_sub (by linarith)
have h_ny_cast : (↑(n - y) : ℤ) = ↑n - ↑y := Int.ofNat_sub (by linarith)
rw [h_nx_cast, h_ny_cast] at h_bound
nlinarith
theorem imo1971_p6 {n : ℕ} (A : Matrix (Fin n) (Fin n) ℕ) (n_pos : 0 < n)
(h_cond : ∀ i j : Fin n, A i j = 0 → rowSum A i + colSum A j ≥ n) :
2 * totalSum A ≥ n^2 := by
let S_vals := (Finset.univ.image (rowSum A)) ∪ (Finset.univ.image (colSum A))
have h_ne : S_vals.Nonempty := ⟨rowSum A ⟨0, n_pos⟩, by simp [S_vals]⟩
let x := S_vals.min' h_ne
-- x is less than or equal to all row sums and column sums
have h_min_row (i : Fin n) : x ≤ rowSum A i := by
apply Finset.min'_le S_vals; simp [S_vals]
have h_min_col (j : Fin n) : x ≤ colSum A j := by
apply Finset.min'_le S_vals; simp [S_vals]
have h_source := Finset.min'_mem S_vals h_ne
simp only [S_vals, Finset.mem_union] at h_source
rcases h_source with h_row | h_col
· -- Case A: The minimum x is a row sum
simp at h_row
exact aux A n_pos h_cond x h_min_row h_min_col h_row
· -- Case B: The minimum x is a column sum
simp only [Finset.mem_image] at h_col
rw [totalSum_transpose_eq A]
apply aux Aᵀ n_pos _ x
· intro i; simp [rowSum]; exact h_min_col i
· intro j; simp [colSum]; exact h_min_row j
· simp at h_col
change ∃ a, colSum A a = x at h_col
exact h_col
· intro i j hij
simp [rowSum, colSum] at hij ⊢
rw [add_comm]
exact h_cond j i hij
end Imo1971P6
| true | Copyright (c) 2026 lean-tom. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: lean-tom (with assistance from Gemini)
-/
import Mathlib
/-!
# International Mathematical Olympiad 1971, Problem 6
Let $A = (a_{ij})$ be an $n \times n$ matrix with non-negative integer entries.
Suppose that for all $i, j$, if $a_{ij} = 0$, then the sum of the elements in the
$i$-th row plus the sum of the elements in the $j$-th column is at least $n$.
Prove that the sum of all elements in the matrix is at least $n^2 / 2$.
-/
namespace Imo1971P6
open BigOperators Matrix
variable {n : ℕ} (A : Matrix (Fin n) (Fin n) ℕ)
-- Definitions of row sum, column sum, and total sum
def rowSum (i : Fin n) : ℕ := ∑ j, A i j
def colSum (j : Fin n) : ℕ := ∑ i, Aᵀ j i
def totalSum : ℕ := ∑ i, ∑ j, A i j
-- Basic lemmas connecting total sum to row/col sums
lemma totalSum_eq_rowSum_sum : totalSum A = ∑ i, rowSum A i := rfl
lemma totalSum_eq_colSum_sum : totalSum A = ∑ j, colSum A j := Finset.sum_comm
theorem totalSum_transpose_eq : totalSum A = totalSum Aᵀ := by
simp [totalSum, Matrix.transpose]
exact Finset.sum_comm
/-- Auxiliary lemma: The inequality holds if there exists a row with sum `x`
such that `x` is less than or equal to all row sums and column sums. -/
lemma aux {n : ℕ} (A : Matrix (Fin n) (Fin n) ℕ) (n_pos : 0 < n)
(h_cond : ∀ i j : Fin n, A i j = 0 → rowSum A i + colSum A j ≥ n)
(x : ℕ)
(h_min_row : ∀ i, x ≤ rowSum A i)
(h_min_col : ∀ j, x ≤ colSum A j)
(h_exists_row : ∃ i, rowSum A i = x) :
2 * totalSum A ≥ n^2 := by
obtain ⟨i₀, h_xi0⟩ := h_exists_row
by_cases h_x_large : n ≤ 2 * x
· -- Case 1: x ≥ n/2
have h_total_ge_nx : totalSum A ≥ n * x := calc
totalSum A = ∑ i, rowSum A i := totalSum_eq_rowSum_sum A
_ ≥ ∑ i, x := Finset.sum_le_sum (fun i _ => h_min_row i)
_ = n * x := by simp
zify at h_total_ge_nx h_x_large ⊢; nlinarith
· -- Case 2: x < n/2
push_neg at h_x_large
let Y := (Finset.univ : Finset (Fin n)).filter (fun j => A i₀ j ≠ 0)
let y := Y.card
have h_y_le_x : y ≤ x := by
rw [← h_xi0, rowSum]
calc y = ∑ j ∈ Y, 1 := by simp [y]
_ ≤ ∑ j ∈ Y, A i₀ j := Finset.sum_le_sum (fun j hj =>
Nat.one_le_iff_ne_zero.mpr (by simp [Y] at hj; exact hj))
_ ≤ ∑ j, A i₀ j := Finset.sum_le_sum_of_subset_of_nonneg
(Finset.subset_univ Y) (fun _ _ _ => Nat.zero_le _)
rw [totalSum_eq_colSum_sum A]
have h_split : ∑ j, colSum A j = (∑ j ∈ Y, colSum A j) + (∑ j ∈ Yᶜ, colSum A j) := by
rw [← Finset.sum_add_sum_compl Y]
rw [h_split]
have h_bound : (∑ j ∈ Y, colSum A j) + (∑ j ∈ Yᶜ, colSum A j) ≥ y * x + (n - y) * (n - x) := by
apply add_le_add
· have h_yx : y * x = ∑ j ∈ Y, x := by simp [y, Finset.sum_const]
rw [h_yx]; apply Finset.sum_le_sum; intro j _; exact h_min_col j
· have h_col_Yc (j : Fin n) (hj : j ∈ Yᶜ) : colSum A j ≥ n - x := by
have h_zero : A i₀ j = 0 := by simp [Y] at hj; exact hj
have h_app := h_cond i₀ j h_zero; rw [h_xi0] at h_app; omega
have h_nx : (n - y) * (n - x) = ∑ j ∈ Yᶜ, (n - x) := by simp [y, Finset.card_compl]
rw [h_nx]; exact Finset.sum_le_sum h_col_Yc
zify at h_y_le_x h_bound h_x_large ⊢
have h_nx_cast : (↑(n - x) : ℤ) = ↑n - ↑x := Int.ofNat_sub (by linarith)
have h_ny_cast : (↑(n - y) : ℤ) = ↑n - ↑y := Int.ofNat_sub (by linarith)
rw [h_nx_cast, h_ny_cast] at h_bound
nlinarith
theorem imo1971_p6 {n : ℕ} (A : Matrix (Fin n) (Fin n) ℕ) (n_pos : 0 < n)
(h_cond : ∀ i j : Fin n, A i j = 0 → rowSum A i + colSum A j ≥ n) :
2 * totalSum A ≥ n^2 := by
let S_vals := (Finset.univ.image (rowSum A)) ∪ (Finset.univ.image (colSum A))
have h_ne : S_vals.Nonempty := ⟨rowSum A ⟨0, n_pos⟩, by simp [S_vals]⟩
let x := S_vals.min' h_ne
-- x is less than or equal to all row sums and column sums
have h_min_row (i : Fin n) : x ≤ rowSum A i := by
apply Finset.min'_le S_vals; simp [S_vals]
have h_min_col (j : Fin n) : x ≤ colSum A j := by
apply Finset.min'_le S_vals; simp [S_vals]
have h_source := Finset.min'_mem S_vals h_ne
simp only [S_vals, Finset.mem_union] at h_source
rcases h_source with h_row | h_col
· -- Case A: The minimum x is a row sum
simp at h_row
exact aux A n_pos h_cond x h_min_row h_min_col h_row
· -- Case B: The minimum x is a column sum
simp only [Finset.mem_image] at h_col
rw [totalSum_transpose_eq A]
apply aux Aᵀ n_pos _ x
· intro i; simp [rowSum]; exact h_min_col i
· intro j; simp [colSum]; exact h_min_row j
· simp at h_col
change ∃ a, colSum A a = x at h_col
exact h_col
· intro i j hij
simp [rowSum, colSum] at hij ⊢
rw [add_comm]
exact h_cond j i hij
end Imo1971P6 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1971P6.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 120, "latency_s": 4.8352, "verified_at": "2026-03-30T14:39:40.328236+00:00"}} | true | true | false | 4.8352 |
compfiles_Imo1972P1 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1972, Problem 1
Prove that from a set of ten distinct two-digit numbers (in
decimal), it is possible to select two disjoint subsets whose
members have the same sum.
-/
namespace Imo1972P1
theorem imo1972_p1 (S : Finset ℕ)
(Scard : S.card = 10)
(Sdigits : ∀ n ∈ S, (Nat.digits 10 n).length = 2) :
∃ S1 S2 : Finset ℕ, S1 ⊆ S ∧ S2 ⊆ S ∧
Disjoint S1 S2 ∧ ∑ n ∈ S1, n = ∑ n ∈ S2, n := by
-- https://prase.cz/kalva/imo/isoln/isoln721.html
replace Sdigits : S ⊆ Finset.Ico 10 100 := by
have one_lt_ten : 1 < 10 := by norm_num
intro n hn
have h2 := Sdigits n hn
have h3 : n < 10 ^ ((Nat.digits 10 n).length) :=
Nat.lt_base_pow_length_digits one_lt_ten
have h4 : n ≠ 0 := by rintro rfl; norm_num at h2
have h5 := Nat.base_pow_length_digits_le _ n one_lt_ten h4
rw [h2] at h3 h5
rw [sq] at h5
have h6 : 10 ≤ n := by omega
rw [Finset.mem_Ico]
exact ⟨h6, h3⟩
have h2 := Finset.card_powerset S
rw [Scard] at h2
have h3 : ∀ s ∈ Finset.powerset S, ∑ n ∈ s, n ∈ Finset.range 991 := by
intro s hs
have h4 : ∀ n ∈ s, n ≤ 99 := by
intro n hn
have h5 : n ∈ Finset.Ico 10 100 := by
rw [Finset.mem_powerset] at hs
exact Sdigits (hs hn)
rw [Finset.mem_Ico] at h5
omega
have h5 : ∑ n ∈ s, n ≤ ∑ n ∈ s, 99 := Finset.sum_le_sum h4
simp only [Finset.sum_const, smul_eq_mul] at h5
have h6 : s.card ≤ S.card := by
rw [Finset.mem_powerset] at hs
exact Finset.card_le_card hs
rw [Finset.mem_range]
omega
let t : Finset ℕ := Finset.range 991
have h7 : t.card = 991 := Finset.card_range _
have h8 : t.card < S.powerset.card := by omega
replace h3 : Set.MapsTo _ _ _ := h3
have h9 := Finset.exists_ne_map_eq_of_card_lt_of_maps_to h8 h3
obtain ⟨A, hA, B, hB, hAB1, hAB2⟩ := h9
let C := A ∩ B
let A' := A \ C
let B' := B \ C
refine ⟨A', B', ?_, ?_, ?_, ?_⟩
· have h10 : A' ⊆ A := Finset.sdiff_subset
have h11 : A ⊆ S := Finset.mem_powerset.mp hA
exact h10.trans h11
· have h10 : B' ⊆ B := Finset.sdiff_subset
have h11 : B ⊆ S := Finset.mem_powerset.mp hB
exact h10.trans h11
· rw[Finset.disjoint_iff_ne]
intro a ha b hb
clear h2 h3 h7 h8 Sdigits Scard hA hB
aesop
· have h12 : C ⊆ A := Finset.inter_subset_left
have h13 : C ⊆ B := Finset.inter_subset_right
have h14 := Finset.sum_sdiff (f := id) h12
have h15 := Finset.sum_sdiff (f := id) h13
unfold A' B'
dsimp at h14 h15
omega
end Imo1972P1 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1972, Problem 1
Prove that from a set of ten distinct two-digit numbers (in
decimal), it is possible to select two disjoint subsets whose
members have the same sum.
-/
namespace Imo1972P1
theorem imo1972_p1 (S : Finset ℕ)
(Scard : S.card = 10)
(Sdigits : ∀ n ∈ S, (Nat.digits 10 n).length = 2) :
∃ S1 S2 : Finset ℕ, S1 ⊆ S ∧ S2 ⊆ S ∧
Disjoint S1 S2 ∧ ∑ n ∈ S1, n = ∑ n ∈ S2, n := by
-- https://prase.cz/kalva/imo/isoln/isoln721.html
replace Sdigits : S ⊆ Finset.Ico 10 100 := by
have one_lt_ten : 1 < 10 := by norm_num
intro n hn
have h2 := Sdigits n hn
have h3 : n < 10 ^ ((Nat.digits 10 n).length) :=
Nat.lt_base_pow_length_digits one_lt_ten
have h4 : n ≠ 0 := by rintro rfl; norm_num at h2
have h5 := Nat.base_pow_length_digits_le _ n one_lt_ten h4
rw [h2] at h3 h5
rw [sq] at h5
have h6 : 10 ≤ n := by omega
rw [Finset.mem_Ico]
exact ⟨h6, h3⟩
have h2 := Finset.card_powerset S
rw [Scard] at h2
have h3 : ∀ s ∈ Finset.powerset S, ∑ n ∈ s, n ∈ Finset.range 991 := by
intro s hs
have h4 : ∀ n ∈ s, n ≤ 99 := by
intro n hn
have h5 : n ∈ Finset.Ico 10 100 := by
rw [Finset.mem_powerset] at hs
exact Sdigits (hs hn)
rw [Finset.mem_Ico] at h5
omega
have h5 : ∑ n ∈ s, n ≤ ∑ n ∈ s, 99 := Finset.sum_le_sum h4
simp only [Finset.sum_const, smul_eq_mul] at h5
have h6 : s.card ≤ S.card := by
rw [Finset.mem_powerset] at hs
exact Finset.card_le_card hs
rw [Finset.mem_range]
omega
let t : Finset ℕ := Finset.range 991
have h7 : t.card = 991 := Finset.card_range _
have h8 : t.card < S.powerset.card := by omega
replace h3 : Set.MapsTo _ _ _ := h3
have h9 := Finset.exists_ne_map_eq_of_card_lt_of_maps_to h8 h3
obtain ⟨A, hA, B, hB, hAB1, hAB2⟩ := h9
let C := A ∩ B
let A' := A \ C
let B' := B \ C
refine ⟨A', B', ?_, ?_, ?_, ?_⟩
· have h10 : A' ⊆ A := Finset.sdiff_subset
have h11 : A ⊆ S := Finset.mem_powerset.mp hA
exact h10.trans h11
· have h10 : B' ⊆ B := Finset.sdiff_subset
have h11 : B ⊆ S := Finset.mem_powerset.mp hB
exact h10.trans h11
· rw[Finset.disjoint_iff_ne]
intro a ha b hb
clear h2 h3 h7 h8 Sdigits Scard hA hB
aesop
· have h12 : C ⊆ A := Finset.inter_subset_left
have h13 : C ⊆ B := Finset.inter_subset_right
have h14 := Finset.sum_sdiff (f := id) h12
have h15 := Finset.sum_sdiff (f := id) h13
unfold A' B'
dsimp at h14 h15
omega
end Imo1972P1
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1972, Problem 1
Prove that from a set of ten distinct two-digit numbers (in
decimal), it is possible to select two disjoint subsets whose
members have the same sum.
-/
namespace Imo1972P1
theorem imo1972_p1 (S : Finset ℕ)
(Scard : S.card = 10)
(Sdigits : ∀ n ∈ S, (Nat.digits 10 n).length = 2) :
∃ S1 S2 : Finset ℕ, S1 ⊆ S ∧ S2 ⊆ S ∧
Disjoint S1 S2 ∧ ∑ n ∈ S1, n = ∑ n ∈ S2, n := by
-- https://prase.cz/kalva/imo/isoln/isoln721.html
replace Sdigits : S ⊆ Finset.Ico 10 100 := by
have one_lt_ten : 1 < 10 := by norm_num
intro n hn
have h2 := Sdigits n hn
have h3 : n < 10 ^ ((Nat.digits 10 n).length) :=
Nat.lt_base_pow_length_digits one_lt_ten
have h4 : n ≠ 0 := by rintro rfl; norm_num at h2
have h5 := Nat.base_pow_length_digits_le _ n one_lt_ten h4
rw [h2] at h3 h5
rw [sq] at h5
have h6 : 10 ≤ n := by omega
rw [Finset.mem_Ico]
exact ⟨h6, h3⟩
have h2 := Finset.card_powerset S
rw [Scard] at h2
have h3 : ∀ s ∈ Finset.powerset S, ∑ n ∈ s, n ∈ Finset.range 991 := by
intro s hs
have h4 : ∀ n ∈ s, n ≤ 99 := by
intro n hn
have h5 : n ∈ Finset.Ico 10 100 := by
rw [Finset.mem_powerset] at hs
exact Sdigits (hs hn)
rw [Finset.mem_Ico] at h5
omega
have h5 : ∑ n ∈ s, n ≤ ∑ n ∈ s, 99 := Finset.sum_le_sum h4
simp only [Finset.sum_const, smul_eq_mul] at h5
have h6 : s.card ≤ S.card := by
rw [Finset.mem_powerset] at hs
exact Finset.card_le_card hs
rw [Finset.mem_range]
omega
let t : Finset ℕ := Finset.range 991
have h7 : t.card = 991 := Finset.card_range _
have h8 : t.card < S.powerset.card := by omega
replace h3 : Set.MapsTo _ _ _ := h3
have h9 := Finset.exists_ne_map_eq_of_card_lt_of_maps_to h8 h3
obtain ⟨A, hA, B, hB, hAB1, hAB2⟩ := h9
let C := A ∩ B
let A' := A \ C
let B' := B \ C
refine ⟨A', B', ?_, ?_, ?_, ?_⟩
· have h10 : A' ⊆ A := Finset.sdiff_subset
have h11 : A ⊆ S := Finset.mem_powerset.mp hA
exact h10.trans h11
· have h10 : B' ⊆ B := Finset.sdiff_subset
have h11 : B ⊆ S := Finset.mem_powerset.mp hB
exact h10.trans h11
· rw[Finset.disjoint_iff_ne]
intro a ha b hb
clear h2 h3 h7 h8 Sdigits Scard hA hB
aesop
· have h12 : C ⊆ A := Finset.inter_subset_left
have h13 : C ⊆ B := Finset.inter_subset_right
have h14 := Finset.sum_sdiff (f := id) h12
have h15 := Finset.sum_sdiff (f := id) h13
unfold A' B'
dsimp at h14 h15
omega
end Imo1972P1 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1972P1.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 120, "latency_s": 0.6073, "verified_at": "2026-03-30T14:39:45.163583+00:00"}} | true | true | false | 0.6073 |
compfiles_Imo1972P3 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Hongyu Ouyang
-/
import Mathlib
/-!
# International Mathematical Olympiad 1972, Problem 3
Let m and n be non-negative integers. Prove that
(2m)!(2n)! / (m!n!(m + n)!)
is an integer.
-/
namespace Imo1972P3
open scoped Nat
theorem imo1972_p3 (m n : ℕ) :
m ! * n ! * (m + n)! ∣ (2 * m)! * (2 * n)! := by
let f := fun m n => ((2 * m)! * (2 * n)!) / (m ! * n ! * (m + n)!)
revert m
induction' n with n ih
· intro m
simp only [Nat.factorial_zero, mul_one, add_zero, mul_zero]
use Nat.choose (2*m) m
rw [← Nat.choose_mul_factorial_mul_factorial (n := 2 * m) (k := m)]
· rw [show 2*m-m = m by omega]
ring_nf
omega
· intro m
zify
use (4 * f m n - f (m + 1) n)
rify
dsimp only [f]
rw [Nat.cast_div, Nat.cast_div]
· rw [show 2 * Nat.succ n = Nat.succ (Nat.succ (2 * n)) by omega]
rw [show m + Nat.succ n = Nat.succ (m + n) by omega]
rw [show 2 * (m + 1) = Nat.succ (Nat.succ (2 * m)) by omega]
rw [show (m + 1 + n) = Nat.succ (m + n) by omega]
simp only [Nat.factorial_succ]
push_cast
field_simp
ring
· apply ih
· positivity
· apply ih
· positivity
end Imo1972P3 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Hongyu Ouyang
-/
import Mathlib
/-!
# International Mathematical Olympiad 1972, Problem 3
Let m and n be non-negative integers. Prove that
(2m)!(2n)! / (m!n!(m + n)!)
is an integer.
-/
namespace Imo1972P3
open scoped Nat
theorem imo1972_p3 (m n : ℕ) :
m ! * n ! * (m + n)! ∣ (2 * m)! * (2 * n)! := by
let f := fun m n => ((2 * m)! * (2 * n)!) / (m ! * n ! * (m + n)!)
revert m
induction' n with n ih
· intro m
simp only [Nat.factorial_zero, mul_one, add_zero, mul_zero]
use Nat.choose (2*m) m
rw [← Nat.choose_mul_factorial_mul_factorial (n := 2 * m) (k := m)]
· rw [show 2*m-m = m by omega]
ring_nf
omega
· intro m
zify
use (4 * f m n - f (m + 1) n)
rify
dsimp only [f]
rw [Nat.cast_div, Nat.cast_div]
· rw [show 2 * Nat.succ n = Nat.succ (Nat.succ (2 * n)) by omega]
rw [show m + Nat.succ n = Nat.succ (m + n) by omega]
rw [show 2 * (m + 1) = Nat.succ (Nat.succ (2 * m)) by omega]
rw [show (m + 1 + n) = Nat.succ (m + n) by omega]
simp only [Nat.factorial_succ]
push_cast
field_simp
ring
· apply ih
· positivity
· apply ih
· positivity
end Imo1972P3
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Hongyu Ouyang
-/
import Mathlib
/-!
# International Mathematical Olympiad 1972, Problem 3
Let m and n be non-negative integers. Prove that
(2m)!(2n)! / (m!n!(m + n)!)
is an integer.
-/
namespace Imo1972P3
open scoped Nat
theorem imo1972_p3 (m n : ℕ) :
m ! * n ! * (m + n)! ∣ (2 * m)! * (2 * n)! := by
let f := fun m n => ((2 * m)! * (2 * n)!) / (m ! * n ! * (m + n)!)
revert m
induction' n with n ih
· intro m
simp only [Nat.factorial_zero, mul_one, add_zero, mul_zero]
use Nat.choose (2*m) m
rw [← Nat.choose_mul_factorial_mul_factorial (n := 2 * m) (k := m)]
· rw [show 2*m-m = m by omega]
ring_nf
omega
· intro m
zify
use (4 * f m n - f (m + 1) n)
rify
dsimp only [f]
rw [Nat.cast_div, Nat.cast_div]
· rw [show 2 * Nat.succ n = Nat.succ (Nat.succ (2 * n)) by omega]
rw [show m + Nat.succ n = Nat.succ (m + n) by omega]
rw [show 2 * (m + 1) = Nat.succ (Nat.succ (2 * m)) by omega]
rw [show (m + 1 + n) = Nat.succ (m + n) by omega]
simp only [Nat.factorial_succ]
push_cast
field_simp
ring
· apply ih
· positivity
· apply ih
· positivity
end Imo1972P3 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1972P3.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 120, "latency_s": 1.3442, "verified_at": "2026-03-30T14:39:45.770931+00:00"}} | true | true | false | 1.3442 |
compfiles_Imo1972P4 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Maximiliano Onofre-Martínez
-/
import Mathlib
/-!
# International Mathematical Olympiad 1972, Problem 4
Find all positive real solutions to:
(x_1^2 - x_3x_5)(x_2^2 - x_3x_5) ≤ 0
(x_2^2 - x_4x_1)(x_3^2 - x_4x_1) ≤ 0
(x_3^2 - x_5x_2)(x_4^2 - x_5x_2) ≤ 0
(x_4^2 - x_1x_3)(x_5^2 - x_1x_3) ≤ 0
(x_5^2 - x_2x_4)(x_1^2 - x_2x_4) ≤ 0
-/
namespace Imo1972P4
abbrev solution_set : Set (ℝ × ℝ × ℝ × ℝ × ℝ) :=
{(a, b, c, d, e) | a = b ∧ b = c ∧ c = d ∧ d = e}
theorem imo1972_p4 (a b c d e : ℝ)
(h₀ : 0 < a ∧ 0 < b ∧ 0 < c ∧ 0 < d ∧ 0 < e):
(a^2 - c * e) * (b^2 - c * e) ≤ 0 ∧
(b^2 - d * a) * (c^2 - d * a) ≤ 0 ∧
(c^2 - e * b) * (d^2 - e * b) ≤ 0 ∧
(d^2 - a * c) * (e^2 - a * c) ≤ 0 ∧
(e^2 - b * d) * (a^2 - b * d) ≤ 0 ↔
(a, b, c, d, e) ∈ solution_set := by
constructor
· intro _
have : (a * b - a * d)^2 + (b * c - b * e)^2 +
(c * d - c * a)^2 + (d * e - d * b)^2 +
(e * a - e * c)^2 + (a * c - a * e)^2 +
(b * d - b * a)^2 + (c * e - c * b)^2 +
(d * a - d * c)^2 + (e * b - e * d)^2 ≤ 0 := by linarith
have : 0 ≤ (a * b - a * d)^2 ∧ 0 ≤ (b * c - b * e)^2 ∧
0 ≤ (c * d - c * a)^2 ∧ 0 ≤ (d * e - d * b)^2 ∧
0 ≤ (e * a - e * c)^2 ∧ 0 ≤ (a * c - a * e)^2 ∧
0 ≤ (b * d - b * a)^2 ∧ 0 ≤ (c * e - c * b)^2 ∧
0 ≤ (d * a - d * c)^2 ∧ 0 ≤ (e * b - e * d)^2 := by simp [sq_nonneg (R := ℝ)]
have bd : b = d := by
have h₁ : (a * b - a * d)^2 = 0 := by linarith
have h₂ : a * b - a * d = 0 := by rwa [sq_eq_zero_iff] at h₁
have h₃ : a * b = a * d := by rwa [sub_eq_zero] at h₂
exact mul_left_cancel₀ (ne_of_gt h₀.1) h₃
have ce : c = e := by
have h₁ : (b * c - b * e)^2 = 0 := by linarith
have h₂ : b * c - b * e = 0 := by rwa [sq_eq_zero_iff] at h₁
have h₃ : b * c = b * e := by rwa [sub_eq_zero] at h₂
exact mul_left_cancel₀ (ne_of_gt h₀.2.1) h₃
have da : d = a := by
have h₁ : (c * d - c * a)^2 = 0 := by linarith
have h₂ : c * d - c * a = 0 := by rwa [sq_eq_zero_iff] at h₁
have h₃ : c * d = c * a := by rwa [sub_eq_zero] at h₂
exact mul_left_cancel₀ (ne_of_gt h₀.2.2.1) h₃
have eb : e = b := by
have h₁ : (d * e - d * b)^2 = 0 := by linarith
have h₂ : d * e - d * b = 0 := by rwa [sq_eq_zero_iff] at h₁
have h₃ : d * e = d * b := by rwa [sub_eq_zero] at h₂
exact mul_left_cancel₀ (ne_of_gt h₀.2.2.2.1) h₃
have ab : a = b := by rw [← da]; exact bd.symm
have bc : b = c := by rw [← eb]; exact ce.symm
have cd : c = d := by rwa [← bc]
have de : d = e := by rwa [cd] at ce
exact ⟨ab, bc, cd, de⟩
· intro h
obtain ⟨rfl, rfl, rfl, rfl⟩ := h
ring_nf; trivial
end Imo1972P4 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Maximiliano Onofre-Martínez
-/
import Mathlib
/-!
# International Mathematical Olympiad 1972, Problem 4
Find all positive real solutions to:
(x_1^2 - x_3x_5)(x_2^2 - x_3x_5) ≤ 0
(x_2^2 - x_4x_1)(x_3^2 - x_4x_1) ≤ 0
(x_3^2 - x_5x_2)(x_4^2 - x_5x_2) ≤ 0
(x_4^2 - x_1x_3)(x_5^2 - x_1x_3) ≤ 0
(x_5^2 - x_2x_4)(x_1^2 - x_2x_4) ≤ 0
-/
namespace Imo1972P4
abbrev solution_set : Set (ℝ × ℝ × ℝ × ℝ × ℝ) :=
{(a, b, c, d, e) | a = b ∧ b = c ∧ c = d ∧ d = e}
theorem imo1972_p4 (a b c d e : ℝ)
(h₀ : 0 < a ∧ 0 < b ∧ 0 < c ∧ 0 < d ∧ 0 < e):
(a^2 - c * e) * (b^2 - c * e) ≤ 0 ∧
(b^2 - d * a) * (c^2 - d * a) ≤ 0 ∧
(c^2 - e * b) * (d^2 - e * b) ≤ 0 ∧
(d^2 - a * c) * (e^2 - a * c) ≤ 0 ∧
(e^2 - b * d) * (a^2 - b * d) ≤ 0 ↔
(a, b, c, d, e) ∈ solution_set := by
constructor
· intro _
have : (a * b - a * d)^2 + (b * c - b * e)^2 +
(c * d - c * a)^2 + (d * e - d * b)^2 +
(e * a - e * c)^2 + (a * c - a * e)^2 +
(b * d - b * a)^2 + (c * e - c * b)^2 +
(d * a - d * c)^2 + (e * b - e * d)^2 ≤ 0 := by linarith
have : 0 ≤ (a * b - a * d)^2 ∧ 0 ≤ (b * c - b * e)^2 ∧
0 ≤ (c * d - c * a)^2 ∧ 0 ≤ (d * e - d * b)^2 ∧
0 ≤ (e * a - e * c)^2 ∧ 0 ≤ (a * c - a * e)^2 ∧
0 ≤ (b * d - b * a)^2 ∧ 0 ≤ (c * e - c * b)^2 ∧
0 ≤ (d * a - d * c)^2 ∧ 0 ≤ (e * b - e * d)^2 := by simp [sq_nonneg (R := ℝ)]
have bd : b = d := by
have h₁ : (a * b - a * d)^2 = 0 := by linarith
have h₂ : a * b - a * d = 0 := by rwa [sq_eq_zero_iff] at h₁
have h₃ : a * b = a * d := by rwa [sub_eq_zero] at h₂
exact mul_left_cancel₀ (ne_of_gt h₀.1) h₃
have ce : c = e := by
have h₁ : (b * c - b * e)^2 = 0 := by linarith
have h₂ : b * c - b * e = 0 := by rwa [sq_eq_zero_iff] at h₁
have h₃ : b * c = b * e := by rwa [sub_eq_zero] at h₂
exact mul_left_cancel₀ (ne_of_gt h₀.2.1) h₃
have da : d = a := by
have h₁ : (c * d - c * a)^2 = 0 := by linarith
have h₂ : c * d - c * a = 0 := by rwa [sq_eq_zero_iff] at h₁
have h₃ : c * d = c * a := by rwa [sub_eq_zero] at h₂
exact mul_left_cancel₀ (ne_of_gt h₀.2.2.1) h₃
have eb : e = b := by
have h₁ : (d * e - d * b)^2 = 0 := by linarith
have h₂ : d * e - d * b = 0 := by rwa [sq_eq_zero_iff] at h₁
have h₃ : d * e = d * b := by rwa [sub_eq_zero] at h₂
exact mul_left_cancel₀ (ne_of_gt h₀.2.2.2.1) h₃
have ab : a = b := by rw [← da]; exact bd.symm
have bc : b = c := by rw [← eb]; exact ce.symm
have cd : c = d := by rwa [← bc]
have de : d = e := by rwa [cd] at ce
exact ⟨ab, bc, cd, de⟩
· intro h
obtain ⟨rfl, rfl, rfl, rfl⟩ := h
ring_nf; trivial
end Imo1972P4
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Maximiliano Onofre-Martínez
-/
import Mathlib
/-!
# International Mathematical Olympiad 1972, Problem 4
Find all positive real solutions to:
(x_1^2 - x_3x_5)(x_2^2 - x_3x_5) ≤ 0
(x_2^2 - x_4x_1)(x_3^2 - x_4x_1) ≤ 0
(x_3^2 - x_5x_2)(x_4^2 - x_5x_2) ≤ 0
(x_4^2 - x_1x_3)(x_5^2 - x_1x_3) ≤ 0
(x_5^2 - x_2x_4)(x_1^2 - x_2x_4) ≤ 0
-/
namespace Imo1972P4
abbrev solution_set : Set (ℝ × ℝ × ℝ × ℝ × ℝ) :=
{(a, b, c, d, e) | a = b ∧ b = c ∧ c = d ∧ d = e}
theorem imo1972_p4 (a b c d e : ℝ)
(h₀ : 0 < a ∧ 0 < b ∧ 0 < c ∧ 0 < d ∧ 0 < e):
(a^2 - c * e) * (b^2 - c * e) ≤ 0 ∧
(b^2 - d * a) * (c^2 - d * a) ≤ 0 ∧
(c^2 - e * b) * (d^2 - e * b) ≤ 0 ∧
(d^2 - a * c) * (e^2 - a * c) ≤ 0 ∧
(e^2 - b * d) * (a^2 - b * d) ≤ 0 ↔
(a, b, c, d, e) ∈ solution_set := by
constructor
· intro _
have : (a * b - a * d)^2 + (b * c - b * e)^2 +
(c * d - c * a)^2 + (d * e - d * b)^2 +
(e * a - e * c)^2 + (a * c - a * e)^2 +
(b * d - b * a)^2 + (c * e - c * b)^2 +
(d * a - d * c)^2 + (e * b - e * d)^2 ≤ 0 := by linarith
have : 0 ≤ (a * b - a * d)^2 ∧ 0 ≤ (b * c - b * e)^2 ∧
0 ≤ (c * d - c * a)^2 ∧ 0 ≤ (d * e - d * b)^2 ∧
0 ≤ (e * a - e * c)^2 ∧ 0 ≤ (a * c - a * e)^2 ∧
0 ≤ (b * d - b * a)^2 ∧ 0 ≤ (c * e - c * b)^2 ∧
0 ≤ (d * a - d * c)^2 ∧ 0 ≤ (e * b - e * d)^2 := by simp [sq_nonneg (R := ℝ)]
have bd : b = d := by
have h₁ : (a * b - a * d)^2 = 0 := by linarith
have h₂ : a * b - a * d = 0 := by rwa [sq_eq_zero_iff] at h₁
have h₃ : a * b = a * d := by rwa [sub_eq_zero] at h₂
exact mul_left_cancel₀ (ne_of_gt h₀.1) h₃
have ce : c = e := by
have h₁ : (b * c - b * e)^2 = 0 := by linarith
have h₂ : b * c - b * e = 0 := by rwa [sq_eq_zero_iff] at h₁
have h₃ : b * c = b * e := by rwa [sub_eq_zero] at h₂
exact mul_left_cancel₀ (ne_of_gt h₀.2.1) h₃
have da : d = a := by
have h₁ : (c * d - c * a)^2 = 0 := by linarith
have h₂ : c * d - c * a = 0 := by rwa [sq_eq_zero_iff] at h₁
have h₃ : c * d = c * a := by rwa [sub_eq_zero] at h₂
exact mul_left_cancel₀ (ne_of_gt h₀.2.2.1) h₃
have eb : e = b := by
have h₁ : (d * e - d * b)^2 = 0 := by linarith
have h₂ : d * e - d * b = 0 := by rwa [sq_eq_zero_iff] at h₁
have h₃ : d * e = d * b := by rwa [sub_eq_zero] at h₂
exact mul_left_cancel₀ (ne_of_gt h₀.2.2.2.1) h₃
have ab : a = b := by rw [← da]; exact bd.symm
have bc : b = c := by rw [← eb]; exact ce.symm
have cd : c = d := by rwa [← bc]
have de : d = e := by rwa [cd] at ce
exact ⟨ab, bc, cd, de⟩
· intro h
obtain ⟨rfl, rfl, rfl, rfl⟩ := h
ring_nf; trivial
end Imo1972P4 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1972P4.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 600.0, "latency_s": 2.4445, "verified_at": "2026-03-26T18:16:29.330031+00:00"}} | true | true | false | 2.4445 |
compfiles_Imo1972P5 | compfiles | Copyright (c) 2020 Ruben Van de Velde, Stanislas Polu. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Ruben Van de Velde, Stanislas Polu
-/
import Mathlib
/-!
# International Mathematical Olympiad 1972, Problem 5
`f` and `g` are real-valued functions defined on the real line. For all `x` and `y`,
`f(x + y) + f(x - y) = 2f(x)g(y)`. `f` is not identically zero and `|f(x)| ≤ 1` for all `x`.
Prove that `|g(x)| ≤ 1` for all `x`.
-/
namespace Imo1972P5
theorem imo1972_p5 (f g : ℝ → ℝ) (hf1 : ∀ x, ∀ y, f (x + y) + f (x - y) = 2 * f x * g y)
(hf2 : BddAbove (Set.range fun x => ‖f x‖)) (hf3 : ∃ x, f x ≠ 0) (y : ℝ) : ‖g y‖ ≤ 1 := by
by_contra! H
obtain ⟨x, hx⟩ := hf3
set k := ⨆ x, ‖f x‖
have h : ∀ x, ‖f x‖ ≤ k := le_ciSup hf2
have hgy : 0 < ‖g y‖ := by linarith only [H]
have k_pos : 0 < k := lt_of_lt_of_le (norm_pos_iff.mpr hx) (h x)
have : k / ‖g y‖ < k := (div_lt_iff₀ hgy).mpr (lt_mul_of_one_lt_right k_pos H)
have : k ≤ k / ‖g y‖ := by
suffices ∀ x, ‖f x‖ ≤ k / ‖g y‖ from ciSup_le this
intro x
suffices 2 * (‖f x‖ * ‖g y‖) ≤ 2 * k by
rwa [le_div_iff₀ hgy, ← mul_le_mul_iff_right₀ zero_lt_two]
calc
2 * (‖f x‖ * ‖g y‖) = ‖2 * f x * g y‖ := by simp [mul_assoc]
_ = ‖f (x + y) + f (x - y)‖ := by rw [hf1]
_ ≤ ‖f (x + y)‖ + ‖f (x - y)‖ := abs_add_le _ _
_ ≤ 2 * k := by linarith [h (x + y), h (x - y)]
order
end Imo1972P5 | /- | /-
Copyright (c) 2020 Ruben Van de Velde, Stanislas Polu. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Ruben Van de Velde, Stanislas Polu
-/
import Mathlib
/-!
# International Mathematical Olympiad 1972, Problem 5
`f` and `g` are real-valued functions defined on the real line. For all `x` and `y`,
`f(x + y) + f(x - y) = 2f(x)g(y)`. `f` is not identically zero and `|f(x)| ≤ 1` for all `x`.
Prove that `|g(x)| ≤ 1` for all `x`.
-/
namespace Imo1972P5
theorem imo1972_p5 (f g : ℝ → ℝ) (hf1 : ∀ x, ∀ y, f (x + y) + f (x - y) = 2 * f x * g y)
(hf2 : BddAbove (Set.range fun x => ‖f x‖)) (hf3 : ∃ x, f x ≠ 0) (y : ℝ) : ‖g y‖ ≤ 1 := by
by_contra! H
obtain ⟨x, hx⟩ := hf3
set k := ⨆ x, ‖f x‖
have h : ∀ x, ‖f x‖ ≤ k := le_ciSup hf2
have hgy : 0 < ‖g y‖ := by linarith only [H]
have k_pos : 0 < k := lt_of_lt_of_le (norm_pos_iff.mpr hx) (h x)
have : k / ‖g y‖ < k := (div_lt_iff₀ hgy).mpr (lt_mul_of_one_lt_right k_pos H)
have : k ≤ k / ‖g y‖ := by
suffices ∀ x, ‖f x‖ ≤ k / ‖g y‖ from ciSup_le this
intro x
suffices 2 * (‖f x‖ * ‖g y‖) ≤ 2 * k by
rwa [le_div_iff₀ hgy, ← mul_le_mul_iff_right₀ zero_lt_two]
calc
2 * (‖f x‖ * ‖g y‖) = ‖2 * f x * g y‖ := by simp [mul_assoc]
_ = ‖f (x + y) + f (x - y)‖ := by rw [hf1]
_ ≤ ‖f (x + y)‖ + ‖f (x - y)‖ := abs_add_le _ _
_ ≤ 2 * k := by linarith [h (x + y), h (x - y)]
order
end Imo1972P5
| true | Copyright (c) 2020 Ruben Van de Velde, Stanislas Polu. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Ruben Van de Velde, Stanislas Polu
-/
import Mathlib
/-!
# International Mathematical Olympiad 1972, Problem 5
`f` and `g` are real-valued functions defined on the real line. For all `x` and `y`,
`f(x + y) + f(x - y) = 2f(x)g(y)`. `f` is not identically zero and `|f(x)| ≤ 1` for all `x`.
Prove that `|g(x)| ≤ 1` for all `x`.
-/
namespace Imo1972P5
theorem imo1972_p5 (f g : ℝ → ℝ) (hf1 : ∀ x, ∀ y, f (x + y) + f (x - y) = 2 * f x * g y)
(hf2 : BddAbove (Set.range fun x => ‖f x‖)) (hf3 : ∃ x, f x ≠ 0) (y : ℝ) : ‖g y‖ ≤ 1 := by
by_contra! H
obtain ⟨x, hx⟩ := hf3
set k := ⨆ x, ‖f x‖
have h : ∀ x, ‖f x‖ ≤ k := le_ciSup hf2
have hgy : 0 < ‖g y‖ := by linarith only [H]
have k_pos : 0 < k := lt_of_lt_of_le (norm_pos_iff.mpr hx) (h x)
have : k / ‖g y‖ < k := (div_lt_iff₀ hgy).mpr (lt_mul_of_one_lt_right k_pos H)
have : k ≤ k / ‖g y‖ := by
suffices ∀ x, ‖f x‖ ≤ k / ‖g y‖ from ciSup_le this
intro x
suffices 2 * (‖f x‖ * ‖g y‖) ≤ 2 * k by
rwa [le_div_iff₀ hgy, ← mul_le_mul_iff_right₀ zero_lt_two]
calc
2 * (‖f x‖ * ‖g y‖) = ‖2 * f x * g y‖ := by simp [mul_assoc]
_ = ‖f (x + y) + f (x - y)‖ := by rw [hf1]
_ ≤ ‖f (x + y)‖ + ‖f (x - y)‖ := abs_add_le _ _
_ ≤ 2 * k := by linarith [h (x + y), h (x - y)]
order
end Imo1972P5 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1972P5.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown identifier 'mul_le_mul_iff_right\u2080'", "unsolved goals\nf g : \u211d \u2192 \u211d\nhf1 : \u2200 (x y : \u211d), f (x + y) + f (x - y) = 2 * f x * g y\nhf2 : BddAbove (Set.range fun x => \u2016f x\u2016)\ny : \u211d\nH : 1 < \u2016g y\u2016\nx\u271d : \u211d\nhx : f x\u271d \u2260 0\nk : \u211d := \u2a06 x, \u2016f x\u2016\nh : \u2200 (x : \u211d), \u2016f x\u2016 \u2264 k\nhgy : 0 < \u2016g y\u2016\nk_pos : 0 < k\nthis\u271d : k / \u2016g y\u2016 < k\nx : \u211d\nthis : 2 * (\u2016f x\u2016 * \u2016g y\u2016) \u2264 2 * k\n\u22a2 \u2016f x\u2016 * \u2016g y\u2016 \u2264 k"], "timeout_s": 600.0, "latency_s": 0.3392, "verified_at": "2026-03-26T18:16:27.224897+00:00"}} | false | true | false | 0.3392 |
compfiles_Imo1973P3 | compfiles | Copyright (c) 2025 Roozbeh Yousefzadeh. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1973, Problem 3
Let $a$ and $b$ be real numbers for which the equation
$x^4 + ax^3 + bx^2 + ax + 1 = 0$ has at least one real solution.
For all such pairs $(a, b)$, find the minimum value of $a^2 + b^2$.
-/
namespace Imo1973P3
noncomputable abbrev solution : ℝ := (4:ℝ)/5
lemma aux_1
(a b : ℝ)
(h₀ : ∃ (x : ℝ), x ^ 4 + a * x ^ 3 + b * x ^ 2 + a * x + 1 = 0) :
4 / 5 ≤ a^2 + b^2 := by
obtain ⟨x, h₁⟩ := h₀
let t := x + 1 / x
have ht₀: t = x + 1 / x := by rfl
have hx: x ≠ 0 := by
by_contra hc
rw [hc] at h₁
simp at h₁
have h₂: t ^ 2 + a * t + (b - 2) = 0 := by
rw [ht₀]
ring_nf
rw [mul_inv_cancel₀ hx]
simp only [one_mul, neg_add_cancel, zero_add, inv_pow]
have h₂₀: (x ^ 4 + a * x ^ 3 + b * x ^ 2 + a * x + 1) / (x ^ 2) = 0 / (x ^ 2) := by
exact congr(HDiv.hDiv $h₁ (x ^ 2))
ring_nf at h₂₀
have hx₁: x ^ 2 ≠ 0 := by exact pow_ne_zero 2 hx
rw [mul_comm (x ^ 2), mul_assoc b, inv_pow, mul_inv_cancel₀ hx₁, mul_one] at h₂₀
rw [mul_comm x a, mul_assoc a, pow_two, mul_inv,
← mul_assoc x, mul_inv_cancel₀ hx, one_mul] at h₂₀
rw [mul_comm _ a, mul_assoc a, ← pow_two, inv_pow, ← pow_sub₀ _ hx, ← pow_sub₀ _ hx] at h₂₀
all_goals try linarith
have ht₁: 2 ≤ abs t := by
have g₀: 1 * (x * x) + (-t) * x + 1 = 0 := by
rw [ht₀]
ring_nf
rw [mul_inv_cancel₀ hx]
exact sub_eq_zero_of_eq rfl
have g₁: discrim 1 (-t) 1 = (-t) ^ 2 - 4 * 1 * 1 := by exact rfl
simp at g₁
by_contra hc₀
push_neg at hc₀
have hc₁: t ^ 2 < 2 ^ 2 := by
refine sq_lt_sq.mpr ?_
refine lt_of_lt_of_le hc₀ ?_
norm_num
apply sub_neg_of_lt at hc₁
have hc₂: ∀ (s : ℝ), discrim 1 (-t) 1 ≠ s ^ 2 := by
intro s
have hs: 0 ≤ s ^ 2 := by exact sq_nonneg s
linarith
have hc₃: 1 * (x * x) + -t * x + 1 ≠ 0 := by
exact quadratic_ne_zero_of_discrim_ne_sq hc₂ x
exact hc₃ g₀
have ht₂: 0 < t ^ 2 := by
refine sq_pos_iff.mpr ?_
by_contra hc
rw [hc] at ht₁
simp at ht₁
linarith
have h₃: (a * t + b * 1) ^ 2 ≤ (a ^ 2 + b ^ 2) * (t ^ 2 + 1 ^ 2) := by
let s := Finset.range 2
let f : ℕ → ℝ := fun x => a * (1 - x) + b * x
let g : ℕ → ℝ := fun x => t * (1 - x) + 1 * x
have hhf: f = fun x:ℕ => a * (1 - x) + b * x := by rfl
have hhg: g = fun x:ℕ => t * (1 - x) + 1 * x := by rfl
have h₃₀: f 0 = a := by rw [hhf]; bound
have h₃₁: f 1 = b := by rw [hhf]; ring_nf
have h₃₂: g 0 = t := by rw [hhg]; ring_nf
have h₃₃: g 1 = 1 := by rw [hhg]; ring_nf
have h₃₄: a * t + b * 1 = ∑ i ∈ s, f i * g i := by
rw [Finset.sum_range_succ, Finset.sum_range_succ, Finset.sum_range_zero]
rw [h₃₀, h₃₁, h₃₂, h₃₃, zero_add]
rw [h₃₄]
have h₃₅: (∑ i ∈ s, f i * g i) ^ 2 ≤ (∑ i ∈ s, f i ^ 2) * ∑ i ∈ s, g i ^ 2 := by
exact Finset.sum_mul_sq_le_sq_mul_sq s f g
refine le_trans h₃₅ ?_
rw [Finset.sum_range_succ, Finset.sum_range_succ, Finset.sum_range_succ, Finset.sum_range_succ]
simp only [Finset.range_zero, Finset.sum_empty, zero_add, one_pow]
rw [h₃₀, h₃₁, h₃₂, h₃₃]
linarith
rw [mul_one, one_pow] at h₃
have h₄: (a * t + b) ^ 2 = (t ^ 2 - 2) ^ 2 := by
refine (pow_eq_pow_iff_of_ne_zero two_ne_zero).mpr ?_
right
constructor
· linarith
· decide
have h₅: 4 / 5 ≤ (t ^ 2 - 2) ^ 2 / (t ^ 2 + 1) := by
refine (div_le_div_iff₀ (by norm_num) ?_).mpr ?_
· positivity
· rw [mul_add, mul_one, sub_sq, add_mul, sub_mul, ← pow_mul]
norm_num
have h₅₀: 0 ≤ 5 * t ^ 4 + 16 - 24 * t ^ 2 := by
have h₅₁: 5 * t ^ 4 + 16 - 24 * t ^ 2 = (5 * t ^ 2 - 4) * (t ^ 2 - 4) := by ring_nf
have h₅₂: 2 ^ 2 ≤ t ^ 2 := by
refine sq_le_sq.mpr ?_
refine le_trans ?_ ht₁
norm_num
have h₅₃: 0 ≤ t ^ 2 - 4 := by linarith
have h₅₄: 0 ≤ 5 * t ^ 2 - 4 := by linarith
rw [h₅₁]
exact Left.mul_nonneg h₅₄ h₅₃
linarith
refine le_trans h₅ ?_
rw [h₄] at h₃
refine (div_le_iff₀ ?_).mpr h₃
positivity
theorem imo1973_p3
(S : Set (ℝ × ℝ))
(hS : S = {(a, b) | ∃ x : ℝ, x ^ 4 + a * x ^ 3 + b * x ^ 2 + a * x + 1 = 0}) :
IsLeast { x.1 ^ 2 + x.2 ^ 2 | x ∈ S } solution := by
constructor
· simp only [Prod.exists, Set.mem_setOf_eq]
use 4/5, -2/5
constructor
· simp only [hS, Set.mem_setOf_eq]
use -1
norm_num
· norm_num
· refine mem_lowerBounds.mpr ?_
simp only [Prod.exists, Set.mem_setOf_eq, forall_exists_index, and_imp]
intro x a b h₀ h₁
rw [←h₁]
refine aux_1 a b ?_
simpa only [hS, Set.mem_setOf_eq] using h₀
end Imo1973P3 | /- | /-
Copyright (c) 2025 Roozbeh Yousefzadeh. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1973, Problem 3
Let $a$ and $b$ be real numbers for which the equation
$x^4 + ax^3 + bx^2 + ax + 1 = 0$ has at least one real solution.
For all such pairs $(a, b)$, find the minimum value of $a^2 + b^2$.
-/
namespace Imo1973P3
noncomputable abbrev solution : ℝ := (4:ℝ)/5
lemma aux_1
(a b : ℝ)
(h₀ : ∃ (x : ℝ), x ^ 4 + a * x ^ 3 + b * x ^ 2 + a * x + 1 = 0) :
4 / 5 ≤ a^2 + b^2 := by
obtain ⟨x, h₁⟩ := h₀
let t := x + 1 / x
have ht₀: t = x + 1 / x := by rfl
have hx: x ≠ 0 := by
by_contra hc
rw [hc] at h₁
simp at h₁
have h₂: t ^ 2 + a * t + (b - 2) = 0 := by
rw [ht₀]
ring_nf
rw [mul_inv_cancel₀ hx]
simp only [one_mul, neg_add_cancel, zero_add, inv_pow]
have h₂₀: (x ^ 4 + a * x ^ 3 + b * x ^ 2 + a * x + 1) / (x ^ 2) = 0 / (x ^ 2) := by
exact congr(HDiv.hDiv $h₁ (x ^ 2))
ring_nf at h₂₀
have hx₁: x ^ 2 ≠ 0 := by exact pow_ne_zero 2 hx
rw [mul_comm (x ^ 2), mul_assoc b, inv_pow, mul_inv_cancel₀ hx₁, mul_one] at h₂₀
rw [mul_comm x a, mul_assoc a, pow_two, mul_inv,
← mul_assoc x, mul_inv_cancel₀ hx, one_mul] at h₂₀
rw [mul_comm _ a, mul_assoc a, ← pow_two, inv_pow, ← pow_sub₀ _ hx, ← pow_sub₀ _ hx] at h₂₀
all_goals try linarith
have ht₁: 2 ≤ abs t := by
have g₀: 1 * (x * x) + (-t) * x + 1 = 0 := by
rw [ht₀]
ring_nf
rw [mul_inv_cancel₀ hx]
exact sub_eq_zero_of_eq rfl
have g₁: discrim 1 (-t) 1 = (-t) ^ 2 - 4 * 1 * 1 := by exact rfl
simp at g₁
by_contra hc₀
push_neg at hc₀
have hc₁: t ^ 2 < 2 ^ 2 := by
refine sq_lt_sq.mpr ?_
refine lt_of_lt_of_le hc₀ ?_
norm_num
apply sub_neg_of_lt at hc₁
have hc₂: ∀ (s : ℝ), discrim 1 (-t) 1 ≠ s ^ 2 := by
intro s
have hs: 0 ≤ s ^ 2 := by exact sq_nonneg s
linarith
have hc₃: 1 * (x * x) + -t * x + 1 ≠ 0 := by
exact quadratic_ne_zero_of_discrim_ne_sq hc₂ x
exact hc₃ g₀
have ht₂: 0 < t ^ 2 := by
refine sq_pos_iff.mpr ?_
by_contra hc
rw [hc] at ht₁
simp at ht₁
linarith
have h₃: (a * t + b * 1) ^ 2 ≤ (a ^ 2 + b ^ 2) * (t ^ 2 + 1 ^ 2) := by
let s := Finset.range 2
let f : ℕ → ℝ := fun x => a * (1 - x) + b * x
let g : ℕ → ℝ := fun x => t * (1 - x) + 1 * x
have hhf: f = fun x:ℕ => a * (1 - x) + b * x := by rfl
have hhg: g = fun x:ℕ => t * (1 - x) + 1 * x := by rfl
have h₃₀: f 0 = a := by rw [hhf]; bound
have h₃₁: f 1 = b := by rw [hhf]; ring_nf
have h₃₂: g 0 = t := by rw [hhg]; ring_nf
have h₃₃: g 1 = 1 := by rw [hhg]; ring_nf
have h₃₄: a * t + b * 1 = ∑ i ∈ s, f i * g i := by
rw [Finset.sum_range_succ, Finset.sum_range_succ, Finset.sum_range_zero]
rw [h₃₀, h₃₁, h₃₂, h₃₃, zero_add]
rw [h₃₄]
have h₃₅: (∑ i ∈ s, f i * g i) ^ 2 ≤ (∑ i ∈ s, f i ^ 2) * ∑ i ∈ s, g i ^ 2 := by
exact Finset.sum_mul_sq_le_sq_mul_sq s f g
refine le_trans h₃₅ ?_
rw [Finset.sum_range_succ, Finset.sum_range_succ, Finset.sum_range_succ, Finset.sum_range_succ]
simp only [Finset.range_zero, Finset.sum_empty, zero_add, one_pow]
rw [h₃₀, h₃₁, h₃₂, h₃₃]
linarith
rw [mul_one, one_pow] at h₃
have h₄: (a * t + b) ^ 2 = (t ^ 2 - 2) ^ 2 := by
refine (pow_eq_pow_iff_of_ne_zero two_ne_zero).mpr ?_
right
constructor
· linarith
· decide
have h₅: 4 / 5 ≤ (t ^ 2 - 2) ^ 2 / (t ^ 2 + 1) := by
refine (div_le_div_iff₀ (by norm_num) ?_).mpr ?_
· positivity
· rw [mul_add, mul_one, sub_sq, add_mul, sub_mul, ← pow_mul]
norm_num
have h₅₀: 0 ≤ 5 * t ^ 4 + 16 - 24 * t ^ 2 := by
have h₅₁: 5 * t ^ 4 + 16 - 24 * t ^ 2 = (5 * t ^ 2 - 4) * (t ^ 2 - 4) := by ring_nf
have h₅₂: 2 ^ 2 ≤ t ^ 2 := by
refine sq_le_sq.mpr ?_
refine le_trans ?_ ht₁
norm_num
have h₅₃: 0 ≤ t ^ 2 - 4 := by linarith
have h₅₄: 0 ≤ 5 * t ^ 2 - 4 := by linarith
rw [h₅₁]
exact Left.mul_nonneg h₅₄ h₅₃
linarith
refine le_trans h₅ ?_
rw [h₄] at h₃
refine (div_le_iff₀ ?_).mpr h₃
positivity
theorem imo1973_p3
(S : Set (ℝ × ℝ))
(hS : S = {(a, b) | ∃ x : ℝ, x ^ 4 + a * x ^ 3 + b * x ^ 2 + a * x + 1 = 0}) :
IsLeast { x.1 ^ 2 + x.2 ^ 2 | x ∈ S } solution := by
constructor
· simp only [Prod.exists, Set.mem_setOf_eq]
use 4/5, -2/5
constructor
· simp only [hS, Set.mem_setOf_eq]
use -1
norm_num
· norm_num
· refine mem_lowerBounds.mpr ?_
simp only [Prod.exists, Set.mem_setOf_eq, forall_exists_index, and_imp]
intro x a b h₀ h₁
rw [←h₁]
refine aux_1 a b ?_
simpa only [hS, Set.mem_setOf_eq] using h₀
end Imo1973P3
| true | Copyright (c) 2025 Roozbeh Yousefzadeh. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1973, Problem 3
Let $a$ and $b$ be real numbers for which the equation
$x^4 + ax^3 + bx^2 + ax + 1 = 0$ has at least one real solution.
For all such pairs $(a, b)$, find the minimum value of $a^2 + b^2$.
-/
namespace Imo1973P3
noncomputable abbrev solution : ℝ := (4:ℝ)/5
lemma aux_1
(a b : ℝ)
(h₀ : ∃ (x : ℝ), x ^ 4 + a * x ^ 3 + b * x ^ 2 + a * x + 1 = 0) :
4 / 5 ≤ a^2 + b^2 := by
obtain ⟨x, h₁⟩ := h₀
let t := x + 1 / x
have ht₀: t = x + 1 / x := by rfl
have hx: x ≠ 0 := by
by_contra hc
rw [hc] at h₁
simp at h₁
have h₂: t ^ 2 + a * t + (b - 2) = 0 := by
rw [ht₀]
ring_nf
rw [mul_inv_cancel₀ hx]
simp only [one_mul, neg_add_cancel, zero_add, inv_pow]
have h₂₀: (x ^ 4 + a * x ^ 3 + b * x ^ 2 + a * x + 1) / (x ^ 2) = 0 / (x ^ 2) := by
exact congr(HDiv.hDiv $h₁ (x ^ 2))
ring_nf at h₂₀
have hx₁: x ^ 2 ≠ 0 := by exact pow_ne_zero 2 hx
rw [mul_comm (x ^ 2), mul_assoc b, inv_pow, mul_inv_cancel₀ hx₁, mul_one] at h₂₀
rw [mul_comm x a, mul_assoc a, pow_two, mul_inv,
← mul_assoc x, mul_inv_cancel₀ hx, one_mul] at h₂₀
rw [mul_comm _ a, mul_assoc a, ← pow_two, inv_pow, ← pow_sub₀ _ hx, ← pow_sub₀ _ hx] at h₂₀
all_goals try linarith
have ht₁: 2 ≤ abs t := by
have g₀: 1 * (x * x) + (-t) * x + 1 = 0 := by
rw [ht₀]
ring_nf
rw [mul_inv_cancel₀ hx]
exact sub_eq_zero_of_eq rfl
have g₁: discrim 1 (-t) 1 = (-t) ^ 2 - 4 * 1 * 1 := by exact rfl
simp at g₁
by_contra hc₀
push_neg at hc₀
have hc₁: t ^ 2 < 2 ^ 2 := by
refine sq_lt_sq.mpr ?_
refine lt_of_lt_of_le hc₀ ?_
norm_num
apply sub_neg_of_lt at hc₁
have hc₂: ∀ (s : ℝ), discrim 1 (-t) 1 ≠ s ^ 2 := by
intro s
have hs: 0 ≤ s ^ 2 := by exact sq_nonneg s
linarith
have hc₃: 1 * (x * x) + -t * x + 1 ≠ 0 := by
exact quadratic_ne_zero_of_discrim_ne_sq hc₂ x
exact hc₃ g₀
have ht₂: 0 < t ^ 2 := by
refine sq_pos_iff.mpr ?_
by_contra hc
rw [hc] at ht₁
simp at ht₁
linarith
have h₃: (a * t + b * 1) ^ 2 ≤ (a ^ 2 + b ^ 2) * (t ^ 2 + 1 ^ 2) := by
let s := Finset.range 2
let f : ℕ → ℝ := fun x => a * (1 - x) + b * x
let g : ℕ → ℝ := fun x => t * (1 - x) + 1 * x
have hhf: f = fun x:ℕ => a * (1 - x) + b * x := by rfl
have hhg: g = fun x:ℕ => t * (1 - x) + 1 * x := by rfl
have h₃₀: f 0 = a := by rw [hhf]; bound
have h₃₁: f 1 = b := by rw [hhf]; ring_nf
have h₃₂: g 0 = t := by rw [hhg]; ring_nf
have h₃₃: g 1 = 1 := by rw [hhg]; ring_nf
have h₃₄: a * t + b * 1 = ∑ i ∈ s, f i * g i := by
rw [Finset.sum_range_succ, Finset.sum_range_succ, Finset.sum_range_zero]
rw [h₃₀, h₃₁, h₃₂, h₃₃, zero_add]
rw [h₃₄]
have h₃₅: (∑ i ∈ s, f i * g i) ^ 2 ≤ (∑ i ∈ s, f i ^ 2) * ∑ i ∈ s, g i ^ 2 := by
exact Finset.sum_mul_sq_le_sq_mul_sq s f g
refine le_trans h₃₅ ?_
rw [Finset.sum_range_succ, Finset.sum_range_succ, Finset.sum_range_succ, Finset.sum_range_succ]
simp only [Finset.range_zero, Finset.sum_empty, zero_add, one_pow]
rw [h₃₀, h₃₁, h₃₂, h₃₃]
linarith
rw [mul_one, one_pow] at h₃
have h₄: (a * t + b) ^ 2 = (t ^ 2 - 2) ^ 2 := by
refine (pow_eq_pow_iff_of_ne_zero two_ne_zero).mpr ?_
right
constructor
· linarith
· decide
have h₅: 4 / 5 ≤ (t ^ 2 - 2) ^ 2 / (t ^ 2 + 1) := by
refine (div_le_div_iff₀ (by norm_num) ?_).mpr ?_
· positivity
· rw [mul_add, mul_one, sub_sq, add_mul, sub_mul, ← pow_mul]
norm_num
have h₅₀: 0 ≤ 5 * t ^ 4 + 16 - 24 * t ^ 2 := by
have h₅₁: 5 * t ^ 4 + 16 - 24 * t ^ 2 = (5 * t ^ 2 - 4) * (t ^ 2 - 4) := by ring_nf
have h₅₂: 2 ^ 2 ≤ t ^ 2 := by
refine sq_le_sq.mpr ?_
refine le_trans ?_ ht₁
norm_num
have h₅₃: 0 ≤ t ^ 2 - 4 := by linarith
have h₅₄: 0 ≤ 5 * t ^ 2 - 4 := by linarith
rw [h₅₁]
exact Left.mul_nonneg h₅₄ h₅₃
linarith
refine le_trans h₅ ?_
rw [h₄] at h₃
refine (div_le_iff₀ ?_).mpr h₃
positivity
theorem imo1973_p3
(S : Set (ℝ × ℝ))
(hS : S = {(a, b) | ∃ x : ℝ, x ^ 4 + a * x ^ 3 + b * x ^ 2 + a * x + 1 = 0}) :
IsLeast { x.1 ^ 2 + x.2 ^ 2 | x ∈ S } solution := by
constructor
· simp only [Prod.exists, Set.mem_setOf_eq]
use 4/5, -2/5
constructor
· simp only [hS, Set.mem_setOf_eq]
use -1
norm_num
· norm_num
· refine mem_lowerBounds.mpr ?_
simp only [Prod.exists, Set.mem_setOf_eq, forall_exists_index, and_imp]
intro x a b h₀ h₁
rw [←h₁]
refine aux_1 a b ?_
simpa only [hS, Set.mem_setOf_eq] using h₀
end Imo1973P3 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1973P3.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 600.0, "latency_s": 3.7796, "verified_at": "2026-03-26T18:16:30.740374+00:00"}} | true | true | false | 3.7796 |
compfiles_Imo1973P5 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1 , Shahar Blumentzvaig
-/
import Mathlib
/-!
# International Mathematical Olympiad 1973, Problem 5
$G$ is a set of non-constant functions of the real variable $x$ of the form
\[f(x) = ax + b, a \text{ and } b \text{ are real numbers,}\] and $G$ has the following properties:
(a) If $f$ and $g$ are in $G$, then $g \circ f$ is in $G$; here $(g \circ f)(x) = g[f(x)]$.
(b) If $f$ is in $G$, then its inverse $f^{-1}$ is in $G$;
here the inverse of $f(x) = ax + b$ is $f^{-1}(x) = (x - b) / a$.
(c) For every $f$ in $G$, there exists a real number $x_f$ such that $f(x_f) = x_f$.
Prove that there exists a real number $k$ such that $f(k) = k$ for all $f$ in $G$.
-/
namespace Imo1973P5
theorem imo1973_p5 {G : Set (ℝ → ℝ)}
(hf: ∀ f ∈ G, ∃ a b : ℝ, a ≠ 0 ∧ ∀ x : ℝ, f x = a * x + b)
(hG : ∀ f ∈ G, ∀ g ∈ G, g ∘ f ∈ G)
(hinv : ∀ f ∈ G, (Function.invFun f) ∈ G)
(hfix : ∀ f ∈ G, ∃ x, f x = x) :
∃ k : ℝ, ∀ f ∈ G, f k = k := by
by_cases hnep : Set.Nonempty G
· by_cases non_id : ∃f∈G , f≠id
· obtain ⟨f,hf1⟩ := non_id
obtain ⟨hf2,hf3⟩ := hf1
have h1 := hfix f hf2
obtain ⟨x,hx⟩ := h1
use x
intro g hg2
have hf3 := hf f hf2
obtain ⟨a,ha⟩ := hf3
obtain ⟨b,hb⟩ := ha
obtain ⟨hb1,hb2⟩ := hb
have hf3 := hf g hg2
obtain ⟨c,hc⟩ := hf3
obtain ⟨d,hd⟩ := hc
obtain ⟨hd1,hd2⟩ := hd
have r1 := hG f hf2 g hg2
have s1 : ∀x:ℝ , (g ∘ f) x = a*c*x + c*b+d := by
intro x
simp
rw [hb2 x, hd2 (a*x+b)]
grind
have r2 := hG g hg2 f hf2
have s2 : ∀x:ℝ , (f ∘ g) x = a*c*x + a*d+b := by
intro x
simp
rw [hd2 x, hb2 (c*x+d)]
grind
have r3 := hinv (g ∘ f) r1
have inj : Function.Injective (g ∘ f) := by
intro a1 a2
rw [s1,s1]
simp
intro h
rcases h with h1|h1|h1
· exact h1
· exfalso
exact hb1 h1
· exfalso
exact hd1 h1
have s3 : ∀x:ℝ , (Function.invFun (g ∘ f)) x = (1/(a*c))*x - (c*b+d)/(a*c) := by
intro x
have t : (g ∘ f) ((1/(a*c))*x - (c*b+d)/(a*c)) = x := by
rw [s1]
field_simp
ring
nth_rw 1 [← t]
rw [Function.leftInverse_invFun inj]
have r4 := hG (Function.invFun (g∘f)) r3 (f∘g) r2
have s4 : ∀x:ℝ , ((f ∘ g) ∘ Function.invFun (g ∘ f)) x = x + (a*d+b) - (c*b+d) := by
intro x
simp
rw [s3,hd2,hb2]
field_simp
ring
obtain ⟨y,hy⟩ := hfix (((f ∘ g) ∘ Function.invFun (g ∘ f))) r4
rw [s4] at hy
have h1 : (a * d + b) = (c * b + d) := by
grind
by_cases ha1 : a - 1 = 0
· replace ha1 : a = 1 := by
calc
a = (a-1)+1 := by ring
_ = 0+1 := by rw[ha1]
_ = 1 := by ring
rw [hb2, ha1] at hx
simp at hx
rw [ha1,hx] at hb2
simp at hb2
exfalso
have r : f = id := by
exact Function.forall_isFixedPt_iff.mp hb2
exact hf3 r
· grind
· push_neg at non_id
use 0
intro f hf2
rw [non_id f hf2]
rfl
· push_neg at hnep
use 0
intro f hf2
exfalso
rw [hnep] at hf2
exact hf2
end Imo1973P5 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1 , Shahar Blumentzvaig
-/
import Mathlib
/-!
# International Mathematical Olympiad 1973, Problem 5
$G$ is a set of non-constant functions of the real variable $x$ of the form
\[f(x) = ax + b, a \text{ and } b \text{ are real numbers,}\] and $G$ has the following properties:
(a) If $f$ and $g$ are in $G$, then $g \circ f$ is in $G$; here $(g \circ f)(x) = g[f(x)]$.
(b) If $f$ is in $G$, then its inverse $f^{-1}$ is in $G$;
here the inverse of $f(x) = ax + b$ is $f^{-1}(x) = (x - b) / a$.
(c) For every $f$ in $G$, there exists a real number $x_f$ such that $f(x_f) = x_f$.
Prove that there exists a real number $k$ such that $f(k) = k$ for all $f$ in $G$.
-/
namespace Imo1973P5
theorem imo1973_p5 {G : Set (ℝ → ℝ)}
(hf: ∀ f ∈ G, ∃ a b : ℝ, a ≠ 0 ∧ ∀ x : ℝ, f x = a * x + b)
(hG : ∀ f ∈ G, ∀ g ∈ G, g ∘ f ∈ G)
(hinv : ∀ f ∈ G, (Function.invFun f) ∈ G)
(hfix : ∀ f ∈ G, ∃ x, f x = x) :
∃ k : ℝ, ∀ f ∈ G, f k = k := by
by_cases hnep : Set.Nonempty G
· by_cases non_id : ∃f∈G , f≠id
· obtain ⟨f,hf1⟩ := non_id
obtain ⟨hf2,hf3⟩ := hf1
have h1 := hfix f hf2
obtain ⟨x,hx⟩ := h1
use x
intro g hg2
have hf3 := hf f hf2
obtain ⟨a,ha⟩ := hf3
obtain ⟨b,hb⟩ := ha
obtain ⟨hb1,hb2⟩ := hb
have hf3 := hf g hg2
obtain ⟨c,hc⟩ := hf3
obtain ⟨d,hd⟩ := hc
obtain ⟨hd1,hd2⟩ := hd
have r1 := hG f hf2 g hg2
have s1 : ∀x:ℝ , (g ∘ f) x = a*c*x + c*b+d := by
intro x
simp
rw [hb2 x, hd2 (a*x+b)]
grind
have r2 := hG g hg2 f hf2
have s2 : ∀x:ℝ , (f ∘ g) x = a*c*x + a*d+b := by
intro x
simp
rw [hd2 x, hb2 (c*x+d)]
grind
have r3 := hinv (g ∘ f) r1
have inj : Function.Injective (g ∘ f) := by
intro a1 a2
rw [s1,s1]
simp
intro h
rcases h with h1|h1|h1
· exact h1
· exfalso
exact hb1 h1
· exfalso
exact hd1 h1
have s3 : ∀x:ℝ , (Function.invFun (g ∘ f)) x = (1/(a*c))*x - (c*b+d)/(a*c) := by
intro x
have t : (g ∘ f) ((1/(a*c))*x - (c*b+d)/(a*c)) = x := by
rw [s1]
field_simp
ring
nth_rw 1 [← t]
rw [Function.leftInverse_invFun inj]
have r4 := hG (Function.invFun (g∘f)) r3 (f∘g) r2
have s4 : ∀x:ℝ , ((f ∘ g) ∘ Function.invFun (g ∘ f)) x = x + (a*d+b) - (c*b+d) := by
intro x
simp
rw [s3,hd2,hb2]
field_simp
ring
obtain ⟨y,hy⟩ := hfix (((f ∘ g) ∘ Function.invFun (g ∘ f))) r4
rw [s4] at hy
have h1 : (a * d + b) = (c * b + d) := by
grind
by_cases ha1 : a - 1 = 0
· replace ha1 : a = 1 := by
calc
a = (a-1)+1 := by ring
_ = 0+1 := by rw[ha1]
_ = 1 := by ring
rw [hb2, ha1] at hx
simp at hx
rw [ha1,hx] at hb2
simp at hb2
exfalso
have r : f = id := by
exact Function.forall_isFixedPt_iff.mp hb2
exact hf3 r
· grind
· push_neg at non_id
use 0
intro f hf2
rw [non_id f hf2]
rfl
· push_neg at hnep
use 0
intro f hf2
exfalso
rw [hnep] at hf2
exact hf2
end Imo1973P5
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1 , Shahar Blumentzvaig
-/
import Mathlib
/-!
# International Mathematical Olympiad 1973, Problem 5
$G$ is a set of non-constant functions of the real variable $x$ of the form
\[f(x) = ax + b, a \text{ and } b \text{ are real numbers,}\] and $G$ has the following properties:
(a) If $f$ and $g$ are in $G$, then $g \circ f$ is in $G$; here $(g \circ f)(x) = g[f(x)]$.
(b) If $f$ is in $G$, then its inverse $f^{-1}$ is in $G$;
here the inverse of $f(x) = ax + b$ is $f^{-1}(x) = (x - b) / a$.
(c) For every $f$ in $G$, there exists a real number $x_f$ such that $f(x_f) = x_f$.
Prove that there exists a real number $k$ such that $f(k) = k$ for all $f$ in $G$.
-/
namespace Imo1973P5
theorem imo1973_p5 {G : Set (ℝ → ℝ)}
(hf: ∀ f ∈ G, ∃ a b : ℝ, a ≠ 0 ∧ ∀ x : ℝ, f x = a * x + b)
(hG : ∀ f ∈ G, ∀ g ∈ G, g ∘ f ∈ G)
(hinv : ∀ f ∈ G, (Function.invFun f) ∈ G)
(hfix : ∀ f ∈ G, ∃ x, f x = x) :
∃ k : ℝ, ∀ f ∈ G, f k = k := by
by_cases hnep : Set.Nonempty G
· by_cases non_id : ∃f∈G , f≠id
· obtain ⟨f,hf1⟩ := non_id
obtain ⟨hf2,hf3⟩ := hf1
have h1 := hfix f hf2
obtain ⟨x,hx⟩ := h1
use x
intro g hg2
have hf3 := hf f hf2
obtain ⟨a,ha⟩ := hf3
obtain ⟨b,hb⟩ := ha
obtain ⟨hb1,hb2⟩ := hb
have hf3 := hf g hg2
obtain ⟨c,hc⟩ := hf3
obtain ⟨d,hd⟩ := hc
obtain ⟨hd1,hd2⟩ := hd
have r1 := hG f hf2 g hg2
have s1 : ∀x:ℝ , (g ∘ f) x = a*c*x + c*b+d := by
intro x
simp
rw [hb2 x, hd2 (a*x+b)]
grind
have r2 := hG g hg2 f hf2
have s2 : ∀x:ℝ , (f ∘ g) x = a*c*x + a*d+b := by
intro x
simp
rw [hd2 x, hb2 (c*x+d)]
grind
have r3 := hinv (g ∘ f) r1
have inj : Function.Injective (g ∘ f) := by
intro a1 a2
rw [s1,s1]
simp
intro h
rcases h with h1|h1|h1
· exact h1
· exfalso
exact hb1 h1
· exfalso
exact hd1 h1
have s3 : ∀x:ℝ , (Function.invFun (g ∘ f)) x = (1/(a*c))*x - (c*b+d)/(a*c) := by
intro x
have t : (g ∘ f) ((1/(a*c))*x - (c*b+d)/(a*c)) = x := by
rw [s1]
field_simp
ring
nth_rw 1 [← t]
rw [Function.leftInverse_invFun inj]
have r4 := hG (Function.invFun (g∘f)) r3 (f∘g) r2
have s4 : ∀x:ℝ , ((f ∘ g) ∘ Function.invFun (g ∘ f)) x = x + (a*d+b) - (c*b+d) := by
intro x
simp
rw [s3,hd2,hb2]
field_simp
ring
obtain ⟨y,hy⟩ := hfix (((f ∘ g) ∘ Function.invFun (g ∘ f))) r4
rw [s4] at hy
have h1 : (a * d + b) = (c * b + d) := by
grind
by_cases ha1 : a - 1 = 0
· replace ha1 : a = 1 := by
calc
a = (a-1)+1 := by ring
_ = 0+1 := by rw[ha1]
_ = 1 := by ring
rw [hb2, ha1] at hx
simp at hx
rw [ha1,hx] at hb2
simp at hb2
exfalso
have r : f = id := by
exact Function.forall_isFixedPt_iff.mp hb2
exact hf3 r
· grind
· push_neg at non_id
use 0
intro f hf2
rw [non_id f hf2]
rfl
· push_neg at hnep
use 0
intro f hf2
exfalso
rw [hnep] at hf2
exact hf2
end Imo1973P5 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1973P5.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["`grind` failed\ncase grind\nG : Set (\u211d \u2192 \u211d)\nhf : \u2200 f \u2208 G, \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f x_1 = a * x_1 + x\nhG : \u2200 f \u2208 G, \u2200 g \u2208 G, g \u2218 f \u2208 G\nhinv : \u2200 f \u2208 G, Function.invFun f \u2208 G\nhfix : \u2200 f \u2208 G, \u2203 x, f x = x\nhnep : G.Nonempty\nf : \u211d \u2192 \u211d\nhf2 : f \u2208 G\nhf3 : \u00acf = id\nx : \u211d\nhx : f x = x\ng : \u211d \u2192 \u211d\nhg2 : g \u2208 G\na b : \u211d\nhb1 : \u00aca = 0\nhb2 : \u2200 (x : \u211d), f x = a * x + b\nc d : \u211d\nhd1 : \u00acc = 0\nhd2 : \u2200 (x : \u211d), g x = c * x + d\nr1 : g \u2218 f \u2208 G\ns1 : \u2200 (x : \u211d), g (f x) = a * c * x + c * b + d\nr2 : f \u2218 g \u2208 G\ns2 : \u2200 (x : \u211d), f (g x) = a * c * x + a * d + b\nr3 : Function.invFun (g \u2218 f) \u2208 G\ninj : Function.Injective (g \u2218 f)\ns3 : \u2200 (x : \u211d), Function.invFun (g \u2218 f) x = 1 / (a * c) * x - (c * b + d) / (a * c)\nr4 : (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\ns4 : \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) x)) = x + (a * d + b) - (c * b + d)\ny : \u211d\nhy : y + (a * d + b) - (c * b + d) = y\nh1 : a * d + b = c * b + d\nha1 : \u00aca - 1 = 0\nh : \u00acg x = x\nw : \u211d\nh_1 : f w = w\nw_1 : \u211d\nh_2 : g w_1 = w_1\nw_2 : \u211d\nh_3 : g (f w_2) = w_2\nw_3 : \u211d\nh_4 : f (g w_3) = w_3\nw_4 : \u211d\nh_5 : Function.invFun (g \u2218 f) w_4 = w_4\nw_5 : \u211d\nh_6 : f (g (Function.invFun (g \u2218 f) w_5)) = w_5\nw_6 : \u211d\nleft : \u00acw_6 = 0\nw_7 : \u211d\nh_8 : \u2200 (x : \u211d), f x = w_6 * x + w_7\nw_8 : \u211d\nleft_1 : \u00acw_8 = 0\nw_9 : \u211d\nh_10 : \u2200 (x : \u211d), g x = w_8 * x + w_9\nw_10 : \u211d\nleft_2 : \u00acw_10 = 0\nw_11 : \u211d\nh_12 : \u2200 (x : \u211d), g (f x) = w_10 * x + w_11\nw_12 : \u211d\nleft_3 : \u00acw_12 = 0\nw_13 : \u211d\nh_14 : \u2200 (x : \u211d), f (g x) = w_12 * x + w_13\nw_14 : \u211d\nleft_4 : \u00acw_14 = 0\nw_15 : \u211d\nh_16 : \u2200 (x : \u211d), Function.invFun (g \u2218 f) x = w_14 * x + w_15\nw_16 : \u211d\nleft_5 : \u00acw_16 = 0\nw_17 : \u211d\nh_18 : \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) x)) = w_16 * x + w_17\nw_18 : \u211d\nh_19 : \u00acf w_18 = id w_18\nw_19 : \u211d\nleft_6 : \u00acw_19 = 0\nw_20 : \u211d\nh_21 : \u2200 (x : \u211d), f (g (f (g x))) = w_19 * x + w_20\nw_21 : \u211d\nleft_7 : \u00acw_21 = 0\nw_22 : \u211d\nh_23 : \u2200 (x : \u211d), Function.invFun (g \u2218 f) (f (g x)) = w_21 * x + w_22\nw_23 : \u211d\nleft_8 : \u00acw_23 = 0\nw_24 : \u211d\nh_25 : \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) (f (g x)))) = w_23 * x + w_24\nw_25 : \u211d\nleft_9 : \u00acw_25 = 0\nw_26 : \u211d\nh_27 : \u2200 (x : \u211d), g (g (f x)) = w_25 * x + w_26\nw_27 : \u211d\nleft_10 : \u00acw_27 = 0\nw_28 : \u211d\nh_29 : \u2200 (x : \u211d), g (f (g (f x))) = w_27 * x + w_28\nw_29 : \u211d\nleft_11 : \u00acw_29 = 0\nw_30 : \u211d\nh_31 : \u2200 (x : \u211d), f (g (g (f x))) = w_29 * x + w_30\nw_31 : \u211d\nleft_12 : \u00acw_31 = 0\nw_32 : \u211d\nh_33 : \u2200 (x : \u211d), Function.invFun (g \u2218 f) (g (f x)) = w_31 * x + w_32\nw_33 : \u211d\nleft_13 : \u00acw_33 = 0\nw_34 : \u211d\nh_35 : \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) (g (f x)))) = w_33 * x + w_34\nw_35 : \u211d\nleft_14 : \u00acw_35 = 0\nw_36 : \u211d\nh_37 : \u2200 (x : \u211d), g (g x) = w_35 * x + w_36\nw_37 : \u211d\nleft_15 : \u00acw_37 = 0\nw_38 : \u211d\nh_39 : \u2200 (x : \u211d), g (f (g x)) = w_37 * x + w_38\nw_39 : \u211d\nleft_16 : \u00acw_39 = 0\nw_40 : \u211d\nh_41 : \u2200 (x : \u211d), f (g (g x)) = w_39 * x + w_40\nw_41 : \u211d\nleft_17 : \u00acw_41 = 0\nw_42 : \u211d\nh_43 : \u2200 (x : \u211d), Function.invFun (g \u2218 f) (g x) = w_41 * x + w_42\nw_43 : \u211d\nleft_18 : \u00acw_43 = 0\nw_44 : \u211d\nh_45 : \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) (g x))) = w_43 * x + w_44\nw_45 : \u211d\nleft_19 : \u00acw_45 = 0\nw_46 : \u211d\nh_47 : \u2200 (x : \u211d), f (f x) = w_45 * x + w_46\nw_47 : \u211d\nleft_20 : \u00acw_47 = 0\nw_48 : \u211d\nh_49 : \u2200 (x : \u211d), g (f (f x)) = w_47 * x + w_48\nw_49 : \u211d\nleft_21 : \u00acw_49 = 0\nw_50 : \u211d\nh_51 : \u2200 (x : \u211d), f (g (f x)) = w_49 * x + w_50\nw_51 : \u211d\nleft_22 : \u00acw_51 = 0\nw_52 : \u211d\nh_53 : \u2200 (x : \u211d), Function.invFun (g \u2218 f) (f x) = w_51 * x + w_52\nw_53 : \u211d\nleft_23 : \u00acw_53 = 0\nw_54 : \u211d\nh_55 : \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) (f x))) = w_53 * x + w_54\nw_55 : \u211d\nleft_24 : \u00acw_55 = 0\nw_56 : \u211d\nh_57 : \u2200 (x : \u211d), Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) x = w_55 * x + w_56\nw_57 : \u211d\nleft_25 : \u00acw_57 = 0\nw_58 : \u211d\nh_59 : \u2200 (x : \u211d), Function.invFun (Function.invFun (g \u2218 f)) x = w_57 * x + w_58\nw_59 : \u211d\nleft_26 : \u00acw_59 = 0\nw_60 : \u211d\nh_61 : \u2200 (x : \u211d), Function.invFun (f \u2218 g) x = w_59 * x + w_60\nw_61 : \u211d\nleft_27 : \u00acw_61 = 0\nw_62 : \u211d\nh_63 : \u2200 (x : \u211d), Function.invFun g x = w_61 * x + w_62\nw_63 : \u211d\nleft_28 : \u00acw_63 = 0\nw_64 : \u211d\nh_65 : \u2200 (x : \u211d), Function.invFun f x = w_63 * x + w_64\nw_65 : \u211d\nleft_29 : \u00acw_65 = 0\nw_66 : \u211d\nh_67 : \u2200 (x : \u211d), f (f (g (Function.invFun (g \u2218 f) x))) = w_65 * x + w_66\nw_67 : \u211d\nleft_30 : \u00acw_67 = 0\nw_68 : \u211d\nh_69 : \u2200 (x : \u211d), g (f (g (Function.invFun (g \u2218 f) x))) = w_67 * x + w_68\nw_69 : \u211d\nleft_31 : \u00acw_69 = 0\nw_70 : \u211d\nh_71 : \u2200 (x : \u211d), g (f (f (g (Function.invFun (g \u2218 f) x)))) = w_69 * x + w_70\nw_71 : \u211d\nleft_32 : \u00acw_71 = 0\nw_72 : \u211d\nh_73 : \u2200 (x : \u211d), f (g (f (g (Function.invFun (g \u2218 f) x)))) = w_71 * x + w_72\nw_73 : \u211d\nleft_33 : \u00acw_73 = 0\nw_74 : \u211d\nh_75 : \u2200 (x : \u211d), Function.invFun (g \u2218 f) (f (g (Function.invFun (g \u2218 f) x))) = w_73 * x + w_74\nw_75 : \u211d\nleft_34 : \u00acw_75 = 0\nw_76 : \u211d\nh_77 : \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) (f (g (Function.invFun (g \u2218 f) x))))) = w_75 * x + w_76\nw_77 : \u211d\nleft_35 : \u00acw_77 = 0\nw_78 : \u211d\nh_79 : \u2200 (x : \u211d), f (Function.invFun (g \u2218 f) x) = w_77 * x + w_78\nw_79 : \u211d\nleft_36 : \u00acw_79 = 0\nw_80 : \u211d\nh_81 : \u2200 (x : \u211d), g (Function.invFun (g \u2218 f) x) = w_79 * x + w_80\nw_81 : \u211d\nleft_37 : \u00acw_81 = 0\nw_82 : \u211d\nh_83 : \u2200 (x : \u211d), g (f (Function.invFun (g \u2218 f) x)) = w_81 * x + w_82\nw_83 : \u211d\nleft_38 : \u00acw_83 = 0\nw_84 : \u211d\nh_85 : \u2200 (x : \u211d), Function.invFun (g \u2218 f) (Function.invFun (g \u2218 f) x) = w_83 * x + w_84\nw_85 : \u211d\nleft_39 : \u00acw_85 = 0\nw_86 : \u211d\nh_87 : \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) (Function.invFun (g \u2218 f) x))) = w_85 * x + w_86\nw_87 : \u211d\nleft_40 : \u00acw_87 = 0\nw_88 : \u211d\nh_89 : \u2200 (x : \u211d), f (f (g x)) = w_87 * x + w_88\nw_89 : \u211d\nleft_41 : \u00acw_89 = 0\nw_90 : \u211d\nh_91 : \u2200 (x : \u211d), g (f (f (g x))) = w_89 * x + w_90\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] \u2200 f \u2208 G, \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f x_1 = a * x_1 + x\n [prop] \u2200 f \u2208 G, \u2200 g \u2208 G, g \u2218 f \u2208 G\n [prop] \u2200 f \u2208 G, Function.invFun f \u2208 G\n [prop] \u2200 f \u2208 G, \u2203 x, f x = x\n [prop] G.Nonempty\n [prop] f \u2208 G\n [prop] \u00acf = id\n [prop] f x = x\n [prop] g \u2208 G\n [prop] \u00aca = 0\n [prop] \u2200 (x : \u211d), f x = a * x + b\n [prop] \u00acc = 0\n [prop] \u2200 (x : \u211d), g x = c * x + d\n [prop] g \u2218 f \u2208 G\n [prop] \u2200 (x : \u211d), g (f x) = a * c * x + c * b + d\n [prop] f \u2218 g \u2208 G\n [prop] \u2200 (x : \u211d), f (g x) = a * c * x + a * d + b\n [prop] Function.invFun (g \u2218 f) \u2208 G\n [prop] Function.Injective (g \u2218 f)\n [prop] \u2200 (x : \u211d), Function.invFun (g \u2218 f) x = 1 / (a * c) * x - (c * b + d) / (a * c)\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) x)) = x + (a * d + b) - (c * b + d)\n [prop] y + (a * d + b) - (c * b + d) = y\n [prop] a * d + b = c * b + d\n [prop] \u00aca - 1 = 0\n [prop] \u00acg x = x\n [prop] \u2203 x, \u00acf x = id x\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) x_1)) = a * x_1 + x\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) x_1 = a * x_1 + x\n [prop] f \u2218 g \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g x_1) = a * x_1 + x\n [prop] g \u2218 f \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f x_1) = a * x_1 + x\n [prop] g \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g x_1 = a * x_1 + x\n [prop] f \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f x_1 = a * x_1 + x\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 f \u2208 G \u2192 f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 g \u2208 G \u2192 g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 g \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 g \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] g \u2208 G \u2192 f \u2208 G \u2192 f \u2218 g \u2208 G\n [prop] g \u2208 G \u2192 g \u2208 G \u2192 g \u2218 g \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G\n [prop] g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G\n [prop] g \u2208 G \u2192 Function.invFun g \u2208 G\n [prop] f \u2208 G \u2192 Function.invFun f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 \u2203 x, f (g (Function.invFun (g \u2218 f) x)) = x\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 \u2203 x, Function.invFun (g \u2218 f) x = x\n [prop] f \u2218 g \u2208 G \u2192 \u2203 x, f (g x) = x\n [prop] g \u2218 f \u2208 G \u2192 \u2203 x, g (f x) = x\n [prop] g \u2208 G \u2192 \u2203 x, g x = x\n [prop] f \u2208 G \u2192 \u2203 x, f x = x\n [prop] f x = a * x + b\n [prop] g x = c * x + d\n [prop] g (f x) = a * c * x + c * b + d\n [prop] f (g x) = a * c * x + a * d + b\n [prop] Function.invFun f \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun f x_1 = a * x_1 + x\n [prop] Function.invFun g \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun g x_1 = a * x_1 + x\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (f \u2218 g) x_1 = a * x_1 + x\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (Function.invFun (g \u2218 f)) x_1 = a * x_1 + x\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) x_1 = a * x_1 + x\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (f x_1))) = a * x_1 + x\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (f x_1) = a * x_1 + x\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (f x_1)) = a * x_1 + x\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (f x_1)) = a * x_1 + x\n [prop] f \u2218 f \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (f x_1) = a * x_1 + x\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (g x_1))) = a * x_1 + x\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (g x_1) = a * x_1 + x\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (g x_1)) = a * x_1 + x\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (g x_1)) = a * x_1 + x\n [prop] g \u2218 g \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (g x_1) = a * x_1 + x\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (g (f x_1)))) = a * x_1 + x\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (g (f x_1)) = a * x_1 + x\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (g (f x_1))) = a * x_1 + x\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (g (f x_1))) = a * x_1 + x\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (g (f x_1)) = a * x_1 + x\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (f x_1)) = a * x_1 + x\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (f (g x_1)))) = a * x_1 + x\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (f (g x_1)) = a * x_1 + x\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (f (g x_1))) = a * x_1 + x\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (f (g x_1))) = a * x_1 + x\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (g x_1)) = a * x_1 + x\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (f (g x_1)) = a * x_1 + x\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (Function.invFun (g \u2218 f) x_1))) = a * x_1 + x\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (Function.invFun (g \u2218 f) x_1) = a * x_1 + x\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (Function.invFun (g \u2218 f) x_1)) = a * x_1 + x\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (Function.invFun (g \u2218 f) x_1) = a * x_1 + x\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (Function.invFun (g \u2218 f) x_1) = a * x_1 + x\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a,\n \u00aca = 0 \u2227\n \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (f (g (Function.invFun (g \u2218 f) x_1))))) = a * x_1 + x\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (f (g (Function.invFun (g \u2218 f) x_1))) = a * x_1 + x\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (f (g (Function.invFun (g \u2218 f) x_1)))) = a * x_1 + x\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (f (g (Function.invFun (g \u2218 f) x_1)))) = a * x_1 + x\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (g (Function.invFun (g \u2218 f) x_1))) = a * x_1 + x\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (f (g (Function.invFun (g \u2218 f) x_1))) = a * x_1 + x\n [prop] Function.invFun f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 f \u2208 G \u2192 f \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 g \u2208 G \u2192 g \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 f \u2208 G \u2192 f \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 g \u2208 G \u2192 g \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 f \u2208 G \u2192 f \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 g \u2208 G \u2192 g \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208\n G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n Function.invFun (Function.invFun (g \u2218 f)) \u2208\n G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218\n Function.invFun (Function.invFun (g \u2218 f)) \u2208\n G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2208 G \u2192 f \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2208 G \u2192 g \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208\n G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208\n G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208\n G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208\n G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208\n G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 f \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 f \u2208 G \u2192 f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 g \u2208 G \u2192 g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 f \u2208 G \u2192 f \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 g \u2208 G \u2192 g \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2208 G \u2192 f \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2208 G \u2192 g \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 f \u2208 G \u2192 f \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 g \u2208 G \u2192 g \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 g \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208\n G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f w = w\n [prop] g w_1 = w_1\n [prop] g (f w_2) = w_2\n [prop] f (g w_3) = w_3\n [prop] Function.invFun (g \u2218 f) w_4 = w_4\n [prop] f (g (Function.invFun (g \u2218 f) w_5)) = w_5\n [prop] \u00acw_6 = 0\n [prop] \u2200 (x : \u211d), f x = w_6 * x + w_7\n [prop] \u00acw_8 = 0\n [prop] \u2200 (x : \u211d), g x = w_8 * x + w_9\n [prop] \u00acw_10 = 0\n [prop] \u2200 (x : \u211d), g (f x) = w_10 * x + w_11\n [prop] \u00acw_12 = 0\n [prop] \u2200 (x : \u211d), f (g x) = w_12 * x + w_13\n [prop] \u00acw_14 = 0\n [prop] \u2200 (x : \u211d), Function.invFun (g \u2218 f) x = w_14 * x + w_15\n [prop] \u00acw_16 = 0\n [prop] \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) x)) = w_16 * x + w_17\n [prop] \u00acf w_18 = id w_18\n [prop] \u00acw_19 = 0\n [prop] \u2200 (x : \u211d), f (g (f (g x))) = w_19 * x + w_20\n [prop] \u00acw_21 = 0\n [prop] \u2200 (x : \u211d), Function.invFun (g \u2218 f) (f (g x)) = w_21 * x + w_22\n [prop] \u00acw_23 = 0\n [prop] \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) (f (g x)))) = w_23 * x + w_24\n [prop] \u00acw_25 = 0\n [prop] \u2200 (x : \u211d), g (g (f x)) = w_25 * x + w_26\n [prop] \u00acw_27 = 0\n [prop] \u2200 (x : \u211d), g (f (g (f x))) = w_27 * x + w_28\n [prop] \u00acw_29 = 0\n [prop] \u2200 (x : \u211d), f (g (g (f x))) = w_29 * x + w_30\n [prop] \u00acw_31 = 0\n [prop] \u2200 (x : \u211d), Function.invFun (g \u2218 f) (g (f x)) = w_31 * x + w_32\n [prop] \u00acw_33 = 0\n [prop] \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) (g (f x)))) = w_33 * x + w_34\n [prop] \u00acw_35 = 0\n [prop] \u2200 (x : \u211d), g (g x) = w_35 * x + w_36\n [prop] \u00acw_37 = 0\n [prop] \u2200 (x : \u211d), g (f (g x)) = w_37 * x + w_38\n [prop] \u00acw_39 = 0\n [prop] \u2200 (x : \u211d), f (g (g x)) = w_39 * x + w_40\n [prop] \u00acw_41 = 0\n [prop] \u2200 (x : \u211d), Function.invFun (g \u2218 f) (g x) = w_41 * x + w_42\n [prop] \u00acw_43 = 0\n [prop] \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) (g x))) = w_43 * x + w_44\n [prop] \u00acw_45 = 0\n [prop] \u2200 (x : \u211d), f (f x) = w_45 * x + w_46\n [prop] \u00acw_47 = 0\n [prop] \u2200 (x : \u211d), g (f (f x)) = w_47 * x + w_48\n [prop] \u00acw_49 = 0\n [prop] \u2200 (x : \u211d), f (g (f x)) = w_49 * x + w_50\n [prop] \u00acw_51 = 0\n [prop] \u2200 (x : \u211d), Function.invFun (g \u2218 f) (f x) = w_51 * x + w_52\n [prop] \u00acw_53 = 0\n [prop] \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) (f x))) = w_53 * x + w_54\n [prop] \u00acw_55 = 0\n [prop] \u2200 (x : \u211d), Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) x = w_55 * x + w_56\n [prop] \u00acw_57 = 0\n [prop] \u2200 (x : \u211d), Function.invFun (Function.invFun (g \u2218 f)) x = w_57 * x + w_58\n [prop] \u00acw_59 = 0\n [prop] \u2200 (x : \u211d), Function.invFun (f \u2218 g) x = w_59 * x + w_60\n [prop] \u00acw_61 = 0\n [prop] \u2200 (x : \u211d), Function.invFun g x = w_61 * x + w_62\n [prop] \u00acw_63 = 0\n [prop] \u2200 (x : \u211d), Function.invFun f x = w_63 * x + w_64\n [prop] \u00acw_65 = 0\n [prop] \u2200 (x : \u211d), f (f (g (Function.invFun (g \u2218 f) x))) = w_65 * x + w_66\n [prop] \u00acw_67 = 0\n [prop] \u2200 (x : \u211d), g (f (g (Function.invFun (g \u2218 f) x))) = w_67 * x + w_68\n [prop] \u00acw_69 = 0\n [prop] \u2200 (x : \u211d), g (f (f (g (Function.invFun (g \u2218 f) x)))) = w_69 * x + w_70\n [prop] \u00acw_71 = 0\n [prop] \u2200 (x : \u211d), f (g (f (g (Function.invFun (g \u2218 f) x)))) = w_71 * x + w_72\n [prop] \u00acw_73 = 0\n [prop] \u2200 (x : \u211d), Function.invFun (g \u2218 f) (f (g (Function.invFun (g \u2218 f) x))) = w_73 * x + w_74\n [prop] \u00acw_75 = 0\n [prop] \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) (f (g (Function.invFun (g \u2218 f) x))))) = w_75 * x + w_76\n [prop] \u00acw_77 = 0\n [prop] \u2200 (x : \u211d), f (Function.invFun (g \u2218 f) x) = w_77 * x + w_78\n [prop] \u00acw_79 = 0\n [prop] \u2200 (x : \u211d), g (Function.invFun (g \u2218 f) x) = w_79 * x + w_80\n [prop] \u00acw_81 = 0\n [prop] \u2200 (x : \u211d), g (f (Function.invFun (g \u2218 f) x)) = w_81 * x + w_82\n [prop] \u00acw_83 = 0\n [prop] \u2200 (x : \u211d), Function.invFun (g \u2218 f) (Function.invFun (g \u2218 f) x) = w_83 * x + w_84\n [prop] \u00acw_85 = 0\n [prop] \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) (Function.invFun (g \u2218 f) x))) = w_85 * x + w_86\n [prop] \u00acw_87 = 0\n [prop] \u2200 (x : \u211d), f (f (g x)) = w_87 * x + w_88\n [prop] \u00acw_89 = 0\n [prop] \u2200 (x : \u211d), g (f (f (g x))) = w_89 * x + w_90\n [eqc] True propositions\n [prop] \u2200 f \u2208 G, \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f x_1 = a * x_1 + x\n [prop] \u2200 f \u2208 G, \u2200 g \u2208 G, g \u2218 f \u2208 G\n [prop] \u2200 f \u2208 G, Function.invFun f \u2208 G\n [prop] Nonempty \u211d\n [prop] \u2200 f \u2208 G, \u2203 x, f x = x\n [prop] G.Nonempty\n [prop] f \u2208 G\n [prop] g \u2208 G\n [prop] \u2200 (x : \u211d), f x = a * x + b\n [prop] \u2200 (x : \u211d), g x = c * x + d\n [prop] g \u2218 f \u2208 G\n [prop] \u2200 (x : \u211d), g (f x) = a * c * x + c * b + d\n [prop] f \u2218 g \u2208 G\n [prop] \u2200 (x : \u211d), f (g x) = a * c * x + a * d + b\n [prop] Function.invFun (g \u2218 f) \u2208 G\n [prop] Function.Injective (g \u2218 f)\n [prop] \u2200 (x : \u211d), Function.invFun (g \u2218 f) x = 1 / (a * c) * x - (c * b + d) / (a * c)\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) x)) = x + (a * d + b) - (c * b + d)\n [prop] \u2203 x, \u00acf x = id x\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) x_1)) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) x_1)) = a * x_1 + x\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) x_1 = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) x_1 = a * x_1 + x\n [prop] f \u2218 g \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g x_1) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g x_1) = a * x_1 + x\n [prop] g \u2218 f \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f x_1) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f x_1) = a * x_1 + x\n [prop] g \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g x_1 = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g x_1 = a * x_1 + x\n [prop] f \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f x_1 = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f x_1 = a * x_1 + x\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 f \u2208 G \u2192 f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 g \u2208 G \u2192 g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 g \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 g \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] g \u2208 G \u2192 f \u2208 G \u2192 f \u2218 g \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 g \u2208 G\n [prop] g \u2208 G \u2192 g \u2208 G \u2192 g \u2218 g \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G\n [prop] g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 f \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G\n [prop] g \u2208 G \u2192 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G\n [prop] f \u2208 G \u2192 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 \u2203 x, f (g (Function.invFun (g \u2218 f) x)) = x\n [prop] \u2203 x, f (g (Function.invFun (g \u2218 f) x)) = x\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 \u2203 x, Function.invFun (g \u2218 f) x = x\n [prop] \u2203 x, Function.invFun (g \u2218 f) x = x\n [prop] f \u2218 g \u2208 G \u2192 \u2203 x, f (g x) = x\n [prop] \u2203 x, f (g x) = x\n [prop] g \u2218 f \u2208 G \u2192 \u2203 x, g (f x) = x\n [prop] \u2203 x, g (f x) = x\n [prop] g \u2208 G \u2192 \u2203 x, g x = x\n [prop] \u2203 x, g x = x\n [prop] f \u2208 G \u2192 \u2203 x, f x = x\n [prop] \u2203 x, f x = x\n [prop] Function.invFun f \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun f x_1 = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun f x_1 = a * x_1 + x\n [prop] Function.invFun g \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun g x_1 = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun g x_1 = a * x_1 + x\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (f \u2218 g) x_1 = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (f \u2218 g) x_1 = a * x_1 + x\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (Function.invFun (g \u2218 f)) x_1 = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (Function.invFun (g \u2218 f)) x_1 = a * x_1 + x\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) x_1 = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) x_1 = a * x_1 + x\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (f x_1))) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (f x_1))) = a * x_1 + x\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (f x_1) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (f x_1) = a * x_1 + x\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (f x_1)) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (f x_1)) = a * x_1 + x\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (f x_1)) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (f x_1)) = a * x_1 + x\n [prop] f \u2218 f \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (f x_1) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (f x_1) = a * x_1 + x\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (g x_1))) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (g x_1))) = a * x_1 + x\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (g x_1) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (g x_1) = a * x_1 + x\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (g x_1)) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (g x_1)) = a * x_1 + x\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (g x_1)) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (g x_1)) = a * x_1 + x\n [prop] g \u2218 g \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (g x_1) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (g x_1) = a * x_1 + x\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (g (f x_1)))) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (g (f x_1)))) = a * x_1 + x\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (g (f x_1)) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (g (f x_1)) = a * x_1 + x\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (g (f x_1))) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (g (f x_1))) = a * x_1 + x\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (g (f x_1))) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (g (f x_1))) = a * x_1 + x\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (g (f x_1)) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (g (f x_1)) = a * x_1 + x\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (f x_1)) = a * x_1 + x\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (f (g x_1)))) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (f (g x_1)))) = a * x_1 + x\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (f (g x_1)) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (f (g x_1)) = a * x_1 + x\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (f (g x_1))) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (f (g x_1))) = a * x_1 + x\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (f (g x_1))) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (f (g x_1))) = a * x_1 + x\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (g x_1)) = a * x_1 + x\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (f (g x_1)) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (f (g x_1)) = a * x_1 + x\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (Function.invFun (g \u2218 f) x_1))) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (Function.invFun (g \u2218 f) x_1))) = a * x_1 + x\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (Function.invFun (g \u2218 f) x_1) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (Function.invFun (g \u2218 f) x_1) = a * x_1 + x\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (Function.invFun (g \u2218 f) x_1)) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (Function.invFun (g \u2218 f) x_1)) = a * x_1 + x\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (Function.invFun (g \u2218 f) x_1) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (Function.invFun (g \u2218 f) x_1) = a * x_1 + x\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (Function.invFun (g \u2218 f) x_1) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (Function.invFun (g \u2218 f) x_1) = a * x_1 + x\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a,\n \u00aca = 0 \u2227\n \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (f (g (Function.invFun (g \u2218 f) x_1))))) = a * x_1 + x\n [prop] \u2203 a,\n \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (f (g (Function.invFun (g \u2218 f) x_1))))) = a * x_1 + x\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (f (g (Function.invFun (g \u2218 f) x_1))) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (f (g (Function.invFun (g \u2218 f) x_1))) = a * x_1 + x\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (f (g (Function.invFun (g \u2218 f) x_1)))) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (f (g (Function.invFun (g \u2218 f) x_1)))) = a * x_1 + x\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (f (g (Function.invFun (g \u2218 f) x_1)))) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (f (g (Function.invFun (g \u2218 f) x_1)))) = a * x_1 + x\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (g (Function.invFun (g \u2218 f) x_1))) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (g (Function.invFun (g \u2218 f) x_1))) = a * x_1 + x\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (f (g (Function.invFun (g \u2218 f) x_1))) = a * x_1 + x\n [prop] \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (f (g (Function.invFun (g \u2218 f) x_1))) = a * x_1 + x\n [prop] Function.invFun f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 Function.invFun f \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 Function.invFun f \u2208 G\n [prop] f \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 Function.invFun f \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 Function.invFun f \u2208 G\n [prop] g \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] (g \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] (g \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] ((g \u2218 f) \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] ((f \u2218 g) \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] (f \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] ((g \u2218 f) \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] ((f \u2218 g) \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun g \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun f \u2218 Function.invFun f \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 f \u2208 G \u2192 f \u2218 Function.invFun g \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 Function.invFun g \u2208 G\n [prop] f \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 g \u2208 G \u2192 g \u2218 Function.invFun g \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 Function.invFun g \u2208 G\n [prop] g \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] (g \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] (g \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] ((g \u2218 f) \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] ((f \u2218 g) \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] (f \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] ((g \u2218 f) \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] ((f \u2218 g) \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun f \u2218 Function.invFun g \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 f \u2208 G \u2192 f \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] f \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 g \u2208 G \u2192 g \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] g \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (g \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (g \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] ((g \u2218 f) \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] ((f \u2218 g) \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (f \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] ((g \u2218 f) \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] ((f \u2218 g) \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun g \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun f \u2218 Function.invFun (f \u2218 g) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 f \u2208 G \u2192 f \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] f \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 g \u2208 G \u2192 g \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] g \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208\n G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n Function.invFun (Function.invFun (g \u2218 f)) \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n Function.invFun (Function.invFun (g \u2218 f)) \u2208\n G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n Function.invFun (Function.invFun (g \u2218 f)) \u2208\n G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218\n Function.invFun (Function.invFun (g \u2218 f)) \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208\n G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208\n G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((g \u2218 f) \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((g \u2218 f) \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun g \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun f \u2218 Function.invFun (Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2208 G \u2192 f \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] f \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2208 G \u2192 g \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] g \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208\n G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208\n G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208\n G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208\n G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208\n G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208\n G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208\n G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208\n G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((g \u2218 f) \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((g \u2218 f) \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208\n G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun g \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] Function.invFun f \u2218 Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208\n G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (g \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (g \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (f \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] Function.invFun g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] Function.invFun f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun g \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun f \u2218 Function.invFun (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (g \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (g \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] Function.invFun g \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] Function.invFun f \u2218 (f \u2218 g) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] g \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun g \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] Function.invFun f \u2218 (g \u2218 f) \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 f \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 f \u2218 f \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 f \u2218 f \u2208 G\n [prop] g \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] (g \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] (g \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] (f \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 f \u2218 f \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 f \u2218 f \u2208 G\n [prop] Function.invFun g \u2218 f \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 f \u2218 f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 f \u2218 f \u2208 G\n [prop] Function.invFun f \u2218 f \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 f \u2208 G \u2192 f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 g \u2208 G \u2192 g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208\n G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (g \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (g \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (f \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] Function.invFun g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] Function.invFun f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun g \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun f \u2218 Function.invFun (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 f \u2208 G \u2192 f \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 g \u2208 G \u2192 g \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (g \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (g \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] Function.invFun g \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] Function.invFun f \u2218 (f \u2218 g) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2208 G \u2192 f \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] f \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2208 G \u2192 g \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun g \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] Function.invFun f \u2218 (g \u2218 f) \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 f \u2208 G \u2192 f \u2218 g \u2218 g \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 g \u2218 g \u2208 G\n [prop] f \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 g \u2208 G \u2192 g \u2218 g \u2218 g \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] (g \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] (g \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] (f \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] ((g \u2218 f) \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 g \u2218 g \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 g \u2218 g \u2208 G\n [prop] Function.invFun g \u2218 g \u2218 g \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 g \u2218 g \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 g \u2218 g \u2208 G\n [prop] Function.invFun f \u2218 g \u2218 g \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208\n G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208\n G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208\n G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208\n G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun g \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun f \u2218 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208\n G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208\n G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208\n G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun g \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun f \u2218 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun g \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun f \u2218 (f \u2218 g) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun g \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun f \u2218 (g \u2218 f) \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2208 G \u2192 (g \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 f \u2208 G \u2192 (f \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2208 G \u2192 ((g \u2218 f) \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2208 G \u2192 ((f \u2218 g) \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2208 G \u2192 (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2208 G \u2192\n Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2208 G \u2192 Function.invFun (Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (Function.invFun (g \u2218 f)) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2208 G \u2192 Function.invFun (f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (f \u2218 g) \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun g \u2208 G \u2192 Function.invFun g \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun g \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 g \u2218 f \u2208 G \u2192 Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun f \u2208 G \u2192 Function.invFun f \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun f \u2218 g \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 f \u2208 G \u2192 f \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2208 G \u2192 f \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 g \u2208 G \u2192 g \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] g \u2208 G \u2192 g \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192\n f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192\n g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192\n (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192\n (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 (f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (f \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 (g \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192 ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192\n Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f) \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 f \u2218 g \u2208 G \u2192 (f \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] g \u2218 f \u2218 g \u2208 G \u2192 (g \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 ((g \u2218 f) \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] ((g \u2218 f) \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g) \u2218 f \u2218 g \u2208 G \u2192 ((f \u2218 g) \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] Function.invFun (g \u2218 f) \u2218 f \u2218 g \u2208 G \u2192 (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (Function.invFun (g \u2218 f) \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192\n ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g \u2208 G \u2192\n (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) \u2218 f \u2218 g) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] f \u2218 g \u2218 f \u2208 G \u2192 (f \u2218 g \u2218 f) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] (f \u2218 g \u2218 f) \u2218 f \u2218 g \u2218 f \u2208 G\n [prop] \u2200 (x : \u211d), f x = w_6 * x + w_7\n [prop] \u2200 (x : \u211d), g x = w_8 * x + w_9\n [prop] \u2200 (x : \u211d), g (f x) = w_10 * x + w_11\n [prop] \u2200 (x : \u211d), f (g x) = w_12 * x + w_13\n [prop] \u2200 (x : \u211d), Function.invFun (g \u2218 f) x = w_14 * x + w_15\n [prop] \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) x)) = w_16 * x + w_17\n [prop] \u2200 (x : \u211d), f (g (f (g x))) = w_19 * x + w_20\n [prop] \u2200 (x : \u211d), Function.invFun (g \u2218 f) (f (g x)) = w_21 * x + w_22\n [prop] \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) (f (g x)))) = w_23 * x + w_24\n [prop] \u2200 (x : \u211d), g (g (f x)) = w_25 * x + w_26\n [prop] \u2200 (x : \u211d), g (f (g (f x))) = w_27 * x + w_28\n [prop] \u2200 (x : \u211d), f (g (g (f x))) = w_29 * x + w_30\n [prop] \u2200 (x : \u211d), Function.invFun (g \u2218 f) (g (f x)) = w_31 * x + w_32\n [prop] \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) (g (f x)))) = w_33 * x + w_34\n [prop] \u2200 (x : \u211d), g (g x) = w_35 * x + w_36\n [prop] \u2200 (x : \u211d), g (f (g x)) = w_37 * x + w_38\n [prop] \u2200 (x : \u211d), f (g (g x)) = w_39 * x + w_40\n [prop] \u2200 (x : \u211d), Function.invFun (g \u2218 f) (g x) = w_41 * x + w_42\n [prop] \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) (g x))) = w_43 * x + w_44\n [prop] \u2200 (x : \u211d), f (f x) = w_45 * x + w_46\n [prop] \u2200 (x : \u211d), g (f (f x)) = w_47 * x + w_48\n [prop] \u2200 (x : \u211d), f (g (f x)) = w_49 * x + w_50\n [prop] \u2200 (x : \u211d), Function.invFun (g \u2218 f) (f x) = w_51 * x + w_52\n [prop] \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) (f x))) = w_53 * x + w_54\n [prop] \u2200 (x : \u211d), Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) x = w_55 * x + w_56\n [prop] \u2200 (x : \u211d), Function.invFun (Function.invFun (g \u2218 f)) x = w_57 * x + w_58\n [prop] \u2200 (x : \u211d), Function.invFun (f \u2218 g) x = w_59 * x + w_60\n [prop] \u2200 (x : \u211d), Function.invFun g x = w_61 * x + w_62\n [prop] \u2200 (x : \u211d), Function.invFun f x = w_63 * x + w_64\n [prop] \u2200 (x : \u211d), f (f (g (Function.invFun (g \u2218 f) x))) = w_65 * x + w_66\n [prop] \u2200 (x : \u211d), g (f (g (Function.invFun (g \u2218 f) x))) = w_67 * x + w_68\n [prop] \u2200 (x : \u211d), g (f (f (g (Function.invFun (g \u2218 f) x)))) = w_69 * x + w_70\n [prop] \u2200 (x : \u211d), f (g (f (g (Function.invFun (g \u2218 f) x)))) = w_71 * x + w_72\n [prop] \u2200 (x : \u211d), Function.invFun (g \u2218 f) (f (g (Function.invFun (g \u2218 f) x))) = w_73 * x + w_74\n [prop] \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) (f (g (Function.invFun (g \u2218 f) x))))) = w_75 * x + w_76\n [prop] \u2200 (x : \u211d), f (Function.invFun (g \u2218 f) x) = w_77 * x + w_78\n [prop] \u2200 (x : \u211d), g (Function.invFun (g \u2218 f) x) = w_79 * x + w_80\n [prop] \u2200 (x : \u211d), g (f (Function.invFun (g \u2218 f) x)) = w_81 * x + w_82\n [prop] \u2200 (x : \u211d), Function.invFun (g \u2218 f) (Function.invFun (g \u2218 f) x) = w_83 * x + w_84\n [prop] \u2200 (x : \u211d), f (g (Function.invFun (g \u2218 f) (Function.invFun (g \u2218 f) x))) = w_85 * x + w_86\n [prop] \u2200 (x : \u211d), f (f (g x)) = w_87 * x + w_88\n [prop] \u2200 (x : \u211d), g (f (f (g x))) = w_89 * x + w_90\n [eqc] False propositions\n [prop] f = id\n [prop] a = 0\n [prop] c = 0\n [prop] a - 1 = 0\n [prop] g x = x\n [prop] w_6 = 0\n [prop] w_8 = 0\n [prop] w_10 = 0\n [prop] w_12 = 0\n [prop] w_14 = 0\n [prop] w_16 = 0\n [prop] f w_18 = id w_18\n [prop] w_19 = 0\n [prop] w_21 = 0\n [prop] w_23 = 0\n [prop] w_25 = 0\n [prop] w_27 = 0\n [prop] w_29 = 0\n [prop] w_31 = 0\n [prop] w_33 = 0\n [prop] w_35 = 0\n [prop] w_37 = 0\n [prop] w_39 = 0\n [prop] w_41 = 0\n [prop] w_43 = 0\n [prop] w_45 = 0\n [prop] w_47 = 0\n [prop] w_49 = 0\n [prop] w_51 = 0\n [prop] w_53 = 0\n [prop] w_55 = 0\n [prop] w_57 = 0\n [prop] w_59 = 0\n [prop] w_61 = 0\n [prop] w_63 = 0\n [prop] w_65 = 0\n [prop] w_67 = 0\n [prop] w_69 = 0\n [prop] w_71 = 0\n [prop] w_73 = 0\n [prop] w_75 = 0\n [prop] w_77 = 0\n [prop] w_79 = 0\n [prop] w_81 = 0\n [prop] w_83 = 0\n [prop] w_85 = 0\n [prop] w_87 = 0\n [prop] w_89 = 0\n [eqc] Equivalence classes\n [eqc] {f (g (Function.invFun (g \u2218 f) w_5)), w_5}\n [eqc] {Function.invFun (g \u2218 f) w_4, w_4}\n [eqc] {f (g w_3), w_3}\n [eqc] {g (f w_2), w_2}\n [eqc] {g w_1, w_1}\n [eqc] {f w, w}\n [eqc] {g x, a * c * x + c * b + d, g (f x), a * c * x + a * d + b, f (g x), c * x + d}\n [eqc] {a * d + b, c * b + d}\n [eqc] {y + (a * d + b) - (c * b + d), y}\n [eqc] {f x, a * x + b, x}\n [cases] Case analyses\n [cases] [1/1]: \u2203 x, f x = x\n [cases] [1/1]: \u2203 x, g x = x\n [cases] [1/1]: \u2203 x, g (f x) = x\n [cases] [1/1]: \u2203 x, f (g x) = x\n [cases] [1/1]: \u2203 x, Function.invFun (g \u2218 f) x = x\n [cases] [1/1]: \u2203 x, f (g (Function.invFun (g \u2218 f) x)) = x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f x_1 = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g x_1 = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f x_1) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g x_1) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) x_1 = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) x_1)) = a * x_1 + x\n [cases] [1/1]: \u2203 x, \u00acf x = id x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (f (g x_1))) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (f (g x_1)) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (f (g x_1)))) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (g (f x_1)) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (g (f x_1))) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (g (f x_1))) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (g (f x_1)) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (g (f x_1)))) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (g x_1) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (g x_1)) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (g x_1)) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (g x_1) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (g x_1))) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (f x_1) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (f x_1)) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (f x_1)) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (f x_1) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (f x_1))) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun ((f \u2218 g) \u2218 Function.invFun (g \u2218 f)) x_1 = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (Function.invFun (g \u2218 f)) x_1 = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (f \u2218 g) x_1 = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun g x_1 = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun f x_1 = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (f (g (Function.invFun (g \u2218 f) x_1))) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (g (Function.invFun (g \u2218 f) x_1))) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (f (g (Function.invFun (g \u2218 f) x_1)))) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (f (g (Function.invFun (g \u2218 f) x_1)))) = a * x_1 + x\n [cases] [1/1]: \u2203 a,\n \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (f (g (Function.invFun (g \u2218 f) x_1))) = a * x_1 + x\n [cases] [1/1]: \u2203 a,\n \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (f (g (Function.invFun (g \u2218 f) x_1))))) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (Function.invFun (g \u2218 f) x_1) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (Function.invFun (g \u2218 f) x_1) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (Function.invFun (g \u2218 f) x_1)) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), Function.invFun (g \u2218 f) (Function.invFun (g \u2218 f) x_1) = a * x_1 + x\n [cases] [1/1]: \u2203 a,\n \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (g (Function.invFun (g \u2218 f) (Function.invFun (g \u2218 f) x_1))) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), f (f (g x_1)) = a * x_1 + x\n [cases] [1/1]: \u2203 a, \u00aca = 0 \u2227 \u2203 x, \u2200 (x_1 : \u211d), g (f (f (g x_1))) = a * x_1 + x\n [ematch] E-matching patterns\n [thm] hf: [@Membership.mem `[\u211d \u2192 \u211d] `[Set (\u211d \u2192 \u211d)] `[Set.instMembership] `[G] #1]\n [thm] hf: [@Membership.mem `[\u211d \u2192 \u211d] `[Set (\u211d \u2192 \u211d)] `[Set.instMembership] `[G] #1]\n [thm] hG: [@Membership.mem `[\u211d \u2192 \u211d] `[Set (\u211d \u2192 \u211d)] `[Set.instMembership] `[G] #3,\n @Membership.mem `[\u211d \u2192 \u211d] `[Set (\u211d \u2192 \u211d)] `[Set.instMembership] `[G] #1]\n [thm] hG: [@Function.comp `[\u211d] `[\u211d] `[\u211d] #1 #3]\n [thm] hinv: [@Membership.mem `[\u211d \u2192 \u211d] `[Set (\u211d \u2192 \u211d)] `[Set.instMembership] `[G] #1]\n [thm] hinv: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] #1]\n [thm] hfix: [@Membership.mem `[\u211d \u2192 \u211d] `[Set (\u211d \u2192 \u211d)] `[Set.instMembership] `[G] #1]\n [thm] hfix: [@Membership.mem `[\u211d \u2192 \u211d] `[Set (\u211d \u2192 \u211d)] `[Set.instMembership] `[G] #1]\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [thm] id.eq_1: [@id #1 #0]\n [thm] hb2: [f #0]\n [thm] hb2: [f #0]\n [thm] hd2: [g #0]\n [thm] hd2: [g #0]\n [thm] s1: [f #0]\n [thm] s1: [f #0]\n [thm] s2: [g #0]\n [thm] s2: [g #0]\n [thm] s3: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] s3: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] s4: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] s4: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_8: [f #0]\n [thm] h_8: [f #0]\n [thm] h_10: [g #0]\n [thm] h_10: [g #0]\n [thm] h_12: [f #0]\n [thm] h_12: [f #0]\n [thm] h_14: [g #0]\n [thm] h_14: [g #0]\n [thm] h_16: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_16: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_18: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_18: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_21: [g #0]\n [thm] h_21: [g #0]\n [thm] h_23: [g #0]\n [thm] h_23: [g #0]\n [thm] h_25: [g #0]\n [thm] h_25: [g #0]\n [thm] h_27: [f #0]\n [thm] h_27: [f #0]\n [thm] h_29: [f #0]\n [thm] h_29: [f #0]\n [thm] h_31: [f #0]\n [thm] h_31: [f #0]\n [thm] h_33: [f #0]\n [thm] h_33: [f #0]\n [thm] h_35: [f #0]\n [thm] h_35: [f #0]\n [thm] h_37: [g #0]\n [thm] h_37: [g #0]\n [thm] h_39: [g #0]\n [thm] h_39: [g #0]\n [thm] h_41: [g #0]\n [thm] h_41: [g #0]\n [thm] h_43: [g #0]\n [thm] h_43: [g #0]\n [thm] h_45: [g #0]\n [thm] h_45: [g #0]\n [thm] h_47: [f #0]\n [thm] h_47: [f #0]\n [thm] h_49: [f #0]\n [thm] h_49: [f #0]\n [thm] h_51: [f #0]\n [thm] h_51: [f #0]\n [thm] h_53: [f #0]\n [thm] h_53: [f #0]\n [thm] h_55: [f #0]\n [thm] h_55: [f #0]\n [thm] h_57: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[(f \u2218 g) \u2218 Function.invFun (g \u2218 f)] #0]\n [thm] h_57: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[(f \u2218 g) \u2218 Function.invFun (g \u2218 f)] #0]\n [thm] h_59: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[Function.invFun (g \u2218 f)] #0]\n [thm] h_59: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[Function.invFun (g \u2218 f)] #0]\n [thm] h_61: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[f \u2218 g] #0]\n [thm] h_61: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[f \u2218 g] #0]\n [thm] h_63: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g] #0]\n [thm] h_63: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g] #0]\n [thm] h_65: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[f] #0]\n [thm] h_65: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[f] #0]\n [thm] h_67: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_67: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_69: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_69: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_71: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_71: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_73: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_73: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_75: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_75: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_77: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_77: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_79: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_79: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_81: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_81: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_83: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_83: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_85: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_85: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_87: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_87: [@Function.invFun `[\u211d] `[\u211d] `[\u2039Nonempty \u211d\u203a] `[g \u2218 f] #0]\n [thm] h_89: [g #0]\n [thm] h_89: [g #0]\n [thm] h_91: [g #0]\n [thm] h_91: [g #0]\n [ring] Ring `\u211d`\n [basis] Basis\n [_] a * d + -1 * (b * c) + -1 * d + b = 0\n [_] a * x + b + -1 * x = 0\n [_] b * c * x + d * b + -1 * (b * x) = 0\n [diseqs] Disequalities\n [_] \u00aca = 0\n [_] \u00acc = 0\n [_] \u00aca + -1 = 0\n [_] \u00acc * x + d + -1 * x = 0\n [limits] Thresholds reached\n [limit] maximum number of instances generated by E-matching has been reached, threshold: `(instances := 1000)`\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n G\n has type\n Set (\u211d \u2192 \u211d) : Type\n but is expected to have type\n Std.ExtDHashMap (\u211d \u2192 \u211d) ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n G\n has type\n Set (\u211d \u2192 \u211d) : Type\n but is expected to have type\n Std.ExtDHashMap (\u211d \u2192 \u211d) ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n G\n has type\n Set (\u211d \u2192 \u211d) : Type\n but is expected to have type\n Std.ExtDHashMap (\u211d \u2192 \u211d) ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n G\n has type\n Set (\u211d \u2192 \u211d) : Type\n but is expected to have type\n Std.ExtDHashMap (\u211d \u2192 \u211d) ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n G\n has type\n Set (\u211d \u2192 \u211d) : Type\n but is expected to have type\n Std.ExtDHashMap (\u211d \u2192 \u211d) ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n G\n has type\n Set (\u211d \u2192 \u211d) : Type\n but is expected to have type\n Std.ExtDHashMap (\u211d \u2192 \u211d) ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n G\n has type\n Set (\u211d \u2192 \u211d) : Type\n but is expected to have type\n Std.DHashMap (\u211d \u2192 \u211d) ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n G\n has type\n Set (\u211d \u2192 \u211d) : Type\n but is expected to have type\n Std.DHashMap (\u211d \u2192 \u211d) ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n G\n has type\n Set (\u211d \u2192 \u211d) : Type\n but is expected to have type\n Std.DHashMap (\u211d \u2192 \u211d) ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n G\n has type\n Set (\u211d \u2192 \u211d) : Type\n but is expected to have type\n Std.DHashMap (\u211d \u2192 \u211d) ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n G\n has type\n Set (\u211d \u2192 \u211d) : Type\n but is expected to have type\n Std.DHashMap (\u211d \u2192 \u211d) ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n G\n has type\n Set (\u211d \u2192 \u211d) : Type\n but is expected to have type\n Std.DHashMap (\u211d \u2192 \u211d) ?\u03b2 : Type"], "timeout_s": 600.0, "latency_s": 14.2919, "verified_at": "2026-03-26T18:16:41.265747+00:00"}} | false | true | false | 14.2919 |
compfiles_Imo1973P6 | compfiles | Copyright (c) 2026 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1973, Problem 6
Let $a_1, a_2,\cdots, a_n$ be $n$ positive numbers,
and let $q$ be a given real number such that $0 < q < 1$. Find $n$ numbers $b_1, b_2, \cdots, b_n$ for which
(a) $a_k < b_k$ for $k=1,2,\cdots, n$,
(b) $q < \dfrac{b_{k+1}}{b_k}<\dfrac{1}{q}$ for $k=1,2,\cdots,n-1$,
(c) $b_1+b_2+\cdots+b_n < \dfrac{1+q}{1-q}(a_1+a_2+\cdots+a_n)$.
-/
namespace Imo1973P6
variable (n : ℕ) (a : Fin n → ℝ) (q : ℝ)
open Matrix
def m (_:ℕ) : ℕ → ℕ := fun i => i
theorem m_zero : m n 0 = 0 := by
rfl
theorem m_nonzero (i) (hi1 : 0 < i) : 0 < m n i := hi1
def Q : Fin n → Fin n → ℝ := fun i j => q ^ m n (Int.natAbs (i.val - j.val))
theorem Q_diag_one : ∀ i, Q n q i i = 1 := by
unfold Q
simp [m_zero]
theorem Q_pos (hq : q ∈ Set.Ioo 0 1) : ∀ i j, 0 < Q n q i j := by
unfold Q
intro i j
apply pow_pos
grind only [= Set.mem_Ioo]
theorem Q_row_neighbour_quot (k) (_ : k+1<n) (j) (hq : q ∈ Set.Ioo 0 1) : ∃ f ∈ ({q, q⁻¹} : Finset _),
Q n q ⟨k+1, by omega⟩ j = f * Q n q ⟨k, by omega⟩ j := by
simp only [Finset.mem_insert, Finset.mem_singleton, exists_eq_or_imp, ↓existsAndEq, true_and]
unfold Q
repeat rw [<-mul_inv_eq_iff_eq_mul₀ (by grind [pow_ne_zero])]
rw [<-zpow_natCast, <-zpow_natCast, <-div_eq_mul_inv]
rw [<-zpow_sub₀ (by grind only [= Set.mem_Ioo])]
nth_rw 2 [show q = q^(1 : ℤ) by simp]
rw [show q⁻¹ = q^(-1 : ℤ) by simp]
repeat rw [zpow_right_inj₀ (by grind) (by grind)]
unfold Int.natAbs m
split <;> split
all_goals grind
theorem imo1973_p6_of_n_eq_one (hn : n = 1) (hq : q ∈ Set.Ioo 0 1) (apos : ∀ i, 0 < a i)
: ∃ b : Fin n → ℝ,
(∀ k, a k < b k)
∧ (∀ k, ∀ _ : k < n-1, (b ⟨k+1, by omega⟩) / (b ⟨k, by omega⟩) ∈ Set.Ioo q (1 / q))
∧ (∑ k, b k < (1+q) / (1-q) * ∑ k, a k) := by
subst n
simp only [Fin.forall_fin_one, Fin.isValue, tsub_self, not_lt_zero, one_div, Set.mem_Ioo,
IsEmpty.forall_iff, implies_true, Finset.univ_unique, Fin.default_eq_zero, Finset.sum_singleton,
true_and]
rw [Set.mem_Ioo] at hq
have : 1 < (1 + q) / (1 - q) := by
refine (one_lt_div ?_).mpr ?_ <;> linarith
use fun _ => √((1+q) / (1-q)) * a 0
and_intros
· rw [lt_mul_iff_one_lt_left (apos 0)]
refine (Real.lt_sqrt ?_).mpr ?_ <;> linarith
· rw [mul_lt_mul_iff_left₀ (apos 0)]
refine (Real.sqrt_lt' ?_).mpr ?_ <;> nlinarith
theorem imo1973_p6 (npos : 0 < n) (hq : q ∈ Set.Ioo 0 1) (apos : ∀ i, 0 < a i)
: ∃ b : Fin n → ℝ,
(∀ k, a k < b k)
∧ (∀ k, ∀ _ : k < n-1, (b ⟨k+1, by omega⟩) / (b ⟨k, by omega⟩) ∈ Set.Ioo q (1 / q))
∧ (∑ k, b k < (1+q) / (1-q) * ∑ k, a k) := by
by_cases hn : n = 1
· apply imo1973_p6_of_n_eq_one <;> trivial
use (Q n q *ᵥ a)
have : 1 < n := Nat.lt_of_le_of_ne npos (Ne.symm hn)
have nnz : NeZero n := NeZero.of_gt this
rw [Set.mem_Ioo] at hq
have q_lt_inv_q : q < 1 / q := by
rw [lt_div_iff₀, <-sq, sq_lt_one_iff₀] <;> linarith
and_intros
-- (a) --
· intro k
rw [mulVec, dotProduct]
calc
_ < a k + Q n q k (k+1) * a (k + 1) := by
simp [apos, Q_pos n q hq]
_ = Q n q k k * a k + Q n q k (k+1) * a (k + 1) := by
simp [Q_diag_one]
_ = ∑ i ∈ {k, k+1}, Q n q k i * a i := by
rw [Finset.sum_insert, Finset.sum_singleton]
rw [Finset.mem_singleton]
rw [left_eq_add, Fin.one_eq_zero_iff]
omega
_ ≤ _ := by
refine Finset.sum_le_univ_sum_of_nonneg ?_
simp [le_of_lt (apos _), Q_pos n q hq]
-- (b) --
· intro k klt
let Xi : Finset _ := {i | Q n q ⟨k+1, by omega⟩ i = q * Q n q ⟨k, by omega⟩ i}
let Yi : Finset _ := {i | Q n q ⟨k+1, by omega⟩ i = q⁻¹ * Q n q ⟨k, by omega⟩ i}
have XY_union : Xi ∪ Yi = Finset.univ := by
apply Finset.eq_univ_of_forall
intro i
apply (Q_row_neighbour_quot n q k (by omega) i hq).elim
intro qq ⟨hqq, e⟩
simp only [Finset.mem_insert, Finset.mem_singleton] at hqq
apply hqq.elim
· intro _
subst qq
apply Finset.mem_union_left
unfold Xi
exact (Finset.mem_filter_univ i).mpr e
· intro _
subst qq
apply Finset.mem_union_right
unfold Yi
exact (Finset.mem_filter_univ i).mpr e
have XY_disj : Disjoint Xi Yi := by
unfold Xi Yi
rw [Finset.disjoint_iff_ne]
simp only [Finset.mem_filter, Finset.mem_univ, true_and, ne_eq]
intro a h1 b h2
by_contra
subst a
rw [h2] at h1
rw [mul_eq_mul_right_iff] at h1
have h (_t) := Q_pos n q hq ⟨k, _t⟩ b
rcases h1 with hq_eq | hb0
· have := q_lt_inv_q; rw [one_div, hq_eq] at this; exact absurd this (lt_irrefl q)
· linarith [h (show k < n by omega)]
let X := ∑ i ∈ Xi, Q n q ⟨k, by omega⟩ i * a i
let Y := ∑ i ∈ Yi, Q n q ⟨k, by omega⟩ i * a i
have Xpos : 0 < X := by
unfold X
apply Finset.sum_pos
· intro i _
have h (_t) := Q_pos n q hq ⟨k, _t⟩ i
exact mul_pos (by apply Q_pos _ q hq) (apos i)
· use ⟨k, by omega⟩
unfold Xi Q m
simp
have Ypos : 0 < Y := by
unfold Y
apply Finset.sum_pos
· intro i _
have h (_t) := Q_pos n q hq ⟨k, _t⟩ i
exact mul_pos (by apply Q_pos _ q hq) (apos i)
· use ⟨k+1, by omega⟩
unfold Yi Q m
simp only [Nat.cast_add, Nat.cast_one, Finset.mem_filter, Finset.mem_univ, sub_self,
Int.natAbs_zero, pow_zero, sub_add_cancel_left, Int.reduceNeg, IsUnit.neg_iff, isUnit_one,
Int.natAbs_of_isUnit, pow_one, true_and]
rw [inv_mul_cancel₀]
exact ne_of_gt hq.left
have hk (_t) : (Q n q *ᵥ a) ⟨k, _t⟩ = X + Y := by
unfold X Y
rw [mulVec, dotProduct, <-Finset.sum_union XY_disj, <-XY_union]
have hk1 (_t) : (Q n q *ᵥ a) ⟨k+1, _t⟩ = q*X + q⁻¹*Y := by
unfold X Y
rw [mulVec, dotProduct]
rw [Finset.mul_sum, Finset.mul_sum]
rw [<-XY_union, Finset.sum_union XY_disj]
congr 1 <;> { apply Finset.sum_bij (fun x _ => x) <;> [simp; simp; simp; grind] }
constructor
· rw [lt_div_iff₀ (by grind only)]
rw [hk, hk1, mul_add]
rw [add_lt_add_iff_left]
field_simp
exact q_lt_inv_q
· rw [div_lt_iff₀ (by grind only)]
rw [hk, hk1, mul_add, one_div]
rw [add_lt_add_iff_right]
field_simp
exact q_lt_inv_q
-- (c) --
· simp_rw [mulVec, <-sum_dotProduct]
rw [dotProduct, Finset.mul_sum]
simp_rw [Finset.sum_apply]
have h (i) : (∑ j, Q n q j i) * a i < (1 + q) / (1 - q) * a i := by
rw [mul_lt_mul_iff_left₀ (apos i)]
unfold Q m
calc
_ = ∑ j ∈ Finset.range n, q ^ (j - i.val : ℤ).natAbs := by
apply Finset.sum_bij (fun i _ => i.val)
· simp
· intro a _ b _ e
exact Fin.eq_of_val_eq e
· intro a h
use ⟨a, by exact Finset.mem_range.mp h⟩
simp
· simp
_ = ∑ j ≤ i.val, q ^ (j - i.val : ℤ).natAbs + ∑ j ∈ Finset.Ioo i.val n, q ^ (j - i.val : ℤ).natAbs := by
rw [<-Finset.sum_union]
· congr
refine Finset.ext_iff.mpr ?_
simp only [Finset.mem_range, Finset.mem_union, Finset.mem_Iic, Finset.mem_Ioo]
omega
· rw [Finset.disjoint_iff_ne]
simp only [Finset.mem_Iic, Finset.mem_Ioo, ne_eq, and_imp]
omega
_ = ∑ j ≤ i.val, q ^ (i.val - j) + ∑ j ∈ Finset.Ioo i.val n, q ^ (j - i.val) := by
congr 1 <;> {
apply Finset.sum_congr rfl
intro x xh
congr
unfold Int.natAbs
split <;> grind only [= Finset.mem_Iic, = Finset.mem_Ioo, = Lean.Grind.toInt_fin]
}
_ = ∑ k ≤ i.val, q ^ k + ∑ k ∈ Finset.Ioo 0 (n-i.val), q ^ k := by
congr 1
· apply Finset.sum_bij (fun j h => i.val-j)
· simp
· grind only [= Finset.mem_Iic, = Lean.Grind.toInt_fin]
· intro y yh
use i.val - y
simp only [Finset.mem_Iic, tsub_le_iff_right, le_add_iff_nonneg_right, zero_le,
exists_const]
apply Nat.sub_sub_self
exact Finset.mem_Iic.mp yh
· simp
· apply Finset.sum_bij (fun j h => j-i.val)
· simp only [Finset.mem_Ioo, and_imp]
omega
· grind only [= Finset.mem_Ioo, = Lean.Grind.toInt_fin]
· intro y yh
use y + i.val
simp only [add_tsub_cancel_right, Finset.mem_Ioo,
lt_add_iff_pos_left, exists_prop, and_true]
simp only [Finset.mem_Ioo] at yh
omega
· simp
_ = 1 + ∑ k ∈ Finset.Ioc 0 i.val, q ^ k + ∑ k ∈ Finset.Ioo 0 (n-i.val), q ^ k := by
rw [add_left_inj, Finset.sum_eq_add_sum_diff_singleton (i:=0)]
· congr
· simp
_ ≤ 1 + 2 * ∑ k ∈ Finset.Ioo 0 n, q ^ k := by
rw [one_add_one_eq_two.symm, add_mul, one_mul, add_assoc, add_le_add_iff_left]
apply add_le_add <;> {
apply Finset.sum_le_sum_of_subset_of_nonneg
· grind only [= Finset.subset_iff, = Finset.mem_Ioo, = Finset.mem_Ioc]
· intro _ _ _
apply pow_nonneg (le_of_lt hq.left)
}
_ = 1 + 2 * (q * ∑ k < n - 1, q ^ k) := by
congr 2
rw [Finset.mul_sum, Eq.comm]
apply Finset.sum_bij (fun i _ => i+1)
· simp
omega
· simp
· intro y yh
use y-1, ?_
· simp only [Finset.mem_Ioo] at yh; omega
· simp only [Finset.mem_Ioo] at yh; simp only [Finset.mem_Iio]; omega
· simp [pow_succ']
_ < _ := by
rw [Nat.Iio_eq_range, geom_sum_eq (ne_of_lt hq.right)]
apply lt_of_mul_lt_mul_of_nonneg_right (a:=1-q) ?_ (by linarith)
rw [IsUnit.div_mul_cancel, <-mul_assoc, mul_div_assoc', <-neg_div_neg_eq, neg_sub,
add_mul, <-neg_mul, IsUnit.div_mul_cancel, one_mul]
· ring_nf
simp only [add_lt_add_iff_left, sub_lt_self_iff, Nat.ofNat_pos, mul_pos_iff_of_pos_right]
rw [mul_pow_sub_one nnz.out]
apply pow_pos hq.left
· exact Ne.isUnit (sub_ne_zero_of_ne (ne_of_gt hq.right))
· exact Ne.isUnit (sub_ne_zero_of_ne (ne_of_gt hq.right))
apply Finset.sum_lt_sum
· intro i _
exact le_of_lt (h i)
· use 0
simp [h 0]
end Imo1973P6 | /- | /-
Copyright (c) 2026 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1973, Problem 6
Let $a_1, a_2,\cdots, a_n$ be $n$ positive numbers,
and let $q$ be a given real number such that $0 < q < 1$. Find $n$ numbers $b_1, b_2, \cdots, b_n$ for which
(a) $a_k < b_k$ for $k=1,2,\cdots, n$,
(b) $q < \dfrac{b_{k+1}}{b_k}<\dfrac{1}{q}$ for $k=1,2,\cdots,n-1$,
(c) $b_1+b_2+\cdots+b_n < \dfrac{1+q}{1-q}(a_1+a_2+\cdots+a_n)$.
-/
namespace Imo1973P6
variable (n : ℕ) (a : Fin n → ℝ) (q : ℝ)
open Matrix
def m (_:ℕ) : ℕ → ℕ := fun i => i
theorem m_zero : m n 0 = 0 := by
rfl
theorem m_nonzero (i) (hi1 : 0 < i) : 0 < m n i := hi1
def Q : Fin n → Fin n → ℝ := fun i j => q ^ m n (Int.natAbs (i.val - j.val))
theorem Q_diag_one : ∀ i, Q n q i i = 1 := by
unfold Q
simp [m_zero]
theorem Q_pos (hq : q ∈ Set.Ioo 0 1) : ∀ i j, 0 < Q n q i j := by
unfold Q
intro i j
apply pow_pos
grind only [= Set.mem_Ioo]
theorem Q_row_neighbour_quot (k) (_ : k+1<n) (j) (hq : q ∈ Set.Ioo 0 1) : ∃ f ∈ ({q, q⁻¹} : Finset _),
Q n q ⟨k+1, by omega⟩ j = f * Q n q ⟨k, by omega⟩ j := by
simp only [Finset.mem_insert, Finset.mem_singleton, exists_eq_or_imp, ↓existsAndEq, true_and]
unfold Q
repeat rw [<-mul_inv_eq_iff_eq_mul₀ (by grind [pow_ne_zero])]
rw [<-zpow_natCast, <-zpow_natCast, <-div_eq_mul_inv]
rw [<-zpow_sub₀ (by grind only [= Set.mem_Ioo])]
nth_rw 2 [show q = q^(1 : ℤ) by simp]
rw [show q⁻¹ = q^(-1 : ℤ) by simp]
repeat rw [zpow_right_inj₀ (by grind) (by grind)]
unfold Int.natAbs m
split <;> split
all_goals grind
theorem imo1973_p6_of_n_eq_one (hn : n = 1) (hq : q ∈ Set.Ioo 0 1) (apos : ∀ i, 0 < a i)
: ∃ b : Fin n → ℝ,
(∀ k, a k < b k)
∧ (∀ k, ∀ _ : k < n-1, (b ⟨k+1, by omega⟩) / (b ⟨k, by omega⟩) ∈ Set.Ioo q (1 / q))
∧ (∑ k, b k < (1+q) / (1-q) * ∑ k, a k) := by
subst n
simp only [Fin.forall_fin_one, Fin.isValue, tsub_self, not_lt_zero, one_div, Set.mem_Ioo,
IsEmpty.forall_iff, implies_true, Finset.univ_unique, Fin.default_eq_zero, Finset.sum_singleton,
true_and]
rw [Set.mem_Ioo] at hq
have : 1 < (1 + q) / (1 - q) := by
refine (one_lt_div ?_).mpr ?_ <;> linarith
use fun _ => √((1+q) / (1-q)) * a 0
and_intros
· rw [lt_mul_iff_one_lt_left (apos 0)]
refine (Real.lt_sqrt ?_).mpr ?_ <;> linarith
· rw [mul_lt_mul_iff_left₀ (apos 0)]
refine (Real.sqrt_lt' ?_).mpr ?_ <;> nlinarith
theorem imo1973_p6 (npos : 0 < n) (hq : q ∈ Set.Ioo 0 1) (apos : ∀ i, 0 < a i)
: ∃ b : Fin n → ℝ,
(∀ k, a k < b k)
∧ (∀ k, ∀ _ : k < n-1, (b ⟨k+1, by omega⟩) / (b ⟨k, by omega⟩) ∈ Set.Ioo q (1 / q))
∧ (∑ k, b k < (1+q) / (1-q) * ∑ k, a k) := by
by_cases hn : n = 1
· apply imo1973_p6_of_n_eq_one <;> trivial
use (Q n q *ᵥ a)
have : 1 < n := Nat.lt_of_le_of_ne npos (Ne.symm hn)
have nnz : NeZero n := NeZero.of_gt this
rw [Set.mem_Ioo] at hq
have q_lt_inv_q : q < 1 / q := by
rw [lt_div_iff₀, <-sq, sq_lt_one_iff₀] <;> linarith
and_intros
-- (a) --
· intro k
rw [mulVec, dotProduct]
calc
_ < a k + Q n q k (k+1) * a (k + 1) := by
simp [apos, Q_pos n q hq]
_ = Q n q k k * a k + Q n q k (k+1) * a (k + 1) := by
simp [Q_diag_one]
_ = ∑ i ∈ {k, k+1}, Q n q k i * a i := by
rw [Finset.sum_insert, Finset.sum_singleton]
rw [Finset.mem_singleton]
rw [left_eq_add, Fin.one_eq_zero_iff]
omega
_ ≤ _ := by
refine Finset.sum_le_univ_sum_of_nonneg ?_
simp [le_of_lt (apos _), Q_pos n q hq]
-- (b) --
· intro k klt
let Xi : Finset _ := {i | Q n q ⟨k+1, by omega⟩ i = q * Q n q ⟨k, by omega⟩ i}
let Yi : Finset _ := {i | Q n q ⟨k+1, by omega⟩ i = q⁻¹ * Q n q ⟨k, by omega⟩ i}
have XY_union : Xi ∪ Yi = Finset.univ := by
apply Finset.eq_univ_of_forall
intro i
apply (Q_row_neighbour_quot n q k (by omega) i hq).elim
intro qq ⟨hqq, e⟩
simp only [Finset.mem_insert, Finset.mem_singleton] at hqq
apply hqq.elim
· intro _
subst qq
apply Finset.mem_union_left
unfold Xi
exact (Finset.mem_filter_univ i).mpr e
· intro _
subst qq
apply Finset.mem_union_right
unfold Yi
exact (Finset.mem_filter_univ i).mpr e
have XY_disj : Disjoint Xi Yi := by
unfold Xi Yi
rw [Finset.disjoint_iff_ne]
simp only [Finset.mem_filter, Finset.mem_univ, true_and, ne_eq]
intro a h1 b h2
by_contra
subst a
rw [h2] at h1
rw [mul_eq_mul_right_iff] at h1
have h (_t) := Q_pos n q hq ⟨k, _t⟩ b
rcases h1 with hq_eq | hb0
· have := q_lt_inv_q; rw [one_div, hq_eq] at this; exact absurd this (lt_irrefl q)
· linarith [h (show k < n by omega)]
let X := ∑ i ∈ Xi, Q n q ⟨k, by omega⟩ i * a i
let Y := ∑ i ∈ Yi, Q n q ⟨k, by omega⟩ i * a i
have Xpos : 0 < X := by
unfold X
apply Finset.sum_pos
· intro i _
have h (_t) := Q_pos n q hq ⟨k, _t⟩ i
exact mul_pos (by apply Q_pos _ q hq) (apos i)
· use ⟨k, by omega⟩
unfold Xi Q m
simp
have Ypos : 0 < Y := by
unfold Y
apply Finset.sum_pos
· intro i _
have h (_t) := Q_pos n q hq ⟨k, _t⟩ i
exact mul_pos (by apply Q_pos _ q hq) (apos i)
· use ⟨k+1, by omega⟩
unfold Yi Q m
simp only [Nat.cast_add, Nat.cast_one, Finset.mem_filter, Finset.mem_univ, sub_self,
Int.natAbs_zero, pow_zero, sub_add_cancel_left, Int.reduceNeg, IsUnit.neg_iff, isUnit_one,
Int.natAbs_of_isUnit, pow_one, true_and]
rw [inv_mul_cancel₀]
exact ne_of_gt hq.left
have hk (_t) : (Q n q *ᵥ a) ⟨k, _t⟩ = X + Y := by
unfold X Y
rw [mulVec, dotProduct, <-Finset.sum_union XY_disj, <-XY_union]
have hk1 (_t) : (Q n q *ᵥ a) ⟨k+1, _t⟩ = q*X + q⁻¹*Y := by
unfold X Y
rw [mulVec, dotProduct]
rw [Finset.mul_sum, Finset.mul_sum]
rw [<-XY_union, Finset.sum_union XY_disj]
congr 1 <;> { apply Finset.sum_bij (fun x _ => x) <;> [simp; simp; simp; grind] }
constructor
· rw [lt_div_iff₀ (by grind only)]
rw [hk, hk1, mul_add]
rw [add_lt_add_iff_left]
field_simp
exact q_lt_inv_q
· rw [div_lt_iff₀ (by grind only)]
rw [hk, hk1, mul_add, one_div]
rw [add_lt_add_iff_right]
field_simp
exact q_lt_inv_q
-- (c) --
· simp_rw [mulVec, <-sum_dotProduct]
rw [dotProduct, Finset.mul_sum]
simp_rw [Finset.sum_apply]
have h (i) : (∑ j, Q n q j i) * a i < (1 + q) / (1 - q) * a i := by
rw [mul_lt_mul_iff_left₀ (apos i)]
unfold Q m
calc
_ = ∑ j ∈ Finset.range n, q ^ (j - i.val : ℤ).natAbs := by
apply Finset.sum_bij (fun i _ => i.val)
· simp
· intro a _ b _ e
exact Fin.eq_of_val_eq e
· intro a h
use ⟨a, by exact Finset.mem_range.mp h⟩
simp
· simp
_ = ∑ j ≤ i.val, q ^ (j - i.val : ℤ).natAbs + ∑ j ∈ Finset.Ioo i.val n, q ^ (j - i.val : ℤ).natAbs := by
rw [<-Finset.sum_union]
· congr
refine Finset.ext_iff.mpr ?_
simp only [Finset.mem_range, Finset.mem_union, Finset.mem_Iic, Finset.mem_Ioo]
omega
· rw [Finset.disjoint_iff_ne]
simp only [Finset.mem_Iic, Finset.mem_Ioo, ne_eq, and_imp]
omega
_ = ∑ j ≤ i.val, q ^ (i.val - j) + ∑ j ∈ Finset.Ioo i.val n, q ^ (j - i.val) := by
congr 1 <;> {
apply Finset.sum_congr rfl
intro x xh
congr
unfold Int.natAbs
split <;> grind only [= Finset.mem_Iic, = Finset.mem_Ioo, = Lean.Grind.toInt_fin]
}
_ = ∑ k ≤ i.val, q ^ k + ∑ k ∈ Finset.Ioo 0 (n-i.val), q ^ k := by
congr 1
· apply Finset.sum_bij (fun j h => i.val-j)
· simp
· grind only [= Finset.mem_Iic, = Lean.Grind.toInt_fin]
· intro y yh
use i.val - y
simp only [Finset.mem_Iic, tsub_le_iff_right, le_add_iff_nonneg_right, zero_le,
exists_const]
apply Nat.sub_sub_self
exact Finset.mem_Iic.mp yh
· simp
· apply Finset.sum_bij (fun j h => j-i.val)
· simp only [Finset.mem_Ioo, and_imp]
omega
· grind only [= Finset.mem_Ioo, = Lean.Grind.toInt_fin]
· intro y yh
use y + i.val
simp only [add_tsub_cancel_right, Finset.mem_Ioo,
lt_add_iff_pos_left, exists_prop, and_true]
simp only [Finset.mem_Ioo] at yh
omega
· simp
_ = 1 + ∑ k ∈ Finset.Ioc 0 i.val, q ^ k + ∑ k ∈ Finset.Ioo 0 (n-i.val), q ^ k := by
rw [add_left_inj, Finset.sum_eq_add_sum_diff_singleton (i:=0)]
· congr
· simp
_ ≤ 1 + 2 * ∑ k ∈ Finset.Ioo 0 n, q ^ k := by
rw [one_add_one_eq_two.symm, add_mul, one_mul, add_assoc, add_le_add_iff_left]
apply add_le_add <;> {
apply Finset.sum_le_sum_of_subset_of_nonneg
· grind only [= Finset.subset_iff, = Finset.mem_Ioo, = Finset.mem_Ioc]
· intro _ _ _
apply pow_nonneg (le_of_lt hq.left)
}
_ = 1 + 2 * (q * ∑ k < n - 1, q ^ k) := by
congr 2
rw [Finset.mul_sum, Eq.comm]
apply Finset.sum_bij (fun i _ => i+1)
· simp
omega
· simp
· intro y yh
use y-1, ?_
· simp only [Finset.mem_Ioo] at yh; omega
· simp only [Finset.mem_Ioo] at yh; simp only [Finset.mem_Iio]; omega
· simp [pow_succ']
_ < _ := by
rw [Nat.Iio_eq_range, geom_sum_eq (ne_of_lt hq.right)]
apply lt_of_mul_lt_mul_of_nonneg_right (a:=1-q) ?_ (by linarith)
rw [IsUnit.div_mul_cancel, <-mul_assoc, mul_div_assoc', <-neg_div_neg_eq, neg_sub,
add_mul, <-neg_mul, IsUnit.div_mul_cancel, one_mul]
· ring_nf
simp only [add_lt_add_iff_left, sub_lt_self_iff, Nat.ofNat_pos, mul_pos_iff_of_pos_right]
rw [mul_pow_sub_one nnz.out]
apply pow_pos hq.left
· exact Ne.isUnit (sub_ne_zero_of_ne (ne_of_gt hq.right))
· exact Ne.isUnit (sub_ne_zero_of_ne (ne_of_gt hq.right))
apply Finset.sum_lt_sum
· intro i _
exact le_of_lt (h i)
· use 0
simp [h 0]
end Imo1973P6
| true | Copyright (c) 2026 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1973, Problem 6
Let $a_1, a_2,\cdots, a_n$ be $n$ positive numbers,
and let $q$ be a given real number such that $0 < q < 1$. Find $n$ numbers $b_1, b_2, \cdots, b_n$ for which
(a) $a_k < b_k$ for $k=1,2,\cdots, n$,
(b) $q < \dfrac{b_{k+1}}{b_k}<\dfrac{1}{q}$ for $k=1,2,\cdots,n-1$,
(c) $b_1+b_2+\cdots+b_n < \dfrac{1+q}{1-q}(a_1+a_2+\cdots+a_n)$.
-/
namespace Imo1973P6
variable (n : ℕ) (a : Fin n → ℝ) (q : ℝ)
open Matrix
def m (_:ℕ) : ℕ → ℕ := fun i => i
theorem m_zero : m n 0 = 0 := by
rfl
theorem m_nonzero (i) (hi1 : 0 < i) : 0 < m n i := hi1
def Q : Fin n → Fin n → ℝ := fun i j => q ^ m n (Int.natAbs (i.val - j.val))
theorem Q_diag_one : ∀ i, Q n q i i = 1 := by
unfold Q
simp [m_zero]
theorem Q_pos (hq : q ∈ Set.Ioo 0 1) : ∀ i j, 0 < Q n q i j := by
unfold Q
intro i j
apply pow_pos
grind only [= Set.mem_Ioo]
theorem Q_row_neighbour_quot (k) (_ : k+1<n) (j) (hq : q ∈ Set.Ioo 0 1) : ∃ f ∈ ({q, q⁻¹} : Finset _),
Q n q ⟨k+1, by omega⟩ j = f * Q n q ⟨k, by omega⟩ j := by
simp only [Finset.mem_insert, Finset.mem_singleton, exists_eq_or_imp, ↓existsAndEq, true_and]
unfold Q
repeat rw [<-mul_inv_eq_iff_eq_mul₀ (by grind [pow_ne_zero])]
rw [<-zpow_natCast, <-zpow_natCast, <-div_eq_mul_inv]
rw [<-zpow_sub₀ (by grind only [= Set.mem_Ioo])]
nth_rw 2 [show q = q^(1 : ℤ) by simp]
rw [show q⁻¹ = q^(-1 : ℤ) by simp]
repeat rw [zpow_right_inj₀ (by grind) (by grind)]
unfold Int.natAbs m
split <;> split
all_goals grind
theorem imo1973_p6_of_n_eq_one (hn : n = 1) (hq : q ∈ Set.Ioo 0 1) (apos : ∀ i, 0 < a i)
: ∃ b : Fin n → ℝ,
(∀ k, a k < b k)
∧ (∀ k, ∀ _ : k < n-1, (b ⟨k+1, by omega⟩) / (b ⟨k, by omega⟩) ∈ Set.Ioo q (1 / q))
∧ (∑ k, b k < (1+q) / (1-q) * ∑ k, a k) := by
subst n
simp only [Fin.forall_fin_one, Fin.isValue, tsub_self, not_lt_zero, one_div, Set.mem_Ioo,
IsEmpty.forall_iff, implies_true, Finset.univ_unique, Fin.default_eq_zero, Finset.sum_singleton,
true_and]
rw [Set.mem_Ioo] at hq
have : 1 < (1 + q) / (1 - q) := by
refine (one_lt_div ?_).mpr ?_ <;> linarith
use fun _ => √((1+q) / (1-q)) * a 0
and_intros
· rw [lt_mul_iff_one_lt_left (apos 0)]
refine (Real.lt_sqrt ?_).mpr ?_ <;> linarith
· rw [mul_lt_mul_iff_left₀ (apos 0)]
refine (Real.sqrt_lt' ?_).mpr ?_ <;> nlinarith
theorem imo1973_p6 (npos : 0 < n) (hq : q ∈ Set.Ioo 0 1) (apos : ∀ i, 0 < a i)
: ∃ b : Fin n → ℝ,
(∀ k, a k < b k)
∧ (∀ k, ∀ _ : k < n-1, (b ⟨k+1, by omega⟩) / (b ⟨k, by omega⟩) ∈ Set.Ioo q (1 / q))
∧ (∑ k, b k < (1+q) / (1-q) * ∑ k, a k) := by
by_cases hn : n = 1
· apply imo1973_p6_of_n_eq_one <;> trivial
use (Q n q *ᵥ a)
have : 1 < n := Nat.lt_of_le_of_ne npos (Ne.symm hn)
have nnz : NeZero n := NeZero.of_gt this
rw [Set.mem_Ioo] at hq
have q_lt_inv_q : q < 1 / q := by
rw [lt_div_iff₀, <-sq, sq_lt_one_iff₀] <;> linarith
and_intros
-- (a) --
· intro k
rw [mulVec, dotProduct]
calc
_ < a k + Q n q k (k+1) * a (k + 1) := by
simp [apos, Q_pos n q hq]
_ = Q n q k k * a k + Q n q k (k+1) * a (k + 1) := by
simp [Q_diag_one]
_ = ∑ i ∈ {k, k+1}, Q n q k i * a i := by
rw [Finset.sum_insert, Finset.sum_singleton]
rw [Finset.mem_singleton]
rw [left_eq_add, Fin.one_eq_zero_iff]
omega
_ ≤ _ := by
refine Finset.sum_le_univ_sum_of_nonneg ?_
simp [le_of_lt (apos _), Q_pos n q hq]
-- (b) --
· intro k klt
let Xi : Finset _ := {i | Q n q ⟨k+1, by omega⟩ i = q * Q n q ⟨k, by omega⟩ i}
let Yi : Finset _ := {i | Q n q ⟨k+1, by omega⟩ i = q⁻¹ * Q n q ⟨k, by omega⟩ i}
have XY_union : Xi ∪ Yi = Finset.univ := by
apply Finset.eq_univ_of_forall
intro i
apply (Q_row_neighbour_quot n q k (by omega) i hq).elim
intro qq ⟨hqq, e⟩
simp only [Finset.mem_insert, Finset.mem_singleton] at hqq
apply hqq.elim
· intro _
subst qq
apply Finset.mem_union_left
unfold Xi
exact (Finset.mem_filter_univ i).mpr e
· intro _
subst qq
apply Finset.mem_union_right
unfold Yi
exact (Finset.mem_filter_univ i).mpr e
have XY_disj : Disjoint Xi Yi := by
unfold Xi Yi
rw [Finset.disjoint_iff_ne]
simp only [Finset.mem_filter, Finset.mem_univ, true_and, ne_eq]
intro a h1 b h2
by_contra
subst a
rw [h2] at h1
rw [mul_eq_mul_right_iff] at h1
have h (_t) := Q_pos n q hq ⟨k, _t⟩ b
rcases h1 with hq_eq | hb0
· have := q_lt_inv_q; rw [one_div, hq_eq] at this; exact absurd this (lt_irrefl q)
· linarith [h (show k < n by omega)]
let X := ∑ i ∈ Xi, Q n q ⟨k, by omega⟩ i * a i
let Y := ∑ i ∈ Yi, Q n q ⟨k, by omega⟩ i * a i
have Xpos : 0 < X := by
unfold X
apply Finset.sum_pos
· intro i _
have h (_t) := Q_pos n q hq ⟨k, _t⟩ i
exact mul_pos (by apply Q_pos _ q hq) (apos i)
· use ⟨k, by omega⟩
unfold Xi Q m
simp
have Ypos : 0 < Y := by
unfold Y
apply Finset.sum_pos
· intro i _
have h (_t) := Q_pos n q hq ⟨k, _t⟩ i
exact mul_pos (by apply Q_pos _ q hq) (apos i)
· use ⟨k+1, by omega⟩
unfold Yi Q m
simp only [Nat.cast_add, Nat.cast_one, Finset.mem_filter, Finset.mem_univ, sub_self,
Int.natAbs_zero, pow_zero, sub_add_cancel_left, Int.reduceNeg, IsUnit.neg_iff, isUnit_one,
Int.natAbs_of_isUnit, pow_one, true_and]
rw [inv_mul_cancel₀]
exact ne_of_gt hq.left
have hk (_t) : (Q n q *ᵥ a) ⟨k, _t⟩ = X + Y := by
unfold X Y
rw [mulVec, dotProduct, <-Finset.sum_union XY_disj, <-XY_union]
have hk1 (_t) : (Q n q *ᵥ a) ⟨k+1, _t⟩ = q*X + q⁻¹*Y := by
unfold X Y
rw [mulVec, dotProduct]
rw [Finset.mul_sum, Finset.mul_sum]
rw [<-XY_union, Finset.sum_union XY_disj]
congr 1 <;> { apply Finset.sum_bij (fun x _ => x) <;> [simp; simp; simp; grind] }
constructor
· rw [lt_div_iff₀ (by grind only)]
rw [hk, hk1, mul_add]
rw [add_lt_add_iff_left]
field_simp
exact q_lt_inv_q
· rw [div_lt_iff₀ (by grind only)]
rw [hk, hk1, mul_add, one_div]
rw [add_lt_add_iff_right]
field_simp
exact q_lt_inv_q
-- (c) --
· simp_rw [mulVec, <-sum_dotProduct]
rw [dotProduct, Finset.mul_sum]
simp_rw [Finset.sum_apply]
have h (i) : (∑ j, Q n q j i) * a i < (1 + q) / (1 - q) * a i := by
rw [mul_lt_mul_iff_left₀ (apos i)]
unfold Q m
calc
_ = ∑ j ∈ Finset.range n, q ^ (j - i.val : ℤ).natAbs := by
apply Finset.sum_bij (fun i _ => i.val)
· simp
· intro a _ b _ e
exact Fin.eq_of_val_eq e
· intro a h
use ⟨a, by exact Finset.mem_range.mp h⟩
simp
· simp
_ = ∑ j ≤ i.val, q ^ (j - i.val : ℤ).natAbs + ∑ j ∈ Finset.Ioo i.val n, q ^ (j - i.val : ℤ).natAbs := by
rw [<-Finset.sum_union]
· congr
refine Finset.ext_iff.mpr ?_
simp only [Finset.mem_range, Finset.mem_union, Finset.mem_Iic, Finset.mem_Ioo]
omega
· rw [Finset.disjoint_iff_ne]
simp only [Finset.mem_Iic, Finset.mem_Ioo, ne_eq, and_imp]
omega
_ = ∑ j ≤ i.val, q ^ (i.val - j) + ∑ j ∈ Finset.Ioo i.val n, q ^ (j - i.val) := by
congr 1 <;> {
apply Finset.sum_congr rfl
intro x xh
congr
unfold Int.natAbs
split <;> grind only [= Finset.mem_Iic, = Finset.mem_Ioo, = Lean.Grind.toInt_fin]
}
_ = ∑ k ≤ i.val, q ^ k + ∑ k ∈ Finset.Ioo 0 (n-i.val), q ^ k := by
congr 1
· apply Finset.sum_bij (fun j h => i.val-j)
· simp
· grind only [= Finset.mem_Iic, = Lean.Grind.toInt_fin]
· intro y yh
use i.val - y
simp only [Finset.mem_Iic, tsub_le_iff_right, le_add_iff_nonneg_right, zero_le,
exists_const]
apply Nat.sub_sub_self
exact Finset.mem_Iic.mp yh
· simp
· apply Finset.sum_bij (fun j h => j-i.val)
· simp only [Finset.mem_Ioo, and_imp]
omega
· grind only [= Finset.mem_Ioo, = Lean.Grind.toInt_fin]
· intro y yh
use y + i.val
simp only [add_tsub_cancel_right, Finset.mem_Ioo,
lt_add_iff_pos_left, exists_prop, and_true]
simp only [Finset.mem_Ioo] at yh
omega
· simp
_ = 1 + ∑ k ∈ Finset.Ioc 0 i.val, q ^ k + ∑ k ∈ Finset.Ioo 0 (n-i.val), q ^ k := by
rw [add_left_inj, Finset.sum_eq_add_sum_diff_singleton (i:=0)]
· congr
· simp
_ ≤ 1 + 2 * ∑ k ∈ Finset.Ioo 0 n, q ^ k := by
rw [one_add_one_eq_two.symm, add_mul, one_mul, add_assoc, add_le_add_iff_left]
apply add_le_add <;> {
apply Finset.sum_le_sum_of_subset_of_nonneg
· grind only [= Finset.subset_iff, = Finset.mem_Ioo, = Finset.mem_Ioc]
· intro _ _ _
apply pow_nonneg (le_of_lt hq.left)
}
_ = 1 + 2 * (q * ∑ k < n - 1, q ^ k) := by
congr 2
rw [Finset.mul_sum, Eq.comm]
apply Finset.sum_bij (fun i _ => i+1)
· simp
omega
· simp
· intro y yh
use y-1, ?_
· simp only [Finset.mem_Ioo] at yh; omega
· simp only [Finset.mem_Ioo] at yh; simp only [Finset.mem_Iio]; omega
· simp [pow_succ']
_ < _ := by
rw [Nat.Iio_eq_range, geom_sum_eq (ne_of_lt hq.right)]
apply lt_of_mul_lt_mul_of_nonneg_right (a:=1-q) ?_ (by linarith)
rw [IsUnit.div_mul_cancel, <-mul_assoc, mul_div_assoc', <-neg_div_neg_eq, neg_sub,
add_mul, <-neg_mul, IsUnit.div_mul_cancel, one_mul]
· ring_nf
simp only [add_lt_add_iff_left, sub_lt_self_iff, Nat.ofNat_pos, mul_pos_iff_of_pos_right]
rw [mul_pow_sub_one nnz.out]
apply pow_pos hq.left
· exact Ne.isUnit (sub_ne_zero_of_ne (ne_of_gt hq.right))
· exact Ne.isUnit (sub_ne_zero_of_ne (ne_of_gt hq.right))
apply Finset.sum_lt_sum
· intro i _
exact le_of_lt (h i)
· use 0
simp [h 0]
end Imo1973P6 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1973P6.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unsolved goals\nn : \u2115\na : Fin n \u2192 \u211d\nq : \u211d\nk : \u2115\nx\u271d : k + 1 < n\nj : ?m.3029\nhq : q \u2208 Set.Ioo 0 1\nf : \u211d\n\u22a2 k + 1 < n", "unknown tactic", "unsolved goals\nn : \u2115\na : Fin n \u2192 \u211d\nq : \u211d\nhn : n = 1\nhq : q \u2208 Set.Ioo 0 1\napos : \u2200 (i : Fin n), 0 < a i\nb : Fin n \u2192 \u211d\nk : \u2115\nx\u271d : k < n - 1\n\u22a2 k + 1 < n", "unknown tactic", "unsolved goals\nn : \u2115\na : Fin n \u2192 \u211d\nq : \u211d\nnpos : 0 < n\nhq : q \u2208 Set.Ioo 0 1\napos : \u2200 (i : Fin n), 0 < a i\nb : Fin n \u2192 \u211d\nk : \u2115\nx\u271d : k < n - 1\n\u22a2 k + 1 < n"], "timeout_s": 600.0, "latency_s": 0.2104, "verified_at": "2026-03-26T18:16:27.435511+00:00"}} | false | true | false | 0.2104 |
compfiles_Imo1974P1 | compfiles | Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Lynn Van Hauwe
-/
import Mathlib
/-!
# International Mathematical Olympiad 1974, Problem 1
Three players $A, B$ and $C$ play the following game:
* On each of three cards an integer is written.
* These three numbers $p, q, r$ satisfy $0 < p < q < r$.
* The three cards are shuffled and one is dealt to each player.
* Each then receives the number of counters indicated by the card he holds.
* Then the cards are shuffled again; the counters remain with the players.
This process (shuffling, dealing, giving out counters) takes place
for at least two rounds. After the last round, $A$ has 20 counters in all,
$B$ has 10 and $C$ has 9. At the last round $B$ received $r$ counters.
Who received $q$ counters on the first round?
-/
/-
Translation of [this proof](https://artofproblemsolving.com/wiki/index.php/1974_IMO_Problems/Problem_1).
We'll model the `game` as a function ℕ → (Fin 3 ≃ Fin 3), mapping round
numbers to bijections between player-indices and card-indices.
Then, for example, `![p,q,r] (game k 2)` is the number of counters won by
player `2` in round `k`.
-/
namespace Imo1974P1
abbrev Player := Fin 3
abbrev solution : Player := 2 -- player C
theorem imo1974_p1
(p q r : ℕ)
(hpqr : 0 < p ∧ p < q ∧ q < r)
(n : ℕ)
(hn : 1 < n)
(game : ℕ → (Player ≃ Fin 3))
(hA : ∑ k ∈ Finset.range n, ![p,q,r] (game k 0) = 20)
(hB : ∑ k ∈ Finset.range n, ![p,q,r] (game k 1) = 10)
(hC : ∑ k ∈ Finset.range n, ![p,q,r] (game k 2) = 9)
(hl : ![p,q,r] (game (n-1) 1) = r)
: game 0 solution = 1 := by
obtain ⟨h0p, hpq, hqr⟩ := hpqr
-- Counters won by player j in round i.
let C i j := ![p,q,r] (game i j)
-- Any score is at least p.
have p_le : ∀i, p ≤ ![p,q,r] i := by
intro i; fin_cases i <;> simp <;> omega
-- Any score is at most r.
have le_r : ∀i, ![p,q,r] i ≤ r := by
intro i; fin_cases i <;> simp <;> omega
-- Because 1 ≤ p and 2 ≤ q and 3 ≤ r, we have 6 ≤ p+q+r.
have hs : 6 ≤ p+q+r := by omega
-- Each round, the players win p+q+r counters in total.
have h_total i : C i 0 + C i 1 + C i 2 = p + q + r := by
rw [←Fin.sum_univ_three]
unfold C
rw [←Fintype.sum_equiv (game i)⁻¹ _ _ (fun _ ↦ rfl)]
simp [Fin.sum_univ_three]
-- The total score, 39, equals n(p+q+r).
have h1 : n*(p+q+r) = 39 := calc
_ = ∑ k ∈ Finset.range n, (p+q+r) := by simp
_ = ∑ k ∈ Finset.range n, (C k 0 + C k 1 + C k 2) := by congr; ext i; rw [←h_total]
_ = ∑ k ∈ Finset.range n, (C k 0)
+ ∑ k ∈ Finset.range n, (C k 1)
+ ∑ k ∈ Finset.range n, (C k 2) := by repeat rw [Finset.sum_add_distrib]
_ = 20 + 10 + 9 := by rw [hA, hB, hC]
-- Thus n ∈ {1,3,13,39}.
have h2 : n ∣ 39 := Dvd.intro (p + q + r) h1
have h3 : n ∈ Nat.divisors 39 := by
apply Nat.mem_divisors.mpr; exact ⟨h2, by decide⟩
-- In fact, n = 3, and p+q+r = 13.
fin_cases h3 <;> try omega
simp only [Nat.succ_eq_add_one, Nat.reduceAdd, Nat.one_lt_ofNat,
Fin.isValue, Nat.add_one_sub_one, Nat.reduceDvd] at *
clear h2 hn
have h4 : p+q+r = 13 := by omega
-- Simplify the score sums.
rw [Finset.sum] at hA hB hC
simp only [Finset.range_val, Multiset.range_succ, Multiset.range_zero, Multiset.cons_zero,
Fin.isValue, Multiset.map_cons, Multiset.map_singleton, Multiset.sum_cons,
Multiset.sum_singleton] at hA hB hC
rw [←Nat.add_assoc] at hA hB hC
-- Show 2+r ≤ 10, and thus r ≤ 8:
have h5 : 2+r ≤ 10 := calc
2+r ≤ r + p + p := by omega
_ ≤ r + C 1 1 + C 0 1 := by gcongr <;> apply p_le
_ = C 2 1 + C 1 1 + C 0 1 := by unfold C; rw [hl]
_ = 10 := hB
have h6 : r ≤ 8 := by omega
-- Show 20 ≤ r+r+r, and thus r > 6:
have h7 : 20 ≤ r+r+r := calc
20 = C 2 0 + C 1 0 + C 0 0 := hA.symm
_ ≤ r+r+r := by gcongr <;> apply le_r
have h8 : r > 6 := by omega
-- Proof idea:
-- hB claims: r + (p|q|r) + (p|q|r) = 10.
-- But neither can be r, because r+r+... > 10.
-- And they can't be (p,q) or (q,p) because we know 13 = r+p+q ≠ 10.
-- So the only options are r+p+p and r+q+q.
have h9 : r + p + p = 10 ∨ r + q + q = 10 := by grind
-- r = 7 leads to a contradiction. Thus r = 8:
have hr : r = 8 := by omega
-- Then p and q are also determined.
have hp : p = 1 := by omega
have hq : q = 4 := by omega
-- Clean up now that we know (p,q,r).
rw [hl] at hB
rw [hp, hq, hr] at hA hB hC p_le le_r
clear h0p hpq hqr hs h1 h4 h5 h6 h7 h8 h9 hl hp hq hr
-- Looking at hB : 8 + G 1 1 + G 0 1 = 10
-- we can deduce that this must be 8 + 1 + 1 = 10
-- and so (game 1) 1 = 0 and (game 0) 1 = 0.
have hg01 : game 0 1 = 0 := by
generalize hg01 : game 0 1 = g01 at hB
generalize hg11 : game 1 1 = g11 at hB
fin_cases g01 <;> fin_cases g11 <;> simp at hB ⊢
-- So (game 0) 2 ≠ 0 (bijective).
have hg020 : game 0 2 ≠ 0 := by
intro h; rw [←h] at hg01
have := Equiv.injective (game 0) hg01
simp only [Fin.isValue, Fin.reduceEq] at this
-- But (game 0) 2 = 2 would make the sum in hC too big.
have hg022 : game 0 2 ≠ 2 := by
intro h; rw [h] at hC
simp only [Fin.isValue, Matrix.cons_val, Nat.reduceEqDiff] at hC; grind
-- So there is only one option left: (game 0) 2 = 1.
unfold solution; omega
end Imo1974P1 | /- | /-
Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Lynn Van Hauwe
-/
import Mathlib
/-!
# International Mathematical Olympiad 1974, Problem 1
Three players $A, B$ and $C$ play the following game:
* On each of three cards an integer is written.
* These three numbers $p, q, r$ satisfy $0 < p < q < r$.
* The three cards are shuffled and one is dealt to each player.
* Each then receives the number of counters indicated by the card he holds.
* Then the cards are shuffled again; the counters remain with the players.
This process (shuffling, dealing, giving out counters) takes place
for at least two rounds. After the last round, $A$ has 20 counters in all,
$B$ has 10 and $C$ has 9. At the last round $B$ received $r$ counters.
Who received $q$ counters on the first round?
-/
/-
Translation of [this proof](https://artofproblemsolving.com/wiki/index.php/1974_IMO_Problems/Problem_1).
We'll model the `game` as a function ℕ → (Fin 3 ≃ Fin 3), mapping round
numbers to bijections between player-indices and card-indices.
Then, for example, `![p,q,r] (game k 2)` is the number of counters won by
player `2` in round `k`.
-/
namespace Imo1974P1
abbrev Player := Fin 3
abbrev solution : Player := 2 -- player C
theorem imo1974_p1
(p q r : ℕ)
(hpqr : 0 < p ∧ p < q ∧ q < r)
(n : ℕ)
(hn : 1 < n)
(game : ℕ → (Player ≃ Fin 3))
(hA : ∑ k ∈ Finset.range n, ![p,q,r] (game k 0) = 20)
(hB : ∑ k ∈ Finset.range n, ![p,q,r] (game k 1) = 10)
(hC : ∑ k ∈ Finset.range n, ![p,q,r] (game k 2) = 9)
(hl : ![p,q,r] (game (n-1) 1) = r)
: game 0 solution = 1 := by
obtain ⟨h0p, hpq, hqr⟩ := hpqr
-- Counters won by player j in round i.
let C i j := ![p,q,r] (game i j)
-- Any score is at least p.
have p_le : ∀i, p ≤ ![p,q,r] i := by
intro i; fin_cases i <;> simp <;> omega
-- Any score is at most r.
have le_r : ∀i, ![p,q,r] i ≤ r := by
intro i; fin_cases i <;> simp <;> omega
-- Because 1 ≤ p and 2 ≤ q and 3 ≤ r, we have 6 ≤ p+q+r.
have hs : 6 ≤ p+q+r := by omega
-- Each round, the players win p+q+r counters in total.
have h_total i : C i 0 + C i 1 + C i 2 = p + q + r := by
rw [←Fin.sum_univ_three]
unfold C
rw [←Fintype.sum_equiv (game i)⁻¹ _ _ (fun _ ↦ rfl)]
simp [Fin.sum_univ_three]
-- The total score, 39, equals n(p+q+r).
have h1 : n*(p+q+r) = 39 := calc
_ = ∑ k ∈ Finset.range n, (p+q+r) := by simp
_ = ∑ k ∈ Finset.range n, (C k 0 + C k 1 + C k 2) := by congr; ext i; rw [←h_total]
_ = ∑ k ∈ Finset.range n, (C k 0)
+ ∑ k ∈ Finset.range n, (C k 1)
+ ∑ k ∈ Finset.range n, (C k 2) := by repeat rw [Finset.sum_add_distrib]
_ = 20 + 10 + 9 := by rw [hA, hB, hC]
-- Thus n ∈ {1,3,13,39}.
have h2 : n ∣ 39 := Dvd.intro (p + q + r) h1
have h3 : n ∈ Nat.divisors 39 := by
apply Nat.mem_divisors.mpr; exact ⟨h2, by decide⟩
-- In fact, n = 3, and p+q+r = 13.
fin_cases h3 <;> try omega
simp only [Nat.succ_eq_add_one, Nat.reduceAdd, Nat.one_lt_ofNat,
Fin.isValue, Nat.add_one_sub_one, Nat.reduceDvd] at *
clear h2 hn
have h4 : p+q+r = 13 := by omega
-- Simplify the score sums.
rw [Finset.sum] at hA hB hC
simp only [Finset.range_val, Multiset.range_succ, Multiset.range_zero, Multiset.cons_zero,
Fin.isValue, Multiset.map_cons, Multiset.map_singleton, Multiset.sum_cons,
Multiset.sum_singleton] at hA hB hC
rw [←Nat.add_assoc] at hA hB hC
-- Show 2+r ≤ 10, and thus r ≤ 8:
have h5 : 2+r ≤ 10 := calc
2+r ≤ r + p + p := by omega
_ ≤ r + C 1 1 + C 0 1 := by gcongr <;> apply p_le
_ = C 2 1 + C 1 1 + C 0 1 := by unfold C; rw [hl]
_ = 10 := hB
have h6 : r ≤ 8 := by omega
-- Show 20 ≤ r+r+r, and thus r > 6:
have h7 : 20 ≤ r+r+r := calc
20 = C 2 0 + C 1 0 + C 0 0 := hA.symm
_ ≤ r+r+r := by gcongr <;> apply le_r
have h8 : r > 6 := by omega
-- Proof idea:
-- hB claims: r + (p|q|r) + (p|q|r) = 10.
-- But neither can be r, because r+r+... > 10.
-- And they can't be (p,q) or (q,p) because we know 13 = r+p+q ≠ 10.
-- So the only options are r+p+p and r+q+q.
have h9 : r + p + p = 10 ∨ r + q + q = 10 := by grind
-- r = 7 leads to a contradiction. Thus r = 8:
have hr : r = 8 := by omega
-- Then p and q are also determined.
have hp : p = 1 := by omega
have hq : q = 4 := by omega
-- Clean up now that we know (p,q,r).
rw [hl] at hB
rw [hp, hq, hr] at hA hB hC p_le le_r
clear h0p hpq hqr hs h1 h4 h5 h6 h7 h8 h9 hl hp hq hr
-- Looking at hB : 8 + G 1 1 + G 0 1 = 10
-- we can deduce that this must be 8 + 1 + 1 = 10
-- and so (game 1) 1 = 0 and (game 0) 1 = 0.
have hg01 : game 0 1 = 0 := by
generalize hg01 : game 0 1 = g01 at hB
generalize hg11 : game 1 1 = g11 at hB
fin_cases g01 <;> fin_cases g11 <;> simp at hB ⊢
-- So (game 0) 2 ≠ 0 (bijective).
have hg020 : game 0 2 ≠ 0 := by
intro h; rw [←h] at hg01
have := Equiv.injective (game 0) hg01
simp only [Fin.isValue, Fin.reduceEq] at this
-- But (game 0) 2 = 2 would make the sum in hC too big.
have hg022 : game 0 2 ≠ 2 := by
intro h; rw [h] at hC
simp only [Fin.isValue, Matrix.cons_val, Nat.reduceEqDiff] at hC; grind
-- So there is only one option left: (game 0) 2 = 1.
unfold solution; omega
end Imo1974P1
| true | Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Lynn Van Hauwe
-/
import Mathlib
/-!
# International Mathematical Olympiad 1974, Problem 1
Three players $A, B$ and $C$ play the following game:
* On each of three cards an integer is written.
* These three numbers $p, q, r$ satisfy $0 < p < q < r$.
* The three cards are shuffled and one is dealt to each player.
* Each then receives the number of counters indicated by the card he holds.
* Then the cards are shuffled again; the counters remain with the players.
This process (shuffling, dealing, giving out counters) takes place
for at least two rounds. After the last round, $A$ has 20 counters in all,
$B$ has 10 and $C$ has 9. At the last round $B$ received $r$ counters.
Who received $q$ counters on the first round?
-/
/-
Translation of [this proof](https://artofproblemsolving.com/wiki/index.php/1974_IMO_Problems/Problem_1).
We'll model the `game` as a function ℕ → (Fin 3 ≃ Fin 3), mapping round
numbers to bijections between player-indices and card-indices.
Then, for example, `![p,q,r] (game k 2)` is the number of counters won by
player `2` in round `k`.
-/
namespace Imo1974P1
abbrev Player := Fin 3
abbrev solution : Player := 2 -- player C
theorem imo1974_p1
(p q r : ℕ)
(hpqr : 0 < p ∧ p < q ∧ q < r)
(n : ℕ)
(hn : 1 < n)
(game : ℕ → (Player ≃ Fin 3))
(hA : ∑ k ∈ Finset.range n, ![p,q,r] (game k 0) = 20)
(hB : ∑ k ∈ Finset.range n, ![p,q,r] (game k 1) = 10)
(hC : ∑ k ∈ Finset.range n, ![p,q,r] (game k 2) = 9)
(hl : ![p,q,r] (game (n-1) 1) = r)
: game 0 solution = 1 := by
obtain ⟨h0p, hpq, hqr⟩ := hpqr
-- Counters won by player j in round i.
let C i j := ![p,q,r] (game i j)
-- Any score is at least p.
have p_le : ∀i, p ≤ ![p,q,r] i := by
intro i; fin_cases i <;> simp <;> omega
-- Any score is at most r.
have le_r : ∀i, ![p,q,r] i ≤ r := by
intro i; fin_cases i <;> simp <;> omega
-- Because 1 ≤ p and 2 ≤ q and 3 ≤ r, we have 6 ≤ p+q+r.
have hs : 6 ≤ p+q+r := by omega
-- Each round, the players win p+q+r counters in total.
have h_total i : C i 0 + C i 1 + C i 2 = p + q + r := by
rw [←Fin.sum_univ_three]
unfold C
rw [←Fintype.sum_equiv (game i)⁻¹ _ _ (fun _ ↦ rfl)]
simp [Fin.sum_univ_three]
-- The total score, 39, equals n(p+q+r).
have h1 : n*(p+q+r) = 39 := calc
_ = ∑ k ∈ Finset.range n, (p+q+r) := by simp
_ = ∑ k ∈ Finset.range n, (C k 0 + C k 1 + C k 2) := by congr; ext i; rw [←h_total]
_ = ∑ k ∈ Finset.range n, (C k 0)
+ ∑ k ∈ Finset.range n, (C k 1)
+ ∑ k ∈ Finset.range n, (C k 2) := by repeat rw [Finset.sum_add_distrib]
_ = 20 + 10 + 9 := by rw [hA, hB, hC]
-- Thus n ∈ {1,3,13,39}.
have h2 : n ∣ 39 := Dvd.intro (p + q + r) h1
have h3 : n ∈ Nat.divisors 39 := by
apply Nat.mem_divisors.mpr; exact ⟨h2, by decide⟩
-- In fact, n = 3, and p+q+r = 13.
fin_cases h3 <;> try omega
simp only [Nat.succ_eq_add_one, Nat.reduceAdd, Nat.one_lt_ofNat,
Fin.isValue, Nat.add_one_sub_one, Nat.reduceDvd] at *
clear h2 hn
have h4 : p+q+r = 13 := by omega
-- Simplify the score sums.
rw [Finset.sum] at hA hB hC
simp only [Finset.range_val, Multiset.range_succ, Multiset.range_zero, Multiset.cons_zero,
Fin.isValue, Multiset.map_cons, Multiset.map_singleton, Multiset.sum_cons,
Multiset.sum_singleton] at hA hB hC
rw [←Nat.add_assoc] at hA hB hC
-- Show 2+r ≤ 10, and thus r ≤ 8:
have h5 : 2+r ≤ 10 := calc
2+r ≤ r + p + p := by omega
_ ≤ r + C 1 1 + C 0 1 := by gcongr <;> apply p_le
_ = C 2 1 + C 1 1 + C 0 1 := by unfold C; rw [hl]
_ = 10 := hB
have h6 : r ≤ 8 := by omega
-- Show 20 ≤ r+r+r, and thus r > 6:
have h7 : 20 ≤ r+r+r := calc
20 = C 2 0 + C 1 0 + C 0 0 := hA.symm
_ ≤ r+r+r := by gcongr <;> apply le_r
have h8 : r > 6 := by omega
-- Proof idea:
-- hB claims: r + (p|q|r) + (p|q|r) = 10.
-- But neither can be r, because r+r+... > 10.
-- And they can't be (p,q) or (q,p) because we know 13 = r+p+q ≠ 10.
-- So the only options are r+p+p and r+q+q.
have h9 : r + p + p = 10 ∨ r + q + q = 10 := by grind
-- r = 7 leads to a contradiction. Thus r = 8:
have hr : r = 8 := by omega
-- Then p and q are also determined.
have hp : p = 1 := by omega
have hq : q = 4 := by omega
-- Clean up now that we know (p,q,r).
rw [hl] at hB
rw [hp, hq, hr] at hA hB hC p_le le_r
clear h0p hpq hqr hs h1 h4 h5 h6 h7 h8 h9 hl hp hq hr
-- Looking at hB : 8 + G 1 1 + G 0 1 = 10
-- we can deduce that this must be 8 + 1 + 1 = 10
-- and so (game 1) 1 = 0 and (game 0) 1 = 0.
have hg01 : game 0 1 = 0 := by
generalize hg01 : game 0 1 = g01 at hB
generalize hg11 : game 1 1 = g11 at hB
fin_cases g01 <;> fin_cases g11 <;> simp at hB ⊢
-- So (game 0) 2 ≠ 0 (bijective).
have hg020 : game 0 2 ≠ 0 := by
intro h; rw [←h] at hg01
have := Equiv.injective (game 0) hg01
simp only [Fin.isValue, Fin.reduceEq] at this
-- But (game 0) 2 = 2 would make the sum in hC too big.
have hg022 : game 0 2 ≠ 2 := by
intro h; rw [h] at hC
simp only [Fin.isValue, Matrix.cons_val, Nat.reduceEqDiff] at hC; grind
-- So there is only one option left: (game 0) 2 = 1.
unfold solution; omega
end Imo1974P1 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1974P1.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 120, "latency_s": 2.4928, "verified_at": "2026-03-30T14:40:11.159523+00:00"}} | true | true | false | 2.4928 |
compfiles_Imo1974P3 | compfiles | Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1974, Problem 3
Prove that the sum from k = 0 to n inclusive of
Choose[2n + 1, 2k + 1] * 2³ᵏ
is not divisible by 5 for any integer n ≥ 0.
-/
namespace Imo1974P3
lemma aux_1 (a : ℕ) :
¬ a ^ 2 ≡ 2 [MOD 5] := by
intro ha
change _ = _ at ha
rw [Nat.pow_mod] at ha
mod_cases H : a % 5 <;>
change _ % _ = _ % 5 at H <;> rw [H] at ha <;> norm_num at ha
lemma aux_2
(a : ℕ) :
¬ a ^ 2 ≡ 3 [MOD 5] := by
intro ha
change _ = _ at ha
rw [Nat.pow_mod] at ha
mod_cases H : a % 5 <;>
change _ % _ = _ % 5 at H <;> rw [H] at ha <;> norm_num at ha
lemma aux_3 (n : ℕ) :
7 ^ (2 * n + 1) ≡ 2 [MOD 5] ∨ 7 ^ (2 * n + 1) ≡ 3 [MOD 5] := by
change _ = _ ∨ _ = _
rw [Nat.pow_mod, Nat.pow_succ, Nat.pow_mul]
norm_num1
rw [Nat.mul_mod]
obtain he | ho := Nat.even_or_odd n
· rw [even_iff_exists_two_mul] at he
obtain ⟨b, hb⟩ := he
left
rw [hb, Nat.pow_mul, Nat.pow_mod]
norm_num
· right
rw [odd_iff_exists_bit1] at ho
obtain ⟨b, hb⟩ := ho
rw [hb, Nat.pow_add, Nat.mul_mod (4^(2 * b)), Nat.pow_mul, Nat.pow_mod]
norm_num
lemma aux_4
(n b a : ℕ)
(k : ℝ)
(hb₁ : ↑b = 1 / k * ∑ x ∈ Finset.range (n + 1),
↑((2 * n + 1).choose (2 * x + 1)) * k ^ (2 * x + 1))
(ha₁ : ↑a = ∑ x ∈ Finset.range (n + 1), ↑((2 * n + 1).choose (2 * x)) * k ^ (2 * x))
(hk₀ : k * k⁻¹ = 1) :
(1 + k) ^ (2 * n + 1) = ↑a + ↑b * k := by
rw [mul_comm _ k, hb₁, ← mul_assoc]
rw [← inv_eq_one_div, hk₀, one_mul, ha₁]
rw [add_comm, add_pow k 1 (2 * n + 1)]
simp
clear hb₁ ha₁ b a hk₀
let f : ℕ → ℝ := fun i => ↑((2 * n + 1).choose (i)) * k ^ i
let fs₂ := Finset.range (2 * n + 2)
-- let fs₀ : Finset ℕ := Finset.filter (fun x => Odd x) (Finset.range (2 * n + 2))
let fs₀ : Finset ℕ := fs₂.filter (fun x => Odd x)
let fs₁ : Finset ℕ := fs₂.filter (fun x => Even x)
let fs₃ : Finset ℕ := Finset.range (n + 1)
have h₀: ∑ x ∈ Finset.range (n + 1), ↑((2 * n + 1).choose (2 * x + 1)) * k ^ (2 * x + 1) =
∑ x ∈ fs₀, ↑((2 * n + 1).choose (x)) * k ^ (x) := by
have h₀₁: ∑ x ∈ fs₃, f (2 * x + 1) = ∑ x ∈ (fs₀), f x := by
refine Finset.sum_bij ?i ?_ ?i_inj ?i_surj ?h
· intro a _
exact (2 * a + 1)
· intro a ha₀
have ha₁: a ≤ n := Finset.mem_range_succ_iff.mp ha₀
have ha₂: 2 * a + 1 ≤ 2 * n + 1 := by omega
have ha₃: (2 * a + 1) ∈ fs₂ := Finset.mem_range_succ_iff.mpr ha₂
have ha₄: Odd (2 * a + 1) := odd_two_mul_add_one a
refine Finset.mem_filter.mpr ?_
exact And.symm ⟨ha₄, ha₃⟩
· intro a _ b _ h₃
omega
· intro b hb₀
use ((b - 1) / 2)
grind
· exact fun a _ => rfl
exact h₀₁
have h₁: ∑ x ∈ Finset.range (n + 1), ↑((2 * n + 1).choose (2 * x)) * k ^ (2 * x) =
∑ x ∈ fs₁, ↑((2 * n + 1).choose (x)) * k ^ (x) := by
have h₁₁: ∑ x ∈ fs₃, f (2 * x) = ∑ x ∈ (fs₁), f x := by
refine Finset.sum_bij ?_ ?_ ?_ ?_ ?_
· intro a _
exact (2 * a)
· intro a ha₀
have ha₁: a < n + 1 := List.mem_range.mp ha₀
have ha₂: 2 * a < 2 * n + 2 := by omega
refine Finset.mem_filter.mpr ?_
constructor
· exact Finset.mem_range.mpr ha₂
· exact even_two_mul a
· intro a _ b _ h₃
exact Nat.eq_of_mul_eq_mul_left (by norm_num) h₃
· intro b hb₀
use (b/2)
refine exists_prop.mpr ?_
have hb₁: b ∈ fs₂ ∧ Even b := Finset.mem_filter.mp hb₀
constructor
· have hb₂: b < 2 * n + 2 := by exact List.mem_range.mp hb₁.1
have hb₃: (b / 2) < n + 1 := by exact Nat.div_lt_of_lt_mul hb₂
exact Finset.mem_range.mpr hb₃
· exact Nat.two_mul_div_two_of_even hb₁.2
· exact fun a _ => rfl
exact h₁₁
have h₂: ∑ x ∈ Finset.range (2 * n + 1 + 1), k ^ x * ↑((2 * n + 1).choose x) =
∑ x ∈ fs₂, ↑((2 * n + 1).choose x) * k ^ x := by
refine Finset.sum_congr (rfl) ?_
intro x _
rw [mul_comm]
rw [h₀, h₁, h₂]
have h₃: fs₂ = fs₀ ∪ fs₁ := by
refine Finset.ext_iff.mpr ?_
intro a
constructor
· intro ha₀
refine Finset.mem_union.mpr ?mp.a
have ha₁: Odd a ∨ Even a := Or.symm (Nat.even_or_odd a)
obtain ha₂ | ha₃ := ha₁
· left
exact Finset.mem_filter.mpr ⟨ha₀, ha₂⟩
· right
exact Finset.mem_filter.mpr ⟨ha₀, ha₃⟩
· intro ha₀
apply Finset.mem_union.mp at ha₀
obtain ha₁ | ha₂ := ha₀
· exact Finset.mem_of_mem_filter a ha₁
· exact Finset.mem_of_mem_filter a ha₂
have h₄: Disjoint fs₀ fs₁ := by
refine Finset.disjoint_filter.mpr ?_
intro x _ hx₁
exact Nat.not_even_iff_odd.mpr hx₁
nth_rw 2 [add_comm]
rw [h₃, Finset.sum_union h₄]
lemma aux_5
(n b a : ℕ)
(k : ℝ)
(hb₁ : ↑b = 1 / k * ∑ x ∈ Finset.range (n + 1),
↑((2 * n + 1).choose (2 * x + 1)) * k ^ (2 * x + 1))
(ha₁ : ↑a = ∑ x ∈ Finset.range (n + 1), ↑((2 * n + 1).choose (2 * x)) * k ^ (2 * x))
(hk₀ : k * k⁻¹ = 1) :
(1 - k) ^ (2 * n + 1) = ↑a - ↑b * k := by
rw [mul_comm _ k, hb₁, ← mul_assoc]
rw [← inv_eq_one_div, hk₀, one_mul, ha₁, sub_eq_add_neg]
rw [add_comm 1 _, add_pow (-k) 1 (2 * n + 1)]
simp
clear hb₁ ha₁ b a hk₀
let f₀ : ℕ → ℝ := fun i => ↑((2 * n + 1).choose (i)) * k ^ i
let f₁ : ℕ → ℝ := fun i => ↑((2 * n + 1).choose (i)) * (-k) ^ i
let fs₂ := Finset.range (2 * n + 2)
let fs₀ : Finset ℕ := fs₂.filter (fun x => Odd x)
let fs₁ : Finset ℕ := fs₂.filter (fun x => Even x)
let fs₃ : Finset ℕ := Finset.range (n + 1)
have h₀: ∑ x ∈ Finset.range (n + 1), ↑((2 * n + 1).choose (2 * x + 1)) * k ^ (2 * x + 1) =
- ∑ x ∈ fs₀, ↑((2 * n + 1).choose (x)) * (-k) ^ (x) := by
rw [neg_eq_neg_one_mul, Finset.mul_sum]
have h₀₁: ∑ x ∈ fs₃, f₀ (2 * x + 1) = ∑ x ∈ (fs₀), -1 * f₁ x := by
refine Finset.sum_bij ?i ?_ ?i_inj ?i_surj ?h
· intro a _
exact (2 * a + 1)
· intro a ha₀
have ha₁: a ≤ n := Finset.mem_range_succ_iff.mp ha₀
have ha₂: 2 * a + 1 ≤ 2 * n + 1 := by omega
have ha₃: (2 * a + 1) ∈ fs₂ := Finset.mem_range_succ_iff.mpr ha₂
have ha₄: Odd (2 * a + 1) := odd_two_mul_add_one a
exact Finset.mem_filter.mpr ⟨ha₃, ha₄⟩
· intro a _ b _ h₃
omega
· intro b hb₀
use ((b - 1) / 2)
grind
· intro b hb₀
have hb₁: (-1:ℝ) ^ (b * 2) = 1 := by
refine (neg_one_pow_eq_one_iff_even (by norm_num)).mpr ?_
rw [mul_comm]
exact even_two_mul b
simp only [f₀, f₁]
ring_nf
rw [hb₁, mul_one]
exact h₀₁
have h₁: ∑ x ∈ Finset.range (n + 1), ↑((2 * n + 1).choose (2 * x)) * k ^ (2 * x) =
∑ x ∈ fs₁, ↑((2 * n + 1).choose (x)) * (-k) ^ (x) := by
have h₁₁: ∑ x ∈ fs₃, f₀ (2 * x) = ∑ x ∈ (fs₁), f₁ x := by
refine Finset.sum_bij ?_ ?_ ?_ ?_ ?_
· intro a _
exact (2 * a)
· intro a ha₀
have ha₁: a < n + 1 := List.mem_range.mp ha₀
have ha₂: 2 * a < 2 * n + 2 := by omega
refine Finset.mem_filter.mpr ?_
constructor
· exact Finset.mem_range.mpr ha₂
· exact even_two_mul a
· intro a _ b _ h₃
exact Nat.eq_of_mul_eq_mul_left (by norm_num) h₃
· intro b hb₀
use (b/2)
refine exists_prop.mpr ?_
have hb₁: b ∈ fs₂ ∧ Even b := Finset.mem_filter.mp hb₀
constructor
· have hb₂: b < 2 * n + 2 := List.mem_range.mp hb₁.1
have hb₃: b / 2 < n + 1 := Nat.div_lt_of_lt_mul hb₂
exact Finset.mem_range.mpr hb₃
· exact Nat.two_mul_div_two_of_even hb₁.2
· intro b hb₀
simp [f₀, f₁]
exact h₁₁
have h₂: ∑ x ∈ Finset.range (2 * n + 1 + 1), (-k) ^ x * ↑((2 * n + 1).choose x) =
∑ x ∈ fs₂, ↑((2 * n + 1).choose x) * (-k) ^ x := by
refine Finset.sum_congr (rfl) ?_
intro x _
rw [mul_comm]
rw [h₀, h₁, h₂, sub_neg_eq_add]
have h₃: fs₂ = fs₀ ∪ fs₁ := by
refine Finset.ext_iff.mpr ?_
intro a
constructor
· intro ha₀
refine Finset.mem_union.mpr ?mp.a
have ha₁: Odd a ∨ Even a := by exact Or.symm (Nat.even_or_odd a)
obtain ha₂ | ha₃ := ha₁
· left
exact Finset.mem_filter.mpr ⟨ha₀, ha₂⟩
· right
exact Finset.mem_filter.mpr ⟨ha₀, ha₃⟩
· intro ha₀
apply Finset.mem_union.mp at ha₀
obtain ha₁ | ha₂ := ha₀
· exact Finset.mem_of_mem_filter a ha₁
· exact Finset.mem_of_mem_filter a ha₂
have h₄: Disjoint fs₀ fs₁ := by
refine Finset.disjoint_filter.mpr ?_
intro x _ hx₁
exact Nat.not_even_iff_odd.mpr hx₁
nth_rw 2 [add_comm]
rw [h₃, Finset.sum_union h₄]
theorem imo1974_p3
(n : ℕ) :
¬ 5 ∣ ∑ k ∈ Finset.range (n + 1),
(Nat.choose (2 * n + 1) (2 * k + 1)) * (2^(3 * k)) := by
let k:ℝ := Real.sqrt (8:ℝ)
have hk: k = Real.sqrt (8:ℝ) := by rfl
let b:ℕ := ∑ k ∈ Finset.range (n + 1), (Nat.choose (2 * n + 1) (2 * k + 1)) * (2^(3 * k))
have hb : b = ∑ k ∈ Finset.range (n + 1),
(Nat.choose (2 * n + 1) (2 * k + 1)) * (2^(3 * k)) := by rfl
rw [← hb]
let a := ∑ k ∈ Finset.range (n + 1), (Nat.choose (2 * n + 1) (2 * k) * (2 ^ (3 * k)))
have ha : a = ∑ k ∈ Finset.range (n + 1),
(Nat.choose (2 * n + 1) (2 * k) * (2 ^ (3 * k))) := by rfl
have hb₁: b = (1 / k) *
∑ x ∈ Finset.range (n + 1), (Nat.choose (2 * n + 1) (2 * x + 1)) * (k ^ (2 * x + 1)) := by
rw [hb, hk]
simp
rw [Finset.mul_sum]
refine Finset.sum_congr (rfl) ?_
intro x _
rw [mul_comm ((√8)⁻¹), mul_assoc]
refine mul_eq_mul_left_iff.mpr ?_
left
rw [pow_succ, pow_mul, pow_mul, Real.sq_sqrt (by norm_num)]
norm_num
have ha₁: a = ∑ x ∈ Finset.range (n + 1), (Nat.choose (2 * n + 1) (2 * x) * (k ^ (2 * x))) := by
rw [ha, hk]
simp
refine Finset.sum_congr (rfl) ?_
intro x _
refine mul_eq_mul_left_iff.mpr ?_
left
rw [pow_mul, pow_mul, Real.sq_sqrt (by norm_num)]
norm_num
have hk₀: k * k⁻¹ = 1 := by
refine (mul_inv_eq_one₀ ?_).mpr (rfl)
rw [hk]
norm_num
have h₀: (1 + k) ^ (2 * n + 1) = a + b * k := by
exact aux_4 n b a k hb₁ ha₁ hk₀
have h₁: (1 - k) ^ (2 * n + 1) = a - b * k := by
exact aux_5 n b a k hb₁ ha₁ hk₀
have h₂: ((1 + k) * (1 - k)) ^ (2 * n + 1) = (a + b * k) * (a - b * k) := by
rw [mul_pow, h₀, h₁]
rw [← sq_sub_sq 1 k] at h₂
rw [← sq_sub_sq (↑a) ((↑b:ℝ) * k)] at h₂
rw [mul_pow, hk] at h₂
norm_num at h₂
have h₃: (7:ℕ) ^ (2 * n + 1) = b ^ 2 * 8 - a ^ 2 := by
have h₃₀: Odd (2 * n + 1) := by exact odd_two_mul_add_one n
have h₃₁: (-7:ℝ) = (-1:ℝ) * (7:ℕ) := by norm_num
have h₃₂: (-1:ℝ) ^ (2 * n + 1) = -1 := by exact Odd.neg_one_pow h₃₀
have h₃₃: ↑a ^ 2 - ↑b ^ 2 * 8 = (-1:ℝ) * (↑b ^ 2 * 8 - ↑a ^ 2) := by
linarith
rw [h₃₁, mul_pow, h₃₂, h₃₃] at h₂
simp at h₂
have h₃₄: (7:ℝ) ^ (2 * n + 1) = ↑b ^ 2 * 8 - ↑a ^ 2 := by
linarith
norm_cast at h₃₄
rw [Int.subNatNat_eq_coe] at h₃₄
rw [← Int.toNat_sub, ← h₃₄]
exact rfl
have h₄: 7 ^ (2 * n + 1) ≡ 2 [MOD 5] ∨ 7 ^ (2 * n + 1) ≡ 3 [MOD 5] := by
refine aux_3 n
by_contra! hc₀
have hc₁: b^2 * 8 ≡ 0^2 * 8 [MOD 5] := by
refine Nat.ModEq.mul ?_ rfl
refine Nat.ModEq.pow 2 ?_
exact Nat.modEq_zero_iff_dvd.mpr hc₀
simp at hc₁
have h₅: a ^ 2 < b ^ 2 * 8 := by
have h₅₀: 0 < 7 ^ (2 * n + 1) := by
exact Nat.pow_pos (by norm_num)
rw [h₃] at h₅₀
exact Nat.lt_of_sub_pos h₅₀
obtain h₄₀ | h₄₁ := h₄
· rw [h₃] at h₄₀
have hc₂: b ^ 2 * 8 - a ^ 2 + a ^ 2 ≡ 2 + a ^ 2 [MOD 5] := by
exact Nat.ModEq.add_right (a ^ 2) h₄₀
rw [Nat.sub_add_cancel (le_of_lt h₅)] at hc₂
have hc₃: 3 + (2 + a ^ 2) ≡ 3 [MOD 5] := by
apply Nat.ModEq.trans hc₂.symm at hc₁
exact Nat.ModEq.add_left 3 hc₁
have hc₄: a ^ 2 ≡ 3 [MOD 5] := by
rw [← add_assoc, ← zero_add 3] at hc₃
norm_num at hc₃
exact hc₃
have hc₅: ¬ a ^ 2 ≡ 3 [MOD 5] := by exact aux_2 a
exact hc₅ hc₄
· rw [h₃] at h₄₁
have hc₂: b ^ 2 * 8 - a ^ 2 + a ^ 2 ≡ 3 + a ^ 2 [MOD 5] := by
exact Nat.ModEq.add_right (a ^ 2) h₄₁
rw [Nat.sub_add_cancel (le_of_lt h₅)] at hc₂
apply Nat.ModEq.trans hc₂.symm at hc₁
have hc₃: a ^ 2 ≡ 2 [MOD 5] := Nat.ModEq.add_left_cancel' 3 hc₁
exact aux_1 a hc₃
end Imo1974P3 | /- | /-
Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1974, Problem 3
Prove that the sum from k = 0 to n inclusive of
Choose[2n + 1, 2k + 1] * 2³ᵏ
is not divisible by 5 for any integer n ≥ 0.
-/
namespace Imo1974P3
lemma aux_1 (a : ℕ) :
¬ a ^ 2 ≡ 2 [MOD 5] := by
intro ha
change _ = _ at ha
rw [Nat.pow_mod] at ha
mod_cases H : a % 5 <;>
change _ % _ = _ % 5 at H <;> rw [H] at ha <;> norm_num at ha
lemma aux_2
(a : ℕ) :
¬ a ^ 2 ≡ 3 [MOD 5] := by
intro ha
change _ = _ at ha
rw [Nat.pow_mod] at ha
mod_cases H : a % 5 <;>
change _ % _ = _ % 5 at H <;> rw [H] at ha <;> norm_num at ha
lemma aux_3 (n : ℕ) :
7 ^ (2 * n + 1) ≡ 2 [MOD 5] ∨ 7 ^ (2 * n + 1) ≡ 3 [MOD 5] := by
change _ = _ ∨ _ = _
rw [Nat.pow_mod, Nat.pow_succ, Nat.pow_mul]
norm_num1
rw [Nat.mul_mod]
obtain he | ho := Nat.even_or_odd n
· rw [even_iff_exists_two_mul] at he
obtain ⟨b, hb⟩ := he
left
rw [hb, Nat.pow_mul, Nat.pow_mod]
norm_num
· right
rw [odd_iff_exists_bit1] at ho
obtain ⟨b, hb⟩ := ho
rw [hb, Nat.pow_add, Nat.mul_mod (4^(2 * b)), Nat.pow_mul, Nat.pow_mod]
norm_num
lemma aux_4
(n b a : ℕ)
(k : ℝ)
(hb₁ : ↑b = 1 / k * ∑ x ∈ Finset.range (n + 1),
↑((2 * n + 1).choose (2 * x + 1)) * k ^ (2 * x + 1))
(ha₁ : ↑a = ∑ x ∈ Finset.range (n + 1), ↑((2 * n + 1).choose (2 * x)) * k ^ (2 * x))
(hk₀ : k * k⁻¹ = 1) :
(1 + k) ^ (2 * n + 1) = ↑a + ↑b * k := by
rw [mul_comm _ k, hb₁, ← mul_assoc]
rw [← inv_eq_one_div, hk₀, one_mul, ha₁]
rw [add_comm, add_pow k 1 (2 * n + 1)]
simp
clear hb₁ ha₁ b a hk₀
let f : ℕ → ℝ := fun i => ↑((2 * n + 1).choose (i)) * k ^ i
let fs₂ := Finset.range (2 * n + 2)
-- let fs₀ : Finset ℕ := Finset.filter (fun x => Odd x) (Finset.range (2 * n + 2))
let fs₀ : Finset ℕ := fs₂.filter (fun x => Odd x)
let fs₁ : Finset ℕ := fs₂.filter (fun x => Even x)
let fs₃ : Finset ℕ := Finset.range (n + 1)
have h₀: ∑ x ∈ Finset.range (n + 1), ↑((2 * n + 1).choose (2 * x + 1)) * k ^ (2 * x + 1) =
∑ x ∈ fs₀, ↑((2 * n + 1).choose (x)) * k ^ (x) := by
have h₀₁: ∑ x ∈ fs₃, f (2 * x + 1) = ∑ x ∈ (fs₀), f x := by
refine Finset.sum_bij ?i ?_ ?i_inj ?i_surj ?h
· intro a _
exact (2 * a + 1)
· intro a ha₀
have ha₁: a ≤ n := Finset.mem_range_succ_iff.mp ha₀
have ha₂: 2 * a + 1 ≤ 2 * n + 1 := by omega
have ha₃: (2 * a + 1) ∈ fs₂ := Finset.mem_range_succ_iff.mpr ha₂
have ha₄: Odd (2 * a + 1) := odd_two_mul_add_one a
refine Finset.mem_filter.mpr ?_
exact And.symm ⟨ha₄, ha₃⟩
· intro a _ b _ h₃
omega
· intro b hb₀
use ((b - 1) / 2)
grind
· exact fun a _ => rfl
exact h₀₁
have h₁: ∑ x ∈ Finset.range (n + 1), ↑((2 * n + 1).choose (2 * x)) * k ^ (2 * x) =
∑ x ∈ fs₁, ↑((2 * n + 1).choose (x)) * k ^ (x) := by
have h₁₁: ∑ x ∈ fs₃, f (2 * x) = ∑ x ∈ (fs₁), f x := by
refine Finset.sum_bij ?_ ?_ ?_ ?_ ?_
· intro a _
exact (2 * a)
· intro a ha₀
have ha₁: a < n + 1 := List.mem_range.mp ha₀
have ha₂: 2 * a < 2 * n + 2 := by omega
refine Finset.mem_filter.mpr ?_
constructor
· exact Finset.mem_range.mpr ha₂
· exact even_two_mul a
· intro a _ b _ h₃
exact Nat.eq_of_mul_eq_mul_left (by norm_num) h₃
· intro b hb₀
use (b/2)
refine exists_prop.mpr ?_
have hb₁: b ∈ fs₂ ∧ Even b := Finset.mem_filter.mp hb₀
constructor
· have hb₂: b < 2 * n + 2 := by exact List.mem_range.mp hb₁.1
have hb₃: (b / 2) < n + 1 := by exact Nat.div_lt_of_lt_mul hb₂
exact Finset.mem_range.mpr hb₃
· exact Nat.two_mul_div_two_of_even hb₁.2
· exact fun a _ => rfl
exact h₁₁
have h₂: ∑ x ∈ Finset.range (2 * n + 1 + 1), k ^ x * ↑((2 * n + 1).choose x) =
∑ x ∈ fs₂, ↑((2 * n + 1).choose x) * k ^ x := by
refine Finset.sum_congr (rfl) ?_
intro x _
rw [mul_comm]
rw [h₀, h₁, h₂]
have h₃: fs₂ = fs₀ ∪ fs₁ := by
refine Finset.ext_iff.mpr ?_
intro a
constructor
· intro ha₀
refine Finset.mem_union.mpr ?mp.a
have ha₁: Odd a ∨ Even a := Or.symm (Nat.even_or_odd a)
obtain ha₂ | ha₃ := ha₁
· left
exact Finset.mem_filter.mpr ⟨ha₀, ha₂⟩
· right
exact Finset.mem_filter.mpr ⟨ha₀, ha₃⟩
· intro ha₀
apply Finset.mem_union.mp at ha₀
obtain ha₁ | ha₂ := ha₀
· exact Finset.mem_of_mem_filter a ha₁
· exact Finset.mem_of_mem_filter a ha₂
have h₄: Disjoint fs₀ fs₁ := by
refine Finset.disjoint_filter.mpr ?_
intro x _ hx₁
exact Nat.not_even_iff_odd.mpr hx₁
nth_rw 2 [add_comm]
rw [h₃, Finset.sum_union h₄]
lemma aux_5
(n b a : ℕ)
(k : ℝ)
(hb₁ : ↑b = 1 / k * ∑ x ∈ Finset.range (n + 1),
↑((2 * n + 1).choose (2 * x + 1)) * k ^ (2 * x + 1))
(ha₁ : ↑a = ∑ x ∈ Finset.range (n + 1), ↑((2 * n + 1).choose (2 * x)) * k ^ (2 * x))
(hk₀ : k * k⁻¹ = 1) :
(1 - k) ^ (2 * n + 1) = ↑a - ↑b * k := by
rw [mul_comm _ k, hb₁, ← mul_assoc]
rw [← inv_eq_one_div, hk₀, one_mul, ha₁, sub_eq_add_neg]
rw [add_comm 1 _, add_pow (-k) 1 (2 * n + 1)]
simp
clear hb₁ ha₁ b a hk₀
let f₀ : ℕ → ℝ := fun i => ↑((2 * n + 1).choose (i)) * k ^ i
let f₁ : ℕ → ℝ := fun i => ↑((2 * n + 1).choose (i)) * (-k) ^ i
let fs₂ := Finset.range (2 * n + 2)
let fs₀ : Finset ℕ := fs₂.filter (fun x => Odd x)
let fs₁ : Finset ℕ := fs₂.filter (fun x => Even x)
let fs₃ : Finset ℕ := Finset.range (n + 1)
have h₀: ∑ x ∈ Finset.range (n + 1), ↑((2 * n + 1).choose (2 * x + 1)) * k ^ (2 * x + 1) =
- ∑ x ∈ fs₀, ↑((2 * n + 1).choose (x)) * (-k) ^ (x) := by
rw [neg_eq_neg_one_mul, Finset.mul_sum]
have h₀₁: ∑ x ∈ fs₃, f₀ (2 * x + 1) = ∑ x ∈ (fs₀), -1 * f₁ x := by
refine Finset.sum_bij ?i ?_ ?i_inj ?i_surj ?h
· intro a _
exact (2 * a + 1)
· intro a ha₀
have ha₁: a ≤ n := Finset.mem_range_succ_iff.mp ha₀
have ha₂: 2 * a + 1 ≤ 2 * n + 1 := by omega
have ha₃: (2 * a + 1) ∈ fs₂ := Finset.mem_range_succ_iff.mpr ha₂
have ha₄: Odd (2 * a + 1) := odd_two_mul_add_one a
exact Finset.mem_filter.mpr ⟨ha₃, ha₄⟩
· intro a _ b _ h₃
omega
· intro b hb₀
use ((b - 1) / 2)
grind
· intro b hb₀
have hb₁: (-1:ℝ) ^ (b * 2) = 1 := by
refine (neg_one_pow_eq_one_iff_even (by norm_num)).mpr ?_
rw [mul_comm]
exact even_two_mul b
simp only [f₀, f₁]
ring_nf
rw [hb₁, mul_one]
exact h₀₁
have h₁: ∑ x ∈ Finset.range (n + 1), ↑((2 * n + 1).choose (2 * x)) * k ^ (2 * x) =
∑ x ∈ fs₁, ↑((2 * n + 1).choose (x)) * (-k) ^ (x) := by
have h₁₁: ∑ x ∈ fs₃, f₀ (2 * x) = ∑ x ∈ (fs₁), f₁ x := by
refine Finset.sum_bij ?_ ?_ ?_ ?_ ?_
· intro a _
exact (2 * a)
· intro a ha₀
have ha₁: a < n + 1 := List.mem_range.mp ha₀
have ha₂: 2 * a < 2 * n + 2 := by omega
refine Finset.mem_filter.mpr ?_
constructor
· exact Finset.mem_range.mpr ha₂
· exact even_two_mul a
· intro a _ b _ h₃
exact Nat.eq_of_mul_eq_mul_left (by norm_num) h₃
· intro b hb₀
use (b/2)
refine exists_prop.mpr ?_
have hb₁: b ∈ fs₂ ∧ Even b := Finset.mem_filter.mp hb₀
constructor
· have hb₂: b < 2 * n + 2 := List.mem_range.mp hb₁.1
have hb₃: b / 2 < n + 1 := Nat.div_lt_of_lt_mul hb₂
exact Finset.mem_range.mpr hb₃
· exact Nat.two_mul_div_two_of_even hb₁.2
· intro b hb₀
simp [f₀, f₁]
exact h₁₁
have h₂: ∑ x ∈ Finset.range (2 * n + 1 + 1), (-k) ^ x * ↑((2 * n + 1).choose x) =
∑ x ∈ fs₂, ↑((2 * n + 1).choose x) * (-k) ^ x := by
refine Finset.sum_congr (rfl) ?_
intro x _
rw [mul_comm]
rw [h₀, h₁, h₂, sub_neg_eq_add]
have h₃: fs₂ = fs₀ ∪ fs₁ := by
refine Finset.ext_iff.mpr ?_
intro a
constructor
· intro ha₀
refine Finset.mem_union.mpr ?mp.a
have ha₁: Odd a ∨ Even a := by exact Or.symm (Nat.even_or_odd a)
obtain ha₂ | ha₃ := ha₁
· left
exact Finset.mem_filter.mpr ⟨ha₀, ha₂⟩
· right
exact Finset.mem_filter.mpr ⟨ha₀, ha₃⟩
· intro ha₀
apply Finset.mem_union.mp at ha₀
obtain ha₁ | ha₂ := ha₀
· exact Finset.mem_of_mem_filter a ha₁
· exact Finset.mem_of_mem_filter a ha₂
have h₄: Disjoint fs₀ fs₁ := by
refine Finset.disjoint_filter.mpr ?_
intro x _ hx₁
exact Nat.not_even_iff_odd.mpr hx₁
nth_rw 2 [add_comm]
rw [h₃, Finset.sum_union h₄]
theorem imo1974_p3
(n : ℕ) :
¬ 5 ∣ ∑ k ∈ Finset.range (n + 1),
(Nat.choose (2 * n + 1) (2 * k + 1)) * (2^(3 * k)) := by
let k:ℝ := Real.sqrt (8:ℝ)
have hk: k = Real.sqrt (8:ℝ) := by rfl
let b:ℕ := ∑ k ∈ Finset.range (n + 1), (Nat.choose (2 * n + 1) (2 * k + 1)) * (2^(3 * k))
have hb : b = ∑ k ∈ Finset.range (n + 1),
(Nat.choose (2 * n + 1) (2 * k + 1)) * (2^(3 * k)) := by rfl
rw [← hb]
let a := ∑ k ∈ Finset.range (n + 1), (Nat.choose (2 * n + 1) (2 * k) * (2 ^ (3 * k)))
have ha : a = ∑ k ∈ Finset.range (n + 1),
(Nat.choose (2 * n + 1) (2 * k) * (2 ^ (3 * k))) := by rfl
have hb₁: b = (1 / k) *
∑ x ∈ Finset.range (n + 1), (Nat.choose (2 * n + 1) (2 * x + 1)) * (k ^ (2 * x + 1)) := by
rw [hb, hk]
simp
rw [Finset.mul_sum]
refine Finset.sum_congr (rfl) ?_
intro x _
rw [mul_comm ((√8)⁻¹), mul_assoc]
refine mul_eq_mul_left_iff.mpr ?_
left
rw [pow_succ, pow_mul, pow_mul, Real.sq_sqrt (by norm_num)]
norm_num
have ha₁: a = ∑ x ∈ Finset.range (n + 1), (Nat.choose (2 * n + 1) (2 * x) * (k ^ (2 * x))) := by
rw [ha, hk]
simp
refine Finset.sum_congr (rfl) ?_
intro x _
refine mul_eq_mul_left_iff.mpr ?_
left
rw [pow_mul, pow_mul, Real.sq_sqrt (by norm_num)]
norm_num
have hk₀: k * k⁻¹ = 1 := by
refine (mul_inv_eq_one₀ ?_).mpr (rfl)
rw [hk]
norm_num
have h₀: (1 + k) ^ (2 * n + 1) = a + b * k := by
exact aux_4 n b a k hb₁ ha₁ hk₀
have h₁: (1 - k) ^ (2 * n + 1) = a - b * k := by
exact aux_5 n b a k hb₁ ha₁ hk₀
have h₂: ((1 + k) * (1 - k)) ^ (2 * n + 1) = (a + b * k) * (a - b * k) := by
rw [mul_pow, h₀, h₁]
rw [← sq_sub_sq 1 k] at h₂
rw [← sq_sub_sq (↑a) ((↑b:ℝ) * k)] at h₂
rw [mul_pow, hk] at h₂
norm_num at h₂
have h₃: (7:ℕ) ^ (2 * n + 1) = b ^ 2 * 8 - a ^ 2 := by
have h₃₀: Odd (2 * n + 1) := by exact odd_two_mul_add_one n
have h₃₁: (-7:ℝ) = (-1:ℝ) * (7:ℕ) := by norm_num
have h₃₂: (-1:ℝ) ^ (2 * n + 1) = -1 := by exact Odd.neg_one_pow h₃₀
have h₃₃: ↑a ^ 2 - ↑b ^ 2 * 8 = (-1:ℝ) * (↑b ^ 2 * 8 - ↑a ^ 2) := by
linarith
rw [h₃₁, mul_pow, h₃₂, h₃₃] at h₂
simp at h₂
have h₃₄: (7:ℝ) ^ (2 * n + 1) = ↑b ^ 2 * 8 - ↑a ^ 2 := by
linarith
norm_cast at h₃₄
rw [Int.subNatNat_eq_coe] at h₃₄
rw [← Int.toNat_sub, ← h₃₄]
exact rfl
have h₄: 7 ^ (2 * n + 1) ≡ 2 [MOD 5] ∨ 7 ^ (2 * n + 1) ≡ 3 [MOD 5] := by
refine aux_3 n
by_contra! hc₀
have hc₁: b^2 * 8 ≡ 0^2 * 8 [MOD 5] := by
refine Nat.ModEq.mul ?_ rfl
refine Nat.ModEq.pow 2 ?_
exact Nat.modEq_zero_iff_dvd.mpr hc₀
simp at hc₁
have h₅: a ^ 2 < b ^ 2 * 8 := by
have h₅₀: 0 < 7 ^ (2 * n + 1) := by
exact Nat.pow_pos (by norm_num)
rw [h₃] at h₅₀
exact Nat.lt_of_sub_pos h₅₀
obtain h₄₀ | h₄₁ := h₄
· rw [h₃] at h₄₀
have hc₂: b ^ 2 * 8 - a ^ 2 + a ^ 2 ≡ 2 + a ^ 2 [MOD 5] := by
exact Nat.ModEq.add_right (a ^ 2) h₄₀
rw [Nat.sub_add_cancel (le_of_lt h₅)] at hc₂
have hc₃: 3 + (2 + a ^ 2) ≡ 3 [MOD 5] := by
apply Nat.ModEq.trans hc₂.symm at hc₁
exact Nat.ModEq.add_left 3 hc₁
have hc₄: a ^ 2 ≡ 3 [MOD 5] := by
rw [← add_assoc, ← zero_add 3] at hc₃
norm_num at hc₃
exact hc₃
have hc₅: ¬ a ^ 2 ≡ 3 [MOD 5] := by exact aux_2 a
exact hc₅ hc₄
· rw [h₃] at h₄₁
have hc₂: b ^ 2 * 8 - a ^ 2 + a ^ 2 ≡ 3 + a ^ 2 [MOD 5] := by
exact Nat.ModEq.add_right (a ^ 2) h₄₁
rw [Nat.sub_add_cancel (le_of_lt h₅)] at hc₂
apply Nat.ModEq.trans hc₂.symm at hc₁
have hc₃: a ^ 2 ≡ 2 [MOD 5] := Nat.ModEq.add_left_cancel' 3 hc₁
exact aux_1 a hc₃
end Imo1974P3
| true | Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1974, Problem 3
Prove that the sum from k = 0 to n inclusive of
Choose[2n + 1, 2k + 1] * 2³ᵏ
is not divisible by 5 for any integer n ≥ 0.
-/
namespace Imo1974P3
lemma aux_1 (a : ℕ) :
¬ a ^ 2 ≡ 2 [MOD 5] := by
intro ha
change _ = _ at ha
rw [Nat.pow_mod] at ha
mod_cases H : a % 5 <;>
change _ % _ = _ % 5 at H <;> rw [H] at ha <;> norm_num at ha
lemma aux_2
(a : ℕ) :
¬ a ^ 2 ≡ 3 [MOD 5] := by
intro ha
change _ = _ at ha
rw [Nat.pow_mod] at ha
mod_cases H : a % 5 <;>
change _ % _ = _ % 5 at H <;> rw [H] at ha <;> norm_num at ha
lemma aux_3 (n : ℕ) :
7 ^ (2 * n + 1) ≡ 2 [MOD 5] ∨ 7 ^ (2 * n + 1) ≡ 3 [MOD 5] := by
change _ = _ ∨ _ = _
rw [Nat.pow_mod, Nat.pow_succ, Nat.pow_mul]
norm_num1
rw [Nat.mul_mod]
obtain he | ho := Nat.even_or_odd n
· rw [even_iff_exists_two_mul] at he
obtain ⟨b, hb⟩ := he
left
rw [hb, Nat.pow_mul, Nat.pow_mod]
norm_num
· right
rw [odd_iff_exists_bit1] at ho
obtain ⟨b, hb⟩ := ho
rw [hb, Nat.pow_add, Nat.mul_mod (4^(2 * b)), Nat.pow_mul, Nat.pow_mod]
norm_num
lemma aux_4
(n b a : ℕ)
(k : ℝ)
(hb₁ : ↑b = 1 / k * ∑ x ∈ Finset.range (n + 1),
↑((2 * n + 1).choose (2 * x + 1)) * k ^ (2 * x + 1))
(ha₁ : ↑a = ∑ x ∈ Finset.range (n + 1), ↑((2 * n + 1).choose (2 * x)) * k ^ (2 * x))
(hk₀ : k * k⁻¹ = 1) :
(1 + k) ^ (2 * n + 1) = ↑a + ↑b * k := by
rw [mul_comm _ k, hb₁, ← mul_assoc]
rw [← inv_eq_one_div, hk₀, one_mul, ha₁]
rw [add_comm, add_pow k 1 (2 * n + 1)]
simp
clear hb₁ ha₁ b a hk₀
let f : ℕ → ℝ := fun i => ↑((2 * n + 1).choose (i)) * k ^ i
let fs₂ := Finset.range (2 * n + 2)
-- let fs₀ : Finset ℕ := Finset.filter (fun x => Odd x) (Finset.range (2 * n + 2))
let fs₀ : Finset ℕ := fs₂.filter (fun x => Odd x)
let fs₁ : Finset ℕ := fs₂.filter (fun x => Even x)
let fs₃ : Finset ℕ := Finset.range (n + 1)
have h₀: ∑ x ∈ Finset.range (n + 1), ↑((2 * n + 1).choose (2 * x + 1)) * k ^ (2 * x + 1) =
∑ x ∈ fs₀, ↑((2 * n + 1).choose (x)) * k ^ (x) := by
have h₀₁: ∑ x ∈ fs₃, f (2 * x + 1) = ∑ x ∈ (fs₀), f x := by
refine Finset.sum_bij ?i ?_ ?i_inj ?i_surj ?h
· intro a _
exact (2 * a + 1)
· intro a ha₀
have ha₁: a ≤ n := Finset.mem_range_succ_iff.mp ha₀
have ha₂: 2 * a + 1 ≤ 2 * n + 1 := by omega
have ha₃: (2 * a + 1) ∈ fs₂ := Finset.mem_range_succ_iff.mpr ha₂
have ha₄: Odd (2 * a + 1) := odd_two_mul_add_one a
refine Finset.mem_filter.mpr ?_
exact And.symm ⟨ha₄, ha₃⟩
· intro a _ b _ h₃
omega
· intro b hb₀
use ((b - 1) / 2)
grind
· exact fun a _ => rfl
exact h₀₁
have h₁: ∑ x ∈ Finset.range (n + 1), ↑((2 * n + 1).choose (2 * x)) * k ^ (2 * x) =
∑ x ∈ fs₁, ↑((2 * n + 1).choose (x)) * k ^ (x) := by
have h₁₁: ∑ x ∈ fs₃, f (2 * x) = ∑ x ∈ (fs₁), f x := by
refine Finset.sum_bij ?_ ?_ ?_ ?_ ?_
· intro a _
exact (2 * a)
· intro a ha₀
have ha₁: a < n + 1 := List.mem_range.mp ha₀
have ha₂: 2 * a < 2 * n + 2 := by omega
refine Finset.mem_filter.mpr ?_
constructor
· exact Finset.mem_range.mpr ha₂
· exact even_two_mul a
· intro a _ b _ h₃
exact Nat.eq_of_mul_eq_mul_left (by norm_num) h₃
· intro b hb₀
use (b/2)
refine exists_prop.mpr ?_
have hb₁: b ∈ fs₂ ∧ Even b := Finset.mem_filter.mp hb₀
constructor
· have hb₂: b < 2 * n + 2 := by exact List.mem_range.mp hb₁.1
have hb₃: (b / 2) < n + 1 := by exact Nat.div_lt_of_lt_mul hb₂
exact Finset.mem_range.mpr hb₃
· exact Nat.two_mul_div_two_of_even hb₁.2
· exact fun a _ => rfl
exact h₁₁
have h₂: ∑ x ∈ Finset.range (2 * n + 1 + 1), k ^ x * ↑((2 * n + 1).choose x) =
∑ x ∈ fs₂, ↑((2 * n + 1).choose x) * k ^ x := by
refine Finset.sum_congr (rfl) ?_
intro x _
rw [mul_comm]
rw [h₀, h₁, h₂]
have h₃: fs₂ = fs₀ ∪ fs₁ := by
refine Finset.ext_iff.mpr ?_
intro a
constructor
· intro ha₀
refine Finset.mem_union.mpr ?mp.a
have ha₁: Odd a ∨ Even a := Or.symm (Nat.even_or_odd a)
obtain ha₂ | ha₃ := ha₁
· left
exact Finset.mem_filter.mpr ⟨ha₀, ha₂⟩
· right
exact Finset.mem_filter.mpr ⟨ha₀, ha₃⟩
· intro ha₀
apply Finset.mem_union.mp at ha₀
obtain ha₁ | ha₂ := ha₀
· exact Finset.mem_of_mem_filter a ha₁
· exact Finset.mem_of_mem_filter a ha₂
have h₄: Disjoint fs₀ fs₁ := by
refine Finset.disjoint_filter.mpr ?_
intro x _ hx₁
exact Nat.not_even_iff_odd.mpr hx₁
nth_rw 2 [add_comm]
rw [h₃, Finset.sum_union h₄]
lemma aux_5
(n b a : ℕ)
(k : ℝ)
(hb₁ : ↑b = 1 / k * ∑ x ∈ Finset.range (n + 1),
↑((2 * n + 1).choose (2 * x + 1)) * k ^ (2 * x + 1))
(ha₁ : ↑a = ∑ x ∈ Finset.range (n + 1), ↑((2 * n + 1).choose (2 * x)) * k ^ (2 * x))
(hk₀ : k * k⁻¹ = 1) :
(1 - k) ^ (2 * n + 1) = ↑a - ↑b * k := by
rw [mul_comm _ k, hb₁, ← mul_assoc]
rw [← inv_eq_one_div, hk₀, one_mul, ha₁, sub_eq_add_neg]
rw [add_comm 1 _, add_pow (-k) 1 (2 * n + 1)]
simp
clear hb₁ ha₁ b a hk₀
let f₀ : ℕ → ℝ := fun i => ↑((2 * n + 1).choose (i)) * k ^ i
let f₁ : ℕ → ℝ := fun i => ↑((2 * n + 1).choose (i)) * (-k) ^ i
let fs₂ := Finset.range (2 * n + 2)
let fs₀ : Finset ℕ := fs₂.filter (fun x => Odd x)
let fs₁ : Finset ℕ := fs₂.filter (fun x => Even x)
let fs₃ : Finset ℕ := Finset.range (n + 1)
have h₀: ∑ x ∈ Finset.range (n + 1), ↑((2 * n + 1).choose (2 * x + 1)) * k ^ (2 * x + 1) =
- ∑ x ∈ fs₀, ↑((2 * n + 1).choose (x)) * (-k) ^ (x) := by
rw [neg_eq_neg_one_mul, Finset.mul_sum]
have h₀₁: ∑ x ∈ fs₃, f₀ (2 * x + 1) = ∑ x ∈ (fs₀), -1 * f₁ x := by
refine Finset.sum_bij ?i ?_ ?i_inj ?i_surj ?h
· intro a _
exact (2 * a + 1)
· intro a ha₀
have ha₁: a ≤ n := Finset.mem_range_succ_iff.mp ha₀
have ha₂: 2 * a + 1 ≤ 2 * n + 1 := by omega
have ha₃: (2 * a + 1) ∈ fs₂ := Finset.mem_range_succ_iff.mpr ha₂
have ha₄: Odd (2 * a + 1) := odd_two_mul_add_one a
exact Finset.mem_filter.mpr ⟨ha₃, ha₄⟩
· intro a _ b _ h₃
omega
· intro b hb₀
use ((b - 1) / 2)
grind
· intro b hb₀
have hb₁: (-1:ℝ) ^ (b * 2) = 1 := by
refine (neg_one_pow_eq_one_iff_even (by norm_num)).mpr ?_
rw [mul_comm]
exact even_two_mul b
simp only [f₀, f₁]
ring_nf
rw [hb₁, mul_one]
exact h₀₁
have h₁: ∑ x ∈ Finset.range (n + 1), ↑((2 * n + 1).choose (2 * x)) * k ^ (2 * x) =
∑ x ∈ fs₁, ↑((2 * n + 1).choose (x)) * (-k) ^ (x) := by
have h₁₁: ∑ x ∈ fs₃, f₀ (2 * x) = ∑ x ∈ (fs₁), f₁ x := by
refine Finset.sum_bij ?_ ?_ ?_ ?_ ?_
· intro a _
exact (2 * a)
· intro a ha₀
have ha₁: a < n + 1 := List.mem_range.mp ha₀
have ha₂: 2 * a < 2 * n + 2 := by omega
refine Finset.mem_filter.mpr ?_
constructor
· exact Finset.mem_range.mpr ha₂
· exact even_two_mul a
· intro a _ b _ h₃
exact Nat.eq_of_mul_eq_mul_left (by norm_num) h₃
· intro b hb₀
use (b/2)
refine exists_prop.mpr ?_
have hb₁: b ∈ fs₂ ∧ Even b := Finset.mem_filter.mp hb₀
constructor
· have hb₂: b < 2 * n + 2 := List.mem_range.mp hb₁.1
have hb₃: b / 2 < n + 1 := Nat.div_lt_of_lt_mul hb₂
exact Finset.mem_range.mpr hb₃
· exact Nat.two_mul_div_two_of_even hb₁.2
· intro b hb₀
simp [f₀, f₁]
exact h₁₁
have h₂: ∑ x ∈ Finset.range (2 * n + 1 + 1), (-k) ^ x * ↑((2 * n + 1).choose x) =
∑ x ∈ fs₂, ↑((2 * n + 1).choose x) * (-k) ^ x := by
refine Finset.sum_congr (rfl) ?_
intro x _
rw [mul_comm]
rw [h₀, h₁, h₂, sub_neg_eq_add]
have h₃: fs₂ = fs₀ ∪ fs₁ := by
refine Finset.ext_iff.mpr ?_
intro a
constructor
· intro ha₀
refine Finset.mem_union.mpr ?mp.a
have ha₁: Odd a ∨ Even a := by exact Or.symm (Nat.even_or_odd a)
obtain ha₂ | ha₃ := ha₁
· left
exact Finset.mem_filter.mpr ⟨ha₀, ha₂⟩
· right
exact Finset.mem_filter.mpr ⟨ha₀, ha₃⟩
· intro ha₀
apply Finset.mem_union.mp at ha₀
obtain ha₁ | ha₂ := ha₀
· exact Finset.mem_of_mem_filter a ha₁
· exact Finset.mem_of_mem_filter a ha₂
have h₄: Disjoint fs₀ fs₁ := by
refine Finset.disjoint_filter.mpr ?_
intro x _ hx₁
exact Nat.not_even_iff_odd.mpr hx₁
nth_rw 2 [add_comm]
rw [h₃, Finset.sum_union h₄]
theorem imo1974_p3
(n : ℕ) :
¬ 5 ∣ ∑ k ∈ Finset.range (n + 1),
(Nat.choose (2 * n + 1) (2 * k + 1)) * (2^(3 * k)) := by
let k:ℝ := Real.sqrt (8:ℝ)
have hk: k = Real.sqrt (8:ℝ) := by rfl
let b:ℕ := ∑ k ∈ Finset.range (n + 1), (Nat.choose (2 * n + 1) (2 * k + 1)) * (2^(3 * k))
have hb : b = ∑ k ∈ Finset.range (n + 1),
(Nat.choose (2 * n + 1) (2 * k + 1)) * (2^(3 * k)) := by rfl
rw [← hb]
let a := ∑ k ∈ Finset.range (n + 1), (Nat.choose (2 * n + 1) (2 * k) * (2 ^ (3 * k)))
have ha : a = ∑ k ∈ Finset.range (n + 1),
(Nat.choose (2 * n + 1) (2 * k) * (2 ^ (3 * k))) := by rfl
have hb₁: b = (1 / k) *
∑ x ∈ Finset.range (n + 1), (Nat.choose (2 * n + 1) (2 * x + 1)) * (k ^ (2 * x + 1)) := by
rw [hb, hk]
simp
rw [Finset.mul_sum]
refine Finset.sum_congr (rfl) ?_
intro x _
rw [mul_comm ((√8)⁻¹), mul_assoc]
refine mul_eq_mul_left_iff.mpr ?_
left
rw [pow_succ, pow_mul, pow_mul, Real.sq_sqrt (by norm_num)]
norm_num
have ha₁: a = ∑ x ∈ Finset.range (n + 1), (Nat.choose (2 * n + 1) (2 * x) * (k ^ (2 * x))) := by
rw [ha, hk]
simp
refine Finset.sum_congr (rfl) ?_
intro x _
refine mul_eq_mul_left_iff.mpr ?_
left
rw [pow_mul, pow_mul, Real.sq_sqrt (by norm_num)]
norm_num
have hk₀: k * k⁻¹ = 1 := by
refine (mul_inv_eq_one₀ ?_).mpr (rfl)
rw [hk]
norm_num
have h₀: (1 + k) ^ (2 * n + 1) = a + b * k := by
exact aux_4 n b a k hb₁ ha₁ hk₀
have h₁: (1 - k) ^ (2 * n + 1) = a - b * k := by
exact aux_5 n b a k hb₁ ha₁ hk₀
have h₂: ((1 + k) * (1 - k)) ^ (2 * n + 1) = (a + b * k) * (a - b * k) := by
rw [mul_pow, h₀, h₁]
rw [← sq_sub_sq 1 k] at h₂
rw [← sq_sub_sq (↑a) ((↑b:ℝ) * k)] at h₂
rw [mul_pow, hk] at h₂
norm_num at h₂
have h₃: (7:ℕ) ^ (2 * n + 1) = b ^ 2 * 8 - a ^ 2 := by
have h₃₀: Odd (2 * n + 1) := by exact odd_two_mul_add_one n
have h₃₁: (-7:ℝ) = (-1:ℝ) * (7:ℕ) := by norm_num
have h₃₂: (-1:ℝ) ^ (2 * n + 1) = -1 := by exact Odd.neg_one_pow h₃₀
have h₃₃: ↑a ^ 2 - ↑b ^ 2 * 8 = (-1:ℝ) * (↑b ^ 2 * 8 - ↑a ^ 2) := by
linarith
rw [h₃₁, mul_pow, h₃₂, h₃₃] at h₂
simp at h₂
have h₃₄: (7:ℝ) ^ (2 * n + 1) = ↑b ^ 2 * 8 - ↑a ^ 2 := by
linarith
norm_cast at h₃₄
rw [Int.subNatNat_eq_coe] at h₃₄
rw [← Int.toNat_sub, ← h₃₄]
exact rfl
have h₄: 7 ^ (2 * n + 1) ≡ 2 [MOD 5] ∨ 7 ^ (2 * n + 1) ≡ 3 [MOD 5] := by
refine aux_3 n
by_contra! hc₀
have hc₁: b^2 * 8 ≡ 0^2 * 8 [MOD 5] := by
refine Nat.ModEq.mul ?_ rfl
refine Nat.ModEq.pow 2 ?_
exact Nat.modEq_zero_iff_dvd.mpr hc₀
simp at hc₁
have h₅: a ^ 2 < b ^ 2 * 8 := by
have h₅₀: 0 < 7 ^ (2 * n + 1) := by
exact Nat.pow_pos (by norm_num)
rw [h₃] at h₅₀
exact Nat.lt_of_sub_pos h₅₀
obtain h₄₀ | h₄₁ := h₄
· rw [h₃] at h₄₀
have hc₂: b ^ 2 * 8 - a ^ 2 + a ^ 2 ≡ 2 + a ^ 2 [MOD 5] := by
exact Nat.ModEq.add_right (a ^ 2) h₄₀
rw [Nat.sub_add_cancel (le_of_lt h₅)] at hc₂
have hc₃: 3 + (2 + a ^ 2) ≡ 3 [MOD 5] := by
apply Nat.ModEq.trans hc₂.symm at hc₁
exact Nat.ModEq.add_left 3 hc₁
have hc₄: a ^ 2 ≡ 3 [MOD 5] := by
rw [← add_assoc, ← zero_add 3] at hc₃
norm_num at hc₃
exact hc₃
have hc₅: ¬ a ^ 2 ≡ 3 [MOD 5] := by exact aux_2 a
exact hc₅ hc₄
· rw [h₃] at h₄₁
have hc₂: b ^ 2 * 8 - a ^ 2 + a ^ 2 ≡ 3 + a ^ 2 [MOD 5] := by
exact Nat.ModEq.add_right (a ^ 2) h₄₁
rw [Nat.sub_add_cancel (le_of_lt h₅)] at hc₂
apply Nat.ModEq.trans hc₂.symm at hc₁
have hc₃: a ^ 2 ≡ 2 [MOD 5] := Nat.ModEq.add_left_cancel' 3 hc₁
exact aux_1 a hc₃
end Imo1974P3 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1974P3.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unsolved goals\nn : \u2115\nk : \u211d\nf : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * k ^ i\nfs\u2082 : Finset \u2115 := Finset.range (2 * n + 2)\nfs\u2080 : Finset \u2115 := {x \u2208 fs\u2082 | Odd x}\nfs\u2081 : Finset \u2115 := {x \u2208 fs\u2082 | Even x}\nfs\u2083 : Finset \u2115 := Finset.range (n + 1)\na : \u2115\nha\u2080 : a \u2208 fs\u2083\nha\u2081 : a \u2264 n\n\u22a2 2 * a + 1 \u2264 2 * n + 1", "unsolved goals\nn : \u2115\nk : \u211d\nf : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * k ^ i\nfs\u2082 : Finset \u2115 := Finset.range (2 * n + 2)\nfs\u2080 : Finset \u2115 := {x \u2208 fs\u2082 | Odd x}\nfs\u2081 : Finset \u2115 := {x \u2208 fs\u2082 | Even x}\nfs\u2083 : Finset \u2115 := Finset.range (n + 1)\na : \u2115\nha\u2080 : a \u2208 fs\u2083\nha\u2081 : a \u2264 n\nha\u2082 : 2 * a + 1 \u2264 2 * n + 1\n\u22a2 2 * a + 1 \u2208 fs\u2080", "unsolved goals\ncase i_inj\nn : \u2115\nk : \u211d\nf : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * k ^ i\nfs\u2082 : Finset \u2115 := Finset.range (2 * n + 2)\nfs\u2080 : Finset \u2115 := {x \u2208 fs\u2082 | Odd x}\nfs\u2081 : Finset \u2115 := {x \u2208 fs\u2082 | Even x}\nfs\u2083 : Finset \u2115 := Finset.range (n + 1)\n\u22a2 \u2200 a\u2081 \u2208 fs\u2083, \u2200 a\u2082 \u2208 fs\u2083, 2 * a\u2081 + 1 = 2 * a\u2082 + 1 \u2192 a\u2081 = a\u2082\n\ncase i_surj\nn : \u2115\nk : \u211d\nf : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * k ^ i\nfs\u2082 : Finset \u2115 := Finset.range (2 * n + 2)\nfs\u2080 : Finset \u2115 := {x \u2208 fs\u2082 | Odd x}\nfs\u2081 : Finset \u2115 := {x \u2208 fs\u2082 | Even x}\nfs\u2083 : Finset \u2115 := Finset.range (n + 1)\n\u22a2 \u2200 b \u2208 fs\u2080, \u2203 a, \u2203 (_ : a \u2208 fs\u2083), 2 * a + 1 = b\n\ncase h\nn : \u2115\nk : \u211d\nf : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * k ^ i\nfs\u2082 : Finset \u2115 := Finset.range (2 * n + 2)\nfs\u2080 : Finset \u2115 := {x \u2208 fs\u2082 | Odd x}\nfs\u2081 : Finset \u2115 := {x \u2208 fs\u2082 | Even x}\nfs\u2083 : Finset \u2115 := Finset.range (n + 1)\n\u22a2 \u2200 a \u2208 fs\u2083, f (2 * a + 1) = f (2 * a + 1)", "unsolved goals\nn : \u2115\nk : \u211d\nf : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * k ^ i\nfs\u2082 : Finset \u2115 := Finset.range (2 * n + 2)\nfs\u2080 : Finset \u2115 := {x \u2208 fs\u2082 | Odd x}\nfs\u2081 : Finset \u2115 := {x \u2208 fs\u2082 | Even x}\nfs\u2083 : Finset \u2115 := Finset.range (n + 1)\nh\u2080\u2081 : \u2211 x \u2208 fs\u2083, f (2 * x + 1) = \u2211 x \u2208 fs\u2080, f x\n\u22a2 \u2211 x \u2208 Finset.range (n + 1), \u2191((2 * n + 1).choose (2 * x + 1)) * k ^ (2 * x + 1) =\n \u2211 x \u2208 fs\u2080, \u2191((2 * n + 1).choose x) * k ^ x", "unsolved goals\nn : \u2115\nk : \u211d\nf : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * k ^ i\nfs\u2082 : Finset \u2115 := Finset.range (2 * n + 2)\nfs\u2080 : Finset \u2115 := {x \u2208 fs\u2082 | Odd x}\nfs\u2081 : Finset \u2115 := {x \u2208 fs\u2082 | Even x}\nfs\u2083 : Finset \u2115 := Finset.range (n + 1)\nh\u2080 :\n \u2211 x \u2208 Finset.range (n + 1), \u2191((2 * n + 1).choose (2 * x + 1)) * k ^ (2 * x + 1) =\n \u2211 x \u2208 fs\u2080, \u2191((2 * n + 1).choose x) * k ^ x\n\u22a2 \u2211 x \u2208 Finset.range (2 * n + 1 + 1), k ^ x * \u2191((2 * n + 1).choose x) =\n \u2211 x \u2208 Finset.range (n + 1), \u2191((2 * n + 1).choose (2 * x)) * k ^ (2 * x) +\n \u2211 x \u2208 Finset.range (n + 1), \u2191((2 * n + 1).choose (2 * x + 1)) * k ^ (2 * x + 1)", "unknown tactic", "unsolved goals\nn : \u2115\nk : \u211d\nf\u2080 : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * k ^ i\nf\u2081 : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * (-k) ^ i\nfs\u2082 : Finset \u2115 := Finset.range (2 * n + 2)\nfs\u2080 : Finset \u2115 := {x \u2208 fs\u2082 | Odd x}\nfs\u2081 : Finset \u2115 := {x \u2208 fs\u2082 | Even x}\nfs\u2083 : Finset \u2115 := Finset.range (n + 1)\na : \u2115\nha\u2080 : a \u2208 fs\u2083\nha\u2081 : a \u2264 n\n\u22a2 2 * a + 1 \u2264 2 * n + 1", "unsolved goals\nn : \u2115\nk : \u211d\nf\u2080 : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * k ^ i\nf\u2081 : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * (-k) ^ i\nfs\u2082 : Finset \u2115 := Finset.range (2 * n + 2)\nfs\u2080 : Finset \u2115 := {x \u2208 fs\u2082 | Odd x}\nfs\u2081 : Finset \u2115 := {x \u2208 fs\u2082 | Even x}\nfs\u2083 : Finset \u2115 := Finset.range (n + 1)\na : \u2115\nha\u2080 : a \u2208 fs\u2083\nha\u2081 : a \u2264 n\nha\u2082 : 2 * a + 1 \u2264 2 * n + 1\n\u22a2 2 * a + 1 \u2208 fs\u2080", "unsolved goals\ncase i_inj\nn : \u2115\nk : \u211d\nf\u2080 : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * k ^ i\nf\u2081 : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * (-k) ^ i\nfs\u2082 : Finset \u2115 := Finset.range (2 * n + 2)\nfs\u2080 : Finset \u2115 := {x \u2208 fs\u2082 | Odd x}\nfs\u2081 : Finset \u2115 := {x \u2208 fs\u2082 | Even x}\nfs\u2083 : Finset \u2115 := Finset.range (n + 1)\n\u22a2 \u2200 a\u2081 \u2208 fs\u2083, \u2200 a\u2082 \u2208 fs\u2083, 2 * a\u2081 + 1 = 2 * a\u2082 + 1 \u2192 a\u2081 = a\u2082\n\ncase i_surj\nn : \u2115\nk : \u211d\nf\u2080 : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * k ^ i\nf\u2081 : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * (-k) ^ i\nfs\u2082 : Finset \u2115 := Finset.range (2 * n + 2)\nfs\u2080 : Finset \u2115 := {x \u2208 fs\u2082 | Odd x}\nfs\u2081 : Finset \u2115 := {x \u2208 fs\u2082 | Even x}\nfs\u2083 : Finset \u2115 := Finset.range (n + 1)\n\u22a2 \u2200 b \u2208 fs\u2080, \u2203 a, \u2203 (_ : a \u2208 fs\u2083), 2 * a + 1 = b\n\ncase h\nn : \u2115\nk : \u211d\nf\u2080 : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * k ^ i\nf\u2081 : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * (-k) ^ i\nfs\u2082 : Finset \u2115 := Finset.range (2 * n + 2)\nfs\u2080 : Finset \u2115 := {x \u2208 fs\u2082 | Odd x}\nfs\u2081 : Finset \u2115 := {x \u2208 fs\u2082 | Even x}\nfs\u2083 : Finset \u2115 := Finset.range (n + 1)\n\u22a2 \u2200 a \u2208 fs\u2083, f\u2080 (2 * a + 1) = -1 * f\u2081 (2 * a + 1)", "unsolved goals\nn : \u2115\nk : \u211d\nf\u2080 : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * k ^ i\nf\u2081 : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * (-k) ^ i\nfs\u2082 : Finset \u2115 := Finset.range (2 * n + 2)\nfs\u2080 : Finset \u2115 := {x \u2208 fs\u2082 | Odd x}\nfs\u2081 : Finset \u2115 := {x \u2208 fs\u2082 | Even x}\nfs\u2083 : Finset \u2115 := Finset.range (n + 1)\nh\u2080\u2081 : \u2211 x \u2208 fs\u2083, f\u2080 (2 * x + 1) = \u2211 x \u2208 fs\u2080, -1 * f\u2081 x\n\u22a2 \u2211 x \u2208 Finset.range (n + 1), \u2191((2 * n + 1).choose (2 * x + 1)) * k ^ (2 * x + 1) =\n \u2211 i \u2208 fs\u2080, -1 * (\u2191((2 * n + 1).choose i) * (-k) ^ i)", "unsolved goals\nn : \u2115\nk : \u211d\nf\u2080 : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * k ^ i\nf\u2081 : \u2115 \u2192 \u211d := fun i => \u2191((2 * n + 1).choose i) * (-k) ^ i\nfs\u2082 : Finset \u2115 := Finset.range (2 * n + 2)\nfs\u2080 : Finset \u2115 := {x \u2208 fs\u2082 | Odd x}\nfs\u2081 : Finset \u2115 := {x \u2208 fs\u2082 | Even x}\nfs\u2083 : Finset \u2115 := Finset.range (n + 1)\nh\u2080 :\n \u2211 x \u2208 Finset.range (n + 1), \u2191((2 * n + 1).choose (2 * x + 1)) * k ^ (2 * x + 1) =\n -\u2211 x \u2208 fs\u2080, \u2191((2 * n + 1).choose x) * (-k) ^ x\n\u22a2 \u2211 x \u2208 Finset.range (2 * n + 1 + 1), (-k) ^ x * \u2191((2 * n + 1).choose x) =\n \u2211 x \u2208 Finset.range (n + 1), \u2191((2 * n + 1).choose (2 * x)) * k ^ (2 * x) -\n \u2211 x \u2208 Finset.range (n + 1), \u2191((2 * n + 1).choose (2 * x + 1)) * k ^ (2 * x + 1)", "type mismatch\n hc\u2083\nhas type\n 5 + a ^ 2 \u2261 3 [MOD 5] : Prop\nbut is expected to have type\n a ^ 2 \u2261 3 [MOD 5] : Prop"], "timeout_s": 600.0, "latency_s": 3.6842, "verified_at": "2026-03-26T18:16:31.259357+00:00"}} | false | true | false | 3.6842 |
compfiles_Imo1974P5 | compfiles | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1974, Problem 5
What are the possible values of
a / (a + b + d) + b / (a + b + c) + c / (b + c + d) + d / (a + c + d)
as a,b,c,d range over the positive real numbers?
-/
namespace Imo1974P5
abbrev solution_set : Set ℝ := Set.Ioo 1 2
lemma condition_implies_solution_set (s : ℝ)
(h : ∃ a b c d : ℝ,
0 < a ∧ 0 < b ∧ 0 < c ∧ 0 < d ∧
s = a / (a + b + d) + b / (a + b + c) +
c / (b + c + d) + d / (a + c + d)) :
s ∈ solution_set := by
rw [Set.mem_Ioo]
obtain ⟨a, b, c, d, ha, hb, hc, hd, rfl⟩ := h
constructor
· have h8 : a / (a + b + c + d) < a / (a + b + d) :=
div_lt_div_of_pos_left ha (by positivity) (by linarith)
have h9 : b / (a + b + c + d) < b / (a + b + c) :=
div_lt_div_of_pos_left hb (by positivity) (lt_add_of_pos_right _ hd)
have h10 : c / (a + b + c + d) < c / (b + c + d) :=
div_lt_div_of_pos_left hc (by positivity) (by linarith)
have h11 : d / (a + b + c + d) < d / (a + c + d) :=
div_lt_div_of_pos_left hd (by positivity) (by linarith)
calc 1 = a / (a + b + c + d) + b / (a + b + c + d) +
c / (a + b + c + d) + d / (a + b + c + d) := by field_simp
_ < _ := by gcongr
· have h3 : a / (a + b + d) < a / (a + b) :=
div_lt_div_of_pos_left ha (add_pos ha hb) (lt_add_of_pos_right _ hd)
have h4 : b / (a + b + c) < b / (a + b) :=
div_lt_div_of_pos_left hb (add_pos ha hb) (lt_add_of_pos_right _ hc)
have h5 : c / (b + c + d) < c / (c + d) :=
div_lt_div_of_pos_left hc (add_pos hc hd) (by linarith)
have h6 : d / (a + c + d) < d / (c + d) :=
div_lt_div_of_pos_left hd (add_pos hc hd) (by linarith)
calc
_ < a / (a + b) + b / (a + b) + c / (c + d) + d / (c + d) := by gcongr
_ = 2 := by field
noncomputable def S (a b c d : ℝ) : ℝ :=
a / (a + b + d) + b / (a + b + c) +
c / (b + c + d) + d / (a + c + d)
noncomputable def T (t : ℝ) : ℝ := S 1 (1 - t) t (t * (1 - t))
theorem T_continuous : ContinuousOn T (Set.Icc 0 1) := by
unfold T S
fun_prop (disch := (rintro x ⟨a,b⟩; nlinarith))
lemma T0 : T 0 = 1 := by norm_num [T, S]
lemma T1 : T 1 = 2 := by norm_num [T, S]
theorem imo1974_p5 (s : ℝ) :
s ∈ solution_set ↔
∃ a b c d : ℝ, 0 < a ∧ 0 < b ∧ 0 < c ∧ 0 < d ∧
s = a / (a + b + d) + b / (a + b + c) +
c / (b + c + d) + d / (a + c + d) := by
constructor
· intro hx
have h2 := intermediate_value_Ioo zero_le_one T_continuous
rw [T0, T1] at h2
have h4 := h2 hx
rw [Set.mem_image] at h4
obtain ⟨t, ht, hts⟩ := h4
rw [Set.mem_Ioo] at ht
obtain ⟨hta, htb⟩ := ht
use 1, 1 - t, t, (t * (1 - t))
exact ⟨zero_lt_one, sub_pos.mpr htb, hta, by nlinarith, hts.symm⟩
· intro hs; exact condition_implies_solution_set s hs
end Imo1974P5 | /- | /-
Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1974, Problem 5
What are the possible values of
a / (a + b + d) + b / (a + b + c) + c / (b + c + d) + d / (a + c + d)
as a,b,c,d range over the positive real numbers?
-/
namespace Imo1974P5
abbrev solution_set : Set ℝ := Set.Ioo 1 2
lemma condition_implies_solution_set (s : ℝ)
(h : ∃ a b c d : ℝ,
0 < a ∧ 0 < b ∧ 0 < c ∧ 0 < d ∧
s = a / (a + b + d) + b / (a + b + c) +
c / (b + c + d) + d / (a + c + d)) :
s ∈ solution_set := by
rw [Set.mem_Ioo]
obtain ⟨a, b, c, d, ha, hb, hc, hd, rfl⟩ := h
constructor
· have h8 : a / (a + b + c + d) < a / (a + b + d) :=
div_lt_div_of_pos_left ha (by positivity) (by linarith)
have h9 : b / (a + b + c + d) < b / (a + b + c) :=
div_lt_div_of_pos_left hb (by positivity) (lt_add_of_pos_right _ hd)
have h10 : c / (a + b + c + d) < c / (b + c + d) :=
div_lt_div_of_pos_left hc (by positivity) (by linarith)
have h11 : d / (a + b + c + d) < d / (a + c + d) :=
div_lt_div_of_pos_left hd (by positivity) (by linarith)
calc 1 = a / (a + b + c + d) + b / (a + b + c + d) +
c / (a + b + c + d) + d / (a + b + c + d) := by field_simp
_ < _ := by gcongr
· have h3 : a / (a + b + d) < a / (a + b) :=
div_lt_div_of_pos_left ha (add_pos ha hb) (lt_add_of_pos_right _ hd)
have h4 : b / (a + b + c) < b / (a + b) :=
div_lt_div_of_pos_left hb (add_pos ha hb) (lt_add_of_pos_right _ hc)
have h5 : c / (b + c + d) < c / (c + d) :=
div_lt_div_of_pos_left hc (add_pos hc hd) (by linarith)
have h6 : d / (a + c + d) < d / (c + d) :=
div_lt_div_of_pos_left hd (add_pos hc hd) (by linarith)
calc
_ < a / (a + b) + b / (a + b) + c / (c + d) + d / (c + d) := by gcongr
_ = 2 := by field
noncomputable def S (a b c d : ℝ) : ℝ :=
a / (a + b + d) + b / (a + b + c) +
c / (b + c + d) + d / (a + c + d)
noncomputable def T (t : ℝ) : ℝ := S 1 (1 - t) t (t * (1 - t))
theorem T_continuous : ContinuousOn T (Set.Icc 0 1) := by
unfold T S
fun_prop (disch := (rintro x ⟨a,b⟩; nlinarith))
lemma T0 : T 0 = 1 := by norm_num [T, S]
lemma T1 : T 1 = 2 := by norm_num [T, S]
theorem imo1974_p5 (s : ℝ) :
s ∈ solution_set ↔
∃ a b c d : ℝ, 0 < a ∧ 0 < b ∧ 0 < c ∧ 0 < d ∧
s = a / (a + b + d) + b / (a + b + c) +
c / (b + c + d) + d / (a + c + d) := by
constructor
· intro hx
have h2 := intermediate_value_Ioo zero_le_one T_continuous
rw [T0, T1] at h2
have h4 := h2 hx
rw [Set.mem_image] at h4
obtain ⟨t, ht, hts⟩ := h4
rw [Set.mem_Ioo] at ht
obtain ⟨hta, htb⟩ := ht
use 1, 1 - t, t, (t * (1 - t))
exact ⟨zero_lt_one, sub_pos.mpr htb, hta, by nlinarith, hts.symm⟩
· intro hs; exact condition_implies_solution_set s hs
end Imo1974P5
| true | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1974, Problem 5
What are the possible values of
a / (a + b + d) + b / (a + b + c) + c / (b + c + d) + d / (a + c + d)
as a,b,c,d range over the positive real numbers?
-/
namespace Imo1974P5
abbrev solution_set : Set ℝ := Set.Ioo 1 2
lemma condition_implies_solution_set (s : ℝ)
(h : ∃ a b c d : ℝ,
0 < a ∧ 0 < b ∧ 0 < c ∧ 0 < d ∧
s = a / (a + b + d) + b / (a + b + c) +
c / (b + c + d) + d / (a + c + d)) :
s ∈ solution_set := by
rw [Set.mem_Ioo]
obtain ⟨a, b, c, d, ha, hb, hc, hd, rfl⟩ := h
constructor
· have h8 : a / (a + b + c + d) < a / (a + b + d) :=
div_lt_div_of_pos_left ha (by positivity) (by linarith)
have h9 : b / (a + b + c + d) < b / (a + b + c) :=
div_lt_div_of_pos_left hb (by positivity) (lt_add_of_pos_right _ hd)
have h10 : c / (a + b + c + d) < c / (b + c + d) :=
div_lt_div_of_pos_left hc (by positivity) (by linarith)
have h11 : d / (a + b + c + d) < d / (a + c + d) :=
div_lt_div_of_pos_left hd (by positivity) (by linarith)
calc 1 = a / (a + b + c + d) + b / (a + b + c + d) +
c / (a + b + c + d) + d / (a + b + c + d) := by field_simp
_ < _ := by gcongr
· have h3 : a / (a + b + d) < a / (a + b) :=
div_lt_div_of_pos_left ha (add_pos ha hb) (lt_add_of_pos_right _ hd)
have h4 : b / (a + b + c) < b / (a + b) :=
div_lt_div_of_pos_left hb (add_pos ha hb) (lt_add_of_pos_right _ hc)
have h5 : c / (b + c + d) < c / (c + d) :=
div_lt_div_of_pos_left hc (add_pos hc hd) (by linarith)
have h6 : d / (a + c + d) < d / (c + d) :=
div_lt_div_of_pos_left hd (add_pos hc hd) (by linarith)
calc
_ < a / (a + b) + b / (a + b) + c / (c + d) + d / (c + d) := by gcongr
_ = 2 := by field
noncomputable def S (a b c d : ℝ) : ℝ :=
a / (a + b + d) + b / (a + b + c) +
c / (b + c + d) + d / (a + c + d)
noncomputable def T (t : ℝ) : ℝ := S 1 (1 - t) t (t * (1 - t))
theorem T_continuous : ContinuousOn T (Set.Icc 0 1) := by
unfold T S
fun_prop (disch := (rintro x ⟨a,b⟩; nlinarith))
lemma T0 : T 0 = 1 := by norm_num [T, S]
lemma T1 : T 1 = 2 := by norm_num [T, S]
theorem imo1974_p5 (s : ℝ) :
s ∈ solution_set ↔
∃ a b c d : ℝ, 0 < a ∧ 0 < b ∧ 0 < c ∧ 0 < d ∧
s = a / (a + b + d) + b / (a + b + c) +
c / (b + c + d) + d / (a + c + d) := by
constructor
· intro hx
have h2 := intermediate_value_Ioo zero_le_one T_continuous
rw [T0, T1] at h2
have h4 := h2 hx
rw [Set.mem_image] at h4
obtain ⟨t, ht, hts⟩ := h4
rw [Set.mem_Ioo] at ht
obtain ⟨hta, htb⟩ := ht
use 1, 1 - t, t, (t * (1 - t))
exact ⟨zero_lt_one, sub_pos.mpr htb, hta, by nlinarith, hts.symm⟩
· intro hs; exact condition_implies_solution_set s hs
end Imo1974P5 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1974P5.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unsolved goals\na b c d : \u211d\nha : 0 < a\nhb : 0 < b\nhc : 0 < c\nhd : 0 < d\nh3 : a / (a + b + d) < a / (a + b)\nh4 : b / (a + b + c) < b / (a + b)\nh5 : c / (b + c + d) < c / (c + d)\nh6 : d / (a + c + d) < d / (c + d)\n\u22a2 a / (a + b) + b / (a + b) + c / (c + d) + d / (c + d) = 2"], "timeout_s": 600.0, "latency_s": 2.4046, "verified_at": "2026-03-26T18:16:31.734747+00:00"}} | false | true | false | 2.4046 |
compfiles_Imo1975P1 | compfiles | Copyright (c) 2022 Mantas Bakšys. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mantas Bakšys
-/
import Mathlib
/-!
# International Mathematical Olympiad 1975, Problem 1
Let `x₁, x₂, ... , xₙ` and `y₁, y₂, ... , yₙ` be two sequences of real numbers, such that
`x₁ ≥ x₂ ≥ ... ≥ xₙ` and `y₁ ≥ y₂ ≥ ... ≥ yₙ`. Prove that if `z₁, z₂, ... , zₙ` is any permutation
of `y₁, y₂, ... , yₙ`, then `∑ (xᵢ - yᵢ)^2 ≤ ∑ (xᵢ - zᵢ)^2`
-/
namespace Imo1975P1
/- Let `n` be a natural number, `x` and `y` be as in the problem statement and `σ` be the
permutation of natural numbers such that `z = y ∘ σ` -/
variable (n : ℕ) (σ : Equiv.Perm ℕ) (x y : ℕ → ℝ)
theorem imo1975_p1
(hx : AntitoneOn x (Finset.Icc 1 n)) (hy : AntitoneOn y (Finset.Icc 1 n))
(hσ : {x | σ x ≠ x} ⊆ Finset.Icc 1 n) :
∑ i ∈ Finset.Icc 1 n, (x i - y i) ^ 2 ≤ ∑ i ∈ Finset.Icc 1 n, (x i - y (σ i)) ^ 2 := by
/-
Firstly, we expand the squares within both sums and distribute into separate finite sums. Then,
noting that `∑ yᵢ ^ 2 = ∑ zᵢ ^ 2`, it remains to prove that `∑ xᵢ * zᵢ ≤ ∑ xᵢ * yᵢ`, which is true
by the Rearrangement Inequality
-/
simp only [sub_sq, Finset.sum_add_distrib, Finset.sum_sub_distrib]
-- a finite sum is invariant if we permute the order of summation
have hσy : ∑ i ∈ Finset.Icc 1 n, y i ^ 2 = ∑ i ∈ Finset.Icc 1 n, y (σ i) ^ 2 := by
rw [← Equiv.Perm.sum_comp σ (Finset.Icc 1 n) _ hσ]
-- let's cancel terms appearing on both sides
rw [hσy, add_le_add_iff_right, sub_le_sub_iff_left]
simp only [mul_assoc, ← Finset.mul_sum, zero_lt_two, mul_le_mul_iff_right₀]
-- what's left to prove is a version of the rearrangement inequality
apply MonovaryOn.sum_mul_comp_perm_le_sum_mul _ hσ
-- finally we need to show that `x` and `y` 'vary' together on `[1, n]` and this is due to both of
-- them being `decreasing`
exact AntitoneOn.monovaryOn hx hy
end Imo1975P1 | /- | /-
Copyright (c) 2022 Mantas Bakšys. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mantas Bakšys
-/
import Mathlib
/-!
# International Mathematical Olympiad 1975, Problem 1
Let `x₁, x₂, ... , xₙ` and `y₁, y₂, ... , yₙ` be two sequences of real numbers, such that
`x₁ ≥ x₂ ≥ ... ≥ xₙ` and `y₁ ≥ y₂ ≥ ... ≥ yₙ`. Prove that if `z₁, z₂, ... , zₙ` is any permutation
of `y₁, y₂, ... , yₙ`, then `∑ (xᵢ - yᵢ)^2 ≤ ∑ (xᵢ - zᵢ)^2`
-/
namespace Imo1975P1
/- Let `n` be a natural number, `x` and `y` be as in the problem statement and `σ` be the
permutation of natural numbers such that `z = y ∘ σ` -/
variable (n : ℕ) (σ : Equiv.Perm ℕ) (x y : ℕ → ℝ)
theorem imo1975_p1
(hx : AntitoneOn x (Finset.Icc 1 n)) (hy : AntitoneOn y (Finset.Icc 1 n))
(hσ : {x | σ x ≠ x} ⊆ Finset.Icc 1 n) :
∑ i ∈ Finset.Icc 1 n, (x i - y i) ^ 2 ≤ ∑ i ∈ Finset.Icc 1 n, (x i - y (σ i)) ^ 2 := by
/-
Firstly, we expand the squares within both sums and distribute into separate finite sums. Then,
noting that `∑ yᵢ ^ 2 = ∑ zᵢ ^ 2`, it remains to prove that `∑ xᵢ * zᵢ ≤ ∑ xᵢ * yᵢ`, which is true
by the Rearrangement Inequality
-/
simp only [sub_sq, Finset.sum_add_distrib, Finset.sum_sub_distrib]
-- a finite sum is invariant if we permute the order of summation
have hσy : ∑ i ∈ Finset.Icc 1 n, y i ^ 2 = ∑ i ∈ Finset.Icc 1 n, y (σ i) ^ 2 := by
rw [← Equiv.Perm.sum_comp σ (Finset.Icc 1 n) _ hσ]
-- let's cancel terms appearing on both sides
rw [hσy, add_le_add_iff_right, sub_le_sub_iff_left]
simp only [mul_assoc, ← Finset.mul_sum, zero_lt_two, mul_le_mul_iff_right₀]
-- what's left to prove is a version of the rearrangement inequality
apply MonovaryOn.sum_mul_comp_perm_le_sum_mul _ hσ
-- finally we need to show that `x` and `y` 'vary' together on `[1, n]` and this is due to both of
-- them being `decreasing`
exact AntitoneOn.monovaryOn hx hy
end Imo1975P1
| true | Copyright (c) 2022 Mantas Bakšys. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mantas Bakšys
-/
import Mathlib
/-!
# International Mathematical Olympiad 1975, Problem 1
Let `x₁, x₂, ... , xₙ` and `y₁, y₂, ... , yₙ` be two sequences of real numbers, such that
`x₁ ≥ x₂ ≥ ... ≥ xₙ` and `y₁ ≥ y₂ ≥ ... ≥ yₙ`. Prove that if `z₁, z₂, ... , zₙ` is any permutation
of `y₁, y₂, ... , yₙ`, then `∑ (xᵢ - yᵢ)^2 ≤ ∑ (xᵢ - zᵢ)^2`
-/
namespace Imo1975P1
/- Let `n` be a natural number, `x` and `y` be as in the problem statement and `σ` be the
permutation of natural numbers such that `z = y ∘ σ` -/
variable (n : ℕ) (σ : Equiv.Perm ℕ) (x y : ℕ → ℝ)
theorem imo1975_p1
(hx : AntitoneOn x (Finset.Icc 1 n)) (hy : AntitoneOn y (Finset.Icc 1 n))
(hσ : {x | σ x ≠ x} ⊆ Finset.Icc 1 n) :
∑ i ∈ Finset.Icc 1 n, (x i - y i) ^ 2 ≤ ∑ i ∈ Finset.Icc 1 n, (x i - y (σ i)) ^ 2 := by
/-
Firstly, we expand the squares within both sums and distribute into separate finite sums. Then,
noting that `∑ yᵢ ^ 2 = ∑ zᵢ ^ 2`, it remains to prove that `∑ xᵢ * zᵢ ≤ ∑ xᵢ * yᵢ`, which is true
by the Rearrangement Inequality
-/
simp only [sub_sq, Finset.sum_add_distrib, Finset.sum_sub_distrib]
-- a finite sum is invariant if we permute the order of summation
have hσy : ∑ i ∈ Finset.Icc 1 n, y i ^ 2 = ∑ i ∈ Finset.Icc 1 n, y (σ i) ^ 2 := by
rw [← Equiv.Perm.sum_comp σ (Finset.Icc 1 n) _ hσ]
-- let's cancel terms appearing on both sides
rw [hσy, add_le_add_iff_right, sub_le_sub_iff_left]
simp only [mul_assoc, ← Finset.mul_sum, zero_lt_two, mul_le_mul_iff_right₀]
-- what's left to prove is a version of the rearrangement inequality
apply MonovaryOn.sum_mul_comp_perm_le_sum_mul _ hσ
-- finally we need to show that `x` and `y` 'vary' together on `[1, n]` and this is due to both of
-- them being `decreasing`
exact AntitoneOn.monovaryOn hx hy
end Imo1975P1 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1975P1.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown identifier 'mul_le_mul_iff_right\u2080'", "tactic 'apply' failed, could not unify the type of `MonovaryOn.sum_mul_comp_perm_le_sum_mul ?m.8124 h\u03c3`\n \u2211 i \u2208 Finset.Icc 1 n, ?m.8122 i * ?m.8123 (\u03c3 i) \u2264 \u2211 i \u2208 Finset.Icc 1 n, ?m.8122 i * ?m.8123 i\nwith the goal\n 2 * \u2211 i \u2208 Finset.Icc 1 n, x i * y (\u03c3 i) \u2264 2 * \u2211 i \u2208 Finset.Icc 1 n, x i * y i\nn : \u2115\n\u03c3 : Equiv.Perm \u2115\nx y : \u2115 \u2192 \u211d\nhx : AntitoneOn x \u2191(Finset.Icc 1 n)\nhy : AntitoneOn y \u2191(Finset.Icc 1 n)\nh\u03c3 : {x | \u03c3 x \u2260 x} \u2286 \u2191(Finset.Icc 1 n)\nh\u03c3y : \u2211 i \u2208 Finset.Icc 1 n, y i ^ 2 = \u2211 i \u2208 Finset.Icc 1 n, y (\u03c3 i) ^ 2\n\u22a2 2 * \u2211 i \u2208 Finset.Icc 1 n, x i * y (\u03c3 i) \u2264 2 * \u2211 i \u2208 Finset.Icc 1 n, x i * y i"], "timeout_s": 600.0, "latency_s": 0.232, "verified_at": "2026-03-26T18:16:30.972496+00:00"}} | false | true | false | 0.232 |
compfiles_Imo1975P2 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Shahar Blumentzvaig
-/
import Mathlib
/-!
# International Mathematical Olympiad 1975, Problem 2
Let a1 < a2 < a3 < ... be positive integers.
Prove that for every i >= 1,
there are infinitely many a_n that can be written in the form a_n = ra_i + sa_j,
with r, s positive integers and j > i.
-/
namespace Imo1975P2
theorem imo1975_p2 (a : ℕ → ℤ)
(apos : ∀ i : ℕ, 0 < a i)
(ha : ∀ i : ℕ, a i < a (i + 1))
: ∀ i n0 : ℕ,
∃ n, n0 ≤ n ∧
∃ r s : ℕ,
∃ j : ℕ,
a n = r * a i + s * a j ∧
i < j ∧
0 < r ∧
0 < s := by
let b : ℕ → ℕ := fun n => (a n).natAbs
intro i
have hn0 : ∀ j, a j ≠ (0 : ℤ) := fun j ↦ (Int.ne_of_lt (apos j)).symm
intro n0
have h1 : ∃t:ℕ , ∀ n1:ℕ , ∃ n:ℕ , n > n1 ∧ a i ∣ (a n-t) := by
by_contra h2
push_neg at h2
choose f hf using h2
let m := Nat.succ (Finset.sup ((List.range (b i)).toFinset) f)
have h3 : ∀ n>m , ∀ t:ℕ , t < b i → ¬ (a i ∣ a n - t) := by
intro n1 g t1 r
have h4 : m > f t1 := by
have h4' : (Finset.sup (List.range (b i)).toFinset f) >= f t1 := by
apply Finset.le_sup
rw[List.mem_toFinset]
exact List.mem_range.2 r
exact Nat.lt_add_one_of_le h4'
have h6 : n1 > f t1 := Nat.lt_trans h4 g
apply hf t1 n1 h6
have h4 := h3 (m+1) (Nat.lt_add_one m)
let t_int := a (m+1) - (a i)*((a (m+1))/(a i))
let t := t_int.natAbs
have g : (a i)∣ a (m+1) - (a (m+1) - (a i)*((a (m+1))/(a i))) := by
simp
have h5 := h4 t
have h6 : (a i ∣ a (m + 1) - ↑t) → (t ≥ b i) := by
contrapose
intro r
apply lt_of_not_ge at r
exact h5 r
dsimp [t] at h6
dsimp [t_int] at h6
have g : (a (m + 1) - a i * (a (m + 1) / a i))≥0 := by
have r : (a i)*(a (m + 1) / a i) ≤ a (m+1) := Int.mul_ediv_self_le (hn0 i)
omega
have h7 : ↑(a (m + 1) - a i * (a (m + 1) / a i)).natAbs = (a (m + 1) - a i * (a (m + 1) / a i)) := Int.natAbs_of_nonneg g
rw [h7] at h6
simp only [sub_sub_cancel, dvd_mul_right, ge_iff_le, forall_const] at h6
unfold b at h6
have h8 : a (m + 1) - a i * (a (m + 1) / a i) < (a i):= by
have h8' : a i * (a (m + 1) / a i) + (a i) > a (m + 1) := Int.lt_mul_ediv_self_add (apos i)
omega
omega
obtain ⟨t,ht⟩ := h1
have g := ht (n0+i)
obtain ⟨k,hk⟩ := g
rcases hk.right with ⟨x, hx⟩
have g' := ht k
obtain ⟨m,hm⟩ := g'
rcases hm.right with ⟨y, hy⟩
have g : a m = (y-x)*(a i) + (a k) := by
calc
a m = (a m - t) - (a k - t)+(a k) := by ring
_ = a i * y - a i * x +(a k) := by rw [hy, hx]
_ = (y - x) * a i +(a k) := by ring
have rm : n0 ≤ m ∧ ∃ r s j : ℕ, a m = ↑r * a i + ↑s * a j ∧ i < j ∧ 0 < r ∧ 0 < s := by
have r1 : m ≥ n0 := by omega
have r2 : ∃ r s j : ℕ, a m = r * a i + s * a j ∧ i < j ∧ 0 < r ∧ 0 < s := by
have s3 : 0<y-x := by
have t1 : a k < a m := strictMono_nat_of_lt_succ ha hm.left
have t2 : a m - t > a k - t := add_lt_add_left t1 (-t)
rw [hy] at t2
rw [hx] at t2
have : PosMulStrictMono ℤ := PosMulMono.toPosMulStrictMono
have t3 := (mul_lt_mul_iff_right₀ (apos i)).mp t2
exact sub_pos.mpr t3
have s : a m = (y-x) * a i + 1 * a k ∧ i < k ∧ 0 < (y - x).natAbs ∧ (0 : ℕ)<(1 : ℕ) := by
omega
use (y-x).natAbs, 1, k
have abs_eq : ↑((y - x).natAbs) = y - x := by
rw [Int.natAbs_of_nonneg (Int.le_of_lt s3)]
rw [abs_eq]
exact s
exact And.intro r1 r2
use m
end Imo1975P2 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Shahar Blumentzvaig
-/
import Mathlib
/-!
# International Mathematical Olympiad 1975, Problem 2
Let a1 < a2 < a3 < ... be positive integers.
Prove that for every i >= 1,
there are infinitely many a_n that can be written in the form a_n = ra_i + sa_j,
with r, s positive integers and j > i.
-/
namespace Imo1975P2
theorem imo1975_p2 (a : ℕ → ℤ)
(apos : ∀ i : ℕ, 0 < a i)
(ha : ∀ i : ℕ, a i < a (i + 1))
: ∀ i n0 : ℕ,
∃ n, n0 ≤ n ∧
∃ r s : ℕ,
∃ j : ℕ,
a n = r * a i + s * a j ∧
i < j ∧
0 < r ∧
0 < s := by
let b : ℕ → ℕ := fun n => (a n).natAbs
intro i
have hn0 : ∀ j, a j ≠ (0 : ℤ) := fun j ↦ (Int.ne_of_lt (apos j)).symm
intro n0
have h1 : ∃t:ℕ , ∀ n1:ℕ , ∃ n:ℕ , n > n1 ∧ a i ∣ (a n-t) := by
by_contra h2
push_neg at h2
choose f hf using h2
let m := Nat.succ (Finset.sup ((List.range (b i)).toFinset) f)
have h3 : ∀ n>m , ∀ t:ℕ , t < b i → ¬ (a i ∣ a n - t) := by
intro n1 g t1 r
have h4 : m > f t1 := by
have h4' : (Finset.sup (List.range (b i)).toFinset f) >= f t1 := by
apply Finset.le_sup
rw[List.mem_toFinset]
exact List.mem_range.2 r
exact Nat.lt_add_one_of_le h4'
have h6 : n1 > f t1 := Nat.lt_trans h4 g
apply hf t1 n1 h6
have h4 := h3 (m+1) (Nat.lt_add_one m)
let t_int := a (m+1) - (a i)*((a (m+1))/(a i))
let t := t_int.natAbs
have g : (a i)∣ a (m+1) - (a (m+1) - (a i)*((a (m+1))/(a i))) := by
simp
have h5 := h4 t
have h6 : (a i ∣ a (m + 1) - ↑t) → (t ≥ b i) := by
contrapose
intro r
apply lt_of_not_ge at r
exact h5 r
dsimp [t] at h6
dsimp [t_int] at h6
have g : (a (m + 1) - a i * (a (m + 1) / a i))≥0 := by
have r : (a i)*(a (m + 1) / a i) ≤ a (m+1) := Int.mul_ediv_self_le (hn0 i)
omega
have h7 : ↑(a (m + 1) - a i * (a (m + 1) / a i)).natAbs = (a (m + 1) - a i * (a (m + 1) / a i)) := Int.natAbs_of_nonneg g
rw [h7] at h6
simp only [sub_sub_cancel, dvd_mul_right, ge_iff_le, forall_const] at h6
unfold b at h6
have h8 : a (m + 1) - a i * (a (m + 1) / a i) < (a i):= by
have h8' : a i * (a (m + 1) / a i) + (a i) > a (m + 1) := Int.lt_mul_ediv_self_add (apos i)
omega
omega
obtain ⟨t,ht⟩ := h1
have g := ht (n0+i)
obtain ⟨k,hk⟩ := g
rcases hk.right with ⟨x, hx⟩
have g' := ht k
obtain ⟨m,hm⟩ := g'
rcases hm.right with ⟨y, hy⟩
have g : a m = (y-x)*(a i) + (a k) := by
calc
a m = (a m - t) - (a k - t)+(a k) := by ring
_ = a i * y - a i * x +(a k) := by rw [hy, hx]
_ = (y - x) * a i +(a k) := by ring
have rm : n0 ≤ m ∧ ∃ r s j : ℕ, a m = ↑r * a i + ↑s * a j ∧ i < j ∧ 0 < r ∧ 0 < s := by
have r1 : m ≥ n0 := by omega
have r2 : ∃ r s j : ℕ, a m = r * a i + s * a j ∧ i < j ∧ 0 < r ∧ 0 < s := by
have s3 : 0<y-x := by
have t1 : a k < a m := strictMono_nat_of_lt_succ ha hm.left
have t2 : a m - t > a k - t := add_lt_add_left t1 (-t)
rw [hy] at t2
rw [hx] at t2
have : PosMulStrictMono ℤ := PosMulMono.toPosMulStrictMono
have t3 := (mul_lt_mul_iff_right₀ (apos i)).mp t2
exact sub_pos.mpr t3
have s : a m = (y-x) * a i + 1 * a k ∧ i < k ∧ 0 < (y - x).natAbs ∧ (0 : ℕ)<(1 : ℕ) := by
omega
use (y-x).natAbs, 1, k
have abs_eq : ↑((y - x).natAbs) = y - x := by
rw [Int.natAbs_of_nonneg (Int.le_of_lt s3)]
rw [abs_eq]
exact s
exact And.intro r1 r2
use m
end Imo1975P2
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Shahar Blumentzvaig
-/
import Mathlib
/-!
# International Mathematical Olympiad 1975, Problem 2
Let a1 < a2 < a3 < ... be positive integers.
Prove that for every i >= 1,
there are infinitely many a_n that can be written in the form a_n = ra_i + sa_j,
with r, s positive integers and j > i.
-/
namespace Imo1975P2
theorem imo1975_p2 (a : ℕ → ℤ)
(apos : ∀ i : ℕ, 0 < a i)
(ha : ∀ i : ℕ, a i < a (i + 1))
: ∀ i n0 : ℕ,
∃ n, n0 ≤ n ∧
∃ r s : ℕ,
∃ j : ℕ,
a n = r * a i + s * a j ∧
i < j ∧
0 < r ∧
0 < s := by
let b : ℕ → ℕ := fun n => (a n).natAbs
intro i
have hn0 : ∀ j, a j ≠ (0 : ℤ) := fun j ↦ (Int.ne_of_lt (apos j)).symm
intro n0
have h1 : ∃t:ℕ , ∀ n1:ℕ , ∃ n:ℕ , n > n1 ∧ a i ∣ (a n-t) := by
by_contra h2
push_neg at h2
choose f hf using h2
let m := Nat.succ (Finset.sup ((List.range (b i)).toFinset) f)
have h3 : ∀ n>m , ∀ t:ℕ , t < b i → ¬ (a i ∣ a n - t) := by
intro n1 g t1 r
have h4 : m > f t1 := by
have h4' : (Finset.sup (List.range (b i)).toFinset f) >= f t1 := by
apply Finset.le_sup
rw[List.mem_toFinset]
exact List.mem_range.2 r
exact Nat.lt_add_one_of_le h4'
have h6 : n1 > f t1 := Nat.lt_trans h4 g
apply hf t1 n1 h6
have h4 := h3 (m+1) (Nat.lt_add_one m)
let t_int := a (m+1) - (a i)*((a (m+1))/(a i))
let t := t_int.natAbs
have g : (a i)∣ a (m+1) - (a (m+1) - (a i)*((a (m+1))/(a i))) := by
simp
have h5 := h4 t
have h6 : (a i ∣ a (m + 1) - ↑t) → (t ≥ b i) := by
contrapose
intro r
apply lt_of_not_ge at r
exact h5 r
dsimp [t] at h6
dsimp [t_int] at h6
have g : (a (m + 1) - a i * (a (m + 1) / a i))≥0 := by
have r : (a i)*(a (m + 1) / a i) ≤ a (m+1) := Int.mul_ediv_self_le (hn0 i)
omega
have h7 : ↑(a (m + 1) - a i * (a (m + 1) / a i)).natAbs = (a (m + 1) - a i * (a (m + 1) / a i)) := Int.natAbs_of_nonneg g
rw [h7] at h6
simp only [sub_sub_cancel, dvd_mul_right, ge_iff_le, forall_const] at h6
unfold b at h6
have h8 : a (m + 1) - a i * (a (m + 1) / a i) < (a i):= by
have h8' : a i * (a (m + 1) / a i) + (a i) > a (m + 1) := Int.lt_mul_ediv_self_add (apos i)
omega
omega
obtain ⟨t,ht⟩ := h1
have g := ht (n0+i)
obtain ⟨k,hk⟩ := g
rcases hk.right with ⟨x, hx⟩
have g' := ht k
obtain ⟨m,hm⟩ := g'
rcases hm.right with ⟨y, hy⟩
have g : a m = (y-x)*(a i) + (a k) := by
calc
a m = (a m - t) - (a k - t)+(a k) := by ring
_ = a i * y - a i * x +(a k) := by rw [hy, hx]
_ = (y - x) * a i +(a k) := by ring
have rm : n0 ≤ m ∧ ∃ r s j : ℕ, a m = ↑r * a i + ↑s * a j ∧ i < j ∧ 0 < r ∧ 0 < s := by
have r1 : m ≥ n0 := by omega
have r2 : ∃ r s j : ℕ, a m = r * a i + s * a j ∧ i < j ∧ 0 < r ∧ 0 < s := by
have s3 : 0<y-x := by
have t1 : a k < a m := strictMono_nat_of_lt_succ ha hm.left
have t2 : a m - t > a k - t := add_lt_add_left t1 (-t)
rw [hy] at t2
rw [hx] at t2
have : PosMulStrictMono ℤ := PosMulMono.toPosMulStrictMono
have t3 := (mul_lt_mul_iff_right₀ (apos i)).mp t2
exact sub_pos.mpr t3
have s : a m = (y-x) * a i + 1 * a k ∧ i < k ∧ 0 < (y - x).natAbs ∧ (0 : ℕ)<(1 : ℕ) := by
omega
use (y-x).natAbs, 1, k
have abs_eq : ↑((y - x).natAbs) = y - x := by
rw [Int.natAbs_of_nonneg (Int.le_of_lt s3)]
rw [abs_eq]
exact s
exact And.intro r1 r2
use m
end Imo1975P2 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1975P2.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unsolved goals\na : \u2115 \u2192 \u2124\napos : \u2200 (i : \u2115), 0 < a i\nha : \u2200 (i : \u2115), a i < a (i + 1)\nb : \u2115 \u2192 \u2115 := fun n => (a n).natAbs\ni : \u2115\nhn0 : \u2200 (j : \u2115), a j \u2260 0\nn0 : \u2115\nf : \u2115 \u2192 \u2115\nhf : \u2200 (t n : \u2115), n > f t \u2192 \u00aca i \u2223 a n - \u2191t\nm : \u2115 := ((List.range (b i)).toFinset.sup f).succ\nh3 : \u2200 n > m, \u2200 t < b i, \u00aca i \u2223 a n - \u2191t\nh4 : \u2200 t < b i, \u00aca i \u2223 a (m + 1) - \u2191t\nt_int : \u2124 := a (m + 1) - a i * (a (m + 1) / a i)\nt : \u2115 := t_int.natAbs\ng : a i \u2223 a (m + 1) - (a (m + 1) - a i * (a (m + 1) / a i))\nh5 : t < b i \u2192 \u00aca i \u2223 a (m + 1) - \u2191t\nh6 :\n a i \u2223 a (m + 1) - \u2191(a (m + 1) - a i * (a (m + 1) / a i)).natAbs \u2192 (a (m + 1) - a i * (a (m + 1) / a i)).natAbs \u2265 b i\nr : a i * (a (m + 1) / a i) \u2264 a (m + 1)\n\u22a2 a (m + 1) - a i * (a (m + 1) / a i) \u2265 0", "unsolved goals\na : \u2115 \u2192 \u2124\napos : \u2200 (i : \u2115), 0 < a i\nha : \u2200 (i : \u2115), a i < a (i + 1)\nb : \u2115 \u2192 \u2115 := fun n => (a n).natAbs\ni : \u2115\nhn0 : \u2200 (j : \u2115), a j \u2260 0\nn0 : \u2115\nf : \u2115 \u2192 \u2115\nhf : \u2200 (t n : \u2115), n > f t \u2192 \u00aca i \u2223 a n - \u2191t\nm : \u2115 := ((List.range (b i)).toFinset.sup f).succ\nh3 : \u2200 n > m, \u2200 t < b i, \u00aca i \u2223 a n - \u2191t\nh4 : \u2200 t < b i, \u00aca i \u2223 a (m + 1) - \u2191t\nt_int : \u2124 := a (m + 1) - a i * (a (m + 1) / a i)\nt : \u2115 := t_int.natAbs\ng\u271d : a i \u2223 a (m + 1) - (a (m + 1) - a i * (a (m + 1) / a i))\nh5 : t < b i \u2192 \u00aca i \u2223 a (m + 1) - \u2191t\nh6 :\n a i \u2223 a (m + 1) - \u2191(a (m + 1) - a i * (a (m + 1) / a i)).natAbs \u2192 (a (m + 1) - a i * (a (m + 1) / a i)).natAbs \u2265 b i\ng : a (m + 1) - a i * (a (m + 1) / a i) \u2265 0\n\u22a2 False", "unsolved goals\na : \u2115 \u2192 \u2124\napos : \u2200 (i : \u2115), 0 < a i\nha : \u2200 (i : \u2115), a i < a (i + 1)\nb : \u2115 \u2192 \u2115 := fun n => (a n).natAbs\ni : \u2115\nhn0 : \u2200 (j : \u2115), a j \u2260 0\nn0 : \u2115\nh1 : \u2203 t, \u2200 (n1 : \u2115), \u2203 n > n1, a i \u2223 a n - \u2191t\n\u22a2 \u2203 n, n0 \u2264 n \u2227 \u2203 r s j, a n = \u2191r * a i + \u2191s * a j \u2227 i < j \u2227 0 < r \u2227 0 < s"], "timeout_s": 600.0, "latency_s": 0.2735, "verified_at": "2026-03-26T18:16:31.246194+00:00"}} | false | true | false | 0.2735 |
compfiles_Imo1975P4 | compfiles | Copyright (c) 2026 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1975, Problem 4
When $4444^{4444}$ is written in decimal notation, the sum of its digits is $A$.
Let $B$ be the sum of the digits of $A$.
Find the sum of the digits of $B$. ($A$ and $B$ are written in decimal notation.)
-/
namespace Imo1975P4
def A : ℕ := (Nat.digits 10 (4444^4444)).sum
def B : ℕ := (Nat.digits 10 A).sum
abbrev sum_digits_B : ℕ := 7
/-!
We follow the proof from https://prase.cz/kalva/imo/isoln/isoln754.html
-/
/-!
I'd love to have the following theorems in Mathlib :)
-/
theorem Nat.mod_eq_iff_eq {n a b : ℕ} (h : a < n) :
a % n = b ↔ a = b := by
rw [(Nat.mod_eq_iff_lt _).mpr h]
exact Nat.ne_zero_of_lt h
theorem Nat.modEq_iff_eq_lt (n : ℕ) {a b : ℕ} (ha : a < n) (hb : b < n) :
a ≡ b [MOD n] ↔ a = b := by
rw [Nat.ModEq]
rw [(Nat.mod_eq_iff_lt _).mpr hb]
· exact mod_eq_iff_eq ha
· exact Nat.ne_zero_of_lt hb
theorem Nat.digits_sum_le_mul_digits_length (n b : ℕ) (hb : 1 < b) : (Nat.digits b n).sum ≤ (Nat.digits b n).length * (b-1) := by
apply List.sum_le_card_nsmul
intro x xh
rw [Nat.le_sub_one_iff_lt (Nat.zero_lt_of_lt hb)]
apply Nat.digits_lt_base hb xh
theorem Nat.digits_sum_le_log (n b : ℕ) (hn : n ≠ 0) (hb : 1 < b) : (Nat.digits b n).sum ≤ (Nat.log b n + 1) * (b-1) := by
rw [← Nat.length_digits _ _ hb hn]
exact digits_sum_le_mul_digits_length n b hb
theorem Nat.digits_sum_le_of_le (n b u : ℕ) (hb : 1 < b) (hn : n ≤ u) : (Nat.digits b n).sum ≤ (Nat.clog b u + 1) * (b-1) := by
by_cases nz : n = 0
· subst n
simp
trans (Nat.log b n + 1) * (b-1)
· apply Nat.digits_sum_le_log _ _ nz hb
· rw [mul_le_mul_iff_left₀ (by omega), add_le_add_iff_right]
apply le_trans (Nat.log_le_clog _ _)
apply Nat.clog_mono_right _ hn
theorem Nat.clog_pow_le_clog_mul (a b c : ℕ) (hb : 1 < b) : Nat.clog b (a ^ c) ≤ Nat.clog b a * c := by
by_cases hc : c = 0
· subst c
simp
rw [Nat.clog_le_iff_le_pow hb, pow_mul, Nat.pow_le_pow_iff_left hc]
apply Nat.le_pow_clog hb
theorem imo1975_p4 : sum_digits_B = (Nat.digits 10 B).sum := by
have sumBmod : sum_digits_B ≡ 4444 ^ 4444 [MOD 9] := by
rw [Nat.ModEq, Nat.pow_mod]
rw [show 4444%9 = 7 by simp]
rw [show 4444 = 3*1481+1 by simp]
simp only [pow_add, pow_mul, pow_one]
rw [Nat.mul_mod, Nat.pow_mod]
simp only [show 7 ^ 3 % 9 = 1 by simp, one_pow]
unfold sum_digits_B
rfl
have sumBmod' : (Nat.digits 10 B).sum ≡ 4444 ^ 4444 [MOD 9] := by
unfold B A
rw [Nat.ModEq, Eq.comm]
iterate 3 rw [Nat.modEq_nine_digits_sum]
have sumBmod'' : (Nat.digits 10 B).sum ≡ sum_digits_B [MOD 9] := by
grw [sumBmod, sumBmod']
have : A ≤ 159993 := by
unfold A
apply le_trans (Nat.digits_sum_le_of_le _ _ _ (by simp) le_rfl)
calc
_ ≤ (Nat.clog 10 4444 * 4444 + 1) * 9 := by
simp only [Nat.add_one_sub_one, Nat.ofNat_pos, mul_le_mul_iff_left₀, add_le_add_iff_right]
apply Nat.clog_pow_le_clog_mul
simp
_ = (4 * 4444 + 1) * 9 := by
rfl
_ = _ := by
rfl
have : B ≤ 63 := by
unfold B
apply le_trans (Nat.digits_sum_le_of_le _ _ _ (by simp) this)
rfl
generalize B = x at ⊢ this sumBmod''
revert x
decide
end Imo1975P4 | /- | /-
Copyright (c) 2026 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1975, Problem 4
When $4444^{4444}$ is written in decimal notation, the sum of its digits is $A$.
Let $B$ be the sum of the digits of $A$.
Find the sum of the digits of $B$. ($A$ and $B$ are written in decimal notation.)
-/
namespace Imo1975P4
def A : ℕ := (Nat.digits 10 (4444^4444)).sum
def B : ℕ := (Nat.digits 10 A).sum
abbrev sum_digits_B : ℕ := 7
/-!
We follow the proof from https://prase.cz/kalva/imo/isoln/isoln754.html
-/
/-!
I'd love to have the following theorems in Mathlib :)
-/
theorem Nat.mod_eq_iff_eq {n a b : ℕ} (h : a < n) :
a % n = b ↔ a = b := by
rw [(Nat.mod_eq_iff_lt _).mpr h]
exact Nat.ne_zero_of_lt h
theorem Nat.modEq_iff_eq_lt (n : ℕ) {a b : ℕ} (ha : a < n) (hb : b < n) :
a ≡ b [MOD n] ↔ a = b := by
rw [Nat.ModEq]
rw [(Nat.mod_eq_iff_lt _).mpr hb]
· exact mod_eq_iff_eq ha
· exact Nat.ne_zero_of_lt hb
theorem Nat.digits_sum_le_mul_digits_length (n b : ℕ) (hb : 1 < b) : (Nat.digits b n).sum ≤ (Nat.digits b n).length * (b-1) := by
apply List.sum_le_card_nsmul
intro x xh
rw [Nat.le_sub_one_iff_lt (Nat.zero_lt_of_lt hb)]
apply Nat.digits_lt_base hb xh
theorem Nat.digits_sum_le_log (n b : ℕ) (hn : n ≠ 0) (hb : 1 < b) : (Nat.digits b n).sum ≤ (Nat.log b n + 1) * (b-1) := by
rw [← Nat.length_digits _ _ hb hn]
exact digits_sum_le_mul_digits_length n b hb
theorem Nat.digits_sum_le_of_le (n b u : ℕ) (hb : 1 < b) (hn : n ≤ u) : (Nat.digits b n).sum ≤ (Nat.clog b u + 1) * (b-1) := by
by_cases nz : n = 0
· subst n
simp
trans (Nat.log b n + 1) * (b-1)
· apply Nat.digits_sum_le_log _ _ nz hb
· rw [mul_le_mul_iff_left₀ (by omega), add_le_add_iff_right]
apply le_trans (Nat.log_le_clog _ _)
apply Nat.clog_mono_right _ hn
theorem Nat.clog_pow_le_clog_mul (a b c : ℕ) (hb : 1 < b) : Nat.clog b (a ^ c) ≤ Nat.clog b a * c := by
by_cases hc : c = 0
· subst c
simp
rw [Nat.clog_le_iff_le_pow hb, pow_mul, Nat.pow_le_pow_iff_left hc]
apply Nat.le_pow_clog hb
theorem imo1975_p4 : sum_digits_B = (Nat.digits 10 B).sum := by
have sumBmod : sum_digits_B ≡ 4444 ^ 4444 [MOD 9] := by
rw [Nat.ModEq, Nat.pow_mod]
rw [show 4444%9 = 7 by simp]
rw [show 4444 = 3*1481+1 by simp]
simp only [pow_add, pow_mul, pow_one]
rw [Nat.mul_mod, Nat.pow_mod]
simp only [show 7 ^ 3 % 9 = 1 by simp, one_pow]
unfold sum_digits_B
rfl
have sumBmod' : (Nat.digits 10 B).sum ≡ 4444 ^ 4444 [MOD 9] := by
unfold B A
rw [Nat.ModEq, Eq.comm]
iterate 3 rw [Nat.modEq_nine_digits_sum]
have sumBmod'' : (Nat.digits 10 B).sum ≡ sum_digits_B [MOD 9] := by
grw [sumBmod, sumBmod']
have : A ≤ 159993 := by
unfold A
apply le_trans (Nat.digits_sum_le_of_le _ _ _ (by simp) le_rfl)
calc
_ ≤ (Nat.clog 10 4444 * 4444 + 1) * 9 := by
simp only [Nat.add_one_sub_one, Nat.ofNat_pos, mul_le_mul_iff_left₀, add_le_add_iff_right]
apply Nat.clog_pow_le_clog_mul
simp
_ = (4 * 4444 + 1) * 9 := by
rfl
_ = _ := by
rfl
have : B ≤ 63 := by
unfold B
apply le_trans (Nat.digits_sum_le_of_le _ _ _ (by simp) this)
rfl
generalize B = x at ⊢ this sumBmod''
revert x
decide
end Imo1975P4
| true | Copyright (c) 2026 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1975, Problem 4
When $4444^{4444}$ is written in decimal notation, the sum of its digits is $A$.
Let $B$ be the sum of the digits of $A$.
Find the sum of the digits of $B$. ($A$ and $B$ are written in decimal notation.)
-/
namespace Imo1975P4
def A : ℕ := (Nat.digits 10 (4444^4444)).sum
def B : ℕ := (Nat.digits 10 A).sum
abbrev sum_digits_B : ℕ := 7
/-!
We follow the proof from https://prase.cz/kalva/imo/isoln/isoln754.html
-/
/-!
I'd love to have the following theorems in Mathlib :)
-/
theorem Nat.mod_eq_iff_eq {n a b : ℕ} (h : a < n) :
a % n = b ↔ a = b := by
rw [(Nat.mod_eq_iff_lt _).mpr h]
exact Nat.ne_zero_of_lt h
theorem Nat.modEq_iff_eq_lt (n : ℕ) {a b : ℕ} (ha : a < n) (hb : b < n) :
a ≡ b [MOD n] ↔ a = b := by
rw [Nat.ModEq]
rw [(Nat.mod_eq_iff_lt _).mpr hb]
· exact mod_eq_iff_eq ha
· exact Nat.ne_zero_of_lt hb
theorem Nat.digits_sum_le_mul_digits_length (n b : ℕ) (hb : 1 < b) : (Nat.digits b n).sum ≤ (Nat.digits b n).length * (b-1) := by
apply List.sum_le_card_nsmul
intro x xh
rw [Nat.le_sub_one_iff_lt (Nat.zero_lt_of_lt hb)]
apply Nat.digits_lt_base hb xh
theorem Nat.digits_sum_le_log (n b : ℕ) (hn : n ≠ 0) (hb : 1 < b) : (Nat.digits b n).sum ≤ (Nat.log b n + 1) * (b-1) := by
rw [← Nat.length_digits _ _ hb hn]
exact digits_sum_le_mul_digits_length n b hb
theorem Nat.digits_sum_le_of_le (n b u : ℕ) (hb : 1 < b) (hn : n ≤ u) : (Nat.digits b n).sum ≤ (Nat.clog b u + 1) * (b-1) := by
by_cases nz : n = 0
· subst n
simp
trans (Nat.log b n + 1) * (b-1)
· apply Nat.digits_sum_le_log _ _ nz hb
· rw [mul_le_mul_iff_left₀ (by omega), add_le_add_iff_right]
apply le_trans (Nat.log_le_clog _ _)
apply Nat.clog_mono_right _ hn
theorem Nat.clog_pow_le_clog_mul (a b c : ℕ) (hb : 1 < b) : Nat.clog b (a ^ c) ≤ Nat.clog b a * c := by
by_cases hc : c = 0
· subst c
simp
rw [Nat.clog_le_iff_le_pow hb, pow_mul, Nat.pow_le_pow_iff_left hc]
apply Nat.le_pow_clog hb
theorem imo1975_p4 : sum_digits_B = (Nat.digits 10 B).sum := by
have sumBmod : sum_digits_B ≡ 4444 ^ 4444 [MOD 9] := by
rw [Nat.ModEq, Nat.pow_mod]
rw [show 4444%9 = 7 by simp]
rw [show 4444 = 3*1481+1 by simp]
simp only [pow_add, pow_mul, pow_one]
rw [Nat.mul_mod, Nat.pow_mod]
simp only [show 7 ^ 3 % 9 = 1 by simp, one_pow]
unfold sum_digits_B
rfl
have sumBmod' : (Nat.digits 10 B).sum ≡ 4444 ^ 4444 [MOD 9] := by
unfold B A
rw [Nat.ModEq, Eq.comm]
iterate 3 rw [Nat.modEq_nine_digits_sum]
have sumBmod'' : (Nat.digits 10 B).sum ≡ sum_digits_B [MOD 9] := by
grw [sumBmod, sumBmod']
have : A ≤ 159993 := by
unfold A
apply le_trans (Nat.digits_sum_le_of_le _ _ _ (by simp) le_rfl)
calc
_ ≤ (Nat.clog 10 4444 * 4444 + 1) * 9 := by
simp only [Nat.add_one_sub_one, Nat.ofNat_pos, mul_le_mul_iff_left₀, add_le_add_iff_right]
apply Nat.clog_pow_le_clog_mul
simp
_ = (4 * 4444 + 1) * 9 := by
rfl
_ = _ := by
rfl
have : B ≤ 63 := by
unfold B
apply le_trans (Nat.digits_sum_le_of_le _ _ _ (by simp) this)
rfl
generalize B = x at ⊢ this sumBmod''
revert x
decide
end Imo1975P4 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1975P4.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown constant 'Nat.length_digits'", "unsolved goals\nn b : \u2115\nhn : n \u2260 0\nhb : 1 < b\n\u22a2 (b.digits n).sum \u2264 (Nat.log b n + 1) * (b - 1)", "unknown tactic", "unknown identifier 'mul_le_mul_iff_left\u2080'", "unknown constant 'Nat.clog_le_iff_le_pow'", "unsolved goals\ncase neg\na b c : \u2115\nhb : 1 < b\nhc : \u00acc = 0\n\u22a2 Nat.clog b (a ^ c) \u2264 Nat.clog b a * c", "unknown identifier 'mul_le_mul_iff_left\u2080'", "tactic 'apply' failed, [Error pretty printing: maximum recursion depth has been reached\nuse `set_option maxRecDepth <num>` to increase limit\nuse `set_option diagnostics true` to get diagnostic information]\nsumBmod : sum_digits_B \u2261 4444 ^ 4444 [MOD 9]\nsumBmod' : (Nat.digits 10 B).sum \u2261 4444 ^ 4444 [MOD 9]\nsumBmod'' : (Nat.digits 10 B).sum \u2261 sum_digits_B [MOD 9]\n\u22a2 (Nat.clog 10 (4444 ^ 4444) + 1) * 9 \u2264 (Nat.clog 10 4444 * 4444 + 1) * 9", "maximum recursion depth has been reached\nuse `set_option maxRecDepth <num>` to increase limit\nuse `set_option diagnostics true` to get diagnostic information", "tactic 'rfl' failed, the left-hand side\n (Nat.clog 10 159993 + 1) * (10 - 1)\nis not definitionally equal to the right-hand side\n 63\nsumBmod : sum_digits_B \u2261 4444 ^ 4444 [MOD 9]\nsumBmod' : (Nat.digits 10 B).sum \u2261 4444 ^ 4444 [MOD 9]\nsumBmod'' : (Nat.digits 10 B).sum \u2261 sum_digits_B [MOD 9]\nthis : A \u2264 159993\n\u22a2 (Nat.clog 10 159993 + 1) * (10 - 1) \u2264 63", "tactic 'decide' failed for proposition\n \u2200 x \u2264 63, (Nat.digits 10 x).sum \u2261 sum_digits_B [MOD 9] \u2192 sum_digits_B = (Nat.digits 10 x).sum\nsince its 'Decidable' instance\n Nat.decidableBallLE 63 fun x this =>\n (Nat.digits 10 x).sum \u2261 sum_digits_B [MOD 9] \u2192 sum_digits_B = (Nat.digits 10 x).sum\ndid not reduce to 'isTrue' or 'isFalse'.\n\nAfter unfolding the instances 'decidable_of_decidable_of_iff', 'decidable_of_iff', 'forall_prop_decidable', 'instDecidableEqNat', 'Nat.decEq', 'Nat.decidableBallLE', 'Nat.decidableBallLT', and 'Nat.instDecidableModEq', reduction got stuck at the 'Decidable' instance\n match h : ((Nat.digits 10 0).sum % 9).beq (sum_digits_B % 9) with\n | true => isTrue \u22ef\n | false => isFalse \u22ef"], "timeout_s": 600.0, "latency_s": 0.4098, "verified_at": "2026-03-26T18:16:31.656290+00:00"}} | false | true | false | 0.4098 |
compfiles_Imo1975P5 | compfiles | Copyright (c) 2026 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1975, Problem 5
Determine, with proof, whether or not one can find $1975$ points on the circumference of a circle
with unit radius such that the distance between any two of them is a rational number.
-/
namespace Imo1975P5
abbrev constructible : Bool := true
@[simp]
theorem Complex.mk_mem_unitSphere_iff (a b : ℝ) : Complex.mk a b ∈ Submonoid.unitSphere ℂ ↔ a^2+b^2=1 := by
rw [Submonoid.unitSphere, <-Submonoid.mem_carrier, mem_sphere_iff_norm, sub_zero, <-sq_eq_sq₀,
Complex.norm_eq_sqrt_sq_add_sq, Real.sq_sqrt, one_pow] <;> positivity
theorem not_irrational_add {b c : ℝ}: ¬Irrational b → ¬Irrational c → ¬Irrational (b + c) := by
intro h1 h2
apply not_imp_not.mpr (Irrational.add_cases)
apply not_or_intro h1 h2
theorem not_irrational_sub {b c : ℝ} : ¬Irrational b → ¬Irrational c → ¬Irrational (b - c) := by
intro h1 h2
apply not_imp_not.mpr (Irrational.add_cases)
apply not_or_intro h1 _
rw [irrational_neg_iff]
exact h2
theorem not_irrational_mul {b c : ℝ} : ¬Irrational b → ¬Irrational c → ¬Irrational (b * c) := by
intro h1 h2
apply not_imp_not.mpr (Irrational.mul_cases)
apply not_or_intro h1 h2
theorem irrational_abs_iff {x : ℝ} : Irrational |x| ↔ Irrational x := by
apply abs_by_cases (fun y => Irrational y ↔ Irrational x) Iff.rfl
exact irrational_neg_iff
noncomputable def θ : ℝ := Real.arccos (4/5)
theorem sin_θ : Real.sin θ = (3/5:ℚ) := by
unfold θ
rw [Real.sin_arccos]
field
theorem cos_θ : Real.cos θ = (4/5:ℚ) := by
unfold θ
rw [Real.cos_arccos] <;> linarith
noncomputable def P (n:ℕ) : Circle := {
val := ⟨Real.cos (θ*2*n), Real.sin (θ*2*n)⟩
property := by simp
}
theorem not_irrational_sin_θ_mul_and_not_irrational_cos_θ_mul (n : ℕ)
: ¬ Irrational (Real.sin (θ*n)) ∧ ¬ Irrational (Real.cos (θ*n)) := by
induction n with
| zero => simp
| succ n ih =>
rw [Nat.cast_add, mul_add, Real.sin_add, Real.cos_add]
grind only [= cos_θ, = sin_θ, Rat.not_irrational, not_irrational_mul, not_irrational_add, not_irrational_sub]
theorem not_irrational_dist_P_P (i j : ℕ) : ¬ Irrational (dist (P i) (P j)) := by
unfold P
rw [Subtype.dist_eq, Complex.dist_mk, Real.cos_sub_cos, Real.sin_sub_sin, mul_right_comm]
repeat rw [mul_pow]
simp only [even_two, Even.neg_pow]
rw [<-mul_add]
simp only [Real.sin_sq_add_cos_sq, mul_one, Nat.ofNat_nonneg, pow_succ_nonneg, Real.sqrt_mul,
Real.sqrt_sq]
rw [Real.sqrt_sq_eq_abs]
apply not_irrational_mul (not_irrational_ofNat _)
rw [irrational_abs_iff, mul_right_comm _ 2 _, mul_right_comm _ 2 _, <-sub_mul, mul_div_cancel_right₀ _ (by simp), Real.sin_sub]
apply not_irrational_sub <;> apply not_irrational_mul <;> simp [not_irrational_sin_θ_mul_and_not_irrational_cos_θ_mul]
theorem sin_mul_θ_ne_zero (n : ℕ) (hz : 1 ≤ n) : Real.sin (n * θ) ≠ 0 := by
by_contra
have := @niven_sin θ ?_ ?_
· rw [sin_θ] at this
simp at this
grind only
· rw [Real.sin_eq_zero_iff] at this
let ⟨z, h⟩ := this
use z/n
rify
have : 0 < (n:ℝ) := by
rw [Nat.cast_pos]
exact Nat.zero_lt_of_lt hz
grind only
· rw [sin_θ]
use ?_
theorem P_injective : Function.Injective P := by
intro i j e
contrapose! e
wlog w : j < i
· rw [ne_comm]
have := this e.symm
grind only
unfold P
rw [Ne, Iff.not (Subtype.ext_iff)]
simp only [Complex.mk.injEq, not_and]
intro _
suffices Real.sin (θ*2*(i-j)) ≠ 0 by
grind only [mul_sub, Real.sin_sub]
rw [mul_assoc, mul_comm]
rw [show (2 * (i - j) : ℝ) = (2 * (i-j) : ℕ) by rw [Nat.cast_mul, Nat.cast_sub] <;> omega]
apply sin_mul_θ_ne_zero
omega
theorem imo1975_p5 : constructible ↔
∃ p : Finset Circle, p.card = 1975 ∧ (SetLike.coe p).Pairwise (fun a b => ¬ Irrational (dist a b)) := by
simp only [true_iff]
use (Finset.range 1975).map ⟨P, P_injective⟩
and_intros
· simp
· intro x hx y hy ne
simp only [Finset.coe_map, Function.Embedding.coeFn_mk, Finset.coe_range, Set.mem_image, Set.mem_Iio] at hx hy
grind only [not_irrational_dist_P_P]
end Imo1975P5 | /- | /-
Copyright (c) 2026 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1975, Problem 5
Determine, with proof, whether or not one can find $1975$ points on the circumference of a circle
with unit radius such that the distance between any two of them is a rational number.
-/
namespace Imo1975P5
abbrev constructible : Bool := true
@[simp]
theorem Complex.mk_mem_unitSphere_iff (a b : ℝ) : Complex.mk a b ∈ Submonoid.unitSphere ℂ ↔ a^2+b^2=1 := by
rw [Submonoid.unitSphere, <-Submonoid.mem_carrier, mem_sphere_iff_norm, sub_zero, <-sq_eq_sq₀,
Complex.norm_eq_sqrt_sq_add_sq, Real.sq_sqrt, one_pow] <;> positivity
theorem not_irrational_add {b c : ℝ}: ¬Irrational b → ¬Irrational c → ¬Irrational (b + c) := by
intro h1 h2
apply not_imp_not.mpr (Irrational.add_cases)
apply not_or_intro h1 h2
theorem not_irrational_sub {b c : ℝ} : ¬Irrational b → ¬Irrational c → ¬Irrational (b - c) := by
intro h1 h2
apply not_imp_not.mpr (Irrational.add_cases)
apply not_or_intro h1 _
rw [irrational_neg_iff]
exact h2
theorem not_irrational_mul {b c : ℝ} : ¬Irrational b → ¬Irrational c → ¬Irrational (b * c) := by
intro h1 h2
apply not_imp_not.mpr (Irrational.mul_cases)
apply not_or_intro h1 h2
theorem irrational_abs_iff {x : ℝ} : Irrational |x| ↔ Irrational x := by
apply abs_by_cases (fun y => Irrational y ↔ Irrational x) Iff.rfl
exact irrational_neg_iff
noncomputable def θ : ℝ := Real.arccos (4/5)
theorem sin_θ : Real.sin θ = (3/5:ℚ) := by
unfold θ
rw [Real.sin_arccos]
field
theorem cos_θ : Real.cos θ = (4/5:ℚ) := by
unfold θ
rw [Real.cos_arccos] <;> linarith
noncomputable def P (n:ℕ) : Circle := {
val := ⟨Real.cos (θ*2*n), Real.sin (θ*2*n)⟩
property := by simp
}
theorem not_irrational_sin_θ_mul_and_not_irrational_cos_θ_mul (n : ℕ)
: ¬ Irrational (Real.sin (θ*n)) ∧ ¬ Irrational (Real.cos (θ*n)) := by
induction n with
| zero => simp
| succ n ih =>
rw [Nat.cast_add, mul_add, Real.sin_add, Real.cos_add]
grind only [= cos_θ, = sin_θ, Rat.not_irrational, not_irrational_mul, not_irrational_add, not_irrational_sub]
theorem not_irrational_dist_P_P (i j : ℕ) : ¬ Irrational (dist (P i) (P j)) := by
unfold P
rw [Subtype.dist_eq, Complex.dist_mk, Real.cos_sub_cos, Real.sin_sub_sin, mul_right_comm]
repeat rw [mul_pow]
simp only [even_two, Even.neg_pow]
rw [<-mul_add]
simp only [Real.sin_sq_add_cos_sq, mul_one, Nat.ofNat_nonneg, pow_succ_nonneg, Real.sqrt_mul,
Real.sqrt_sq]
rw [Real.sqrt_sq_eq_abs]
apply not_irrational_mul (not_irrational_ofNat _)
rw [irrational_abs_iff, mul_right_comm _ 2 _, mul_right_comm _ 2 _, <-sub_mul, mul_div_cancel_right₀ _ (by simp), Real.sin_sub]
apply not_irrational_sub <;> apply not_irrational_mul <;> simp [not_irrational_sin_θ_mul_and_not_irrational_cos_θ_mul]
theorem sin_mul_θ_ne_zero (n : ℕ) (hz : 1 ≤ n) : Real.sin (n * θ) ≠ 0 := by
by_contra
have := @niven_sin θ ?_ ?_
· rw [sin_θ] at this
simp at this
grind only
· rw [Real.sin_eq_zero_iff] at this
let ⟨z, h⟩ := this
use z/n
rify
have : 0 < (n:ℝ) := by
rw [Nat.cast_pos]
exact Nat.zero_lt_of_lt hz
grind only
· rw [sin_θ]
use ?_
theorem P_injective : Function.Injective P := by
intro i j e
contrapose! e
wlog w : j < i
· rw [ne_comm]
have := this e.symm
grind only
unfold P
rw [Ne, Iff.not (Subtype.ext_iff)]
simp only [Complex.mk.injEq, not_and]
intro _
suffices Real.sin (θ*2*(i-j)) ≠ 0 by
grind only [mul_sub, Real.sin_sub]
rw [mul_assoc, mul_comm]
rw [show (2 * (i - j) : ℝ) = (2 * (i-j) : ℕ) by rw [Nat.cast_mul, Nat.cast_sub] <;> omega]
apply sin_mul_θ_ne_zero
omega
theorem imo1975_p5 : constructible ↔
∃ p : Finset Circle, p.card = 1975 ∧ (SetLike.coe p).Pairwise (fun a b => ¬ Irrational (dist a b)) := by
simp only [true_iff]
use (Finset.range 1975).map ⟨P, P_injective⟩
and_intros
· simp
· intro x hx y hy ne
simp only [Finset.coe_map, Function.Embedding.coeFn_mk, Finset.coe_range, Set.mem_image, Set.mem_Iio] at hx hy
grind only [not_irrational_dist_P_P]
end Imo1975P5
| true | Copyright (c) 2026 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1975, Problem 5
Determine, with proof, whether or not one can find $1975$ points on the circumference of a circle
with unit radius such that the distance between any two of them is a rational number.
-/
namespace Imo1975P5
abbrev constructible : Bool := true
@[simp]
theorem Complex.mk_mem_unitSphere_iff (a b : ℝ) : Complex.mk a b ∈ Submonoid.unitSphere ℂ ↔ a^2+b^2=1 := by
rw [Submonoid.unitSphere, <-Submonoid.mem_carrier, mem_sphere_iff_norm, sub_zero, <-sq_eq_sq₀,
Complex.norm_eq_sqrt_sq_add_sq, Real.sq_sqrt, one_pow] <;> positivity
theorem not_irrational_add {b c : ℝ}: ¬Irrational b → ¬Irrational c → ¬Irrational (b + c) := by
intro h1 h2
apply not_imp_not.mpr (Irrational.add_cases)
apply not_or_intro h1 h2
theorem not_irrational_sub {b c : ℝ} : ¬Irrational b → ¬Irrational c → ¬Irrational (b - c) := by
intro h1 h2
apply not_imp_not.mpr (Irrational.add_cases)
apply not_or_intro h1 _
rw [irrational_neg_iff]
exact h2
theorem not_irrational_mul {b c : ℝ} : ¬Irrational b → ¬Irrational c → ¬Irrational (b * c) := by
intro h1 h2
apply not_imp_not.mpr (Irrational.mul_cases)
apply not_or_intro h1 h2
theorem irrational_abs_iff {x : ℝ} : Irrational |x| ↔ Irrational x := by
apply abs_by_cases (fun y => Irrational y ↔ Irrational x) Iff.rfl
exact irrational_neg_iff
noncomputable def θ : ℝ := Real.arccos (4/5)
theorem sin_θ : Real.sin θ = (3/5:ℚ) := by
unfold θ
rw [Real.sin_arccos]
field
theorem cos_θ : Real.cos θ = (4/5:ℚ) := by
unfold θ
rw [Real.cos_arccos] <;> linarith
noncomputable def P (n:ℕ) : Circle := {
val := ⟨Real.cos (θ*2*n), Real.sin (θ*2*n)⟩
property := by simp
}
theorem not_irrational_sin_θ_mul_and_not_irrational_cos_θ_mul (n : ℕ)
: ¬ Irrational (Real.sin (θ*n)) ∧ ¬ Irrational (Real.cos (θ*n)) := by
induction n with
| zero => simp
| succ n ih =>
rw [Nat.cast_add, mul_add, Real.sin_add, Real.cos_add]
grind only [= cos_θ, = sin_θ, Rat.not_irrational, not_irrational_mul, not_irrational_add, not_irrational_sub]
theorem not_irrational_dist_P_P (i j : ℕ) : ¬ Irrational (dist (P i) (P j)) := by
unfold P
rw [Subtype.dist_eq, Complex.dist_mk, Real.cos_sub_cos, Real.sin_sub_sin, mul_right_comm]
repeat rw [mul_pow]
simp only [even_two, Even.neg_pow]
rw [<-mul_add]
simp only [Real.sin_sq_add_cos_sq, mul_one, Nat.ofNat_nonneg, pow_succ_nonneg, Real.sqrt_mul,
Real.sqrt_sq]
rw [Real.sqrt_sq_eq_abs]
apply not_irrational_mul (not_irrational_ofNat _)
rw [irrational_abs_iff, mul_right_comm _ 2 _, mul_right_comm _ 2 _, <-sub_mul, mul_div_cancel_right₀ _ (by simp), Real.sin_sub]
apply not_irrational_sub <;> apply not_irrational_mul <;> simp [not_irrational_sin_θ_mul_and_not_irrational_cos_θ_mul]
theorem sin_mul_θ_ne_zero (n : ℕ) (hz : 1 ≤ n) : Real.sin (n * θ) ≠ 0 := by
by_contra
have := @niven_sin θ ?_ ?_
· rw [sin_θ] at this
simp at this
grind only
· rw [Real.sin_eq_zero_iff] at this
let ⟨z, h⟩ := this
use z/n
rify
have : 0 < (n:ℝ) := by
rw [Nat.cast_pos]
exact Nat.zero_lt_of_lt hz
grind only
· rw [sin_θ]
use ?_
theorem P_injective : Function.Injective P := by
intro i j e
contrapose! e
wlog w : j < i
· rw [ne_comm]
have := this e.symm
grind only
unfold P
rw [Ne, Iff.not (Subtype.ext_iff)]
simp only [Complex.mk.injEq, not_and]
intro _
suffices Real.sin (θ*2*(i-j)) ≠ 0 by
grind only [mul_sub, Real.sin_sub]
rw [mul_assoc, mul_comm]
rw [show (2 * (i - j) : ℝ) = (2 * (i-j) : ℕ) by rw [Nat.cast_mul, Nat.cast_sub] <;> omega]
apply sin_mul_θ_ne_zero
omega
theorem imo1975_p5 : constructible ↔
∃ p : Finset Circle, p.card = 1975 ∧ (SetLike.coe p).Pairwise (fun a b => ¬ Irrational (dist a b)) := by
simp only [true_iff]
use (Finset.range 1975).map ⟨P, P_injective⟩
and_intros
· simp
· intro x hx y hy ne
simp only [Finset.coe_map, Function.Embedding.coeFn_mk, Finset.coe_range, Set.mem_image, Set.mem_Iio] at hx hy
grind only [not_irrational_dist_P_P]
end Imo1975P5 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1975P5.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unsolved goals\n\u22a2 \u221a(1 - (4 / 5) ^ 2) = \u2191(3 / 5)", "`grind` failed\ncase grind\nn : \u2115\nleft : \u00acIrrational (Real.sin (\u03b8 * \u2191n))\nright : \u00acIrrational (Real.cos (\u03b8 * \u2191n))\nh :\n Irrational (Real.sin (\u03b8 * \u2191n) * Real.cos (\u03b8 * \u21911) + Real.cos (\u03b8 * \u2191n) * Real.sin (\u03b8 * \u21911)) \u2228\n Irrational (Real.cos (\u03b8 * \u2191n) * Real.cos (\u03b8 * \u21911) - Real.sin (\u03b8 * \u2191n) * Real.sin (\u03b8 * \u21911))\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] \u00acIrrational (Real.sin (\u03b8 * \u2191n))\n [prop] \u00acIrrational (Real.cos (\u03b8 * \u2191n))\n [prop] Irrational (Real.sin (\u03b8 * \u2191n) * Real.cos (\u03b8 * \u21911) + Real.cos (\u03b8 * \u2191n) * Real.sin (\u03b8 * \u21911)) \u2228\n Irrational (Real.cos (\u03b8 * \u2191n) * Real.cos (\u03b8 * \u21911) - Real.sin (\u03b8 * \u2191n) * Real.sin (\u03b8 * \u21911))\n [prop] \u00acIrrational (Real.sin (\u03b8 * \u2191n)) \u2192\n \u00acIrrational (Real.sin (\u03b8 * \u21911)) \u2192 \u00acIrrational (Real.sin (\u03b8 * \u2191n) * Real.sin (\u03b8 * \u21911))\n [prop] \u00acIrrational (Real.cos (\u03b8 * \u2191n)) \u2192\n \u00acIrrational (Real.cos (\u03b8 * \u21911)) \u2192 \u00acIrrational (Real.cos (\u03b8 * \u2191n) * Real.cos (\u03b8 * \u21911))\n [prop] \u00acIrrational (Real.cos (\u03b8 * \u2191n)) \u2192\n \u00acIrrational (Real.sin (\u03b8 * \u21911)) \u2192 \u00acIrrational (Real.cos (\u03b8 * \u2191n) * Real.sin (\u03b8 * \u21911))\n [prop] \u00acIrrational \u03b8 \u2192 \u00acIrrational \u21911 \u2192 \u00acIrrational (\u03b8 * \u21911)\n [prop] \u00acIrrational (Real.sin (\u03b8 * \u2191n)) \u2192\n \u00acIrrational (Real.cos (\u03b8 * \u21911)) \u2192 \u00acIrrational (Real.sin (\u03b8 * \u2191n) * Real.cos (\u03b8 * \u21911))\n [prop] \u00acIrrational \u03b8 \u2192 \u00acIrrational \u2191n \u2192 \u00acIrrational (\u03b8 * \u2191n)\n [prop] \u00acIrrational (Real.sin (\u03b8 * \u2191n) * Real.cos (\u03b8 * \u21911)) \u2192\n \u00acIrrational (Real.cos (\u03b8 * \u2191n) * Real.sin (\u03b8 * \u21911)) \u2192\n \u00acIrrational (Real.sin (\u03b8 * \u2191n) * Real.cos (\u03b8 * \u21911) + Real.cos (\u03b8 * \u2191n) * Real.sin (\u03b8 * \u21911))\n [prop] \u00acIrrational (Real.cos (\u03b8 * \u2191n) * Real.cos (\u03b8 * \u21911)) \u2192\n \u00acIrrational (Real.sin (\u03b8 * \u2191n) * Real.sin (\u03b8 * \u21911)) \u2192\n \u00acIrrational (Real.cos (\u03b8 * \u2191n) * Real.cos (\u03b8 * \u21911) - Real.sin (\u03b8 * \u2191n) * Real.sin (\u03b8 * \u21911))\n [eqc] True propositions\n [prop] Irrational (Real.sin (\u03b8 * \u2191n) * Real.cos (\u03b8 * \u21911) + Real.cos (\u03b8 * \u2191n) * Real.sin (\u03b8 * \u21911)) \u2228\n Irrational (Real.cos (\u03b8 * \u2191n) * Real.cos (\u03b8 * \u21911) - Real.sin (\u03b8 * \u2191n) * Real.sin (\u03b8 * \u21911))\n [prop] \u00acIrrational (Real.sin (\u03b8 * \u2191n)) \u2192\n \u00acIrrational (Real.sin (\u03b8 * \u21911)) \u2192 \u00acIrrational (Real.sin (\u03b8 * \u2191n) * Real.sin (\u03b8 * \u21911))\n [prop] \u00acIrrational (Real.sin (\u03b8 * \u2191n))\n [prop] \u00acIrrational (Real.sin (\u03b8 * \u21911)) \u2192 \u00acIrrational (Real.sin (\u03b8 * \u2191n) * Real.sin (\u03b8 * \u21911))\n [prop] \u00acIrrational (Real.cos (\u03b8 * \u2191n)) \u2192\n \u00acIrrational (Real.cos (\u03b8 * \u21911)) \u2192 \u00acIrrational (Real.cos (\u03b8 * \u2191n) * Real.cos (\u03b8 * \u21911))\n [prop] \u00acIrrational (Real.cos (\u03b8 * \u2191n))\n [prop] \u00acIrrational (Real.cos (\u03b8 * \u21911)) \u2192 \u00acIrrational (Real.cos (\u03b8 * \u2191n) * Real.cos (\u03b8 * \u21911))\n [prop] \u00acIrrational (Real.cos (\u03b8 * \u2191n)) \u2192\n \u00acIrrational (Real.sin (\u03b8 * \u21911)) \u2192 \u00acIrrational (Real.cos (\u03b8 * \u2191n) * Real.sin (\u03b8 * \u21911))\n [prop] \u00acIrrational (Real.sin (\u03b8 * \u21911)) \u2192 \u00acIrrational (Real.cos (\u03b8 * \u2191n) * Real.sin (\u03b8 * \u21911))\n [prop] \u00acIrrational \u03b8 \u2192 \u00acIrrational \u21911 \u2192 \u00acIrrational (\u03b8 * \u21911)\n [prop] \u00acIrrational (Real.sin (\u03b8 * \u2191n)) \u2192\n \u00acIrrational (Real.cos (\u03b8 * \u21911)) \u2192 \u00acIrrational (Real.sin (\u03b8 * \u2191n) * Real.cos (\u03b8 * \u21911))\n [prop] \u00acIrrational (Real.cos (\u03b8 * \u21911)) \u2192 \u00acIrrational (Real.sin (\u03b8 * \u2191n) * Real.cos (\u03b8 * \u21911))\n [prop] \u00acIrrational \u03b8 \u2192 \u00acIrrational \u2191n \u2192 \u00acIrrational (\u03b8 * \u2191n)\n [prop] \u00acIrrational (Real.sin (\u03b8 * \u2191n) * Real.cos (\u03b8 * \u21911)) \u2192\n \u00acIrrational (Real.cos (\u03b8 * \u2191n) * Real.sin (\u03b8 * \u21911)) \u2192\n \u00acIrrational (Real.sin (\u03b8 * \u2191n) * Real.cos (\u03b8 * \u21911) + Real.cos (\u03b8 * \u2191n) * Real.sin (\u03b8 * \u21911))\n [prop] \u00acIrrational (Real.cos (\u03b8 * \u2191n) * Real.cos (\u03b8 * \u21911)) \u2192\n \u00acIrrational (Real.sin (\u03b8 * \u2191n) * Real.sin (\u03b8 * \u21911)) \u2192\n \u00acIrrational (Real.cos (\u03b8 * \u2191n) * Real.cos (\u03b8 * \u21911) - Real.sin (\u03b8 * \u2191n) * Real.sin (\u03b8 * \u21911))\n [eqc] False propositions\n [prop] Irrational (Real.sin (\u03b8 * \u2191n))\n [prop] Irrational (Real.cos (\u03b8 * \u2191n))\n [ematch] E-matching patterns\n [thm] cos_\u03b8: [Real.cos `[\u03b8]]\n [thm] sin_\u03b8: [Real.sin `[\u03b8]]\n [thm] Rat.not_irrational: [@RatCast.ratCast `[\u211d] `[Real.instRatCast] #0]\n [thm] not_irrational_mul: [@HMul.hMul `[\u211d] `[\u211d] `[\u211d] `[instHMul] #3 #2]\n [thm] not_irrational_add: [@HAdd.hAdd `[\u211d] `[\u211d] `[\u211d] `[instHAdd] #3 #2]\n [thm] not_irrational_sub: [@HSub.hSub `[\u211d] `[\u211d] `[\u211d] `[instHSub] #3 #2]\n[grind] Diagnostics\n [thm] E-Matching instances\n [thm] not_irrational_mul \u21a6 6\n [thm] not_irrational_add \u21a6 1\n [thm] not_irrational_sub \u21a6 1", "unknown option 'backward.isDefEq.respectTransparency'", "unknown identifier 'niven_sin'", "unsolved goals\nn : \u2115\nhz : 1 \u2264 n\na\u271d : Real.sin (\u2191n * \u03b8) = 0\n\u22a2 False", "unknown tactic", "failed to synthesize\n SetLike (Finset Circle) ?m.15517\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "tactic 'introN' failed, insufficient number of binders\ncase h.refine_2\n\u22a2 sorry"], "timeout_s": 600.0, "latency_s": 0.6696, "verified_at": "2026-03-26T18:16:31.929297+00:00"}} | false | true | false | 0.6696 |
compfiles_Imo1976P2 | compfiles | Copyright (c) 2026 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1976, Problem 2
Let $P_{1}(x) = x^{2} - 2$ and $P_{j}(x) = P_{1}(P_{j - 1}(x))$ for $j= 2,\ldots$.
Show that for any positive integer $n,$ the roots of the equation $P_{n}(x) = x$ are real and distinct.
-/
namespace Imo1976P2
open Polynomial
noncomputable def P (j : ℕ) : ℝ[X] :=
match j with
| 0 => 0
| 1 => X^2 - 2
| j+2 => (P 1).comp (P (j+1))
theorem all_real_roots (P : ℝ[X]) (rs : Finset ℝ) (hrs : ∀ x ∈ rs, IsRoot P x) (hc : rs.card = P.natDegree) : P.aroots ℂ = (rs.image Complex.ofReal).val := by
wlog nontrivial : P ≠ 0
· rw [ne_eq, not_not] at nontrivial
subst P
simp at hc
subst rs
simp
rw [eq_comm]
apply Multiset.eq_of_le_of_card_le
· rw [Multiset.le_iff_subset (by simp)]
intro r hr
simp only [Finset.image_val, Multiset.mem_dedup, Multiset.mem_map, Finset.mem_val] at hr
let ⟨x, ⟨hx1, hx2⟩⟩ := hr
refine mem_aroots.mpr ⟨nontrivial, ?_⟩
rw [<-hx2, <-Complex.coe_algebraMap, aeval_algebraMap_apply_eq_algebraMap_eval, hrs _ hx1]
simp
· rw [IsAlgClosed.card_aroots_eq_natDegree]
rw [Finset.image_val, Multiset.dedup_eq_self.mpr, Multiset.card_map, Finset.card_val]
· rw [hc]
· rw [Finset.nodup_map_iff_injOn]
simp
theorem root_of_sign_flip {α : Type} [ConditionallyCompleteLinearOrder α] [TopologicalSpace α] [OrderTopology α] [DenselyOrdered α]
{δ : Type} [Ring δ] [LinearOrder δ] [TopologicalSpace δ] [OrderClosedTopology δ] [AddLeftMono δ] [MulPosMono δ] [PosMulMono δ] {a b : α}
(hab : a ≤ b) {f : α → δ} (hf : ContinuousOn f (Set.Icc a b)) (hs : f a * f b < 0) : ∃ r ∈ Set.Ioo a b, f r = 0 := by
if fafb : f a < f b then
have := intermediate_value_Ioo hab hf
have hz : 0 ∈ Set.Ioo (f a) (f b) := by
simp
contrapose! hs
by_cases fann : 0 ≤ f a
· apply le_mul_of_le_mul_of_nonneg_left _ (le_of_lt fafb) fann
positivity
· simp at fann
have := hs fann
rw [<-neg_mul_neg]
apply le_mul_of_le_mul_of_nonneg_right (b:=-f b)
· exact mul_self_nonneg _
· simp [le_of_lt fafb]
· simp [this]
exact this hz
else
simp at fafb
have := intermediate_value_Ioo' hab hf
have hz : 0 ∈ Set.Ioo (f b) (f a) := by
simp
contrapose! hs
by_cases fann : 0 ≤ f b
· apply le_mul_of_le_mul_of_nonneg_right _ fafb fann
positivity
· simp at fann
have := hs fann
rw [<-neg_mul_neg]
apply le_mul_of_le_mul_of_nonneg_left (c:=-f a)
· exact mul_self_nonneg _
· simp [fafb]
· simp [this]
exact this hz
theorem P_natDegree (n : ℕ) (npos : 0 < n) : (P n).natDegree = 2^n := by
fun_induction P
· simp at npos
· simp [<-C_ofNat]
· expose_names
rw [natDegree_comp]
rw [ih1, ih2, pow_succ _ (j+1)]
· ring
· simp
· simp
structure NicePlotOfP (n : ℕ) (npos : 0 < n) where
k : ℕ := (P n).natDegree + 1
len : k = (P n).natDegree + 1 := by simp [P_natDegree]
x : Fin k → ℝ
strictMono : StrictMono x := by simp
y_eq : ∀ i, (P n).eval (x i) = (-1)^i.val * 2
x_first : x ⟨0, Nat.lt_of_sub_eq_succ len⟩ = -2 := by simp
x_last : x ⟨k-1, by simp [len]⟩ = 2 := by simp
theorem NicePlotOfP.findRoot {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i+1 < pl.k) :
∃ r ∈ Set.Ioo (pl.x ⟨i, by omega⟩) (pl.x ⟨i+1, hi⟩), IsRoot (P n) r := by
let a := pl.x ⟨i, by omega⟩
let b := pl.x ⟨i+1, hi⟩
let f := fun x => (P n).eval x
have f_cont : Continuous f := Polynomial.continuous_eval₂ _ _
have aleb : a ≤ b := by
unfold a b
apply pl.strictMono.monotone
simp
have fafb : f a * f b < 0 := by
unfold f a b
rw [pl.y_eq, pl.y_eq, pow_succ]
simp
let ⟨r, hr1, hr2⟩ := root_of_sign_flip aleb f_cont.continuousOn fafb
use r, hr1
grind only [IsRoot]
theorem NicePlotOfP.findRoot.spec_gt {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i+1 < pl.k) (i') (e : i'.val = i) :
(pl.x i') < (NicePlotOfP.findRoot pl i hi).choose := by
let := Exists.choose_spec (NicePlotOfP.findRoot pl i hi)
conv =>
lhs
rw [show i' = ⟨i, by omega⟩ by simp_rw [<-e]]
exact (Set.mem_Ioo.mpr this.left).left
theorem NicePlotOfP.findRoot.spec_lt {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i+1 < pl.k) (i') (e : i'.val = i+1) :
(NicePlotOfP.findRoot pl i hi).choose < (pl.x i') := by
let := Exists.choose_spec (NicePlotOfP.findRoot pl i hi)
conv =>
rhs
rw [show i' = ⟨i+1, hi⟩ by simp_rw [<-e]]
exact (Set.mem_Ioo.mpr this.left).right
theorem NicePlotOfP.findRoot.spec_root {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i+1 < pl.k) :
IsRoot (P n) (NicePlotOfP.findRoot pl i hi).choose := by
let := Exists.choose_spec (NicePlotOfP.findRoot pl i hi)
exact this.right
theorem Fin.val_orderSucc_of_notTop {n : ℕ} (i : Fin (n+1)) (hi : i ≠ ⊤) : (Order.succ i).val = i+1 := by
rw [show i = (Fin.mk i (Fin.val_lt_last hi)).castSucc by simp]
rw [Fin.orderSucc_castSucc]
simp
noncomputable def makePlot (n : ℕ) (npos : 0 < n) : NicePlotOfP n npos :=
match n with
| 1 => {
x := ![-2, 0, 2]
y_eq := by
intro i
unfold P
match i with
| 0 => simp; field
| 1 => simp
| 2 => simp; field
}
| n+2 => {
k : ℕ := (P (n+2)).natDegree + 1
x := fun ⟨i, hi⟩ =>
let pl' := (makePlot (n+1) (Nat.zero_lt_succ n))
if pa : Even i then
have : i/2 < pl'.k := by
rw [pl'.len]
rw [P_natDegree] at hi ⊢
· grind only
· exact Nat.zero_lt_succ n
· exact Nat.lt_add_of_pos_left npos
pl'.x ⟨i/2, this⟩
else
have : (i-1)/2+1 < pl'.k := by
rw [pl'.len]
rw [P_natDegree] at hi ⊢
· grind only [Nat.pow_pos, = Nat.even_iff]
· exact Nat.zero_lt_succ n
· exact Nat.lt_add_of_pos_left npos
(pl'.findRoot _ this).choose
strictMono := by
apply strictMono_of_lt_succ
intro i hi
rw [isMax_iff_eq_top] at hi
if pa : Even i.val then
simp_rw [Fin.val_orderSucc_of_notTop _ hi]
have pa' : ¬ Even (i.val+1) := by grind only [= Nat.even_iff]
simp only [pa, ↓reduceDIte, pa']
apply NicePlotOfP.findRoot.spec_gt
simp
else
simp_rw [Fin.val_orderSucc_of_notTop _ hi]
have pa' :Even (i.val+1) := by grind only [= Nat.even_iff]
simp only [pa, ↓reduceDIte, pa']
apply NicePlotOfP.findRoot.spec_lt
rw [<-mul_left_inj' (c:=2) (by simp), add_mul]
rw [Nat.div_two_mul_two_of_even, Nat.div_two_mul_two_of_even] <;> grind only [= Nat.even_iff]
y_eq := by
intro i
simp only [Set.mem_Ioo, IsRoot.def]
split_ifs with pa
· conv =>
lhs
arg 2
unfold P
arg 1
unfold P
rw [eval_comp]
rw [@NicePlotOfP.y_eq (n+1)]
simp only [eval_sub, eval_pow, eval_X, eval_ofNat]
rw [(neg_one_pow_eq_one_iff_even (by norm_num)).mpr pa]
rw [mul_pow, <-pow_mul]
rw [(neg_one_pow_eq_one_iff_even (by linarith)).mpr _]
· norm_num
· simp
· conv =>
lhs
arg 2
unfold P
arg 1
unfold P
rw [eval_comp]
simp only [eval_sub, eval_pow, eval_X, eval_ofNat]
rw [show eval _ (P (n + 1)) = 0 by {
rw [<-IsRoot]
apply NicePlotOfP.findRoot.spec_root
}]
rw [(neg_one_pow_eq_neg_one_iff_odd (by norm_num)).mpr (Nat.not_even_iff_odd.mp pa)]
simp
x_first := by
simp [NicePlotOfP.x_first]
x_last := by
simp only
rw [dite_eq_left_iff.mpr]
· rw [<-@NicePlotOfP.x_last (n+1) (Nat.zero_lt_succ n) ?_]
· congr 2
· rfl
· rfl
· rw [NicePlotOfP.len, P_natDegree, P_natDegree]
· grind
· simp
· simp
· apply proof_irrel_heq
· intro h
simp [P_natDegree] at h
grind only [= Nat.odd_iff]
}
theorem P_intersect_X {n : ℕ} {npos : 0 < n} (pl : NicePlotOfP n npos) (i : ℕ) (hi : i ∈ Finset.range ((P n).natDegree-1)) :
∃ r ∈ Set.Ioo (pl.x ⟨i, by grind [pl.len]⟩) (pl.x ⟨i+1, by grind [pl.len]⟩), (P n - X).eval r = 0 := by
let a := pl.x ⟨i, by grind [pl.len]⟩
let b := pl.x ⟨i+1, by grind [pl.len]⟩
let f (x:ℝ) := (P n - X).eval x
have f_cont : Continuous f := Polynomial.continuous_eval₂ _ _
have aleb : a ≤ b := by
unfold a b
apply pl.strictMono.monotone
grind
have h1 : {(P n).eval a, (P n).eval b} = ({-2, 2} : Finset ℝ) := by
rw [pl.y_eq, pl.y_eq]
by_cases pa : Even i
· rw [(neg_one_pow_eq_one_iff_even _).mpr _, (neg_one_pow_eq_neg_one_iff_odd _).mpr _] <;> grind
· rw [(neg_one_pow_eq_neg_one_iff_odd _).mpr _, (neg_one_pow_eq_one_iff_even _).mpr _] <;> grind
have : -2 ≤ a ∧ a < 2 := by
rw [<-pl.x_first, <-pl.x_last]
and_intros
· apply pl.strictMono.monotone
simp
· apply pl.strictMono
grind only [= Finset.mem_range, = Lean.Grind.toInt_fin]
have : 0 < i → -2 < a := by
intro ih'
rw [<-pl.x_first]
apply pl.strictMono
grind only [= Finset.mem_range, = Lean.Grind.toInt_fin]
have : -2 < b ∧ b < 2 := by
rw [<-pl.x_first, <-pl.x_last]
and_intros <;> {
apply pl.strictMono
grind only [= Finset.mem_range, = Lean.Grind.toInt_fin, pl.len]
}
have fafb : f a * f b < 0 := by
unfold f
rw [eval_sub, eval_X, eval_sub, eval_X]
if iz : i = 0 then
subst i
conv =>
lhs
args
· args
· rw [pl.y_eq]
· unfold a
rw [pl.x_first]
· arg 1
rw [pl.y_eq]
simp
nlinarith
else
suffices (eval a (P n) - a) < 0 ∧ (eval b (P n) - b) > 0 ∨ (eval a (P n) - a) > 0 ∧ (eval b (P n) - b) < 0 by
exact mul_neg_iff.mpr this.symm
suffices (P n).eval a = -2 ∧ (P n).eval b = 2 ∨ (P n).eval a = 2 ∧ (P n).eval b = -2 by
grind
repeat rw [pl.y_eq]
by_cases pa : Even i
· rw [(neg_one_pow_eq_one_iff_even _).mpr _, (neg_one_pow_eq_neg_one_iff_odd _).mpr _] <;> grind
· rw [(neg_one_pow_eq_neg_one_iff_odd _).mpr _, (neg_one_pow_eq_one_iff_even _).mpr _] <;> grind
let ⟨r, hr1, hr2⟩ := root_of_sign_flip aleb f_cont.continuousOn fafb
use r
theorem P_intersect_X.spec_gt {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i ∈ Finset.range ((P n).natDegree-1))(i') (e : i'.val = i) :
(pl.x i') < (P_intersect_X pl i hi).choose := by
let := Exists.choose_spec (P_intersect_X pl i hi)
grind only [= Set.mem_Ioo]
theorem P_intersect_X.spec_lt {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i ∈ Finset.range ((P n).natDegree-1)) (i') (e : i'.val = i+1) :
(P_intersect_X pl i hi).choose < (pl.x i') := by
let := Exists.choose_spec (P_intersect_X pl i hi)
grind only [= Set.mem_Ioo]
theorem P_intersect_X.spec_root {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i ∈ Finset.range ((P n).natDegree-1)) :
IsRoot (P n - X) (P_intersect_X pl i hi).choose := by
let := Exists.choose_spec (P_intersect_X pl i hi)
exact this.right
theorem imo1976_p2 (n : ℕ) (npos : 0 < n) :
(∀ (r : ℂ), r ∈ aroots (P n - X) ℂ → r.im = 0) ∧ (aroots (P n - X) ℂ).Nodup := by
suffices ∃ rs : Finset ℝ, rs.card = (P n - X).natDegree ∧ ∀ r ∈ rs, IsRoot (P n - X) r by
let ⟨rs, h1, h2⟩ := this
rw [all_real_roots (P n - X) rs h2 ?_] <;> simp [h1]
let pl := makePlot n npos
use {2} ∪ (Finset.range ((P n).natDegree-1)).attach.image (fun i => (P_intersect_X pl i.val i.prop).choose)
and_intros
· have : 2 ≤ (P n).natDegree := by
rw [P_natDegree _ npos]
exact Nat.le_pow npos
rw [Finset.card_union_of_disjoint, Finset.card_image_of_injOn, natDegree_sub_eq_left_of_natDegree_lt]
· rw [Finset.card_attach, Finset.card_range, Finset.card_singleton]
omega
· rw [natDegree_X]
omega
· simp only [Finset.coe_attach, Set.injOn_univ]
apply StrictMono.injective
intro i j iltj
calc
_ < pl.x ⟨i.val+1, by grind [NicePlotOfP.len]⟩ := by
apply P_intersect_X.spec_lt _ _ i.prop
simp
_ ≤ pl.x ⟨j, by grind [NicePlotOfP.len]⟩ := by
apply pl.strictMono.monotone
simp [iltj]
_ < _ := by
apply P_intersect_X.spec_gt _ _ j.prop
simp
· simp only [Finset.mem_image, Finset.mem_attach, true_and,
Subtype.exists, not_exists, Finset.disjoint_singleton_left]
intro i hi
apply ne_of_lt
calc
_ < pl.x ⟨i+1, by grind [NicePlotOfP.len]⟩ := by
apply P_intersect_X.spec_lt _ _ hi
simp
_ ≤ pl.x ⟨pl.k-1, by grind [NicePlotOfP.len]⟩ := by
apply pl.strictMono.monotone
grind [NicePlotOfP.len]
_ = _ := by
rw [<-pl.x_last]
· simp only [Set.mem_Ioo, Finset.singleton_union,
Finset.mem_insert, Finset.mem_image, Finset.mem_attach, true_and, Subtype.exists,
IsRoot.def, forall_eq_or_imp, forall_exists_index]
and_intros
· rw [eval_sub, eval_X]
nth_rw 1 [<-pl.x_last, pl.y_eq]
simp [pl.len, P_natDegree _ npos]
rw [(neg_one_pow_eq_one_iff_even _).mpr] <;> grind only [= Nat.even_iff, usr Nat.div_pow_of_pos]
· intro r i hi er
subst r
apply P_intersect_X.spec_root _ _ hi
end Imo1976P2 | /- | /-
Copyright (c) 2026 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1976, Problem 2
Let $P_{1}(x) = x^{2} - 2$ and $P_{j}(x) = P_{1}(P_{j - 1}(x))$ for $j= 2,\ldots$.
Show that for any positive integer $n,$ the roots of the equation $P_{n}(x) = x$ are real and distinct.
-/
namespace Imo1976P2
open Polynomial
noncomputable def P (j : ℕ) : ℝ[X] :=
match j with
| 0 => 0
| 1 => X^2 - 2
| j+2 => (P 1).comp (P (j+1))
theorem all_real_roots (P : ℝ[X]) (rs : Finset ℝ) (hrs : ∀ x ∈ rs, IsRoot P x) (hc : rs.card = P.natDegree) : P.aroots ℂ = (rs.image Complex.ofReal).val := by
wlog nontrivial : P ≠ 0
· rw [ne_eq, not_not] at nontrivial
subst P
simp at hc
subst rs
simp
rw [eq_comm]
apply Multiset.eq_of_le_of_card_le
· rw [Multiset.le_iff_subset (by simp)]
intro r hr
simp only [Finset.image_val, Multiset.mem_dedup, Multiset.mem_map, Finset.mem_val] at hr
let ⟨x, ⟨hx1, hx2⟩⟩ := hr
refine mem_aroots.mpr ⟨nontrivial, ?_⟩
rw [<-hx2, <-Complex.coe_algebraMap, aeval_algebraMap_apply_eq_algebraMap_eval, hrs _ hx1]
simp
· rw [IsAlgClosed.card_aroots_eq_natDegree]
rw [Finset.image_val, Multiset.dedup_eq_self.mpr, Multiset.card_map, Finset.card_val]
· rw [hc]
· rw [Finset.nodup_map_iff_injOn]
simp
theorem root_of_sign_flip {α : Type} [ConditionallyCompleteLinearOrder α] [TopologicalSpace α] [OrderTopology α] [DenselyOrdered α]
{δ : Type} [Ring δ] [LinearOrder δ] [TopologicalSpace δ] [OrderClosedTopology δ] [AddLeftMono δ] [MulPosMono δ] [PosMulMono δ] {a b : α}
(hab : a ≤ b) {f : α → δ} (hf : ContinuousOn f (Set.Icc a b)) (hs : f a * f b < 0) : ∃ r ∈ Set.Ioo a b, f r = 0 := by
if fafb : f a < f b then
have := intermediate_value_Ioo hab hf
have hz : 0 ∈ Set.Ioo (f a) (f b) := by
simp
contrapose! hs
by_cases fann : 0 ≤ f a
· apply le_mul_of_le_mul_of_nonneg_left _ (le_of_lt fafb) fann
positivity
· simp at fann
have := hs fann
rw [<-neg_mul_neg]
apply le_mul_of_le_mul_of_nonneg_right (b:=-f b)
· exact mul_self_nonneg _
· simp [le_of_lt fafb]
· simp [this]
exact this hz
else
simp at fafb
have := intermediate_value_Ioo' hab hf
have hz : 0 ∈ Set.Ioo (f b) (f a) := by
simp
contrapose! hs
by_cases fann : 0 ≤ f b
· apply le_mul_of_le_mul_of_nonneg_right _ fafb fann
positivity
· simp at fann
have := hs fann
rw [<-neg_mul_neg]
apply le_mul_of_le_mul_of_nonneg_left (c:=-f a)
· exact mul_self_nonneg _
· simp [fafb]
· simp [this]
exact this hz
theorem P_natDegree (n : ℕ) (npos : 0 < n) : (P n).natDegree = 2^n := by
fun_induction P
· simp at npos
· simp [<-C_ofNat]
· expose_names
rw [natDegree_comp]
rw [ih1, ih2, pow_succ _ (j+1)]
· ring
· simp
· simp
structure NicePlotOfP (n : ℕ) (npos : 0 < n) where
k : ℕ := (P n).natDegree + 1
len : k = (P n).natDegree + 1 := by simp [P_natDegree]
x : Fin k → ℝ
strictMono : StrictMono x := by simp
y_eq : ∀ i, (P n).eval (x i) = (-1)^i.val * 2
x_first : x ⟨0, Nat.lt_of_sub_eq_succ len⟩ = -2 := by simp
x_last : x ⟨k-1, by simp [len]⟩ = 2 := by simp
theorem NicePlotOfP.findRoot {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i+1 < pl.k) :
∃ r ∈ Set.Ioo (pl.x ⟨i, by omega⟩) (pl.x ⟨i+1, hi⟩), IsRoot (P n) r := by
let a := pl.x ⟨i, by omega⟩
let b := pl.x ⟨i+1, hi⟩
let f := fun x => (P n).eval x
have f_cont : Continuous f := Polynomial.continuous_eval₂ _ _
have aleb : a ≤ b := by
unfold a b
apply pl.strictMono.monotone
simp
have fafb : f a * f b < 0 := by
unfold f a b
rw [pl.y_eq, pl.y_eq, pow_succ]
simp
let ⟨r, hr1, hr2⟩ := root_of_sign_flip aleb f_cont.continuousOn fafb
use r, hr1
grind only [IsRoot]
theorem NicePlotOfP.findRoot.spec_gt {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i+1 < pl.k) (i') (e : i'.val = i) :
(pl.x i') < (NicePlotOfP.findRoot pl i hi).choose := by
let := Exists.choose_spec (NicePlotOfP.findRoot pl i hi)
conv =>
lhs
rw [show i' = ⟨i, by omega⟩ by simp_rw [<-e]]
exact (Set.mem_Ioo.mpr this.left).left
theorem NicePlotOfP.findRoot.spec_lt {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i+1 < pl.k) (i') (e : i'.val = i+1) :
(NicePlotOfP.findRoot pl i hi).choose < (pl.x i') := by
let := Exists.choose_spec (NicePlotOfP.findRoot pl i hi)
conv =>
rhs
rw [show i' = ⟨i+1, hi⟩ by simp_rw [<-e]]
exact (Set.mem_Ioo.mpr this.left).right
theorem NicePlotOfP.findRoot.spec_root {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i+1 < pl.k) :
IsRoot (P n) (NicePlotOfP.findRoot pl i hi).choose := by
let := Exists.choose_spec (NicePlotOfP.findRoot pl i hi)
exact this.right
theorem Fin.val_orderSucc_of_notTop {n : ℕ} (i : Fin (n+1)) (hi : i ≠ ⊤) : (Order.succ i).val = i+1 := by
rw [show i = (Fin.mk i (Fin.val_lt_last hi)).castSucc by simp]
rw [Fin.orderSucc_castSucc]
simp
noncomputable def makePlot (n : ℕ) (npos : 0 < n) : NicePlotOfP n npos :=
match n with
| 1 => {
x := ![-2, 0, 2]
y_eq := by
intro i
unfold P
match i with
| 0 => simp; field
| 1 => simp
| 2 => simp; field
}
| n+2 => {
k : ℕ := (P (n+2)).natDegree + 1
x := fun ⟨i, hi⟩ =>
let pl' := (makePlot (n+1) (Nat.zero_lt_succ n))
if pa : Even i then
have : i/2 < pl'.k := by
rw [pl'.len]
rw [P_natDegree] at hi ⊢
· grind only
· exact Nat.zero_lt_succ n
· exact Nat.lt_add_of_pos_left npos
pl'.x ⟨i/2, this⟩
else
have : (i-1)/2+1 < pl'.k := by
rw [pl'.len]
rw [P_natDegree] at hi ⊢
· grind only [Nat.pow_pos, = Nat.even_iff]
· exact Nat.zero_lt_succ n
· exact Nat.lt_add_of_pos_left npos
(pl'.findRoot _ this).choose
strictMono := by
apply strictMono_of_lt_succ
intro i hi
rw [isMax_iff_eq_top] at hi
if pa : Even i.val then
simp_rw [Fin.val_orderSucc_of_notTop _ hi]
have pa' : ¬ Even (i.val+1) := by grind only [= Nat.even_iff]
simp only [pa, ↓reduceDIte, pa']
apply NicePlotOfP.findRoot.spec_gt
simp
else
simp_rw [Fin.val_orderSucc_of_notTop _ hi]
have pa' :Even (i.val+1) := by grind only [= Nat.even_iff]
simp only [pa, ↓reduceDIte, pa']
apply NicePlotOfP.findRoot.spec_lt
rw [<-mul_left_inj' (c:=2) (by simp), add_mul]
rw [Nat.div_two_mul_two_of_even, Nat.div_two_mul_two_of_even] <;> grind only [= Nat.even_iff]
y_eq := by
intro i
simp only [Set.mem_Ioo, IsRoot.def]
split_ifs with pa
· conv =>
lhs
arg 2
unfold P
arg 1
unfold P
rw [eval_comp]
rw [@NicePlotOfP.y_eq (n+1)]
simp only [eval_sub, eval_pow, eval_X, eval_ofNat]
rw [(neg_one_pow_eq_one_iff_even (by norm_num)).mpr pa]
rw [mul_pow, <-pow_mul]
rw [(neg_one_pow_eq_one_iff_even (by linarith)).mpr _]
· norm_num
· simp
· conv =>
lhs
arg 2
unfold P
arg 1
unfold P
rw [eval_comp]
simp only [eval_sub, eval_pow, eval_X, eval_ofNat]
rw [show eval _ (P (n + 1)) = 0 by {
rw [<-IsRoot]
apply NicePlotOfP.findRoot.spec_root
}]
rw [(neg_one_pow_eq_neg_one_iff_odd (by norm_num)).mpr (Nat.not_even_iff_odd.mp pa)]
simp
x_first := by
simp [NicePlotOfP.x_first]
x_last := by
simp only
rw [dite_eq_left_iff.mpr]
· rw [<-@NicePlotOfP.x_last (n+1) (Nat.zero_lt_succ n) ?_]
· congr 2
· rfl
· rfl
· rw [NicePlotOfP.len, P_natDegree, P_natDegree]
· grind
· simp
· simp
· apply proof_irrel_heq
· intro h
simp [P_natDegree] at h
grind only [= Nat.odd_iff]
}
theorem P_intersect_X {n : ℕ} {npos : 0 < n} (pl : NicePlotOfP n npos) (i : ℕ) (hi : i ∈ Finset.range ((P n).natDegree-1)) :
∃ r ∈ Set.Ioo (pl.x ⟨i, by grind [pl.len]⟩) (pl.x ⟨i+1, by grind [pl.len]⟩), (P n - X).eval r = 0 := by
let a := pl.x ⟨i, by grind [pl.len]⟩
let b := pl.x ⟨i+1, by grind [pl.len]⟩
let f (x:ℝ) := (P n - X).eval x
have f_cont : Continuous f := Polynomial.continuous_eval₂ _ _
have aleb : a ≤ b := by
unfold a b
apply pl.strictMono.monotone
grind
have h1 : {(P n).eval a, (P n).eval b} = ({-2, 2} : Finset ℝ) := by
rw [pl.y_eq, pl.y_eq]
by_cases pa : Even i
· rw [(neg_one_pow_eq_one_iff_even _).mpr _, (neg_one_pow_eq_neg_one_iff_odd _).mpr _] <;> grind
· rw [(neg_one_pow_eq_neg_one_iff_odd _).mpr _, (neg_one_pow_eq_one_iff_even _).mpr _] <;> grind
have : -2 ≤ a ∧ a < 2 := by
rw [<-pl.x_first, <-pl.x_last]
and_intros
· apply pl.strictMono.monotone
simp
· apply pl.strictMono
grind only [= Finset.mem_range, = Lean.Grind.toInt_fin]
have : 0 < i → -2 < a := by
intro ih'
rw [<-pl.x_first]
apply pl.strictMono
grind only [= Finset.mem_range, = Lean.Grind.toInt_fin]
have : -2 < b ∧ b < 2 := by
rw [<-pl.x_first, <-pl.x_last]
and_intros <;> {
apply pl.strictMono
grind only [= Finset.mem_range, = Lean.Grind.toInt_fin, pl.len]
}
have fafb : f a * f b < 0 := by
unfold f
rw [eval_sub, eval_X, eval_sub, eval_X]
if iz : i = 0 then
subst i
conv =>
lhs
args
· args
· rw [pl.y_eq]
· unfold a
rw [pl.x_first]
· arg 1
rw [pl.y_eq]
simp
nlinarith
else
suffices (eval a (P n) - a) < 0 ∧ (eval b (P n) - b) > 0 ∨ (eval a (P n) - a) > 0 ∧ (eval b (P n) - b) < 0 by
exact mul_neg_iff.mpr this.symm
suffices (P n).eval a = -2 ∧ (P n).eval b = 2 ∨ (P n).eval a = 2 ∧ (P n).eval b = -2 by
grind
repeat rw [pl.y_eq]
by_cases pa : Even i
· rw [(neg_one_pow_eq_one_iff_even _).mpr _, (neg_one_pow_eq_neg_one_iff_odd _).mpr _] <;> grind
· rw [(neg_one_pow_eq_neg_one_iff_odd _).mpr _, (neg_one_pow_eq_one_iff_even _).mpr _] <;> grind
let ⟨r, hr1, hr2⟩ := root_of_sign_flip aleb f_cont.continuousOn fafb
use r
theorem P_intersect_X.spec_gt {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i ∈ Finset.range ((P n).natDegree-1))(i') (e : i'.val = i) :
(pl.x i') < (P_intersect_X pl i hi).choose := by
let := Exists.choose_spec (P_intersect_X pl i hi)
grind only [= Set.mem_Ioo]
theorem P_intersect_X.spec_lt {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i ∈ Finset.range ((P n).natDegree-1)) (i') (e : i'.val = i+1) :
(P_intersect_X pl i hi).choose < (pl.x i') := by
let := Exists.choose_spec (P_intersect_X pl i hi)
grind only [= Set.mem_Ioo]
theorem P_intersect_X.spec_root {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i ∈ Finset.range ((P n).natDegree-1)) :
IsRoot (P n - X) (P_intersect_X pl i hi).choose := by
let := Exists.choose_spec (P_intersect_X pl i hi)
exact this.right
theorem imo1976_p2 (n : ℕ) (npos : 0 < n) :
(∀ (r : ℂ), r ∈ aroots (P n - X) ℂ → r.im = 0) ∧ (aroots (P n - X) ℂ).Nodup := by
suffices ∃ rs : Finset ℝ, rs.card = (P n - X).natDegree ∧ ∀ r ∈ rs, IsRoot (P n - X) r by
let ⟨rs, h1, h2⟩ := this
rw [all_real_roots (P n - X) rs h2 ?_] <;> simp [h1]
let pl := makePlot n npos
use {2} ∪ (Finset.range ((P n).natDegree-1)).attach.image (fun i => (P_intersect_X pl i.val i.prop).choose)
and_intros
· have : 2 ≤ (P n).natDegree := by
rw [P_natDegree _ npos]
exact Nat.le_pow npos
rw [Finset.card_union_of_disjoint, Finset.card_image_of_injOn, natDegree_sub_eq_left_of_natDegree_lt]
· rw [Finset.card_attach, Finset.card_range, Finset.card_singleton]
omega
· rw [natDegree_X]
omega
· simp only [Finset.coe_attach, Set.injOn_univ]
apply StrictMono.injective
intro i j iltj
calc
_ < pl.x ⟨i.val+1, by grind [NicePlotOfP.len]⟩ := by
apply P_intersect_X.spec_lt _ _ i.prop
simp
_ ≤ pl.x ⟨j, by grind [NicePlotOfP.len]⟩ := by
apply pl.strictMono.monotone
simp [iltj]
_ < _ := by
apply P_intersect_X.spec_gt _ _ j.prop
simp
· simp only [Finset.mem_image, Finset.mem_attach, true_and,
Subtype.exists, not_exists, Finset.disjoint_singleton_left]
intro i hi
apply ne_of_lt
calc
_ < pl.x ⟨i+1, by grind [NicePlotOfP.len]⟩ := by
apply P_intersect_X.spec_lt _ _ hi
simp
_ ≤ pl.x ⟨pl.k-1, by grind [NicePlotOfP.len]⟩ := by
apply pl.strictMono.monotone
grind [NicePlotOfP.len]
_ = _ := by
rw [<-pl.x_last]
· simp only [Set.mem_Ioo, Finset.singleton_union,
Finset.mem_insert, Finset.mem_image, Finset.mem_attach, true_and, Subtype.exists,
IsRoot.def, forall_eq_or_imp, forall_exists_index]
and_intros
· rw [eval_sub, eval_X]
nth_rw 1 [<-pl.x_last, pl.y_eq]
simp [pl.len, P_natDegree _ npos]
rw [(neg_one_pow_eq_one_iff_even _).mpr] <;> grind only [= Nat.even_iff, usr Nat.div_pow_of_pos]
· intro r i hi er
subst r
apply P_intersect_X.spec_root _ _ hi
end Imo1976P2
| true | Copyright (c) 2026 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1976, Problem 2
Let $P_{1}(x) = x^{2} - 2$ and $P_{j}(x) = P_{1}(P_{j - 1}(x))$ for $j= 2,\ldots$.
Show that for any positive integer $n,$ the roots of the equation $P_{n}(x) = x$ are real and distinct.
-/
namespace Imo1976P2
open Polynomial
noncomputable def P (j : ℕ) : ℝ[X] :=
match j with
| 0 => 0
| 1 => X^2 - 2
| j+2 => (P 1).comp (P (j+1))
theorem all_real_roots (P : ℝ[X]) (rs : Finset ℝ) (hrs : ∀ x ∈ rs, IsRoot P x) (hc : rs.card = P.natDegree) : P.aroots ℂ = (rs.image Complex.ofReal).val := by
wlog nontrivial : P ≠ 0
· rw [ne_eq, not_not] at nontrivial
subst P
simp at hc
subst rs
simp
rw [eq_comm]
apply Multiset.eq_of_le_of_card_le
· rw [Multiset.le_iff_subset (by simp)]
intro r hr
simp only [Finset.image_val, Multiset.mem_dedup, Multiset.mem_map, Finset.mem_val] at hr
let ⟨x, ⟨hx1, hx2⟩⟩ := hr
refine mem_aroots.mpr ⟨nontrivial, ?_⟩
rw [<-hx2, <-Complex.coe_algebraMap, aeval_algebraMap_apply_eq_algebraMap_eval, hrs _ hx1]
simp
· rw [IsAlgClosed.card_aroots_eq_natDegree]
rw [Finset.image_val, Multiset.dedup_eq_self.mpr, Multiset.card_map, Finset.card_val]
· rw [hc]
· rw [Finset.nodup_map_iff_injOn]
simp
theorem root_of_sign_flip {α : Type} [ConditionallyCompleteLinearOrder α] [TopologicalSpace α] [OrderTopology α] [DenselyOrdered α]
{δ : Type} [Ring δ] [LinearOrder δ] [TopologicalSpace δ] [OrderClosedTopology δ] [AddLeftMono δ] [MulPosMono δ] [PosMulMono δ] {a b : α}
(hab : a ≤ b) {f : α → δ} (hf : ContinuousOn f (Set.Icc a b)) (hs : f a * f b < 0) : ∃ r ∈ Set.Ioo a b, f r = 0 := by
if fafb : f a < f b then
have := intermediate_value_Ioo hab hf
have hz : 0 ∈ Set.Ioo (f a) (f b) := by
simp
contrapose! hs
by_cases fann : 0 ≤ f a
· apply le_mul_of_le_mul_of_nonneg_left _ (le_of_lt fafb) fann
positivity
· simp at fann
have := hs fann
rw [<-neg_mul_neg]
apply le_mul_of_le_mul_of_nonneg_right (b:=-f b)
· exact mul_self_nonneg _
· simp [le_of_lt fafb]
· simp [this]
exact this hz
else
simp at fafb
have := intermediate_value_Ioo' hab hf
have hz : 0 ∈ Set.Ioo (f b) (f a) := by
simp
contrapose! hs
by_cases fann : 0 ≤ f b
· apply le_mul_of_le_mul_of_nonneg_right _ fafb fann
positivity
· simp at fann
have := hs fann
rw [<-neg_mul_neg]
apply le_mul_of_le_mul_of_nonneg_left (c:=-f a)
· exact mul_self_nonneg _
· simp [fafb]
· simp [this]
exact this hz
theorem P_natDegree (n : ℕ) (npos : 0 < n) : (P n).natDegree = 2^n := by
fun_induction P
· simp at npos
· simp [<-C_ofNat]
· expose_names
rw [natDegree_comp]
rw [ih1, ih2, pow_succ _ (j+1)]
· ring
· simp
· simp
structure NicePlotOfP (n : ℕ) (npos : 0 < n) where
k : ℕ := (P n).natDegree + 1
len : k = (P n).natDegree + 1 := by simp [P_natDegree]
x : Fin k → ℝ
strictMono : StrictMono x := by simp
y_eq : ∀ i, (P n).eval (x i) = (-1)^i.val * 2
x_first : x ⟨0, Nat.lt_of_sub_eq_succ len⟩ = -2 := by simp
x_last : x ⟨k-1, by simp [len]⟩ = 2 := by simp
theorem NicePlotOfP.findRoot {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i+1 < pl.k) :
∃ r ∈ Set.Ioo (pl.x ⟨i, by omega⟩) (pl.x ⟨i+1, hi⟩), IsRoot (P n) r := by
let a := pl.x ⟨i, by omega⟩
let b := pl.x ⟨i+1, hi⟩
let f := fun x => (P n).eval x
have f_cont : Continuous f := Polynomial.continuous_eval₂ _ _
have aleb : a ≤ b := by
unfold a b
apply pl.strictMono.monotone
simp
have fafb : f a * f b < 0 := by
unfold f a b
rw [pl.y_eq, pl.y_eq, pow_succ]
simp
let ⟨r, hr1, hr2⟩ := root_of_sign_flip aleb f_cont.continuousOn fafb
use r, hr1
grind only [IsRoot]
theorem NicePlotOfP.findRoot.spec_gt {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i+1 < pl.k) (i') (e : i'.val = i) :
(pl.x i') < (NicePlotOfP.findRoot pl i hi).choose := by
let := Exists.choose_spec (NicePlotOfP.findRoot pl i hi)
conv =>
lhs
rw [show i' = ⟨i, by omega⟩ by simp_rw [<-e]]
exact (Set.mem_Ioo.mpr this.left).left
theorem NicePlotOfP.findRoot.spec_lt {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i+1 < pl.k) (i') (e : i'.val = i+1) :
(NicePlotOfP.findRoot pl i hi).choose < (pl.x i') := by
let := Exists.choose_spec (NicePlotOfP.findRoot pl i hi)
conv =>
rhs
rw [show i' = ⟨i+1, hi⟩ by simp_rw [<-e]]
exact (Set.mem_Ioo.mpr this.left).right
theorem NicePlotOfP.findRoot.spec_root {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i+1 < pl.k) :
IsRoot (P n) (NicePlotOfP.findRoot pl i hi).choose := by
let := Exists.choose_spec (NicePlotOfP.findRoot pl i hi)
exact this.right
theorem Fin.val_orderSucc_of_notTop {n : ℕ} (i : Fin (n+1)) (hi : i ≠ ⊤) : (Order.succ i).val = i+1 := by
rw [show i = (Fin.mk i (Fin.val_lt_last hi)).castSucc by simp]
rw [Fin.orderSucc_castSucc]
simp
noncomputable def makePlot (n : ℕ) (npos : 0 < n) : NicePlotOfP n npos :=
match n with
| 1 => {
x := ![-2, 0, 2]
y_eq := by
intro i
unfold P
match i with
| 0 => simp; field
| 1 => simp
| 2 => simp; field
}
| n+2 => {
k : ℕ := (P (n+2)).natDegree + 1
x := fun ⟨i, hi⟩ =>
let pl' := (makePlot (n+1) (Nat.zero_lt_succ n))
if pa : Even i then
have : i/2 < pl'.k := by
rw [pl'.len]
rw [P_natDegree] at hi ⊢
· grind only
· exact Nat.zero_lt_succ n
· exact Nat.lt_add_of_pos_left npos
pl'.x ⟨i/2, this⟩
else
have : (i-1)/2+1 < pl'.k := by
rw [pl'.len]
rw [P_natDegree] at hi ⊢
· grind only [Nat.pow_pos, = Nat.even_iff]
· exact Nat.zero_lt_succ n
· exact Nat.lt_add_of_pos_left npos
(pl'.findRoot _ this).choose
strictMono := by
apply strictMono_of_lt_succ
intro i hi
rw [isMax_iff_eq_top] at hi
if pa : Even i.val then
simp_rw [Fin.val_orderSucc_of_notTop _ hi]
have pa' : ¬ Even (i.val+1) := by grind only [= Nat.even_iff]
simp only [pa, ↓reduceDIte, pa']
apply NicePlotOfP.findRoot.spec_gt
simp
else
simp_rw [Fin.val_orderSucc_of_notTop _ hi]
have pa' :Even (i.val+1) := by grind only [= Nat.even_iff]
simp only [pa, ↓reduceDIte, pa']
apply NicePlotOfP.findRoot.spec_lt
rw [<-mul_left_inj' (c:=2) (by simp), add_mul]
rw [Nat.div_two_mul_two_of_even, Nat.div_two_mul_two_of_even] <;> grind only [= Nat.even_iff]
y_eq := by
intro i
simp only [Set.mem_Ioo, IsRoot.def]
split_ifs with pa
· conv =>
lhs
arg 2
unfold P
arg 1
unfold P
rw [eval_comp]
rw [@NicePlotOfP.y_eq (n+1)]
simp only [eval_sub, eval_pow, eval_X, eval_ofNat]
rw [(neg_one_pow_eq_one_iff_even (by norm_num)).mpr pa]
rw [mul_pow, <-pow_mul]
rw [(neg_one_pow_eq_one_iff_even (by linarith)).mpr _]
· norm_num
· simp
· conv =>
lhs
arg 2
unfold P
arg 1
unfold P
rw [eval_comp]
simp only [eval_sub, eval_pow, eval_X, eval_ofNat]
rw [show eval _ (P (n + 1)) = 0 by {
rw [<-IsRoot]
apply NicePlotOfP.findRoot.spec_root
}]
rw [(neg_one_pow_eq_neg_one_iff_odd (by norm_num)).mpr (Nat.not_even_iff_odd.mp pa)]
simp
x_first := by
simp [NicePlotOfP.x_first]
x_last := by
simp only
rw [dite_eq_left_iff.mpr]
· rw [<-@NicePlotOfP.x_last (n+1) (Nat.zero_lt_succ n) ?_]
· congr 2
· rfl
· rfl
· rw [NicePlotOfP.len, P_natDegree, P_natDegree]
· grind
· simp
· simp
· apply proof_irrel_heq
· intro h
simp [P_natDegree] at h
grind only [= Nat.odd_iff]
}
theorem P_intersect_X {n : ℕ} {npos : 0 < n} (pl : NicePlotOfP n npos) (i : ℕ) (hi : i ∈ Finset.range ((P n).natDegree-1)) :
∃ r ∈ Set.Ioo (pl.x ⟨i, by grind [pl.len]⟩) (pl.x ⟨i+1, by grind [pl.len]⟩), (P n - X).eval r = 0 := by
let a := pl.x ⟨i, by grind [pl.len]⟩
let b := pl.x ⟨i+1, by grind [pl.len]⟩
let f (x:ℝ) := (P n - X).eval x
have f_cont : Continuous f := Polynomial.continuous_eval₂ _ _
have aleb : a ≤ b := by
unfold a b
apply pl.strictMono.monotone
grind
have h1 : {(P n).eval a, (P n).eval b} = ({-2, 2} : Finset ℝ) := by
rw [pl.y_eq, pl.y_eq]
by_cases pa : Even i
· rw [(neg_one_pow_eq_one_iff_even _).mpr _, (neg_one_pow_eq_neg_one_iff_odd _).mpr _] <;> grind
· rw [(neg_one_pow_eq_neg_one_iff_odd _).mpr _, (neg_one_pow_eq_one_iff_even _).mpr _] <;> grind
have : -2 ≤ a ∧ a < 2 := by
rw [<-pl.x_first, <-pl.x_last]
and_intros
· apply pl.strictMono.monotone
simp
· apply pl.strictMono
grind only [= Finset.mem_range, = Lean.Grind.toInt_fin]
have : 0 < i → -2 < a := by
intro ih'
rw [<-pl.x_first]
apply pl.strictMono
grind only [= Finset.mem_range, = Lean.Grind.toInt_fin]
have : -2 < b ∧ b < 2 := by
rw [<-pl.x_first, <-pl.x_last]
and_intros <;> {
apply pl.strictMono
grind only [= Finset.mem_range, = Lean.Grind.toInt_fin, pl.len]
}
have fafb : f a * f b < 0 := by
unfold f
rw [eval_sub, eval_X, eval_sub, eval_X]
if iz : i = 0 then
subst i
conv =>
lhs
args
· args
· rw [pl.y_eq]
· unfold a
rw [pl.x_first]
· arg 1
rw [pl.y_eq]
simp
nlinarith
else
suffices (eval a (P n) - a) < 0 ∧ (eval b (P n) - b) > 0 ∨ (eval a (P n) - a) > 0 ∧ (eval b (P n) - b) < 0 by
exact mul_neg_iff.mpr this.symm
suffices (P n).eval a = -2 ∧ (P n).eval b = 2 ∨ (P n).eval a = 2 ∧ (P n).eval b = -2 by
grind
repeat rw [pl.y_eq]
by_cases pa : Even i
· rw [(neg_one_pow_eq_one_iff_even _).mpr _, (neg_one_pow_eq_neg_one_iff_odd _).mpr _] <;> grind
· rw [(neg_one_pow_eq_neg_one_iff_odd _).mpr _, (neg_one_pow_eq_one_iff_even _).mpr _] <;> grind
let ⟨r, hr1, hr2⟩ := root_of_sign_flip aleb f_cont.continuousOn fafb
use r
theorem P_intersect_X.spec_gt {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i ∈ Finset.range ((P n).natDegree-1))(i') (e : i'.val = i) :
(pl.x i') < (P_intersect_X pl i hi).choose := by
let := Exists.choose_spec (P_intersect_X pl i hi)
grind only [= Set.mem_Ioo]
theorem P_intersect_X.spec_lt {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i ∈ Finset.range ((P n).natDegree-1)) (i') (e : i'.val = i+1) :
(P_intersect_X pl i hi).choose < (pl.x i') := by
let := Exists.choose_spec (P_intersect_X pl i hi)
grind only [= Set.mem_Ioo]
theorem P_intersect_X.spec_root {n} {npos} (pl : NicePlotOfP n npos) (i:ℕ) (hi : i ∈ Finset.range ((P n).natDegree-1)) :
IsRoot (P n - X) (P_intersect_X pl i hi).choose := by
let := Exists.choose_spec (P_intersect_X pl i hi)
exact this.right
theorem imo1976_p2 (n : ℕ) (npos : 0 < n) :
(∀ (r : ℂ), r ∈ aroots (P n - X) ℂ → r.im = 0) ∧ (aroots (P n - X) ℂ).Nodup := by
suffices ∃ rs : Finset ℝ, rs.card = (P n - X).natDegree ∧ ∀ r ∈ rs, IsRoot (P n - X) r by
let ⟨rs, h1, h2⟩ := this
rw [all_real_roots (P n - X) rs h2 ?_] <;> simp [h1]
let pl := makePlot n npos
use {2} ∪ (Finset.range ((P n).natDegree-1)).attach.image (fun i => (P_intersect_X pl i.val i.prop).choose)
and_intros
· have : 2 ≤ (P n).natDegree := by
rw [P_natDegree _ npos]
exact Nat.le_pow npos
rw [Finset.card_union_of_disjoint, Finset.card_image_of_injOn, natDegree_sub_eq_left_of_natDegree_lt]
· rw [Finset.card_attach, Finset.card_range, Finset.card_singleton]
omega
· rw [natDegree_X]
omega
· simp only [Finset.coe_attach, Set.injOn_univ]
apply StrictMono.injective
intro i j iltj
calc
_ < pl.x ⟨i.val+1, by grind [NicePlotOfP.len]⟩ := by
apply P_intersect_X.spec_lt _ _ i.prop
simp
_ ≤ pl.x ⟨j, by grind [NicePlotOfP.len]⟩ := by
apply pl.strictMono.monotone
simp [iltj]
_ < _ := by
apply P_intersect_X.spec_gt _ _ j.prop
simp
· simp only [Finset.mem_image, Finset.mem_attach, true_and,
Subtype.exists, not_exists, Finset.disjoint_singleton_left]
intro i hi
apply ne_of_lt
calc
_ < pl.x ⟨i+1, by grind [NicePlotOfP.len]⟩ := by
apply P_intersect_X.spec_lt _ _ hi
simp
_ ≤ pl.x ⟨pl.k-1, by grind [NicePlotOfP.len]⟩ := by
apply pl.strictMono.monotone
grind [NicePlotOfP.len]
_ = _ := by
rw [<-pl.x_last]
· simp only [Set.mem_Ioo, Finset.singleton_union,
Finset.mem_insert, Finset.mem_image, Finset.mem_attach, true_and, Subtype.exists,
IsRoot.def, forall_eq_or_imp, forall_exists_index]
and_intros
· rw [eval_sub, eval_X]
nth_rw 1 [<-pl.x_last, pl.y_eq]
simp [pl.len, P_natDegree _ npos]
rw [(neg_one_pow_eq_one_iff_even _).mpr] <;> grind only [= Nat.even_iff, usr Nat.div_pow_of_pos]
· intro r i hi er
subst r
apply P_intersect_X.spec_root _ _ hi
end Imo1976P2 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1976P2.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown constant 'IsAlgClosed.card_aroots_eq_natDegree'", "failed to synthesize\n ZeroLEOneClass \u03b4\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n ZeroLEOneClass \u03b4\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "unknown identifier 'C_ofNat'", "unsolved goals\ncase case2\nnpos : 0 < 1\n\u22a2 (X ^ 2 - 2).natDegree = 2", "unknown tactic", "unsolved goals\nn : \u2115\nnpos : 0 < n\npl : NicePlotOfP n npos\ni : \u2115\nhi : i + 1 < pl.k\nr : ?m.96351\n\u22a2 i < pl.k", "unknown constant 'Imo1976P2.NicePlotOfP.findRoot'", "unsolved goals\ncase this\nn : \u2115\nnpos : 0 < n\npl : NicePlotOfP n npos\ni : \u2115\nhi : i + 1 < pl.k\ni' : Fin pl.k\ne : \u2191i' = i\n\u22a2 ?m.96667\n\nn : \u2115\nnpos : 0 < n\npl : NicePlotOfP n npos\ni : \u2115\nhi : i + 1 < pl.k\ni' : Fin pl.k\ne : \u2191i' = i\nthis : ?m.96667 := ?this\n\u22a2 pl.x i' < sorry", "(kernel) declaration has metavariables 'Imo1976P2.NicePlotOfP.findRoot.spec_gt'", "unexpected token ':='; expected command", "unknown constant 'Imo1976P2.NicePlotOfP.findRoot'", "unsolved goals\ncase this\nn : \u2115\nnpos : 0 < n\npl : NicePlotOfP n npos\ni : \u2115\nhi : i + 1 < pl.k\ni' : Fin pl.k\ne : \u2191i' = i + 1\n\u22a2 ?m.96907\n\nn : \u2115\nnpos : 0 < n\npl : NicePlotOfP n npos\ni : \u2115\nhi : i + 1 < pl.k\ni' : Fin pl.k\ne : \u2191i' = i + 1\nthis : ?m.96907 := ?this\n\u22a2 sorry < pl.x i'", "(kernel) declaration has metavariables 'Imo1976P2.NicePlotOfP.findRoot.spec_lt'", "unexpected token ':='; expected command", "unknown constant 'Imo1976P2.NicePlotOfP.findRoot'", "unsolved goals\ncase this\nn : \u2115\nnpos : 0 < n\npl : NicePlotOfP n npos\ni : \u2115\nhi : i + 1 < pl.k\n\u22a2 ?m.97207\n\nn : \u2115\nnpos : 0 < n\npl : NicePlotOfP n npos\ni : \u2115\nhi : i + 1 < pl.k\nthis : ?m.97207 := ?this\n\u22a2 (P n).IsRoot sorry", "(kernel) declaration has metavariables 'Imo1976P2.NicePlotOfP.findRoot.spec_root'", "unexpected token ':='; expected command", "unknown tactic", "Missing cases:\n(Fin.mk (Nat.succ _) _)", "unsolved goals\nn : \u2115\nnpos : 0 < 1\ni : Fin (Nat.succ 0).succ.succ\n\u22a2 2 ^ 2 - 2 = 2", "unknown constant 'pl.len'", "unknown constant 'pl.len'", "unknown constant 'pl.len'", "unknown constant 'pl.len'", "`grind` failed\ncase grind.1.1\nn : \u2115\nnpos : 1 \u2264 n\npl : NicePlotOfP n \u22ef\ni : \u2115\nhi : i \u2208 Finset.range ((P n).natDegree - 1)\nf_cont : Continuous fun x => eval x (P n - X)\nh : \u00ac\u27e8i, \u22ef\u27e9 \u2264 \u27e8i + 1, \u22ef\u27e9\nh_1 : -1 * \u2191(P n).natDegree + 1 \u2264 0\nh_2 : i = 0\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] 1 \u2264 n\n [prop] i \u2208 Finset.range ((P n).natDegree - 1)\n [prop] \u2191((P n).natDegree - 1) = if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0\n [prop] Continuous fun x => eval x (P n - X)\n [prop] \u00ac\u27e8i, \u22ef\u27e9 \u2264 \u27e8i + 1, \u22ef\u27e9\n [prop] -1 * \u2191(P n).natDegree + 1 \u2264 0\n [prop] i = 0\n [eqc] True propositions\n [prop] 1 \u2264 n\n [prop] i \u2208 Finset.range ((P n).natDegree - 1)\n [prop] Continuous fun x => eval x (P n - X)\n [prop] i + 1 < pl.k\n [prop] i < pl.k\n [prop] -1 * \u2191(P n).natDegree + 1 \u2264 0\n [prop] i = 0\n [eqc] False propositions\n [prop] \u27e8i, \u22ef\u27e9 \u2264 \u27e8i + 1, \u22ef\u27e9\n [eqc] Equivalence classes\n [eqc] {\u2191i, \u21910}\n [eqc] {\u2191((P n).natDegree - 1),\n \u2191(P n).natDegree + -1,\n if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0}\n [eqc] {\u2191(i + 1), \u21911}\n [eqc] {i + 1, 1}\n [eqc] {i, 0}\n [cases] Case analyses\n [cases] [1/2]: if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0\n [cases] [1/2]: i = 0\n [ematch] E-matching patterns\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [cutsat] Assignment satisfying linear constraints\n [assign] n := 1\n [assign] i := 0\n [assign] pl.k := 4\n [assign] (P n).natDegree := 1\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.range ((P n).natDegree - 1)\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.range ((P n).natDegree - 1)\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type", "`grind` failed\ncase grind.1.1\nn : \u2115\nnpos : 1 \u2264 n\npl : NicePlotOfP n \u22ef\ni : \u2115\nhi : i \u2208 Finset.range ((P n).natDegree - 1)\nf_cont : Continuous fun x => eval x (P n - X)\naleb : pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\npa : Even i\nh : \u00ac{1 * 2, -1 * 2} = {-2, 2}\nh_1 : -1 * \u2191(P n).natDegree + 1 \u2264 0\nh_2 : i = 0\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] 1 \u2264 n\n [prop] i \u2208 Finset.range ((P n).natDegree - 1)\n [prop] \u2191((P n).natDegree - 1) = if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0\n [prop] Continuous fun x => eval x (P n - X)\n [prop] pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] Even i\n [prop] \u00ac{1 * 2, -1 * 2} = {-2, 2}\n [prop] -1 * \u2191(P n).natDegree + 1 \u2264 0\n [prop] i = 0\n [eqc] True propositions\n [prop] 1 \u2264 n\n [prop] i \u2208 Finset.range ((P n).natDegree - 1)\n [prop] Continuous fun x => eval x (P n - X)\n [prop] pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] i + 1 < pl.k\n [prop] i < pl.k\n [prop] Even i\n [prop] (0 + 2).AtLeastTwo\n [prop] -1 * \u2191(P n).natDegree + 1 \u2264 0\n [prop] i = 0\n [eqc] False propositions\n [prop] {1 * 2, -1 * 2} = {-2, 2}\n [eqc] Equivalence classes\n [eqc] {\u2191i, \u21910}\n [eqc] {\u2191((P n).natDegree - 1),\n \u2191(P n).natDegree + -1,\n if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0}\n [eqc] {\u2191(i + 1), \u21911}\n [eqc] {i + 1, 1}\n [eqc] {i, 0}\n [cases] Case analyses\n [cases] [1/2]: if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0\n [cases] [1/2]: i = 0\n [ematch] E-matching patterns\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [cutsat] Assignment satisfying linear constraints\n [assign] n := 1\n [assign] i := 0\n [assign] pl.k := 5\n [assign] (P n).natDegree := 1\n [assign] 1 := 1\n [assign] 2 := 2\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.range ((P n).natDegree - 1)\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.range ((P n).natDegree - 1)\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type", "`grind` failed\ncase grind.1.1\nn : \u2115\nnpos : 1 \u2264 n\npl : NicePlotOfP n \u22ef\ni : \u2115\nhi : i \u2208 Finset.range ((P n).natDegree - 1)\nf_cont : Continuous fun x => eval x (P n - X)\naleb : pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\npa : Even i\nh : \u00acOdd (i + 1)\nh_1 : -1 * \u2191(P n).natDegree + 1 \u2264 0\nh_2 : i = 0\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] 1 \u2264 n\n [prop] i \u2208 Finset.range ((P n).natDegree - 1)\n [prop] \u2191((P n).natDegree - 1) = if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0\n [prop] Continuous fun x => eval x (P n - X)\n [prop] pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] Even i\n [prop] \u00acOdd (i + 1)\n [prop] -1 * \u2191(P n).natDegree + 1 \u2264 0\n [prop] i = 0\n [eqc] True propositions\n [prop] 1 \u2264 n\n [prop] i \u2208 Finset.range ((P n).natDegree - 1)\n [prop] Continuous fun x => eval x (P n - X)\n [prop] pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] i + 1 < pl.k\n [prop] i < pl.k\n [prop] Even i\n [prop] -1 * \u2191(P n).natDegree + 1 \u2264 0\n [prop] i = 0\n [eqc] False propositions\n [prop] Odd (i + 1)\n [eqc] Equivalence classes\n [eqc] {\u2191i, \u21910}\n [eqc] {\u2191((P n).natDegree - 1),\n \u2191(P n).natDegree + -1,\n if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0}\n [eqc] {\u2191(i + 1), \u21911}\n [eqc] {i + 1, 1}\n [eqc] {i, 0}\n [cases] Case analyses\n [cases] [1/2]: if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0\n [cases] [1/2]: i = 0\n [ematch] E-matching patterns\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [cutsat] Assignment satisfying linear constraints\n [assign] n := 1\n [assign] i := 0\n [assign] pl.k := 4\n [assign] (P n).natDegree := 1\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.range ((P n).natDegree - 1)\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.range ((P n).natDegree - 1)\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type", "`grind` failed\ncase grind.1.1\nn : \u2115\nnpos : 1 \u2264 n\npl : NicePlotOfP n \u22ef\ni : \u2115\nhi : i \u2208 Finset.range ((P n).natDegree - 1)\nf_cont : Continuous fun x => eval x (P n - X)\naleb : pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\npa : \u00acEven i\nh : \u00ac{-1 * 2, 1 * 2} = {-2, 2}\nh_1 : -1 * \u2191(P n).natDegree + 1 \u2264 0\nh_2 : i = 0\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] 1 \u2264 n\n [prop] i \u2208 Finset.range ((P n).natDegree - 1)\n [prop] \u2191((P n).natDegree - 1) = if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0\n [prop] Continuous fun x => eval x (P n - X)\n [prop] pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] \u00acEven i\n [prop] \u00ac{-1 * 2, 1 * 2} = {-2, 2}\n [prop] -1 * \u2191(P n).natDegree + 1 \u2264 0\n [prop] i = 0\n [eqc] True propositions\n [prop] 1 \u2264 n\n [prop] i \u2208 Finset.range ((P n).natDegree - 1)\n [prop] Continuous fun x => eval x (P n - X)\n [prop] pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] i + 1 < pl.k\n [prop] i < pl.k\n [prop] (0 + 2).AtLeastTwo\n [prop] -1 * \u2191(P n).natDegree + 1 \u2264 0\n [prop] i = 0\n [eqc] False propositions\n [prop] Even i\n [prop] {-1 * 2, 1 * 2} = {-2, 2}\n [eqc] Equivalence classes\n [eqc] {\u2191i, \u21910}\n [eqc] {\u2191((P n).natDegree - 1),\n \u2191(P n).natDegree + -1,\n if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0}\n [eqc] {\u2191(i + 1), \u21911}\n [eqc] {i + 1, 1}\n [eqc] {i, 0}\n [cases] Case analyses\n [cases] [1/2]: if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0\n [cases] [1/2]: i = 0\n [ematch] E-matching patterns\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [cutsat] Assignment satisfying linear constraints\n [assign] n := 1\n [assign] i := 0\n [assign] pl.k := 5\n [assign] (P n).natDegree := 1\n [assign] 1 := 1\n [assign] 2 := 2\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.range ((P n).natDegree - 1)\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.range ((P n).natDegree - 1)\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type", "`grind` failed\ncase grind.1.1\nn : \u2115\nnpos : 1 \u2264 n\npl : NicePlotOfP n \u22ef\ni : \u2115\nhi : i \u2208 Finset.range ((P n).natDegree - 1)\nf_cont : Continuous fun x => eval x (P n - X)\naleb : pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\npa : \u00acEven i\nh : \u00acEven (i + 1)\nh_1 : -1 * \u2191(P n).natDegree + 1 \u2264 0\nh_2 : i = 0\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] 1 \u2264 n\n [prop] i \u2208 Finset.range ((P n).natDegree - 1)\n [prop] \u2191((P n).natDegree - 1) = if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0\n [prop] Continuous fun x => eval x (P n - X)\n [prop] pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] \u00acEven i\n [prop] \u00acEven (i + 1)\n [prop] -1 * \u2191(P n).natDegree + 1 \u2264 0\n [prop] i = 0\n [eqc] True propositions\n [prop] 1 \u2264 n\n [prop] i \u2208 Finset.range ((P n).natDegree - 1)\n [prop] Continuous fun x => eval x (P n - X)\n [prop] pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] i + 1 < pl.k\n [prop] i < pl.k\n [prop] -1 * \u2191(P n).natDegree + 1 \u2264 0\n [prop] i = 0\n [eqc] False propositions\n [prop] Even i\n [prop] Even (i + 1)\n [eqc] Equivalence classes\n [eqc] {\u2191i, \u21910}\n [eqc] {\u2191((P n).natDegree - 1),\n \u2191(P n).natDegree + -1,\n if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0}\n [eqc] {\u2191(i + 1), \u21911}\n [eqc] {i + 1, 1}\n [eqc] {i, 0}\n [cases] Case analyses\n [cases] [1/2]: if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0\n [cases] [1/2]: i = 0\n [ematch] E-matching patterns\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [cutsat] Assignment satisfying linear constraints\n [assign] n := 1\n [assign] i := 0\n [assign] pl.k := 4\n [assign] (P n).natDegree := 1\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.range ((P n).natDegree - 1)\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.range ((P n).natDegree - 1)\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type", "`grind` failed\ncase grind.1.1\nn : \u2115\nnpos : 1 \u2264 n\npl : NicePlotOfP n \u22ef\ni : \u2115\nhi : i \u2208 Finset.range ((P n).natDegree - 1)\nf_cont : Continuous fun x => eval x (P n - X)\naleb : pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\npa : \u00acEven i\nh : \u00acOdd i\nh_1 : -1 * \u2191(P n).natDegree + 1 \u2264 0\nh_2 : i = 0\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] 1 \u2264 n\n [prop] i \u2208 Finset.range ((P n).natDegree - 1)\n [prop] \u2191((P n).natDegree - 1) = if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0\n [prop] Continuous fun x => eval x (P n - X)\n [prop] pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] \u00acEven i\n [prop] \u00acOdd i\n [prop] -1 * \u2191(P n).natDegree + 1 \u2264 0\n [prop] i = 0\n [eqc] True propositions\n [prop] 1 \u2264 n\n [prop] i \u2208 Finset.range ((P n).natDegree - 1)\n [prop] Continuous fun x => eval x (P n - X)\n [prop] pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] i + 1 < pl.k\n [prop] i < pl.k\n [prop] -1 * \u2191(P n).natDegree + 1 \u2264 0\n [prop] i = 0\n [eqc] False propositions\n [prop] Even i\n [prop] Odd i\n [eqc] Equivalence classes\n [eqc] {\u2191i, \u21910}\n [eqc] {\u2191((P n).natDegree - 1),\n \u2191(P n).natDegree + -1,\n if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0}\n [eqc] {\u2191(i + 1), \u21911}\n [eqc] {i + 1, 1}\n [eqc] {i, 0}\n [cases] Case analyses\n [cases] [1/2]: if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0\n [cases] [1/2]: i = 0\n [ematch] E-matching patterns\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [cutsat] Assignment satisfying linear constraints\n [assign] n := 1\n [assign] i := 0\n [assign] pl.k := 4\n [assign] (P n).natDegree := 1\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.range ((P n).natDegree - 1)\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.range ((P n).natDegree - 1)\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type", "unknown constant 'Lean.Grind.toInt_fin'", "unknown constant 'Lean.Grind.toInt_fin'", "unknown constant 'Lean.Grind.toInt_fin'", "unknown constant 'Lean.Grind.toInt_fin'", "`grind` failed\ncase grind.1.1.1.1\nn : \u2115\nnpos : 1 \u2264 n\npl : NicePlotOfP n \u22ef\ni : \u2115\nhi : i \u2208 Finset.range ((P n).natDegree - 1)\nf_cont : Continuous fun x => eval x (P n - X)\naleb : pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\nh1 : {eval (pl.x \u27e8i, \u22ef\u27e9) (P n), eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n)} = {-2, 2}\nleft : -2 \u2264 pl.x \u27e8i, \u22ef\u27e9\nright : pl.x \u27e8i, \u22ef\u27e9 < 2\nthis_1 : 1 \u2264 i \u2192 -2 < pl.x \u27e8i, \u22ef\u27e9\nleft_1 : -2 < pl.x \u27e8i + 1, \u22ef\u27e9\nright_1 : pl.x \u27e8i + 1, \u22ef\u27e9 < 2\niz : \u00aci = 0\nh_1 : \u00ac0 < eval (pl.x \u27e8i, \u22ef\u27e9) (P n) - pl.x \u27e8i, \u22ef\u27e9\nh_2 : \u00aceval (pl.x \u27e8i, \u22ef\u27e9) (P n) - pl.x \u27e8i, \u22ef\u27e9 < 0\nleft_3 : eval (pl.x \u27e8i, \u22ef\u27e9) (P n) = -2\nright_3 : eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n) = 2\nh_4 : -1 * \u2191(P n).natDegree + 1 \u2264 0\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] 1 \u2264 n\n [prop] i \u2208 Finset.range ((P n).natDegree - 1)\n [prop] \u2191((P n).natDegree - 1) = if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0\n [prop] Continuous fun x => eval x (P n - X)\n [prop] pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] {eval (pl.x \u27e8i, \u22ef\u27e9) (P n), eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n)} = {-2, 2}\n [prop] -2 \u2264 pl.x \u27e8i, \u22ef\u27e9\n [prop] pl.x \u27e8i, \u22ef\u27e9 < 2\n [prop] 1 \u2264 i \u2192 -2 < pl.x \u27e8i, \u22ef\u27e9\n [prop] -2 < pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] pl.x \u27e8i + 1, \u22ef\u27e9 < 2\n [prop] \u00aci = 0\n [prop] eval (pl.x \u27e8i, \u22ef\u27e9) (P n) = -2 \u2227 eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n) = 2 \u2228\n eval (pl.x \u27e8i, \u22ef\u27e9) (P n) = 2 \u2227 eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n) = -2\n [prop] \u00aceval (pl.x \u27e8i, \u22ef\u27e9) (P n) - pl.x \u27e8i, \u22ef\u27e9 < 0 \u2228 \u00ac0 < eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n) - pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] \u00ac0 < eval (pl.x \u27e8i, \u22ef\u27e9) (P n) - pl.x \u27e8i, \u22ef\u27e9 \u2228 \u00aceval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n) - pl.x \u27e8i + 1, \u22ef\u27e9 < 0\n [prop] \u00ac0 < eval (pl.x \u27e8i, \u22ef\u27e9) (P n) - pl.x \u27e8i, \u22ef\u27e9\n [prop] \u00aceval (pl.x \u27e8i, \u22ef\u27e9) (P n) - pl.x \u27e8i, \u22ef\u27e9 < 0\n [prop] eval (pl.x \u27e8i, \u22ef\u27e9) (P n) = -2\n [prop] eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n) = 2\n [prop] -1 * \u2191(P n).natDegree + 1 \u2264 0\n [eqc] True propositions\n [prop] 1 \u2264 n\n [prop] i \u2208 Finset.range ((P n).natDegree - 1)\n [prop] Continuous fun x => eval x (P n - X)\n [prop] pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] i + 1 < pl.k\n [prop] i < pl.k\n [prop] (0 + 2).AtLeastTwo\n [prop] -2 \u2264 pl.x \u27e8i, \u22ef\u27e9\n [prop] pl.x \u27e8i, \u22ef\u27e9 < 2\n [prop] 1 \u2264 i \u2192 -2 < pl.x \u27e8i, \u22ef\u27e9\n [prop] -2 < pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] pl.x \u27e8i + 1, \u22ef\u27e9 < 2\n [prop] eval (pl.x \u27e8i, \u22ef\u27e9) (P n) = -2 \u2227 eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n) = 2 \u2228\n eval (pl.x \u27e8i, \u22ef\u27e9) (P n) = 2 \u2227 eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n) = -2\n [prop] \u00aceval (pl.x \u27e8i, \u22ef\u27e9) (P n) - pl.x \u27e8i, \u22ef\u27e9 < 0 \u2228 \u00ac0 < eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n) - pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] \u00ac0 < eval (pl.x \u27e8i, \u22ef\u27e9) (P n) - pl.x \u27e8i, \u22ef\u27e9 \u2228 \u00aceval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n) - pl.x \u27e8i + 1, \u22ef\u27e9 < 0\n [prop] 1 \u2264 i\n [prop] -2 < pl.x \u27e8i, \u22ef\u27e9\n [prop] \u00ac0 < eval (pl.x \u27e8i, \u22ef\u27e9) (P n) - pl.x \u27e8i, \u22ef\u27e9\n [prop] \u00aceval (pl.x \u27e8i, \u22ef\u27e9) (P n) - pl.x \u27e8i, \u22ef\u27e9 < 0\n [prop] eval (pl.x \u27e8i, \u22ef\u27e9) (P n) = -2\n [prop] eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n) = 2\n [prop] eval (pl.x \u27e8i, \u22ef\u27e9) (P n) = -2 \u2227 eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n) = 2\n [prop] -1 * \u2191(P n).natDegree + 1 \u2264 0\n [eqc] False propositions\n [prop] i = 0\n [prop] 0 < eval (pl.x \u27e8i, \u22ef\u27e9) (P n) - pl.x \u27e8i, \u22ef\u27e9\n [prop] eval (pl.x \u27e8i, \u22ef\u27e9) (P n) - pl.x \u27e8i, \u22ef\u27e9 < 0\n [eqc] Equivalence classes\n [eqc] {eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n) = -2, eval (pl.x \u27e8i, \u22ef\u27e9) (P n) = 2}\n [eqc] {{eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n)}, {2}}\n [eqc] {eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n), 2}\n [eqc] {eval (pl.x \u27e8i, \u22ef\u27e9) (P n), -2}\n [eqc] {{eval (pl.x \u27e8i, \u22ef\u27e9) (P n), eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n)}, {-2, 2}}\n [eqc] {\u2191((P n).natDegree - 1),\n \u2191(P n).natDegree + -1,\n if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0}\n [cases] Case analyses\n [cases] [1/2]: \u00ac0 < eval (pl.x \u27e8i, \u22ef\u27e9) (P n) - pl.x \u27e8i, \u22ef\u27e9 \u2228 \u00aceval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n) - pl.x \u27e8i + 1, \u22ef\u27e9 < 0\n [cases] [1/2]: \u00aceval (pl.x \u27e8i, \u22ef\u27e9) (P n) - pl.x \u27e8i, \u22ef\u27e9 < 0 \u2228 \u00ac0 < eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n) - pl.x \u27e8i + 1, \u22ef\u27e9\n [cases] [1/2]: eval (pl.x \u27e8i, \u22ef\u27e9) (P n) = -2 \u2227 eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n) = 2 \u2228\n eval (pl.x \u27e8i, \u22ef\u27e9) (P n) = 2 \u2227 eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n) = -2\n [cases] [1/2]: if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0\n [ematch] E-matching patterns\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [cutsat] Assignment satisfying linear constraints\n [assign] n := 1\n [assign] i := 1\n [assign] pl.k := 5\n [assign] (P n).natDegree := 1\n [assign] 0 := 0\n [assign] 2 := 2\n [ring] Ring `\u211d`\n [basis] Basis\n [_] eval (pl.x \u27e8i, \u22ef\u27e9) (P n) + 2 = 0\n [_] eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n) + -2 = 0\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.range ((P n).natDegree - 1)\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.range ((P n).natDegree - 1)\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type", "`grind` failed\ncase grind.1\nn : \u2115\nnpos : 1 \u2264 n\npl : NicePlotOfP n \u22ef\ni : \u2115\nhi : i \u2208 Finset.range ((P n).natDegree - 1)\nf_cont : Continuous fun x => eval x (P n - X)\naleb : pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\nh1 : {eval (pl.x \u27e8i, \u22ef\u27e9) (P n), eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n)} = {-2, 2}\nleft : -2 \u2264 pl.x \u27e8i, \u22ef\u27e9\nright : pl.x \u27e8i, \u22ef\u27e9 < 2\nthis_1 : 1 \u2264 i \u2192 -2 < pl.x \u27e8i, \u22ef\u27e9\nleft_1 : -2 < pl.x \u27e8i + 1, \u22ef\u27e9\nright_1 : pl.x \u27e8i + 1, \u22ef\u27e9 < 2\niz : \u00aci = 0\npa : Even i\nh : \u00acOdd (i + 1)\nh_1 : -1 * \u2191(P n).natDegree + 1 \u2264 0\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] 1 \u2264 n\n [prop] i \u2208 Finset.range ((P n).natDegree - 1)\n [prop] \u2191((P n).natDegree - 1) = if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0\n [prop] Continuous fun x => eval x (P n - X)\n [prop] pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] {eval (pl.x \u27e8i, \u22ef\u27e9) (P n), eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n)} = {-2, 2}\n [prop] -2 \u2264 pl.x \u27e8i, \u22ef\u27e9\n [prop] pl.x \u27e8i, \u22ef\u27e9 < 2\n [prop] 1 \u2264 i \u2192 -2 < pl.x \u27e8i, \u22ef\u27e9\n [prop] -2 < pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] pl.x \u27e8i + 1, \u22ef\u27e9 < 2\n [prop] \u00aci = 0\n [prop] Even i\n [prop] \u00acOdd (i + 1)\n [prop] -1 * \u2191(P n).natDegree + 1 \u2264 0\n [eqc] True propositions\n [prop] 1 \u2264 n\n [prop] i \u2208 Finset.range ((P n).natDegree - 1)\n [prop] Continuous fun x => eval x (P n - X)\n [prop] pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] i + 1 < pl.k\n [prop] i < pl.k\n [prop] (0 + 2).AtLeastTwo\n [prop] -2 \u2264 pl.x \u27e8i, \u22ef\u27e9\n [prop] pl.x \u27e8i, \u22ef\u27e9 < 2\n [prop] 1 \u2264 i \u2192 -2 < pl.x \u27e8i, \u22ef\u27e9\n [prop] -2 < pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] pl.x \u27e8i + 1, \u22ef\u27e9 < 2\n [prop] Even i\n [prop] 1 \u2264 i\n [prop] -2 < pl.x \u27e8i, \u22ef\u27e9\n [prop] -1 * \u2191(P n).natDegree + 1 \u2264 0\n [eqc] False propositions\n [prop] i = 0\n [prop] Odd (i + 1)\n [eqc] Equivalence classes\n [eqc] {{eval (pl.x \u27e8i, \u22ef\u27e9) (P n), eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n)}, {-2, 2}}\n [eqc] {\u2191((P n).natDegree - 1),\n \u2191(P n).natDegree + -1,\n if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0}\n [cases] Case analyses\n [cases] [1/2]: if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0\n [ematch] E-matching patterns\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [cutsat] Assignment satisfying linear constraints\n [assign] n := 1\n [assign] i := 1\n [assign] pl.k := 5\n [assign] (P n).natDegree := 1\n [assign] 2 := 2\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.range ((P n).natDegree - 1)\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.range ((P n).natDegree - 1)\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type", "`grind` failed\ncase grind.1\nn : \u2115\nnpos : 1 \u2264 n\npl : NicePlotOfP n \u22ef\ni : \u2115\nhi : i \u2208 Finset.range ((P n).natDegree - 1)\nf_cont : Continuous fun x => eval x (P n - X)\naleb : pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\nh1 : {eval (pl.x \u27e8i, \u22ef\u27e9) (P n), eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n)} = {-2, 2}\nleft : -2 \u2264 pl.x \u27e8i, \u22ef\u27e9\nright : pl.x \u27e8i, \u22ef\u27e9 < 2\nthis_1 : 1 \u2264 i \u2192 -2 < pl.x \u27e8i, \u22ef\u27e9\nleft_1 : -2 < pl.x \u27e8i + 1, \u22ef\u27e9\nright_1 : pl.x \u27e8i + 1, \u22ef\u27e9 < 2\niz : \u00aci = 0\npa : \u00acEven i\nh : \u00acEven (i + 1)\nh_1 : -1 * \u2191(P n).natDegree + 1 \u2264 0\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] 1 \u2264 n\n [prop] i \u2208 Finset.range ((P n).natDegree - 1)\n [prop] \u2191((P n).natDegree - 1) = if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0\n [prop] Continuous fun x => eval x (P n - X)\n [prop] pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] {eval (pl.x \u27e8i, \u22ef\u27e9) (P n), eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n)} = {-2, 2}\n [prop] -2 \u2264 pl.x \u27e8i, \u22ef\u27e9\n [prop] pl.x \u27e8i, \u22ef\u27e9 < 2\n [prop] 1 \u2264 i \u2192 -2 < pl.x \u27e8i, \u22ef\u27e9\n [prop] -2 < pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] pl.x \u27e8i + 1, \u22ef\u27e9 < 2\n [prop] \u00aci = 0\n [prop] \u00acEven i\n [prop] \u00acEven (i + 1)\n [prop] -1 * \u2191(P n).natDegree + 1 \u2264 0\n [eqc] True propositions\n [prop] 1 \u2264 n\n [prop] i \u2208 Finset.range ((P n).natDegree - 1)\n [prop] Continuous fun x => eval x (P n - X)\n [prop] pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] i + 1 < pl.k\n [prop] i < pl.k\n [prop] (0 + 2).AtLeastTwo\n [prop] -2 \u2264 pl.x \u27e8i, \u22ef\u27e9\n [prop] pl.x \u27e8i, \u22ef\u27e9 < 2\n [prop] 1 \u2264 i \u2192 -2 < pl.x \u27e8i, \u22ef\u27e9\n [prop] -2 < pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] pl.x \u27e8i + 1, \u22ef\u27e9 < 2\n [prop] 1 \u2264 i\n [prop] -2 < pl.x \u27e8i, \u22ef\u27e9\n [prop] -1 * \u2191(P n).natDegree + 1 \u2264 0\n [eqc] False propositions\n [prop] i = 0\n [prop] Even i\n [prop] Even (i + 1)\n [eqc] Equivalence classes\n [eqc] {{eval (pl.x \u27e8i, \u22ef\u27e9) (P n), eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n)}, {-2, 2}}\n [eqc] {\u2191((P n).natDegree - 1),\n \u2191(P n).natDegree + -1,\n if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0}\n [cases] Case analyses\n [cases] [1/2]: if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0\n [ematch] E-matching patterns\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [cutsat] Assignment satisfying linear constraints\n [assign] n := 1\n [assign] i := 1\n [assign] pl.k := 5\n [assign] (P n).natDegree := 1\n [assign] 2 := 2\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.range ((P n).natDegree - 1)\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.range ((P n).natDegree - 1)\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type", "`grind` failed\ncase grind.1\nn : \u2115\nnpos : 1 \u2264 n\npl : NicePlotOfP n \u22ef\ni : \u2115\nhi : i \u2208 Finset.range ((P n).natDegree - 1)\nf_cont : Continuous fun x => eval x (P n - X)\naleb : pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\nh1 : {eval (pl.x \u27e8i, \u22ef\u27e9) (P n), eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n)} = {-2, 2}\nleft : -2 \u2264 pl.x \u27e8i, \u22ef\u27e9\nright : pl.x \u27e8i, \u22ef\u27e9 < 2\nthis_1 : 1 \u2264 i \u2192 -2 < pl.x \u27e8i, \u22ef\u27e9\nleft_1 : -2 < pl.x \u27e8i + 1, \u22ef\u27e9\nright_1 : pl.x \u27e8i + 1, \u22ef\u27e9 < 2\niz : \u00aci = 0\npa : \u00acEven i\nh : \u00acOdd i\nh_1 : -1 * \u2191(P n).natDegree + 1 \u2264 0\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] 1 \u2264 n\n [prop] i \u2208 Finset.range ((P n).natDegree - 1)\n [prop] \u2191((P n).natDegree - 1) = if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0\n [prop] Continuous fun x => eval x (P n - X)\n [prop] pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] {eval (pl.x \u27e8i, \u22ef\u27e9) (P n), eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n)} = {-2, 2}\n [prop] -2 \u2264 pl.x \u27e8i, \u22ef\u27e9\n [prop] pl.x \u27e8i, \u22ef\u27e9 < 2\n [prop] 1 \u2264 i \u2192 -2 < pl.x \u27e8i, \u22ef\u27e9\n [prop] -2 < pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] pl.x \u27e8i + 1, \u22ef\u27e9 < 2\n [prop] \u00aci = 0\n [prop] \u00acEven i\n [prop] \u00acOdd i\n [prop] -1 * \u2191(P n).natDegree + 1 \u2264 0\n [eqc] True propositions\n [prop] 1 \u2264 n\n [prop] i \u2208 Finset.range ((P n).natDegree - 1)\n [prop] Continuous fun x => eval x (P n - X)\n [prop] pl.x \u27e8i, \u22ef\u27e9 \u2264 pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] i + 1 < pl.k\n [prop] i < pl.k\n [prop] (0 + 2).AtLeastTwo\n [prop] -2 \u2264 pl.x \u27e8i, \u22ef\u27e9\n [prop] pl.x \u27e8i, \u22ef\u27e9 < 2\n [prop] 1 \u2264 i \u2192 -2 < pl.x \u27e8i, \u22ef\u27e9\n [prop] -2 < pl.x \u27e8i + 1, \u22ef\u27e9\n [prop] pl.x \u27e8i + 1, \u22ef\u27e9 < 2\n [prop] 1 \u2264 i\n [prop] -2 < pl.x \u27e8i, \u22ef\u27e9\n [prop] -1 * \u2191(P n).natDegree + 1 \u2264 0\n [eqc] False propositions\n [prop] i = 0\n [prop] Even i\n [prop] Odd i\n [eqc] Equivalence classes\n [eqc] {{eval (pl.x \u27e8i, \u22ef\u27e9) (P n), eval (pl.x \u27e8i + 1, \u22ef\u27e9) (P n)}, {-2, 2}}\n [eqc] {\u2191((P n).natDegree - 1),\n \u2191(P n).natDegree + -1,\n if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0}\n [cases] Case analyses\n [cases] [1/2]: if -1 * \u2191(P n).natDegree + 1 \u2264 0 then \u2191(P n).natDegree + -1 else 0\n [ematch] E-matching patterns\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [cutsat] Assignment satisfying linear constraints\n [assign] n := 1\n [assign] i := 1\n [assign] pl.k := 5\n [assign] (P n).natDegree := 1\n [assign] 2 := 2\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.range ((P n).natDegree - 1)\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n Finset.range ((P n).natDegree - 1)\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type", "unsolved goals\ncase this\nn : \u2115\nnpos : 0 < n\npl : NicePlotOfP n npos\ni : \u2115\nhi : i \u2208 Finset.range ((P n).natDegree - 1)\ni' : Fin pl.k\ne : \u2191i' = i\n\u22a2 ?m.155945\n\nn : \u2115\nnpos : 0 < n\npl : NicePlotOfP n npos\ni : \u2115\nhi : i \u2208 Finset.range ((P n).natDegree - 1)\ni' : Fin pl.k\ne : \u2191i' = i\nthis : ?m.155945 := ?this\n\u22a2 pl.x i' < \u22ef.choose", "(kernel) declaration has metavariables 'Imo1976P2.P_intersect_X.spec_gt'", "unexpected token ':='; expected command", "unsolved goals\ncase this\nn : \u2115\nnpos : 0 < n\npl : NicePlotOfP n npos\ni : \u2115\nhi : i \u2208 Finset.range ((P n).natDegree - 1)\ni' : Fin pl.k\ne : \u2191i' = i + 1\n\u22a2 ?m.156313\n\nn : \u2115\nnpos : 0 < n\npl : NicePlotOfP n npos\ni : \u2115\nhi : i \u2208 Finset.range ((P n).natDegree - 1)\ni' : Fin pl.k\ne : \u2191i' = i + 1\nthis : ?m.156313 := ?this\n\u22a2 \u22ef.choose < pl.x i'", "(kernel) declaration has metavariables 'Imo1976P2.P_intersect_X.spec_lt'", "unexpected token ':='; expected command", "unsolved goals\ncase this\nn : \u2115\nnpos : 0 < n\npl : NicePlotOfP n npos\ni : \u2115\nhi : i \u2208 Finset.range ((P n).natDegree - 1)\n\u22a2 ?m.157468\n\nn : \u2115\nnpos : 0 < n\npl : NicePlotOfP n npos\ni : \u2115\nhi : i \u2208 Finset.range ((P n).natDegree - 1)\nthis : ?m.157468 := ?this\n\u22a2 (P n - X).IsRoot \u22ef.choose", "(kernel) declaration has metavariables 'Imo1976P2.P_intersect_X.spec_root'", "unexpected token ':='; expected command", "unknown tactic", "unsolved goals\ncase h.refine_1\nn : \u2115\nnpos : 0 < n\npl : NicePlotOfP n npos := makePlot n npos\nthis : 2 \u2264 (P n).natDegree\n\u22a2 1 + ((P n).natDegree - 1) = (P n).natDegree", "unsolved goals\ncase h.refine_1\nn : \u2115\nnpos : 0 < n\npl : NicePlotOfP n npos := \u22ef\nthis : 2 \u2264 (P n).natDegree\n\u22a2 X.natDegree < (P n).natDegree\n\ncase h.refine_1\nn : \u2115\nnpos : 0 < n\npl : NicePlotOfP n npos := \u22ef\nthis : 2 \u2264 (P n).natDegree\n\u22a2 Set.InjOn (fun i => \u22ef.choose) \u2191(Finset.range ((P n).natDegree - 1)).attach\n\ncase h.refine_1\nn : \u2115\nnpos : 0 < n\npl : NicePlotOfP n npos := \u22ef\nthis : 2 \u2264 (P n).natDegree\n\u22a2 Disjoint {2} (Finset.image (fun i => \u22ef.choose) (Finset.range ((P n).natDegree - 1)).attach)", "unsolved goals\ncase h.refine_2\nn : \u2115\nnpos : 0 < n\npl : NicePlotOfP n npos := makePlot n npos\n\u22a2 \u2200 r \u2208 {2} \u222a Finset.image (fun i => \u22ef.choose) (Finset.range ((P n).natDegree - 1)).attach, (P n - X).IsRoot r"], "timeout_s": 600.0, "latency_s": 5.0178, "verified_at": "2026-03-26T18:16:36.675323+00:00"}} | false | true | false | 5.0178 |
compfiles_Imo1976P4 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Benpigchu
-/
import Mathlib
/-!
# International Mathematical Olympiad 1976, Problem 4
Determine, with proof, the largest number which is the product
of positive integers whose sum is 1976.
-/
namespace Imo1976P4
def IsMaxProd (n₀ : ℕ) :=
fun m ↦ IsGreatest
{ n | ∃ s : Multiset ℕ, s.sum = n₀ ∧ s.prod = n }
m
def IsMaxProdSet (s : Multiset ℕ) :=
IsMaxProd (s.sum) (s.prod)
def result : ℕ → ℕ
| 0 => 1
| 1 => 1
| 2 => 2
| 3 => 3
| 4 => 4
| n + 3 => 3 * (result n)
lemma prod_le_sum_pow_sum (s : Multiset ℕ) : s.prod ≤ s.sum ^ s.sum := by
induction' s using Multiset.induction with i s' hs'
· simp
· rw [Multiset.sum_cons, Multiset.prod_cons]
by_cases hi : i = 0
· rw [hi, zero_mul]
apply Nat.zero_le
· push_neg at hi
rw [← Nat.one_le_iff_ne_zero] at hi
calc i * s'.prod
≤ i * s'.sum ^ s'.sum := mul_le_mul_right hs' i
_ ≤ (i + s'.sum) * s'.sum ^ s'.sum := mul_le_mul_left (Nat.le_add_right _ _) _
_ ≤ (i + s'.sum) * (i + s'.sum) ^ s'.sum :=
mul_le_mul_right (pow_le_pow_left' (Nat.le_add_left _ _) _) _
_ = (i + s'.sum) ^ (s'.sum + 1) := by exact Nat.pow_add_one'.symm
_ ≤ (i + s'.sum) ^ (i + s'.sum) := by
apply pow_le_pow_right'
· exact Nat.le_add_right_of_le hi
· rw [add_comm]
exact Nat.add_le_add_right hi s'.sum
lemma exists_mem_of_sum_lt_zero (s : Multiset ℕ) (hs: 0 < s.sum) :
∃ x: ℕ, x ∈ s := by
have hs' : s ≠ 0 := by
contrapose! hs
rw [hs, Multiset.sum_zero]
exact Multiset.exists_mem_of_ne_zero hs'
lemma prod_with_given_sum_bddAbove (n₀ : ℕ) :
BddAbove {n | ∃ s : Multiset ℕ, s.sum = n₀ ∧ s.prod = n} := by
use n₀ ^ n₀
intro m hm
rcases hm with ⟨s, ⟨hs_sum, hs_prod⟩⟩
rw [← hs_sum, ← hs_prod]
exact prod_le_sum_pow_sum s
lemma exists_max_prod (n : ℕ) :
∃ m : ℕ, IsMaxProd n m := by
apply BddAbove.exists_isGreatest_of_nonempty
· exact prod_with_given_sum_bddAbove n
· use n
use {n}
constructor
· rw [Multiset.sum_singleton]
· rw [Multiset.prod_singleton]
lemma exists_max_prod_set {n m : ℕ} (hnm: IsMaxProd n m):
∃ s : Multiset ℕ, s.sum = n ∧ IsMaxProdSet s := by
rcases hnm.left with ⟨s, ⟨hs_sum, hs_prod⟩⟩
use s
constructor
· exact hs_sum
· rw [IsMaxProdSet, hs_prod, hs_sum]
exact hnm
lemma prod_le_max_prod {n m : ℕ} (hnm: IsMaxProd n m)
{s : Multiset ℕ} (hs : s.sum = n) : s.prod ≤ m := by
have h := hnm.right
simp [upperBounds] at h
exact h s hs
lemma not_max_prod_set_of_prod_lt_prod {s t: Multiset ℕ}
(hst' : s.sum = t.sum) (hst : s.prod < t.prod) : ¬IsMaxProdSet s := by
contrapose! hst
have h' := hst.right
simp [upperBounds] at h'
exact h' t hst'.symm
lemma exists_cons_le_of_le_of_sum_lt_sum {s t : Multiset ℕ}
(hst' : s ≤ t) (hst : s.sum < t.sum) : ∃ n : ℕ, s.cons n ≤ t := by
have ht_sub_s : t - s ≠ 0 := by
contrapose! hst
apply le_of_eq
calc t.sum
= (t - s + s).sum := by rw [Multiset.sub_add_cancel hst']
_ = (t - s).sum + s.sum := by rw [Multiset.sum_add]
_ = 0 + s.sum := by rw [hst, Multiset.sum_zero]
_ = s.sum := by rw [zero_add]
rcases Multiset.exists_mem_of_ne_zero ht_sub_s with ⟨m, hm⟩
use m
rw [← Multiset.singleton_add, ← Multiset.sub_add_cancel hst']
rw [Multiset.add_le_add_iff_right, Multiset.singleton_le]
exact hm
lemma exists_le_of_mem_of_lt_sum {n : ℕ} {s : Multiset ℕ}
(hns' : n ∈ s) (hns : n < s.sum) : ∃ m : ℕ, {n, m} ≤ s := by
rcases Multiset.exists_cons_of_mem hns' with ⟨t, ht⟩
have ht' : t ≠ 0 := by
contrapose! hns
rw [ht, hns, Multiset.sum_cons, Multiset.sum_zero, add_zero]
rcases Multiset.exists_mem_of_ne_zero ht' with ⟨m, hm⟩
use m
rw [ht, Multiset.insert_eq_cons]
exact Multiset.cons_le_cons n (Multiset.singleton_le.mpr hm)
lemma zero_not_in_max_prod_set {s : Multiset ℕ}
(hs: IsMaxProdSet s) : 0 ∉ s := by
contrapose! hs
have ha : s.sum = (Multiset.replicate s.sum 1).sum := by
rw [Multiset.sum_replicate, Nat.nsmul_eq_mul, mul_one (M := ℕ)]
apply not_max_prod_set_of_prod_lt_prod ha
rw [Multiset.prod_replicate, one_pow (M := ℕ), Multiset.prod_eq_zero hs]
norm_num
lemma max_prod_set_of_subset_of_max_prod_set {s t : Multiset ℕ}
(hst : s ≤ t) (ht: IsMaxProdSet t) : IsMaxProdSet s := by
constructor
· use s
· intro n hn
rcases hn with ⟨s', ⟨hs'_sum, hs'_prod⟩⟩
have ht_sub_s : (t - s).prod > 0 := by
apply Nat.zero_lt_of_ne_zero
apply Multiset.prod_ne_zero
intro h'
apply zero_not_in_max_prod_set ht
rw [Multiset.mem_sub] at h'
rw [← Multiset.count_pos]
exact Nat.zero_lt_of_lt h'
apply Nat.le_of_mul_le_mul_left _ ht_sub_s
rw [← hs'_prod, ← Multiset.prod_add, ← Multiset.prod_add]
rw [Multiset.sub_add_cancel hst]
have h' := ht.right
simp [upperBounds] at h'
apply h' (t - s + s')
calc (t - s + s').sum
= (t - s).sum + s'.sum := by rw [Multiset.sum_add]
_ = (t - s).sum + s.sum := by rw [hs'_sum]
_ = (t - s + s).sum := by rw [Multiset.sum_add]
_ = t.sum := by rw [Multiset.sub_add_cancel hst]
lemma one_not_in_max_prod_set_of_one_lt_sum {s : Multiset ℕ}
(hs' : 1 < s.sum) (hs: IsMaxProdSet s) : 1 ∉ s := by
intro h1s
rcases exists_le_of_mem_of_lt_sum h1s hs' with ⟨n, hn⟩
have h1n := max_prod_set_of_subset_of_max_prod_set hn hs
contrapose! h1n
have h1n' : ({1, n} : Multiset ℕ).sum = ({1 + n} : Multiset ℕ).sum := by
rw [Multiset.sum_singleton, Multiset.insert_eq_cons, Multiset.sum_cons, Multiset.sum_singleton]
apply not_max_prod_set_of_prod_lt_prod h1n'
rw [Multiset.prod_singleton, Multiset.insert_eq_cons, Multiset.prod_cons, Multiset.prod_singleton]
omega
lemma not_in_max_prod_set_of_five_le {s : Multiset ℕ} {n : ℕ}
(hn : 4 < n) (hs: IsMaxProdSet s) : n ∉ s := by
intro hn'
have hn'' := max_prod_set_of_subset_of_max_prod_set (Multiset.singleton_le.mpr hn') hs
contrapose! hn''
have hn_sub_2 : ({n} : Multiset ℕ).sum = ({n - 2, 2} : Multiset ℕ).sum := by
rw [Multiset.sum_singleton, Multiset.insert_eq_cons, Multiset.sum_cons, Multiset.sum_singleton]
symm
apply Nat.sub_add_cancel
omega
apply not_max_prod_set_of_prod_lt_prod hn_sub_2
rw [Multiset.prod_singleton, Multiset.insert_eq_cons, Multiset.prod_cons, Multiset.prod_singleton]
omega
lemma lt_and_gt_of_in_max_prod_set_of_four_lt_sum {s : Multiset ℕ} {n : ℕ}
(hn : n ∈ s) (hs' : 4 < s.sum) (hs: IsMaxProdSet s) : 1 < n ∧ n < 5 := by
have hn_ne_0 : n ≠ 0 := by
contrapose! hn
rw [hn]
exact zero_not_in_max_prod_set hs
have hn_ne_1 : n ≠ 1 := by
contrapose! hn
rw [hn]
apply one_not_in_max_prod_set_of_one_lt_sum _ hs
omega
have hn_le_4 : n ≤ 4 := by
contrapose! hn
exact not_in_max_prod_set_of_five_le hn hs
omega
lemma three_in_max_prod_set_of_four_lt_sum {s : Multiset ℕ}
(hs' : 4 < s.sum) (hs: IsMaxProdSet s) : 3 ∈ s := by
rw [← Multiset.count_ne_zero, Nat.ne_zero_iff_zero_lt]
have h₁ : s.toFinset ⊆ {2, 3, 4} := by
intro x hx
rw [Multiset.mem_toFinset] at hx
have hx' := lt_and_gt_of_in_max_prod_set_of_four_lt_sum hx hs' hs
have hx'l := hx'.left
have hx'r := hx'.right
interval_cases x <;> simp
simp [Finset.sum_multiset_count_of_subset _ _ h₁] at hs'
have h₂ : Multiset.count 2 s < 3 := by
by_contra! h2
have h222 : ({2, 2, 2} : Multiset ℕ) ≤ s := by
rw [Multiset.le_iff_count]
intro n
by_cases hn2 : n = 2
· simp [hn2]
exact h2
· have hn' : n ∉ ({2, 2, 2} : Multiset ℕ) := by
simp [← Multiset.mem_toFinset]
exact hn2
rw [Multiset.count_eq_zero_of_notMem hn']
apply Nat.zero_le
have h222' := max_prod_set_of_subset_of_max_prod_set h222 hs
contrapose! h222'
have h : ({2, 2, 2} : Multiset ℕ).sum = ({3, 3} : Multiset ℕ).sum := by
simp [Multiset.sum_singleton, Multiset.insert_eq_cons, Multiset.sum_cons]
apply not_max_prod_set_of_prod_lt_prod h
simp [Multiset.prod_singleton, Multiset.insert_eq_cons, Multiset.prod_cons]
have h₃ : Multiset.count 4 s < 2 := by
by_contra! h4
have h44 : ({4, 4} : Multiset ℕ) ≤ s := by
rw [Multiset.le_iff_count]
intro n
by_cases hn4 : n = 4
· simp [hn4]
exact h4
· have hn' : n ∉ ({4, 4} : Multiset ℕ) := by
simp [← Multiset.mem_toFinset]
exact hn4
rw [Multiset.count_eq_zero_of_notMem hn']
apply Nat.zero_le
have h44' := max_prod_set_of_subset_of_max_prod_set h44 hs
contrapose! h44'
have h : ({4, 4} : Multiset ℕ).sum = ({3, 3, 2} : Multiset ℕ).sum := by
simp [Multiset.sum_singleton, Multiset.insert_eq_cons, Multiset.sum_cons]
apply not_max_prod_set_of_prod_lt_prod h
simp [Multiset.prod_singleton, Multiset.insert_eq_cons, Multiset.prod_cons]
have h₄ : Multiset.count 4 s < 1 ∨ Multiset.count 2 s < 1 := by
by_contra! h'
have h24 : ({2, 4} : Multiset ℕ) ≤ s := by
rw [Multiset.le_iff_count]
intro n
by_cases hn4 : n = 4
· simp [hn4]
exact h'.left
· by_cases hn2 : n = 2
· simp [hn2]
exact h'.right
· have hn' : n ∉ ({2, 4} : Multiset ℕ) := by
simp [← Multiset.mem_toFinset]
exact ⟨hn2, hn4⟩
rw [Multiset.count_eq_zero_of_notMem hn']
apply Nat.zero_le
have h24' := max_prod_set_of_subset_of_max_prod_set h24 hs
contrapose! h24'
have h : ({2, 4} : Multiset ℕ).sum = ({3, 3} : Multiset ℕ).sum := by
simp [Multiset.sum_singleton, Multiset.insert_eq_cons, Multiset.sum_cons]
apply not_max_prod_set_of_prod_lt_prod h
simp [Multiset.prod_singleton, Multiset.insert_eq_cons, Multiset.prod_cons]
omega
lemma max_prod_zero : IsMaxProd 0 1 := by
constructor
· use 0
constructor <;> rfl
· intro n hn
rcases hn with ⟨s, ⟨s_sum, s_prod⟩⟩
by_cases hs : s = 0
· rw [← s_prod, hs, Multiset.prod_zero]
· rcases Multiset.exists_mem_of_ne_zero hs with ⟨m, hm⟩
have hm' := Multiset.le_sum_of_mem hm
rw [s_sum] at hm'
rw [Nat.eq_zero_of_le_zero hm'] at hm
rw [← s_prod, Multiset.prod_eq_zero hm]
omega
lemma max_prod_one : IsMaxProd 1 1 := by
constructor
· use {1}
constructor <;> rfl
· intro n hn
rcases hn with ⟨s, ⟨s_sum, s_prod⟩⟩
rcases exists_mem_of_sum_lt_zero s (by omega:_) with ⟨m, hm⟩
have hm' : m ≤ 1 := by
rw [← s_sum]
exact Multiset.le_sum_of_mem hm
rcases Multiset.exists_cons_of_mem hm with ⟨t, ht⟩
have ht' : t.sum = 1 - m := by
rw [← s_sum, ht, Multiset.sum_cons, add_comm, Nat.add_sub_cancel_right]
rw [← s_prod, ht, Multiset.prod_cons]
interval_cases m
· rw [zero_mul]
norm_num
· have h := prod_le_max_prod max_prod_zero ht'
omega
lemma max_prod_two : IsMaxProd 2 2 := by
constructor
· use {2}
constructor <;> rfl
· intro n hn
rcases hn with ⟨s, ⟨s_sum, s_prod⟩⟩
rcases exists_mem_of_sum_lt_zero s (by omega:_) with ⟨m, hm⟩
have hm' : m ≤ 2 := by
rw [← s_sum]
exact Multiset.le_sum_of_mem hm
rcases Multiset.exists_cons_of_mem hm with ⟨t, ht⟩
have ht' : t.sum = 2 - m := by
rw [← s_sum, ht, Multiset.sum_cons, add_comm, Nat.add_sub_cancel_right]
rw [← s_prod, ht, Multiset.prod_cons]
interval_cases m
· rw [zero_mul]
norm_num
· have h := prod_le_max_prod max_prod_one ht'
omega
· have h := prod_le_max_prod max_prod_zero ht'
omega
lemma max_prod_three : IsMaxProd 3 3 := by
constructor
· use {3}
constructor <;> rfl
· intro n hn
rcases hn with ⟨s, ⟨s_sum, s_prod⟩⟩
rcases exists_mem_of_sum_lt_zero s (by omega:_) with ⟨m, hm⟩
have hm' : m ≤ 3 := by
rw [← s_sum]
exact Multiset.le_sum_of_mem hm
rcases Multiset.exists_cons_of_mem hm with ⟨t, ht⟩
have ht' : t.sum = 3 - m := by
rw [← s_sum, ht, Multiset.sum_cons, add_comm, Nat.add_sub_cancel_right]
rw [← s_prod, ht, Multiset.prod_cons]
interval_cases m
· rw [zero_mul]
norm_num
· have h := prod_le_max_prod max_prod_two ht'
omega
· have h := prod_le_max_prod max_prod_one ht'
omega
· have h := prod_le_max_prod max_prod_zero ht'
omega
lemma max_prod_four : IsMaxProd 4 4 := by
constructor
· use {4}
constructor <;> rfl
· intro n hn
rcases hn with ⟨s, ⟨s_sum, s_prod⟩⟩
rcases exists_mem_of_sum_lt_zero s (by omega:_) with ⟨m, hm⟩
have hm' : m ≤ 4 := by
rw [← s_sum]
exact Multiset.le_sum_of_mem hm
rcases Multiset.exists_cons_of_mem hm with ⟨t, ht⟩
have ht' : t.sum = 4 - m := by
rw [← s_sum, ht, Multiset.sum_cons, add_comm, Nat.add_sub_cancel_right]
rw [← s_prod, ht, Multiset.prod_cons]
interval_cases m
· rw [zero_mul]
norm_num
· have h := prod_le_max_prod max_prod_three ht'
omega
· have h := prod_le_max_prod max_prod_two ht'
omega
· have h := prod_le_max_prod max_prod_one ht'
omega
· have h := prod_le_max_prod max_prod_zero ht'
omega
theorem generalized (n : ℕ) :
IsMaxProd n (result n) := by
fun_induction result with
| case1 => exact max_prod_zero
| case2 => exact max_prod_one
| case3 => exact max_prod_two
| case4 => exact max_prod_three
| case5 => exact max_prod_four
| case6 n n_ne_zero n_ne_one ih =>
rw [imp_false, ← ne_eq] at *
rcases exists_max_prod (n + 3) with ⟨m, hm⟩
rcases exists_max_prod_set hm with ⟨s, ⟨hs_sum, hs⟩⟩
have hs_sum' : 4 < s.sum := by
rw [hs_sum]
omega
have hs3 := three_in_max_prod_set_of_four_lt_sum hs_sum' hs
have hs3' := Multiset.singleton_le.mpr hs3
have hs_without_3 : s - {3} ≤ s := Multiset.sub_le_self _ _
have hs_without_3' := max_prod_set_of_subset_of_max_prod_set hs_without_3 hs
have hs_without_3_sum : (s - {3}).sum = n := by
calc (s - {3}).sum
= (s - {3}).sum + ({3} : Multiset _).sum - ({3} : Multiset _).sum := by rfl
_ = (s - {3} + {3}).sum - ({3} : Multiset _).sum := by rw [Multiset.sum_add]
_ = s.sum - ({3} : Multiset _).sum := by rw [Multiset.sub_add_cancel hs3']
_ = n + 3 - 3 := by rw [hs_sum, Multiset.sum_singleton]
_ = n := by rfl
rw [IsMaxProdSet, hs_without_3_sum] at hs_without_3'
have hs_without_3_prod := IsGreatest.unique hs_without_3' ih
have hs_prod : s.prod = (3 * result n) := by
calc s.prod
= (s - {3} + {3}).prod := by rw [Multiset.sub_add_cancel hs3']
_ = (s - {3}).prod * ({3} : Multiset _).prod := by rw [Multiset.prod_add]
_ = result n * 3 := by rw [hs_without_3_prod, Multiset.prod_singleton]
_ = 3 * result n := by apply mul_comm
rw [IsMaxProdSet, hs_prod, hs_sum] at hs
exact hs
abbrev solution : ℕ := result 1976
theorem imo1976_p4 :
IsGreatest
{ n | ∃ s : Multiset ℕ, s.sum = 1976 ∧ s.prod = n }
solution := by
exact generalized 1976
end Imo1976P4 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Benpigchu
-/
import Mathlib
/-!
# International Mathematical Olympiad 1976, Problem 4
Determine, with proof, the largest number which is the product
of positive integers whose sum is 1976.
-/
namespace Imo1976P4
def IsMaxProd (n₀ : ℕ) :=
fun m ↦ IsGreatest
{ n | ∃ s : Multiset ℕ, s.sum = n₀ ∧ s.prod = n }
m
def IsMaxProdSet (s : Multiset ℕ) :=
IsMaxProd (s.sum) (s.prod)
def result : ℕ → ℕ
| 0 => 1
| 1 => 1
| 2 => 2
| 3 => 3
| 4 => 4
| n + 3 => 3 * (result n)
lemma prod_le_sum_pow_sum (s : Multiset ℕ) : s.prod ≤ s.sum ^ s.sum := by
induction' s using Multiset.induction with i s' hs'
· simp
· rw [Multiset.sum_cons, Multiset.prod_cons]
by_cases hi : i = 0
· rw [hi, zero_mul]
apply Nat.zero_le
· push_neg at hi
rw [← Nat.one_le_iff_ne_zero] at hi
calc i * s'.prod
≤ i * s'.sum ^ s'.sum := mul_le_mul_right hs' i
_ ≤ (i + s'.sum) * s'.sum ^ s'.sum := mul_le_mul_left (Nat.le_add_right _ _) _
_ ≤ (i + s'.sum) * (i + s'.sum) ^ s'.sum :=
mul_le_mul_right (pow_le_pow_left' (Nat.le_add_left _ _) _) _
_ = (i + s'.sum) ^ (s'.sum + 1) := by exact Nat.pow_add_one'.symm
_ ≤ (i + s'.sum) ^ (i + s'.sum) := by
apply pow_le_pow_right'
· exact Nat.le_add_right_of_le hi
· rw [add_comm]
exact Nat.add_le_add_right hi s'.sum
lemma exists_mem_of_sum_lt_zero (s : Multiset ℕ) (hs: 0 < s.sum) :
∃ x: ℕ, x ∈ s := by
have hs' : s ≠ 0 := by
contrapose! hs
rw [hs, Multiset.sum_zero]
exact Multiset.exists_mem_of_ne_zero hs'
lemma prod_with_given_sum_bddAbove (n₀ : ℕ) :
BddAbove {n | ∃ s : Multiset ℕ, s.sum = n₀ ∧ s.prod = n} := by
use n₀ ^ n₀
intro m hm
rcases hm with ⟨s, ⟨hs_sum, hs_prod⟩⟩
rw [← hs_sum, ← hs_prod]
exact prod_le_sum_pow_sum s
lemma exists_max_prod (n : ℕ) :
∃ m : ℕ, IsMaxProd n m := by
apply BddAbove.exists_isGreatest_of_nonempty
· exact prod_with_given_sum_bddAbove n
· use n
use {n}
constructor
· rw [Multiset.sum_singleton]
· rw [Multiset.prod_singleton]
lemma exists_max_prod_set {n m : ℕ} (hnm: IsMaxProd n m):
∃ s : Multiset ℕ, s.sum = n ∧ IsMaxProdSet s := by
rcases hnm.left with ⟨s, ⟨hs_sum, hs_prod⟩⟩
use s
constructor
· exact hs_sum
· rw [IsMaxProdSet, hs_prod, hs_sum]
exact hnm
lemma prod_le_max_prod {n m : ℕ} (hnm: IsMaxProd n m)
{s : Multiset ℕ} (hs : s.sum = n) : s.prod ≤ m := by
have h := hnm.right
simp [upperBounds] at h
exact h s hs
lemma not_max_prod_set_of_prod_lt_prod {s t: Multiset ℕ}
(hst' : s.sum = t.sum) (hst : s.prod < t.prod) : ¬IsMaxProdSet s := by
contrapose! hst
have h' := hst.right
simp [upperBounds] at h'
exact h' t hst'.symm
lemma exists_cons_le_of_le_of_sum_lt_sum {s t : Multiset ℕ}
(hst' : s ≤ t) (hst : s.sum < t.sum) : ∃ n : ℕ, s.cons n ≤ t := by
have ht_sub_s : t - s ≠ 0 := by
contrapose! hst
apply le_of_eq
calc t.sum
= (t - s + s).sum := by rw [Multiset.sub_add_cancel hst']
_ = (t - s).sum + s.sum := by rw [Multiset.sum_add]
_ = 0 + s.sum := by rw [hst, Multiset.sum_zero]
_ = s.sum := by rw [zero_add]
rcases Multiset.exists_mem_of_ne_zero ht_sub_s with ⟨m, hm⟩
use m
rw [← Multiset.singleton_add, ← Multiset.sub_add_cancel hst']
rw [Multiset.add_le_add_iff_right, Multiset.singleton_le]
exact hm
lemma exists_le_of_mem_of_lt_sum {n : ℕ} {s : Multiset ℕ}
(hns' : n ∈ s) (hns : n < s.sum) : ∃ m : ℕ, {n, m} ≤ s := by
rcases Multiset.exists_cons_of_mem hns' with ⟨t, ht⟩
have ht' : t ≠ 0 := by
contrapose! hns
rw [ht, hns, Multiset.sum_cons, Multiset.sum_zero, add_zero]
rcases Multiset.exists_mem_of_ne_zero ht' with ⟨m, hm⟩
use m
rw [ht, Multiset.insert_eq_cons]
exact Multiset.cons_le_cons n (Multiset.singleton_le.mpr hm)
lemma zero_not_in_max_prod_set {s : Multiset ℕ}
(hs: IsMaxProdSet s) : 0 ∉ s := by
contrapose! hs
have ha : s.sum = (Multiset.replicate s.sum 1).sum := by
rw [Multiset.sum_replicate, Nat.nsmul_eq_mul, mul_one (M := ℕ)]
apply not_max_prod_set_of_prod_lt_prod ha
rw [Multiset.prod_replicate, one_pow (M := ℕ), Multiset.prod_eq_zero hs]
norm_num
lemma max_prod_set_of_subset_of_max_prod_set {s t : Multiset ℕ}
(hst : s ≤ t) (ht: IsMaxProdSet t) : IsMaxProdSet s := by
constructor
· use s
· intro n hn
rcases hn with ⟨s', ⟨hs'_sum, hs'_prod⟩⟩
have ht_sub_s : (t - s).prod > 0 := by
apply Nat.zero_lt_of_ne_zero
apply Multiset.prod_ne_zero
intro h'
apply zero_not_in_max_prod_set ht
rw [Multiset.mem_sub] at h'
rw [← Multiset.count_pos]
exact Nat.zero_lt_of_lt h'
apply Nat.le_of_mul_le_mul_left _ ht_sub_s
rw [← hs'_prod, ← Multiset.prod_add, ← Multiset.prod_add]
rw [Multiset.sub_add_cancel hst]
have h' := ht.right
simp [upperBounds] at h'
apply h' (t - s + s')
calc (t - s + s').sum
= (t - s).sum + s'.sum := by rw [Multiset.sum_add]
_ = (t - s).sum + s.sum := by rw [hs'_sum]
_ = (t - s + s).sum := by rw [Multiset.sum_add]
_ = t.sum := by rw [Multiset.sub_add_cancel hst]
lemma one_not_in_max_prod_set_of_one_lt_sum {s : Multiset ℕ}
(hs' : 1 < s.sum) (hs: IsMaxProdSet s) : 1 ∉ s := by
intro h1s
rcases exists_le_of_mem_of_lt_sum h1s hs' with ⟨n, hn⟩
have h1n := max_prod_set_of_subset_of_max_prod_set hn hs
contrapose! h1n
have h1n' : ({1, n} : Multiset ℕ).sum = ({1 + n} : Multiset ℕ).sum := by
rw [Multiset.sum_singleton, Multiset.insert_eq_cons, Multiset.sum_cons, Multiset.sum_singleton]
apply not_max_prod_set_of_prod_lt_prod h1n'
rw [Multiset.prod_singleton, Multiset.insert_eq_cons, Multiset.prod_cons, Multiset.prod_singleton]
omega
lemma not_in_max_prod_set_of_five_le {s : Multiset ℕ} {n : ℕ}
(hn : 4 < n) (hs: IsMaxProdSet s) : n ∉ s := by
intro hn'
have hn'' := max_prod_set_of_subset_of_max_prod_set (Multiset.singleton_le.mpr hn') hs
contrapose! hn''
have hn_sub_2 : ({n} : Multiset ℕ).sum = ({n - 2, 2} : Multiset ℕ).sum := by
rw [Multiset.sum_singleton, Multiset.insert_eq_cons, Multiset.sum_cons, Multiset.sum_singleton]
symm
apply Nat.sub_add_cancel
omega
apply not_max_prod_set_of_prod_lt_prod hn_sub_2
rw [Multiset.prod_singleton, Multiset.insert_eq_cons, Multiset.prod_cons, Multiset.prod_singleton]
omega
lemma lt_and_gt_of_in_max_prod_set_of_four_lt_sum {s : Multiset ℕ} {n : ℕ}
(hn : n ∈ s) (hs' : 4 < s.sum) (hs: IsMaxProdSet s) : 1 < n ∧ n < 5 := by
have hn_ne_0 : n ≠ 0 := by
contrapose! hn
rw [hn]
exact zero_not_in_max_prod_set hs
have hn_ne_1 : n ≠ 1 := by
contrapose! hn
rw [hn]
apply one_not_in_max_prod_set_of_one_lt_sum _ hs
omega
have hn_le_4 : n ≤ 4 := by
contrapose! hn
exact not_in_max_prod_set_of_five_le hn hs
omega
lemma three_in_max_prod_set_of_four_lt_sum {s : Multiset ℕ}
(hs' : 4 < s.sum) (hs: IsMaxProdSet s) : 3 ∈ s := by
rw [← Multiset.count_ne_zero, Nat.ne_zero_iff_zero_lt]
have h₁ : s.toFinset ⊆ {2, 3, 4} := by
intro x hx
rw [Multiset.mem_toFinset] at hx
have hx' := lt_and_gt_of_in_max_prod_set_of_four_lt_sum hx hs' hs
have hx'l := hx'.left
have hx'r := hx'.right
interval_cases x <;> simp
simp [Finset.sum_multiset_count_of_subset _ _ h₁] at hs'
have h₂ : Multiset.count 2 s < 3 := by
by_contra! h2
have h222 : ({2, 2, 2} : Multiset ℕ) ≤ s := by
rw [Multiset.le_iff_count]
intro n
by_cases hn2 : n = 2
· simp [hn2]
exact h2
· have hn' : n ∉ ({2, 2, 2} : Multiset ℕ) := by
simp [← Multiset.mem_toFinset]
exact hn2
rw [Multiset.count_eq_zero_of_notMem hn']
apply Nat.zero_le
have h222' := max_prod_set_of_subset_of_max_prod_set h222 hs
contrapose! h222'
have h : ({2, 2, 2} : Multiset ℕ).sum = ({3, 3} : Multiset ℕ).sum := by
simp [Multiset.sum_singleton, Multiset.insert_eq_cons, Multiset.sum_cons]
apply not_max_prod_set_of_prod_lt_prod h
simp [Multiset.prod_singleton, Multiset.insert_eq_cons, Multiset.prod_cons]
have h₃ : Multiset.count 4 s < 2 := by
by_contra! h4
have h44 : ({4, 4} : Multiset ℕ) ≤ s := by
rw [Multiset.le_iff_count]
intro n
by_cases hn4 : n = 4
· simp [hn4]
exact h4
· have hn' : n ∉ ({4, 4} : Multiset ℕ) := by
simp [← Multiset.mem_toFinset]
exact hn4
rw [Multiset.count_eq_zero_of_notMem hn']
apply Nat.zero_le
have h44' := max_prod_set_of_subset_of_max_prod_set h44 hs
contrapose! h44'
have h : ({4, 4} : Multiset ℕ).sum = ({3, 3, 2} : Multiset ℕ).sum := by
simp [Multiset.sum_singleton, Multiset.insert_eq_cons, Multiset.sum_cons]
apply not_max_prod_set_of_prod_lt_prod h
simp [Multiset.prod_singleton, Multiset.insert_eq_cons, Multiset.prod_cons]
have h₄ : Multiset.count 4 s < 1 ∨ Multiset.count 2 s < 1 := by
by_contra! h'
have h24 : ({2, 4} : Multiset ℕ) ≤ s := by
rw [Multiset.le_iff_count]
intro n
by_cases hn4 : n = 4
· simp [hn4]
exact h'.left
· by_cases hn2 : n = 2
· simp [hn2]
exact h'.right
· have hn' : n ∉ ({2, 4} : Multiset ℕ) := by
simp [← Multiset.mem_toFinset]
exact ⟨hn2, hn4⟩
rw [Multiset.count_eq_zero_of_notMem hn']
apply Nat.zero_le
have h24' := max_prod_set_of_subset_of_max_prod_set h24 hs
contrapose! h24'
have h : ({2, 4} : Multiset ℕ).sum = ({3, 3} : Multiset ℕ).sum := by
simp [Multiset.sum_singleton, Multiset.insert_eq_cons, Multiset.sum_cons]
apply not_max_prod_set_of_prod_lt_prod h
simp [Multiset.prod_singleton, Multiset.insert_eq_cons, Multiset.prod_cons]
omega
lemma max_prod_zero : IsMaxProd 0 1 := by
constructor
· use 0
constructor <;> rfl
· intro n hn
rcases hn with ⟨s, ⟨s_sum, s_prod⟩⟩
by_cases hs : s = 0
· rw [← s_prod, hs, Multiset.prod_zero]
· rcases Multiset.exists_mem_of_ne_zero hs with ⟨m, hm⟩
have hm' := Multiset.le_sum_of_mem hm
rw [s_sum] at hm'
rw [Nat.eq_zero_of_le_zero hm'] at hm
rw [← s_prod, Multiset.prod_eq_zero hm]
omega
lemma max_prod_one : IsMaxProd 1 1 := by
constructor
· use {1}
constructor <;> rfl
· intro n hn
rcases hn with ⟨s, ⟨s_sum, s_prod⟩⟩
rcases exists_mem_of_sum_lt_zero s (by omega:_) with ⟨m, hm⟩
have hm' : m ≤ 1 := by
rw [← s_sum]
exact Multiset.le_sum_of_mem hm
rcases Multiset.exists_cons_of_mem hm with ⟨t, ht⟩
have ht' : t.sum = 1 - m := by
rw [← s_sum, ht, Multiset.sum_cons, add_comm, Nat.add_sub_cancel_right]
rw [← s_prod, ht, Multiset.prod_cons]
interval_cases m
· rw [zero_mul]
norm_num
· have h := prod_le_max_prod max_prod_zero ht'
omega
lemma max_prod_two : IsMaxProd 2 2 := by
constructor
· use {2}
constructor <;> rfl
· intro n hn
rcases hn with ⟨s, ⟨s_sum, s_prod⟩⟩
rcases exists_mem_of_sum_lt_zero s (by omega:_) with ⟨m, hm⟩
have hm' : m ≤ 2 := by
rw [← s_sum]
exact Multiset.le_sum_of_mem hm
rcases Multiset.exists_cons_of_mem hm with ⟨t, ht⟩
have ht' : t.sum = 2 - m := by
rw [← s_sum, ht, Multiset.sum_cons, add_comm, Nat.add_sub_cancel_right]
rw [← s_prod, ht, Multiset.prod_cons]
interval_cases m
· rw [zero_mul]
norm_num
· have h := prod_le_max_prod max_prod_one ht'
omega
· have h := prod_le_max_prod max_prod_zero ht'
omega
lemma max_prod_three : IsMaxProd 3 3 := by
constructor
· use {3}
constructor <;> rfl
· intro n hn
rcases hn with ⟨s, ⟨s_sum, s_prod⟩⟩
rcases exists_mem_of_sum_lt_zero s (by omega:_) with ⟨m, hm⟩
have hm' : m ≤ 3 := by
rw [← s_sum]
exact Multiset.le_sum_of_mem hm
rcases Multiset.exists_cons_of_mem hm with ⟨t, ht⟩
have ht' : t.sum = 3 - m := by
rw [← s_sum, ht, Multiset.sum_cons, add_comm, Nat.add_sub_cancel_right]
rw [← s_prod, ht, Multiset.prod_cons]
interval_cases m
· rw [zero_mul]
norm_num
· have h := prod_le_max_prod max_prod_two ht'
omega
· have h := prod_le_max_prod max_prod_one ht'
omega
· have h := prod_le_max_prod max_prod_zero ht'
omega
lemma max_prod_four : IsMaxProd 4 4 := by
constructor
· use {4}
constructor <;> rfl
· intro n hn
rcases hn with ⟨s, ⟨s_sum, s_prod⟩⟩
rcases exists_mem_of_sum_lt_zero s (by omega:_) with ⟨m, hm⟩
have hm' : m ≤ 4 := by
rw [← s_sum]
exact Multiset.le_sum_of_mem hm
rcases Multiset.exists_cons_of_mem hm with ⟨t, ht⟩
have ht' : t.sum = 4 - m := by
rw [← s_sum, ht, Multiset.sum_cons, add_comm, Nat.add_sub_cancel_right]
rw [← s_prod, ht, Multiset.prod_cons]
interval_cases m
· rw [zero_mul]
norm_num
· have h := prod_le_max_prod max_prod_three ht'
omega
· have h := prod_le_max_prod max_prod_two ht'
omega
· have h := prod_le_max_prod max_prod_one ht'
omega
· have h := prod_le_max_prod max_prod_zero ht'
omega
theorem generalized (n : ℕ) :
IsMaxProd n (result n) := by
fun_induction result with
| case1 => exact max_prod_zero
| case2 => exact max_prod_one
| case3 => exact max_prod_two
| case4 => exact max_prod_three
| case5 => exact max_prod_four
| case6 n n_ne_zero n_ne_one ih =>
rw [imp_false, ← ne_eq] at *
rcases exists_max_prod (n + 3) with ⟨m, hm⟩
rcases exists_max_prod_set hm with ⟨s, ⟨hs_sum, hs⟩⟩
have hs_sum' : 4 < s.sum := by
rw [hs_sum]
omega
have hs3 := three_in_max_prod_set_of_four_lt_sum hs_sum' hs
have hs3' := Multiset.singleton_le.mpr hs3
have hs_without_3 : s - {3} ≤ s := Multiset.sub_le_self _ _
have hs_without_3' := max_prod_set_of_subset_of_max_prod_set hs_without_3 hs
have hs_without_3_sum : (s - {3}).sum = n := by
calc (s - {3}).sum
= (s - {3}).sum + ({3} : Multiset _).sum - ({3} : Multiset _).sum := by rfl
_ = (s - {3} + {3}).sum - ({3} : Multiset _).sum := by rw [Multiset.sum_add]
_ = s.sum - ({3} : Multiset _).sum := by rw [Multiset.sub_add_cancel hs3']
_ = n + 3 - 3 := by rw [hs_sum, Multiset.sum_singleton]
_ = n := by rfl
rw [IsMaxProdSet, hs_without_3_sum] at hs_without_3'
have hs_without_3_prod := IsGreatest.unique hs_without_3' ih
have hs_prod : s.prod = (3 * result n) := by
calc s.prod
= (s - {3} + {3}).prod := by rw [Multiset.sub_add_cancel hs3']
_ = (s - {3}).prod * ({3} : Multiset _).prod := by rw [Multiset.prod_add]
_ = result n * 3 := by rw [hs_without_3_prod, Multiset.prod_singleton]
_ = 3 * result n := by apply mul_comm
rw [IsMaxProdSet, hs_prod, hs_sum] at hs
exact hs
abbrev solution : ℕ := result 1976
theorem imo1976_p4 :
IsGreatest
{ n | ∃ s : Multiset ℕ, s.sum = 1976 ∧ s.prod = n }
solution := by
exact generalized 1976
end Imo1976P4
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Benpigchu
-/
import Mathlib
/-!
# International Mathematical Olympiad 1976, Problem 4
Determine, with proof, the largest number which is the product
of positive integers whose sum is 1976.
-/
namespace Imo1976P4
def IsMaxProd (n₀ : ℕ) :=
fun m ↦ IsGreatest
{ n | ∃ s : Multiset ℕ, s.sum = n₀ ∧ s.prod = n }
m
def IsMaxProdSet (s : Multiset ℕ) :=
IsMaxProd (s.sum) (s.prod)
def result : ℕ → ℕ
| 0 => 1
| 1 => 1
| 2 => 2
| 3 => 3
| 4 => 4
| n + 3 => 3 * (result n)
lemma prod_le_sum_pow_sum (s : Multiset ℕ) : s.prod ≤ s.sum ^ s.sum := by
induction' s using Multiset.induction with i s' hs'
· simp
· rw [Multiset.sum_cons, Multiset.prod_cons]
by_cases hi : i = 0
· rw [hi, zero_mul]
apply Nat.zero_le
· push_neg at hi
rw [← Nat.one_le_iff_ne_zero] at hi
calc i * s'.prod
≤ i * s'.sum ^ s'.sum := mul_le_mul_right hs' i
_ ≤ (i + s'.sum) * s'.sum ^ s'.sum := mul_le_mul_left (Nat.le_add_right _ _) _
_ ≤ (i + s'.sum) * (i + s'.sum) ^ s'.sum :=
mul_le_mul_right (pow_le_pow_left' (Nat.le_add_left _ _) _) _
_ = (i + s'.sum) ^ (s'.sum + 1) := by exact Nat.pow_add_one'.symm
_ ≤ (i + s'.sum) ^ (i + s'.sum) := by
apply pow_le_pow_right'
· exact Nat.le_add_right_of_le hi
· rw [add_comm]
exact Nat.add_le_add_right hi s'.sum
lemma exists_mem_of_sum_lt_zero (s : Multiset ℕ) (hs: 0 < s.sum) :
∃ x: ℕ, x ∈ s := by
have hs' : s ≠ 0 := by
contrapose! hs
rw [hs, Multiset.sum_zero]
exact Multiset.exists_mem_of_ne_zero hs'
lemma prod_with_given_sum_bddAbove (n₀ : ℕ) :
BddAbove {n | ∃ s : Multiset ℕ, s.sum = n₀ ∧ s.prod = n} := by
use n₀ ^ n₀
intro m hm
rcases hm with ⟨s, ⟨hs_sum, hs_prod⟩⟩
rw [← hs_sum, ← hs_prod]
exact prod_le_sum_pow_sum s
lemma exists_max_prod (n : ℕ) :
∃ m : ℕ, IsMaxProd n m := by
apply BddAbove.exists_isGreatest_of_nonempty
· exact prod_with_given_sum_bddAbove n
· use n
use {n}
constructor
· rw [Multiset.sum_singleton]
· rw [Multiset.prod_singleton]
lemma exists_max_prod_set {n m : ℕ} (hnm: IsMaxProd n m):
∃ s : Multiset ℕ, s.sum = n ∧ IsMaxProdSet s := by
rcases hnm.left with ⟨s, ⟨hs_sum, hs_prod⟩⟩
use s
constructor
· exact hs_sum
· rw [IsMaxProdSet, hs_prod, hs_sum]
exact hnm
lemma prod_le_max_prod {n m : ℕ} (hnm: IsMaxProd n m)
{s : Multiset ℕ} (hs : s.sum = n) : s.prod ≤ m := by
have h := hnm.right
simp [upperBounds] at h
exact h s hs
lemma not_max_prod_set_of_prod_lt_prod {s t: Multiset ℕ}
(hst' : s.sum = t.sum) (hst : s.prod < t.prod) : ¬IsMaxProdSet s := by
contrapose! hst
have h' := hst.right
simp [upperBounds] at h'
exact h' t hst'.symm
lemma exists_cons_le_of_le_of_sum_lt_sum {s t : Multiset ℕ}
(hst' : s ≤ t) (hst : s.sum < t.sum) : ∃ n : ℕ, s.cons n ≤ t := by
have ht_sub_s : t - s ≠ 0 := by
contrapose! hst
apply le_of_eq
calc t.sum
= (t - s + s).sum := by rw [Multiset.sub_add_cancel hst']
_ = (t - s).sum + s.sum := by rw [Multiset.sum_add]
_ = 0 + s.sum := by rw [hst, Multiset.sum_zero]
_ = s.sum := by rw [zero_add]
rcases Multiset.exists_mem_of_ne_zero ht_sub_s with ⟨m, hm⟩
use m
rw [← Multiset.singleton_add, ← Multiset.sub_add_cancel hst']
rw [Multiset.add_le_add_iff_right, Multiset.singleton_le]
exact hm
lemma exists_le_of_mem_of_lt_sum {n : ℕ} {s : Multiset ℕ}
(hns' : n ∈ s) (hns : n < s.sum) : ∃ m : ℕ, {n, m} ≤ s := by
rcases Multiset.exists_cons_of_mem hns' with ⟨t, ht⟩
have ht' : t ≠ 0 := by
contrapose! hns
rw [ht, hns, Multiset.sum_cons, Multiset.sum_zero, add_zero]
rcases Multiset.exists_mem_of_ne_zero ht' with ⟨m, hm⟩
use m
rw [ht, Multiset.insert_eq_cons]
exact Multiset.cons_le_cons n (Multiset.singleton_le.mpr hm)
lemma zero_not_in_max_prod_set {s : Multiset ℕ}
(hs: IsMaxProdSet s) : 0 ∉ s := by
contrapose! hs
have ha : s.sum = (Multiset.replicate s.sum 1).sum := by
rw [Multiset.sum_replicate, Nat.nsmul_eq_mul, mul_one (M := ℕ)]
apply not_max_prod_set_of_prod_lt_prod ha
rw [Multiset.prod_replicate, one_pow (M := ℕ), Multiset.prod_eq_zero hs]
norm_num
lemma max_prod_set_of_subset_of_max_prod_set {s t : Multiset ℕ}
(hst : s ≤ t) (ht: IsMaxProdSet t) : IsMaxProdSet s := by
constructor
· use s
· intro n hn
rcases hn with ⟨s', ⟨hs'_sum, hs'_prod⟩⟩
have ht_sub_s : (t - s).prod > 0 := by
apply Nat.zero_lt_of_ne_zero
apply Multiset.prod_ne_zero
intro h'
apply zero_not_in_max_prod_set ht
rw [Multiset.mem_sub] at h'
rw [← Multiset.count_pos]
exact Nat.zero_lt_of_lt h'
apply Nat.le_of_mul_le_mul_left _ ht_sub_s
rw [← hs'_prod, ← Multiset.prod_add, ← Multiset.prod_add]
rw [Multiset.sub_add_cancel hst]
have h' := ht.right
simp [upperBounds] at h'
apply h' (t - s + s')
calc (t - s + s').sum
= (t - s).sum + s'.sum := by rw [Multiset.sum_add]
_ = (t - s).sum + s.sum := by rw [hs'_sum]
_ = (t - s + s).sum := by rw [Multiset.sum_add]
_ = t.sum := by rw [Multiset.sub_add_cancel hst]
lemma one_not_in_max_prod_set_of_one_lt_sum {s : Multiset ℕ}
(hs' : 1 < s.sum) (hs: IsMaxProdSet s) : 1 ∉ s := by
intro h1s
rcases exists_le_of_mem_of_lt_sum h1s hs' with ⟨n, hn⟩
have h1n := max_prod_set_of_subset_of_max_prod_set hn hs
contrapose! h1n
have h1n' : ({1, n} : Multiset ℕ).sum = ({1 + n} : Multiset ℕ).sum := by
rw [Multiset.sum_singleton, Multiset.insert_eq_cons, Multiset.sum_cons, Multiset.sum_singleton]
apply not_max_prod_set_of_prod_lt_prod h1n'
rw [Multiset.prod_singleton, Multiset.insert_eq_cons, Multiset.prod_cons, Multiset.prod_singleton]
omega
lemma not_in_max_prod_set_of_five_le {s : Multiset ℕ} {n : ℕ}
(hn : 4 < n) (hs: IsMaxProdSet s) : n ∉ s := by
intro hn'
have hn'' := max_prod_set_of_subset_of_max_prod_set (Multiset.singleton_le.mpr hn') hs
contrapose! hn''
have hn_sub_2 : ({n} : Multiset ℕ).sum = ({n - 2, 2} : Multiset ℕ).sum := by
rw [Multiset.sum_singleton, Multiset.insert_eq_cons, Multiset.sum_cons, Multiset.sum_singleton]
symm
apply Nat.sub_add_cancel
omega
apply not_max_prod_set_of_prod_lt_prod hn_sub_2
rw [Multiset.prod_singleton, Multiset.insert_eq_cons, Multiset.prod_cons, Multiset.prod_singleton]
omega
lemma lt_and_gt_of_in_max_prod_set_of_four_lt_sum {s : Multiset ℕ} {n : ℕ}
(hn : n ∈ s) (hs' : 4 < s.sum) (hs: IsMaxProdSet s) : 1 < n ∧ n < 5 := by
have hn_ne_0 : n ≠ 0 := by
contrapose! hn
rw [hn]
exact zero_not_in_max_prod_set hs
have hn_ne_1 : n ≠ 1 := by
contrapose! hn
rw [hn]
apply one_not_in_max_prod_set_of_one_lt_sum _ hs
omega
have hn_le_4 : n ≤ 4 := by
contrapose! hn
exact not_in_max_prod_set_of_five_le hn hs
omega
lemma three_in_max_prod_set_of_four_lt_sum {s : Multiset ℕ}
(hs' : 4 < s.sum) (hs: IsMaxProdSet s) : 3 ∈ s := by
rw [← Multiset.count_ne_zero, Nat.ne_zero_iff_zero_lt]
have h₁ : s.toFinset ⊆ {2, 3, 4} := by
intro x hx
rw [Multiset.mem_toFinset] at hx
have hx' := lt_and_gt_of_in_max_prod_set_of_four_lt_sum hx hs' hs
have hx'l := hx'.left
have hx'r := hx'.right
interval_cases x <;> simp
simp [Finset.sum_multiset_count_of_subset _ _ h₁] at hs'
have h₂ : Multiset.count 2 s < 3 := by
by_contra! h2
have h222 : ({2, 2, 2} : Multiset ℕ) ≤ s := by
rw [Multiset.le_iff_count]
intro n
by_cases hn2 : n = 2
· simp [hn2]
exact h2
· have hn' : n ∉ ({2, 2, 2} : Multiset ℕ) := by
simp [← Multiset.mem_toFinset]
exact hn2
rw [Multiset.count_eq_zero_of_notMem hn']
apply Nat.zero_le
have h222' := max_prod_set_of_subset_of_max_prod_set h222 hs
contrapose! h222'
have h : ({2, 2, 2} : Multiset ℕ).sum = ({3, 3} : Multiset ℕ).sum := by
simp [Multiset.sum_singleton, Multiset.insert_eq_cons, Multiset.sum_cons]
apply not_max_prod_set_of_prod_lt_prod h
simp [Multiset.prod_singleton, Multiset.insert_eq_cons, Multiset.prod_cons]
have h₃ : Multiset.count 4 s < 2 := by
by_contra! h4
have h44 : ({4, 4} : Multiset ℕ) ≤ s := by
rw [Multiset.le_iff_count]
intro n
by_cases hn4 : n = 4
· simp [hn4]
exact h4
· have hn' : n ∉ ({4, 4} : Multiset ℕ) := by
simp [← Multiset.mem_toFinset]
exact hn4
rw [Multiset.count_eq_zero_of_notMem hn']
apply Nat.zero_le
have h44' := max_prod_set_of_subset_of_max_prod_set h44 hs
contrapose! h44'
have h : ({4, 4} : Multiset ℕ).sum = ({3, 3, 2} : Multiset ℕ).sum := by
simp [Multiset.sum_singleton, Multiset.insert_eq_cons, Multiset.sum_cons]
apply not_max_prod_set_of_prod_lt_prod h
simp [Multiset.prod_singleton, Multiset.insert_eq_cons, Multiset.prod_cons]
have h₄ : Multiset.count 4 s < 1 ∨ Multiset.count 2 s < 1 := by
by_contra! h'
have h24 : ({2, 4} : Multiset ℕ) ≤ s := by
rw [Multiset.le_iff_count]
intro n
by_cases hn4 : n = 4
· simp [hn4]
exact h'.left
· by_cases hn2 : n = 2
· simp [hn2]
exact h'.right
· have hn' : n ∉ ({2, 4} : Multiset ℕ) := by
simp [← Multiset.mem_toFinset]
exact ⟨hn2, hn4⟩
rw [Multiset.count_eq_zero_of_notMem hn']
apply Nat.zero_le
have h24' := max_prod_set_of_subset_of_max_prod_set h24 hs
contrapose! h24'
have h : ({2, 4} : Multiset ℕ).sum = ({3, 3} : Multiset ℕ).sum := by
simp [Multiset.sum_singleton, Multiset.insert_eq_cons, Multiset.sum_cons]
apply not_max_prod_set_of_prod_lt_prod h
simp [Multiset.prod_singleton, Multiset.insert_eq_cons, Multiset.prod_cons]
omega
lemma max_prod_zero : IsMaxProd 0 1 := by
constructor
· use 0
constructor <;> rfl
· intro n hn
rcases hn with ⟨s, ⟨s_sum, s_prod⟩⟩
by_cases hs : s = 0
· rw [← s_prod, hs, Multiset.prod_zero]
· rcases Multiset.exists_mem_of_ne_zero hs with ⟨m, hm⟩
have hm' := Multiset.le_sum_of_mem hm
rw [s_sum] at hm'
rw [Nat.eq_zero_of_le_zero hm'] at hm
rw [← s_prod, Multiset.prod_eq_zero hm]
omega
lemma max_prod_one : IsMaxProd 1 1 := by
constructor
· use {1}
constructor <;> rfl
· intro n hn
rcases hn with ⟨s, ⟨s_sum, s_prod⟩⟩
rcases exists_mem_of_sum_lt_zero s (by omega:_) with ⟨m, hm⟩
have hm' : m ≤ 1 := by
rw [← s_sum]
exact Multiset.le_sum_of_mem hm
rcases Multiset.exists_cons_of_mem hm with ⟨t, ht⟩
have ht' : t.sum = 1 - m := by
rw [← s_sum, ht, Multiset.sum_cons, add_comm, Nat.add_sub_cancel_right]
rw [← s_prod, ht, Multiset.prod_cons]
interval_cases m
· rw [zero_mul]
norm_num
· have h := prod_le_max_prod max_prod_zero ht'
omega
lemma max_prod_two : IsMaxProd 2 2 := by
constructor
· use {2}
constructor <;> rfl
· intro n hn
rcases hn with ⟨s, ⟨s_sum, s_prod⟩⟩
rcases exists_mem_of_sum_lt_zero s (by omega:_) with ⟨m, hm⟩
have hm' : m ≤ 2 := by
rw [← s_sum]
exact Multiset.le_sum_of_mem hm
rcases Multiset.exists_cons_of_mem hm with ⟨t, ht⟩
have ht' : t.sum = 2 - m := by
rw [← s_sum, ht, Multiset.sum_cons, add_comm, Nat.add_sub_cancel_right]
rw [← s_prod, ht, Multiset.prod_cons]
interval_cases m
· rw [zero_mul]
norm_num
· have h := prod_le_max_prod max_prod_one ht'
omega
· have h := prod_le_max_prod max_prod_zero ht'
omega
lemma max_prod_three : IsMaxProd 3 3 := by
constructor
· use {3}
constructor <;> rfl
· intro n hn
rcases hn with ⟨s, ⟨s_sum, s_prod⟩⟩
rcases exists_mem_of_sum_lt_zero s (by omega:_) with ⟨m, hm⟩
have hm' : m ≤ 3 := by
rw [← s_sum]
exact Multiset.le_sum_of_mem hm
rcases Multiset.exists_cons_of_mem hm with ⟨t, ht⟩
have ht' : t.sum = 3 - m := by
rw [← s_sum, ht, Multiset.sum_cons, add_comm, Nat.add_sub_cancel_right]
rw [← s_prod, ht, Multiset.prod_cons]
interval_cases m
· rw [zero_mul]
norm_num
· have h := prod_le_max_prod max_prod_two ht'
omega
· have h := prod_le_max_prod max_prod_one ht'
omega
· have h := prod_le_max_prod max_prod_zero ht'
omega
lemma max_prod_four : IsMaxProd 4 4 := by
constructor
· use {4}
constructor <;> rfl
· intro n hn
rcases hn with ⟨s, ⟨s_sum, s_prod⟩⟩
rcases exists_mem_of_sum_lt_zero s (by omega:_) with ⟨m, hm⟩
have hm' : m ≤ 4 := by
rw [← s_sum]
exact Multiset.le_sum_of_mem hm
rcases Multiset.exists_cons_of_mem hm with ⟨t, ht⟩
have ht' : t.sum = 4 - m := by
rw [← s_sum, ht, Multiset.sum_cons, add_comm, Nat.add_sub_cancel_right]
rw [← s_prod, ht, Multiset.prod_cons]
interval_cases m
· rw [zero_mul]
norm_num
· have h := prod_le_max_prod max_prod_three ht'
omega
· have h := prod_le_max_prod max_prod_two ht'
omega
· have h := prod_le_max_prod max_prod_one ht'
omega
· have h := prod_le_max_prod max_prod_zero ht'
omega
theorem generalized (n : ℕ) :
IsMaxProd n (result n) := by
fun_induction result with
| case1 => exact max_prod_zero
| case2 => exact max_prod_one
| case3 => exact max_prod_two
| case4 => exact max_prod_three
| case5 => exact max_prod_four
| case6 n n_ne_zero n_ne_one ih =>
rw [imp_false, ← ne_eq] at *
rcases exists_max_prod (n + 3) with ⟨m, hm⟩
rcases exists_max_prod_set hm with ⟨s, ⟨hs_sum, hs⟩⟩
have hs_sum' : 4 < s.sum := by
rw [hs_sum]
omega
have hs3 := three_in_max_prod_set_of_four_lt_sum hs_sum' hs
have hs3' := Multiset.singleton_le.mpr hs3
have hs_without_3 : s - {3} ≤ s := Multiset.sub_le_self _ _
have hs_without_3' := max_prod_set_of_subset_of_max_prod_set hs_without_3 hs
have hs_without_3_sum : (s - {3}).sum = n := by
calc (s - {3}).sum
= (s - {3}).sum + ({3} : Multiset _).sum - ({3} : Multiset _).sum := by rfl
_ = (s - {3} + {3}).sum - ({3} : Multiset _).sum := by rw [Multiset.sum_add]
_ = s.sum - ({3} : Multiset _).sum := by rw [Multiset.sub_add_cancel hs3']
_ = n + 3 - 3 := by rw [hs_sum, Multiset.sum_singleton]
_ = n := by rfl
rw [IsMaxProdSet, hs_without_3_sum] at hs_without_3'
have hs_without_3_prod := IsGreatest.unique hs_without_3' ih
have hs_prod : s.prod = (3 * result n) := by
calc s.prod
= (s - {3} + {3}).prod := by rw [Multiset.sub_add_cancel hs3']
_ = (s - {3}).prod * ({3} : Multiset _).prod := by rw [Multiset.prod_add]
_ = result n * 3 := by rw [hs_without_3_prod, Multiset.prod_singleton]
_ = 3 * result n := by apply mul_comm
rw [IsMaxProdSet, hs_prod, hs_sum] at hs
exact hs
abbrev solution : ℕ := result 1976
theorem imo1976_p4 :
IsGreatest
{ n | ∃ s : Multiset ℕ, s.sum = 1976 ∧ s.prod = n }
solution := by
exact generalized 1976
end Imo1976P4 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1976P4.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["function expected at\n mul_le_mul_right ?m.33970\nterm has type\n ?m.33167 * ?m.33166 \u2264 ?m.33168 * ?m.33166 \u2194 ?m.33167 \u2264 ?m.33168", "function expected at\n mul_le_mul_left ?m.36254\nterm has type\n ?m.35448 * ?m.35449 \u2264 ?m.35448 * ?m.35450 \u2194 ?m.35449 \u2264 ?m.35450", "function expected at\n mul_le_mul_right ?m.40594\nterm has type\n ?m.39483 * ?m.39482 \u2264 ?m.39484 * ?m.39482 \u2194 ?m.39483 \u2264 ?m.39484", "Application type mismatch: In the application\n mul_le_mul_right (pow_le_pow_left' (Nat.le_add_left ?m.39495 ?m.39496) ?m.39507)\nthe argument\n pow_le_pow_left' (Nat.le_add_left ?m.39495 ?m.39496) ?m.39507\nhas type\n ?m.39495 ^ ?m.39507 \u2264 (?m.39496 + ?m.39495) ^ ?m.39507 : Prop\nbut is expected to have type\n 0 < ?m.39482 : Prop", "unknown tactic", "unsolved goals\ncase intro\ns : Multiset \u2115\nhs' : 1 < s.sum\nhs : IsMaxProdSet s\nh1s : 1 \u2208 s\nn : \u2115\nhn : {1, n} \u2264 s\nh1n : \u00acFalse\nh1n' : {1, n}.sum = {1 + n}.sum\n\u22a2 1 * n < 1 + n", "unknown tactic", "unsolved goals\ncase h\ns : Multiset \u2115\nn : \u2115\nhn : 4 < n\nhs : IsMaxProdSet s\nhn' : n \u2208 s\nhn'' : \u00acFalse\n\u22a2 2 \u2264 n", "unsolved goals\ns : Multiset \u2115\nn : \u2115\nhn : 4 < n\nhs : IsMaxProdSet s\nhn' : n \u2208 s\nhn'' : \u00acFalse\nhn_sub_2 : {n}.sum = {n - 2, 2}.sum\n\u22a2 \u00acIsMaxProdSet {n}", "unknown tactic", "unsolved goals\ns : Multiset \u2115\nn : \u2115\nhs' : 4 < s.sum\nhs : IsMaxProdSet s\nhn_ne_0 : n \u2260 0\nhn : n = 1\n\u22a2 1 < s.sum", "unsolved goals\ns : Multiset \u2115\nn : \u2115\nhn : n \u2208 s\nhs' : 4 < s.sum\nhs : IsMaxProdSet s\nhn_ne_0 : n \u2260 0\nhn_ne_1 : n \u2260 1\n\u22a2 1 < n \u2227 n < 5", "unknown tactic", "unsolved goals\ns : Multiset \u2115\nhs : IsMaxProdSet s\nh\u2081 : s.toFinset \u2286 {2, 3, 4}\nhs' : 4 < Multiset.count 2 s * 2 + (Multiset.count 3 s * 3 + Multiset.count 4 s * 4)\nh\u2082 : Multiset.count 2 s < 3\nh\u2083 : Multiset.count 4 s < 2\nh\u2084 : Multiset.count 4 s < 1 \u2228 Multiset.count 2 s < 1\n\u22a2 0 < Multiset.count 3 s", "unknown tactic", "unsolved goals\ncase neg.intro\nn : \u2115\ns : Multiset \u2115\ns_sum : s.sum = 0\ns_prod : s.prod = n\nhs : \u00acs = 0\nm : \u2115\nhm : 0 \u2208 s\nhm' : m \u2264 0\n\u22a2 0 \u2264 1", "unknown tactic", "unsolved goals\nn : \u2115\ns : Multiset \u2115\ns_sum : s.sum = 1\ns_prod : s.prod = n\n\u22a2 0 < s.sum", "unsolved goals\ncase right.intro.intro.intro\nn : \u2115\ns : Multiset \u2115\ns_sum : s.sum = 1\ns_prod : s.prod = n\nw\u271d : \u2115\nh\u271d : w\u271d \u2208 s\n\u22a2 n \u2264 1", "unknown tactic", "unsolved goals\nn : \u2115\ns : Multiset \u2115\ns_sum : s.sum = 2\ns_prod : s.prod = n\n\u22a2 0 < s.sum", "unsolved goals\ncase right.intro.intro.intro\nn : \u2115\ns : Multiset \u2115\ns_sum : s.sum = 2\ns_prod : s.prod = n\nw\u271d : \u2115\nh\u271d : w\u271d \u2208 s\n\u22a2 n \u2264 2", "unknown tactic", "unsolved goals\nn : \u2115\ns : Multiset \u2115\ns_sum : s.sum = 3\ns_prod : s.prod = n\n\u22a2 0 < s.sum", "unsolved goals\ncase right.intro.intro.intro\nn : \u2115\ns : Multiset \u2115\ns_sum : s.sum = 3\ns_prod : s.prod = n\nw\u271d : \u2115\nh\u271d : w\u271d \u2208 s\n\u22a2 n \u2264 3", "unknown tactic", "unsolved goals\nn : \u2115\ns : Multiset \u2115\ns_sum : s.sum = 4\ns_prod : s.prod = n\n\u22a2 0 < s.sum", "unsolved goals\ncase right.intro.intro.intro\nn : \u2115\ns : Multiset \u2115\ns_sum : s.sum = 4\ns_prod : s.prod = n\nw\u271d : \u2115\nh\u271d : w\u271d \u2208 s\n\u22a2 n \u2264 4", "unknown tactic", "unsolved goals\nn : \u2115\nn_ne_zero : n \u2260 0\nn_ne_one : n \u2260 1\nih : IsMaxProd n (result n)\nm : \u2115\nhm : IsMaxProd (n + 3) m\ns : Multiset \u2115\nhs_sum : s.sum = n + 3\nhs : IsMaxProdSet s\n\u22a2 4 < n + 3", "unsolved goals\ncase case6.intro.intro.intro\nn : \u2115\nn_ne_zero : n \u2260 0\nn_ne_one : n \u2260 1\nih : IsMaxProd n (result n)\nm : \u2115\nhm : IsMaxProd (n + 3) m\ns : Multiset \u2115\nhs_sum : s.sum = n + 3\nhs : IsMaxProdSet s\nhs_sum' : 4 < s.sum\n\u22a2 IsMaxProd n.succ.succ.succ (3 * result n)"], "timeout_s": 600.0, "latency_s": 2.0615, "verified_at": "2026-03-26T18:16:33.796615+00:00"}} | false | true | false | 2.0615 |
compfiles_Imo1976P6 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Aristotle-Harmonic, David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1976, Problem 6
The sequence u_0, u_1, u_2, ... is defined by:
u_0 = 2, u_1 = 5/2, u_{n+1} = u_n(u_{n-1}^2 - 2) - u_1 for n = 1, 2, ... .
Prove that ⌊u_n⌋ = 2^(2^n - (-1)^n)/3 for all positive n,
where ⌊x⌋ denotes the greatest integer less than or equal to x.
-/
namespace Imo1976P6
theorem imo1976_p6 (u : ℕ → ℝ)
(h₀ : u 0 = 2)
(h₁ : u 1 = 5 / 2)
(h₂ : ∀ n, u (n + 2) = u (n + 1) * ((u n) ^ 2 - 2) - u 1) :
∀ n > 0, ⌊u n⌋ = (2 : ℝ) ^ ((2^n - (-1 : ℝ) ^ n) / 3) := by
have h_ind : ∀ n, u n = 2 ^ ((2 ^ n - (-1) ^ n) / 3 : ℝ) +
2 ^ ((-2 ^ n + (-1) ^ n) / 3 : ℝ) := by
intro n
induction' n using Nat.strong_induction_on with n ih;
rcases n with ( _ | _ | n ) <;> norm_num
· exact h₀
· exact h₁
simp_all only [lt_add_iff_pos_left, add_pos_iff, Nat.ofNat_pos, or_true, pow_zero,
sub_self, zero_div, Real.rpow_zero, neg_add_cancel,
zero_lt_one, pow_one, sub_neg_eq_add, lt_add_iff_pos_right]
ring_nf at * ; norm_num at *;
rw [ih n (by omega)] ; ring_nf; norm_num [ sq, ← Real.rpow_add ] ; ring_nf;
obtain h | h := Nat.even_or_odd n <;> norm_num [h.neg_one_pow] <;> ring_nf
intro n hn_pos
have h_int : ∃ k : ℤ, (2 : ℝ) ^ ((2 ^ n - (-1) ^ n) / 3 : ℝ) = k := by
-- We need to show that $(2^n - (-1)^n) / 3$ is an integer.
have h_int : ∃ k : ℤ, (2^n - (-1)^n) = 3 * k := sub_dvd_pow_sub_pow _ _ _
simp_all only [pow_zero, sub_self, zero_div, Real.rpow_zero, neg_add_cancel,
pow_one, sub_neg_eq_add, gt_iff_lt, Int.reduceNeg]
obtain ⟨w, h⟩ := h_int
use 2 ^ w.natAbs
obtain a | a := w <;> norm_num [ Real.rpow_def_of_pos ] at *
· simp_all only [Int.reduceNeg]
norm_num [ ← h, Real.exp_mul, Real.exp_log ];
norm_num [ show ( 2 ^ n - ( -1 ) ^ n : ℝ ) = 3 * a by exact_mod_cast h ];
· obtain ⟨w, h_1⟩ := Nat.even_or_odd' n
simp_all only [Int.reduceNeg]
cases h_1 with
| inl h_2 =>
subst h_2
simp_all only [Nat.ofNat_pos, mul_pos_iff_of_pos_left, Int.reduceNeg, even_two,
Even.mul_right, Even.neg_pow, one_pow]
omega
| inr h_3 =>
subst h_3
simp_all only [lt_add_iff_pos_left, add_pos_iff, Nat.ofNat_pos, mul_pos_iff_of_pos_left,
zero_lt_one, or_true, Int.reduceNeg]
norm_num [Int.negSucc_eq] at h
omega
simp_all only [pow_zero, sub_self, zero_div, Real.rpow_zero, neg_add_cancel,
pow_one, sub_neg_eq_add, gt_iff_lt]
obtain ⟨w, h⟩ := h_int
simp_all only [Int.floor_intCast_add, Int.cast_add, add_eq_left, Int.cast_eq_zero,
Int.floor_eq_zero_iff, Set.mem_Ico]
apply And.intro
· positivity
· rw [ Real.rpow_lt_one_iff ] <;> norm_num
rcases Nat.even_or_odd' n with ⟨ k, rfl | rfl ⟩ <;> norm_num [ pow_add, pow_mul ] at *;
· linarith [ pow_le_pow_right₀ ( by norm_num : ( 1 : ℝ ) ≤ 4 ) hn_pos ];
· linarith [ pow_pos ( by norm_num : ( 0 : ℝ ) < 4 ) k ]
end Imo1976P6 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Aristotle-Harmonic, David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1976, Problem 6
The sequence u_0, u_1, u_2, ... is defined by:
u_0 = 2, u_1 = 5/2, u_{n+1} = u_n(u_{n-1}^2 - 2) - u_1 for n = 1, 2, ... .
Prove that ⌊u_n⌋ = 2^(2^n - (-1)^n)/3 for all positive n,
where ⌊x⌋ denotes the greatest integer less than or equal to x.
-/
namespace Imo1976P6
theorem imo1976_p6 (u : ℕ → ℝ)
(h₀ : u 0 = 2)
(h₁ : u 1 = 5 / 2)
(h₂ : ∀ n, u (n + 2) = u (n + 1) * ((u n) ^ 2 - 2) - u 1) :
∀ n > 0, ⌊u n⌋ = (2 : ℝ) ^ ((2^n - (-1 : ℝ) ^ n) / 3) := by
have h_ind : ∀ n, u n = 2 ^ ((2 ^ n - (-1) ^ n) / 3 : ℝ) +
2 ^ ((-2 ^ n + (-1) ^ n) / 3 : ℝ) := by
intro n
induction' n using Nat.strong_induction_on with n ih;
rcases n with ( _ | _ | n ) <;> norm_num
· exact h₀
· exact h₁
simp_all only [lt_add_iff_pos_left, add_pos_iff, Nat.ofNat_pos, or_true, pow_zero,
sub_self, zero_div, Real.rpow_zero, neg_add_cancel,
zero_lt_one, pow_one, sub_neg_eq_add, lt_add_iff_pos_right]
ring_nf at * ; norm_num at *;
rw [ih n (by omega)] ; ring_nf; norm_num [ sq, ← Real.rpow_add ] ; ring_nf;
obtain h | h := Nat.even_or_odd n <;> norm_num [h.neg_one_pow] <;> ring_nf
intro n hn_pos
have h_int : ∃ k : ℤ, (2 : ℝ) ^ ((2 ^ n - (-1) ^ n) / 3 : ℝ) = k := by
-- We need to show that $(2^n - (-1)^n) / 3$ is an integer.
have h_int : ∃ k : ℤ, (2^n - (-1)^n) = 3 * k := sub_dvd_pow_sub_pow _ _ _
simp_all only [pow_zero, sub_self, zero_div, Real.rpow_zero, neg_add_cancel,
pow_one, sub_neg_eq_add, gt_iff_lt, Int.reduceNeg]
obtain ⟨w, h⟩ := h_int
use 2 ^ w.natAbs
obtain a | a := w <;> norm_num [ Real.rpow_def_of_pos ] at *
· simp_all only [Int.reduceNeg]
norm_num [ ← h, Real.exp_mul, Real.exp_log ];
norm_num [ show ( 2 ^ n - ( -1 ) ^ n : ℝ ) = 3 * a by exact_mod_cast h ];
· obtain ⟨w, h_1⟩ := Nat.even_or_odd' n
simp_all only [Int.reduceNeg]
cases h_1 with
| inl h_2 =>
subst h_2
simp_all only [Nat.ofNat_pos, mul_pos_iff_of_pos_left, Int.reduceNeg, even_two,
Even.mul_right, Even.neg_pow, one_pow]
omega
| inr h_3 =>
subst h_3
simp_all only [lt_add_iff_pos_left, add_pos_iff, Nat.ofNat_pos, mul_pos_iff_of_pos_left,
zero_lt_one, or_true, Int.reduceNeg]
norm_num [Int.negSucc_eq] at h
omega
simp_all only [pow_zero, sub_self, zero_div, Real.rpow_zero, neg_add_cancel,
pow_one, sub_neg_eq_add, gt_iff_lt]
obtain ⟨w, h⟩ := h_int
simp_all only [Int.floor_intCast_add, Int.cast_add, add_eq_left, Int.cast_eq_zero,
Int.floor_eq_zero_iff, Set.mem_Ico]
apply And.intro
· positivity
· rw [ Real.rpow_lt_one_iff ] <;> norm_num
rcases Nat.even_or_odd' n with ⟨ k, rfl | rfl ⟩ <;> norm_num [ pow_add, pow_mul ] at *;
· linarith [ pow_le_pow_right₀ ( by norm_num : ( 1 : ℝ ) ≤ 4 ) hn_pos ];
· linarith [ pow_pos ( by norm_num : ( 0 : ℝ ) < 4 ) k ]
end Imo1976P6
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Aristotle-Harmonic, David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1976, Problem 6
The sequence u_0, u_1, u_2, ... is defined by:
u_0 = 2, u_1 = 5/2, u_{n+1} = u_n(u_{n-1}^2 - 2) - u_1 for n = 1, 2, ... .
Prove that ⌊u_n⌋ = 2^(2^n - (-1)^n)/3 for all positive n,
where ⌊x⌋ denotes the greatest integer less than or equal to x.
-/
namespace Imo1976P6
theorem imo1976_p6 (u : ℕ → ℝ)
(h₀ : u 0 = 2)
(h₁ : u 1 = 5 / 2)
(h₂ : ∀ n, u (n + 2) = u (n + 1) * ((u n) ^ 2 - 2) - u 1) :
∀ n > 0, ⌊u n⌋ = (2 : ℝ) ^ ((2^n - (-1 : ℝ) ^ n) / 3) := by
have h_ind : ∀ n, u n = 2 ^ ((2 ^ n - (-1) ^ n) / 3 : ℝ) +
2 ^ ((-2 ^ n + (-1) ^ n) / 3 : ℝ) := by
intro n
induction' n using Nat.strong_induction_on with n ih;
rcases n with ( _ | _ | n ) <;> norm_num
· exact h₀
· exact h₁
simp_all only [lt_add_iff_pos_left, add_pos_iff, Nat.ofNat_pos, or_true, pow_zero,
sub_self, zero_div, Real.rpow_zero, neg_add_cancel,
zero_lt_one, pow_one, sub_neg_eq_add, lt_add_iff_pos_right]
ring_nf at * ; norm_num at *;
rw [ih n (by omega)] ; ring_nf; norm_num [ sq, ← Real.rpow_add ] ; ring_nf;
obtain h | h := Nat.even_or_odd n <;> norm_num [h.neg_one_pow] <;> ring_nf
intro n hn_pos
have h_int : ∃ k : ℤ, (2 : ℝ) ^ ((2 ^ n - (-1) ^ n) / 3 : ℝ) = k := by
-- We need to show that $(2^n - (-1)^n) / 3$ is an integer.
have h_int : ∃ k : ℤ, (2^n - (-1)^n) = 3 * k := sub_dvd_pow_sub_pow _ _ _
simp_all only [pow_zero, sub_self, zero_div, Real.rpow_zero, neg_add_cancel,
pow_one, sub_neg_eq_add, gt_iff_lt, Int.reduceNeg]
obtain ⟨w, h⟩ := h_int
use 2 ^ w.natAbs
obtain a | a := w <;> norm_num [ Real.rpow_def_of_pos ] at *
· simp_all only [Int.reduceNeg]
norm_num [ ← h, Real.exp_mul, Real.exp_log ];
norm_num [ show ( 2 ^ n - ( -1 ) ^ n : ℝ ) = 3 * a by exact_mod_cast h ];
· obtain ⟨w, h_1⟩ := Nat.even_or_odd' n
simp_all only [Int.reduceNeg]
cases h_1 with
| inl h_2 =>
subst h_2
simp_all only [Nat.ofNat_pos, mul_pos_iff_of_pos_left, Int.reduceNeg, even_two,
Even.mul_right, Even.neg_pow, one_pow]
omega
| inr h_3 =>
subst h_3
simp_all only [lt_add_iff_pos_left, add_pos_iff, Nat.ofNat_pos, mul_pos_iff_of_pos_left,
zero_lt_one, or_true, Int.reduceNeg]
norm_num [Int.negSucc_eq] at h
omega
simp_all only [pow_zero, sub_self, zero_div, Real.rpow_zero, neg_add_cancel,
pow_one, sub_neg_eq_add, gt_iff_lt]
obtain ⟨w, h⟩ := h_int
simp_all only [Int.floor_intCast_add, Int.cast_add, add_eq_left, Int.cast_eq_zero,
Int.floor_eq_zero_iff, Set.mem_Ico]
apply And.intro
· positivity
· rw [ Real.rpow_lt_one_iff ] <;> norm_num
rcases Nat.even_or_odd' n with ⟨ k, rfl | rfl ⟩ <;> norm_num [ pow_add, pow_mul ] at *;
· linarith [ pow_le_pow_right₀ ( by norm_num : ( 1 : ℝ ) ≤ 4 ) hn_pos ];
· linarith [ pow_pos ( by norm_num : ( 0 : ℝ ) < 4 ) k ]
end Imo1976P6 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1976P6.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic"], "timeout_s": 600.0, "latency_s": 0.0767, "verified_at": "2026-03-26T18:16:41.346100+00:00"}} | false | true | false | 0.0767 |
compfiles_Imo1977P2 | compfiles | Copyright (c) 2026 Constantin Seebach. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1977, Problem 2
In a finite sequence of real numbers the sum of any seven successive terms is negative and the sum of any eleven successive terms is positive.
Determine the maximum number of terms in the sequence.
-/
namespace Imo1977P2
def sum_successive_terms {α : Type} [AddCommMonoid α] {n : ℕ} (s : Fin n → α) (start : Fin n) (count : ℕ) [NeZero count] (h : start+count-1 < n) : α :=
∑ i ∈ Finset.Icc start ⟨start+count-1, h⟩, s i
open Matrix
@[coe]
def coeFunctionInt2Real {α : Type*} (f : α → ℤ) : (α → ℝ) := fun x => (f x).cast
instance {α : Type*} : Coe (α → ℤ) (α → ℝ) := {
coe := coeFunctionInt2Real
}
theorem sum_successive_terms_intCast {n : ℕ} (s : Fin n → ℤ) (start : Fin n) (count : ℕ) [NeZero count] (h : start+count-1 < n) :
sum_successive_terms s start count h = (sum_successive_terms s start count h : ℝ) := by
unfold sum_successive_terms coeFunctionInt2Real
simp
def example_16_int : Fin 16 → ℤ := ![5, 5, -13, 5, 5, 5, -13, 5, 5, -13, 5, 5, 5, -13, 5, 5]
def example_16 : Fin 16 → ℝ := (example_16_int : Fin 16 → ℝ)
abbrev max_num_terms : ℕ := 16
theorem imo1977_p2 :
Maximal (λn ↦ ∃ s : Fin n → ℝ, ∀ i0, (∀ h7, sum_successive_terms s i0 7 h7 < 0) ∧ (∀ h11, sum_successive_terms s i0 11 h11 > 0)) max_num_terms := by
rw [maximal_iff_forall_gt]
and_intros
· use example_16
intro i0
and_intros <;> {
intro _
unfold example_16
rw [<-sum_successive_terms_intCast]
simp only [gt_iff_lt, Int.cast_pos, Int.cast_lt_zero]
decide +revert
}
· intro n ngt
have := NeZero.of_gt ngt
simp only [Nat.add_one_sub_one, gt_iff_lt, not_exists, not_forall, not_and, not_lt]
intro x
by_contra! c
let A : Matrix (Fin 7) (Fin 11) ℝ :=
fun (i) (j) ↦ x ⟨i.val+j.val, by omega⟩
have rneg : ∀ j, (1 ᵥ* A) j < 0 := by
intro j
unfold A
rw [Matrix.vecMul_eq_sum]
simp only [Finset.sum_apply]
have := (c (j.castLT (by omega))).left (by rw [Fin.val_castLT]; omega)
unfold sum_successive_terms at this
apply this.trans_eq'
apply Finset.sum_bij' (fun x h => ⟨x.val-j.val, by grind⟩) (fun y _ => ⟨j.val+y.val, by omega⟩) <;> {
simp <;> grind only [= Fin.val_castLT, = Lean.Grind.toInt_fin, = Finset.mem_Icc]
}
have cpos : ∀ j, (A *ᵥ 1) j > 0 := by
intro j
unfold A
rw [Matrix.mulVec_eq_sum]
simp only [ Finset.sum_apply, gt_iff_lt]
have := (c (j.castLT (by omega))).right (by rw [Fin.val_castLT]; omega)
unfold sum_successive_terms at this
apply this.trans_eq
apply Finset.sum_bij' (fun x h => ⟨x.val-j.val, by grind⟩) (fun y _ => ⟨j.val+y.val, by omega⟩) <;> {
simp <;> grind only [= Fin.val_castLT, = Lean.Grind.toInt_fin, = Finset.mem_Icc]
}
have : (1 ᵥ* A) ⬝ᵥ 1 < 0 := by
rw [dotProduct_one]
apply Fintype.sum_neg
exact lt_of_strongLT rneg
have : 0 < (1 ᵥ* A) ⬝ᵥ 1 := by
rw [<-Matrix.dotProduct_mulVec, one_dotProduct]
apply Fintype.sum_pos
exact lt_of_strongLT cpos
linarith
end Imo1977P2 | /- | /-
Copyright (c) 2026 Constantin Seebach. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1977, Problem 2
In a finite sequence of real numbers the sum of any seven successive terms is negative and the sum of any eleven successive terms is positive.
Determine the maximum number of terms in the sequence.
-/
namespace Imo1977P2
def sum_successive_terms {α : Type} [AddCommMonoid α] {n : ℕ} (s : Fin n → α) (start : Fin n) (count : ℕ) [NeZero count] (h : start+count-1 < n) : α :=
∑ i ∈ Finset.Icc start ⟨start+count-1, h⟩, s i
open Matrix
@[coe]
def coeFunctionInt2Real {α : Type*} (f : α → ℤ) : (α → ℝ) := fun x => (f x).cast
instance {α : Type*} : Coe (α → ℤ) (α → ℝ) := {
coe := coeFunctionInt2Real
}
theorem sum_successive_terms_intCast {n : ℕ} (s : Fin n → ℤ) (start : Fin n) (count : ℕ) [NeZero count] (h : start+count-1 < n) :
sum_successive_terms s start count h = (sum_successive_terms s start count h : ℝ) := by
unfold sum_successive_terms coeFunctionInt2Real
simp
def example_16_int : Fin 16 → ℤ := ![5, 5, -13, 5, 5, 5, -13, 5, 5, -13, 5, 5, 5, -13, 5, 5]
def example_16 : Fin 16 → ℝ := (example_16_int : Fin 16 → ℝ)
abbrev max_num_terms : ℕ := 16
theorem imo1977_p2 :
Maximal (λn ↦ ∃ s : Fin n → ℝ, ∀ i0, (∀ h7, sum_successive_terms s i0 7 h7 < 0) ∧ (∀ h11, sum_successive_terms s i0 11 h11 > 0)) max_num_terms := by
rw [maximal_iff_forall_gt]
and_intros
· use example_16
intro i0
and_intros <;> {
intro _
unfold example_16
rw [<-sum_successive_terms_intCast]
simp only [gt_iff_lt, Int.cast_pos, Int.cast_lt_zero]
decide +revert
}
· intro n ngt
have := NeZero.of_gt ngt
simp only [Nat.add_one_sub_one, gt_iff_lt, not_exists, not_forall, not_and, not_lt]
intro x
by_contra! c
let A : Matrix (Fin 7) (Fin 11) ℝ :=
fun (i) (j) ↦ x ⟨i.val+j.val, by omega⟩
have rneg : ∀ j, (1 ᵥ* A) j < 0 := by
intro j
unfold A
rw [Matrix.vecMul_eq_sum]
simp only [Finset.sum_apply]
have := (c (j.castLT (by omega))).left (by rw [Fin.val_castLT]; omega)
unfold sum_successive_terms at this
apply this.trans_eq'
apply Finset.sum_bij' (fun x h => ⟨x.val-j.val, by grind⟩) (fun y _ => ⟨j.val+y.val, by omega⟩) <;> {
simp <;> grind only [= Fin.val_castLT, = Lean.Grind.toInt_fin, = Finset.mem_Icc]
}
have cpos : ∀ j, (A *ᵥ 1) j > 0 := by
intro j
unfold A
rw [Matrix.mulVec_eq_sum]
simp only [ Finset.sum_apply, gt_iff_lt]
have := (c (j.castLT (by omega))).right (by rw [Fin.val_castLT]; omega)
unfold sum_successive_terms at this
apply this.trans_eq
apply Finset.sum_bij' (fun x h => ⟨x.val-j.val, by grind⟩) (fun y _ => ⟨j.val+y.val, by omega⟩) <;> {
simp <;> grind only [= Fin.val_castLT, = Lean.Grind.toInt_fin, = Finset.mem_Icc]
}
have : (1 ᵥ* A) ⬝ᵥ 1 < 0 := by
rw [dotProduct_one]
apply Fintype.sum_neg
exact lt_of_strongLT rneg
have : 0 < (1 ᵥ* A) ⬝ᵥ 1 := by
rw [<-Matrix.dotProduct_mulVec, one_dotProduct]
apply Fintype.sum_pos
exact lt_of_strongLT cpos
linarith
end Imo1977P2
| true | Copyright (c) 2026 Constantin Seebach. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1977, Problem 2
In a finite sequence of real numbers the sum of any seven successive terms is negative and the sum of any eleven successive terms is positive.
Determine the maximum number of terms in the sequence.
-/
namespace Imo1977P2
def sum_successive_terms {α : Type} [AddCommMonoid α] {n : ℕ} (s : Fin n → α) (start : Fin n) (count : ℕ) [NeZero count] (h : start+count-1 < n) : α :=
∑ i ∈ Finset.Icc start ⟨start+count-1, h⟩, s i
open Matrix
@[coe]
def coeFunctionInt2Real {α : Type*} (f : α → ℤ) : (α → ℝ) := fun x => (f x).cast
instance {α : Type*} : Coe (α → ℤ) (α → ℝ) := {
coe := coeFunctionInt2Real
}
theorem sum_successive_terms_intCast {n : ℕ} (s : Fin n → ℤ) (start : Fin n) (count : ℕ) [NeZero count] (h : start+count-1 < n) :
sum_successive_terms s start count h = (sum_successive_terms s start count h : ℝ) := by
unfold sum_successive_terms coeFunctionInt2Real
simp
def example_16_int : Fin 16 → ℤ := ![5, 5, -13, 5, 5, 5, -13, 5, 5, -13, 5, 5, 5, -13, 5, 5]
def example_16 : Fin 16 → ℝ := (example_16_int : Fin 16 → ℝ)
abbrev max_num_terms : ℕ := 16
theorem imo1977_p2 :
Maximal (λn ↦ ∃ s : Fin n → ℝ, ∀ i0, (∀ h7, sum_successive_terms s i0 7 h7 < 0) ∧ (∀ h11, sum_successive_terms s i0 11 h11 > 0)) max_num_terms := by
rw [maximal_iff_forall_gt]
and_intros
· use example_16
intro i0
and_intros <;> {
intro _
unfold example_16
rw [<-sum_successive_terms_intCast]
simp only [gt_iff_lt, Int.cast_pos, Int.cast_lt_zero]
decide +revert
}
· intro n ngt
have := NeZero.of_gt ngt
simp only [Nat.add_one_sub_one, gt_iff_lt, not_exists, not_forall, not_and, not_lt]
intro x
by_contra! c
let A : Matrix (Fin 7) (Fin 11) ℝ :=
fun (i) (j) ↦ x ⟨i.val+j.val, by omega⟩
have rneg : ∀ j, (1 ᵥ* A) j < 0 := by
intro j
unfold A
rw [Matrix.vecMul_eq_sum]
simp only [Finset.sum_apply]
have := (c (j.castLT (by omega))).left (by rw [Fin.val_castLT]; omega)
unfold sum_successive_terms at this
apply this.trans_eq'
apply Finset.sum_bij' (fun x h => ⟨x.val-j.val, by grind⟩) (fun y _ => ⟨j.val+y.val, by omega⟩) <;> {
simp <;> grind only [= Fin.val_castLT, = Lean.Grind.toInt_fin, = Finset.mem_Icc]
}
have cpos : ∀ j, (A *ᵥ 1) j > 0 := by
intro j
unfold A
rw [Matrix.mulVec_eq_sum]
simp only [ Finset.sum_apply, gt_iff_lt]
have := (c (j.castLT (by omega))).right (by rw [Fin.val_castLT]; omega)
unfold sum_successive_terms at this
apply this.trans_eq
apply Finset.sum_bij' (fun x h => ⟨x.val-j.val, by grind⟩) (fun y _ => ⟨j.val+y.val, by omega⟩) <;> {
simp <;> grind only [= Fin.val_castLT, = Lean.Grind.toInt_fin, = Finset.mem_Icc]
}
have : (1 ᵥ* A) ⬝ᵥ 1 < 0 := by
rw [dotProduct_one]
apply Fintype.sum_neg
exact lt_of_strongLT rneg
have : 0 < (1 ᵥ* A) ⬝ᵥ 1 := by
rw [<-Matrix.dotProduct_mulVec, one_dotProduct]
apply Fintype.sum_pos
exact lt_of_strongLT cpos
linarith
end Imo1977P2 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1977P2.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unsolved goals\nn : \u2115\nngt : max_num_terms < n\nthis : NeZero n\nx : Fin n \u2192 \u211d\nc :\n \u2200 (x_1 : Fin n),\n (\u2200 (h7 : \u2191x_1 + 6 < n), sum_successive_terms x x_1 7 h7 < 0) \u2227\n \u2200 (h : \u2191x_1 + 10 < n), 0 < sum_successive_terms x x_1 11 \u22ef\ni : Fin 7\nj : Fin 11\n\u22a2 \u2191i + \u2191j < n", "unsolved goals\ncase refine_2\nn : \u2115\nngt : max_num_terms < n\nthis : NeZero n\nx : Fin n \u2192 \u211d\nc :\n \u2200 (x_1 : Fin n),\n (\u2200 (h7 : \u2191x_1 + 6 < n), sum_successive_terms x x_1 7 h7 < 0) \u2227\n \u2200 (h : \u2191x_1 + 10 < n), 0 < sum_successive_terms x x_1 11 \u22ef\nA : Matrix (Fin 7) (Fin 11) \u211d := fun i j => x \u27e8\u2191i + \u2191j, \u22ef\u27e9\n\u22a2 False"], "timeout_s": 600.0, "latency_s": 1.0745, "verified_at": "2026-03-26T18:16:42.344245+00:00"}} | false | true | false | 1.0745 |
compfiles_Imo1977P4 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Goedel-Prover-V2
-/
import Mathlib
/-!
# International Mathematical Olympiad 1977, Problem 4
Define f(x) = 1 - a cos x - b sin x - A cos 2x - B sin 2x,
where a, b, A, B are real constants.
Suppose that f(x) ≥ 0 for all real x.
Prove that a^2 + b^2 ≤ 2 and A^2 + B^2 ≤ 1.
-/
namespace Imo1977P4
theorem imo1977_p4 (f : ℝ → ℝ) (a b A B : ℝ)
(h₀ : ∀ x, f x = 1 - a * Real.cos x - b * Real.sin x -
A * Real.cos (2 * x) - B * Real.sin (2 * x))
(h₁ : ∀ x, f x ≥ 0) :
a ^ 2 + b ^ 2 ≤ 2 ∧ A ^ 2 + B ^ 2 ≤ 1 := by
have h₂ : A ^ 2 + B ^ 2 ≤ 1 := by
by_contra! h
have h₅ : 0 < A ^ 2 + B ^ 2 := by positivity
set R : ℝ := Real.sqrt (A ^ 2 + B ^ 2) with hR_def
have hR_pos : 0 < R := Real.sqrt_pos.mpr h₅
have hR_sq : R ^ 2 = A ^ 2 + B ^ 2 := Real.sq_sqrt (by positivity)
set p : ℝ := A / R with hp_def
set q : ℝ := B / R with hq_def
have hpq_sq : p ^ 2 + q ^ 2 = 1 := by
calc
p ^ 2 + q ^ 2 = (A / R) ^ 2 + (B / R) ^ 2 := by rw [hp_def, hq_def]
_ = (A ^ 2 + B ^ 2) / R ^ 2 := by
field_simp [hR_pos.ne']
_ = 1 := by
rw [hR_sq]
field_simp [hR_pos.ne']
have hpn1 : -1 ≤ p := by nlinarith only [hpq_sq]
have hp1 : p ≤ 1 := by nlinarith only [hpq_sq]
have hθ : ∃ (θ : ℝ), Real.cos θ = p ∧ Real.sin θ = q := by
by_cases hq_nonneg : q ≥ 0
· use Real.arccos p
have h₈ : Real.sin (Real.arccos p) = Real.sqrt (1 - p ^ 2) := by
rw [Real.sin_arccos]
have h₉ : Real.sqrt (1 - p ^ 2) = q := by
have h₁₁ : q ^ 2 = 1 - p ^ 2 := (sub_eq_of_eq_add' hpq_sq.symm).symm
have h₁₂ : Real.sqrt (1 - p ^ 2) = q := by
rw [Real.sqrt_eq_iff_eq_sq _ hq_nonneg] <;> nlinarith only [h₁₁]
exact h₁₂
exact ⟨Real.cos_arccos hpn1 hp1, by linarith only [h₈, h₉]⟩
· use -Real.arccos p
have h₇ : Real.cos (-Real.arccos p) = p := by
rw [Real.cos_neg, Real.cos_arccos hpn1 hp1]
have h₈ : Real.sin (-Real.arccos p) = -Real.sqrt (1 - p ^ 2) := by
rw [Real.sin_neg, Real.sin_arccos]
have h₉ : -Real.sqrt (1 - p ^ 2) = q := by
have h₁₀ : q < 0 := lt_of_not_ge hq_nonneg
have h₁₁ : q ^ 2 = 1 - p ^ 2 := (sub_eq_of_eq_add' hpq_sq.symm).symm
have h₁₂ : Real.sqrt (1 - p ^ 2) = -q := by
rw [Real.sqrt_eq_iff_eq_sq] <;> nlinarith only [h₁₀, h₁₁]
exact neg_eq_iff_eq_neg.mpr h₁₂
exact ⟨h₇, by linarith only [h₈, h₉]⟩
obtain ⟨θ, hθ_cos, hθ_sin⟩ := hθ
have h₁₀ : A * Real.cos θ + B * Real.sin θ = R := by
calc
A * Real.cos θ + B * Real.sin θ = R * p * Real.cos θ + R * q * Real.sin θ := by
rw [hp_def, hq_def]
field_simp [hR_pos.ne']
_ = R * (p * Real.cos θ + q * Real.sin θ) := by ring
_ = R * (p * p + q * q) := by
rw [hθ_cos, hθ_sin]
_ = R * 1 := by
have h₁₂ : p * p + q * q = 1 := by simp only [←sq, hpq_sq]
rw [h₁₂]
_ = R := by ring
have h₁₁ : A * Real.cos θ + B * Real.sin θ > 1 := by
have h₁₂ : R > 1 := by
rw [hR_def, gt_iff_lt, ←one_lt_sq_iff₀ (a := √(A^2 + B^2)) (by positivity)]
rw [Real.sq_sqrt (by positivity)]
exact h
linarith only [h₁₀, h₁₂]
have h₁₂ : A * Real.cos (2 * (θ / 2)) + B * Real.sin (2 * (θ / 2)) > 1 := by
have h₁₃ : Real.cos (2 * (θ / 2)) = Real.cos θ := by ring_nf
have h₁₄ : Real.sin (2 * (θ / 2)) = Real.sin θ := by ring_nf
omega
have h₁₃ : A * Real.cos (2 * (θ / 2)) + B * Real.sin (2 * (θ / 2)) ≤ 1 := by
have h₁₄ : f (θ / 2) + f (θ / 2 + Real.pi) ≥ 0 :=
Left.add_nonneg (h₁ (θ / 2)) (h₁ (θ / 2 + Real.pi))
have h₁₅ : f (θ / 2) + f (θ / 2 + Real.pi) = 2 - 2 * (A * Real.cos (2 * (θ / 2)) + B * Real.sin (2 * (θ / 2))) := by
have h₁₆ : f (θ / 2) = 1 - a * Real.cos (θ / 2) - b * Real.sin (θ / 2) - A * Real.cos (2 * (θ / 2)) - B * Real.sin (2 * (θ / 2)) := by
rw [h₀]
have h₁₇ : f (θ / 2 + Real.pi) = 1 - a * Real.cos (θ / 2 + Real.pi) - b * Real.sin (θ / 2 + Real.pi) - A * Real.cos (2 * (θ / 2 + Real.pi)) - B * Real.sin (2 * (θ / 2 + Real.pi)) := by
rw [h₀]
rw [h₁₆, h₁₇]
have h₁₈ : Real.cos (θ / 2 + Real.pi) = -Real.cos (θ / 2) := by
rw [Real.cos_add]
simp [Real.cos_pi, Real.sin_pi]
have h₁₉ : Real.sin (θ / 2 + Real.pi) = -Real.sin (θ / 2) := by
rw [Real.sin_add]
simp [Real.cos_pi, Real.sin_pi]
have h₂₀ : Real.cos (2 * (θ / 2 + Real.pi)) = Real.cos (2 * (θ / 2)) := by
have h₂₁ : 2 * (θ / 2 + Real.pi) = 2 * (θ / 2) + 2 * Real.pi := by ring_nf
rw [h₂₁]
exact Real.cos_add_two_pi (2 * (θ / 2))
have h₂₁ : Real.sin (2 * (θ / 2 + Real.pi)) = Real.sin (2 * (θ / 2)) := by
have h₂₂ : 2 * (θ / 2 + Real.pi) = 2 * (θ / 2) + 2 * Real.pi := by ring_nf
rw [h₂₂]
exact Real.sin_add_two_pi (2 * (θ / 2))
rw [h₁₈, h₁₉, h₂₀, h₂₁]
ring_nf
rw [h₁₅] at h₁₄
linarith only [h₁₄]
exact not_lt_of_ge h₁₃ h₁₂
have h₃ : a ^ 2 + b ^ 2 ≤ 2 := by
by_contra! h
set C : ℝ := a + b with hC_def
set D : ℝ := a - b with hD_def
have hC_sq_add_D_sq : C ^ 2 + D ^ 2 = 2 * (a ^ 2 + b ^ 2) := by
calc
C ^ 2 + D ^ 2 = (a + b) ^ 2 + (a - b) ^ 2 := by rw [hC_def, hD_def]
_ = 2 * (a ^ 2 + b ^ 2) := by ring
have hC_sq_add_D_sq_gt_4 : C ^ 2 + D ^ 2 > 4 := by
linarith only [h, hC_sq_add_D_sq]
set R : ℝ := Real.sqrt (C ^ 2 + D ^ 2) with hR_def
have hR_pos : 0 < R := by positivity
have hR_sq : R ^ 2 = C ^ 2 + D ^ 2 := Real.sq_sqrt (by positivity)
set p : ℝ := C / R with hp_def
set q : ℝ := D / R with hq_def
have hpq_sq : p ^ 2 + q ^ 2 = 1 := by
calc
p ^ 2 + q ^ 2 = (C / R) ^ 2 + (D / R) ^ 2 := by rw [hp_def, hq_def]
_ = (C ^ 2 + D ^ 2) / R ^ 2 := by
field_simp [hR_pos.ne']
_ = 1 := by
rw [hR_sq]
field_simp [hR_pos.ne']
have hpn1 : -1 ≤ p := by nlinarith only [hpq_sq]
have hp1 : p ≤ 1 := by nlinarith only [hpq_sq]
have hθ : ∃ (θ : ℝ), Real.cos θ = p ∧ Real.sin θ = -q := by
by_cases hq_nonneg : q ≥ 0
· use -Real.arccos p
have h₅ : Real.cos (-Real.arccos p) = p := by
rw [Real.cos_neg, Real.cos_arccos hpn1 hp1]
have h₆ : Real.sin (-Real.arccos p) = -Real.sqrt (1 - p ^ 2) := by
rw [Real.sin_neg, Real.sin_arccos]
have h₇ : -Real.sqrt (1 - p ^ 2) = -q := by
have h₈ : q ≥ 0 := hq_nonneg
have h₉ : q ^ 2 = 1 - p ^ 2 := (sub_eq_of_eq_add' hpq_sq.symm).symm
congr 1
rw [Real.sqrt_eq_iff_eq_sq] <;> nlinarith only [h₈, h₉]
exact ⟨h₅, h₆.trans h₇⟩
· use Real.arccos p
have h₆ : Real.sin (Real.arccos p) = Real.sqrt (1 - p ^ 2) := by
rw [Real.sin_arccos]
have h₇ : Real.sqrt (1 - p ^ 2) = -q := by
have h₈ : q < 0 := lt_of_not_ge hq_nonneg
have h₉ : q ^ 2 = 1 - p ^ 2 := (sub_eq_of_eq_add' hpq_sq.symm).symm
rw [Real.sqrt_eq_iff_eq_sq] <;> nlinarith only [h₈, h₉]
exact ⟨Real.cos_arccos hpn1 hp1, by rw [h₆, h₇]⟩
obtain ⟨θ, hθ_cos, hθ_sin⟩ := hθ
have h₅ : C * Real.cos θ - D * Real.sin θ = R := by
calc
C * Real.cos θ - D * Real.sin θ = R * p * Real.cos θ - R * q * Real.sin θ := by
rw [hp_def, hq_def]
ring_nf
field_simp [hR_pos.ne']
_ = R * (p * Real.cos θ - q * Real.sin θ) := by ring
_ = R * (p * p + q * q) := by
rw [hθ_cos, hθ_sin]
ring_nf
_ = R * 1 := by
have h₆ : p ^ 2 + q ^ 2 = 1 := hpq_sq
have h₇ : p * p + q * q = 1 := by simp only [←sq, h₆]
rw [h₇]
_ = R := by ring
have h₆ : C * Real.cos θ - D * Real.sin θ > 2 := by
have h₇ : R > 2 := by
have h₉ : C ^ 2 + D ^ 2 > 4 := hC_sq_add_D_sq_gt_4
rw [←hR_sq, show 4 = (2:ℝ)^2 by norm_num] at h₉
exact (sq_lt_sq₀ (by positivity) (by positivity)).mp h₉
omega
have h₇ : C * Real.cos θ - D * Real.sin θ ≤ 2 := by
have h₈ : f θ + f (θ + Real.pi / 2) ≥ 0 := by
exact Left.add_nonneg (h₁ θ) (h₁ (θ + Real.pi / 2))
have h₉ : f θ + f (θ + Real.pi / 2) = 2 - (C * Real.cos θ - D * Real.sin θ) := by
have h₁₀ : f θ = 1 - a * Real.cos θ - b * Real.sin θ - A * Real.cos (2 * θ) - B * Real.sin (2 * θ) := by
rw [h₀]
have h₁₁ : f (θ + Real.pi / 2) = 1 - a * Real.cos (θ + Real.pi / 2) - b * Real.sin (θ + Real.pi / 2) - A * Real.cos (2 * (θ + Real.pi / 2)) - B * Real.sin (2 * (θ + Real.pi / 2)) := by
rw [h₀]
rw [h₁₀, h₁₁]
have h₁₄ : Real.cos (2 * (θ + Real.pi / 2)) = -Real.cos (2 * θ) := by
have h₁₅ : 2 * (θ + Real.pi / 2) = 2 * θ + Real.pi := by ring_nf
rw [h₁₅]
exact Real.cos_add_pi _
have h₁₅ : Real.sin (2 * (θ + Real.pi / 2)) = -Real.sin (2 * θ) := by
have h₁₆ : 2 * (θ + Real.pi / 2) = 2 * θ + Real.pi := by ring_nf
rw [h₁₆]
exact Real.sin_add_pi _
rw [Real.cos_add_pi_div_two θ, Real.sin_add_pi_div_two θ, h₁₄, h₁₅]
have h₁₆ : C = a + b := by rw [hC_def]
have h₁₇ : D = a - b := by rw [hD_def]
simp only [h₁₆, h₁₇] at *
ring_nf at *
rw [h₉] at h₈
linarith only [h₈]
exact not_lt_of_ge h₇ h₆
exact ⟨h₃, h₂⟩
end Imo1977P4 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Goedel-Prover-V2
-/
import Mathlib
/-!
# International Mathematical Olympiad 1977, Problem 4
Define f(x) = 1 - a cos x - b sin x - A cos 2x - B sin 2x,
where a, b, A, B are real constants.
Suppose that f(x) ≥ 0 for all real x.
Prove that a^2 + b^2 ≤ 2 and A^2 + B^2 ≤ 1.
-/
namespace Imo1977P4
theorem imo1977_p4 (f : ℝ → ℝ) (a b A B : ℝ)
(h₀ : ∀ x, f x = 1 - a * Real.cos x - b * Real.sin x -
A * Real.cos (2 * x) - B * Real.sin (2 * x))
(h₁ : ∀ x, f x ≥ 0) :
a ^ 2 + b ^ 2 ≤ 2 ∧ A ^ 2 + B ^ 2 ≤ 1 := by
have h₂ : A ^ 2 + B ^ 2 ≤ 1 := by
by_contra! h
have h₅ : 0 < A ^ 2 + B ^ 2 := by positivity
set R : ℝ := Real.sqrt (A ^ 2 + B ^ 2) with hR_def
have hR_pos : 0 < R := Real.sqrt_pos.mpr h₅
have hR_sq : R ^ 2 = A ^ 2 + B ^ 2 := Real.sq_sqrt (by positivity)
set p : ℝ := A / R with hp_def
set q : ℝ := B / R with hq_def
have hpq_sq : p ^ 2 + q ^ 2 = 1 := by
calc
p ^ 2 + q ^ 2 = (A / R) ^ 2 + (B / R) ^ 2 := by rw [hp_def, hq_def]
_ = (A ^ 2 + B ^ 2) / R ^ 2 := by
field_simp [hR_pos.ne']
_ = 1 := by
rw [hR_sq]
field_simp [hR_pos.ne']
have hpn1 : -1 ≤ p := by nlinarith only [hpq_sq]
have hp1 : p ≤ 1 := by nlinarith only [hpq_sq]
have hθ : ∃ (θ : ℝ), Real.cos θ = p ∧ Real.sin θ = q := by
by_cases hq_nonneg : q ≥ 0
· use Real.arccos p
have h₈ : Real.sin (Real.arccos p) = Real.sqrt (1 - p ^ 2) := by
rw [Real.sin_arccos]
have h₉ : Real.sqrt (1 - p ^ 2) = q := by
have h₁₁ : q ^ 2 = 1 - p ^ 2 := (sub_eq_of_eq_add' hpq_sq.symm).symm
have h₁₂ : Real.sqrt (1 - p ^ 2) = q := by
rw [Real.sqrt_eq_iff_eq_sq _ hq_nonneg] <;> nlinarith only [h₁₁]
exact h₁₂
exact ⟨Real.cos_arccos hpn1 hp1, by linarith only [h₈, h₉]⟩
· use -Real.arccos p
have h₇ : Real.cos (-Real.arccos p) = p := by
rw [Real.cos_neg, Real.cos_arccos hpn1 hp1]
have h₈ : Real.sin (-Real.arccos p) = -Real.sqrt (1 - p ^ 2) := by
rw [Real.sin_neg, Real.sin_arccos]
have h₉ : -Real.sqrt (1 - p ^ 2) = q := by
have h₁₀ : q < 0 := lt_of_not_ge hq_nonneg
have h₁₁ : q ^ 2 = 1 - p ^ 2 := (sub_eq_of_eq_add' hpq_sq.symm).symm
have h₁₂ : Real.sqrt (1 - p ^ 2) = -q := by
rw [Real.sqrt_eq_iff_eq_sq] <;> nlinarith only [h₁₀, h₁₁]
exact neg_eq_iff_eq_neg.mpr h₁₂
exact ⟨h₇, by linarith only [h₈, h₉]⟩
obtain ⟨θ, hθ_cos, hθ_sin⟩ := hθ
have h₁₀ : A * Real.cos θ + B * Real.sin θ = R := by
calc
A * Real.cos θ + B * Real.sin θ = R * p * Real.cos θ + R * q * Real.sin θ := by
rw [hp_def, hq_def]
field_simp [hR_pos.ne']
_ = R * (p * Real.cos θ + q * Real.sin θ) := by ring
_ = R * (p * p + q * q) := by
rw [hθ_cos, hθ_sin]
_ = R * 1 := by
have h₁₂ : p * p + q * q = 1 := by simp only [←sq, hpq_sq]
rw [h₁₂]
_ = R := by ring
have h₁₁ : A * Real.cos θ + B * Real.sin θ > 1 := by
have h₁₂ : R > 1 := by
rw [hR_def, gt_iff_lt, ←one_lt_sq_iff₀ (a := √(A^2 + B^2)) (by positivity)]
rw [Real.sq_sqrt (by positivity)]
exact h
linarith only [h₁₀, h₁₂]
have h₁₂ : A * Real.cos (2 * (θ / 2)) + B * Real.sin (2 * (θ / 2)) > 1 := by
have h₁₃ : Real.cos (2 * (θ / 2)) = Real.cos θ := by ring_nf
have h₁₄ : Real.sin (2 * (θ / 2)) = Real.sin θ := by ring_nf
omega
have h₁₃ : A * Real.cos (2 * (θ / 2)) + B * Real.sin (2 * (θ / 2)) ≤ 1 := by
have h₁₄ : f (θ / 2) + f (θ / 2 + Real.pi) ≥ 0 :=
Left.add_nonneg (h₁ (θ / 2)) (h₁ (θ / 2 + Real.pi))
have h₁₅ : f (θ / 2) + f (θ / 2 + Real.pi) = 2 - 2 * (A * Real.cos (2 * (θ / 2)) + B * Real.sin (2 * (θ / 2))) := by
have h₁₆ : f (θ / 2) = 1 - a * Real.cos (θ / 2) - b * Real.sin (θ / 2) - A * Real.cos (2 * (θ / 2)) - B * Real.sin (2 * (θ / 2)) := by
rw [h₀]
have h₁₇ : f (θ / 2 + Real.pi) = 1 - a * Real.cos (θ / 2 + Real.pi) - b * Real.sin (θ / 2 + Real.pi) - A * Real.cos (2 * (θ / 2 + Real.pi)) - B * Real.sin (2 * (θ / 2 + Real.pi)) := by
rw [h₀]
rw [h₁₆, h₁₇]
have h₁₈ : Real.cos (θ / 2 + Real.pi) = -Real.cos (θ / 2) := by
rw [Real.cos_add]
simp [Real.cos_pi, Real.sin_pi]
have h₁₉ : Real.sin (θ / 2 + Real.pi) = -Real.sin (θ / 2) := by
rw [Real.sin_add]
simp [Real.cos_pi, Real.sin_pi]
have h₂₀ : Real.cos (2 * (θ / 2 + Real.pi)) = Real.cos (2 * (θ / 2)) := by
have h₂₁ : 2 * (θ / 2 + Real.pi) = 2 * (θ / 2) + 2 * Real.pi := by ring_nf
rw [h₂₁]
exact Real.cos_add_two_pi (2 * (θ / 2))
have h₂₁ : Real.sin (2 * (θ / 2 + Real.pi)) = Real.sin (2 * (θ / 2)) := by
have h₂₂ : 2 * (θ / 2 + Real.pi) = 2 * (θ / 2) + 2 * Real.pi := by ring_nf
rw [h₂₂]
exact Real.sin_add_two_pi (2 * (θ / 2))
rw [h₁₈, h₁₉, h₂₀, h₂₁]
ring_nf
rw [h₁₅] at h₁₄
linarith only [h₁₄]
exact not_lt_of_ge h₁₃ h₁₂
have h₃ : a ^ 2 + b ^ 2 ≤ 2 := by
by_contra! h
set C : ℝ := a + b with hC_def
set D : ℝ := a - b with hD_def
have hC_sq_add_D_sq : C ^ 2 + D ^ 2 = 2 * (a ^ 2 + b ^ 2) := by
calc
C ^ 2 + D ^ 2 = (a + b) ^ 2 + (a - b) ^ 2 := by rw [hC_def, hD_def]
_ = 2 * (a ^ 2 + b ^ 2) := by ring
have hC_sq_add_D_sq_gt_4 : C ^ 2 + D ^ 2 > 4 := by
linarith only [h, hC_sq_add_D_sq]
set R : ℝ := Real.sqrt (C ^ 2 + D ^ 2) with hR_def
have hR_pos : 0 < R := by positivity
have hR_sq : R ^ 2 = C ^ 2 + D ^ 2 := Real.sq_sqrt (by positivity)
set p : ℝ := C / R with hp_def
set q : ℝ := D / R with hq_def
have hpq_sq : p ^ 2 + q ^ 2 = 1 := by
calc
p ^ 2 + q ^ 2 = (C / R) ^ 2 + (D / R) ^ 2 := by rw [hp_def, hq_def]
_ = (C ^ 2 + D ^ 2) / R ^ 2 := by
field_simp [hR_pos.ne']
_ = 1 := by
rw [hR_sq]
field_simp [hR_pos.ne']
have hpn1 : -1 ≤ p := by nlinarith only [hpq_sq]
have hp1 : p ≤ 1 := by nlinarith only [hpq_sq]
have hθ : ∃ (θ : ℝ), Real.cos θ = p ∧ Real.sin θ = -q := by
by_cases hq_nonneg : q ≥ 0
· use -Real.arccos p
have h₅ : Real.cos (-Real.arccos p) = p := by
rw [Real.cos_neg, Real.cos_arccos hpn1 hp1]
have h₆ : Real.sin (-Real.arccos p) = -Real.sqrt (1 - p ^ 2) := by
rw [Real.sin_neg, Real.sin_arccos]
have h₇ : -Real.sqrt (1 - p ^ 2) = -q := by
have h₈ : q ≥ 0 := hq_nonneg
have h₉ : q ^ 2 = 1 - p ^ 2 := (sub_eq_of_eq_add' hpq_sq.symm).symm
congr 1
rw [Real.sqrt_eq_iff_eq_sq] <;> nlinarith only [h₈, h₉]
exact ⟨h₅, h₆.trans h₇⟩
· use Real.arccos p
have h₆ : Real.sin (Real.arccos p) = Real.sqrt (1 - p ^ 2) := by
rw [Real.sin_arccos]
have h₇ : Real.sqrt (1 - p ^ 2) = -q := by
have h₈ : q < 0 := lt_of_not_ge hq_nonneg
have h₉ : q ^ 2 = 1 - p ^ 2 := (sub_eq_of_eq_add' hpq_sq.symm).symm
rw [Real.sqrt_eq_iff_eq_sq] <;> nlinarith only [h₈, h₉]
exact ⟨Real.cos_arccos hpn1 hp1, by rw [h₆, h₇]⟩
obtain ⟨θ, hθ_cos, hθ_sin⟩ := hθ
have h₅ : C * Real.cos θ - D * Real.sin θ = R := by
calc
C * Real.cos θ - D * Real.sin θ = R * p * Real.cos θ - R * q * Real.sin θ := by
rw [hp_def, hq_def]
ring_nf
field_simp [hR_pos.ne']
_ = R * (p * Real.cos θ - q * Real.sin θ) := by ring
_ = R * (p * p + q * q) := by
rw [hθ_cos, hθ_sin]
ring_nf
_ = R * 1 := by
have h₆ : p ^ 2 + q ^ 2 = 1 := hpq_sq
have h₇ : p * p + q * q = 1 := by simp only [←sq, h₆]
rw [h₇]
_ = R := by ring
have h₆ : C * Real.cos θ - D * Real.sin θ > 2 := by
have h₇ : R > 2 := by
have h₉ : C ^ 2 + D ^ 2 > 4 := hC_sq_add_D_sq_gt_4
rw [←hR_sq, show 4 = (2:ℝ)^2 by norm_num] at h₉
exact (sq_lt_sq₀ (by positivity) (by positivity)).mp h₉
omega
have h₇ : C * Real.cos θ - D * Real.sin θ ≤ 2 := by
have h₈ : f θ + f (θ + Real.pi / 2) ≥ 0 := by
exact Left.add_nonneg (h₁ θ) (h₁ (θ + Real.pi / 2))
have h₉ : f θ + f (θ + Real.pi / 2) = 2 - (C * Real.cos θ - D * Real.sin θ) := by
have h₁₀ : f θ = 1 - a * Real.cos θ - b * Real.sin θ - A * Real.cos (2 * θ) - B * Real.sin (2 * θ) := by
rw [h₀]
have h₁₁ : f (θ + Real.pi / 2) = 1 - a * Real.cos (θ + Real.pi / 2) - b * Real.sin (θ + Real.pi / 2) - A * Real.cos (2 * (θ + Real.pi / 2)) - B * Real.sin (2 * (θ + Real.pi / 2)) := by
rw [h₀]
rw [h₁₀, h₁₁]
have h₁₄ : Real.cos (2 * (θ + Real.pi / 2)) = -Real.cos (2 * θ) := by
have h₁₅ : 2 * (θ + Real.pi / 2) = 2 * θ + Real.pi := by ring_nf
rw [h₁₅]
exact Real.cos_add_pi _
have h₁₅ : Real.sin (2 * (θ + Real.pi / 2)) = -Real.sin (2 * θ) := by
have h₁₆ : 2 * (θ + Real.pi / 2) = 2 * θ + Real.pi := by ring_nf
rw [h₁₆]
exact Real.sin_add_pi _
rw [Real.cos_add_pi_div_two θ, Real.sin_add_pi_div_two θ, h₁₄, h₁₅]
have h₁₆ : C = a + b := by rw [hC_def]
have h₁₇ : D = a - b := by rw [hD_def]
simp only [h₁₆, h₁₇] at *
ring_nf at *
rw [h₉] at h₈
linarith only [h₈]
exact not_lt_of_ge h₇ h₆
exact ⟨h₃, h₂⟩
end Imo1977P4
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Goedel-Prover-V2
-/
import Mathlib
/-!
# International Mathematical Olympiad 1977, Problem 4
Define f(x) = 1 - a cos x - b sin x - A cos 2x - B sin 2x,
where a, b, A, B are real constants.
Suppose that f(x) ≥ 0 for all real x.
Prove that a^2 + b^2 ≤ 2 and A^2 + B^2 ≤ 1.
-/
namespace Imo1977P4
theorem imo1977_p4 (f : ℝ → ℝ) (a b A B : ℝ)
(h₀ : ∀ x, f x = 1 - a * Real.cos x - b * Real.sin x -
A * Real.cos (2 * x) - B * Real.sin (2 * x))
(h₁ : ∀ x, f x ≥ 0) :
a ^ 2 + b ^ 2 ≤ 2 ∧ A ^ 2 + B ^ 2 ≤ 1 := by
have h₂ : A ^ 2 + B ^ 2 ≤ 1 := by
by_contra! h
have h₅ : 0 < A ^ 2 + B ^ 2 := by positivity
set R : ℝ := Real.sqrt (A ^ 2 + B ^ 2) with hR_def
have hR_pos : 0 < R := Real.sqrt_pos.mpr h₅
have hR_sq : R ^ 2 = A ^ 2 + B ^ 2 := Real.sq_sqrt (by positivity)
set p : ℝ := A / R with hp_def
set q : ℝ := B / R with hq_def
have hpq_sq : p ^ 2 + q ^ 2 = 1 := by
calc
p ^ 2 + q ^ 2 = (A / R) ^ 2 + (B / R) ^ 2 := by rw [hp_def, hq_def]
_ = (A ^ 2 + B ^ 2) / R ^ 2 := by
field_simp [hR_pos.ne']
_ = 1 := by
rw [hR_sq]
field_simp [hR_pos.ne']
have hpn1 : -1 ≤ p := by nlinarith only [hpq_sq]
have hp1 : p ≤ 1 := by nlinarith only [hpq_sq]
have hθ : ∃ (θ : ℝ), Real.cos θ = p ∧ Real.sin θ = q := by
by_cases hq_nonneg : q ≥ 0
· use Real.arccos p
have h₈ : Real.sin (Real.arccos p) = Real.sqrt (1 - p ^ 2) := by
rw [Real.sin_arccos]
have h₉ : Real.sqrt (1 - p ^ 2) = q := by
have h₁₁ : q ^ 2 = 1 - p ^ 2 := (sub_eq_of_eq_add' hpq_sq.symm).symm
have h₁₂ : Real.sqrt (1 - p ^ 2) = q := by
rw [Real.sqrt_eq_iff_eq_sq _ hq_nonneg] <;> nlinarith only [h₁₁]
exact h₁₂
exact ⟨Real.cos_arccos hpn1 hp1, by linarith only [h₈, h₉]⟩
· use -Real.arccos p
have h₇ : Real.cos (-Real.arccos p) = p := by
rw [Real.cos_neg, Real.cos_arccos hpn1 hp1]
have h₈ : Real.sin (-Real.arccos p) = -Real.sqrt (1 - p ^ 2) := by
rw [Real.sin_neg, Real.sin_arccos]
have h₉ : -Real.sqrt (1 - p ^ 2) = q := by
have h₁₀ : q < 0 := lt_of_not_ge hq_nonneg
have h₁₁ : q ^ 2 = 1 - p ^ 2 := (sub_eq_of_eq_add' hpq_sq.symm).symm
have h₁₂ : Real.sqrt (1 - p ^ 2) = -q := by
rw [Real.sqrt_eq_iff_eq_sq] <;> nlinarith only [h₁₀, h₁₁]
exact neg_eq_iff_eq_neg.mpr h₁₂
exact ⟨h₇, by linarith only [h₈, h₉]⟩
obtain ⟨θ, hθ_cos, hθ_sin⟩ := hθ
have h₁₀ : A * Real.cos θ + B * Real.sin θ = R := by
calc
A * Real.cos θ + B * Real.sin θ = R * p * Real.cos θ + R * q * Real.sin θ := by
rw [hp_def, hq_def]
field_simp [hR_pos.ne']
_ = R * (p * Real.cos θ + q * Real.sin θ) := by ring
_ = R * (p * p + q * q) := by
rw [hθ_cos, hθ_sin]
_ = R * 1 := by
have h₁₂ : p * p + q * q = 1 := by simp only [←sq, hpq_sq]
rw [h₁₂]
_ = R := by ring
have h₁₁ : A * Real.cos θ + B * Real.sin θ > 1 := by
have h₁₂ : R > 1 := by
rw [hR_def, gt_iff_lt, ←one_lt_sq_iff₀ (a := √(A^2 + B^2)) (by positivity)]
rw [Real.sq_sqrt (by positivity)]
exact h
linarith only [h₁₀, h₁₂]
have h₁₂ : A * Real.cos (2 * (θ / 2)) + B * Real.sin (2 * (θ / 2)) > 1 := by
have h₁₃ : Real.cos (2 * (θ / 2)) = Real.cos θ := by ring_nf
have h₁₄ : Real.sin (2 * (θ / 2)) = Real.sin θ := by ring_nf
omega
have h₁₃ : A * Real.cos (2 * (θ / 2)) + B * Real.sin (2 * (θ / 2)) ≤ 1 := by
have h₁₄ : f (θ / 2) + f (θ / 2 + Real.pi) ≥ 0 :=
Left.add_nonneg (h₁ (θ / 2)) (h₁ (θ / 2 + Real.pi))
have h₁₅ : f (θ / 2) + f (θ / 2 + Real.pi) = 2 - 2 * (A * Real.cos (2 * (θ / 2)) + B * Real.sin (2 * (θ / 2))) := by
have h₁₆ : f (θ / 2) = 1 - a * Real.cos (θ / 2) - b * Real.sin (θ / 2) - A * Real.cos (2 * (θ / 2)) - B * Real.sin (2 * (θ / 2)) := by
rw [h₀]
have h₁₇ : f (θ / 2 + Real.pi) = 1 - a * Real.cos (θ / 2 + Real.pi) - b * Real.sin (θ / 2 + Real.pi) - A * Real.cos (2 * (θ / 2 + Real.pi)) - B * Real.sin (2 * (θ / 2 + Real.pi)) := by
rw [h₀]
rw [h₁₆, h₁₇]
have h₁₈ : Real.cos (θ / 2 + Real.pi) = -Real.cos (θ / 2) := by
rw [Real.cos_add]
simp [Real.cos_pi, Real.sin_pi]
have h₁₉ : Real.sin (θ / 2 + Real.pi) = -Real.sin (θ / 2) := by
rw [Real.sin_add]
simp [Real.cos_pi, Real.sin_pi]
have h₂₀ : Real.cos (2 * (θ / 2 + Real.pi)) = Real.cos (2 * (θ / 2)) := by
have h₂₁ : 2 * (θ / 2 + Real.pi) = 2 * (θ / 2) + 2 * Real.pi := by ring_nf
rw [h₂₁]
exact Real.cos_add_two_pi (2 * (θ / 2))
have h₂₁ : Real.sin (2 * (θ / 2 + Real.pi)) = Real.sin (2 * (θ / 2)) := by
have h₂₂ : 2 * (θ / 2 + Real.pi) = 2 * (θ / 2) + 2 * Real.pi := by ring_nf
rw [h₂₂]
exact Real.sin_add_two_pi (2 * (θ / 2))
rw [h₁₈, h₁₉, h₂₀, h₂₁]
ring_nf
rw [h₁₅] at h₁₄
linarith only [h₁₄]
exact not_lt_of_ge h₁₃ h₁₂
have h₃ : a ^ 2 + b ^ 2 ≤ 2 := by
by_contra! h
set C : ℝ := a + b with hC_def
set D : ℝ := a - b with hD_def
have hC_sq_add_D_sq : C ^ 2 + D ^ 2 = 2 * (a ^ 2 + b ^ 2) := by
calc
C ^ 2 + D ^ 2 = (a + b) ^ 2 + (a - b) ^ 2 := by rw [hC_def, hD_def]
_ = 2 * (a ^ 2 + b ^ 2) := by ring
have hC_sq_add_D_sq_gt_4 : C ^ 2 + D ^ 2 > 4 := by
linarith only [h, hC_sq_add_D_sq]
set R : ℝ := Real.sqrt (C ^ 2 + D ^ 2) with hR_def
have hR_pos : 0 < R := by positivity
have hR_sq : R ^ 2 = C ^ 2 + D ^ 2 := Real.sq_sqrt (by positivity)
set p : ℝ := C / R with hp_def
set q : ℝ := D / R with hq_def
have hpq_sq : p ^ 2 + q ^ 2 = 1 := by
calc
p ^ 2 + q ^ 2 = (C / R) ^ 2 + (D / R) ^ 2 := by rw [hp_def, hq_def]
_ = (C ^ 2 + D ^ 2) / R ^ 2 := by
field_simp [hR_pos.ne']
_ = 1 := by
rw [hR_sq]
field_simp [hR_pos.ne']
have hpn1 : -1 ≤ p := by nlinarith only [hpq_sq]
have hp1 : p ≤ 1 := by nlinarith only [hpq_sq]
have hθ : ∃ (θ : ℝ), Real.cos θ = p ∧ Real.sin θ = -q := by
by_cases hq_nonneg : q ≥ 0
· use -Real.arccos p
have h₅ : Real.cos (-Real.arccos p) = p := by
rw [Real.cos_neg, Real.cos_arccos hpn1 hp1]
have h₆ : Real.sin (-Real.arccos p) = -Real.sqrt (1 - p ^ 2) := by
rw [Real.sin_neg, Real.sin_arccos]
have h₇ : -Real.sqrt (1 - p ^ 2) = -q := by
have h₈ : q ≥ 0 := hq_nonneg
have h₉ : q ^ 2 = 1 - p ^ 2 := (sub_eq_of_eq_add' hpq_sq.symm).symm
congr 1
rw [Real.sqrt_eq_iff_eq_sq] <;> nlinarith only [h₈, h₉]
exact ⟨h₅, h₆.trans h₇⟩
· use Real.arccos p
have h₆ : Real.sin (Real.arccos p) = Real.sqrt (1 - p ^ 2) := by
rw [Real.sin_arccos]
have h₇ : Real.sqrt (1 - p ^ 2) = -q := by
have h₈ : q < 0 := lt_of_not_ge hq_nonneg
have h₉ : q ^ 2 = 1 - p ^ 2 := (sub_eq_of_eq_add' hpq_sq.symm).symm
rw [Real.sqrt_eq_iff_eq_sq] <;> nlinarith only [h₈, h₉]
exact ⟨Real.cos_arccos hpn1 hp1, by rw [h₆, h₇]⟩
obtain ⟨θ, hθ_cos, hθ_sin⟩ := hθ
have h₅ : C * Real.cos θ - D * Real.sin θ = R := by
calc
C * Real.cos θ - D * Real.sin θ = R * p * Real.cos θ - R * q * Real.sin θ := by
rw [hp_def, hq_def]
ring_nf
field_simp [hR_pos.ne']
_ = R * (p * Real.cos θ - q * Real.sin θ) := by ring
_ = R * (p * p + q * q) := by
rw [hθ_cos, hθ_sin]
ring_nf
_ = R * 1 := by
have h₆ : p ^ 2 + q ^ 2 = 1 := hpq_sq
have h₇ : p * p + q * q = 1 := by simp only [←sq, h₆]
rw [h₇]
_ = R := by ring
have h₆ : C * Real.cos θ - D * Real.sin θ > 2 := by
have h₇ : R > 2 := by
have h₉ : C ^ 2 + D ^ 2 > 4 := hC_sq_add_D_sq_gt_4
rw [←hR_sq, show 4 = (2:ℝ)^2 by norm_num] at h₉
exact (sq_lt_sq₀ (by positivity) (by positivity)).mp h₉
omega
have h₇ : C * Real.cos θ - D * Real.sin θ ≤ 2 := by
have h₈ : f θ + f (θ + Real.pi / 2) ≥ 0 := by
exact Left.add_nonneg (h₁ θ) (h₁ (θ + Real.pi / 2))
have h₉ : f θ + f (θ + Real.pi / 2) = 2 - (C * Real.cos θ - D * Real.sin θ) := by
have h₁₀ : f θ = 1 - a * Real.cos θ - b * Real.sin θ - A * Real.cos (2 * θ) - B * Real.sin (2 * θ) := by
rw [h₀]
have h₁₁ : f (θ + Real.pi / 2) = 1 - a * Real.cos (θ + Real.pi / 2) - b * Real.sin (θ + Real.pi / 2) - A * Real.cos (2 * (θ + Real.pi / 2)) - B * Real.sin (2 * (θ + Real.pi / 2)) := by
rw [h₀]
rw [h₁₀, h₁₁]
have h₁₄ : Real.cos (2 * (θ + Real.pi / 2)) = -Real.cos (2 * θ) := by
have h₁₅ : 2 * (θ + Real.pi / 2) = 2 * θ + Real.pi := by ring_nf
rw [h₁₅]
exact Real.cos_add_pi _
have h₁₅ : Real.sin (2 * (θ + Real.pi / 2)) = -Real.sin (2 * θ) := by
have h₁₆ : 2 * (θ + Real.pi / 2) = 2 * θ + Real.pi := by ring_nf
rw [h₁₆]
exact Real.sin_add_pi _
rw [Real.cos_add_pi_div_two θ, Real.sin_add_pi_div_two θ, h₁₄, h₁₅]
have h₁₆ : C = a + b := by rw [hC_def]
have h₁₇ : D = a - b := by rw [hD_def]
simp only [h₁₆, h₁₇] at *
ring_nf at *
rw [h₉] at h₈
linarith only [h₈]
exact not_lt_of_ge h₇ h₆
exact ⟨h₃, h₂⟩
end Imo1977P4 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1977P4.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unsolved goals\nf : \u211d \u2192 \u211d\na b A B : \u211d\nh\u2080 : \u2200 (x : \u211d), f x = 1 - a * Real.cos x - b * Real.sin x - A * Real.cos (2 * x) - B * Real.sin (2 * x)\nh\u2081 : \u2200 (x : \u211d), f x \u2265 0\nh : 1 < A ^ 2 + B ^ 2\nh\u2085 : 0 < A ^ 2 + B ^ 2\nR : \u211d := \u221a(A ^ 2 + B ^ 2)\nhR_def : R = \u221a(A ^ 2 + B ^ 2)\nhR_pos : 0 < R\nhR_sq : R ^ 2 = A ^ 2 + B ^ 2\np : \u211d := A / R\nhp_def : p = A / R\nq : \u211d := B / R\nhq_def : q = B / R\nhpq_sq : p ^ 2 + q ^ 2 = 1\nhpn1 : -1 \u2264 p\nhp1 : p \u2264 1\n\u03b8 : \u211d\nh\u03b8_cos : Real.cos \u03b8 = p\nh\u03b8_sin : Real.sin \u03b8 = q\nh\u2081\u2080 : A * Real.cos \u03b8 + B * Real.sin \u03b8 = R\nh\u2081\u2081 : A * Real.cos \u03b8 + B * Real.sin \u03b8 > 1\nh\u2081\u2083 : Real.cos (2 * (\u03b8 / 2)) = Real.cos \u03b8\nh\u2081\u2084 : Real.sin (2 * (\u03b8 / 2)) = Real.sin \u03b8\n\u22a2 A * Real.cos (2 * (\u03b8 / 2)) + B * Real.sin (2 * (\u03b8 / 2)) > 1", "unsolved goals\ncase intro.intro\nf : \u211d \u2192 \u211d\na b A B : \u211d\nh\u2080 : \u2200 (x : \u211d), f x = 1 - a * Real.cos x - b * Real.sin x - A * Real.cos (2 * x) - B * Real.sin (2 * x)\nh\u2081 : \u2200 (x : \u211d), f x \u2265 0\nh : 1 < A ^ 2 + B ^ 2\nh\u2085 : 0 < A ^ 2 + B ^ 2\nR : \u211d := \u221a(A ^ 2 + B ^ 2)\nhR_def : R = \u221a(A ^ 2 + B ^ 2)\nhR_pos : 0 < R\nhR_sq : R ^ 2 = A ^ 2 + B ^ 2\np : \u211d := A / R\nhp_def : p = A / R\nq : \u211d := B / R\nhq_def : q = B / R\nhpq_sq : p ^ 2 + q ^ 2 = 1\nhpn1 : -1 \u2264 p\nhp1 : p \u2264 1\n\u03b8 : \u211d\nh\u03b8_cos : Real.cos \u03b8 = p\nh\u03b8_sin : Real.sin \u03b8 = q\nh\u2081\u2080 : A * Real.cos \u03b8 + B * Real.sin \u03b8 = R\nh\u2081\u2081 : A * Real.cos \u03b8 + B * Real.sin \u03b8 > 1\nh\u2081\u2082 : A * Real.cos (2 * (\u03b8 / 2)) + B * Real.sin (2 * (\u03b8 / 2)) > 1\n\u22a2 False", "unsolved goals\nf : \u211d \u2192 \u211d\na b A B : \u211d\nh\u2080 : \u2200 (x : \u211d), f x = 1 - a * Real.cos x - b * Real.sin x - A * Real.cos (2 * x) - B * Real.sin (2 * x)\nh\u2081 : \u2200 (x : \u211d), f x \u2265 0\nh\u2082 : A ^ 2 + B ^ 2 \u2264 1\n\u22a2 a ^ 2 + b ^ 2 \u2264 2 \u2227 A ^ 2 + B ^ 2 \u2264 1"], "timeout_s": 600.0, "latency_s": 2.9583, "verified_at": "2026-03-26T18:16:44.228224+00:00"}} | false | true | false | 2.9583 |
compfiles_Imo1977P5 | compfiles | Copyright (c) 2025 Roozbeh Yousefzadeh. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1977, Problem 5
Let $a,b$ be two natural numbers. When we divide $a^2+b^2$ by $a+b$,
we get the remainder $r$ and the quotient $q$. Determine all pairs $(a, b)$
for which $q^2 + r = 1977$.
-/
namespace Imo1977P5
abbrev solution_set : Set (ℕ×ℕ) := {(7,50), (37, 50), (50, 7), (50, 37)}
lemma aux_1
(a b : ℕ)
(h₁ : ((↑b : ℤ) - 22) ^ 2 = 1009 - ((↑a : ℤ) - 22) ^ 2)
(ha₀ : a ≤ 53) :
(a, b) ∈ solution_set := by
let s : ℤ := 1009 - (↑(a:ℤ) - 22) ^ 2
have hs: s = 1009 - (↑(a:ℤ) - 22) ^ 2 := by rfl
have h₈₀: IsSquare (((a:ℤ) - 22) ^ 2) := by exact IsSquare.sq ((a:ℤ) - 22)
have h₈₁: IsSquare (((b:ℤ) - 22) ^ 2) := by exact IsSquare.sq ((b:ℤ) - 22)
have h₈₂: IsSquare s := by
rw [hs, ← h₁]
exact h₈₁
have ha₁: ∀ k n:ℤ, n^2 < k ∧ k < (n + 1) ^ 2 → ¬ IsSquare k := by
intro k n hk₀
obtain ⟨hk₀, hk₁⟩ := hk₀
by_contra hc₂
apply (isSquare_iff_exists_sq k).mp at hc₂
let ⟨d, hd₀⟩ := hc₂
rw [hd₀] at hk₀ hk₁
apply sq_lt_sq.mp at hk₀
apply sq_lt_sq.mp at hk₁
by_cases hn: 0 ≤ n
· rw [abs_of_nonneg hn] at hk₀
nth_rw 2 [abs_of_nonneg (by linarith)] at hk₁
linarith
· push_neg at hn
have hn₁: n + 1 ≤ 0 := by linarith
rw [abs_of_neg hn] at hk₀
rw [abs_of_nonpos hn₁] at hk₁
linarith
have ha₂: ∀ k:ℤ, 31^2 < k ∧ k < 32 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 31 a
have ha₃: ∀ k:ℤ, 30^2 < k ∧ k < 31 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 30 a
have ha₄: ∀ k:ℤ, 29^2 < k ∧ k < 30 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 29 a
have ha₅: ∀ k:ℤ, 28^2 < k ∧ k < 29 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 28 a
have ha₆: ∀ k:ℤ, 27^2 < k ∧ k < 28 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 27 a
have ha₇: ∀ k:ℤ, 26^2 < k ∧ k < 27 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 26 a
have ha₈: ∀ k:ℤ, 25^2 < k ∧ k < 26 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 25 a
have ha₉: ∀ k:ℤ, 24^2 < k ∧ k < 25 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 24 a
have ha₁₀: ∀ k:ℤ, 23^2 < k ∧ k < 24 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 23 a
have ha₁₁: abs ((↑a : ℤ) - (22 : ℤ)) ≤ 31 := by
refine abs_le.mpr ?_
omega
rw [← sq_abs ((↑a : ℤ) - (22 : ℤ))] at h₁ hs h₈₀
have ha₁₂: 0 ≤ abs ((↑a : ℤ) - (22 : ℤ)) := by exact abs_nonneg ((↑a : ℤ) - (22 : ℤ))
by_cases ha₁₃: abs ((↑a : ℤ) - (22 : ℤ)) < 15
· exfalso
interval_cases abs ((↑a : ℤ) - (22 : ℤ))
· have hh₀: IsSquare (1009:ℤ) := by
rw [zero_pow (by norm_num), sub_zero] at h₁
rw [← h₁]
exact h₈₁
have hh₁: ¬ IsSquare (1009:ℤ) := Prime.not_isSquare (by norm_num)
exact hh₁ hh₀
all_goals try exact (ha₂ s (by omega)) h₈₂
all_goals try exact (ha₃ s (by omega)) h₈₂
· exact (ha₄ s (by omega)) h₈₂
· exact (ha₄ s (by omega)) h₈₂
· exact (ha₅ s (by omega)) h₈₂
· exact (ha₅ s (by omega)) h₈₂
· push_neg at ha₁₃
by_cases ha₁₄: abs ((↑a : ℤ) - (22 : ℤ)) = 15
· apply (abs_eq (by norm_num)).mp at ha₁₄
obtain ha₁₄ | ha₁₄ := ha₁₄
· right; left
have hh₀: a = 37 := by bound
rw [hh₀] at h₁
simp at h₁
have hh₁: (784:ℤ) = 28 ^ 2 := by norm_num1
rw [hh₁] at h₁
apply pow_eq_pow_iff_cases.mp at h₁
simp at h₁
bound
· left
have hh₀: a = 7 := by bound
rw [hh₀] at h₁
simp at h₁
have hh₁: (784:ℤ) = 28 ^ 2 := by norm_num1
rw [hh₁] at h₁
apply pow_eq_pow_iff_cases.mp at h₁
simp at h₁
rw [hh₀]
rw [@Prod.mk_right_inj]
omega
· by_cases ha₁₅: abs ((↑a : ℤ) - (22 : ℤ)) < 28
· exfalso
interval_cases abs ((↑a : ℤ) - (22 : ℤ))
· exact false_of_ne ha₁₄
· exact (ha₆ s (by omega)) h₈₂
· exact (ha₇ s (by omega)) h₈₂
· exact (ha₇ s (by omega)) h₈₂
· exact (ha₈ s (by omega)) h₈₂
· exact (ha₉ s (by omega)) h₈₂
· exact (ha₁₀ s (by omega)) h₈₂
· exact (ha₁ s 22 (by omega)) h₈₂
· exact (ha₁ s 21 (by omega)) h₈₂
· exact (ha₁ s 20 (by omega)) h₈₂
· exact (ha₁ s 19 (by omega)) h₈₂
· exact (ha₁ s 18 (by omega)) h₈₂
· exact (ha₁ s 16 (by omega)) h₈₂
· by_cases ha₁₆: abs ((↑a : ℤ) - (22 : ℤ)) = 28
· right; right
have ha₁₇: a = 50 := by
apply (abs_eq (by norm_num)).mp at ha₁₆
omega
rw [ha₁₇]
rw [ha₁₇] at h₁
simp at h₁
have hh₀: (225:ℤ) = 15 ^ 2 := by bound
rw [hh₀] at h₁
apply pow_eq_pow_iff_cases.mp at h₁
simp at h₁
obtain h₁ | h₁ := h₁
· simp
right
omega
· simp
left
omega
· exfalso
interval_cases abs ((↑a : ℤ) - (22 : ℤ))
· exact false_of_ne ha₁₆
· exact (ha₁ s 12 (by omega)) h₈₂
· exact (ha₁ s 10 (by omega)) h₈₂
· exact (ha₁ s 6 (by omega)) h₈₂
lemma aux_2
(a b q r : ℕ)
(hp : 0 < a ∧ 0 < b)
(h₀ : r = (a ^ 2 + b ^ 2) % (a + b))
(h₁ : q = (a ^ 2 + b ^ 2) / (a + b)) :
q ^ 2 + r = 1977 → (a, b) ∈ solution_set := by
intro h₂
have hr₀: r = 1977 - q ^ 2 := by exact Nat.eq_sub_of_add_eq' h₂
have h₅₁: 0 < a + b := by linarith
have h₅₂: a ^ 2 + b ^ 2 = q * (a + b) + r := by
rw [h₀, h₁,]
exact Eq.symm (Nat.div_add_mod' (a ^ 2 + b ^ 2) (a + b))
have h₅₃: q ≤ 44 := by
by_contra hc₀
push_neg at hc₀
apply Nat.succ_le_iff.mpr at hc₀
have hc₁: 45 ^ 2 ≤ q ^ 2 := by exact Nat.pow_le_pow_left hc₀ 2
linarith
have h₅₄: 43 < q := by
have g₀: (a + b) ^ 2 ≤ 2 * (a ^ 2 + b ^ 2) := by exact add_sq_le
have g₁: 2 * (a ^ 2 + b ^ 2) < 2 * (45 * (a + b)) := by
refine (Nat.mul_lt_mul_left zero_lt_two).mpr ?_
have g₁₀: 45 = 44 + 1 := by linarith
rw [h₅₂, g₁₀, add_mul, one_mul]
refine add_lt_add_of_le_of_lt ?_ ?_
· exact Nat.mul_le_mul_right (a + b) h₅₃
· rw [h₀]
exact Nat.mod_lt (a ^ 2 + b ^ 2) h₅₁
have g₂: a + b < 90 := by
apply lt_of_le_of_lt g₀ at g₁
rw [pow_two] at g₁
rw [← mul_assoc] at g₁
simp at g₁
exact (Nat.mul_lt_mul_right h₅₁).mp g₁
have g₃: r < 90 := by
rw [h₀]
refine lt_trans ?_ g₂
exact Nat.mod_lt (a ^ 2 + b ^ 2) h₅₁
by_contra hc₀
push_neg at hc₀
have hc₁: q ^ 2 ≤ 43 ^ 2 := by exact Nat.pow_le_pow_left hc₀ 2
omega
have hq₀: q = 44 := by omega
rw [hq₀] at hr₀
norm_num at hr₀
rw [hq₀, hr₀] at h₅₂
have h₆: ((a:ℤ) - 22) ^ 2 + ((b:ℤ) - 22) ^ 2 = 1009 := by
ring_nf
linarith
apply eq_sub_of_add_eq' at h₆
by_cases ha₀: 53 < a
· exfalso
apply Nat.succ_le_iff.mpr at ha₀
simp at ha₀
have ha₁: 32 ^ 2 ≤ ((a:ℤ) - 22) ^ 2 := by
refine pow_le_pow_left₀ (by omega) (by omega) 2
have hb₁: 0 ≤ ((b:ℤ) - 22) ^ 2 := by positivity
omega
· push_neg at ha₀
exact aux_1 a b h₆ ha₀
theorem imo1977_p5
(a b q r : ℕ)
(hp: 0 < a ∧ 0 < b)
(h₀ : r = (a ^ 2 + b ^ 2) % (a + b))
(h₁ : q = (a ^ 2 + b ^ 2) / (a + b)) :
q ^ 2 + r = 1977 ↔ (a, b) ∈ solution_set := by
constructor
· exact fun (a_1 : q ^ 2 + r = 1977) ↦ aux_2 a b q r hp h₀ h₁ a_1
· simp
intro h₂
bound
end Imo1977P5 | /- | /-
Copyright (c) 2025 Roozbeh Yousefzadeh. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1977, Problem 5
Let $a,b$ be two natural numbers. When we divide $a^2+b^2$ by $a+b$,
we get the remainder $r$ and the quotient $q$. Determine all pairs $(a, b)$
for which $q^2 + r = 1977$.
-/
namespace Imo1977P5
abbrev solution_set : Set (ℕ×ℕ) := {(7,50), (37, 50), (50, 7), (50, 37)}
lemma aux_1
(a b : ℕ)
(h₁ : ((↑b : ℤ) - 22) ^ 2 = 1009 - ((↑a : ℤ) - 22) ^ 2)
(ha₀ : a ≤ 53) :
(a, b) ∈ solution_set := by
let s : ℤ := 1009 - (↑(a:ℤ) - 22) ^ 2
have hs: s = 1009 - (↑(a:ℤ) - 22) ^ 2 := by rfl
have h₈₀: IsSquare (((a:ℤ) - 22) ^ 2) := by exact IsSquare.sq ((a:ℤ) - 22)
have h₈₁: IsSquare (((b:ℤ) - 22) ^ 2) := by exact IsSquare.sq ((b:ℤ) - 22)
have h₈₂: IsSquare s := by
rw [hs, ← h₁]
exact h₈₁
have ha₁: ∀ k n:ℤ, n^2 < k ∧ k < (n + 1) ^ 2 → ¬ IsSquare k := by
intro k n hk₀
obtain ⟨hk₀, hk₁⟩ := hk₀
by_contra hc₂
apply (isSquare_iff_exists_sq k).mp at hc₂
let ⟨d, hd₀⟩ := hc₂
rw [hd₀] at hk₀ hk₁
apply sq_lt_sq.mp at hk₀
apply sq_lt_sq.mp at hk₁
by_cases hn: 0 ≤ n
· rw [abs_of_nonneg hn] at hk₀
nth_rw 2 [abs_of_nonneg (by linarith)] at hk₁
linarith
· push_neg at hn
have hn₁: n + 1 ≤ 0 := by linarith
rw [abs_of_neg hn] at hk₀
rw [abs_of_nonpos hn₁] at hk₁
linarith
have ha₂: ∀ k:ℤ, 31^2 < k ∧ k < 32 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 31 a
have ha₃: ∀ k:ℤ, 30^2 < k ∧ k < 31 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 30 a
have ha₄: ∀ k:ℤ, 29^2 < k ∧ k < 30 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 29 a
have ha₅: ∀ k:ℤ, 28^2 < k ∧ k < 29 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 28 a
have ha₆: ∀ k:ℤ, 27^2 < k ∧ k < 28 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 27 a
have ha₇: ∀ k:ℤ, 26^2 < k ∧ k < 27 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 26 a
have ha₈: ∀ k:ℤ, 25^2 < k ∧ k < 26 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 25 a
have ha₉: ∀ k:ℤ, 24^2 < k ∧ k < 25 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 24 a
have ha₁₀: ∀ k:ℤ, 23^2 < k ∧ k < 24 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 23 a
have ha₁₁: abs ((↑a : ℤ) - (22 : ℤ)) ≤ 31 := by
refine abs_le.mpr ?_
omega
rw [← sq_abs ((↑a : ℤ) - (22 : ℤ))] at h₁ hs h₈₀
have ha₁₂: 0 ≤ abs ((↑a : ℤ) - (22 : ℤ)) := by exact abs_nonneg ((↑a : ℤ) - (22 : ℤ))
by_cases ha₁₃: abs ((↑a : ℤ) - (22 : ℤ)) < 15
· exfalso
interval_cases abs ((↑a : ℤ) - (22 : ℤ))
· have hh₀: IsSquare (1009:ℤ) := by
rw [zero_pow (by norm_num), sub_zero] at h₁
rw [← h₁]
exact h₈₁
have hh₁: ¬ IsSquare (1009:ℤ) := Prime.not_isSquare (by norm_num)
exact hh₁ hh₀
all_goals try exact (ha₂ s (by omega)) h₈₂
all_goals try exact (ha₃ s (by omega)) h₈₂
· exact (ha₄ s (by omega)) h₈₂
· exact (ha₄ s (by omega)) h₈₂
· exact (ha₅ s (by omega)) h₈₂
· exact (ha₅ s (by omega)) h₈₂
· push_neg at ha₁₃
by_cases ha₁₄: abs ((↑a : ℤ) - (22 : ℤ)) = 15
· apply (abs_eq (by norm_num)).mp at ha₁₄
obtain ha₁₄ | ha₁₄ := ha₁₄
· right; left
have hh₀: a = 37 := by bound
rw [hh₀] at h₁
simp at h₁
have hh₁: (784:ℤ) = 28 ^ 2 := by norm_num1
rw [hh₁] at h₁
apply pow_eq_pow_iff_cases.mp at h₁
simp at h₁
bound
· left
have hh₀: a = 7 := by bound
rw [hh₀] at h₁
simp at h₁
have hh₁: (784:ℤ) = 28 ^ 2 := by norm_num1
rw [hh₁] at h₁
apply pow_eq_pow_iff_cases.mp at h₁
simp at h₁
rw [hh₀]
rw [@Prod.mk_right_inj]
omega
· by_cases ha₁₅: abs ((↑a : ℤ) - (22 : ℤ)) < 28
· exfalso
interval_cases abs ((↑a : ℤ) - (22 : ℤ))
· exact false_of_ne ha₁₄
· exact (ha₆ s (by omega)) h₈₂
· exact (ha₇ s (by omega)) h₈₂
· exact (ha₇ s (by omega)) h₈₂
· exact (ha₈ s (by omega)) h₈₂
· exact (ha₉ s (by omega)) h₈₂
· exact (ha₁₀ s (by omega)) h₈₂
· exact (ha₁ s 22 (by omega)) h₈₂
· exact (ha₁ s 21 (by omega)) h₈₂
· exact (ha₁ s 20 (by omega)) h₈₂
· exact (ha₁ s 19 (by omega)) h₈₂
· exact (ha₁ s 18 (by omega)) h₈₂
· exact (ha₁ s 16 (by omega)) h₈₂
· by_cases ha₁₆: abs ((↑a : ℤ) - (22 : ℤ)) = 28
· right; right
have ha₁₇: a = 50 := by
apply (abs_eq (by norm_num)).mp at ha₁₆
omega
rw [ha₁₇]
rw [ha₁₇] at h₁
simp at h₁
have hh₀: (225:ℤ) = 15 ^ 2 := by bound
rw [hh₀] at h₁
apply pow_eq_pow_iff_cases.mp at h₁
simp at h₁
obtain h₁ | h₁ := h₁
· simp
right
omega
· simp
left
omega
· exfalso
interval_cases abs ((↑a : ℤ) - (22 : ℤ))
· exact false_of_ne ha₁₆
· exact (ha₁ s 12 (by omega)) h₈₂
· exact (ha₁ s 10 (by omega)) h₈₂
· exact (ha₁ s 6 (by omega)) h₈₂
lemma aux_2
(a b q r : ℕ)
(hp : 0 < a ∧ 0 < b)
(h₀ : r = (a ^ 2 + b ^ 2) % (a + b))
(h₁ : q = (a ^ 2 + b ^ 2) / (a + b)) :
q ^ 2 + r = 1977 → (a, b) ∈ solution_set := by
intro h₂
have hr₀: r = 1977 - q ^ 2 := by exact Nat.eq_sub_of_add_eq' h₂
have h₅₁: 0 < a + b := by linarith
have h₅₂: a ^ 2 + b ^ 2 = q * (a + b) + r := by
rw [h₀, h₁,]
exact Eq.symm (Nat.div_add_mod' (a ^ 2 + b ^ 2) (a + b))
have h₅₃: q ≤ 44 := by
by_contra hc₀
push_neg at hc₀
apply Nat.succ_le_iff.mpr at hc₀
have hc₁: 45 ^ 2 ≤ q ^ 2 := by exact Nat.pow_le_pow_left hc₀ 2
linarith
have h₅₄: 43 < q := by
have g₀: (a + b) ^ 2 ≤ 2 * (a ^ 2 + b ^ 2) := by exact add_sq_le
have g₁: 2 * (a ^ 2 + b ^ 2) < 2 * (45 * (a + b)) := by
refine (Nat.mul_lt_mul_left zero_lt_two).mpr ?_
have g₁₀: 45 = 44 + 1 := by linarith
rw [h₅₂, g₁₀, add_mul, one_mul]
refine add_lt_add_of_le_of_lt ?_ ?_
· exact Nat.mul_le_mul_right (a + b) h₅₃
· rw [h₀]
exact Nat.mod_lt (a ^ 2 + b ^ 2) h₅₁
have g₂: a + b < 90 := by
apply lt_of_le_of_lt g₀ at g₁
rw [pow_two] at g₁
rw [← mul_assoc] at g₁
simp at g₁
exact (Nat.mul_lt_mul_right h₅₁).mp g₁
have g₃: r < 90 := by
rw [h₀]
refine lt_trans ?_ g₂
exact Nat.mod_lt (a ^ 2 + b ^ 2) h₅₁
by_contra hc₀
push_neg at hc₀
have hc₁: q ^ 2 ≤ 43 ^ 2 := by exact Nat.pow_le_pow_left hc₀ 2
omega
have hq₀: q = 44 := by omega
rw [hq₀] at hr₀
norm_num at hr₀
rw [hq₀, hr₀] at h₅₂
have h₆: ((a:ℤ) - 22) ^ 2 + ((b:ℤ) - 22) ^ 2 = 1009 := by
ring_nf
linarith
apply eq_sub_of_add_eq' at h₆
by_cases ha₀: 53 < a
· exfalso
apply Nat.succ_le_iff.mpr at ha₀
simp at ha₀
have ha₁: 32 ^ 2 ≤ ((a:ℤ) - 22) ^ 2 := by
refine pow_le_pow_left₀ (by omega) (by omega) 2
have hb₁: 0 ≤ ((b:ℤ) - 22) ^ 2 := by positivity
omega
· push_neg at ha₀
exact aux_1 a b h₆ ha₀
theorem imo1977_p5
(a b q r : ℕ)
(hp: 0 < a ∧ 0 < b)
(h₀ : r = (a ^ 2 + b ^ 2) % (a + b))
(h₁ : q = (a ^ 2 + b ^ 2) / (a + b)) :
q ^ 2 + r = 1977 ↔ (a, b) ∈ solution_set := by
constructor
· exact fun (a_1 : q ^ 2 + r = 1977) ↦ aux_2 a b q r hp h₀ h₁ a_1
· simp
intro h₂
bound
end Imo1977P5
| true | Copyright (c) 2025 Roozbeh Yousefzadeh. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1977, Problem 5
Let $a,b$ be two natural numbers. When we divide $a^2+b^2$ by $a+b$,
we get the remainder $r$ and the quotient $q$. Determine all pairs $(a, b)$
for which $q^2 + r = 1977$.
-/
namespace Imo1977P5
abbrev solution_set : Set (ℕ×ℕ) := {(7,50), (37, 50), (50, 7), (50, 37)}
lemma aux_1
(a b : ℕ)
(h₁ : ((↑b : ℤ) - 22) ^ 2 = 1009 - ((↑a : ℤ) - 22) ^ 2)
(ha₀ : a ≤ 53) :
(a, b) ∈ solution_set := by
let s : ℤ := 1009 - (↑(a:ℤ) - 22) ^ 2
have hs: s = 1009 - (↑(a:ℤ) - 22) ^ 2 := by rfl
have h₈₀: IsSquare (((a:ℤ) - 22) ^ 2) := by exact IsSquare.sq ((a:ℤ) - 22)
have h₈₁: IsSquare (((b:ℤ) - 22) ^ 2) := by exact IsSquare.sq ((b:ℤ) - 22)
have h₈₂: IsSquare s := by
rw [hs, ← h₁]
exact h₈₁
have ha₁: ∀ k n:ℤ, n^2 < k ∧ k < (n + 1) ^ 2 → ¬ IsSquare k := by
intro k n hk₀
obtain ⟨hk₀, hk₁⟩ := hk₀
by_contra hc₂
apply (isSquare_iff_exists_sq k).mp at hc₂
let ⟨d, hd₀⟩ := hc₂
rw [hd₀] at hk₀ hk₁
apply sq_lt_sq.mp at hk₀
apply sq_lt_sq.mp at hk₁
by_cases hn: 0 ≤ n
· rw [abs_of_nonneg hn] at hk₀
nth_rw 2 [abs_of_nonneg (by linarith)] at hk₁
linarith
· push_neg at hn
have hn₁: n + 1 ≤ 0 := by linarith
rw [abs_of_neg hn] at hk₀
rw [abs_of_nonpos hn₁] at hk₁
linarith
have ha₂: ∀ k:ℤ, 31^2 < k ∧ k < 32 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 31 a
have ha₃: ∀ k:ℤ, 30^2 < k ∧ k < 31 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 30 a
have ha₄: ∀ k:ℤ, 29^2 < k ∧ k < 30 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 29 a
have ha₅: ∀ k:ℤ, 28^2 < k ∧ k < 29 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 28 a
have ha₆: ∀ k:ℤ, 27^2 < k ∧ k < 28 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 27 a
have ha₇: ∀ k:ℤ, 26^2 < k ∧ k < 27 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 26 a
have ha₈: ∀ k:ℤ, 25^2 < k ∧ k < 26 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 25 a
have ha₉: ∀ k:ℤ, 24^2 < k ∧ k < 25 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 24 a
have ha₁₀: ∀ k:ℤ, 23^2 < k ∧ k < 24 ^ 2 → ¬ IsSquare k := by exact fun k a => ha₁ k 23 a
have ha₁₁: abs ((↑a : ℤ) - (22 : ℤ)) ≤ 31 := by
refine abs_le.mpr ?_
omega
rw [← sq_abs ((↑a : ℤ) - (22 : ℤ))] at h₁ hs h₈₀
have ha₁₂: 0 ≤ abs ((↑a : ℤ) - (22 : ℤ)) := by exact abs_nonneg ((↑a : ℤ) - (22 : ℤ))
by_cases ha₁₃: abs ((↑a : ℤ) - (22 : ℤ)) < 15
· exfalso
interval_cases abs ((↑a : ℤ) - (22 : ℤ))
· have hh₀: IsSquare (1009:ℤ) := by
rw [zero_pow (by norm_num), sub_zero] at h₁
rw [← h₁]
exact h₈₁
have hh₁: ¬ IsSquare (1009:ℤ) := Prime.not_isSquare (by norm_num)
exact hh₁ hh₀
all_goals try exact (ha₂ s (by omega)) h₈₂
all_goals try exact (ha₃ s (by omega)) h₈₂
· exact (ha₄ s (by omega)) h₈₂
· exact (ha₄ s (by omega)) h₈₂
· exact (ha₅ s (by omega)) h₈₂
· exact (ha₅ s (by omega)) h₈₂
· push_neg at ha₁₃
by_cases ha₁₄: abs ((↑a : ℤ) - (22 : ℤ)) = 15
· apply (abs_eq (by norm_num)).mp at ha₁₄
obtain ha₁₄ | ha₁₄ := ha₁₄
· right; left
have hh₀: a = 37 := by bound
rw [hh₀] at h₁
simp at h₁
have hh₁: (784:ℤ) = 28 ^ 2 := by norm_num1
rw [hh₁] at h₁
apply pow_eq_pow_iff_cases.mp at h₁
simp at h₁
bound
· left
have hh₀: a = 7 := by bound
rw [hh₀] at h₁
simp at h₁
have hh₁: (784:ℤ) = 28 ^ 2 := by norm_num1
rw [hh₁] at h₁
apply pow_eq_pow_iff_cases.mp at h₁
simp at h₁
rw [hh₀]
rw [@Prod.mk_right_inj]
omega
· by_cases ha₁₅: abs ((↑a : ℤ) - (22 : ℤ)) < 28
· exfalso
interval_cases abs ((↑a : ℤ) - (22 : ℤ))
· exact false_of_ne ha₁₄
· exact (ha₆ s (by omega)) h₈₂
· exact (ha₇ s (by omega)) h₈₂
· exact (ha₇ s (by omega)) h₈₂
· exact (ha₈ s (by omega)) h₈₂
· exact (ha₉ s (by omega)) h₈₂
· exact (ha₁₀ s (by omega)) h₈₂
· exact (ha₁ s 22 (by omega)) h₈₂
· exact (ha₁ s 21 (by omega)) h₈₂
· exact (ha₁ s 20 (by omega)) h₈₂
· exact (ha₁ s 19 (by omega)) h₈₂
· exact (ha₁ s 18 (by omega)) h₈₂
· exact (ha₁ s 16 (by omega)) h₈₂
· by_cases ha₁₆: abs ((↑a : ℤ) - (22 : ℤ)) = 28
· right; right
have ha₁₇: a = 50 := by
apply (abs_eq (by norm_num)).mp at ha₁₆
omega
rw [ha₁₇]
rw [ha₁₇] at h₁
simp at h₁
have hh₀: (225:ℤ) = 15 ^ 2 := by bound
rw [hh₀] at h₁
apply pow_eq_pow_iff_cases.mp at h₁
simp at h₁
obtain h₁ | h₁ := h₁
· simp
right
omega
· simp
left
omega
· exfalso
interval_cases abs ((↑a : ℤ) - (22 : ℤ))
· exact false_of_ne ha₁₆
· exact (ha₁ s 12 (by omega)) h₈₂
· exact (ha₁ s 10 (by omega)) h₈₂
· exact (ha₁ s 6 (by omega)) h₈₂
lemma aux_2
(a b q r : ℕ)
(hp : 0 < a ∧ 0 < b)
(h₀ : r = (a ^ 2 + b ^ 2) % (a + b))
(h₁ : q = (a ^ 2 + b ^ 2) / (a + b)) :
q ^ 2 + r = 1977 → (a, b) ∈ solution_set := by
intro h₂
have hr₀: r = 1977 - q ^ 2 := by exact Nat.eq_sub_of_add_eq' h₂
have h₅₁: 0 < a + b := by linarith
have h₅₂: a ^ 2 + b ^ 2 = q * (a + b) + r := by
rw [h₀, h₁,]
exact Eq.symm (Nat.div_add_mod' (a ^ 2 + b ^ 2) (a + b))
have h₅₃: q ≤ 44 := by
by_contra hc₀
push_neg at hc₀
apply Nat.succ_le_iff.mpr at hc₀
have hc₁: 45 ^ 2 ≤ q ^ 2 := by exact Nat.pow_le_pow_left hc₀ 2
linarith
have h₅₄: 43 < q := by
have g₀: (a + b) ^ 2 ≤ 2 * (a ^ 2 + b ^ 2) := by exact add_sq_le
have g₁: 2 * (a ^ 2 + b ^ 2) < 2 * (45 * (a + b)) := by
refine (Nat.mul_lt_mul_left zero_lt_two).mpr ?_
have g₁₀: 45 = 44 + 1 := by linarith
rw [h₅₂, g₁₀, add_mul, one_mul]
refine add_lt_add_of_le_of_lt ?_ ?_
· exact Nat.mul_le_mul_right (a + b) h₅₃
· rw [h₀]
exact Nat.mod_lt (a ^ 2 + b ^ 2) h₅₁
have g₂: a + b < 90 := by
apply lt_of_le_of_lt g₀ at g₁
rw [pow_two] at g₁
rw [← mul_assoc] at g₁
simp at g₁
exact (Nat.mul_lt_mul_right h₅₁).mp g₁
have g₃: r < 90 := by
rw [h₀]
refine lt_trans ?_ g₂
exact Nat.mod_lt (a ^ 2 + b ^ 2) h₅₁
by_contra hc₀
push_neg at hc₀
have hc₁: q ^ 2 ≤ 43 ^ 2 := by exact Nat.pow_le_pow_left hc₀ 2
omega
have hq₀: q = 44 := by omega
rw [hq₀] at hr₀
norm_num at hr₀
rw [hq₀, hr₀] at h₅₂
have h₆: ((a:ℤ) - 22) ^ 2 + ((b:ℤ) - 22) ^ 2 = 1009 := by
ring_nf
linarith
apply eq_sub_of_add_eq' at h₆
by_cases ha₀: 53 < a
· exfalso
apply Nat.succ_le_iff.mpr at ha₀
simp at ha₀
have ha₁: 32 ^ 2 ≤ ((a:ℤ) - 22) ^ 2 := by
refine pow_le_pow_left₀ (by omega) (by omega) 2
have hb₁: 0 ≤ ((b:ℤ) - 22) ^ 2 := by positivity
omega
· push_neg at ha₀
exact aux_1 a b h₆ ha₀
theorem imo1977_p5
(a b q r : ℕ)
(hp: 0 < a ∧ 0 < b)
(h₀ : r = (a ^ 2 + b ^ 2) % (a + b))
(h₁ : q = (a ^ 2 + b ^ 2) / (a + b)) :
q ^ 2 + r = 1977 ↔ (a, b) ∈ solution_set := by
constructor
· exact fun (a_1 : q ^ 2 + r = 1977) ↦ aux_2 a b q r hp h₀ h₁ a_1
· simp
intro h₂
bound
end Imo1977P5 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1977P5.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 120, "latency_s": 6.7109, "verified_at": "2026-03-30T14:40:51.112455+00:00"}} | true | true | false | 6.7109 |
compfiles_Imo1977P6 | compfiles | Copyright (c) 2021 Tian Chen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Tian Chen
-/
import Mathlib
/-!
# International Mathematical Olympiad 1977, Problem 6
Suppose `f : ℕ+ → ℕ+` satisfies `f(f(n)) < f(n + 1)` for all `n`.
Prove that `f(n) = n` for all `n`.
-/
namespace Imo1977P6
/-
We first prove the problem statement for `f : ℕ → ℕ`
then we use it to prove the statement for positive naturals.
-/
theorem imo1977_p6_nat (f : ℕ → ℕ) (h : ∀ n, f (f n) < f (n + 1)) : ∀ n, f n = n := by
have h' : ∀ k n : ℕ, k ≤ n → k ≤ f n := by
intro k
induction k with
| zero => intros; exact Nat.zero_le _
| succ k h_ind =>
intro n hk
apply Nat.succ_le_of_lt
calc
k ≤ f (f (n - 1)) := h_ind _ (h_ind (n - 1) (le_tsub_of_add_le_right hk))
_ < f n := tsub_add_cancel_of_le (le_trans (Nat.succ_le_succ (Nat.zero_le _)) hk) ▸ h _
have hf : ∀ n, n ≤ f n := fun n => h' n n rfl.le
have hf_mono : StrictMono f := strictMono_nat_of_lt_succ fun _ => lt_of_le_of_lt (hf _) (h _)
intro
exact Nat.eq_of_le_of_lt_succ (hf _) (hf_mono.lt_iff_lt.mp (h _))
theorem imo1977_p6 (f : ℕ+ → ℕ+) (h : ∀ n, f (f n) < f (n + 1)) : ∀ n, f n = n := by
intro n
have := by
refine imo1977_p6_nat (fun m => if 0 < m then f m.toPNat' else 0) ?_ n
intro x; cases x
· simp
· simpa using h _
simpa
end Imo1977P6 | /- | /-
Copyright (c) 2021 Tian Chen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Tian Chen
-/
import Mathlib
/-!
# International Mathematical Olympiad 1977, Problem 6
Suppose `f : ℕ+ → ℕ+` satisfies `f(f(n)) < f(n + 1)` for all `n`.
Prove that `f(n) = n` for all `n`.
-/
namespace Imo1977P6
/-
We first prove the problem statement for `f : ℕ → ℕ`
then we use it to prove the statement for positive naturals.
-/
theorem imo1977_p6_nat (f : ℕ → ℕ) (h : ∀ n, f (f n) < f (n + 1)) : ∀ n, f n = n := by
have h' : ∀ k n : ℕ, k ≤ n → k ≤ f n := by
intro k
induction k with
| zero => intros; exact Nat.zero_le _
| succ k h_ind =>
intro n hk
apply Nat.succ_le_of_lt
calc
k ≤ f (f (n - 1)) := h_ind _ (h_ind (n - 1) (le_tsub_of_add_le_right hk))
_ < f n := tsub_add_cancel_of_le (le_trans (Nat.succ_le_succ (Nat.zero_le _)) hk) ▸ h _
have hf : ∀ n, n ≤ f n := fun n => h' n n rfl.le
have hf_mono : StrictMono f := strictMono_nat_of_lt_succ fun _ => lt_of_le_of_lt (hf _) (h _)
intro
exact Nat.eq_of_le_of_lt_succ (hf _) (hf_mono.lt_iff_lt.mp (h _))
theorem imo1977_p6 (f : ℕ+ → ℕ+) (h : ∀ n, f (f n) < f (n + 1)) : ∀ n, f n = n := by
intro n
have := by
refine imo1977_p6_nat (fun m => if 0 < m then f m.toPNat' else 0) ?_ n
intro x; cases x
· simp
· simpa using h _
simpa
end Imo1977P6
| true | Copyright (c) 2021 Tian Chen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Tian Chen
-/
import Mathlib
/-!
# International Mathematical Olympiad 1977, Problem 6
Suppose `f : ℕ+ → ℕ+` satisfies `f(f(n)) < f(n + 1)` for all `n`.
Prove that `f(n) = n` for all `n`.
-/
namespace Imo1977P6
/-
We first prove the problem statement for `f : ℕ → ℕ`
then we use it to prove the statement for positive naturals.
-/
theorem imo1977_p6_nat (f : ℕ → ℕ) (h : ∀ n, f (f n) < f (n + 1)) : ∀ n, f n = n := by
have h' : ∀ k n : ℕ, k ≤ n → k ≤ f n := by
intro k
induction k with
| zero => intros; exact Nat.zero_le _
| succ k h_ind =>
intro n hk
apply Nat.succ_le_of_lt
calc
k ≤ f (f (n - 1)) := h_ind _ (h_ind (n - 1) (le_tsub_of_add_le_right hk))
_ < f n := tsub_add_cancel_of_le (le_trans (Nat.succ_le_succ (Nat.zero_le _)) hk) ▸ h _
have hf : ∀ n, n ≤ f n := fun n => h' n n rfl.le
have hf_mono : StrictMono f := strictMono_nat_of_lt_succ fun _ => lt_of_le_of_lt (hf _) (h _)
intro
exact Nat.eq_of_le_of_lt_succ (hf _) (hf_mono.lt_iff_lt.mp (h _))
theorem imo1977_p6 (f : ℕ+ → ℕ+) (h : ∀ n, f (f n) < f (n + 1)) : ∀ n, f n = n := by
intro n
have := by
refine imo1977_p6_nat (fun m => if 0 < m then f m.toPNat' else 0) ?_ n
intro x; cases x
· simp
· simpa using h _
simpa
end Imo1977P6 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1977P6.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 600.0, "latency_s": 0.2406, "verified_at": "2026-03-26T18:16:41.586816+00:00"}} | true | true | false | 0.2406 |
compfiles_Imo1978P1 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1978, Problem 1
m and n are positive integers with m < n.
The last three decimal digits of 1978ᵐ are the same as the
last three decimal digits of 1978ⁿ.
Find m and n such that m + n has the least possible value.
-/
namespace Imo1978P1
abbrev solution : ℕ × ℕ := (3, 103)
abbrev ValidPair : ℕ × ℕ → Prop
| (m, n) => 1 ≤ m ∧ m < n ∧ (1978^m) % 1000 = (1978^n) % 1000
theorem imo1978_p1 (m n : ℕ)
(hmn : (m, n) = solution) :
ValidPair (m, n) ∧
(∀ m' n' : ℕ, ValidPair (m', n') → m + n ≤ m' + n') := by
-- We follow the informal solution at
-- https://prase.cz/kalva/imo/isoln/isoln781.html
constructor
· rw [hmn, solution, ValidPair]
norm_num
intro m' n' hmn'
-- We require 1978^m'(1978^(n'-m') - 1) to be a multiple of 1000=8·125.
dsimp only [ValidPair] at hmn'
obtain ⟨h1, h2, h3⟩ := hmn'
change _ ≡ _ [MOD 1000] at h3
rw [Nat.modEq_iff_dvd] at h3
push_cast at h3
replace h3 : (1000:ℤ) ∣ 1978 ^ m' * (1978 ^ (n' - m') - 1) := by
rw [mul_sub, mul_one]
rwa [pow_mul_pow_sub 1978 (Nat.le_of_succ_le h2)]
rw [show (1000 : ℤ) = 8 * 125 by norm_num] at h3
-- So we must have 8 divides 1978^m',
have h4 : (8 : ℤ) ∣ 1978 ^ m' := by
replace h3 : (8:ℤ) ∣ 1978 ^ m' * (1978 ^ (n' - m') - 1) :=
dvd_of_mul_right_dvd h3
have h5 : IsCoprime (8 : ℤ) (1978 ^ (n' - m') - 1) := by
rw [show (8 : ℤ) = 2 ^ 3 by norm_num]
refine IsCoprime.pow_left ?_
rw [Prime.coprime_iff_not_dvd Int.prime_two]
rw [show (1978 : ℤ) = 2 * 989 by norm_num]
have h6 : (2:ℤ) ∣ (2 * 989) ^ (n' - m') := by
rw [mul_pow]
exact Dvd.dvd.mul_right (dvd_pow_self 2 (Nat.sub_ne_zero_iff_lt.mpr h2)) _
rw [Int.dvd_iff_emod_eq_zero] at h6
rw [Int.two_dvd_ne_zero, Int.sub_emod, h6]
norm_num
exact IsCoprime.dvd_of_dvd_mul_right h5 h3
-- and hence m ≥ 3
have h5 : 3 ≤ m' := by
rw [show (1978 : ℤ) = 2 * 989 by norm_num] at h4
rw [show (8 : ℤ) = 2 ^ 3 by norm_num] at h4
rw [mul_pow] at h4
have h6 : IsCoprime ((2:ℤ)^3) (989 ^ m') := by
refine IsCoprime.pow_left ?_
rw [Prime.coprime_iff_not_dvd Int.prime_two, Int.two_dvd_ne_zero]
rw [←Int.odd_iff, Int.odd_pow]
exact Or.inl ⟨494, rfl⟩
replace h4 := IsCoprime.dvd_of_dvd_mul_right h6 h4
rw [pow_dvd_pow_iff (by norm_num) Int.prime_two.2.1] at h4
exact h4
-- and 125 divides 1978^(n'-m') - 1.
have h6 : (125 : ℤ) ∣ 1978^(n'-m') - 1 := by
obtain ⟨k, hk⟩ : ∃ k, k + 3 = m' := ⟨m' - 3, by omega⟩
rw [←hk] at h4
nth_rw 1 [←hk] at h3
have h7 : (1978:ℤ) ^ (k + 3) * (1978 ^ (n' - m') - 1) =
8 * (1978 ^ k * 989 ^ 3 * (1978 ^ (n' - m') - 1)) := by ring
rw [h7] at h3
rw [dvd_cancel_left_mem_nonZeroDivisors (mem_nonZeroDivisors_of_ne_zero (by norm_num))] at h3
have h8 : IsCoprime (125 : ℤ) (1978 ^ k) := IsCoprime.pow_right (by norm_num)
have h9 : IsCoprime (125 : ℤ) (989 ^ 3) := by norm_num
rw [mul_assoc] at h3
replace h3 := IsCoprime.dvd_of_dvd_mul_left h8 h3
exact IsCoprime.dvd_of_dvd_mul_left h9 h3
rw [Prod.mk.injEq] at hmn
obtain ⟨rfl, rfl⟩ := hmn
suffices H : 100 ≤ n' - m' by omega
suffices H : ∀ r, 0 < r → 125 ∣ (1978 : ℤ) ^ r - 1 → 100 ≤ r from H (n' - m') (by omega) h6
clear m' n' h1 h2 h3 h4 h5 h6
intro r
induction r using Nat.strong_induction_on with | h r ih =>
intro hr0 hr
-- By Euler's theorem, 1978^φ(125) = 1 (mod 125).
-- φ(125) = 125 - 25 = 100, so, 1978^100 = 1 (mod 125).
-- Hence the smallest r such that 1978^r = 1 (mod 125) must be a divisor of 100
-- (because if it was not, then the remainder on dividing it into 100 would give a smaller r).
by_cases h10 : r ∣ 100
swap
· let r' := 100 % r
have h12 : r' < r := by
unfold r'
exact Nat.mod_lt 100 hr0
have h14 : (125:ℤ) ∣ 1978 ^ r' - 1 := by
unfold r'
clear ih
have h19 : 1978 ^ r % 125 = 1 := by
rw [← Int.modEq_iff_dvd] at hr
change _ % _ = _ % _ at hr
dsimp at hr
zify
exact hr.symm
have h20 : (100 % r) + r * (100 / r) = 100 := Nat.mod_add_div _ _
apply_fun (1978 ^ ·) at h20
apply_fun (· % 125) at h20
rw [pow_add] at h20
simp only [Nat.reducePow, Nat.reduceMod] at h20
rw [pow_mul] at h20
rw [Nat.mul_mod] at h20
nth_rw 2 [Nat.pow_mod] at h20
rw [h19] at h20
simp only [one_pow, Nat.one_mod, mul_one, dvd_refl, Nat.mod_mod_of_dvd] at h20
rw [show 1 = 1 % 125 by rfl] at h20
zify at h20
exact Int.ModEq.dvd h20.symm
have h15 : 0 < r' := Nat.emod_pos_of_not_dvd h10
have h13 := ih r' h12 h15 h14
omega
have h11 : r ∈ Nat.divisors 100 := by
rw [Nat.mem_divisors]
exact ⟨h10, by norm_num⟩
have h12 : Nat.divisors 100 = {1,2,4,5,10,20,25,50,100} := by decide
rw [h12] at h11; clear h12
simp only [Finset.mem_insert, Finset.mem_singleton] at h11
omega
end Imo1978P1 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1978, Problem 1
m and n are positive integers with m < n.
The last three decimal digits of 1978ᵐ are the same as the
last three decimal digits of 1978ⁿ.
Find m and n such that m + n has the least possible value.
-/
namespace Imo1978P1
abbrev solution : ℕ × ℕ := (3, 103)
abbrev ValidPair : ℕ × ℕ → Prop
| (m, n) => 1 ≤ m ∧ m < n ∧ (1978^m) % 1000 = (1978^n) % 1000
theorem imo1978_p1 (m n : ℕ)
(hmn : (m, n) = solution) :
ValidPair (m, n) ∧
(∀ m' n' : ℕ, ValidPair (m', n') → m + n ≤ m' + n') := by
-- We follow the informal solution at
-- https://prase.cz/kalva/imo/isoln/isoln781.html
constructor
· rw [hmn, solution, ValidPair]
norm_num
intro m' n' hmn'
-- We require 1978^m'(1978^(n'-m') - 1) to be a multiple of 1000=8·125.
dsimp only [ValidPair] at hmn'
obtain ⟨h1, h2, h3⟩ := hmn'
change _ ≡ _ [MOD 1000] at h3
rw [Nat.modEq_iff_dvd] at h3
push_cast at h3
replace h3 : (1000:ℤ) ∣ 1978 ^ m' * (1978 ^ (n' - m') - 1) := by
rw [mul_sub, mul_one]
rwa [pow_mul_pow_sub 1978 (Nat.le_of_succ_le h2)]
rw [show (1000 : ℤ) = 8 * 125 by norm_num] at h3
-- So we must have 8 divides 1978^m',
have h4 : (8 : ℤ) ∣ 1978 ^ m' := by
replace h3 : (8:ℤ) ∣ 1978 ^ m' * (1978 ^ (n' - m') - 1) :=
dvd_of_mul_right_dvd h3
have h5 : IsCoprime (8 : ℤ) (1978 ^ (n' - m') - 1) := by
rw [show (8 : ℤ) = 2 ^ 3 by norm_num]
refine IsCoprime.pow_left ?_
rw [Prime.coprime_iff_not_dvd Int.prime_two]
rw [show (1978 : ℤ) = 2 * 989 by norm_num]
have h6 : (2:ℤ) ∣ (2 * 989) ^ (n' - m') := by
rw [mul_pow]
exact Dvd.dvd.mul_right (dvd_pow_self 2 (Nat.sub_ne_zero_iff_lt.mpr h2)) _
rw [Int.dvd_iff_emod_eq_zero] at h6
rw [Int.two_dvd_ne_zero, Int.sub_emod, h6]
norm_num
exact IsCoprime.dvd_of_dvd_mul_right h5 h3
-- and hence m ≥ 3
have h5 : 3 ≤ m' := by
rw [show (1978 : ℤ) = 2 * 989 by norm_num] at h4
rw [show (8 : ℤ) = 2 ^ 3 by norm_num] at h4
rw [mul_pow] at h4
have h6 : IsCoprime ((2:ℤ)^3) (989 ^ m') := by
refine IsCoprime.pow_left ?_
rw [Prime.coprime_iff_not_dvd Int.prime_two, Int.two_dvd_ne_zero]
rw [←Int.odd_iff, Int.odd_pow]
exact Or.inl ⟨494, rfl⟩
replace h4 := IsCoprime.dvd_of_dvd_mul_right h6 h4
rw [pow_dvd_pow_iff (by norm_num) Int.prime_two.2.1] at h4
exact h4
-- and 125 divides 1978^(n'-m') - 1.
have h6 : (125 : ℤ) ∣ 1978^(n'-m') - 1 := by
obtain ⟨k, hk⟩ : ∃ k, k + 3 = m' := ⟨m' - 3, by omega⟩
rw [←hk] at h4
nth_rw 1 [←hk] at h3
have h7 : (1978:ℤ) ^ (k + 3) * (1978 ^ (n' - m') - 1) =
8 * (1978 ^ k * 989 ^ 3 * (1978 ^ (n' - m') - 1)) := by ring
rw [h7] at h3
rw [dvd_cancel_left_mem_nonZeroDivisors (mem_nonZeroDivisors_of_ne_zero (by norm_num))] at h3
have h8 : IsCoprime (125 : ℤ) (1978 ^ k) := IsCoprime.pow_right (by norm_num)
have h9 : IsCoprime (125 : ℤ) (989 ^ 3) := by norm_num
rw [mul_assoc] at h3
replace h3 := IsCoprime.dvd_of_dvd_mul_left h8 h3
exact IsCoprime.dvd_of_dvd_mul_left h9 h3
rw [Prod.mk.injEq] at hmn
obtain ⟨rfl, rfl⟩ := hmn
suffices H : 100 ≤ n' - m' by omega
suffices H : ∀ r, 0 < r → 125 ∣ (1978 : ℤ) ^ r - 1 → 100 ≤ r from H (n' - m') (by omega) h6
clear m' n' h1 h2 h3 h4 h5 h6
intro r
induction r using Nat.strong_induction_on with | h r ih =>
intro hr0 hr
-- By Euler's theorem, 1978^φ(125) = 1 (mod 125).
-- φ(125) = 125 - 25 = 100, so, 1978^100 = 1 (mod 125).
-- Hence the smallest r such that 1978^r = 1 (mod 125) must be a divisor of 100
-- (because if it was not, then the remainder on dividing it into 100 would give a smaller r).
by_cases h10 : r ∣ 100
swap
· let r' := 100 % r
have h12 : r' < r := by
unfold r'
exact Nat.mod_lt 100 hr0
have h14 : (125:ℤ) ∣ 1978 ^ r' - 1 := by
unfold r'
clear ih
have h19 : 1978 ^ r % 125 = 1 := by
rw [← Int.modEq_iff_dvd] at hr
change _ % _ = _ % _ at hr
dsimp at hr
zify
exact hr.symm
have h20 : (100 % r) + r * (100 / r) = 100 := Nat.mod_add_div _ _
apply_fun (1978 ^ ·) at h20
apply_fun (· % 125) at h20
rw [pow_add] at h20
simp only [Nat.reducePow, Nat.reduceMod] at h20
rw [pow_mul] at h20
rw [Nat.mul_mod] at h20
nth_rw 2 [Nat.pow_mod] at h20
rw [h19] at h20
simp only [one_pow, Nat.one_mod, mul_one, dvd_refl, Nat.mod_mod_of_dvd] at h20
rw [show 1 = 1 % 125 by rfl] at h20
zify at h20
exact Int.ModEq.dvd h20.symm
have h15 : 0 < r' := Nat.emod_pos_of_not_dvd h10
have h13 := ih r' h12 h15 h14
omega
have h11 : r ∈ Nat.divisors 100 := by
rw [Nat.mem_divisors]
exact ⟨h10, by norm_num⟩
have h12 : Nat.divisors 100 = {1,2,4,5,10,20,25,50,100} := by decide
rw [h12] at h11; clear h12
simp only [Finset.mem_insert, Finset.mem_singleton] at h11
omega
end Imo1978P1
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1978, Problem 1
m and n are positive integers with m < n.
The last three decimal digits of 1978ᵐ are the same as the
last three decimal digits of 1978ⁿ.
Find m and n such that m + n has the least possible value.
-/
namespace Imo1978P1
abbrev solution : ℕ × ℕ := (3, 103)
abbrev ValidPair : ℕ × ℕ → Prop
| (m, n) => 1 ≤ m ∧ m < n ∧ (1978^m) % 1000 = (1978^n) % 1000
theorem imo1978_p1 (m n : ℕ)
(hmn : (m, n) = solution) :
ValidPair (m, n) ∧
(∀ m' n' : ℕ, ValidPair (m', n') → m + n ≤ m' + n') := by
-- We follow the informal solution at
-- https://prase.cz/kalva/imo/isoln/isoln781.html
constructor
· rw [hmn, solution, ValidPair]
norm_num
intro m' n' hmn'
-- We require 1978^m'(1978^(n'-m') - 1) to be a multiple of 1000=8·125.
dsimp only [ValidPair] at hmn'
obtain ⟨h1, h2, h3⟩ := hmn'
change _ ≡ _ [MOD 1000] at h3
rw [Nat.modEq_iff_dvd] at h3
push_cast at h3
replace h3 : (1000:ℤ) ∣ 1978 ^ m' * (1978 ^ (n' - m') - 1) := by
rw [mul_sub, mul_one]
rwa [pow_mul_pow_sub 1978 (Nat.le_of_succ_le h2)]
rw [show (1000 : ℤ) = 8 * 125 by norm_num] at h3
-- So we must have 8 divides 1978^m',
have h4 : (8 : ℤ) ∣ 1978 ^ m' := by
replace h3 : (8:ℤ) ∣ 1978 ^ m' * (1978 ^ (n' - m') - 1) :=
dvd_of_mul_right_dvd h3
have h5 : IsCoprime (8 : ℤ) (1978 ^ (n' - m') - 1) := by
rw [show (8 : ℤ) = 2 ^ 3 by norm_num]
refine IsCoprime.pow_left ?_
rw [Prime.coprime_iff_not_dvd Int.prime_two]
rw [show (1978 : ℤ) = 2 * 989 by norm_num]
have h6 : (2:ℤ) ∣ (2 * 989) ^ (n' - m') := by
rw [mul_pow]
exact Dvd.dvd.mul_right (dvd_pow_self 2 (Nat.sub_ne_zero_iff_lt.mpr h2)) _
rw [Int.dvd_iff_emod_eq_zero] at h6
rw [Int.two_dvd_ne_zero, Int.sub_emod, h6]
norm_num
exact IsCoprime.dvd_of_dvd_mul_right h5 h3
-- and hence m ≥ 3
have h5 : 3 ≤ m' := by
rw [show (1978 : ℤ) = 2 * 989 by norm_num] at h4
rw [show (8 : ℤ) = 2 ^ 3 by norm_num] at h4
rw [mul_pow] at h4
have h6 : IsCoprime ((2:ℤ)^3) (989 ^ m') := by
refine IsCoprime.pow_left ?_
rw [Prime.coprime_iff_not_dvd Int.prime_two, Int.two_dvd_ne_zero]
rw [←Int.odd_iff, Int.odd_pow]
exact Or.inl ⟨494, rfl⟩
replace h4 := IsCoprime.dvd_of_dvd_mul_right h6 h4
rw [pow_dvd_pow_iff (by norm_num) Int.prime_two.2.1] at h4
exact h4
-- and 125 divides 1978^(n'-m') - 1.
have h6 : (125 : ℤ) ∣ 1978^(n'-m') - 1 := by
obtain ⟨k, hk⟩ : ∃ k, k + 3 = m' := ⟨m' - 3, by omega⟩
rw [←hk] at h4
nth_rw 1 [←hk] at h3
have h7 : (1978:ℤ) ^ (k + 3) * (1978 ^ (n' - m') - 1) =
8 * (1978 ^ k * 989 ^ 3 * (1978 ^ (n' - m') - 1)) := by ring
rw [h7] at h3
rw [dvd_cancel_left_mem_nonZeroDivisors (mem_nonZeroDivisors_of_ne_zero (by norm_num))] at h3
have h8 : IsCoprime (125 : ℤ) (1978 ^ k) := IsCoprime.pow_right (by norm_num)
have h9 : IsCoprime (125 : ℤ) (989 ^ 3) := by norm_num
rw [mul_assoc] at h3
replace h3 := IsCoprime.dvd_of_dvd_mul_left h8 h3
exact IsCoprime.dvd_of_dvd_mul_left h9 h3
rw [Prod.mk.injEq] at hmn
obtain ⟨rfl, rfl⟩ := hmn
suffices H : 100 ≤ n' - m' by omega
suffices H : ∀ r, 0 < r → 125 ∣ (1978 : ℤ) ^ r - 1 → 100 ≤ r from H (n' - m') (by omega) h6
clear m' n' h1 h2 h3 h4 h5 h6
intro r
induction r using Nat.strong_induction_on with | h r ih =>
intro hr0 hr
-- By Euler's theorem, 1978^φ(125) = 1 (mod 125).
-- φ(125) = 125 - 25 = 100, so, 1978^100 = 1 (mod 125).
-- Hence the smallest r such that 1978^r = 1 (mod 125) must be a divisor of 100
-- (because if it was not, then the remainder on dividing it into 100 would give a smaller r).
by_cases h10 : r ∣ 100
swap
· let r' := 100 % r
have h12 : r' < r := by
unfold r'
exact Nat.mod_lt 100 hr0
have h14 : (125:ℤ) ∣ 1978 ^ r' - 1 := by
unfold r'
clear ih
have h19 : 1978 ^ r % 125 = 1 := by
rw [← Int.modEq_iff_dvd] at hr
change _ % _ = _ % _ at hr
dsimp at hr
zify
exact hr.symm
have h20 : (100 % r) + r * (100 / r) = 100 := Nat.mod_add_div _ _
apply_fun (1978 ^ ·) at h20
apply_fun (· % 125) at h20
rw [pow_add] at h20
simp only [Nat.reducePow, Nat.reduceMod] at h20
rw [pow_mul] at h20
rw [Nat.mul_mod] at h20
nth_rw 2 [Nat.pow_mod] at h20
rw [h19] at h20
simp only [one_pow, Nat.one_mod, mul_one, dvd_refl, Nat.mod_mod_of_dvd] at h20
rw [show 1 = 1 % 125 by rfl] at h20
zify at h20
exact Int.ModEq.dvd h20.symm
have h15 : 0 < r' := Nat.emod_pos_of_not_dvd h10
have h13 := ih r' h12 h15 h14
omega
have h11 : r ∈ Nat.divisors 100 := by
rw [Nat.mem_divisors]
exact ⟨h10, by norm_num⟩
have h12 : Nat.divisors 100 = {1,2,4,5,10,20,25,50,100} := by decide
rw [h12] at h11; clear h12
simp only [Finset.mem_insert, Finset.mem_singleton] at h11
omega
end Imo1978P1 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1978P1.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unsolved goals\nm n : \u2115\nhmn : (m, n) = solution\nm' n' : \u2115\nh1 : 1 \u2264 m'\nh2 : m' < n'\nh3 : 8 * 125 \u2223 1978 ^ m' * (1978 ^ (n' - m') - 1)\nh4 : 8 \u2223 1978 ^ m'\nh5 : 3 \u2264 m'\n\u22a2 m' - 3 + 3 = m'", "unsolved goals\ncase intro\nm n : \u2115\nhmn : (m, n) = solution\nm' n' : \u2115\nh1 : 1 \u2264 m'\nh2 : m' < n'\nh3 : 8 * 125 \u2223 1978 ^ m' * (1978 ^ (n' - m') - 1)\nh4 : 8 \u2223 1978 ^ m'\nh5 : 3 \u2264 m'\nk : \u2115\nhk : k + 3 = m'\n\u22a2 125 \u2223 1978 ^ (n' - m') - 1", "unsolved goals\ncase right.intro.intro\nm n : \u2115\nhmn : (m, n) = solution\nm' n' : \u2115\nh1 : 1 \u2264 m'\nh2 : m' < n'\nh3 : 8 * 125 \u2223 1978 ^ m' * (1978 ^ (n' - m') - 1)\nh4 : 8 \u2223 1978 ^ m'\nh5 : 3 \u2264 m'\nh6 : 125 \u2223 1978 ^ (n' - m') - 1\n\u22a2 m + n \u2264 m' + n'"], "timeout_s": 600.0, "latency_s": 0.6238, "verified_at": "2026-03-26T18:16:42.210822+00:00"}} | false | true | false | 0.6238 |
compfiles_Imo1978P5 | compfiles | Copyright (c) 2025 Roozbeh Yousefzadeh. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1978, Problem 5
Let a_k be a sequence of distinct positive integers for k = 1,2,3, ...
Prove that for all natural numbers n, we have:
sum_{k=1}^{n} a(k)/(k^2) >= sum_{k=1}^{n} (1/k).
-/
open Finset
namespace Imo1978P5
lemma aux₁
{n : ℕ}
(f : ℕ → ℕ)
(h₀ : ∀ (m : ℕ), 0 < m → 0 < f m)
(h₁ : ∀ (p q : ℕ), 0 < p → 0 < q → p ≠ q → f p ≠ f q)
(h₂ : 0 < n) :
∑ k ∈ Finset.Icc 1 n, ((k):ℝ) / (k) ^ 2 ≤ ∑ k ∈ Finset.Icc 1 n, ((f k):ℝ) / (k) ^ 2 := by
let s := Finset.Icc 1 n
let f₀ : ℕ → ℝ := fun k => 1 / (k:ℝ) ^ 2
let f₁ : ℕ → ℝ := fun k => (k:ℝ)
let f₂ : ℕ → ℝ := fun k => ((f k):ℝ)
have h₃: ∑ k ∈ Icc 1 n, (k : ℝ) / k ^ 2 = ∑ k ∈ Icc 1 n, f₁ k • f₀ k := by
refine Finset.sum_congr rfl ?_
intro x _
rw [div_eq_mul_one_div, smul_eq_mul]
have h₄: ∑ k ∈ Icc 1 n, ((f k):ℝ) / (k) ^ 2 = ∑ k ∈ Icc 1 n, f₂ k • f₀ k := by
refine Finset.sum_congr rfl ?_
intro x _
rw [div_eq_mul_one_div, smul_eq_mul]
let sf : Finset ℝ := Finset.image f₂ (Finset.Icc 1 n)
set sf_sorted : List ℝ := sf.sort (fun (x₁ x₂) => x₁ ≤ x₂) with hf₁
let f₃: ℕ → ℝ := fun k => sf_sorted.getD (k - 1) 0
have hf₀: ∀ k, f₃ k = sf_sorted.getD (k - 1) 0 := by exact fun k => rfl
have hf₂: sf = Finset.image f₂ s := by rfl
have hf₃: f₂ = fun k => ((f k):ℝ) := by rfl
have hl₁: s.card = n := by
have g₀: s = Icc 1 n := by rfl
rw [g₀]
refine Nat.le_induction ?_ ?_ n h₂
· simp
· simp
have hf₄: sf_sorted.length = n ∧ (sort (image f s) (fun x₁ x₂ => x₁ ≤ x₂) ).length = n := by
have hl₂: sf.card = n := by
rw [← hl₁]
refine Finset.card_image_of_injOn ?_
intro p hp₀ q hq₀ hpq
have hf₅: f₂ = fun k => ((f k):ℝ) := by rfl
contrapose! hpq
rw [hf₅]
simp only [ne_eq, Nat.cast_inj]
refine h₁ p q ?_ ?_ hpq
· norm_cast at hp₀
apply Finset.mem_Icc.mp at hp₀
exact hp₀.1
· norm_cast at hq₀
apply Finset.mem_Icc.mp at hq₀
exact hq₀.1
have hl₃: (image f s).card = n := by
rw [← hl₁]
refine Finset.card_image_of_injOn ?_
intro p hp₀ q hq₀ hpq
contrapose! hpq
refine h₁ p q ?_ ?_ hpq
· norm_cast at hp₀
apply Finset.mem_Icc.mp at hp₀
exact hp₀.1
· norm_cast at hq₀
apply Finset.mem_Icc.mp at hq₀
exact hq₀.1
constructor
· rw [← hl₂]
exact length_sort fun x₁ x₂ => x₁ ≤ x₂
· rw [← hl₃]
exact length_sort fun x₁ x₂ => x₁ ≤ x₂
have hf₅: ∀ a ∈ s, a - 1 < sf_sorted.length := by
intro a ha₀
rw [hf₄.1]
apply Finset.mem_Icc.mp at ha₀
omega
have hf₆: ∀ k ∈ s, 1 ≤ f₃ k := by
have hs₂: ∀ k ∈ sf_sorted, 1 ≤ k := by
rw [hf₁, hf₂, hf₃]
simp only [mem_sort, mem_image, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂, Nat.one_le_cast]
intro k hk₀
apply Finset.mem_Icc.mp at hk₀
exact h₀ k hk₀.1
have hs₃: ∀ k ∈ s, f₃ k ∈ sf_sorted := by
intro k hk₀
rw [hf₀]
have hk₁: k - 1 < sf_sorted.length := by exact hf₅ k hk₀
rw [List.getD_eq_getElem sf_sorted 0 hk₁]
exact List.getElem_mem hk₁
intro k hk₀
exact hs₂ (f₃ k) (hs₃ k hk₀)
have hf₇: ∀ a : ℕ, a ∈ Icc 1 n → ∀ b : ℕ, b ∈ Icc 1 n → a < b → f₃ a + 1 ≤ f₃ b := by
intro a ha₀ b hb₀ hab
rw [hf₀, hf₀]
have ha₁: a - 1 < sf_sorted.length := by exact hf₅ a ha₀
have hb₁: b - 1 < sf_sorted.length := by exact hf₅ b hb₀
rw [hf₁, hf₂]
let sfo : Finset ℕ := image f s
have hso₂: ∀ k ∈ s, ((image f₂ s).sort (fun x₁ x₂ => x₁ ≤ x₂)).getD (k - 1) 0
= ((image f s).sort (fun x₁ x₂ => x₁ ≤ x₂)).getD (k - 1) 0 := by
intro k hk₀
have hk₃: Function.Injective f₁ := CharZero.cast_injective
let fe : ℕ ↪ ℝ := {toFun := f₁ , inj' := hk₃}
have hk₅: ((image f₂ s).sort (fun x₁ x₂ => x₁ ≤ x₂)) =
List.map f₁ ((image f s).sort (fun x₁ x₂ => x₁ ≤ x₂)) := by
have hh₀: fe = {toFun := f₁ , inj' := hk₃} := by rfl
have hh₁: (image f₂ s) = Finset.map fe (image f s) := by
rw [hf₃, hh₀]
refine Finset.induction_on_min s ?_ ?_
· simp
· intro z sz _ hz₁
simp only [image_insert, map_insert, Function.Embedding.coeFn_mk]
exact congrArg (insert ↑(f z)) hz₁
rw [hh₁]
refine Finset.induction_on_min (image f s) ?_ ?_
· simp
· intro z sz hz₀ hz₁
have hz₂: z ∉ sz := by
contrapose! hz₀
use z
simp only [map_insert]
have hz₃: fe z = (z:ℝ) := by exact rfl
rw [hz₃]
have hz₄: ∀ b ∈ sz, (fun x₁ x₂ => x₁ ≤ x₂) z b := by
intro b a
exact Nat.le_of_succ_le (hz₀ b a)
have hz₅: ∀ b ∈ map fe sz, (fun x₁ x₂ => x₁ ≤ x₂) (↑z:ℝ) b := by
intro y hy₀
have hy₁: ∃ d:ℕ, d ∈ sz ∧ (d:ℝ) = y := by exact Multiset.mem_map.mp hy₀
obtain ⟨d, hd₀, hd₁⟩ := hy₁
refine le_of_lt ?_
rw [← hd₁]
exact Nat.cast_lt.mpr (hz₀ d hd₀)
have hz₆: (↑z:ℝ) ∉ map fe sz := by
simp only [mem_map, not_exists, not_and]
intro x hx₀
rw [hh₀]
simp only [Function.Embedding.coeFn_mk]
have hx₁: ∀ x:ℕ, f₁ x = (x:ℝ) := by exact fun x => rfl
rw [hx₁]
norm_cast
exact Nat.ne_of_lt' (hz₀ x hx₀)
rw [Finset.sort_insert (fun x₁ x₂ => x₁ ≤ x₂) hz₄ hz₂]
rw [Finset.sort_insert (fun x₁ x₂ => x₁ ≤ x₂) hz₅ hz₆]
simp only [List.map_cons, List.cons.injEq]
exact List.cons_eq_cons.mp (congrArg (List.cons ↑z) hz₁)
have hk₁: k - 1 < (List.map f₁ (sfo.sort (fun x₁ x₂ => x₁ ≤ x₂))).length := by
rw [← hk₅]
exact hf₅ k hk₀
have hk₂: k - 1 < (sfo.sort (fun x₁ x₂ => x₁ ≤ x₂)).length := by
rw [hf₄.2, ← hf₄.1]
exact hf₅ k hk₀
rw [hk₅, List.getD_eq_getElem _ 0 hk₁, List.getD_eq_getElem _ 0 hk₂]
exact List.getElem_map f₁
rw [hso₂ a ha₀, hso₂ b hb₀]
norm_cast
refine Nat.succ_le_of_lt ?_
have ha₂: a - 1 < ((image f s).sort (fun x₁ x₂ => x₁ ≤ x₂)).length := by
rw [hf₄.2, ← hf₄.1]
exact ha₁
have hb₂: b - 1 < ((image f s).sort (fun x₁ x₂ => x₁ ≤ x₂)).length := by
rw [hf₄.2, ← hf₄.1]
exact hb₁
rw [List.getD_eq_getElem _ 0 ha₂, List.getD_eq_getElem _ 0 hb₂]
refine List.Pairwise.rel_get_of_lt ?_ ?_
· have := Finset.sortedLT_sort (image f s)
rw [List.sortedLT_iff_pairwise] at this
exact this
simp only [Fin.mk_lt_mk]
apply Finset.mem_Icc.mp at ha₀
apply Finset.mem_Icc.mp at hb₀
omega
have hρ: ∃ ρ: Equiv.Perm ℕ, (∀ a ∈ Icc 1 n, f₂ a = f₃ (ρ a)) ∧ ∀ a ∉ Icc 1 n, ρ a = a := by
let so : Finset ℕ := image f (Icc 1 n)
let lo_sorted : List ℕ := so.sort (fun x₁ x₂ => x₁ ≤ x₂)
let sl := List.range' 1 n 1
have hs₀: sl = List.range' 1 n 1 := by rfl
let lo : List ℕ := List.map f sl
let f₄ : ℕ → ℕ := fun k => lo_sorted.getD (k - 1) 0
let f₅ : ℕ → ℕ := fun k => (List.findIdx (fun x => x = f k) lo_sorted) + 1
let f₆ : ℕ → ℕ := fun k => ite (k ∈ s) (f₅ k) (k)
let f₈ : ℕ → ℕ := fun k => (List.findIdx (fun x => x = f₄ k) lo) + 1
let f₉ : ℕ → ℕ := fun k => ite (k ∈ s) (f₈ k) (k)
have gg₀: f₄ = fun k => lo_sorted.getD (k - 1) 0 := by rfl
have gg₁: f₅ = fun k => List.findIdx (fun x => decide (x = f k)) lo_sorted + 1 := by rfl
have gg₂: f₆ = fun k => if k ∈ s then f₅ k else k := by rfl
have gg₃: f₈ = fun k => (List.findIdx (fun x => x = f₄ k) lo) + 1 := by rfl
have gg₄: f₉ = fun k => ite (k ∈ s) (f₈ k) (k) := by rfl
have gg₅: ∀ k ∈ s, f₆ k = f₅ k := by
intro k hk₀
rw [gg₂]
simp only [ite_eq_left_iff]
intro hk₁
exact False.elim (hk₁ hk₀)
have gg₆: ∀ k ∈ s, f₉ k = f₈ k := by grind
have gg₇: ∀ k ∉ s, f₆ k = k := by grind
have gg₈: ∀ k ∉ s, f₉ k = k := by grind
have gg₉: lo_sorted.length = n := by grind
have gg₁₀: ∀ k ∈ s, f₅ k ∈ s := by
intro k hk₀
refine Finset.mem_Icc.mpr ?_
constructor
· exact Nat.le_add_left 1 (List.findIdx (fun y => decide (y = f k)) lo_sorted)
· have hk₁: List.findIdx (fun x => decide (x = f k)) lo_sorted < lo_sorted.length := by
refine List.findIdx_lt_length.mpr ?_
use (f k)
constructor
· refine (mem_sort fun x₁ x₂ => x₁ ≤ x₂).mpr ?_
exact mem_image_of_mem f hk₀
· exact of_decide_eq_self_eq_true (f k)
rw [gg₉] at hk₁
refine Nat.le_of_lt_succ ?_
exact Nat.add_lt_of_lt_sub hk₁
have gg₁₁: lo.length = n := by
have g₀: lo = List.map f sl := by rfl
rw [g₀, hs₀]
simp
have gg₁₂: ∀ k ∈ s, f₈ k ∈ s := by
intro k hk₀
refine Finset.mem_Icc.mpr ?_
constructor
· exact Nat.le_add_left 1 (List.findIdx (fun x => decide (x = f₄ k)) lo)
· have hk₁: List.findIdx (fun x => decide (x = f₄ k)) lo < lo.length := by
refine List.findIdx_lt_length.mpr ?_
use (f₄ k)
constructor
· have hk₁: k - 1 < lo.length := by
rw [gg₁₁]
apply Finset.mem_Icc.mp at hk₀
exact Nat.sub_one_lt_of_le hk₀.1 hk₀.2
have hk₂: lo_sorted = so.sort (fun x₁ x₂ => x₁ ≤ x₂) := by rfl
have hk₃: lo = List.map f sl := by rfl
rw [gg₀, hk₂, hk₃]
ring_nf
have hk₄: so = image f (Icc 1 n) := by rfl
rw [gg₁₁, ← gg₉, hk₂, hk₄] at hk₁
rw [List.getD_eq_getElem _ 0 hk₁]
let j : ℕ := ((image f (Icc 1 n)).sort (fun x₁ x₂ => x₁ ≤ x₂))[k - 1]
have hj₀: j = ((image f (Icc 1 n)).sort (fun x₁ x₂ => x₁ ≤ x₂))[k - 1] := by rfl
have hj₁: j ∈ ((image f (Icc 1 n)).sort (fun x₁ x₂ => x₁ ≤ x₂)) := List.getElem_mem hk₁
have hj₂: j ∈ image f s := by exact (mem_sort fun x₁ x₂ => x₁ ≤ x₂).mp hj₁
rw [← hj₀]
exact List.mem_dedup.mp hj₂
· exact of_decide_eq_self_eq_true (f₄ k)
rw [gg₁₁] at hk₁
refine Nat.le_of_lt_succ ?_
exact Nat.add_lt_of_lt_sub hk₁
have gg₁₃: sf_sorted = List.map f₁ lo_sorted := by
have g₀: Function.Injective f₁ := by exact CharZero.cast_injective
let fe : ℕ ↪ ℝ := {toFun := f₁ , inj' := g₀}
have hh₀: fe = {toFun := f₁ , inj' := g₀} := by rfl
have hh₁: (image f₂ s) = Finset.map fe (image f s) := by
rw [hf₃, hh₀]
refine Finset.induction_on_min s ?_ ?_
· simp
· intro z sz _ hz₁
simp only [image_insert, map_insert, Function.Embedding.coeFn_mk]
exact congrArg (insert ↑(f z)) hz₁
have g₁: lo_sorted = so.sort (fun x₁ x₂ => x₁ ≤ x₂) := by rfl
have g₂: so = image f s := by rfl
rw [hf₁, hf₂, g₁, g₂, hh₁]
refine Finset.induction_on_min (image f s) ?_ ?_
· simp
· intro z sz hz₀ hz₁
have hz₂: z ∉ sz := by
contrapose! hz₀
use z
simp only [map_insert]
have hz₃ : fe z = (z:ℝ) := rfl
rw [hz₃]
have hz₄: ∀ b ∈ sz, (fun x₁ x₂ => x₁ ≤ x₂) z b := by
simp only
exact fun b a => Nat.le_of_succ_le (hz₀ b a)
have hz₅: ∀ b ∈ map fe sz, (fun x₁ x₂ => x₁ ≤ x₂) (↑z:ℝ) b := by
intro y hy₀
have hy₁: ∃ d:ℕ, d ∈ sz ∧ (d:ℝ) = y := by exact Multiset.mem_map.mp hy₀
obtain ⟨d, hd₀, hd₁⟩ := hy₁
refine le_of_lt ?_
rw [← hd₁]
exact Nat.cast_lt.mpr (hz₀ d hd₀)
have hz₆: (↑z:ℝ) ∉ map fe sz := by
simp only [mem_map, not_exists, not_and]
intro x hx₀
rw [hh₀]
simp only [Function.Embedding.coeFn_mk]
have hx₁: ∀ x:ℕ, f₁ x = (x:ℝ) := by exact fun x => rfl
rw [hx₁]
norm_cast
exact Nat.ne_of_lt' (hz₀ x hx₀)
rw [Finset.sort_insert (fun x₁ x₂ => x₁ ≤ x₂) hz₄ hz₂]
rw [Finset.sort_insert (fun x₁ x₂ => x₁ ≤ x₂) hz₅ hz₆]
simp only [List.map_cons, List.cons.injEq]
exact List.cons_eq_cons.mp (congrArg (List.cons ↑z) hz₁)
have gg₁₄: ∀ x y, x ∈ s → y ∈ s → f₄ x = f₄ y → x = y := by
intro x y hx₀ hy₀ hx₁
have hx₂: List.Nodup lo_sorted := by exact sort_nodup so (fun x₁ x₂ => x₁ ≤ x₂)
rw [gg₀] at hx₁
ring_nf at hx₁
have hx₃: x - 1 < lo_sorted.length := by
rw [gg₉]
apply Finset.mem_Icc.mp at hx₀
exact Nat.sub_one_lt_of_le hx₀.1 hx₀.2
have hy₁: y - 1 < lo_sorted.length := by
rw [gg₉]
apply Finset.mem_Icc.mp at hy₀
exact Nat.sub_one_lt_of_le hy₀.1 hy₀.2
rw [List.getD_eq_getElem _ 0 hx₃, List.getD_eq_getElem _ 0 hy₁] at hx₁
have hj₉: x - 1 = y - 1 := by
exact (List.Nodup.getElem_inj_iff hx₂).mp hx₁
apply Finset.mem_Icc.mp at hy₀
apply Finset.mem_Icc.mp at hx₀
rw [← Nat.sub_add_cancel hy₀.1, ← Nat.sub_add_cancel hx₀.1]
exact congr(HAdd.hAdd $hj₉ 1)
have hh₀: ∀ k ∈ s, f₄ (f₆ k) = f k := by
intro k hk₀
have g₀: f₆ k = f₅ k := gg₅ k hk₀
rw [g₀, gg₁]
simp only
let j := List.findIdx (fun x => decide (x = f k)) lo_sorted
have hj₀: j + 1 = List.findIdx (fun x => decide (x = f k)) lo_sorted + 1 := by rfl
have hj₁: List.findIdx (fun x => decide (x = f k)) lo_sorted < lo_sorted.length := by
refine List.findIdx_lt_length.mpr ?_
simp only [decide_eq_true_eq, exists_eq_right]
refine (mem_sort fun x₁ x₂ => x₁ ≤ x₂).mpr ?_
exact mem_image_of_mem f hk₀
have hj₂: f₄ (j + 1) = f k := by
let p := (fun (x) => decide (x = f k))
have hp₀: p = (fun (x) => decide (x = f k)) := by rfl
rw [gg₀, hj₀]
ring_nf
rw [add_comm 1, Nat.add_sub_cancel]
rw [← hp₀]
rw [← hp₀] at hj₁
rw [List.getD_eq_getElem _ 0 hj₁]
have g₁: p lo_sorted[List.findIdx p lo_sorted] = true := by
exact List.findIdx_getElem
refine decide_eq_true_iff.mp g₁
rw [← hj₀, hj₂]
have gg₁₅: ∀ x y, x ∈ s → y ∈ s → (f₄ x = f y ↔ f₈ x = y) := by
intro x y hx₀ hy₀
have hy₁: y - 1 < lo.length := by
rw [gg₁₁]
apply Finset.mem_Icc.mp at hy₀
exact Nat.sub_one_lt_of_le hy₀.1 hy₀.2
have hy₃: y - 1 < (List.range' 1 n 1).length := by
rw [List.length_range', ← gg₁₁]
exact hy₁
have hy₄: y - 1 < sl.length := by
rw [hs₀]
exact hy₃
have gg₁₆: lo = List.map f sl := by rfl
constructor
· intro hx₁
have hx₂: f₄ (f₆ y) = f y := by exact hh₀ y hy₀
have hx₃: x = f₅ y := by
rw [← hx₁, gg₅ y hy₀] at hx₂
exact gg₁₄ x (f₅ y) hx₀ (gg₁₀ y hy₀) (id (Eq.symm hx₂))
rw [hx₃]
apply Finset.mem_Icc.mp at hx₀
apply Finset.mem_Icc.mp at hy₀
have hx₄: x - 1 < lo_sorted.length := by
rw [gg₉]
exact Nat.sub_one_lt_of_le hx₀.1 hx₀.2
have hx₅: List.findIdx (fun x => decide (x = f y)) lo_sorted = x - 1 :=
Nat.eq_sub_of_add_eq hx₃.symm
apply (List.findIdx_eq hx₄).mp at hx₅
obtain ⟨hx₅, hx₆⟩ := hx₅
simp at hx₅ hx₆
rw [gg₃]
simp only
rw [← Nat.sub_add_cancel hy₀.1]
refine add_right_cancel_iff.mpr ?_
refine (List.findIdx_eq hy₁).mpr ?_
simp only [decide_eq_true_eq, decide_eq_false_iff_not]
constructor
· rw [Nat.sub_add_cancel hy₀.1]
apply Finset.mem_Icc.mpr at hy₀
rw [← gg₅ y hy₀, hh₀ y hy₀]
rw [← List.getD_eq_getElem lo 0 hy₁, gg₁₆]
rw [List.getD_eq_getElem (List.map f sl) 0 hy₁]
simp only [List.getElem_map]
refine congr rfl ?_
have g₀: sl = List.range' 1 n 1 := by rfl
rw [← List.getD_eq_getElem sl 0 hy₄, g₀]
rw [List.getD_eq_getElem (List.range' 1 n 1) 0 hy₃]
rw [List.getElem_range' hy₃]
omega
· intro j hj₀
rw [Nat.sub_add_cancel hy₀.1]
apply Finset.mem_Icc.mpr at hy₀
rw [← gg₅ y hy₀, hh₀ y hy₀]
have hj₁: j < lo.length := by exact Nat.lt_trans hj₀ hy₁
have hj₂: j < (List.map f sl).length := by exact Nat.lt_trans hj₀ hy₁
have hj₃: j < sl.length := by exact Nat.lt_trans hj₀ hy₃
have hj₄: j < (List.range' 1 n 1).length := by exact Nat.lt_trans hj₀ hy₃
rw [← List.getD_eq_getElem lo 0 hj₁, gg₁₆]
rw [List.getD_eq_getElem (List.map f sl) 0 hj₂]
simp only [List.getElem_map, ne_eq]
refine h₁ sl[j] y ?_ ?_ ?_
· have ht: ∀ t ∈ sl, 1 ≤ t := by
intro t ht₀
apply List.mem_range'.mp at ht₀
omega
refine ht sl[j] ?_
exact List.getElem_mem hj₄
· omega
· rw [List.getElem_range' hj₃]
omega
· intro hx₁
have hx₃: f (f₈ x) = f₄ x := by
rw [hx₁]
rw [gg₃] at hx₁
simp only at hx₁
have hy₅: List.findIdx (fun x_1 => decide (x_1 = f₄ x)) lo = y - 1 :=
Nat.eq_sub_of_add_eq hx₁
apply (List.findIdx_eq hy₁).mp at hy₅
obtain ⟨hy₅, hy₆⟩ := hy₅
simp only [decide_eq_true_eq, decide_eq_false_iff_not] at hy₅ hy₆
rw [← hy₅]
have hy₇: lo[y - 1] = (List.map f sl)[y - 1] := by
rw [← List.getD_eq_getElem (List.map f sl) 0 hy₁, ← gg₁₆]
rw [hy₇]
apply Finset.mem_Icc.mp at hy₀
simp only [List.getElem_map]
refine congr rfl ?_
have g₀: sl = List.range' 1 n 1 := by rfl
rw [← List.getD_eq_getElem sl 0 hy₄, g₀]
rw [List.getD_eq_getElem (List.range' 1 n 1) 0 hy₃]
rw [List.getElem_range' hy₃]
rw [one_mul, add_comm 1, Nat.sub_add_cancel hy₀.1]
rw [← hx₃]
exact congrArg f hx₁
have hh₁: ∀ x, (f₉ ∘ f₆) x = x := by
intro x
rw [Function.comp_def]
simp only
by_cases hx₀: x ∈ s
· have g₀: f₅ x ∈ s := by exact gg₁₀ x hx₀
rw [gg₅ x hx₀, gg₆ (f₅ x) g₀,]
let j := f₅ x
have hj₀: j = f₅ x := by rfl
have hj₁: f₄ j = f x := by
rw [hj₀, ← gg₅ x hx₀]
exact hh₀ x hx₀
exact (gg₁₅ j x (gg₁₀ x hx₀) hx₀).mp hj₁
· have g₀: f₆ x = x := by exact gg₇ x hx₀
have g₁: f₉ x = x := by exact gg₈ x hx₀
rw [g₀, g₁]
have hh₂: Function.LeftInverse f₉ f₆ := by
refine Function.leftInverse_iff_comp.mpr ?_
exact Function.RightInverse.id hh₁
have hh₃: Function.RightInverse f₉ f₆ := by
refine Function.rightInverse_iff_comp.mpr ?_
have hh₄: ∀ x, (f₆ ∘ f₉) x = x := by
intro x
rw [Function.comp_def]
simp only
by_cases hx₀: x ∈ s
· have g₀: f₈ x ∈ s := by exact gg₁₂ x hx₀
rw [gg₆ x hx₀, gg₅ (f₈ x) g₀,]
let j := f₈ x
have hj₀: j = f₈ x := by rfl
have hj₁: f₄ x = f j := by exact (gg₁₅ x j hx₀ (gg₁₂ x hx₀)).mpr hj₀.symm
rw [← hj₀]
have hj₂: j ∈ s := gg₁₂ x hx₀
have hj₃: f₄ (f₅ j) = f j := by
rw [← gg₅ j hj₂]
exact hh₀ j hj₂
rw [← hj₁] at hj₃
exact gg₁₄ (f₅ j) x (gg₁₀ j g₀) hx₀ hj₃
· have g₀: f₉ x = x := gg₈ x hx₀
have g₁: f₆ x = x := gg₇ x hx₀
rw [g₀, g₁]
exact Function.RightInverse.id hh₄
set ρ : Equiv.Perm ℕ := { toFun := f₆, invFun := f₉, left_inv := hh₂, right_inv := hh₃ }
have hh₅: ∀ k ∈ s, ρ k ∈ s := by
intro k hk₀
have hk₁: f₆ k ∈ s := by
rw [gg₅ k hk₀]
exact gg₁₀ k hk₀
exact hk₁
use ρ
constructor
· intro a ha₀
have ha₁: f₂ a = ((f a):ℝ) := by rfl
have ha₂: f₃ (ρ a) = ((f₄ (ρ a)):ℝ) := by
have ha₂: f₃ (ρ a) = sf_sorted.getD (ρ a - 1) 0 := by rfl
have ha₃: f₄ (ρ a) = lo_sorted.getD (ρ a - 1) 0 := by rfl
have ha₄: ρ a ∈ s := by exact hh₅ a ha₀
have ha₅: ρ a - 1 < sf_sorted.length := by
exact hf₅ (ρ a) (hh₅ a ha₀)
have ha₆: ρ a - 1 < lo_sorted.length := by
refine Nat.lt_of_succ_le ?_
apply Finset.mem_Icc.mp at ha₄
rw [gg₉, Nat.succ_eq_add_one, Nat.sub_add_cancel ha₄.1]
exact ha₄.2
rw [ha₂, ha₃]
rw [gg₁₃]
rw [gg₁₃] at ha₅
rw [List.getD_eq_getElem _ 0 ha₅, List.getD_eq_getElem _ 0 ha₆]
exact List.getElem_map f₁
rw [ha₁, ha₂,]
norm_cast
rw [← hh₀ a ha₀]
exact rfl
· intro a ha₀
exact gg₇ a ha₀
obtain ⟨ρ, hρ₀, hρ₁⟩ := hρ
have h₆: ∑ k ∈ Icc 1 n, f₃ k • f₀ k ≤ ∑ k ∈ Icc 1 n, f₂ k • f₀ k := by
have h₆₀: ∑ k ∈ Icc 1 n, f₂ k • f₀ k = ∑ k ∈ Icc 1 n, f₃ (ρ k) • f₀ k := by
refine Finset.sum_congr rfl ?_
intro x hx₀
rw [hρ₀ x hx₀]
rw [h₆₀]
refine AntivaryOn.sum_smul_le_sum_comp_perm_smul ?hfg ?hσ
· refine MonotoneOn.antivaryOn ?hfg.hf ?hfg.hg
· refine monotoneOn_iff_forall_lt.mpr ?hfg.hf.a
norm_cast
intro a ha₀ b hb₀ ha₁
have ha₂: f₃ a + 1 ≤ f₃ b := by exact hf₇ a ha₀ b hb₀ ha₁
refine le_trans ?_ ha₂
refine le_of_lt ?_
exact lt_add_one (f₃ a)
· refine antitoneOn_iff_forall_lt.mpr ?hfg.hg.a
norm_cast
intro a ha₀ b hb₀ ha₁
refine (one_div_le_one_div ?_ ?_).mpr ?_
· apply Finset.mem_Icc.mp at hb₀
norm_cast
exact Nat.pow_pos hb₀.1
· apply Finset.mem_Icc.mp at ha₀
norm_cast
exact Nat.pow_pos ha₀.1
· norm_cast
exact Nat.pow_le_pow_left (le_of_lt ha₁) 2
· intro x hx₀
contrapose! hx₀
exact fun a => a (hρ₁ x hx₀)
have h₇: ∑ k ∈ Icc 1 n, f₁ k • f₀ k ≤ ∑ k ∈ Icc 1 n, f₃ k • f₀ k := by
refine Finset.sum_le_sum ?_
intro x hx₀
have hx₁: 1 ≤ x := by
apply Finset.mem_Icc.mp at hx₀
exact hx₀.1
have hx₂: 0 < f₀ x := by
ring_nf
refine div_pos zero_lt_one ?_
norm_cast
exact Nat.pow_pos hx₁
refine (smul_le_smul_iff_of_pos_right hx₂).mpr ?_
have hh₀: f₁ = fun (k:ℕ) => (↑k:ℝ) := by rfl
rw [hh₀]
dsimp only
have hi: x ≤ n → (↑x:ℝ) ≤ f₃ x := by
refine Nat.le_induction ?_ ?_ x hx₁
· intro _
norm_cast
refine hf₆ 1 ?_
exact left_mem_Icc.mpr h₂
· intro y hy₀ hy₁ hy₂
have hy₃: y ≤ n := Nat.le_of_succ_le hy₂
have hy₄: f₃ y + 1 ≤ f₃ (y + 1) := by
refine hf₇ y ?_ (y + 1) ?_ (by omega)
· exact Finset.mem_Icc.mpr ⟨hy₀, hy₃⟩
· refine Finset.mem_Icc.mpr ⟨Nat.le_add_right_of_le hy₀, hy₂⟩
refine le_trans ?_ hy₄
simp only [Nat.cast_add, Nat.cast_one, add_le_add_iff_right]
exact hy₁ hy₃
refine hi ?_
apply Finset.mem_Icc.mp at hx₀
exact hx₀.2
rw [h₃, h₄]
refine le_trans h₇ h₆
theorem imo_1978_p5
(n : ℕ)
(f : ℕ → ℕ)
(h₀ : ∀ (m : ℕ), 0 < m → 0 < f m)
(h₁ : ∀ (p q : ℕ), 0 < p → 0 < q → p ≠ q → f p ≠ f q)
(h₂ : 0 < n) :
∑ k ∈ Finset.Icc 1 n, (1 : ℝ) / k ≤ ∑ k ∈ Finset.Icc 1 n, ((f k):ℝ) / k ^ 2 := by
have h₃ : ∑ k ∈ Icc 1 n, (k : ℝ) / k ^ 2 ≤ ∑ k ∈ Icc 1 n, ((f k):ℝ) / (k) ^ 2 :=
aux₁ f h₀ h₁ h₂
refine le_trans ?_ h₃
refine Finset.sum_le_sum ?_
intro x hx₀
rw [pow_two, ← div_div, div_self]
rw [Finset.mem_Icc] at hx₀
norm_cast
omega
end Imo1978P5 | /- | /-
Copyright (c) 2025 Roozbeh Yousefzadeh. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1978, Problem 5
Let a_k be a sequence of distinct positive integers for k = 1,2,3, ...
Prove that for all natural numbers n, we have:
sum_{k=1}^{n} a(k)/(k^2) >= sum_{k=1}^{n} (1/k).
-/
open Finset
namespace Imo1978P5
lemma aux₁
{n : ℕ}
(f : ℕ → ℕ)
(h₀ : ∀ (m : ℕ), 0 < m → 0 < f m)
(h₁ : ∀ (p q : ℕ), 0 < p → 0 < q → p ≠ q → f p ≠ f q)
(h₂ : 0 < n) :
∑ k ∈ Finset.Icc 1 n, ((k):ℝ) / (k) ^ 2 ≤ ∑ k ∈ Finset.Icc 1 n, ((f k):ℝ) / (k) ^ 2 := by
let s := Finset.Icc 1 n
let f₀ : ℕ → ℝ := fun k => 1 / (k:ℝ) ^ 2
let f₁ : ℕ → ℝ := fun k => (k:ℝ)
let f₂ : ℕ → ℝ := fun k => ((f k):ℝ)
have h₃: ∑ k ∈ Icc 1 n, (k : ℝ) / k ^ 2 = ∑ k ∈ Icc 1 n, f₁ k • f₀ k := by
refine Finset.sum_congr rfl ?_
intro x _
rw [div_eq_mul_one_div, smul_eq_mul]
have h₄: ∑ k ∈ Icc 1 n, ((f k):ℝ) / (k) ^ 2 = ∑ k ∈ Icc 1 n, f₂ k • f₀ k := by
refine Finset.sum_congr rfl ?_
intro x _
rw [div_eq_mul_one_div, smul_eq_mul]
let sf : Finset ℝ := Finset.image f₂ (Finset.Icc 1 n)
set sf_sorted : List ℝ := sf.sort (fun (x₁ x₂) => x₁ ≤ x₂) with hf₁
let f₃: ℕ → ℝ := fun k => sf_sorted.getD (k - 1) 0
have hf₀: ∀ k, f₃ k = sf_sorted.getD (k - 1) 0 := by exact fun k => rfl
have hf₂: sf = Finset.image f₂ s := by rfl
have hf₃: f₂ = fun k => ((f k):ℝ) := by rfl
have hl₁: s.card = n := by
have g₀: s = Icc 1 n := by rfl
rw [g₀]
refine Nat.le_induction ?_ ?_ n h₂
· simp
· simp
have hf₄: sf_sorted.length = n ∧ (sort (image f s) (fun x₁ x₂ => x₁ ≤ x₂) ).length = n := by
have hl₂: sf.card = n := by
rw [← hl₁]
refine Finset.card_image_of_injOn ?_
intro p hp₀ q hq₀ hpq
have hf₅: f₂ = fun k => ((f k):ℝ) := by rfl
contrapose! hpq
rw [hf₅]
simp only [ne_eq, Nat.cast_inj]
refine h₁ p q ?_ ?_ hpq
· norm_cast at hp₀
apply Finset.mem_Icc.mp at hp₀
exact hp₀.1
· norm_cast at hq₀
apply Finset.mem_Icc.mp at hq₀
exact hq₀.1
have hl₃: (image f s).card = n := by
rw [← hl₁]
refine Finset.card_image_of_injOn ?_
intro p hp₀ q hq₀ hpq
contrapose! hpq
refine h₁ p q ?_ ?_ hpq
· norm_cast at hp₀
apply Finset.mem_Icc.mp at hp₀
exact hp₀.1
· norm_cast at hq₀
apply Finset.mem_Icc.mp at hq₀
exact hq₀.1
constructor
· rw [← hl₂]
exact length_sort fun x₁ x₂ => x₁ ≤ x₂
· rw [← hl₃]
exact length_sort fun x₁ x₂ => x₁ ≤ x₂
have hf₅: ∀ a ∈ s, a - 1 < sf_sorted.length := by
intro a ha₀
rw [hf₄.1]
apply Finset.mem_Icc.mp at ha₀
omega
have hf₆: ∀ k ∈ s, 1 ≤ f₃ k := by
have hs₂: ∀ k ∈ sf_sorted, 1 ≤ k := by
rw [hf₁, hf₂, hf₃]
simp only [mem_sort, mem_image, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂, Nat.one_le_cast]
intro k hk₀
apply Finset.mem_Icc.mp at hk₀
exact h₀ k hk₀.1
have hs₃: ∀ k ∈ s, f₃ k ∈ sf_sorted := by
intro k hk₀
rw [hf₀]
have hk₁: k - 1 < sf_sorted.length := by exact hf₅ k hk₀
rw [List.getD_eq_getElem sf_sorted 0 hk₁]
exact List.getElem_mem hk₁
intro k hk₀
exact hs₂ (f₃ k) (hs₃ k hk₀)
have hf₇: ∀ a : ℕ, a ∈ Icc 1 n → ∀ b : ℕ, b ∈ Icc 1 n → a < b → f₃ a + 1 ≤ f₃ b := by
intro a ha₀ b hb₀ hab
rw [hf₀, hf₀]
have ha₁: a - 1 < sf_sorted.length := by exact hf₅ a ha₀
have hb₁: b - 1 < sf_sorted.length := by exact hf₅ b hb₀
rw [hf₁, hf₂]
let sfo : Finset ℕ := image f s
have hso₂: ∀ k ∈ s, ((image f₂ s).sort (fun x₁ x₂ => x₁ ≤ x₂)).getD (k - 1) 0
= ((image f s).sort (fun x₁ x₂ => x₁ ≤ x₂)).getD (k - 1) 0 := by
intro k hk₀
have hk₃: Function.Injective f₁ := CharZero.cast_injective
let fe : ℕ ↪ ℝ := {toFun := f₁ , inj' := hk₃}
have hk₅: ((image f₂ s).sort (fun x₁ x₂ => x₁ ≤ x₂)) =
List.map f₁ ((image f s).sort (fun x₁ x₂ => x₁ ≤ x₂)) := by
have hh₀: fe = {toFun := f₁ , inj' := hk₃} := by rfl
have hh₁: (image f₂ s) = Finset.map fe (image f s) := by
rw [hf₃, hh₀]
refine Finset.induction_on_min s ?_ ?_
· simp
· intro z sz _ hz₁
simp only [image_insert, map_insert, Function.Embedding.coeFn_mk]
exact congrArg (insert ↑(f z)) hz₁
rw [hh₁]
refine Finset.induction_on_min (image f s) ?_ ?_
· simp
· intro z sz hz₀ hz₁
have hz₂: z ∉ sz := by
contrapose! hz₀
use z
simp only [map_insert]
have hz₃: fe z = (z:ℝ) := by exact rfl
rw [hz₃]
have hz₄: ∀ b ∈ sz, (fun x₁ x₂ => x₁ ≤ x₂) z b := by
intro b a
exact Nat.le_of_succ_le (hz₀ b a)
have hz₅: ∀ b ∈ map fe sz, (fun x₁ x₂ => x₁ ≤ x₂) (↑z:ℝ) b := by
intro y hy₀
have hy₁: ∃ d:ℕ, d ∈ sz ∧ (d:ℝ) = y := by exact Multiset.mem_map.mp hy₀
obtain ⟨d, hd₀, hd₁⟩ := hy₁
refine le_of_lt ?_
rw [← hd₁]
exact Nat.cast_lt.mpr (hz₀ d hd₀)
have hz₆: (↑z:ℝ) ∉ map fe sz := by
simp only [mem_map, not_exists, not_and]
intro x hx₀
rw [hh₀]
simp only [Function.Embedding.coeFn_mk]
have hx₁: ∀ x:ℕ, f₁ x = (x:ℝ) := by exact fun x => rfl
rw [hx₁]
norm_cast
exact Nat.ne_of_lt' (hz₀ x hx₀)
rw [Finset.sort_insert (fun x₁ x₂ => x₁ ≤ x₂) hz₄ hz₂]
rw [Finset.sort_insert (fun x₁ x₂ => x₁ ≤ x₂) hz₅ hz₆]
simp only [List.map_cons, List.cons.injEq]
exact List.cons_eq_cons.mp (congrArg (List.cons ↑z) hz₁)
have hk₁: k - 1 < (List.map f₁ (sfo.sort (fun x₁ x₂ => x₁ ≤ x₂))).length := by
rw [← hk₅]
exact hf₅ k hk₀
have hk₂: k - 1 < (sfo.sort (fun x₁ x₂ => x₁ ≤ x₂)).length := by
rw [hf₄.2, ← hf₄.1]
exact hf₅ k hk₀
rw [hk₅, List.getD_eq_getElem _ 0 hk₁, List.getD_eq_getElem _ 0 hk₂]
exact List.getElem_map f₁
rw [hso₂ a ha₀, hso₂ b hb₀]
norm_cast
refine Nat.succ_le_of_lt ?_
have ha₂: a - 1 < ((image f s).sort (fun x₁ x₂ => x₁ ≤ x₂)).length := by
rw [hf₄.2, ← hf₄.1]
exact ha₁
have hb₂: b - 1 < ((image f s).sort (fun x₁ x₂ => x₁ ≤ x₂)).length := by
rw [hf₄.2, ← hf₄.1]
exact hb₁
rw [List.getD_eq_getElem _ 0 ha₂, List.getD_eq_getElem _ 0 hb₂]
refine List.Pairwise.rel_get_of_lt ?_ ?_
· have := Finset.sortedLT_sort (image f s)
rw [List.sortedLT_iff_pairwise] at this
exact this
simp only [Fin.mk_lt_mk]
apply Finset.mem_Icc.mp at ha₀
apply Finset.mem_Icc.mp at hb₀
omega
have hρ: ∃ ρ: Equiv.Perm ℕ, (∀ a ∈ Icc 1 n, f₂ a = f₃ (ρ a)) ∧ ∀ a ∉ Icc 1 n, ρ a = a := by
let so : Finset ℕ := image f (Icc 1 n)
let lo_sorted : List ℕ := so.sort (fun x₁ x₂ => x₁ ≤ x₂)
let sl := List.range' 1 n 1
have hs₀: sl = List.range' 1 n 1 := by rfl
let lo : List ℕ := List.map f sl
let f₄ : ℕ → ℕ := fun k => lo_sorted.getD (k - 1) 0
let f₅ : ℕ → ℕ := fun k => (List.findIdx (fun x => x = f k) lo_sorted) + 1
let f₆ : ℕ → ℕ := fun k => ite (k ∈ s) (f₅ k) (k)
let f₈ : ℕ → ℕ := fun k => (List.findIdx (fun x => x = f₄ k) lo) + 1
let f₉ : ℕ → ℕ := fun k => ite (k ∈ s) (f₈ k) (k)
have gg₀: f₄ = fun k => lo_sorted.getD (k - 1) 0 := by rfl
have gg₁: f₅ = fun k => List.findIdx (fun x => decide (x = f k)) lo_sorted + 1 := by rfl
have gg₂: f₆ = fun k => if k ∈ s then f₅ k else k := by rfl
have gg₃: f₈ = fun k => (List.findIdx (fun x => x = f₄ k) lo) + 1 := by rfl
have gg₄: f₉ = fun k => ite (k ∈ s) (f₈ k) (k) := by rfl
have gg₅: ∀ k ∈ s, f₆ k = f₅ k := by
intro k hk₀
rw [gg₂]
simp only [ite_eq_left_iff]
intro hk₁
exact False.elim (hk₁ hk₀)
have gg₆: ∀ k ∈ s, f₉ k = f₈ k := by grind
have gg₇: ∀ k ∉ s, f₆ k = k := by grind
have gg₈: ∀ k ∉ s, f₉ k = k := by grind
have gg₉: lo_sorted.length = n := by grind
have gg₁₀: ∀ k ∈ s, f₅ k ∈ s := by
intro k hk₀
refine Finset.mem_Icc.mpr ?_
constructor
· exact Nat.le_add_left 1 (List.findIdx (fun y => decide (y = f k)) lo_sorted)
· have hk₁: List.findIdx (fun x => decide (x = f k)) lo_sorted < lo_sorted.length := by
refine List.findIdx_lt_length.mpr ?_
use (f k)
constructor
· refine (mem_sort fun x₁ x₂ => x₁ ≤ x₂).mpr ?_
exact mem_image_of_mem f hk₀
· exact of_decide_eq_self_eq_true (f k)
rw [gg₉] at hk₁
refine Nat.le_of_lt_succ ?_
exact Nat.add_lt_of_lt_sub hk₁
have gg₁₁: lo.length = n := by
have g₀: lo = List.map f sl := by rfl
rw [g₀, hs₀]
simp
have gg₁₂: ∀ k ∈ s, f₈ k ∈ s := by
intro k hk₀
refine Finset.mem_Icc.mpr ?_
constructor
· exact Nat.le_add_left 1 (List.findIdx (fun x => decide (x = f₄ k)) lo)
· have hk₁: List.findIdx (fun x => decide (x = f₄ k)) lo < lo.length := by
refine List.findIdx_lt_length.mpr ?_
use (f₄ k)
constructor
· have hk₁: k - 1 < lo.length := by
rw [gg₁₁]
apply Finset.mem_Icc.mp at hk₀
exact Nat.sub_one_lt_of_le hk₀.1 hk₀.2
have hk₂: lo_sorted = so.sort (fun x₁ x₂ => x₁ ≤ x₂) := by rfl
have hk₃: lo = List.map f sl := by rfl
rw [gg₀, hk₂, hk₃]
ring_nf
have hk₄: so = image f (Icc 1 n) := by rfl
rw [gg₁₁, ← gg₉, hk₂, hk₄] at hk₁
rw [List.getD_eq_getElem _ 0 hk₁]
let j : ℕ := ((image f (Icc 1 n)).sort (fun x₁ x₂ => x₁ ≤ x₂))[k - 1]
have hj₀: j = ((image f (Icc 1 n)).sort (fun x₁ x₂ => x₁ ≤ x₂))[k - 1] := by rfl
have hj₁: j ∈ ((image f (Icc 1 n)).sort (fun x₁ x₂ => x₁ ≤ x₂)) := List.getElem_mem hk₁
have hj₂: j ∈ image f s := by exact (mem_sort fun x₁ x₂ => x₁ ≤ x₂).mp hj₁
rw [← hj₀]
exact List.mem_dedup.mp hj₂
· exact of_decide_eq_self_eq_true (f₄ k)
rw [gg₁₁] at hk₁
refine Nat.le_of_lt_succ ?_
exact Nat.add_lt_of_lt_sub hk₁
have gg₁₃: sf_sorted = List.map f₁ lo_sorted := by
have g₀: Function.Injective f₁ := by exact CharZero.cast_injective
let fe : ℕ ↪ ℝ := {toFun := f₁ , inj' := g₀}
have hh₀: fe = {toFun := f₁ , inj' := g₀} := by rfl
have hh₁: (image f₂ s) = Finset.map fe (image f s) := by
rw [hf₃, hh₀]
refine Finset.induction_on_min s ?_ ?_
· simp
· intro z sz _ hz₁
simp only [image_insert, map_insert, Function.Embedding.coeFn_mk]
exact congrArg (insert ↑(f z)) hz₁
have g₁: lo_sorted = so.sort (fun x₁ x₂ => x₁ ≤ x₂) := by rfl
have g₂: so = image f s := by rfl
rw [hf₁, hf₂, g₁, g₂, hh₁]
refine Finset.induction_on_min (image f s) ?_ ?_
· simp
· intro z sz hz₀ hz₁
have hz₂: z ∉ sz := by
contrapose! hz₀
use z
simp only [map_insert]
have hz₃ : fe z = (z:ℝ) := rfl
rw [hz₃]
have hz₄: ∀ b ∈ sz, (fun x₁ x₂ => x₁ ≤ x₂) z b := by
simp only
exact fun b a => Nat.le_of_succ_le (hz₀ b a)
have hz₅: ∀ b ∈ map fe sz, (fun x₁ x₂ => x₁ ≤ x₂) (↑z:ℝ) b := by
intro y hy₀
have hy₁: ∃ d:ℕ, d ∈ sz ∧ (d:ℝ) = y := by exact Multiset.mem_map.mp hy₀
obtain ⟨d, hd₀, hd₁⟩ := hy₁
refine le_of_lt ?_
rw [← hd₁]
exact Nat.cast_lt.mpr (hz₀ d hd₀)
have hz₆: (↑z:ℝ) ∉ map fe sz := by
simp only [mem_map, not_exists, not_and]
intro x hx₀
rw [hh₀]
simp only [Function.Embedding.coeFn_mk]
have hx₁: ∀ x:ℕ, f₁ x = (x:ℝ) := by exact fun x => rfl
rw [hx₁]
norm_cast
exact Nat.ne_of_lt' (hz₀ x hx₀)
rw [Finset.sort_insert (fun x₁ x₂ => x₁ ≤ x₂) hz₄ hz₂]
rw [Finset.sort_insert (fun x₁ x₂ => x₁ ≤ x₂) hz₅ hz₆]
simp only [List.map_cons, List.cons.injEq]
exact List.cons_eq_cons.mp (congrArg (List.cons ↑z) hz₁)
have gg₁₄: ∀ x y, x ∈ s → y ∈ s → f₄ x = f₄ y → x = y := by
intro x y hx₀ hy₀ hx₁
have hx₂: List.Nodup lo_sorted := by exact sort_nodup so (fun x₁ x₂ => x₁ ≤ x₂)
rw [gg₀] at hx₁
ring_nf at hx₁
have hx₃: x - 1 < lo_sorted.length := by
rw [gg₉]
apply Finset.mem_Icc.mp at hx₀
exact Nat.sub_one_lt_of_le hx₀.1 hx₀.2
have hy₁: y - 1 < lo_sorted.length := by
rw [gg₉]
apply Finset.mem_Icc.mp at hy₀
exact Nat.sub_one_lt_of_le hy₀.1 hy₀.2
rw [List.getD_eq_getElem _ 0 hx₃, List.getD_eq_getElem _ 0 hy₁] at hx₁
have hj₉: x - 1 = y - 1 := by
exact (List.Nodup.getElem_inj_iff hx₂).mp hx₁
apply Finset.mem_Icc.mp at hy₀
apply Finset.mem_Icc.mp at hx₀
rw [← Nat.sub_add_cancel hy₀.1, ← Nat.sub_add_cancel hx₀.1]
exact congr(HAdd.hAdd $hj₉ 1)
have hh₀: ∀ k ∈ s, f₄ (f₆ k) = f k := by
intro k hk₀
have g₀: f₆ k = f₅ k := gg₅ k hk₀
rw [g₀, gg₁]
simp only
let j := List.findIdx (fun x => decide (x = f k)) lo_sorted
have hj₀: j + 1 = List.findIdx (fun x => decide (x = f k)) lo_sorted + 1 := by rfl
have hj₁: List.findIdx (fun x => decide (x = f k)) lo_sorted < lo_sorted.length := by
refine List.findIdx_lt_length.mpr ?_
simp only [decide_eq_true_eq, exists_eq_right]
refine (mem_sort fun x₁ x₂ => x₁ ≤ x₂).mpr ?_
exact mem_image_of_mem f hk₀
have hj₂: f₄ (j + 1) = f k := by
let p := (fun (x) => decide (x = f k))
have hp₀: p = (fun (x) => decide (x = f k)) := by rfl
rw [gg₀, hj₀]
ring_nf
rw [add_comm 1, Nat.add_sub_cancel]
rw [← hp₀]
rw [← hp₀] at hj₁
rw [List.getD_eq_getElem _ 0 hj₁]
have g₁: p lo_sorted[List.findIdx p lo_sorted] = true := by
exact List.findIdx_getElem
refine decide_eq_true_iff.mp g₁
rw [← hj₀, hj₂]
have gg₁₅: ∀ x y, x ∈ s → y ∈ s → (f₄ x = f y ↔ f₈ x = y) := by
intro x y hx₀ hy₀
have hy₁: y - 1 < lo.length := by
rw [gg₁₁]
apply Finset.mem_Icc.mp at hy₀
exact Nat.sub_one_lt_of_le hy₀.1 hy₀.2
have hy₃: y - 1 < (List.range' 1 n 1).length := by
rw [List.length_range', ← gg₁₁]
exact hy₁
have hy₄: y - 1 < sl.length := by
rw [hs₀]
exact hy₃
have gg₁₆: lo = List.map f sl := by rfl
constructor
· intro hx₁
have hx₂: f₄ (f₆ y) = f y := by exact hh₀ y hy₀
have hx₃: x = f₅ y := by
rw [← hx₁, gg₅ y hy₀] at hx₂
exact gg₁₄ x (f₅ y) hx₀ (gg₁₀ y hy₀) (id (Eq.symm hx₂))
rw [hx₃]
apply Finset.mem_Icc.mp at hx₀
apply Finset.mem_Icc.mp at hy₀
have hx₄: x - 1 < lo_sorted.length := by
rw [gg₉]
exact Nat.sub_one_lt_of_le hx₀.1 hx₀.2
have hx₅: List.findIdx (fun x => decide (x = f y)) lo_sorted = x - 1 :=
Nat.eq_sub_of_add_eq hx₃.symm
apply (List.findIdx_eq hx₄).mp at hx₅
obtain ⟨hx₅, hx₆⟩ := hx₅
simp at hx₅ hx₆
rw [gg₃]
simp only
rw [← Nat.sub_add_cancel hy₀.1]
refine add_right_cancel_iff.mpr ?_
refine (List.findIdx_eq hy₁).mpr ?_
simp only [decide_eq_true_eq, decide_eq_false_iff_not]
constructor
· rw [Nat.sub_add_cancel hy₀.1]
apply Finset.mem_Icc.mpr at hy₀
rw [← gg₅ y hy₀, hh₀ y hy₀]
rw [← List.getD_eq_getElem lo 0 hy₁, gg₁₆]
rw [List.getD_eq_getElem (List.map f sl) 0 hy₁]
simp only [List.getElem_map]
refine congr rfl ?_
have g₀: sl = List.range' 1 n 1 := by rfl
rw [← List.getD_eq_getElem sl 0 hy₄, g₀]
rw [List.getD_eq_getElem (List.range' 1 n 1) 0 hy₃]
rw [List.getElem_range' hy₃]
omega
· intro j hj₀
rw [Nat.sub_add_cancel hy₀.1]
apply Finset.mem_Icc.mpr at hy₀
rw [← gg₅ y hy₀, hh₀ y hy₀]
have hj₁: j < lo.length := by exact Nat.lt_trans hj₀ hy₁
have hj₂: j < (List.map f sl).length := by exact Nat.lt_trans hj₀ hy₁
have hj₃: j < sl.length := by exact Nat.lt_trans hj₀ hy₃
have hj₄: j < (List.range' 1 n 1).length := by exact Nat.lt_trans hj₀ hy₃
rw [← List.getD_eq_getElem lo 0 hj₁, gg₁₆]
rw [List.getD_eq_getElem (List.map f sl) 0 hj₂]
simp only [List.getElem_map, ne_eq]
refine h₁ sl[j] y ?_ ?_ ?_
· have ht: ∀ t ∈ sl, 1 ≤ t := by
intro t ht₀
apply List.mem_range'.mp at ht₀
omega
refine ht sl[j] ?_
exact List.getElem_mem hj₄
· omega
· rw [List.getElem_range' hj₃]
omega
· intro hx₁
have hx₃: f (f₈ x) = f₄ x := by
rw [hx₁]
rw [gg₃] at hx₁
simp only at hx₁
have hy₅: List.findIdx (fun x_1 => decide (x_1 = f₄ x)) lo = y - 1 :=
Nat.eq_sub_of_add_eq hx₁
apply (List.findIdx_eq hy₁).mp at hy₅
obtain ⟨hy₅, hy₆⟩ := hy₅
simp only [decide_eq_true_eq, decide_eq_false_iff_not] at hy₅ hy₆
rw [← hy₅]
have hy₇: lo[y - 1] = (List.map f sl)[y - 1] := by
rw [← List.getD_eq_getElem (List.map f sl) 0 hy₁, ← gg₁₆]
rw [hy₇]
apply Finset.mem_Icc.mp at hy₀
simp only [List.getElem_map]
refine congr rfl ?_
have g₀: sl = List.range' 1 n 1 := by rfl
rw [← List.getD_eq_getElem sl 0 hy₄, g₀]
rw [List.getD_eq_getElem (List.range' 1 n 1) 0 hy₃]
rw [List.getElem_range' hy₃]
rw [one_mul, add_comm 1, Nat.sub_add_cancel hy₀.1]
rw [← hx₃]
exact congrArg f hx₁
have hh₁: ∀ x, (f₉ ∘ f₆) x = x := by
intro x
rw [Function.comp_def]
simp only
by_cases hx₀: x ∈ s
· have g₀: f₅ x ∈ s := by exact gg₁₀ x hx₀
rw [gg₅ x hx₀, gg₆ (f₅ x) g₀,]
let j := f₅ x
have hj₀: j = f₅ x := by rfl
have hj₁: f₄ j = f x := by
rw [hj₀, ← gg₅ x hx₀]
exact hh₀ x hx₀
exact (gg₁₅ j x (gg₁₀ x hx₀) hx₀).mp hj₁
· have g₀: f₆ x = x := by exact gg₇ x hx₀
have g₁: f₉ x = x := by exact gg₈ x hx₀
rw [g₀, g₁]
have hh₂: Function.LeftInverse f₉ f₆ := by
refine Function.leftInverse_iff_comp.mpr ?_
exact Function.RightInverse.id hh₁
have hh₃: Function.RightInverse f₉ f₆ := by
refine Function.rightInverse_iff_comp.mpr ?_
have hh₄: ∀ x, (f₆ ∘ f₉) x = x := by
intro x
rw [Function.comp_def]
simp only
by_cases hx₀: x ∈ s
· have g₀: f₈ x ∈ s := by exact gg₁₂ x hx₀
rw [gg₆ x hx₀, gg₅ (f₈ x) g₀,]
let j := f₈ x
have hj₀: j = f₈ x := by rfl
have hj₁: f₄ x = f j := by exact (gg₁₅ x j hx₀ (gg₁₂ x hx₀)).mpr hj₀.symm
rw [← hj₀]
have hj₂: j ∈ s := gg₁₂ x hx₀
have hj₃: f₄ (f₅ j) = f j := by
rw [← gg₅ j hj₂]
exact hh₀ j hj₂
rw [← hj₁] at hj₃
exact gg₁₄ (f₅ j) x (gg₁₀ j g₀) hx₀ hj₃
· have g₀: f₉ x = x := gg₈ x hx₀
have g₁: f₆ x = x := gg₇ x hx₀
rw [g₀, g₁]
exact Function.RightInverse.id hh₄
set ρ : Equiv.Perm ℕ := { toFun := f₆, invFun := f₉, left_inv := hh₂, right_inv := hh₃ }
have hh₅: ∀ k ∈ s, ρ k ∈ s := by
intro k hk₀
have hk₁: f₆ k ∈ s := by
rw [gg₅ k hk₀]
exact gg₁₀ k hk₀
exact hk₁
use ρ
constructor
· intro a ha₀
have ha₁: f₂ a = ((f a):ℝ) := by rfl
have ha₂: f₃ (ρ a) = ((f₄ (ρ a)):ℝ) := by
have ha₂: f₃ (ρ a) = sf_sorted.getD (ρ a - 1) 0 := by rfl
have ha₃: f₄ (ρ a) = lo_sorted.getD (ρ a - 1) 0 := by rfl
have ha₄: ρ a ∈ s := by exact hh₅ a ha₀
have ha₅: ρ a - 1 < sf_sorted.length := by
exact hf₅ (ρ a) (hh₅ a ha₀)
have ha₆: ρ a - 1 < lo_sorted.length := by
refine Nat.lt_of_succ_le ?_
apply Finset.mem_Icc.mp at ha₄
rw [gg₉, Nat.succ_eq_add_one, Nat.sub_add_cancel ha₄.1]
exact ha₄.2
rw [ha₂, ha₃]
rw [gg₁₃]
rw [gg₁₃] at ha₅
rw [List.getD_eq_getElem _ 0 ha₅, List.getD_eq_getElem _ 0 ha₆]
exact List.getElem_map f₁
rw [ha₁, ha₂,]
norm_cast
rw [← hh₀ a ha₀]
exact rfl
· intro a ha₀
exact gg₇ a ha₀
obtain ⟨ρ, hρ₀, hρ₁⟩ := hρ
have h₆: ∑ k ∈ Icc 1 n, f₃ k • f₀ k ≤ ∑ k ∈ Icc 1 n, f₂ k • f₀ k := by
have h₆₀: ∑ k ∈ Icc 1 n, f₂ k • f₀ k = ∑ k ∈ Icc 1 n, f₃ (ρ k) • f₀ k := by
refine Finset.sum_congr rfl ?_
intro x hx₀
rw [hρ₀ x hx₀]
rw [h₆₀]
refine AntivaryOn.sum_smul_le_sum_comp_perm_smul ?hfg ?hσ
· refine MonotoneOn.antivaryOn ?hfg.hf ?hfg.hg
· refine monotoneOn_iff_forall_lt.mpr ?hfg.hf.a
norm_cast
intro a ha₀ b hb₀ ha₁
have ha₂: f₃ a + 1 ≤ f₃ b := by exact hf₇ a ha₀ b hb₀ ha₁
refine le_trans ?_ ha₂
refine le_of_lt ?_
exact lt_add_one (f₃ a)
· refine antitoneOn_iff_forall_lt.mpr ?hfg.hg.a
norm_cast
intro a ha₀ b hb₀ ha₁
refine (one_div_le_one_div ?_ ?_).mpr ?_
· apply Finset.mem_Icc.mp at hb₀
norm_cast
exact Nat.pow_pos hb₀.1
· apply Finset.mem_Icc.mp at ha₀
norm_cast
exact Nat.pow_pos ha₀.1
· norm_cast
exact Nat.pow_le_pow_left (le_of_lt ha₁) 2
· intro x hx₀
contrapose! hx₀
exact fun a => a (hρ₁ x hx₀)
have h₇: ∑ k ∈ Icc 1 n, f₁ k • f₀ k ≤ ∑ k ∈ Icc 1 n, f₃ k • f₀ k := by
refine Finset.sum_le_sum ?_
intro x hx₀
have hx₁: 1 ≤ x := by
apply Finset.mem_Icc.mp at hx₀
exact hx₀.1
have hx₂: 0 < f₀ x := by
ring_nf
refine div_pos zero_lt_one ?_
norm_cast
exact Nat.pow_pos hx₁
refine (smul_le_smul_iff_of_pos_right hx₂).mpr ?_
have hh₀: f₁ = fun (k:ℕ) => (↑k:ℝ) := by rfl
rw [hh₀]
dsimp only
have hi: x ≤ n → (↑x:ℝ) ≤ f₃ x := by
refine Nat.le_induction ?_ ?_ x hx₁
· intro _
norm_cast
refine hf₆ 1 ?_
exact left_mem_Icc.mpr h₂
· intro y hy₀ hy₁ hy₂
have hy₃: y ≤ n := Nat.le_of_succ_le hy₂
have hy₄: f₃ y + 1 ≤ f₃ (y + 1) := by
refine hf₇ y ?_ (y + 1) ?_ (by omega)
· exact Finset.mem_Icc.mpr ⟨hy₀, hy₃⟩
· refine Finset.mem_Icc.mpr ⟨Nat.le_add_right_of_le hy₀, hy₂⟩
refine le_trans ?_ hy₄
simp only [Nat.cast_add, Nat.cast_one, add_le_add_iff_right]
exact hy₁ hy₃
refine hi ?_
apply Finset.mem_Icc.mp at hx₀
exact hx₀.2
rw [h₃, h₄]
refine le_trans h₇ h₆
theorem imo_1978_p5
(n : ℕ)
(f : ℕ → ℕ)
(h₀ : ∀ (m : ℕ), 0 < m → 0 < f m)
(h₁ : ∀ (p q : ℕ), 0 < p → 0 < q → p ≠ q → f p ≠ f q)
(h₂ : 0 < n) :
∑ k ∈ Finset.Icc 1 n, (1 : ℝ) / k ≤ ∑ k ∈ Finset.Icc 1 n, ((f k):ℝ) / k ^ 2 := by
have h₃ : ∑ k ∈ Icc 1 n, (k : ℝ) / k ^ 2 ≤ ∑ k ∈ Icc 1 n, ((f k):ℝ) / (k) ^ 2 :=
aux₁ f h₀ h₁ h₂
refine le_trans ?_ h₃
refine Finset.sum_le_sum ?_
intro x hx₀
rw [pow_two, ← div_div, div_self]
rw [Finset.mem_Icc] at hx₀
norm_cast
omega
end Imo1978P5
| true | Copyright (c) 2025 Roozbeh Yousefzadeh. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1978, Problem 5
Let a_k be a sequence of distinct positive integers for k = 1,2,3, ...
Prove that for all natural numbers n, we have:
sum_{k=1}^{n} a(k)/(k^2) >= sum_{k=1}^{n} (1/k).
-/
open Finset
namespace Imo1978P5
lemma aux₁
{n : ℕ}
(f : ℕ → ℕ)
(h₀ : ∀ (m : ℕ), 0 < m → 0 < f m)
(h₁ : ∀ (p q : ℕ), 0 < p → 0 < q → p ≠ q → f p ≠ f q)
(h₂ : 0 < n) :
∑ k ∈ Finset.Icc 1 n, ((k):ℝ) / (k) ^ 2 ≤ ∑ k ∈ Finset.Icc 1 n, ((f k):ℝ) / (k) ^ 2 := by
let s := Finset.Icc 1 n
let f₀ : ℕ → ℝ := fun k => 1 / (k:ℝ) ^ 2
let f₁ : ℕ → ℝ := fun k => (k:ℝ)
let f₂ : ℕ → ℝ := fun k => ((f k):ℝ)
have h₃: ∑ k ∈ Icc 1 n, (k : ℝ) / k ^ 2 = ∑ k ∈ Icc 1 n, f₁ k • f₀ k := by
refine Finset.sum_congr rfl ?_
intro x _
rw [div_eq_mul_one_div, smul_eq_mul]
have h₄: ∑ k ∈ Icc 1 n, ((f k):ℝ) / (k) ^ 2 = ∑ k ∈ Icc 1 n, f₂ k • f₀ k := by
refine Finset.sum_congr rfl ?_
intro x _
rw [div_eq_mul_one_div, smul_eq_mul]
let sf : Finset ℝ := Finset.image f₂ (Finset.Icc 1 n)
set sf_sorted : List ℝ := sf.sort (fun (x₁ x₂) => x₁ ≤ x₂) with hf₁
let f₃: ℕ → ℝ := fun k => sf_sorted.getD (k - 1) 0
have hf₀: ∀ k, f₃ k = sf_sorted.getD (k - 1) 0 := by exact fun k => rfl
have hf₂: sf = Finset.image f₂ s := by rfl
have hf₃: f₂ = fun k => ((f k):ℝ) := by rfl
have hl₁: s.card = n := by
have g₀: s = Icc 1 n := by rfl
rw [g₀]
refine Nat.le_induction ?_ ?_ n h₂
· simp
· simp
have hf₄: sf_sorted.length = n ∧ (sort (image f s) (fun x₁ x₂ => x₁ ≤ x₂) ).length = n := by
have hl₂: sf.card = n := by
rw [← hl₁]
refine Finset.card_image_of_injOn ?_
intro p hp₀ q hq₀ hpq
have hf₅: f₂ = fun k => ((f k):ℝ) := by rfl
contrapose! hpq
rw [hf₅]
simp only [ne_eq, Nat.cast_inj]
refine h₁ p q ?_ ?_ hpq
· norm_cast at hp₀
apply Finset.mem_Icc.mp at hp₀
exact hp₀.1
· norm_cast at hq₀
apply Finset.mem_Icc.mp at hq₀
exact hq₀.1
have hl₃: (image f s).card = n := by
rw [← hl₁]
refine Finset.card_image_of_injOn ?_
intro p hp₀ q hq₀ hpq
contrapose! hpq
refine h₁ p q ?_ ?_ hpq
· norm_cast at hp₀
apply Finset.mem_Icc.mp at hp₀
exact hp₀.1
· norm_cast at hq₀
apply Finset.mem_Icc.mp at hq₀
exact hq₀.1
constructor
· rw [← hl₂]
exact length_sort fun x₁ x₂ => x₁ ≤ x₂
· rw [← hl₃]
exact length_sort fun x₁ x₂ => x₁ ≤ x₂
have hf₅: ∀ a ∈ s, a - 1 < sf_sorted.length := by
intro a ha₀
rw [hf₄.1]
apply Finset.mem_Icc.mp at ha₀
omega
have hf₆: ∀ k ∈ s, 1 ≤ f₃ k := by
have hs₂: ∀ k ∈ sf_sorted, 1 ≤ k := by
rw [hf₁, hf₂, hf₃]
simp only [mem_sort, mem_image, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂, Nat.one_le_cast]
intro k hk₀
apply Finset.mem_Icc.mp at hk₀
exact h₀ k hk₀.1
have hs₃: ∀ k ∈ s, f₃ k ∈ sf_sorted := by
intro k hk₀
rw [hf₀]
have hk₁: k - 1 < sf_sorted.length := by exact hf₅ k hk₀
rw [List.getD_eq_getElem sf_sorted 0 hk₁]
exact List.getElem_mem hk₁
intro k hk₀
exact hs₂ (f₃ k) (hs₃ k hk₀)
have hf₇: ∀ a : ℕ, a ∈ Icc 1 n → ∀ b : ℕ, b ∈ Icc 1 n → a < b → f₃ a + 1 ≤ f₃ b := by
intro a ha₀ b hb₀ hab
rw [hf₀, hf₀]
have ha₁: a - 1 < sf_sorted.length := by exact hf₅ a ha₀
have hb₁: b - 1 < sf_sorted.length := by exact hf₅ b hb₀
rw [hf₁, hf₂]
let sfo : Finset ℕ := image f s
have hso₂: ∀ k ∈ s, ((image f₂ s).sort (fun x₁ x₂ => x₁ ≤ x₂)).getD (k - 1) 0
= ((image f s).sort (fun x₁ x₂ => x₁ ≤ x₂)).getD (k - 1) 0 := by
intro k hk₀
have hk₃: Function.Injective f₁ := CharZero.cast_injective
let fe : ℕ ↪ ℝ := {toFun := f₁ , inj' := hk₃}
have hk₅: ((image f₂ s).sort (fun x₁ x₂ => x₁ ≤ x₂)) =
List.map f₁ ((image f s).sort (fun x₁ x₂ => x₁ ≤ x₂)) := by
have hh₀: fe = {toFun := f₁ , inj' := hk₃} := by rfl
have hh₁: (image f₂ s) = Finset.map fe (image f s) := by
rw [hf₃, hh₀]
refine Finset.induction_on_min s ?_ ?_
· simp
· intro z sz _ hz₁
simp only [image_insert, map_insert, Function.Embedding.coeFn_mk]
exact congrArg (insert ↑(f z)) hz₁
rw [hh₁]
refine Finset.induction_on_min (image f s) ?_ ?_
· simp
· intro z sz hz₀ hz₁
have hz₂: z ∉ sz := by
contrapose! hz₀
use z
simp only [map_insert]
have hz₃: fe z = (z:ℝ) := by exact rfl
rw [hz₃]
have hz₄: ∀ b ∈ sz, (fun x₁ x₂ => x₁ ≤ x₂) z b := by
intro b a
exact Nat.le_of_succ_le (hz₀ b a)
have hz₅: ∀ b ∈ map fe sz, (fun x₁ x₂ => x₁ ≤ x₂) (↑z:ℝ) b := by
intro y hy₀
have hy₁: ∃ d:ℕ, d ∈ sz ∧ (d:ℝ) = y := by exact Multiset.mem_map.mp hy₀
obtain ⟨d, hd₀, hd₁⟩ := hy₁
refine le_of_lt ?_
rw [← hd₁]
exact Nat.cast_lt.mpr (hz₀ d hd₀)
have hz₆: (↑z:ℝ) ∉ map fe sz := by
simp only [mem_map, not_exists, not_and]
intro x hx₀
rw [hh₀]
simp only [Function.Embedding.coeFn_mk]
have hx₁: ∀ x:ℕ, f₁ x = (x:ℝ) := by exact fun x => rfl
rw [hx₁]
norm_cast
exact Nat.ne_of_lt' (hz₀ x hx₀)
rw [Finset.sort_insert (fun x₁ x₂ => x₁ ≤ x₂) hz₄ hz₂]
rw [Finset.sort_insert (fun x₁ x₂ => x₁ ≤ x₂) hz₅ hz₆]
simp only [List.map_cons, List.cons.injEq]
exact List.cons_eq_cons.mp (congrArg (List.cons ↑z) hz₁)
have hk₁: k - 1 < (List.map f₁ (sfo.sort (fun x₁ x₂ => x₁ ≤ x₂))).length := by
rw [← hk₅]
exact hf₅ k hk₀
have hk₂: k - 1 < (sfo.sort (fun x₁ x₂ => x₁ ≤ x₂)).length := by
rw [hf₄.2, ← hf₄.1]
exact hf₅ k hk₀
rw [hk₅, List.getD_eq_getElem _ 0 hk₁, List.getD_eq_getElem _ 0 hk₂]
exact List.getElem_map f₁
rw [hso₂ a ha₀, hso₂ b hb₀]
norm_cast
refine Nat.succ_le_of_lt ?_
have ha₂: a - 1 < ((image f s).sort (fun x₁ x₂ => x₁ ≤ x₂)).length := by
rw [hf₄.2, ← hf₄.1]
exact ha₁
have hb₂: b - 1 < ((image f s).sort (fun x₁ x₂ => x₁ ≤ x₂)).length := by
rw [hf₄.2, ← hf₄.1]
exact hb₁
rw [List.getD_eq_getElem _ 0 ha₂, List.getD_eq_getElem _ 0 hb₂]
refine List.Pairwise.rel_get_of_lt ?_ ?_
· have := Finset.sortedLT_sort (image f s)
rw [List.sortedLT_iff_pairwise] at this
exact this
simp only [Fin.mk_lt_mk]
apply Finset.mem_Icc.mp at ha₀
apply Finset.mem_Icc.mp at hb₀
omega
have hρ: ∃ ρ: Equiv.Perm ℕ, (∀ a ∈ Icc 1 n, f₂ a = f₃ (ρ a)) ∧ ∀ a ∉ Icc 1 n, ρ a = a := by
let so : Finset ℕ := image f (Icc 1 n)
let lo_sorted : List ℕ := so.sort (fun x₁ x₂ => x₁ ≤ x₂)
let sl := List.range' 1 n 1
have hs₀: sl = List.range' 1 n 1 := by rfl
let lo : List ℕ := List.map f sl
let f₄ : ℕ → ℕ := fun k => lo_sorted.getD (k - 1) 0
let f₅ : ℕ → ℕ := fun k => (List.findIdx (fun x => x = f k) lo_sorted) + 1
let f₆ : ℕ → ℕ := fun k => ite (k ∈ s) (f₅ k) (k)
let f₈ : ℕ → ℕ := fun k => (List.findIdx (fun x => x = f₄ k) lo) + 1
let f₉ : ℕ → ℕ := fun k => ite (k ∈ s) (f₈ k) (k)
have gg₀: f₄ = fun k => lo_sorted.getD (k - 1) 0 := by rfl
have gg₁: f₅ = fun k => List.findIdx (fun x => decide (x = f k)) lo_sorted + 1 := by rfl
have gg₂: f₆ = fun k => if k ∈ s then f₅ k else k := by rfl
have gg₃: f₈ = fun k => (List.findIdx (fun x => x = f₄ k) lo) + 1 := by rfl
have gg₄: f₉ = fun k => ite (k ∈ s) (f₈ k) (k) := by rfl
have gg₅: ∀ k ∈ s, f₆ k = f₅ k := by
intro k hk₀
rw [gg₂]
simp only [ite_eq_left_iff]
intro hk₁
exact False.elim (hk₁ hk₀)
have gg₆: ∀ k ∈ s, f₉ k = f₈ k := by grind
have gg₇: ∀ k ∉ s, f₆ k = k := by grind
have gg₈: ∀ k ∉ s, f₉ k = k := by grind
have gg₉: lo_sorted.length = n := by grind
have gg₁₀: ∀ k ∈ s, f₅ k ∈ s := by
intro k hk₀
refine Finset.mem_Icc.mpr ?_
constructor
· exact Nat.le_add_left 1 (List.findIdx (fun y => decide (y = f k)) lo_sorted)
· have hk₁: List.findIdx (fun x => decide (x = f k)) lo_sorted < lo_sorted.length := by
refine List.findIdx_lt_length.mpr ?_
use (f k)
constructor
· refine (mem_sort fun x₁ x₂ => x₁ ≤ x₂).mpr ?_
exact mem_image_of_mem f hk₀
· exact of_decide_eq_self_eq_true (f k)
rw [gg₉] at hk₁
refine Nat.le_of_lt_succ ?_
exact Nat.add_lt_of_lt_sub hk₁
have gg₁₁: lo.length = n := by
have g₀: lo = List.map f sl := by rfl
rw [g₀, hs₀]
simp
have gg₁₂: ∀ k ∈ s, f₈ k ∈ s := by
intro k hk₀
refine Finset.mem_Icc.mpr ?_
constructor
· exact Nat.le_add_left 1 (List.findIdx (fun x => decide (x = f₄ k)) lo)
· have hk₁: List.findIdx (fun x => decide (x = f₄ k)) lo < lo.length := by
refine List.findIdx_lt_length.mpr ?_
use (f₄ k)
constructor
· have hk₁: k - 1 < lo.length := by
rw [gg₁₁]
apply Finset.mem_Icc.mp at hk₀
exact Nat.sub_one_lt_of_le hk₀.1 hk₀.2
have hk₂: lo_sorted = so.sort (fun x₁ x₂ => x₁ ≤ x₂) := by rfl
have hk₃: lo = List.map f sl := by rfl
rw [gg₀, hk₂, hk₃]
ring_nf
have hk₄: so = image f (Icc 1 n) := by rfl
rw [gg₁₁, ← gg₉, hk₂, hk₄] at hk₁
rw [List.getD_eq_getElem _ 0 hk₁]
let j : ℕ := ((image f (Icc 1 n)).sort (fun x₁ x₂ => x₁ ≤ x₂))[k - 1]
have hj₀: j = ((image f (Icc 1 n)).sort (fun x₁ x₂ => x₁ ≤ x₂))[k - 1] := by rfl
have hj₁: j ∈ ((image f (Icc 1 n)).sort (fun x₁ x₂ => x₁ ≤ x₂)) := List.getElem_mem hk₁
have hj₂: j ∈ image f s := by exact (mem_sort fun x₁ x₂ => x₁ ≤ x₂).mp hj₁
rw [← hj₀]
exact List.mem_dedup.mp hj₂
· exact of_decide_eq_self_eq_true (f₄ k)
rw [gg₁₁] at hk₁
refine Nat.le_of_lt_succ ?_
exact Nat.add_lt_of_lt_sub hk₁
have gg₁₃: sf_sorted = List.map f₁ lo_sorted := by
have g₀: Function.Injective f₁ := by exact CharZero.cast_injective
let fe : ℕ ↪ ℝ := {toFun := f₁ , inj' := g₀}
have hh₀: fe = {toFun := f₁ , inj' := g₀} := by rfl
have hh₁: (image f₂ s) = Finset.map fe (image f s) := by
rw [hf₃, hh₀]
refine Finset.induction_on_min s ?_ ?_
· simp
· intro z sz _ hz₁
simp only [image_insert, map_insert, Function.Embedding.coeFn_mk]
exact congrArg (insert ↑(f z)) hz₁
have g₁: lo_sorted = so.sort (fun x₁ x₂ => x₁ ≤ x₂) := by rfl
have g₂: so = image f s := by rfl
rw [hf₁, hf₂, g₁, g₂, hh₁]
refine Finset.induction_on_min (image f s) ?_ ?_
· simp
· intro z sz hz₀ hz₁
have hz₂: z ∉ sz := by
contrapose! hz₀
use z
simp only [map_insert]
have hz₃ : fe z = (z:ℝ) := rfl
rw [hz₃]
have hz₄: ∀ b ∈ sz, (fun x₁ x₂ => x₁ ≤ x₂) z b := by
simp only
exact fun b a => Nat.le_of_succ_le (hz₀ b a)
have hz₅: ∀ b ∈ map fe sz, (fun x₁ x₂ => x₁ ≤ x₂) (↑z:ℝ) b := by
intro y hy₀
have hy₁: ∃ d:ℕ, d ∈ sz ∧ (d:ℝ) = y := by exact Multiset.mem_map.mp hy₀
obtain ⟨d, hd₀, hd₁⟩ := hy₁
refine le_of_lt ?_
rw [← hd₁]
exact Nat.cast_lt.mpr (hz₀ d hd₀)
have hz₆: (↑z:ℝ) ∉ map fe sz := by
simp only [mem_map, not_exists, not_and]
intro x hx₀
rw [hh₀]
simp only [Function.Embedding.coeFn_mk]
have hx₁: ∀ x:ℕ, f₁ x = (x:ℝ) := by exact fun x => rfl
rw [hx₁]
norm_cast
exact Nat.ne_of_lt' (hz₀ x hx₀)
rw [Finset.sort_insert (fun x₁ x₂ => x₁ ≤ x₂) hz₄ hz₂]
rw [Finset.sort_insert (fun x₁ x₂ => x₁ ≤ x₂) hz₅ hz₆]
simp only [List.map_cons, List.cons.injEq]
exact List.cons_eq_cons.mp (congrArg (List.cons ↑z) hz₁)
have gg₁₄: ∀ x y, x ∈ s → y ∈ s → f₄ x = f₄ y → x = y := by
intro x y hx₀ hy₀ hx₁
have hx₂: List.Nodup lo_sorted := by exact sort_nodup so (fun x₁ x₂ => x₁ ≤ x₂)
rw [gg₀] at hx₁
ring_nf at hx₁
have hx₃: x - 1 < lo_sorted.length := by
rw [gg₉]
apply Finset.mem_Icc.mp at hx₀
exact Nat.sub_one_lt_of_le hx₀.1 hx₀.2
have hy₁: y - 1 < lo_sorted.length := by
rw [gg₉]
apply Finset.mem_Icc.mp at hy₀
exact Nat.sub_one_lt_of_le hy₀.1 hy₀.2
rw [List.getD_eq_getElem _ 0 hx₃, List.getD_eq_getElem _ 0 hy₁] at hx₁
have hj₉: x - 1 = y - 1 := by
exact (List.Nodup.getElem_inj_iff hx₂).mp hx₁
apply Finset.mem_Icc.mp at hy₀
apply Finset.mem_Icc.mp at hx₀
rw [← Nat.sub_add_cancel hy₀.1, ← Nat.sub_add_cancel hx₀.1]
exact congr(HAdd.hAdd $hj₉ 1)
have hh₀: ∀ k ∈ s, f₄ (f₆ k) = f k := by
intro k hk₀
have g₀: f₆ k = f₅ k := gg₅ k hk₀
rw [g₀, gg₁]
simp only
let j := List.findIdx (fun x => decide (x = f k)) lo_sorted
have hj₀: j + 1 = List.findIdx (fun x => decide (x = f k)) lo_sorted + 1 := by rfl
have hj₁: List.findIdx (fun x => decide (x = f k)) lo_sorted < lo_sorted.length := by
refine List.findIdx_lt_length.mpr ?_
simp only [decide_eq_true_eq, exists_eq_right]
refine (mem_sort fun x₁ x₂ => x₁ ≤ x₂).mpr ?_
exact mem_image_of_mem f hk₀
have hj₂: f₄ (j + 1) = f k := by
let p := (fun (x) => decide (x = f k))
have hp₀: p = (fun (x) => decide (x = f k)) := by rfl
rw [gg₀, hj₀]
ring_nf
rw [add_comm 1, Nat.add_sub_cancel]
rw [← hp₀]
rw [← hp₀] at hj₁
rw [List.getD_eq_getElem _ 0 hj₁]
have g₁: p lo_sorted[List.findIdx p lo_sorted] = true := by
exact List.findIdx_getElem
refine decide_eq_true_iff.mp g₁
rw [← hj₀, hj₂]
have gg₁₅: ∀ x y, x ∈ s → y ∈ s → (f₄ x = f y ↔ f₈ x = y) := by
intro x y hx₀ hy₀
have hy₁: y - 1 < lo.length := by
rw [gg₁₁]
apply Finset.mem_Icc.mp at hy₀
exact Nat.sub_one_lt_of_le hy₀.1 hy₀.2
have hy₃: y - 1 < (List.range' 1 n 1).length := by
rw [List.length_range', ← gg₁₁]
exact hy₁
have hy₄: y - 1 < sl.length := by
rw [hs₀]
exact hy₃
have gg₁₆: lo = List.map f sl := by rfl
constructor
· intro hx₁
have hx₂: f₄ (f₆ y) = f y := by exact hh₀ y hy₀
have hx₃: x = f₅ y := by
rw [← hx₁, gg₅ y hy₀] at hx₂
exact gg₁₄ x (f₅ y) hx₀ (gg₁₀ y hy₀) (id (Eq.symm hx₂))
rw [hx₃]
apply Finset.mem_Icc.mp at hx₀
apply Finset.mem_Icc.mp at hy₀
have hx₄: x - 1 < lo_sorted.length := by
rw [gg₉]
exact Nat.sub_one_lt_of_le hx₀.1 hx₀.2
have hx₅: List.findIdx (fun x => decide (x = f y)) lo_sorted = x - 1 :=
Nat.eq_sub_of_add_eq hx₃.symm
apply (List.findIdx_eq hx₄).mp at hx₅
obtain ⟨hx₅, hx₆⟩ := hx₅
simp at hx₅ hx₆
rw [gg₃]
simp only
rw [← Nat.sub_add_cancel hy₀.1]
refine add_right_cancel_iff.mpr ?_
refine (List.findIdx_eq hy₁).mpr ?_
simp only [decide_eq_true_eq, decide_eq_false_iff_not]
constructor
· rw [Nat.sub_add_cancel hy₀.1]
apply Finset.mem_Icc.mpr at hy₀
rw [← gg₅ y hy₀, hh₀ y hy₀]
rw [← List.getD_eq_getElem lo 0 hy₁, gg₁₆]
rw [List.getD_eq_getElem (List.map f sl) 0 hy₁]
simp only [List.getElem_map]
refine congr rfl ?_
have g₀: sl = List.range' 1 n 1 := by rfl
rw [← List.getD_eq_getElem sl 0 hy₄, g₀]
rw [List.getD_eq_getElem (List.range' 1 n 1) 0 hy₃]
rw [List.getElem_range' hy₃]
omega
· intro j hj₀
rw [Nat.sub_add_cancel hy₀.1]
apply Finset.mem_Icc.mpr at hy₀
rw [← gg₅ y hy₀, hh₀ y hy₀]
have hj₁: j < lo.length := by exact Nat.lt_trans hj₀ hy₁
have hj₂: j < (List.map f sl).length := by exact Nat.lt_trans hj₀ hy₁
have hj₃: j < sl.length := by exact Nat.lt_trans hj₀ hy₃
have hj₄: j < (List.range' 1 n 1).length := by exact Nat.lt_trans hj₀ hy₃
rw [← List.getD_eq_getElem lo 0 hj₁, gg₁₆]
rw [List.getD_eq_getElem (List.map f sl) 0 hj₂]
simp only [List.getElem_map, ne_eq]
refine h₁ sl[j] y ?_ ?_ ?_
· have ht: ∀ t ∈ sl, 1 ≤ t := by
intro t ht₀
apply List.mem_range'.mp at ht₀
omega
refine ht sl[j] ?_
exact List.getElem_mem hj₄
· omega
· rw [List.getElem_range' hj₃]
omega
· intro hx₁
have hx₃: f (f₈ x) = f₄ x := by
rw [hx₁]
rw [gg₃] at hx₁
simp only at hx₁
have hy₅: List.findIdx (fun x_1 => decide (x_1 = f₄ x)) lo = y - 1 :=
Nat.eq_sub_of_add_eq hx₁
apply (List.findIdx_eq hy₁).mp at hy₅
obtain ⟨hy₅, hy₆⟩ := hy₅
simp only [decide_eq_true_eq, decide_eq_false_iff_not] at hy₅ hy₆
rw [← hy₅]
have hy₇: lo[y - 1] = (List.map f sl)[y - 1] := by
rw [← List.getD_eq_getElem (List.map f sl) 0 hy₁, ← gg₁₆]
rw [hy₇]
apply Finset.mem_Icc.mp at hy₀
simp only [List.getElem_map]
refine congr rfl ?_
have g₀: sl = List.range' 1 n 1 := by rfl
rw [← List.getD_eq_getElem sl 0 hy₄, g₀]
rw [List.getD_eq_getElem (List.range' 1 n 1) 0 hy₃]
rw [List.getElem_range' hy₃]
rw [one_mul, add_comm 1, Nat.sub_add_cancel hy₀.1]
rw [← hx₃]
exact congrArg f hx₁
have hh₁: ∀ x, (f₉ ∘ f₆) x = x := by
intro x
rw [Function.comp_def]
simp only
by_cases hx₀: x ∈ s
· have g₀: f₅ x ∈ s := by exact gg₁₀ x hx₀
rw [gg₅ x hx₀, gg₆ (f₅ x) g₀,]
let j := f₅ x
have hj₀: j = f₅ x := by rfl
have hj₁: f₄ j = f x := by
rw [hj₀, ← gg₅ x hx₀]
exact hh₀ x hx₀
exact (gg₁₅ j x (gg₁₀ x hx₀) hx₀).mp hj₁
· have g₀: f₆ x = x := by exact gg₇ x hx₀
have g₁: f₉ x = x := by exact gg₈ x hx₀
rw [g₀, g₁]
have hh₂: Function.LeftInverse f₉ f₆ := by
refine Function.leftInverse_iff_comp.mpr ?_
exact Function.RightInverse.id hh₁
have hh₃: Function.RightInverse f₉ f₆ := by
refine Function.rightInverse_iff_comp.mpr ?_
have hh₄: ∀ x, (f₆ ∘ f₉) x = x := by
intro x
rw [Function.comp_def]
simp only
by_cases hx₀: x ∈ s
· have g₀: f₈ x ∈ s := by exact gg₁₂ x hx₀
rw [gg₆ x hx₀, gg₅ (f₈ x) g₀,]
let j := f₈ x
have hj₀: j = f₈ x := by rfl
have hj₁: f₄ x = f j := by exact (gg₁₅ x j hx₀ (gg₁₂ x hx₀)).mpr hj₀.symm
rw [← hj₀]
have hj₂: j ∈ s := gg₁₂ x hx₀
have hj₃: f₄ (f₅ j) = f j := by
rw [← gg₅ j hj₂]
exact hh₀ j hj₂
rw [← hj₁] at hj₃
exact gg₁₄ (f₅ j) x (gg₁₀ j g₀) hx₀ hj₃
· have g₀: f₉ x = x := gg₈ x hx₀
have g₁: f₆ x = x := gg₇ x hx₀
rw [g₀, g₁]
exact Function.RightInverse.id hh₄
set ρ : Equiv.Perm ℕ := { toFun := f₆, invFun := f₉, left_inv := hh₂, right_inv := hh₃ }
have hh₅: ∀ k ∈ s, ρ k ∈ s := by
intro k hk₀
have hk₁: f₆ k ∈ s := by
rw [gg₅ k hk₀]
exact gg₁₀ k hk₀
exact hk₁
use ρ
constructor
· intro a ha₀
have ha₁: f₂ a = ((f a):ℝ) := by rfl
have ha₂: f₃ (ρ a) = ((f₄ (ρ a)):ℝ) := by
have ha₂: f₃ (ρ a) = sf_sorted.getD (ρ a - 1) 0 := by rfl
have ha₃: f₄ (ρ a) = lo_sorted.getD (ρ a - 1) 0 := by rfl
have ha₄: ρ a ∈ s := by exact hh₅ a ha₀
have ha₅: ρ a - 1 < sf_sorted.length := by
exact hf₅ (ρ a) (hh₅ a ha₀)
have ha₆: ρ a - 1 < lo_sorted.length := by
refine Nat.lt_of_succ_le ?_
apply Finset.mem_Icc.mp at ha₄
rw [gg₉, Nat.succ_eq_add_one, Nat.sub_add_cancel ha₄.1]
exact ha₄.2
rw [ha₂, ha₃]
rw [gg₁₃]
rw [gg₁₃] at ha₅
rw [List.getD_eq_getElem _ 0 ha₅, List.getD_eq_getElem _ 0 ha₆]
exact List.getElem_map f₁
rw [ha₁, ha₂,]
norm_cast
rw [← hh₀ a ha₀]
exact rfl
· intro a ha₀
exact gg₇ a ha₀
obtain ⟨ρ, hρ₀, hρ₁⟩ := hρ
have h₆: ∑ k ∈ Icc 1 n, f₃ k • f₀ k ≤ ∑ k ∈ Icc 1 n, f₂ k • f₀ k := by
have h₆₀: ∑ k ∈ Icc 1 n, f₂ k • f₀ k = ∑ k ∈ Icc 1 n, f₃ (ρ k) • f₀ k := by
refine Finset.sum_congr rfl ?_
intro x hx₀
rw [hρ₀ x hx₀]
rw [h₆₀]
refine AntivaryOn.sum_smul_le_sum_comp_perm_smul ?hfg ?hσ
· refine MonotoneOn.antivaryOn ?hfg.hf ?hfg.hg
· refine monotoneOn_iff_forall_lt.mpr ?hfg.hf.a
norm_cast
intro a ha₀ b hb₀ ha₁
have ha₂: f₃ a + 1 ≤ f₃ b := by exact hf₇ a ha₀ b hb₀ ha₁
refine le_trans ?_ ha₂
refine le_of_lt ?_
exact lt_add_one (f₃ a)
· refine antitoneOn_iff_forall_lt.mpr ?hfg.hg.a
norm_cast
intro a ha₀ b hb₀ ha₁
refine (one_div_le_one_div ?_ ?_).mpr ?_
· apply Finset.mem_Icc.mp at hb₀
norm_cast
exact Nat.pow_pos hb₀.1
· apply Finset.mem_Icc.mp at ha₀
norm_cast
exact Nat.pow_pos ha₀.1
· norm_cast
exact Nat.pow_le_pow_left (le_of_lt ha₁) 2
· intro x hx₀
contrapose! hx₀
exact fun a => a (hρ₁ x hx₀)
have h₇: ∑ k ∈ Icc 1 n, f₁ k • f₀ k ≤ ∑ k ∈ Icc 1 n, f₃ k • f₀ k := by
refine Finset.sum_le_sum ?_
intro x hx₀
have hx₁: 1 ≤ x := by
apply Finset.mem_Icc.mp at hx₀
exact hx₀.1
have hx₂: 0 < f₀ x := by
ring_nf
refine div_pos zero_lt_one ?_
norm_cast
exact Nat.pow_pos hx₁
refine (smul_le_smul_iff_of_pos_right hx₂).mpr ?_
have hh₀: f₁ = fun (k:ℕ) => (↑k:ℝ) := by rfl
rw [hh₀]
dsimp only
have hi: x ≤ n → (↑x:ℝ) ≤ f₃ x := by
refine Nat.le_induction ?_ ?_ x hx₁
· intro _
norm_cast
refine hf₆ 1 ?_
exact left_mem_Icc.mpr h₂
· intro y hy₀ hy₁ hy₂
have hy₃: y ≤ n := Nat.le_of_succ_le hy₂
have hy₄: f₃ y + 1 ≤ f₃ (y + 1) := by
refine hf₇ y ?_ (y + 1) ?_ (by omega)
· exact Finset.mem_Icc.mpr ⟨hy₀, hy₃⟩
· refine Finset.mem_Icc.mpr ⟨Nat.le_add_right_of_le hy₀, hy₂⟩
refine le_trans ?_ hy₄
simp only [Nat.cast_add, Nat.cast_one, add_le_add_iff_right]
exact hy₁ hy₃
refine hi ?_
apply Finset.mem_Icc.mp at hx₀
exact hx₀.2
rw [h₃, h₄]
refine le_trans h₇ h₆
theorem imo_1978_p5
(n : ℕ)
(f : ℕ → ℕ)
(h₀ : ∀ (m : ℕ), 0 < m → 0 < f m)
(h₁ : ∀ (p q : ℕ), 0 < p → 0 < q → p ≠ q → f p ≠ f q)
(h₂ : 0 < n) :
∑ k ∈ Finset.Icc 1 n, (1 : ℝ) / k ≤ ∑ k ∈ Finset.Icc 1 n, ((f k):ℝ) / k ^ 2 := by
have h₃ : ∑ k ∈ Icc 1 n, (k : ℝ) / k ^ 2 ≤ ∑ k ∈ Icc 1 n, ((f k):ℝ) / (k) ^ 2 :=
aux₁ f h₀ h₁ h₂
refine le_trans ?_ h₃
refine Finset.sum_le_sum ?_
intro x hx₀
rw [pow_two, ← div_div, div_self]
rw [Finset.mem_Icc] at hx₀
norm_cast
omega
end Imo1978P5 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1978P5.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unknown identifier 'Icc'", "unknown identifier 'Icc'", "unknown identifier 'Icc'", "unknown identifier 'Icc'", "unknown identifier 'Icc'", "unsolved goals\ncase refine_1\nn : \u2115\nf : \u2115 \u2192 \u2115\nh\u2080 : \u2200 (m : \u2115), 0 < m \u2192 0 < f m\nh\u2081 : \u2200 (p q : \u2115), 0 < p \u2192 0 < q \u2192 p \u2260 q \u2192 f p \u2260 f q\nh\u2082 : 0 < n\ns : Finset \u2115 := Finset.Icc 1 n\nf\u2080 : \u2115 \u2192 \u211d := fun k => 1 / \u2191k ^ 2\nf\u2081 : \u2115 \u2192 \u211d := fun k => \u2191k\nf\u2082 : \u2115 \u2192 \u211d := fun k => \u2191(f k)\nh\u2083 : \u2211 k \u2208 sorry, k / k ^ 2 = \u2211 k \u2208 sorry, f\u2081 k \u2022 f\u2080 k\nh\u2084 : \u2211 k \u2208 sorry, \u2191(f k) / \u2191k ^ 2 = \u2211 k \u2208 sorry, f\u2082 k \u2022 f\u2080 k\nsf : Finset \u211d := Finset.image f\u2082 (Finset.Icc 1 n)\nsf_sorted : List \u211d := Finset.sort (fun x\u2081 x\u2082 => x\u2081 \u2264 x\u2082) sf\nhf\u2081 : sf_sorted = Finset.sort (fun x\u2081 x\u2082 => x\u2081 \u2264 x\u2082) sf\nf\u2083 : \u2115 \u2192 \u211d := fun k => sf_sorted.getD (k - 1) 0\nhf\u2080 : \u2200 (k : \u2115), f\u2083 k = sf_sorted.getD (k - 1) 0\nhf\u2082 : sf = Finset.image f\u2082 s\nhf\u2083 : f\u2082 = fun k => \u2191(f k)\ng\u2080 : s = sorry\n\u22a2 (sorry ()).card = 1", "unsolved goals\ncase refine_2\nn : \u2115\nf : \u2115 \u2192 \u2115\nh\u2080 : \u2200 (m : \u2115), 0 < m \u2192 0 < f m\nh\u2081 : \u2200 (p q : \u2115), 0 < p \u2192 0 < q \u2192 p \u2260 q \u2192 f p \u2260 f q\nh\u2082 : 0 < n\ns : Finset \u2115 := Finset.Icc 1 n\nf\u2080 : \u2115 \u2192 \u211d := fun k => 1 / \u2191k ^ 2\nf\u2081 : \u2115 \u2192 \u211d := fun k => \u2191k\nf\u2082 : \u2115 \u2192 \u211d := fun k => \u2191(f k)\nh\u2083 : \u2211 k \u2208 sorry, k / k ^ 2 = \u2211 k \u2208 sorry, f\u2081 k \u2022 f\u2080 k\nh\u2084 : \u2211 k \u2208 sorry, \u2191(f k) / \u2191k ^ 2 = \u2211 k \u2208 sorry, f\u2082 k \u2022 f\u2080 k\nsf : Finset \u211d := Finset.image f\u2082 (Finset.Icc 1 n)\nsf_sorted : List \u211d := Finset.sort (fun x\u2081 x\u2082 => x\u2081 \u2264 x\u2082) sf\nhf\u2081 : sf_sorted = Finset.sort (fun x\u2081 x\u2082 => x\u2081 \u2264 x\u2082) sf\nf\u2083 : \u2115 \u2192 \u211d := fun k => sf_sorted.getD (k - 1) 0\nhf\u2080 : \u2200 (k : \u2115), f\u2083 k = sf_sorted.getD (k - 1) 0\nhf\u2082 : sf = Finset.image f\u2082 s\nhf\u2083 : f\u2082 = fun k => \u2191(f k)\ng\u2080 : s = sorry\n\u22a2 \u2200 (n : \u2115), 1 \u2264 n \u2192 (sorry ()).card = n \u2192 (sorry ()).card = n + 1", "unknown identifier 'sort'", "unknown identifier 'image'", "unknown identifier 'length_sort'", "no goals to be solved", "unsolved goals\nn : \u2115\nf : \u2115 \u2192 \u2115\nh\u2080 : \u2200 (m : \u2115), 0 < m \u2192 0 < f m\nh\u2081 : \u2200 (p q : \u2115), 0 < p \u2192 0 < q \u2192 p \u2260 q \u2192 f p \u2260 f q\nh\u2082 : 0 < n\ns : Finset \u2115 := Finset.Icc 1 n\nf\u2080 : \u2115 \u2192 \u211d := fun k => 1 / \u2191k ^ 2\nf\u2081 : \u2115 \u2192 \u211d := fun k => \u2191k\nf\u2082 : \u2115 \u2192 \u211d := fun k => \u2191(f k)\nh\u2083 : \u2211 k \u2208 sorry, k / k ^ 2 = \u2211 k \u2208 sorry, f\u2081 k \u2022 f\u2080 k\nh\u2084 : \u2211 k \u2208 sorry, \u2191(f k) / \u2191k ^ 2 = \u2211 k \u2208 sorry, f\u2082 k \u2022 f\u2080 k\nsf : Finset \u211d := Finset.image f\u2082 (Finset.Icc 1 n)\nsf_sorted : List \u211d := Finset.sort (fun x\u2081 x\u2082 => x\u2081 \u2264 x\u2082) sf\nhf\u2081 : sf_sorted = Finset.sort (fun x\u2081 x\u2082 => x\u2081 \u2264 x\u2082) sf\nf\u2083 : \u2115 \u2192 \u211d := fun k => sf_sorted.getD (k - 1) 0\nhf\u2080 : \u2200 (k : \u2115), f\u2083 k = sf_sorted.getD (k - 1) 0\nhf\u2082 : sf = Finset.image f\u2082 s\nhf\u2083 : f\u2082 = fun k => \u2191(f k)\nhl\u2081 : s.card = n\nhf\u2084 : sf_sorted.length = n \u2227 sorry = n\nhf\u2085 : \u2200 a \u2208 s, a - 1 < sf_sorted.length\n\u22a2 \u2211 k \u2208 Finset.Icc 1 n, \u2191k / \u2191k ^ 2 \u2264 \u2211 k \u2208 Finset.Icc 1 n, \u2191(f k) / \u2191k ^ 2", "unknown tactic", "unknown identifier 'Icc'", "unknown identifier 'Icc'"], "timeout_s": 600.0, "latency_s": 0.592, "verified_at": "2026-03-26T18:16:42.803145+00:00"}} | false | true | false | 0.592 |
compfiles_Imo1978P6 | compfiles | Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1978, Problem 6
An international society has its members from six different countries.
The list of members has 1978 names, numbered $1, 2, \ldots, 1978$.
Prove that there is at least one member whose number is
the sum of the numbers of two (not necessarily distinct) members from his own country.
-/
namespace Imo1978P6
@[grind! .]
theorem Nat.ceilDiv_pos (a b : ℕ) (apos : 0 < a) (bpos : 0 < b) : 0 < a ⌈/⌉ b := by
by_contra!
rw [ceilDiv_le_iff_le_mul bpos] at this
simp_all
variable {M N : ℕ}
abbrev Name : Type := Finset.Icc 1 M
variable (C : @Name M → Fin N)
noncomputable abbrev members_of (i : Fin N) : Finset (@Name M) := {k | C k = i}
def motive (Cdone : Finset (Fin N)) (k : ℕ) : Prop :=
∃ Δ : Finset Name,
(∀ y ∈ Cdone, ∃ a0, C a0 = y ∧ ∀ x ∈ Δ, ∃ hb, C ⟨x.val+a0.val, hb⟩ = y)
∧ Disjoint (Δ.image C) Cdone
∧ k ≤ Δ.card
def motive' (n : ℕ) (k : ℕ) : Prop := ∃ Cdone, Cdone.card = n ∧ motive C Cdone k
theorem induction_begin : motive' C 0 M := by
use ∅, by simp
unfold motive
use Finset.univ
simp
theorem induction_end (k : ℕ) (kpos : 0 < k) : motive' C N k → False := by
intro ih
let ⟨Cdone, cc, Δ, h1, h2, h3⟩ := ih
have : Cdone = Finset.univ := by
apply Finset.eq_univ_of_card
simp [cc]
subst Cdone
simp only [Finset.disjoint_iff_inter_eq_empty, Finset.inter_univ, Finset.image_eq_empty] at h2
grind only [= Finset.card_empty]
theorem induction_step [NeZero N] (h : ∀ (j i k), C i = C j → C j = C k → i.val + k.val ≠ j.val)
(n : ℕ) (k : ℕ) (kpos : 0 < k) (hu : n < N)
: motive' C n k → motive' C (n+1) (k ⌈/⌉ (N-n) - 1) := by
intro ih
let ⟨Cdone, cc, Δ', ih1, ih2, ih3⟩ := ih
have kcd_pos : 1 ≤ k ⌈/⌉ N := by grind only [!Nat.ceilDiv_pos, Nat.pos_of_neZero]
have NsCdpos : 0 < N - Cdone.card := by omega
have ddn_pos : 1 ≤ Δ'.card ⌈/⌉ (N - Cdone.card) := by grind only [!Nat.ceilDiv_pos]
obtain ⟨y, hy1, hy2⟩ : ∃ y ∉ Cdone, (k ⌈/⌉ (N-Cdone.card)) ≤ (Δ' ∩ members_of C y).card := by
let C' (x : Δ') : {y : Fin N // y ∈ (C '' Δ')} :=
⟨C x.val, by grind only [= Set.mem_image, = Finset.mem_coe]⟩
let ⟨y, h⟩ := Fintype.exists_lt_card_fiber_of_mul_lt_card (n:=(Δ'.card ⌈/⌉ (N - Cdone.card) - 1)) C' ?_
· use y
and_intros
· rw [Finset.disjoint_iff_inter_eq_empty] at ih2
contrapose! ih2
use y.val
rw [Finset.mem_inter, <-SetLike.mem_coe]
simp only [Finset.coe_image, Subtype.coe_prop, ih2, and_self]
· calc
_ ≤ Δ'.card ⌈/⌉ (N - Cdone.card) := by
rw [Nat.ceilDiv_eq_add_pred_div, Nat.ceilDiv_eq_add_pred_div]
apply Nat.div_le_div_right
omega
_ ≤ _ := by
rw [tsub_lt_iff_left ddn_pos, Nat.lt_one_add_iff] at h
apply le_trans h
apply Finset.card_le_card_of_injOn (f:=Subtype.val)
· unfold C' at *
intro x hx
simp [<-Subtype.val_inj] at hx ⊢
exact hx
· exact Set.injOn_subtype_val
· apply lt_of_le_of_lt (b:=(N - Cdone.card) * (Δ'.card ⌈/⌉ (N - Cdone.card) - 1))
· apply Nat.mul_le_mul_right
rw [show N - Cdone.card = (Finset.univ \ Cdone).card by
rw [Finset.card_sdiff_of_subset] <;> simp
]
rw [Fintype.card_ofFinset, Finset.toFinset_coe]
apply Finset.card_le_card
rw [Finset.disjoint_iff_inter_eq_empty] at ih2
intro y hy
simp only [Finset.mem_sdiff, Finset.mem_univ, true_and]
contrapose! ih2
use y
exact Finset.mem_inter_of_mem hy ih2
· simp only [Fintype.card_coe]
apply Nat.lt_of_add_one_le
rw [Nat.ceilDiv_eq_add_pred_div, Nat.mul_sub, mul_one]
have := Nat.mul_div_le (Δ'.card + (N - Cdone.card) - 1) (N - Cdone.card)
rw [Nat.le_sub_iff_add_le, <-Nat.sub_le_iff_le_add, Nat.sub_add_comm] at this
· exact this
· suffices 1 ≤ (Δ'.card + (N - Cdone.card) - 1) / (N - Cdone.card) by exact Nat.le_mul_of_pos_right _ this
rw [<-Nat.div_self NsCdpos]
apply Nat.div_le_div_right
rw [Nat.div_self NsCdpos]
omega
· omega
have cc' : (Cdone ∪ {y}).card = n + 1 := by
rw [Finset.union_singleton, Finset.card_insert_of_notMem hy1, cc]
use Cdone ∪ {y}, cc'
have Cyne : (Δ' ∩ members_of C y).Nonempty := by
rw [<-Finset.card_pos, Nat.lt_iff_add_one_le]
trans k ⌈/⌉ (N - Cdone.card)
· by_contra!
rw [add_comm, Nat.lt_one_add_iff] at this
rw [ceilDiv_le_iff_le_mul NsCdpos] at this
omega
· exact hy2
let xmin := (Δ' ∩ members_of C y).min' Cyne
let Δ : Finset (@Name M) := ((Δ' ∩ members_of C y).erase xmin).attach.map (⟨fun x => ⟨x.val.val - xmin.val, by {
rw [Finset.mem_Icc]
and_intros
· apply Nat.le_sub_of_add_le'
rw [Nat.add_one_le_iff, Subtype.coe_lt_coe]
apply Finset.min'_lt_of_mem_erase_min'
apply SetLike.coe_mem
· have := Finset.mem_Icc.mp xmin.prop
have := Finset.mem_Icc.mp x.val.prop
omega
}⟩, by {
intro x1 x2 e
rw [Subtype.mk.injEq, tsub_left_inj, SetLike.coe_eq_coe, SetLike.coe_eq_coe] at e
· trivial
all_goals simp only [Subtype.coe_le_coe]; grind only [usr Subtype.property, = Finset.mem_erase, Finset.min'_le]
}⟩)
use Δ
apply (show ∀ (a b c : Prop), (a ∧ (a → b) ∧ c) → (a ∧ b ∧ c) by grind only)
and_intros
· simp only [Finset.union_singleton, Finset.mem_insert, forall_eq_or_imp]
and_intros
· use xmin
and_intros
· grind only [!Finset.min'_mem, = Finset.mem_inter, = Finset.mem_filter]
· intro x hx
unfold Δ at hx
simp only [Finset.mem_map, Finset.mem_attach, Function.Embedding.coeFn_mk, true_and,
Subtype.exists, Finset.mem_erase, ne_eq, Finset.mem_inter, Finset.mem_filter,
Finset.univ_eq_attach] at hx
let ⟨a, ha1, ha2, ha3⟩ := hx
subst x
rw [Nat.sub_add_cancel]
· simp_rw [ha2.right.right]
simp only [ha1, exists_const]
· rw [Subtype.coe_le_coe (y:=⟨a, ha1⟩)]
grind only [= Finset.nonempty_def, Finset.min'_le, = Finset.mem_inter,
= Finset.mem_filter, ← Finset.mem_univ]
· intro y' hy'
let ⟨b0, h1, h2⟩ := ih1 y' hy'
use ⟨b0 + xmin, ?_⟩
· and_intros
· simp_rw [add_comm] at h2
apply (h2 _ _).snd
grind only [!Finset.min'_mem, = Finset.mem_inter]
· intro x hx
unfold Δ at hx
simp only [Finset.mem_map, Finset.mem_attach, Function.Embedding.coeFn_mk, true_and,
Subtype.exists, Finset.mem_erase, ne_eq, Finset.mem_inter, Finset.mem_filter,
Finset.univ_eq_attach, Finset.mem_Icc] at hx
have hs1 : ∀ (_h), ⟨x.val+xmin.val, _h⟩ ∈ Δ' := by
grind only
have xsx : x.val + xmin.val ∈ Finset.Icc 1 M := by
omega
use ?_
· have := (h2 ⟨x.val+xmin.val, xsx⟩ ?_).snd
· simp_rw [<-add_assoc, add_comm, add_assoc]
simp_rw [add_comm] at this
apply this
· apply hs1
· have := (h2 ⟨x.val+xmin.val, xsx⟩ ?_).snd
· simp_rw [<-add_assoc, add_comm, add_assoc]
simp_rw [add_comm] at this
grind only
· apply hs1
· rw [add_comm]
apply (h2 _ _).fst
grind only [!Finset.min'_mem, = Finset.mem_inter]
· intro hs
suffices ∀ y' ∈ (Cdone ∪ {y}), Disjoint Δ (members_of C y') by
grind only [= Finset.nonempty_def, Finset.disjoint_iff_ne, = Finset.mem_image,
= Finset.mem_filter, ← Finset.mem_univ]
intro y' hy'
let ⟨b0, h1, h2⟩ := hs y' hy'
rw [Finset.disjoint_iff_ne]
intro x hx x' hx'
have ⟨h2, h3⟩ := h2 _ hx
by_cases! xvx'v : ¬ x'.val ≤ x.val
· grind only
have hb0 : b0.val + 1 < M := by grind only [= Finset.mem_Icc, = Finset.mem_filter]
rw [Ne, Subtype.ext_iff, eq_comm, <-add_left_inj b0.val]
rw [show x.val + b0.val = (⟨x.val+b0.val, h2⟩ : Name).val by simp]
apply h <;> grind only [= Finset.mem_filter]
· unfold Δ
rw [Finset.card_map, Finset.card_attach, Finset.card_erase_of_mem (by apply Finset.min'_mem)]
apply Nat.sub_le_sub_right
rw [<-cc]
apply le_trans hy2
apply Finset.card_le_card
simp
def compute_k (n: ℕ) : ℕ :=
match n with
| 0 => M
| n+1 => ((compute_k n) ⌈/⌉ (N-n) - 1)
theorem compute_finite_induction [NeZero N] (hC : ∀ (j i k), C i = C j → C j = C k → i.val + k.val ≠ j.val)
: 0 < @compute_k M N N → False := by
intro hcom
have hcom' : ∀ n ≤ N, 0 < @compute_k M N n := by
clear hC
intro n nb
apply Nat.decreasingInduction' (P:=fun n => 0 < @compute_k M N n) _ nb hcom
intro k _ _
simp only
intro h
unfold compute_k at h
contrapose! h
rw [nonpos_iff_eq_zero] at h
rw [h]
simp
apply induction_end C (compute_k N) hcom
suffices ∀ n ≤ N, motive' C n (compute_k n) by exact this N le_rfl
intro n
induction n with
| zero =>
intro _
apply induction_begin
| succ n ih =>
intro nb
apply induction_step C hC _ _ (hcom' n _) _ (ih _) <;> omega
theorem imo1978_p6 (C : Finset.Icc 1 1978 → Fin 6) :
∃ j i k, C i = C j ∧ C j = C k ∧ i.val + k.val = j.val := by
by_contra! c
apply compute_finite_induction C c
decide
end Imo1978P6 | /- | /-
Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1978, Problem 6
An international society has its members from six different countries.
The list of members has 1978 names, numbered $1, 2, \ldots, 1978$.
Prove that there is at least one member whose number is
the sum of the numbers of two (not necessarily distinct) members from his own country.
-/
namespace Imo1978P6
@[grind! .]
theorem Nat.ceilDiv_pos (a b : ℕ) (apos : 0 < a) (bpos : 0 < b) : 0 < a ⌈/⌉ b := by
by_contra!
rw [ceilDiv_le_iff_le_mul bpos] at this
simp_all
variable {M N : ℕ}
abbrev Name : Type := Finset.Icc 1 M
variable (C : @Name M → Fin N)
noncomputable abbrev members_of (i : Fin N) : Finset (@Name M) := {k | C k = i}
def motive (Cdone : Finset (Fin N)) (k : ℕ) : Prop :=
∃ Δ : Finset Name,
(∀ y ∈ Cdone, ∃ a0, C a0 = y ∧ ∀ x ∈ Δ, ∃ hb, C ⟨x.val+a0.val, hb⟩ = y)
∧ Disjoint (Δ.image C) Cdone
∧ k ≤ Δ.card
def motive' (n : ℕ) (k : ℕ) : Prop := ∃ Cdone, Cdone.card = n ∧ motive C Cdone k
theorem induction_begin : motive' C 0 M := by
use ∅, by simp
unfold motive
use Finset.univ
simp
theorem induction_end (k : ℕ) (kpos : 0 < k) : motive' C N k → False := by
intro ih
let ⟨Cdone, cc, Δ, h1, h2, h3⟩ := ih
have : Cdone = Finset.univ := by
apply Finset.eq_univ_of_card
simp [cc]
subst Cdone
simp only [Finset.disjoint_iff_inter_eq_empty, Finset.inter_univ, Finset.image_eq_empty] at h2
grind only [= Finset.card_empty]
theorem induction_step [NeZero N] (h : ∀ (j i k), C i = C j → C j = C k → i.val + k.val ≠ j.val)
(n : ℕ) (k : ℕ) (kpos : 0 < k) (hu : n < N)
: motive' C n k → motive' C (n+1) (k ⌈/⌉ (N-n) - 1) := by
intro ih
let ⟨Cdone, cc, Δ', ih1, ih2, ih3⟩ := ih
have kcd_pos : 1 ≤ k ⌈/⌉ N := by grind only [!Nat.ceilDiv_pos, Nat.pos_of_neZero]
have NsCdpos : 0 < N - Cdone.card := by omega
have ddn_pos : 1 ≤ Δ'.card ⌈/⌉ (N - Cdone.card) := by grind only [!Nat.ceilDiv_pos]
obtain ⟨y, hy1, hy2⟩ : ∃ y ∉ Cdone, (k ⌈/⌉ (N-Cdone.card)) ≤ (Δ' ∩ members_of C y).card := by
let C' (x : Δ') : {y : Fin N // y ∈ (C '' Δ')} :=
⟨C x.val, by grind only [= Set.mem_image, = Finset.mem_coe]⟩
let ⟨y, h⟩ := Fintype.exists_lt_card_fiber_of_mul_lt_card (n:=(Δ'.card ⌈/⌉ (N - Cdone.card) - 1)) C' ?_
· use y
and_intros
· rw [Finset.disjoint_iff_inter_eq_empty] at ih2
contrapose! ih2
use y.val
rw [Finset.mem_inter, <-SetLike.mem_coe]
simp only [Finset.coe_image, Subtype.coe_prop, ih2, and_self]
· calc
_ ≤ Δ'.card ⌈/⌉ (N - Cdone.card) := by
rw [Nat.ceilDiv_eq_add_pred_div, Nat.ceilDiv_eq_add_pred_div]
apply Nat.div_le_div_right
omega
_ ≤ _ := by
rw [tsub_lt_iff_left ddn_pos, Nat.lt_one_add_iff] at h
apply le_trans h
apply Finset.card_le_card_of_injOn (f:=Subtype.val)
· unfold C' at *
intro x hx
simp [<-Subtype.val_inj] at hx ⊢
exact hx
· exact Set.injOn_subtype_val
· apply lt_of_le_of_lt (b:=(N - Cdone.card) * (Δ'.card ⌈/⌉ (N - Cdone.card) - 1))
· apply Nat.mul_le_mul_right
rw [show N - Cdone.card = (Finset.univ \ Cdone).card by
rw [Finset.card_sdiff_of_subset] <;> simp
]
rw [Fintype.card_ofFinset, Finset.toFinset_coe]
apply Finset.card_le_card
rw [Finset.disjoint_iff_inter_eq_empty] at ih2
intro y hy
simp only [Finset.mem_sdiff, Finset.mem_univ, true_and]
contrapose! ih2
use y
exact Finset.mem_inter_of_mem hy ih2
· simp only [Fintype.card_coe]
apply Nat.lt_of_add_one_le
rw [Nat.ceilDiv_eq_add_pred_div, Nat.mul_sub, mul_one]
have := Nat.mul_div_le (Δ'.card + (N - Cdone.card) - 1) (N - Cdone.card)
rw [Nat.le_sub_iff_add_le, <-Nat.sub_le_iff_le_add, Nat.sub_add_comm] at this
· exact this
· suffices 1 ≤ (Δ'.card + (N - Cdone.card) - 1) / (N - Cdone.card) by exact Nat.le_mul_of_pos_right _ this
rw [<-Nat.div_self NsCdpos]
apply Nat.div_le_div_right
rw [Nat.div_self NsCdpos]
omega
· omega
have cc' : (Cdone ∪ {y}).card = n + 1 := by
rw [Finset.union_singleton, Finset.card_insert_of_notMem hy1, cc]
use Cdone ∪ {y}, cc'
have Cyne : (Δ' ∩ members_of C y).Nonempty := by
rw [<-Finset.card_pos, Nat.lt_iff_add_one_le]
trans k ⌈/⌉ (N - Cdone.card)
· by_contra!
rw [add_comm, Nat.lt_one_add_iff] at this
rw [ceilDiv_le_iff_le_mul NsCdpos] at this
omega
· exact hy2
let xmin := (Δ' ∩ members_of C y).min' Cyne
let Δ : Finset (@Name M) := ((Δ' ∩ members_of C y).erase xmin).attach.map (⟨fun x => ⟨x.val.val - xmin.val, by {
rw [Finset.mem_Icc]
and_intros
· apply Nat.le_sub_of_add_le'
rw [Nat.add_one_le_iff, Subtype.coe_lt_coe]
apply Finset.min'_lt_of_mem_erase_min'
apply SetLike.coe_mem
· have := Finset.mem_Icc.mp xmin.prop
have := Finset.mem_Icc.mp x.val.prop
omega
}⟩, by {
intro x1 x2 e
rw [Subtype.mk.injEq, tsub_left_inj, SetLike.coe_eq_coe, SetLike.coe_eq_coe] at e
· trivial
all_goals simp only [Subtype.coe_le_coe]; grind only [usr Subtype.property, = Finset.mem_erase, Finset.min'_le]
}⟩)
use Δ
apply (show ∀ (a b c : Prop), (a ∧ (a → b) ∧ c) → (a ∧ b ∧ c) by grind only)
and_intros
· simp only [Finset.union_singleton, Finset.mem_insert, forall_eq_or_imp]
and_intros
· use xmin
and_intros
· grind only [!Finset.min'_mem, = Finset.mem_inter, = Finset.mem_filter]
· intro x hx
unfold Δ at hx
simp only [Finset.mem_map, Finset.mem_attach, Function.Embedding.coeFn_mk, true_and,
Subtype.exists, Finset.mem_erase, ne_eq, Finset.mem_inter, Finset.mem_filter,
Finset.univ_eq_attach] at hx
let ⟨a, ha1, ha2, ha3⟩ := hx
subst x
rw [Nat.sub_add_cancel]
· simp_rw [ha2.right.right]
simp only [ha1, exists_const]
· rw [Subtype.coe_le_coe (y:=⟨a, ha1⟩)]
grind only [= Finset.nonempty_def, Finset.min'_le, = Finset.mem_inter,
= Finset.mem_filter, ← Finset.mem_univ]
· intro y' hy'
let ⟨b0, h1, h2⟩ := ih1 y' hy'
use ⟨b0 + xmin, ?_⟩
· and_intros
· simp_rw [add_comm] at h2
apply (h2 _ _).snd
grind only [!Finset.min'_mem, = Finset.mem_inter]
· intro x hx
unfold Δ at hx
simp only [Finset.mem_map, Finset.mem_attach, Function.Embedding.coeFn_mk, true_and,
Subtype.exists, Finset.mem_erase, ne_eq, Finset.mem_inter, Finset.mem_filter,
Finset.univ_eq_attach, Finset.mem_Icc] at hx
have hs1 : ∀ (_h), ⟨x.val+xmin.val, _h⟩ ∈ Δ' := by
grind only
have xsx : x.val + xmin.val ∈ Finset.Icc 1 M := by
omega
use ?_
· have := (h2 ⟨x.val+xmin.val, xsx⟩ ?_).snd
· simp_rw [<-add_assoc, add_comm, add_assoc]
simp_rw [add_comm] at this
apply this
· apply hs1
· have := (h2 ⟨x.val+xmin.val, xsx⟩ ?_).snd
· simp_rw [<-add_assoc, add_comm, add_assoc]
simp_rw [add_comm] at this
grind only
· apply hs1
· rw [add_comm]
apply (h2 _ _).fst
grind only [!Finset.min'_mem, = Finset.mem_inter]
· intro hs
suffices ∀ y' ∈ (Cdone ∪ {y}), Disjoint Δ (members_of C y') by
grind only [= Finset.nonempty_def, Finset.disjoint_iff_ne, = Finset.mem_image,
= Finset.mem_filter, ← Finset.mem_univ]
intro y' hy'
let ⟨b0, h1, h2⟩ := hs y' hy'
rw [Finset.disjoint_iff_ne]
intro x hx x' hx'
have ⟨h2, h3⟩ := h2 _ hx
by_cases! xvx'v : ¬ x'.val ≤ x.val
· grind only
have hb0 : b0.val + 1 < M := by grind only [= Finset.mem_Icc, = Finset.mem_filter]
rw [Ne, Subtype.ext_iff, eq_comm, <-add_left_inj b0.val]
rw [show x.val + b0.val = (⟨x.val+b0.val, h2⟩ : Name).val by simp]
apply h <;> grind only [= Finset.mem_filter]
· unfold Δ
rw [Finset.card_map, Finset.card_attach, Finset.card_erase_of_mem (by apply Finset.min'_mem)]
apply Nat.sub_le_sub_right
rw [<-cc]
apply le_trans hy2
apply Finset.card_le_card
simp
def compute_k (n: ℕ) : ℕ :=
match n with
| 0 => M
| n+1 => ((compute_k n) ⌈/⌉ (N-n) - 1)
theorem compute_finite_induction [NeZero N] (hC : ∀ (j i k), C i = C j → C j = C k → i.val + k.val ≠ j.val)
: 0 < @compute_k M N N → False := by
intro hcom
have hcom' : ∀ n ≤ N, 0 < @compute_k M N n := by
clear hC
intro n nb
apply Nat.decreasingInduction' (P:=fun n => 0 < @compute_k M N n) _ nb hcom
intro k _ _
simp only
intro h
unfold compute_k at h
contrapose! h
rw [nonpos_iff_eq_zero] at h
rw [h]
simp
apply induction_end C (compute_k N) hcom
suffices ∀ n ≤ N, motive' C n (compute_k n) by exact this N le_rfl
intro n
induction n with
| zero =>
intro _
apply induction_begin
| succ n ih =>
intro nb
apply induction_step C hC _ _ (hcom' n _) _ (ih _) <;> omega
theorem imo1978_p6 (C : Finset.Icc 1 1978 → Fin 6) :
∃ j i k, C i = C j ∧ C j = C k ∧ i.val + k.val = j.val := by
by_contra! c
apply compute_finite_induction C c
decide
end Imo1978P6
| true | Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1978, Problem 6
An international society has its members from six different countries.
The list of members has 1978 names, numbered $1, 2, \ldots, 1978$.
Prove that there is at least one member whose number is
the sum of the numbers of two (not necessarily distinct) members from his own country.
-/
namespace Imo1978P6
@[grind! .]
theorem Nat.ceilDiv_pos (a b : ℕ) (apos : 0 < a) (bpos : 0 < b) : 0 < a ⌈/⌉ b := by
by_contra!
rw [ceilDiv_le_iff_le_mul bpos] at this
simp_all
variable {M N : ℕ}
abbrev Name : Type := Finset.Icc 1 M
variable (C : @Name M → Fin N)
noncomputable abbrev members_of (i : Fin N) : Finset (@Name M) := {k | C k = i}
def motive (Cdone : Finset (Fin N)) (k : ℕ) : Prop :=
∃ Δ : Finset Name,
(∀ y ∈ Cdone, ∃ a0, C a0 = y ∧ ∀ x ∈ Δ, ∃ hb, C ⟨x.val+a0.val, hb⟩ = y)
∧ Disjoint (Δ.image C) Cdone
∧ k ≤ Δ.card
def motive' (n : ℕ) (k : ℕ) : Prop := ∃ Cdone, Cdone.card = n ∧ motive C Cdone k
theorem induction_begin : motive' C 0 M := by
use ∅, by simp
unfold motive
use Finset.univ
simp
theorem induction_end (k : ℕ) (kpos : 0 < k) : motive' C N k → False := by
intro ih
let ⟨Cdone, cc, Δ, h1, h2, h3⟩ := ih
have : Cdone = Finset.univ := by
apply Finset.eq_univ_of_card
simp [cc]
subst Cdone
simp only [Finset.disjoint_iff_inter_eq_empty, Finset.inter_univ, Finset.image_eq_empty] at h2
grind only [= Finset.card_empty]
theorem induction_step [NeZero N] (h : ∀ (j i k), C i = C j → C j = C k → i.val + k.val ≠ j.val)
(n : ℕ) (k : ℕ) (kpos : 0 < k) (hu : n < N)
: motive' C n k → motive' C (n+1) (k ⌈/⌉ (N-n) - 1) := by
intro ih
let ⟨Cdone, cc, Δ', ih1, ih2, ih3⟩ := ih
have kcd_pos : 1 ≤ k ⌈/⌉ N := by grind only [!Nat.ceilDiv_pos, Nat.pos_of_neZero]
have NsCdpos : 0 < N - Cdone.card := by omega
have ddn_pos : 1 ≤ Δ'.card ⌈/⌉ (N - Cdone.card) := by grind only [!Nat.ceilDiv_pos]
obtain ⟨y, hy1, hy2⟩ : ∃ y ∉ Cdone, (k ⌈/⌉ (N-Cdone.card)) ≤ (Δ' ∩ members_of C y).card := by
let C' (x : Δ') : {y : Fin N // y ∈ (C '' Δ')} :=
⟨C x.val, by grind only [= Set.mem_image, = Finset.mem_coe]⟩
let ⟨y, h⟩ := Fintype.exists_lt_card_fiber_of_mul_lt_card (n:=(Δ'.card ⌈/⌉ (N - Cdone.card) - 1)) C' ?_
· use y
and_intros
· rw [Finset.disjoint_iff_inter_eq_empty] at ih2
contrapose! ih2
use y.val
rw [Finset.mem_inter, <-SetLike.mem_coe]
simp only [Finset.coe_image, Subtype.coe_prop, ih2, and_self]
· calc
_ ≤ Δ'.card ⌈/⌉ (N - Cdone.card) := by
rw [Nat.ceilDiv_eq_add_pred_div, Nat.ceilDiv_eq_add_pred_div]
apply Nat.div_le_div_right
omega
_ ≤ _ := by
rw [tsub_lt_iff_left ddn_pos, Nat.lt_one_add_iff] at h
apply le_trans h
apply Finset.card_le_card_of_injOn (f:=Subtype.val)
· unfold C' at *
intro x hx
simp [<-Subtype.val_inj] at hx ⊢
exact hx
· exact Set.injOn_subtype_val
· apply lt_of_le_of_lt (b:=(N - Cdone.card) * (Δ'.card ⌈/⌉ (N - Cdone.card) - 1))
· apply Nat.mul_le_mul_right
rw [show N - Cdone.card = (Finset.univ \ Cdone).card by
rw [Finset.card_sdiff_of_subset] <;> simp
]
rw [Fintype.card_ofFinset, Finset.toFinset_coe]
apply Finset.card_le_card
rw [Finset.disjoint_iff_inter_eq_empty] at ih2
intro y hy
simp only [Finset.mem_sdiff, Finset.mem_univ, true_and]
contrapose! ih2
use y
exact Finset.mem_inter_of_mem hy ih2
· simp only [Fintype.card_coe]
apply Nat.lt_of_add_one_le
rw [Nat.ceilDiv_eq_add_pred_div, Nat.mul_sub, mul_one]
have := Nat.mul_div_le (Δ'.card + (N - Cdone.card) - 1) (N - Cdone.card)
rw [Nat.le_sub_iff_add_le, <-Nat.sub_le_iff_le_add, Nat.sub_add_comm] at this
· exact this
· suffices 1 ≤ (Δ'.card + (N - Cdone.card) - 1) / (N - Cdone.card) by exact Nat.le_mul_of_pos_right _ this
rw [<-Nat.div_self NsCdpos]
apply Nat.div_le_div_right
rw [Nat.div_self NsCdpos]
omega
· omega
have cc' : (Cdone ∪ {y}).card = n + 1 := by
rw [Finset.union_singleton, Finset.card_insert_of_notMem hy1, cc]
use Cdone ∪ {y}, cc'
have Cyne : (Δ' ∩ members_of C y).Nonempty := by
rw [<-Finset.card_pos, Nat.lt_iff_add_one_le]
trans k ⌈/⌉ (N - Cdone.card)
· by_contra!
rw [add_comm, Nat.lt_one_add_iff] at this
rw [ceilDiv_le_iff_le_mul NsCdpos] at this
omega
· exact hy2
let xmin := (Δ' ∩ members_of C y).min' Cyne
let Δ : Finset (@Name M) := ((Δ' ∩ members_of C y).erase xmin).attach.map (⟨fun x => ⟨x.val.val - xmin.val, by {
rw [Finset.mem_Icc]
and_intros
· apply Nat.le_sub_of_add_le'
rw [Nat.add_one_le_iff, Subtype.coe_lt_coe]
apply Finset.min'_lt_of_mem_erase_min'
apply SetLike.coe_mem
· have := Finset.mem_Icc.mp xmin.prop
have := Finset.mem_Icc.mp x.val.prop
omega
}⟩, by {
intro x1 x2 e
rw [Subtype.mk.injEq, tsub_left_inj, SetLike.coe_eq_coe, SetLike.coe_eq_coe] at e
· trivial
all_goals simp only [Subtype.coe_le_coe]; grind only [usr Subtype.property, = Finset.mem_erase, Finset.min'_le]
}⟩)
use Δ
apply (show ∀ (a b c : Prop), (a ∧ (a → b) ∧ c) → (a ∧ b ∧ c) by grind only)
and_intros
· simp only [Finset.union_singleton, Finset.mem_insert, forall_eq_or_imp]
and_intros
· use xmin
and_intros
· grind only [!Finset.min'_mem, = Finset.mem_inter, = Finset.mem_filter]
· intro x hx
unfold Δ at hx
simp only [Finset.mem_map, Finset.mem_attach, Function.Embedding.coeFn_mk, true_and,
Subtype.exists, Finset.mem_erase, ne_eq, Finset.mem_inter, Finset.mem_filter,
Finset.univ_eq_attach] at hx
let ⟨a, ha1, ha2, ha3⟩ := hx
subst x
rw [Nat.sub_add_cancel]
· simp_rw [ha2.right.right]
simp only [ha1, exists_const]
· rw [Subtype.coe_le_coe (y:=⟨a, ha1⟩)]
grind only [= Finset.nonempty_def, Finset.min'_le, = Finset.mem_inter,
= Finset.mem_filter, ← Finset.mem_univ]
· intro y' hy'
let ⟨b0, h1, h2⟩ := ih1 y' hy'
use ⟨b0 + xmin, ?_⟩
· and_intros
· simp_rw [add_comm] at h2
apply (h2 _ _).snd
grind only [!Finset.min'_mem, = Finset.mem_inter]
· intro x hx
unfold Δ at hx
simp only [Finset.mem_map, Finset.mem_attach, Function.Embedding.coeFn_mk, true_and,
Subtype.exists, Finset.mem_erase, ne_eq, Finset.mem_inter, Finset.mem_filter,
Finset.univ_eq_attach, Finset.mem_Icc] at hx
have hs1 : ∀ (_h), ⟨x.val+xmin.val, _h⟩ ∈ Δ' := by
grind only
have xsx : x.val + xmin.val ∈ Finset.Icc 1 M := by
omega
use ?_
· have := (h2 ⟨x.val+xmin.val, xsx⟩ ?_).snd
· simp_rw [<-add_assoc, add_comm, add_assoc]
simp_rw [add_comm] at this
apply this
· apply hs1
· have := (h2 ⟨x.val+xmin.val, xsx⟩ ?_).snd
· simp_rw [<-add_assoc, add_comm, add_assoc]
simp_rw [add_comm] at this
grind only
· apply hs1
· rw [add_comm]
apply (h2 _ _).fst
grind only [!Finset.min'_mem, = Finset.mem_inter]
· intro hs
suffices ∀ y' ∈ (Cdone ∪ {y}), Disjoint Δ (members_of C y') by
grind only [= Finset.nonempty_def, Finset.disjoint_iff_ne, = Finset.mem_image,
= Finset.mem_filter, ← Finset.mem_univ]
intro y' hy'
let ⟨b0, h1, h2⟩ := hs y' hy'
rw [Finset.disjoint_iff_ne]
intro x hx x' hx'
have ⟨h2, h3⟩ := h2 _ hx
by_cases! xvx'v : ¬ x'.val ≤ x.val
· grind only
have hb0 : b0.val + 1 < M := by grind only [= Finset.mem_Icc, = Finset.mem_filter]
rw [Ne, Subtype.ext_iff, eq_comm, <-add_left_inj b0.val]
rw [show x.val + b0.val = (⟨x.val+b0.val, h2⟩ : Name).val by simp]
apply h <;> grind only [= Finset.mem_filter]
· unfold Δ
rw [Finset.card_map, Finset.card_attach, Finset.card_erase_of_mem (by apply Finset.min'_mem)]
apply Nat.sub_le_sub_right
rw [<-cc]
apply le_trans hy2
apply Finset.card_le_card
simp
def compute_k (n: ℕ) : ℕ :=
match n with
| 0 => M
| n+1 => ((compute_k n) ⌈/⌉ (N-n) - 1)
theorem compute_finite_induction [NeZero N] (hC : ∀ (j i k), C i = C j → C j = C k → i.val + k.val ≠ j.val)
: 0 < @compute_k M N N → False := by
intro hcom
have hcom' : ∀ n ≤ N, 0 < @compute_k M N n := by
clear hC
intro n nb
apply Nat.decreasingInduction' (P:=fun n => 0 < @compute_k M N n) _ nb hcom
intro k _ _
simp only
intro h
unfold compute_k at h
contrapose! h
rw [nonpos_iff_eq_zero] at h
rw [h]
simp
apply induction_end C (compute_k N) hcom
suffices ∀ n ≤ N, motive' C n (compute_k n) by exact this N le_rfl
intro n
induction n with
| zero =>
intro _
apply induction_begin
| succ n ih =>
intro nb
apply induction_step C hC _ _ (hcom' n _) _ (ih _) <;> omega
theorem imo1978_p6 (C : Finset.Icc 1 1978 → Fin 6) :
∃ j i k, C i = C j ∧ C j = C k ∧ i.val + k.val = j.val := by
by_contra! c
apply compute_finite_induction C c
decide
end Imo1978P6 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1978P6.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unexpected token '.'; expected ']'", "unexpected token '!'; expected ']'", "`grind` failed\ncase grind\nM N : \u2115\nC : { x // x \u2208 Finset.Icc 1 M } \u2192 Fin N\ninst : NeZero N\nh : \u2200 (j i k : { x // x \u2208 Finset.Icc 1 M }), C i = C j \u2192 C j = C k \u2192 \u00ac\u2191i + \u2191k = \u2191j\nn k : \u2115\nkpos : 1 \u2264 k\nhu : n + 1 \u2264 N\nih : motive' C n k\nCdone : Finset (Fin N)\ncc : Cdone.card = n\n\u0394' : Finset { x // x \u2208 Finset.Icc 1 M }\nih1 : \u2200 y \u2208 Cdone, \u2203 a0, C a0 = y \u2227 \u2200 x \u2208 \u0394', \u2203 (h : \u2191a0 + \u2191x \u2208 Finset.Icc 1 M), C \u27e8\u2191a0 + \u2191x, \u22ef\u27e9 = y\nih2 : Disjoint (Finset.image C \u0394') Cdone\nih3 : k \u2264 \u0394'.card\nh_1 : k \u2308/\u2309 N = 0\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] NeZero N\n [prop] \u2200 (j i k : { x // x \u2208 Finset.Icc 1 M }), C i = C j \u2192 C j = C k \u2192 \u00ac\u2191i + \u2191k = \u2191j\n [prop] 1 \u2264 k\n [prop] n + 1 \u2264 N\n [prop] motive' C n k\n [prop] Cdone.card = n\n [prop] \u2200 y \u2208 Cdone, \u2203 a0, C a0 = y \u2227 \u2200 x \u2208 \u0394', \u2203 (h : \u2191a0 + \u2191x \u2208 Finset.Icc 1 M), C \u27e8\u2191a0 + \u2191x, \u22ef\u27e9 = y\n [prop] Disjoint (Finset.image C \u0394') Cdone\n [prop] k \u2264 \u0394'.card\n [prop] k \u2308/\u2309 N = 0\n [prop] \u2200 (k : { x // x \u2208 Finset.Icc 1 M }), \u00ac\u2191k = 0\n [eqc] True propositions\n [prop] NeZero N\n [prop] \u2200 (j i k : { x // x \u2208 Finset.Icc 1 M }), C i = C j \u2192 C j = C k \u2192 \u00ac\u2191i + \u2191k = \u2191j\n [prop] 1 \u2264 k\n [prop] n + 1 \u2264 N\n [prop] motive' C n k\n [prop] \u2200 y \u2208 Cdone, \u2203 a0, C a0 = y \u2227 \u2200 x \u2208 \u0394', \u2203 (h : \u2191a0 + \u2191x \u2208 Finset.Icc 1 M), C \u27e8\u2191a0 + \u2191x, \u22ef\u27e9 = y\n [prop] Disjoint (Finset.image C \u0394') Cdone\n [prop] k \u2264 \u0394'.card\n [prop] \u2200 (k : { x // x \u2208 Finset.Icc 1 M }), \u00ac\u2191k = 0\n [eqc] Equivalence classes\n [eqc] {Cdone.card, n}\n [eqc] {fun x => x \u2208 Finset.Icc 1 M, Membership.mem (Finset.Icc 1 M)}\n [eqc] {k \u2308/\u2309 N, 0}\n [ematch] E-matching patterns\n [thm] ih1: [@Membership.mem `[Fin N] `[Finset (Fin N)] `[Finset.instMembership] `[Cdone] #1]\n [thm] ih1: [@Membership.mem `[Fin N] `[Finset (Fin N)] `[Finset.instMembership] `[Cdone] #1]\n [thm] local_0: [@Subtype.val `[\u2115] `[fun x => x \u2208 Finset.Icc 1 M] #0]\n [thm] local_0: [@Subtype.val `[\u2115] `[fun x => x \u2208 Finset.Icc 1 M] #0]\n [cutsat] Assignment satisfying linear constraints\n [assign] M := 2\n [assign] N := 1\n [assign] n := 0\n [assign] k := 1\n [assign] Cdone.card := 0\n [assign] \u0394'.card := 1\n [assign] k \u2308/\u2309 N := 0", "unsolved goals\nM N : \u2115\nC : Name \u2192 Fin N\ninst\u271d : NeZero N\nh : \u2200 (j i k : Name), C i = C j \u2192 C j = C k \u2192 \u2191i + \u2191k \u2260 \u2191j\nn k : \u2115\nkpos : 0 < k\nhu : n < N\nih : motive' C n k\nCdone : Finset (Fin N)\ncc : Cdone.card = n\n\u0394' : Finset Name\nih1 : \u2200 y \u2208 Cdone, \u2203 a0, C a0 = y \u2227 \u2200 x \u2208 \u0394', \u2203 (hb : \u2191x + \u2191a0 \u2208 Finset.Icc 1 M), C \u27e8\u2191x + \u2191a0, hb\u27e9 = y\nih2 : Disjoint (Finset.image C \u0394') Cdone\nih3 : k \u2264 \u0394'.card\nkcd_pos : 1 \u2264 k \u2308/\u2309 N\n\u22a2 motive' C (n + 1) (k \u2308/\u2309 (N - n) - 1)", "unknown tactic", "unsolved goals\nM N : \u2115\nC : Name \u2192 Fin N\ninst\u271d : NeZero N\nhC : \u2200 (j i k : Name), C i = C j \u2192 C j = C k \u2192 \u2191i + \u2191k \u2260 \u2191j\nhcom : 0 < compute_k N\nhcom' : \u2200 n \u2264 N, 0 < compute_k n\nn : \u2115\nih : n \u2264 N \u2192 motive' C n (compute_k n)\nnb : n + 1 \u2264 N\n\u22a2 n \u2264 N\n\nM N : \u2115\nC : Name \u2192 Fin N\ninst\u271d : NeZero N\nhC : \u2200 (j i k : Name), C i = C j \u2192 C j = C k \u2192 \u2191i + \u2191k \u2260 \u2191j\nhcom : 0 < compute_k N\nhcom' : \u2200 n \u2264 N, 0 < compute_k n\nn : \u2115\nih : n \u2264 N \u2192 motive' C n (compute_k n)\nnb : n + 1 \u2264 N\n\u22a2 n < N\n\nM N : \u2115\nC : Name \u2192 Fin N\ninst\u271d : NeZero N\nhC : \u2200 (j i k : Name), C i = C j \u2192 C j = C k \u2192 \u2191i + \u2191k \u2260 \u2191j\nhcom : 0 < compute_k N\nhcom' : \u2200 n \u2264 N, 0 < compute_k n\nn : \u2115\nih : n \u2264 N \u2192 motive' C n (compute_k n)\nnb : n + 1 \u2264 N\n\u22a2 n \u2264 N"], "timeout_s": 600.0, "latency_s": 3.5573, "verified_at": "2026-03-26T18:16:45.901821+00:00"}} | false | true | false | 3.5573 |
compfiles_Imo1979P1 | compfiles | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1979, Problem 1
Suppose that p and q are positive integers such that
p / q = 1 - 1/2 + 1/3 - 1/4 + ... - 1/1318 + 1/1319.
Prove that p is divisible by 1979.
-/
namespace Imo1979P1
lemma lemma3 : ∑ i ∈ Finset.range 1319, (-(1:ℚ))^i / (i + 1) =
∑ i ∈ Finset.range 1319, (1:ℚ) / (i + 1) -
2 * ∑ i ∈ Finset.range 659, (1:ℚ) / (2 * (i + 1)) := by
have h2 := Finset.sum_filter_add_sum_filter_not
(Finset.range 1319) (Even ·) (λ i ↦ (1:ℚ) / (i + 1))
rw [←h2]
let g : ℕ ↪ ℕ :=
⟨fun x ↦ 2 * x + 1, by intro a b hab; omega⟩
have h4 : (Finset.range 659).map g =
(Finset.range 1319).filter (fun x ↦ ¬Even x) := by
ext a
unfold g
rw [Finset.mem_map, Function.Embedding.coeFn_mk,
Finset.mem_filter, Finset.mem_range]
constructor
· intro ha
obtain ⟨b, hb1, hb2⟩ := ha
rw [Finset.mem_range] at hb1
rw [←hb2]
constructor
· omega
· exact Nat.not_even_iff_odd.mpr ⟨b, rfl⟩
· rintro ⟨ha1, ha2⟩
have h5 : Odd a := Nat.not_even_iff_odd.mp ha2
obtain ⟨r, hr⟩ := h5
use r
constructor
· rw [Finset.mem_range]; omega
· exact hr.symm
have h5 : ∑ i ∈ Finset.range 659, 1 / (2 * ((i:ℚ) + 1))
= ∑ i ∈ Finset.range 659, (1 / (((g i):ℚ) + 1)) := by
apply Finset.sum_congr rfl
intro x _
field_simp
simp only [Function.Embedding.coeFn_mk, Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat,
Nat.cast_one, g]
linarith
have h6 := Finset.sum_map (Finset.range 659) g (fun j ↦ 1 / ((j:ℚ) + 1))
have h3 :
∑ x ∈ Finset.filter (fun x ↦ ¬Even x) (Finset.range 1319),
1 / ((x:ℚ) + 1) =
∑ i ∈ Finset.range 659, 1 / (2 * ((i:ℚ) + 1)) := by
rw [h5]
rw [←h6, h4]
rw [h3, two_mul, add_sub_add_right_eq_sub]
rw [←h3, ←h4, h6, ←h5, ←h3]
have h7 :
∑ i ∈ Finset.filter (fun x ↦ Even x) (Finset.range 1319), 1 / ((i:ℚ) + 1) =
∑ i ∈ Finset.filter (fun x ↦ Even x) (Finset.range 1319),
(-1 : ℚ)^i / ((i:ℚ) + 1) := by
apply Finset.sum_congr rfl
intro x hx
rw [Finset.mem_filter] at hx
have h9: (-1 : ℚ)^x = 1 := Even.neg_one_pow hx.2
rw [h9]
rw [h7]; clear h7
rw [Rat.sub_eq_add_neg, ←Finset.sum_neg_distrib]
have h10 : ∑ x ∈ Finset.filter (fun x ↦ ¬Even x) (Finset.range 1319),
-(1 / ((x:ℚ) + 1)) =
∑ x ∈ Finset.filter (fun x ↦ ¬Even x) (Finset.range 1319),
(-1 : ℚ)^x / ((x:ℚ) + 1) := by
apply Finset.sum_congr rfl
intro x hx
rw [Finset.mem_filter] at hx
have h9: (-1 : ℚ)^x = -1 := Odd.neg_one_pow (Nat.not_even_iff_odd.mp hx.2)
rw [h9]
field_simp
rw [h10, Finset.sum_filter_add_sum_filter_not]
lemma lemma4 (n m : ℕ) (f : ℕ → ℚ) :
∑ i ∈ Finset.Ico n (n + 2 * m), f i =
∑ i ∈ Finset.range m, (f (n + i) + f (n + (2 * m - 1 - i))) := by
rw [Finset.sum_Ico_eq_sum_range, add_tsub_cancel_left]
rw [two_mul, Finset.sum_range_add, Finset.sum_add_distrib]
congr 1
rw [←Finset.sum_range_reflect (fun x ↦ f (n + (m + x)))]
refine Finset.sum_congr rfl fun x hx => ?_
rw [Finset.mem_range] at hx
omega
lemma lemma9' (i : ℕ) (hi : i ∈ Finset.range 330) :
(((∏ j ∈ Finset.range 330,
(660 + j) * (1319 - j)):ℕ):ℚ) / ((660 + (i:ℚ)) * (1319 - (i:ℚ)))
= ∏ j ∈ (Finset.range 330).erase i, (660 + j) * (1319 - j) := by
rw [←Finset.prod_erase_mul _ _ hi]
rw [Finset.mem_range] at hi
push_cast
have h1 : (((1319 - i):ℕ):ℚ) = 1319 - (i:ℚ) := by
have : i ≤ 1319 := by omega
simp_all only [Nat.cast_sub, Nat.cast_ofNat]
rw [h1, mul_div_assoc]
have h2 : ((660 + (i:ℚ)) * (1319 - (i:ℚ))) /
((660 + (i:ℚ)) * (1319 - (i:ℚ))) = 1 := by
have h3 : (660 + (i:ℚ)) * (1319 - (i:ℚ)) ≠ 0 := by
have h5 : (i: ℚ) < 330 := by norm_cast
nlinarith
exact div_self h3
rw [h2, mul_one]
lemma lemma9 :
(∑ i ∈ Finset.range 330, 1 / ((660 + (i:ℚ)) * (1319 - (i:ℚ)))) *
(((∏ j ∈ Finset.range 330, (660 + j) * (1319 - j)):ℕ):ℚ) =
(∑ i ∈ Finset.range 330, ∏ j ∈ (Finset.range 330).erase i,
(660 + j) * (1319 - j)) := by
simp_rw [Finset.sum_mul, div_mul_eq_mul_div, one_mul]
rw [Finset.sum_congr rfl lemma9']
push_cast
rfl
theorem imo1979_p1 (p q : ℤ) (hp : 0 < p) (hq : 0 < q)
(h : (p : ℚ) / q = ∑ i ∈ Finset.range 1319, (-1 : ℚ)^i / (i + 1)) :
1979 ∣ p := by
-- we follow the solution from
-- https://artofproblemsolving.com/wiki/index.php/1979_IMO_Problems/Problem_1
rw [lemma3] at h
have h1 : 2 * ∑ i ∈ Finset.range 659, 1 / (2 * ((i:ℚ) + 1)) =
∑ i ∈ Finset.range 659, 1 / ((i:ℚ) + 1) := by
rw [Finset.mul_sum, Finset.sum_congr rfl]
intro x _
field_simp
rw [h1] at h; clear h1
have h2 : Disjoint (Finset.range 659) (Finset.Ico 659 1319) := by
rw [Finset.disjoint_left]
intro a ha ha1
rw [Finset.mem_range] at ha
rw [Finset.mem_Ico] at ha1
omega
have h3 : Finset.range 1319 =
Finset.disjUnion (Finset.range 659) (Finset.Ico 659 1319) h2 := by
ext a
rw [Finset.mem_range, Finset.disjUnion_eq_union, Finset.mem_union,
Finset.mem_range, Finset.mem_Ico]
omega
rw [h3] at h; clear h3
rw [Finset.sum_disjUnion, add_sub_cancel_left] at h; clear h2
rw [lemma4 659 330] at h
have h4 :
∀ i ∈ Finset.range 330,
1 / ((((659 + i):ℕ):ℚ) + 1) + 1 / ((((659 + (2 * 330 - 1 - i)):ℕ):ℚ) + 1) =
1979 / ((660 + (i:ℚ)) * (1319 - (i:ℚ))) := by
intro i hi
rw [Finset.mem_range] at hi
have h5 : (((659 + i) : ℕ) : ℚ) + 1 = 660 + (i : ℚ) := by grind
have h6 : (((659 + (2 * 330 - 1 - i)):ℕ):ℚ) + 1 = 1319 - (i:ℚ) := by
rw [show 2 * 330 - 1 - i = 659 - i by omega]
rw [show 659 + (659 - i) = 1318 - i by omega]
have h10 : (((1318 - i):ℕ):ℚ) = 1318 - ↑i := by
have : i ≤ 1318 := by omega
rw [Nat.cast_sub this]
rfl
rw [h10]
ring
rw [h5, h6]; clear h5 h6
have : (1319 : ℚ) - i ≠ 0 := by
have h8 : 1319 ≠ i := by omega
intro H
have h9 : 1319 = (i : ℚ) := by linarith
norm_cast at h9
field_simp; norm_num
rw [Finset.sum_congr rfl h4] at h; clear h4
rw [show (1979 : ℚ) = 1979 * 1 by simp (config := { arith := true })] at h
simp_rw [mul_div_assoc] at h
rw [←Finset.mul_sum] at h
let s : ℕ := ∏ i ∈ Finset.range 330, (660 + i) * (1319 - i)
let sq := (s : ℚ)
have hpp : Nat.Prime 1979 := by norm_num1
have hsqp : ¬ 1979 ∣ s := by
have h30 : ∀ i ∈ Finset.range 330, ¬ 1979 ∣ (660 + i) * (1319 - i) := fun i hi ↦ by
rw [Finset.mem_range] at hi
intro H
have := (Nat.Prime.dvd_mul hpp).mp H
omega
exact Prime.not_dvd_finset_prod (Nat.prime_iff.mp hpp) h30
obtain ⟨p', rfl⟩ := Int.eq_ofNat_of_zero_le (le_of_lt hp)
obtain ⟨q', rfl⟩ := Int.eq_ofNat_of_zero_le (le_of_lt hq)
simp only [Int.cast_natCast] at h
suffices H : 1979 ∣ p' from Int.ofNat_dvd.mpr H
have hqq0 : (q':ℚ) ≠ 0 :=
Nat.cast_ne_zero.mpr (Nat.pos_iff_ne_zero.mp (Int.natCast_pos.mp hq))
rw [div_eq_iff hqq0] at h
apply_fun (· * sq) at h
have h41 :
(1979 * ∑ i ∈ Finset.range 330, 1 / ((660 + (i:ℚ)) * (1319 - (i:ℚ)))) * (q':ℚ) * sq
= 1979 * (q':ℚ) *
((∑ i ∈ Finset.range 330, 1 / ((660 + (i:ℚ)) * (1319 - (i:ℚ)))) * sq) := by
ring
rw [h41] at h; clear h41
rw [lemma9] at h
rw [← Nat.cast_mul, show (1979:ℚ) = ((1979:ℕ):ℚ) by rfl,
← Nat.cast_mul, ← Nat.cast_mul] at h
replace h := Nat.cast_inj.mp h
rw [Nat.mul_assoc] at h
have h20 : 1979 ∣ p' * s :=
⟨(q' * ∑ i ∈ Finset.range 330,
∏ j ∈ Finset.erase (Finset.range 330) i, (660 + j) * (1319 - j)),
h⟩
have : Nat.Coprime 1979 s := (Nat.Prime.coprime_iff_not_dvd hpp).mpr hsqp
exact (Nat.Coprime.dvd_mul_right this).mp h20
end Imo1979P1 | /- | /-
Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1979, Problem 1
Suppose that p and q are positive integers such that
p / q = 1 - 1/2 + 1/3 - 1/4 + ... - 1/1318 + 1/1319.
Prove that p is divisible by 1979.
-/
namespace Imo1979P1
lemma lemma3 : ∑ i ∈ Finset.range 1319, (-(1:ℚ))^i / (i + 1) =
∑ i ∈ Finset.range 1319, (1:ℚ) / (i + 1) -
2 * ∑ i ∈ Finset.range 659, (1:ℚ) / (2 * (i + 1)) := by
have h2 := Finset.sum_filter_add_sum_filter_not
(Finset.range 1319) (Even ·) (λ i ↦ (1:ℚ) / (i + 1))
rw [←h2]
let g : ℕ ↪ ℕ :=
⟨fun x ↦ 2 * x + 1, by intro a b hab; omega⟩
have h4 : (Finset.range 659).map g =
(Finset.range 1319).filter (fun x ↦ ¬Even x) := by
ext a
unfold g
rw [Finset.mem_map, Function.Embedding.coeFn_mk,
Finset.mem_filter, Finset.mem_range]
constructor
· intro ha
obtain ⟨b, hb1, hb2⟩ := ha
rw [Finset.mem_range] at hb1
rw [←hb2]
constructor
· omega
· exact Nat.not_even_iff_odd.mpr ⟨b, rfl⟩
· rintro ⟨ha1, ha2⟩
have h5 : Odd a := Nat.not_even_iff_odd.mp ha2
obtain ⟨r, hr⟩ := h5
use r
constructor
· rw [Finset.mem_range]; omega
· exact hr.symm
have h5 : ∑ i ∈ Finset.range 659, 1 / (2 * ((i:ℚ) + 1))
= ∑ i ∈ Finset.range 659, (1 / (((g i):ℚ) + 1)) := by
apply Finset.sum_congr rfl
intro x _
field_simp
simp only [Function.Embedding.coeFn_mk, Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat,
Nat.cast_one, g]
linarith
have h6 := Finset.sum_map (Finset.range 659) g (fun j ↦ 1 / ((j:ℚ) + 1))
have h3 :
∑ x ∈ Finset.filter (fun x ↦ ¬Even x) (Finset.range 1319),
1 / ((x:ℚ) + 1) =
∑ i ∈ Finset.range 659, 1 / (2 * ((i:ℚ) + 1)) := by
rw [h5]
rw [←h6, h4]
rw [h3, two_mul, add_sub_add_right_eq_sub]
rw [←h3, ←h4, h6, ←h5, ←h3]
have h7 :
∑ i ∈ Finset.filter (fun x ↦ Even x) (Finset.range 1319), 1 / ((i:ℚ) + 1) =
∑ i ∈ Finset.filter (fun x ↦ Even x) (Finset.range 1319),
(-1 : ℚ)^i / ((i:ℚ) + 1) := by
apply Finset.sum_congr rfl
intro x hx
rw [Finset.mem_filter] at hx
have h9: (-1 : ℚ)^x = 1 := Even.neg_one_pow hx.2
rw [h9]
rw [h7]; clear h7
rw [Rat.sub_eq_add_neg, ←Finset.sum_neg_distrib]
have h10 : ∑ x ∈ Finset.filter (fun x ↦ ¬Even x) (Finset.range 1319),
-(1 / ((x:ℚ) + 1)) =
∑ x ∈ Finset.filter (fun x ↦ ¬Even x) (Finset.range 1319),
(-1 : ℚ)^x / ((x:ℚ) + 1) := by
apply Finset.sum_congr rfl
intro x hx
rw [Finset.mem_filter] at hx
have h9: (-1 : ℚ)^x = -1 := Odd.neg_one_pow (Nat.not_even_iff_odd.mp hx.2)
rw [h9]
field_simp
rw [h10, Finset.sum_filter_add_sum_filter_not]
lemma lemma4 (n m : ℕ) (f : ℕ → ℚ) :
∑ i ∈ Finset.Ico n (n + 2 * m), f i =
∑ i ∈ Finset.range m, (f (n + i) + f (n + (2 * m - 1 - i))) := by
rw [Finset.sum_Ico_eq_sum_range, add_tsub_cancel_left]
rw [two_mul, Finset.sum_range_add, Finset.sum_add_distrib]
congr 1
rw [←Finset.sum_range_reflect (fun x ↦ f (n + (m + x)))]
refine Finset.sum_congr rfl fun x hx => ?_
rw [Finset.mem_range] at hx
omega
lemma lemma9' (i : ℕ) (hi : i ∈ Finset.range 330) :
(((∏ j ∈ Finset.range 330,
(660 + j) * (1319 - j)):ℕ):ℚ) / ((660 + (i:ℚ)) * (1319 - (i:ℚ)))
= ∏ j ∈ (Finset.range 330).erase i, (660 + j) * (1319 - j) := by
rw [←Finset.prod_erase_mul _ _ hi]
rw [Finset.mem_range] at hi
push_cast
have h1 : (((1319 - i):ℕ):ℚ) = 1319 - (i:ℚ) := by
have : i ≤ 1319 := by omega
simp_all only [Nat.cast_sub, Nat.cast_ofNat]
rw [h1, mul_div_assoc]
have h2 : ((660 + (i:ℚ)) * (1319 - (i:ℚ))) /
((660 + (i:ℚ)) * (1319 - (i:ℚ))) = 1 := by
have h3 : (660 + (i:ℚ)) * (1319 - (i:ℚ)) ≠ 0 := by
have h5 : (i: ℚ) < 330 := by norm_cast
nlinarith
exact div_self h3
rw [h2, mul_one]
lemma lemma9 :
(∑ i ∈ Finset.range 330, 1 / ((660 + (i:ℚ)) * (1319 - (i:ℚ)))) *
(((∏ j ∈ Finset.range 330, (660 + j) * (1319 - j)):ℕ):ℚ) =
(∑ i ∈ Finset.range 330, ∏ j ∈ (Finset.range 330).erase i,
(660 + j) * (1319 - j)) := by
simp_rw [Finset.sum_mul, div_mul_eq_mul_div, one_mul]
rw [Finset.sum_congr rfl lemma9']
push_cast
rfl
theorem imo1979_p1 (p q : ℤ) (hp : 0 < p) (hq : 0 < q)
(h : (p : ℚ) / q = ∑ i ∈ Finset.range 1319, (-1 : ℚ)^i / (i + 1)) :
1979 ∣ p := by
-- we follow the solution from
-- https://artofproblemsolving.com/wiki/index.php/1979_IMO_Problems/Problem_1
rw [lemma3] at h
have h1 : 2 * ∑ i ∈ Finset.range 659, 1 / (2 * ((i:ℚ) + 1)) =
∑ i ∈ Finset.range 659, 1 / ((i:ℚ) + 1) := by
rw [Finset.mul_sum, Finset.sum_congr rfl]
intro x _
field_simp
rw [h1] at h; clear h1
have h2 : Disjoint (Finset.range 659) (Finset.Ico 659 1319) := by
rw [Finset.disjoint_left]
intro a ha ha1
rw [Finset.mem_range] at ha
rw [Finset.mem_Ico] at ha1
omega
have h3 : Finset.range 1319 =
Finset.disjUnion (Finset.range 659) (Finset.Ico 659 1319) h2 := by
ext a
rw [Finset.mem_range, Finset.disjUnion_eq_union, Finset.mem_union,
Finset.mem_range, Finset.mem_Ico]
omega
rw [h3] at h; clear h3
rw [Finset.sum_disjUnion, add_sub_cancel_left] at h; clear h2
rw [lemma4 659 330] at h
have h4 :
∀ i ∈ Finset.range 330,
1 / ((((659 + i):ℕ):ℚ) + 1) + 1 / ((((659 + (2 * 330 - 1 - i)):ℕ):ℚ) + 1) =
1979 / ((660 + (i:ℚ)) * (1319 - (i:ℚ))) := by
intro i hi
rw [Finset.mem_range] at hi
have h5 : (((659 + i) : ℕ) : ℚ) + 1 = 660 + (i : ℚ) := by grind
have h6 : (((659 + (2 * 330 - 1 - i)):ℕ):ℚ) + 1 = 1319 - (i:ℚ) := by
rw [show 2 * 330 - 1 - i = 659 - i by omega]
rw [show 659 + (659 - i) = 1318 - i by omega]
have h10 : (((1318 - i):ℕ):ℚ) = 1318 - ↑i := by
have : i ≤ 1318 := by omega
rw [Nat.cast_sub this]
rfl
rw [h10]
ring
rw [h5, h6]; clear h5 h6
have : (1319 : ℚ) - i ≠ 0 := by
have h8 : 1319 ≠ i := by omega
intro H
have h9 : 1319 = (i : ℚ) := by linarith
norm_cast at h9
field_simp; norm_num
rw [Finset.sum_congr rfl h4] at h; clear h4
rw [show (1979 : ℚ) = 1979 * 1 by simp (config := { arith := true })] at h
simp_rw [mul_div_assoc] at h
rw [←Finset.mul_sum] at h
let s : ℕ := ∏ i ∈ Finset.range 330, (660 + i) * (1319 - i)
let sq := (s : ℚ)
have hpp : Nat.Prime 1979 := by norm_num1
have hsqp : ¬ 1979 ∣ s := by
have h30 : ∀ i ∈ Finset.range 330, ¬ 1979 ∣ (660 + i) * (1319 - i) := fun i hi ↦ by
rw [Finset.mem_range] at hi
intro H
have := (Nat.Prime.dvd_mul hpp).mp H
omega
exact Prime.not_dvd_finset_prod (Nat.prime_iff.mp hpp) h30
obtain ⟨p', rfl⟩ := Int.eq_ofNat_of_zero_le (le_of_lt hp)
obtain ⟨q', rfl⟩ := Int.eq_ofNat_of_zero_le (le_of_lt hq)
simp only [Int.cast_natCast] at h
suffices H : 1979 ∣ p' from Int.ofNat_dvd.mpr H
have hqq0 : (q':ℚ) ≠ 0 :=
Nat.cast_ne_zero.mpr (Nat.pos_iff_ne_zero.mp (Int.natCast_pos.mp hq))
rw [div_eq_iff hqq0] at h
apply_fun (· * sq) at h
have h41 :
(1979 * ∑ i ∈ Finset.range 330, 1 / ((660 + (i:ℚ)) * (1319 - (i:ℚ)))) * (q':ℚ) * sq
= 1979 * (q':ℚ) *
((∑ i ∈ Finset.range 330, 1 / ((660 + (i:ℚ)) * (1319 - (i:ℚ)))) * sq) := by
ring
rw [h41] at h; clear h41
rw [lemma9] at h
rw [← Nat.cast_mul, show (1979:ℚ) = ((1979:ℕ):ℚ) by rfl,
← Nat.cast_mul, ← Nat.cast_mul] at h
replace h := Nat.cast_inj.mp h
rw [Nat.mul_assoc] at h
have h20 : 1979 ∣ p' * s :=
⟨(q' * ∑ i ∈ Finset.range 330,
∏ j ∈ Finset.erase (Finset.range 330) i, (660 + j) * (1319 - j)),
h⟩
have : Nat.Coprime 1979 s := (Nat.Prime.coprime_iff_not_dvd hpp).mpr hsqp
exact (Nat.Coprime.dvd_mul_right this).mp h20
end Imo1979P1
| true | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1979, Problem 1
Suppose that p and q are positive integers such that
p / q = 1 - 1/2 + 1/3 - 1/4 + ... - 1/1318 + 1/1319.
Prove that p is divisible by 1979.
-/
namespace Imo1979P1
lemma lemma3 : ∑ i ∈ Finset.range 1319, (-(1:ℚ))^i / (i + 1) =
∑ i ∈ Finset.range 1319, (1:ℚ) / (i + 1) -
2 * ∑ i ∈ Finset.range 659, (1:ℚ) / (2 * (i + 1)) := by
have h2 := Finset.sum_filter_add_sum_filter_not
(Finset.range 1319) (Even ·) (λ i ↦ (1:ℚ) / (i + 1))
rw [←h2]
let g : ℕ ↪ ℕ :=
⟨fun x ↦ 2 * x + 1, by intro a b hab; omega⟩
have h4 : (Finset.range 659).map g =
(Finset.range 1319).filter (fun x ↦ ¬Even x) := by
ext a
unfold g
rw [Finset.mem_map, Function.Embedding.coeFn_mk,
Finset.mem_filter, Finset.mem_range]
constructor
· intro ha
obtain ⟨b, hb1, hb2⟩ := ha
rw [Finset.mem_range] at hb1
rw [←hb2]
constructor
· omega
· exact Nat.not_even_iff_odd.mpr ⟨b, rfl⟩
· rintro ⟨ha1, ha2⟩
have h5 : Odd a := Nat.not_even_iff_odd.mp ha2
obtain ⟨r, hr⟩ := h5
use r
constructor
· rw [Finset.mem_range]; omega
· exact hr.symm
have h5 : ∑ i ∈ Finset.range 659, 1 / (2 * ((i:ℚ) + 1))
= ∑ i ∈ Finset.range 659, (1 / (((g i):ℚ) + 1)) := by
apply Finset.sum_congr rfl
intro x _
field_simp
simp only [Function.Embedding.coeFn_mk, Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat,
Nat.cast_one, g]
linarith
have h6 := Finset.sum_map (Finset.range 659) g (fun j ↦ 1 / ((j:ℚ) + 1))
have h3 :
∑ x ∈ Finset.filter (fun x ↦ ¬Even x) (Finset.range 1319),
1 / ((x:ℚ) + 1) =
∑ i ∈ Finset.range 659, 1 / (2 * ((i:ℚ) + 1)) := by
rw [h5]
rw [←h6, h4]
rw [h3, two_mul, add_sub_add_right_eq_sub]
rw [←h3, ←h4, h6, ←h5, ←h3]
have h7 :
∑ i ∈ Finset.filter (fun x ↦ Even x) (Finset.range 1319), 1 / ((i:ℚ) + 1) =
∑ i ∈ Finset.filter (fun x ↦ Even x) (Finset.range 1319),
(-1 : ℚ)^i / ((i:ℚ) + 1) := by
apply Finset.sum_congr rfl
intro x hx
rw [Finset.mem_filter] at hx
have h9: (-1 : ℚ)^x = 1 := Even.neg_one_pow hx.2
rw [h9]
rw [h7]; clear h7
rw [Rat.sub_eq_add_neg, ←Finset.sum_neg_distrib]
have h10 : ∑ x ∈ Finset.filter (fun x ↦ ¬Even x) (Finset.range 1319),
-(1 / ((x:ℚ) + 1)) =
∑ x ∈ Finset.filter (fun x ↦ ¬Even x) (Finset.range 1319),
(-1 : ℚ)^x / ((x:ℚ) + 1) := by
apply Finset.sum_congr rfl
intro x hx
rw [Finset.mem_filter] at hx
have h9: (-1 : ℚ)^x = -1 := Odd.neg_one_pow (Nat.not_even_iff_odd.mp hx.2)
rw [h9]
field_simp
rw [h10, Finset.sum_filter_add_sum_filter_not]
lemma lemma4 (n m : ℕ) (f : ℕ → ℚ) :
∑ i ∈ Finset.Ico n (n + 2 * m), f i =
∑ i ∈ Finset.range m, (f (n + i) + f (n + (2 * m - 1 - i))) := by
rw [Finset.sum_Ico_eq_sum_range, add_tsub_cancel_left]
rw [two_mul, Finset.sum_range_add, Finset.sum_add_distrib]
congr 1
rw [←Finset.sum_range_reflect (fun x ↦ f (n + (m + x)))]
refine Finset.sum_congr rfl fun x hx => ?_
rw [Finset.mem_range] at hx
omega
lemma lemma9' (i : ℕ) (hi : i ∈ Finset.range 330) :
(((∏ j ∈ Finset.range 330,
(660 + j) * (1319 - j)):ℕ):ℚ) / ((660 + (i:ℚ)) * (1319 - (i:ℚ)))
= ∏ j ∈ (Finset.range 330).erase i, (660 + j) * (1319 - j) := by
rw [←Finset.prod_erase_mul _ _ hi]
rw [Finset.mem_range] at hi
push_cast
have h1 : (((1319 - i):ℕ):ℚ) = 1319 - (i:ℚ) := by
have : i ≤ 1319 := by omega
simp_all only [Nat.cast_sub, Nat.cast_ofNat]
rw [h1, mul_div_assoc]
have h2 : ((660 + (i:ℚ)) * (1319 - (i:ℚ))) /
((660 + (i:ℚ)) * (1319 - (i:ℚ))) = 1 := by
have h3 : (660 + (i:ℚ)) * (1319 - (i:ℚ)) ≠ 0 := by
have h5 : (i: ℚ) < 330 := by norm_cast
nlinarith
exact div_self h3
rw [h2, mul_one]
lemma lemma9 :
(∑ i ∈ Finset.range 330, 1 / ((660 + (i:ℚ)) * (1319 - (i:ℚ)))) *
(((∏ j ∈ Finset.range 330, (660 + j) * (1319 - j)):ℕ):ℚ) =
(∑ i ∈ Finset.range 330, ∏ j ∈ (Finset.range 330).erase i,
(660 + j) * (1319 - j)) := by
simp_rw [Finset.sum_mul, div_mul_eq_mul_div, one_mul]
rw [Finset.sum_congr rfl lemma9']
push_cast
rfl
theorem imo1979_p1 (p q : ℤ) (hp : 0 < p) (hq : 0 < q)
(h : (p : ℚ) / q = ∑ i ∈ Finset.range 1319, (-1 : ℚ)^i / (i + 1)) :
1979 ∣ p := by
-- we follow the solution from
-- https://artofproblemsolving.com/wiki/index.php/1979_IMO_Problems/Problem_1
rw [lemma3] at h
have h1 : 2 * ∑ i ∈ Finset.range 659, 1 / (2 * ((i:ℚ) + 1)) =
∑ i ∈ Finset.range 659, 1 / ((i:ℚ) + 1) := by
rw [Finset.mul_sum, Finset.sum_congr rfl]
intro x _
field_simp
rw [h1] at h; clear h1
have h2 : Disjoint (Finset.range 659) (Finset.Ico 659 1319) := by
rw [Finset.disjoint_left]
intro a ha ha1
rw [Finset.mem_range] at ha
rw [Finset.mem_Ico] at ha1
omega
have h3 : Finset.range 1319 =
Finset.disjUnion (Finset.range 659) (Finset.Ico 659 1319) h2 := by
ext a
rw [Finset.mem_range, Finset.disjUnion_eq_union, Finset.mem_union,
Finset.mem_range, Finset.mem_Ico]
omega
rw [h3] at h; clear h3
rw [Finset.sum_disjUnion, add_sub_cancel_left] at h; clear h2
rw [lemma4 659 330] at h
have h4 :
∀ i ∈ Finset.range 330,
1 / ((((659 + i):ℕ):ℚ) + 1) + 1 / ((((659 + (2 * 330 - 1 - i)):ℕ):ℚ) + 1) =
1979 / ((660 + (i:ℚ)) * (1319 - (i:ℚ))) := by
intro i hi
rw [Finset.mem_range] at hi
have h5 : (((659 + i) : ℕ) : ℚ) + 1 = 660 + (i : ℚ) := by grind
have h6 : (((659 + (2 * 330 - 1 - i)):ℕ):ℚ) + 1 = 1319 - (i:ℚ) := by
rw [show 2 * 330 - 1 - i = 659 - i by omega]
rw [show 659 + (659 - i) = 1318 - i by omega]
have h10 : (((1318 - i):ℕ):ℚ) = 1318 - ↑i := by
have : i ≤ 1318 := by omega
rw [Nat.cast_sub this]
rfl
rw [h10]
ring
rw [h5, h6]; clear h5 h6
have : (1319 : ℚ) - i ≠ 0 := by
have h8 : 1319 ≠ i := by omega
intro H
have h9 : 1319 = (i : ℚ) := by linarith
norm_cast at h9
field_simp; norm_num
rw [Finset.sum_congr rfl h4] at h; clear h4
rw [show (1979 : ℚ) = 1979 * 1 by simp (config := { arith := true })] at h
simp_rw [mul_div_assoc] at h
rw [←Finset.mul_sum] at h
let s : ℕ := ∏ i ∈ Finset.range 330, (660 + i) * (1319 - i)
let sq := (s : ℚ)
have hpp : Nat.Prime 1979 := by norm_num1
have hsqp : ¬ 1979 ∣ s := by
have h30 : ∀ i ∈ Finset.range 330, ¬ 1979 ∣ (660 + i) * (1319 - i) := fun i hi ↦ by
rw [Finset.mem_range] at hi
intro H
have := (Nat.Prime.dvd_mul hpp).mp H
omega
exact Prime.not_dvd_finset_prod (Nat.prime_iff.mp hpp) h30
obtain ⟨p', rfl⟩ := Int.eq_ofNat_of_zero_le (le_of_lt hp)
obtain ⟨q', rfl⟩ := Int.eq_ofNat_of_zero_le (le_of_lt hq)
simp only [Int.cast_natCast] at h
suffices H : 1979 ∣ p' from Int.ofNat_dvd.mpr H
have hqq0 : (q':ℚ) ≠ 0 :=
Nat.cast_ne_zero.mpr (Nat.pos_iff_ne_zero.mp (Int.natCast_pos.mp hq))
rw [div_eq_iff hqq0] at h
apply_fun (· * sq) at h
have h41 :
(1979 * ∑ i ∈ Finset.range 330, 1 / ((660 + (i:ℚ)) * (1319 - (i:ℚ)))) * (q':ℚ) * sq
= 1979 * (q':ℚ) *
((∑ i ∈ Finset.range 330, 1 / ((660 + (i:ℚ)) * (1319 - (i:ℚ)))) * sq) := by
ring
rw [h41] at h; clear h41
rw [lemma9] at h
rw [← Nat.cast_mul, show (1979:ℚ) = ((1979:ℕ):ℚ) by rfl,
← Nat.cast_mul, ← Nat.cast_mul] at h
replace h := Nat.cast_inj.mp h
rw [Nat.mul_assoc] at h
have h20 : 1979 ∣ p' * s :=
⟨(q' * ∑ i ∈ Finset.range 330,
∏ j ∈ Finset.erase (Finset.range 330) i, (660 + j) * (1319 - j)),
h⟩
have : Nat.Coprime 1979 s := (Nat.Prime.coprime_iff_not_dvd hpp).mpr hsqp
exact (Nat.Coprime.dvd_mul_right this).mp h20
end Imo1979P1 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1979P1.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unsolved goals\nh2 :\n \u2211 x \u2208 Finset.range 1319with Even x, 1 / (\u2191x + 1) + \u2211 x \u2208 Finset.range 1319with \u00acEven x, 1 / (\u2191x + 1) =\n \u2211 x \u2208 Finset.range 1319, 1 / (\u2191x + 1)\na b : \u2115\nhab : (fun x => 2 * x + 1) a = (fun x => 2 * x + 1) b\n\u22a2 a = b", "unsolved goals\nh2 :\n \u2211 x \u2208 Finset.range 1319with Even x, 1 / (\u2191x + 1) + \u2211 x \u2208 Finset.range 1319with \u00acEven x, 1 / (\u2191x + 1) =\n \u2211 x \u2208 Finset.range 1319, 1 / (\u2191x + 1)\ng : \u2115 \u21aa \u2115 := { toFun := fun x => 2 * x + 1, inj' := \u22ef }\n\u22a2 \u2211 i \u2208 Finset.range 1319, (-1) ^ i / (\u2191i + 1) =\n \u2211 x \u2208 Finset.range 1319with Even x, 1 / (\u2191x + 1) + \u2211 x \u2208 Finset.range 1319with \u00acEven x, 1 / (\u2191x + 1) -\n 2 * \u2211 i \u2208 Finset.range 659, 1 / (2 * (\u2191i + 1))", "unknown tactic", "unsolved goals\ncase e_a\nn m : \u2115\nf : \u2115 \u2192 \u211a\nx : \u2115\nhx : x < m\n\u22a2 f (n + (m + (m - 1 - x))) = f (n + (m + m - 1 - x))", "unknown tactic", "unsolved goals\ni : \u2115\nhi : i < 330\n\u22a2 i \u2264 1319", "unsolved goals\ni : \u2115\nhi : i < 330\nthis : i \u2264 1319\n\u22a2 \u2191(1319 - i) = 1319 - \u2191i", "unsolved goals\ni : \u2115\nhi : i < 330\nh1 : \u2191(1319 - i) = 1319 - \u2191i\n\u22a2 (\u220f x \u2208 (Finset.range 330).erase i, (660 + \u2191x) * \u2191(1319 - x)) * ((660 + \u2191i) * \u2191(1319 - i)) /\n ((660 + \u2191i) * (1319 - \u2191i)) =\n \u220f x \u2208 (Finset.range 330).erase i, (660 + \u2191x) * \u2191(1319 - x)", "unknown tactic", "unsolved goals\np q : \u2124\nhp : 0 < p\nhq : 0 < q\nh : \u2191p / \u2191q = \u2211 i \u2208 Finset.range 1319, 1 / (\u2191i + 1) - \u2211 i \u2208 Finset.range 659, 1 / (\u2191i + 1)\na : \u2115\nha : a < 659\nha1 : 659 \u2264 a \u2227 a < 1319\n\u22a2 False", "unsolved goals\np q : \u2124\nhp : 0 < p\nhq : 0 < q\nh : \u2191p / \u2191q = \u2211 i \u2208 Finset.range 1319, 1 / (\u2191i + 1) - \u2211 i \u2208 Finset.range 659, 1 / (\u2191i + 1)\nh2 : Disjoint (Finset.range 659) (Finset.Ico 659 1319)\n\u22a2 1979 \u2223 p"], "timeout_s": 600.0, "latency_s": 0.7497, "verified_at": "2026-03-26T18:16:43.553091+00:00"}} | false | true | false | 0.7497 |
compfiles_Imo1979P5 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Maximiliano Onofre-Martínez
-/
import Mathlib
/-!
# International Mathematical Olympiad 1979, Problem 5
Find all real numbers a for which there exist
non-negative real numbers x1, x2, x3, x4, x5 satisfying:
x1 + 2x_2 + 3x_3 + 4x_4 + 5x_5 = a,
x1 + 2^3x_2 + 3^3x_3 + 4^3x_4 + 5^3x_5 = a^2,
x1 + 2^5x_2 + 3^5x_3 + 4^5x_4 + 5^5x_5 = a^3.
-/
namespace Imo1979P5
abbrev solution_set : Set ℝ := {0, 1, 4, 9, 16, 25}
theorem imo1979_p5 (a : ℝ) :
(∃ x1 x2 x3 x4 x5 : ℝ,
x1 ≥ 0 ∧ x2 ≥ 0 ∧ x3 ≥ 0 ∧ x4 ≥ 0 ∧ x5 ≥ 0 ∧
x1 + 2*x2 + 3*x3 + 4*x4 + 5*x5 = a ∧
x1 + 2^3*x2 + 3^3*x3 + 4^3*x4 + 5^3*x5 = a^2 ∧
x1 + 2^5*x2 + 3^5*x3 + 4^5*x4 + 5^5*x5 = a^3 ) ↔ a ∈ solution_set := by
constructor
· rintro ⟨x1, x2, x3, x4, x5, hx1, hx2, hx3, hx4, hx5, h₁, h₂, h₃⟩
have h₀ :
(a - 1)^2 * x1 + 2*(a - 4)^2 * x2 +
3*(a - 9)^2 * x3 + 4*(a - 16)^2 * x4 +
5*(a - 25)^2 * x5 = 0 := by
linear_combination a^2 * h₁ + h₃ - 2 * a * h₂
have t1 : 0 ≤ (a - 1)^2 * x1 := by positivity
have t2 : 0 ≤ 2 * (a - 4)^2 * x2 := by positivity
have t3 : 0 ≤ 3 * (a - 9)^2 * x3 := by positivity
have t4 : 0 ≤ 4 * (a - 16)^2 * x4 := by positivity
have t5 : 0 ≤ 5 * (a - 25)^2 * x5 := by positivity
have h1 : (a + -1)^2 * x1 = 0 := by grind
have h2 : (a + -4)^2 * x2 = 0 := by grind
have h3 : (a + -9)^2 * x3 = 0 := by grind
have h1 : (a + -1)^2 * x1 = 0 := by linarith
have h2 : (a + -4)^2 * x2 = 0 := by linarith
have h3 : (a + -9)^2 * x3 = 0 := by linarith
have h4 : (a + -16)^2 * x4 = 0 := by linarith
grind
intro h
rcases h with rfl | rfl | rfl | rfl | rfl | rfl
· use 0, 0, 0, 0, 0; norm_num
· use 1, 0, 0, 0, 0; norm_num
· use 0, 2, 0, 0, 0; norm_num
· use 0, 0, 3, 0, 0; norm_num
· use 0, 0, 0, 4, 0; norm_num
· use 0, 0, 0, 0, 5; norm_num
end Imo1979P5 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Maximiliano Onofre-Martínez
-/
import Mathlib
/-!
# International Mathematical Olympiad 1979, Problem 5
Find all real numbers a for which there exist
non-negative real numbers x1, x2, x3, x4, x5 satisfying:
x1 + 2x_2 + 3x_3 + 4x_4 + 5x_5 = a,
x1 + 2^3x_2 + 3^3x_3 + 4^3x_4 + 5^3x_5 = a^2,
x1 + 2^5x_2 + 3^5x_3 + 4^5x_4 + 5^5x_5 = a^3.
-/
namespace Imo1979P5
abbrev solution_set : Set ℝ := {0, 1, 4, 9, 16, 25}
theorem imo1979_p5 (a : ℝ) :
(∃ x1 x2 x3 x4 x5 : ℝ,
x1 ≥ 0 ∧ x2 ≥ 0 ∧ x3 ≥ 0 ∧ x4 ≥ 0 ∧ x5 ≥ 0 ∧
x1 + 2*x2 + 3*x3 + 4*x4 + 5*x5 = a ∧
x1 + 2^3*x2 + 3^3*x3 + 4^3*x4 + 5^3*x5 = a^2 ∧
x1 + 2^5*x2 + 3^5*x3 + 4^5*x4 + 5^5*x5 = a^3 ) ↔ a ∈ solution_set := by
constructor
· rintro ⟨x1, x2, x3, x4, x5, hx1, hx2, hx3, hx4, hx5, h₁, h₂, h₃⟩
have h₀ :
(a - 1)^2 * x1 + 2*(a - 4)^2 * x2 +
3*(a - 9)^2 * x3 + 4*(a - 16)^2 * x4 +
5*(a - 25)^2 * x5 = 0 := by
linear_combination a^2 * h₁ + h₃ - 2 * a * h₂
have t1 : 0 ≤ (a - 1)^2 * x1 := by positivity
have t2 : 0 ≤ 2 * (a - 4)^2 * x2 := by positivity
have t3 : 0 ≤ 3 * (a - 9)^2 * x3 := by positivity
have t4 : 0 ≤ 4 * (a - 16)^2 * x4 := by positivity
have t5 : 0 ≤ 5 * (a - 25)^2 * x5 := by positivity
have h1 : (a + -1)^2 * x1 = 0 := by grind
have h2 : (a + -4)^2 * x2 = 0 := by grind
have h3 : (a + -9)^2 * x3 = 0 := by grind
have h1 : (a + -1)^2 * x1 = 0 := by linarith
have h2 : (a + -4)^2 * x2 = 0 := by linarith
have h3 : (a + -9)^2 * x3 = 0 := by linarith
have h4 : (a + -16)^2 * x4 = 0 := by linarith
grind
intro h
rcases h with rfl | rfl | rfl | rfl | rfl | rfl
· use 0, 0, 0, 0, 0; norm_num
· use 1, 0, 0, 0, 0; norm_num
· use 0, 2, 0, 0, 0; norm_num
· use 0, 0, 3, 0, 0; norm_num
· use 0, 0, 0, 4, 0; norm_num
· use 0, 0, 0, 0, 5; norm_num
end Imo1979P5
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Maximiliano Onofre-Martínez
-/
import Mathlib
/-!
# International Mathematical Olympiad 1979, Problem 5
Find all real numbers a for which there exist
non-negative real numbers x1, x2, x3, x4, x5 satisfying:
x1 + 2x_2 + 3x_3 + 4x_4 + 5x_5 = a,
x1 + 2^3x_2 + 3^3x_3 + 4^3x_4 + 5^3x_5 = a^2,
x1 + 2^5x_2 + 3^5x_3 + 4^5x_4 + 5^5x_5 = a^3.
-/
namespace Imo1979P5
abbrev solution_set : Set ℝ := {0, 1, 4, 9, 16, 25}
theorem imo1979_p5 (a : ℝ) :
(∃ x1 x2 x3 x4 x5 : ℝ,
x1 ≥ 0 ∧ x2 ≥ 0 ∧ x3 ≥ 0 ∧ x4 ≥ 0 ∧ x5 ≥ 0 ∧
x1 + 2*x2 + 3*x3 + 4*x4 + 5*x5 = a ∧
x1 + 2^3*x2 + 3^3*x3 + 4^3*x4 + 5^3*x5 = a^2 ∧
x1 + 2^5*x2 + 3^5*x3 + 4^5*x4 + 5^5*x5 = a^3 ) ↔ a ∈ solution_set := by
constructor
· rintro ⟨x1, x2, x3, x4, x5, hx1, hx2, hx3, hx4, hx5, h₁, h₂, h₃⟩
have h₀ :
(a - 1)^2 * x1 + 2*(a - 4)^2 * x2 +
3*(a - 9)^2 * x3 + 4*(a - 16)^2 * x4 +
5*(a - 25)^2 * x5 = 0 := by
linear_combination a^2 * h₁ + h₃ - 2 * a * h₂
have t1 : 0 ≤ (a - 1)^2 * x1 := by positivity
have t2 : 0 ≤ 2 * (a - 4)^2 * x2 := by positivity
have t3 : 0 ≤ 3 * (a - 9)^2 * x3 := by positivity
have t4 : 0 ≤ 4 * (a - 16)^2 * x4 := by positivity
have t5 : 0 ≤ 5 * (a - 25)^2 * x5 := by positivity
have h1 : (a + -1)^2 * x1 = 0 := by grind
have h2 : (a + -4)^2 * x2 = 0 := by grind
have h3 : (a + -9)^2 * x3 = 0 := by grind
have h1 : (a + -1)^2 * x1 = 0 := by linarith
have h2 : (a + -4)^2 * x2 = 0 := by linarith
have h3 : (a + -9)^2 * x3 = 0 := by linarith
have h4 : (a + -16)^2 * x4 = 0 := by linarith
grind
intro h
rcases h with rfl | rfl | rfl | rfl | rfl | rfl
· use 0, 0, 0, 0, 0; norm_num
· use 1, 0, 0, 0, 0; norm_num
· use 0, 2, 0, 0, 0; norm_num
· use 0, 0, 3, 0, 0; norm_num
· use 0, 0, 0, 4, 0; norm_num
· use 0, 0, 0, 0, 5; norm_num
end Imo1979P5 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1979P5.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["`grind` failed\ncase grind\na x1 x2 x3 x4 x5 : \u211d\nhx1 : 0 \u2264 x1\nhx2 : 0 \u2264 x2\nhx3 : 0 \u2264 x3\nhx4 : 0 \u2264 x4\nhx5 : 0 \u2264 x5\nh\u2081 : x1 + 2 * x2 + 3 * x3 + 4 * x4 + 5 * x5 = a\nh\u2082 : x1 + 2 ^ 3 * x2 + 3 ^ 3 * x3 + 4 ^ 3 * x4 + 5 ^ 3 * x5 = a ^ 2\nh\u2083 : x1 + 2 ^ 5 * x2 + 3 ^ 5 * x3 + 4 ^ 5 * x4 + 5 ^ 5 * x5 = a ^ 3\nh\u2080 : (a - 1) ^ 2 * x1 + 2 * (a - 4) ^ 2 * x2 + 3 * (a - 9) ^ 2 * x3 + 4 * (a - 16) ^ 2 * x4 + 5 * (a - 25) ^ 2 * x5 = 0\nt1 : 0 \u2264 (a - 1) ^ 2 * x1\nt2 : 0 \u2264 2 * (a - 4) ^ 2 * x2\nt3 : 0 \u2264 3 * (a - 9) ^ 2 * x3\nt4 : 0 \u2264 4 * (a - 16) ^ 2 * x4\nt5 : 0 \u2264 5 * (a - 25) ^ 2 * x5\nh : \u00ac(a + -1) ^ 2 * x1 = 0\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] 0 \u2264 x1\n [prop] 0 \u2264 x2\n [prop] 0 \u2264 x3\n [prop] 0 \u2264 x4\n [prop] 0 \u2264 x5\n [prop] x1 + 2 * x2 + 3 * x3 + 4 * x4 + 5 * x5 = a\n [prop] x1 + 2 ^ 3 * x2 + 3 ^ 3 * x3 + 4 ^ 3 * x4 + 5 ^ 3 * x5 = a ^ 2\n [prop] x1 + 2 ^ 5 * x2 + 3 ^ 5 * x3 + 4 ^ 5 * x4 + 5 ^ 5 * x5 = a ^ 3\n [prop] (a - 1) ^ 2 * x1 + 2 * (a - 4) ^ 2 * x2 + 3 * (a - 9) ^ 2 * x3 + 4 * (a - 16) ^ 2 * x4 +\n 5 * (a - 25) ^ 2 * x5 =\n 0\n [prop] 0 \u2264 (a - 1) ^ 2 * x1\n [prop] 0 \u2264 2 * (a - 4) ^ 2 * x2\n [prop] 0 \u2264 3 * (a - 9) ^ 2 * x3\n [prop] 0 \u2264 4 * (a - 16) ^ 2 * x4\n [prop] 0 \u2264 5 * (a - 25) ^ 2 * x5\n [prop] \u00ac(a + -1) ^ 2 * x1 = 0\n [eqc] True propositions\n [prop] 0 \u2264 x1\n [prop] 0 \u2264 x2\n [prop] 0 \u2264 x3\n [prop] 0 \u2264 x4\n [prop] 0 \u2264 x5\n [prop] (3 + 2).AtLeastTwo\n [prop] (2 + 2).AtLeastTwo\n [prop] (1 + 2).AtLeastTwo\n [prop] (0 + 2).AtLeastTwo\n [prop] (23 + 2).AtLeastTwo\n [prop] (14 + 2).AtLeastTwo\n [prop] (7 + 2).AtLeastTwo\n [prop] 0 \u2264 (a - 1) ^ 2 * x1\n [prop] 0 \u2264 2 * (a - 4) ^ 2 * x2\n [prop] 0 \u2264 3 * (a - 9) ^ 2 * x3\n [prop] 0 \u2264 4 * (a - 16) ^ 2 * x4\n [prop] 0 \u2264 5 * (a - 25) ^ 2 * x5\n [eqc] False propositions\n [prop] (a + -1) ^ 2 * x1 = 0\n [eqc] Equivalence classes\n [eqc] {x1 + 2 ^ 5 * x2 + 3 ^ 5 * x3 + 4 ^ 5 * x4 + 5 ^ 5 * x5, a ^ 3}\n [eqc] {x1 + 2 ^ 3 * x2 + 3 ^ 3 * x3 + 4 ^ 3 * x4 + 5 ^ 3 * x5, a ^ 2}\n [eqc] {x1 + 2 * x2 + 3 * x3 + 4 * x4 + 5 * x5, a}\n [eqc] {(a - 1) ^ 2 * x1 + 2 * (a - 4) ^ 2 * x2 + 3 * (a - 9) ^ 2 * x3 + 4 * (a - 16) ^ 2 * x4 +\n 5 * (a - 25) ^ 2 * x5,\n 0}\n [cutsat] Assignment satisfying linear constraints\n [assign] 0 := 0\n [assign] 1 := 1\n [assign] 2 := 2\n [assign] 3 := 3\n [assign] 4 := 4\n [assign] 5 := 5\n [assign] 9 := 9\n [assign] 16 := 16\n [assign] 25 := 25\n [ring] Ring `\u211d`\n [basis] Basis\n [_] x1 + 2 * x2 + 3 * x3 + 4 * x4 + 5 * x5 + -1 * a = 0\n [_] 36 * x2 ^ 2 + 288 * (x2 * x3) + 576 * x3 ^ 2 + 720 * (x2 * x4) + 2880 * (x3 * x4) + 3600 * x4 ^ 2 +\n 1440 * (x2 * x5) +\n 5760 * (x3 * x5) +\n 14400 * (x4 * x5) +\n 14400 * x5 ^ 2 +\n -120 * (x3 * a) +\n -720 * (x4 * a) +\n -2520 * (x5 * a) +\n -72 * x2 +\n -648 * x3 +\n -2880 * x4 +\n -9000 * x5 =\n 0\n [_] 6 * (x2 * a) + 24 * (x3 * a) + 60 * (x4 * a) + 120 * (x5 * a) + -24 * x2 + -216 * x3 + -960 * x4 +\n -3000 * x5 =\n 0\n [_] a ^ 2 + -6 * x2 + -24 * x3 + -60 * x4 + -120 * x5 + -1 * a = 0\n [diseqs] Disequalities\n [_] \u00ac-12 * x2 ^ 2 + -66 * (x2 * x3) + -72 * x3 ^ 2 + -144 * (x2 * x4) + -276 * (x3 * x4) + -240 * x4 ^ 2 +\n -270 * (x2 * x5) +\n -480 * (x3 * x5) +\n -780 * (x4 * x5) +\n -600 * x5 ^ 2 +\n 8 * (x2 * a) +\n 27 * (x3 * a) +\n 64 * (x4 * a) +\n 125 * (x5 * a) +\n -8 * x2 +\n -27 * x3 +\n -64 * x4 +\n -125 * x5 =\n 0", "`grind` failed\ncase grind\na x1 x2 x3 x4 x5 : \u211d\nhx1 : 0 \u2264 x1\nhx2 : 0 \u2264 x2\nhx3 : 0 \u2264 x3\nhx4 : 0 \u2264 x4\nhx5 : 0 \u2264 x5\nh\u2081 : x1 + 2 * x2 + 3 * x3 + 4 * x4 + 5 * x5 = a\nh\u2082 : x1 + 2 ^ 3 * x2 + 3 ^ 3 * x3 + 4 ^ 3 * x4 + 5 ^ 3 * x5 = a ^ 2\nh\u2083 : x1 + 2 ^ 5 * x2 + 3 ^ 5 * x3 + 4 ^ 5 * x4 + 5 ^ 5 * x5 = a ^ 3\nh\u2080 : (a - 1) ^ 2 * x1 + 2 * (a - 4) ^ 2 * x2 + 3 * (a - 9) ^ 2 * x3 + 4 * (a - 16) ^ 2 * x4 + 5 * (a - 25) ^ 2 * x5 = 0\nt1 : 0 \u2264 (a - 1) ^ 2 * x1\nt2 : 0 \u2264 2 * (a - 4) ^ 2 * x2\nt3 : 0 \u2264 3 * (a - 9) ^ 2 * x3\nt4 : 0 \u2264 4 * (a - 16) ^ 2 * x4\nt5 : 0 \u2264 5 * (a - 25) ^ 2 * x5\nh1 : (a + -1) ^ 2 * x1 = 0\nh : \u00ac(a + -4) ^ 2 * x2 = 0\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] 0 \u2264 x1\n [prop] 0 \u2264 x2\n [prop] 0 \u2264 x3\n [prop] 0 \u2264 x4\n [prop] 0 \u2264 x5\n [prop] x1 + 2 * x2 + 3 * x3 + 4 * x4 + 5 * x5 = a\n [prop] x1 + 2 ^ 3 * x2 + 3 ^ 3 * x3 + 4 ^ 3 * x4 + 5 ^ 3 * x5 = a ^ 2\n [prop] x1 + 2 ^ 5 * x2 + 3 ^ 5 * x3 + 4 ^ 5 * x4 + 5 ^ 5 * x5 = a ^ 3\n [prop] (a - 1) ^ 2 * x1 + 2 * (a - 4) ^ 2 * x2 + 3 * (a - 9) ^ 2 * x3 + 4 * (a - 16) ^ 2 * x4 +\n 5 * (a - 25) ^ 2 * x5 =\n 0\n [prop] 0 \u2264 (a - 1) ^ 2 * x1\n [prop] 0 \u2264 2 * (a - 4) ^ 2 * x2\n [prop] 0 \u2264 3 * (a - 9) ^ 2 * x3\n [prop] 0 \u2264 4 * (a - 16) ^ 2 * x4\n [prop] 0 \u2264 5 * (a - 25) ^ 2 * x5\n [prop] (a + -1) ^ 2 * x1 = 0\n [prop] \u00ac(a + -4) ^ 2 * x2 = 0\n [eqc] True propositions\n [prop] 0 \u2264 x1\n [prop] 0 \u2264 x2\n [prop] 0 \u2264 x3\n [prop] 0 \u2264 x4\n [prop] 0 \u2264 x5\n [prop] (3 + 2).AtLeastTwo\n [prop] (2 + 2).AtLeastTwo\n [prop] (1 + 2).AtLeastTwo\n [prop] (0 + 2).AtLeastTwo\n [prop] (23 + 2).AtLeastTwo\n [prop] (14 + 2).AtLeastTwo\n [prop] (7 + 2).AtLeastTwo\n [prop] 0 \u2264 (a - 1) ^ 2 * x1\n [prop] 0 \u2264 2 * (a - 4) ^ 2 * x2\n [prop] 0 \u2264 3 * (a - 9) ^ 2 * x3\n [prop] 0 \u2264 4 * (a - 16) ^ 2 * x4\n [prop] 0 \u2264 5 * (a - 25) ^ 2 * x5\n [eqc] False propositions\n [prop] (a + -4) ^ 2 * x2 = 0\n [eqc] Equivalence classes\n [eqc] {x1 + 2 ^ 5 * x2 + 3 ^ 5 * x3 + 4 ^ 5 * x4 + 5 ^ 5 * x5, a ^ 3}\n [eqc] {x1 + 2 ^ 3 * x2 + 3 ^ 3 * x3 + 4 ^ 3 * x4 + 5 ^ 3 * x5, a ^ 2}\n [eqc] {x1 + 2 * x2 + 3 * x3 + 4 * x4 + 5 * x5, a}\n [eqc] {(a - 1) ^ 2 * x1 + 2 * (a - 4) ^ 2 * x2 + 3 * (a - 9) ^ 2 * x3 + 4 * (a - 16) ^ 2 * x4 +\n 5 * (a - 25) ^ 2 * x5,\n (a + -1) ^ 2 * x1,\n 0}\n [cutsat] Assignment satisfying linear constraints\n [assign] 0 := 0\n [assign] 1 := 1\n [assign] 2 := 2\n [assign] 3 := 3\n [assign] 4 := 4\n [assign] 5 := 5\n [assign] 9 := 9\n [assign] 16 := 16\n [assign] 25 := 25\n [ring] Ring `\u211d`\n [basis] Basis\n [_] x1 + 2 * x2 + 3 * x3 + 4 * x4 + 5 * x5 + -1 * a = 0\n [_] 180 * x2 ^ 2 + -2880 * x3 ^ 2 + -1008 * (x2 * x4) + -18432 * (x3 * x4) + -28080 * x4 ^ 2 + -2880 * (x2 * x5) +\n -40320 * (x3 * x5) +\n -120960 * (x4 * x5) +\n -129600 * x5 ^ 2 +\n 1560 * (x3 * a) +\n 8688 * (x4 * a) +\n 29400 * (x5 * a) +\n -360 * x2 +\n -5400 * x3 +\n -26688 * x4 +\n -87000 * x5 =\n 0\n [_] 90 * (x2 * x3) + 360 * x3 ^ 2 + 288 * (x2 * x4) + 2052 * (x3 * x4) + 2880 * x4 ^ 2 + 630 * (x2 * x5) +\n 4320 * (x3 * x5) +\n 12060 * (x4 * x5) +\n 12600 * x5 ^ 2 +\n -135 * (x3 * a) +\n -768 * (x4 * a) +\n -2625 * (x5 * a) +\n 135 * x3 +\n 768 * x4 +\n 2625 * x5 =\n 0\n [_] 6 * (x2 * a) + 24 * (x3 * a) + 60 * (x4 * a) + 120 * (x5 * a) + -24 * x2 + -216 * x3 + -960 * x4 +\n -3000 * x5 =\n 0\n [_] 1800 * x3 ^ 2 + -2016 * (x2 * x4) + 8496 * (x3 * x4) + 14400 * x4 ^ 2 + -10080 * (x2 * x5) +\n 10080 * (x3 * x5) +\n 55440 * (x4 * x5) +\n 63000 * x5 ^ 2 +\n -675 * (x3 * a) +\n -3840 * (x4 * a) +\n -13125 * (x5 * a) +\n 675 * x3 +\n 3840 * x4 +\n 13125 * x5 =\n 0\n [_] a ^ 2 + -6 * x2 + -24 * x3 + -60 * x4 + -120 * x5 + -1 * a = 0\n [diseqs] Disequalities\n [_] \u00ac6 * x2 ^ 2 + 24 * (x2 * x3) + 60 * (x2 * x4) + 120 * (x2 * x5) + -7 * (x2 * a) + 16 * x2 = 0", "`grind` failed\ncase grind\na x1 x2 x3 x4 x5 : \u211d\nhx1 : 0 \u2264 x1\nhx2 : 0 \u2264 x2\nhx3 : 0 \u2264 x3\nhx4 : 0 \u2264 x4\nhx5 : 0 \u2264 x5\nh\u2081 : x1 + 2 * x2 + 3 * x3 + 4 * x4 + 5 * x5 = a\nh\u2082 : x1 + 2 ^ 3 * x2 + 3 ^ 3 * x3 + 4 ^ 3 * x4 + 5 ^ 3 * x5 = a ^ 2\nh\u2083 : x1 + 2 ^ 5 * x2 + 3 ^ 5 * x3 + 4 ^ 5 * x4 + 5 ^ 5 * x5 = a ^ 3\nh\u2080 : (a - 1) ^ 2 * x1 + 2 * (a - 4) ^ 2 * x2 + 3 * (a - 9) ^ 2 * x3 + 4 * (a - 16) ^ 2 * x4 + 5 * (a - 25) ^ 2 * x5 = 0\nt1 : 0 \u2264 (a - 1) ^ 2 * x1\nt2 : 0 \u2264 2 * (a - 4) ^ 2 * x2\nt3 : 0 \u2264 3 * (a - 9) ^ 2 * x3\nt4 : 0 \u2264 4 * (a - 16) ^ 2 * x4\nt5 : 0 \u2264 5 * (a - 25) ^ 2 * x5\nh1 : (a + -1) ^ 2 * x1 = 0\nh2 : (a + -4) ^ 2 * x2 = 0\nh : \u00ac(a + -9) ^ 2 * x3 = 0\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] 0 \u2264 x1\n [prop] 0 \u2264 x2\n [prop] 0 \u2264 x3\n [prop] 0 \u2264 x4\n [prop] 0 \u2264 x5\n [prop] x1 + 2 * x2 + 3 * x3 + 4 * x4 + 5 * x5 = a\n [prop] x1 + 2 ^ 3 * x2 + 3 ^ 3 * x3 + 4 ^ 3 * x4 + 5 ^ 3 * x5 = a ^ 2\n [prop] x1 + 2 ^ 5 * x2 + 3 ^ 5 * x3 + 4 ^ 5 * x4 + 5 ^ 5 * x5 = a ^ 3\n [prop] (a - 1) ^ 2 * x1 + 2 * (a - 4) ^ 2 * x2 + 3 * (a - 9) ^ 2 * x3 + 4 * (a - 16) ^ 2 * x4 +\n 5 * (a - 25) ^ 2 * x5 =\n 0\n [prop] 0 \u2264 (a - 1) ^ 2 * x1\n [prop] 0 \u2264 2 * (a - 4) ^ 2 * x2\n [prop] 0 \u2264 3 * (a - 9) ^ 2 * x3\n [prop] 0 \u2264 4 * (a - 16) ^ 2 * x4\n [prop] 0 \u2264 5 * (a - 25) ^ 2 * x5\n [prop] (a + -1) ^ 2 * x1 = 0\n [prop] (a + -4) ^ 2 * x2 = 0\n [prop] \u00ac(a + -9) ^ 2 * x3 = 0\n [eqc] True propositions\n [prop] 0 \u2264 x1\n [prop] 0 \u2264 x2\n [prop] 0 \u2264 x3\n [prop] 0 \u2264 x4\n [prop] 0 \u2264 x5\n [prop] (3 + 2).AtLeastTwo\n [prop] (2 + 2).AtLeastTwo\n [prop] (1 + 2).AtLeastTwo\n [prop] (0 + 2).AtLeastTwo\n [prop] (23 + 2).AtLeastTwo\n [prop] (14 + 2).AtLeastTwo\n [prop] (7 + 2).AtLeastTwo\n [prop] 0 \u2264 (a - 1) ^ 2 * x1\n [prop] 0 \u2264 2 * (a - 4) ^ 2 * x2\n [prop] 0 \u2264 3 * (a - 9) ^ 2 * x3\n [prop] 0 \u2264 4 * (a - 16) ^ 2 * x4\n [prop] 0 \u2264 5 * (a - 25) ^ 2 * x5\n [eqc] False propositions\n [prop] (a + -9) ^ 2 * x3 = 0\n [eqc] Equivalence classes\n [eqc] {x1 + 2 ^ 5 * x2 + 3 ^ 5 * x3 + 4 ^ 5 * x4 + 5 ^ 5 * x5, a ^ 3}\n [eqc] {x1 + 2 ^ 3 * x2 + 3 ^ 3 * x3 + 4 ^ 3 * x4 + 5 ^ 3 * x5, a ^ 2}\n [eqc] {x1 + 2 * x2 + 3 * x3 + 4 * x4 + 5 * x5, a}\n [eqc] {(a - 1) ^ 2 * x1 + 2 * (a - 4) ^ 2 * x2 + 3 * (a - 9) ^ 2 * x3 + 4 * (a - 16) ^ 2 * x4 +\n 5 * (a - 25) ^ 2 * x5,\n (a + -1) ^ 2 * x1,\n (a + -4) ^ 2 * x2,\n 0}\n [cutsat] Assignment satisfying linear constraints\n [assign] 0 := 0\n [assign] 1 := 1\n [assign] 2 := 2\n [assign] 3 := 3\n [assign] 4 := 4\n [assign] 5 := 5\n [assign] 9 := 9\n [assign] 16 := 16\n [assign] 25 := 25\n [ring] Ring `\u211d`\n [basis] Basis\n [_] x1 + 2 * x2 + 3 * x3 + 4 * x4 + 5 * x5 + -1 * a = 0\n [_] 180 * x2 ^ 2 + -2880 * x3 ^ 2 + -14400 * (x3 * x4) + -18000 * x4 ^ 2 + -28800 * (x3 * x5) +\n -72000 * (x4 * x5) +\n -72000 * x5 ^ 2 +\n 2280 * (x3 * a) +\n 7800 * (x4 * a) +\n 21000 * (x5 * a) +\n -360 * x2 +\n -11880 * x3 +\n -52800 * x4 +\n -165000 * x5 =\n 0\n [_] 90 * (x2 * x3) + 360 * x3 ^ 2 + 288 * (x2 * x4) + 2052 * (x3 * x4) + 2880 * x4 ^ 2 + 630 * (x2 * x5) +\n 4320 * (x3 * x5) +\n 12060 * (x4 * x5) +\n 12600 * x5 ^ 2 +\n -135 * (x3 * a) +\n -768 * (x4 * a) +\n -2625 * (x5 * a) +\n 135 * x3 +\n 768 * x4 +\n 2625 * x5 =\n 0\n [_] 504 * (x2 * x4) + 2016 * (x3 * x4) + 5040 * x4 ^ 2 + 1440 * (x2 * x5) + 5760 * (x3 * x5) + 24480 * (x4 * x5) +\n 28800 * x5 ^ 2 +\n 360 * (x3 * a) +\n -444 * (x4 * a) +\n -4200 * (x5 * a) +\n -3240 * x3 +\n -13056 * x4 +\n -39000 * x5 =\n 0\n [_] 6 * (x2 * a) + 24 * (x3 * a) + 60 * (x4 * a) + 120 * (x5 * a) + -24 * x2 + -216 * x3 + -960 * x4 +\n -3000 * x5 =\n 0\n [_] 12600 * x3 ^ 2 + 75600 * (x3 * x4) + 21600 * (x2 * x5) + 324000 * (x3 * x5) + 54000 * (x4 * x5) +\n -135000 * x5 ^ 2 +\n -17685 * (x3 * a) +\n -32400 * (x4 * a) +\n -36675 * (x5 * a) +\n 121365 * x3 +\n 518400 * x4 +\n 1591875 * x5 =\n 0\n [_] 10080 * (x3 * x4) + 60480 * x4 ^ 2 + -12960 * (x2 * x5) + -23040 * (x3 * x5) + 254880 * (x4 * x5) +\n 345600 * x5 ^ 2 +\n 5760 * (x3 * a) +\n -1728 * (x4 * a) +\n -43200 * (x5 * a) +\n -51840 * x3 +\n -214272 * x4 +\n -648000 * x5 =\n 0\n [_] 8890560 * x4 ^ 2 + -1905120 * (x2 * x5) + -13063680 * (x3 * x5) + 33384960 * (x4 * x5) + 50803200 * x5 ^ 2 +\n 846720 * (x3 * a) +\n -254016 * (x4 * a) +\n -6350400 * (x5 * a) +\n -7620480 * x3 +\n -31497984 * x4 +\n -95256000 * x5 =\n 0\n [_] a ^ 2 + -6 * x2 + -24 * x3 + -60 * x4 + -120 * x5 + -1 * a = 0\n [diseqs] Disequalities\n [_] \u00ac6 * (x2 * x3) + 24 * x3 ^ 2 + 60 * (x3 * x4) + 120 * (x3 * x5) + -17 * (x3 * a) + 81 * x3 = 0", "`grind` failed\ncase grind\na x1 x2 x3 x4 x5 : \u211d\nhx1 : 0 \u2264 x1\nhx2 : 0 \u2264 x2\nhx3 : 0 \u2264 x3\nhx4 : 0 \u2264 x4\nhx5 : 0 \u2264 x5\nh\u2081 : x1 + 2 * x2 + 3 * x3 + 4 * x4 + 5 * x5 = a\nh\u2082 : x1 + 2 ^ 3 * x2 + 3 ^ 3 * x3 + 4 ^ 3 * x4 + 5 ^ 3 * x5 = a ^ 2\nh\u2083 : x1 + 2 ^ 5 * x2 + 3 ^ 5 * x3 + 4 ^ 5 * x4 + 5 ^ 5 * x5 = a ^ 3\nh\u2080 : (a - 1) ^ 2 * x1 + 2 * (a - 4) ^ 2 * x2 + 3 * (a - 9) ^ 2 * x3 + 4 * (a - 16) ^ 2 * x4 + 5 * (a - 25) ^ 2 * x5 = 0\nt1 : 0 \u2264 (a - 1) ^ 2 * x1\nt2 : 0 \u2264 2 * (a - 4) ^ 2 * x2\nt3 : 0 \u2264 3 * (a - 9) ^ 2 * x3\nt4 : 0 \u2264 4 * (a - 16) ^ 2 * x4\nt5 : 0 \u2264 5 * (a - 25) ^ 2 * x5\nh1 : (a + -1) ^ 2 * x1 = 0\nh2 : (a + -4) ^ 2 * x2 = 0\nh3 : (a + -9) ^ 2 * x3 = 0\nh1_1 : (a + -1) ^ 2 * x1 = 0\nh2_1 : (a + -4) ^ 2 * x2 = 0\nh3_1 : (a + -9) ^ 2 * x3 = 0\nh4 : (a + -16) ^ 2 * x4 = 0\nh : a \u2209 {0, 1, 4, 9, 16, 25}\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] 0 \u2264 x1\n [prop] 0 \u2264 x2\n [prop] 0 \u2264 x3\n [prop] 0 \u2264 x4\n [prop] 0 \u2264 x5\n [prop] x1 + 2 * x2 + 3 * x3 + 4 * x4 + 5 * x5 = a\n [prop] x1 + 2 ^ 3 * x2 + 3 ^ 3 * x3 + 4 ^ 3 * x4 + 5 ^ 3 * x5 = a ^ 2\n [prop] x1 + 2 ^ 5 * x2 + 3 ^ 5 * x3 + 4 ^ 5 * x4 + 5 ^ 5 * x5 = a ^ 3\n [prop] (a - 1) ^ 2 * x1 + 2 * (a - 4) ^ 2 * x2 + 3 * (a - 9) ^ 2 * x3 + 4 * (a - 16) ^ 2 * x4 +\n 5 * (a - 25) ^ 2 * x5 =\n 0\n [prop] 0 \u2264 (a - 1) ^ 2 * x1\n [prop] 0 \u2264 2 * (a - 4) ^ 2 * x2\n [prop] 0 \u2264 3 * (a - 9) ^ 2 * x3\n [prop] 0 \u2264 4 * (a - 16) ^ 2 * x4\n [prop] 0 \u2264 5 * (a - 25) ^ 2 * x5\n [prop] (a + -1) ^ 2 * x1 = 0\n [prop] (a + -4) ^ 2 * x2 = 0\n [prop] (a + -9) ^ 2 * x3 = 0\n [prop] (a + -1) ^ 2 * x1 = 0\n [prop] (a + -4) ^ 2 * x2 = 0\n [prop] (a + -9) ^ 2 * x3 = 0\n [prop] (a + -16) ^ 2 * x4 = 0\n [prop] a \u2209 {0, 1, 4, 9, 16, 25}\n [eqc] True propositions\n [prop] 0 \u2264 x1\n [prop] 0 \u2264 x2\n [prop] 0 \u2264 x3\n [prop] 0 \u2264 x4\n [prop] 0 \u2264 x5\n [prop] (3 + 2).AtLeastTwo\n [prop] (2 + 2).AtLeastTwo\n [prop] (1 + 2).AtLeastTwo\n [prop] (0 + 2).AtLeastTwo\n [prop] (23 + 2).AtLeastTwo\n [prop] (14 + 2).AtLeastTwo\n [prop] (7 + 2).AtLeastTwo\n [prop] 0 \u2264 (a - 1) ^ 2 * x1\n [prop] 0 \u2264 2 * (a - 4) ^ 2 * x2\n [prop] 0 \u2264 3 * (a - 9) ^ 2 * x3\n [prop] 0 \u2264 4 * (a - 16) ^ 2 * x4\n [prop] 0 \u2264 5 * (a - 25) ^ 2 * x5\n [eqc] False propositions\n [prop] a \u2208 {0, 1, 4, 9, 16, 25}\n [eqc] Equivalence classes\n [eqc] {x1 + 2 ^ 5 * x2 + 3 ^ 5 * x3 + 4 ^ 5 * x4 + 5 ^ 5 * x5, a ^ 3}\n [eqc] {x1 + 2 ^ 3 * x2 + 3 ^ 3 * x3 + 4 ^ 3 * x4 + 5 ^ 3 * x5, a ^ 2}\n [eqc] {x1 + 2 * x2 + 3 * x3 + 4 * x4 + 5 * x5, a}\n [eqc] {(a - 1) ^ 2 * x1 + 2 * (a - 4) ^ 2 * x2 + 3 * (a - 9) ^ 2 * x3 + 4 * (a - 16) ^ 2 * x4 +\n 5 * (a - 25) ^ 2 * x5,\n (a + -1) ^ 2 * x1,\n (a + -4) ^ 2 * x2,\n (a + -9) ^ 2 * x3,\n (a + -16) ^ 2 * x4,\n 0}\n [ematch] E-matching patterns\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [cutsat] Assignment satisfying linear constraints\n [assign] 0 := 0\n [assign] 1 := 1\n [assign] 2 := 2\n [assign] 3 := 3\n [assign] 4 := 4\n [assign] 5 := 5\n [assign] 9 := 9\n [assign] 16 := 16\n [assign] 25 := 25\n [ring] Ring `\u211d`\n [basis] Basis\n [_] x1 + 2 * x2 + 3 * x3 + 4 * x4 + 5 * x5 + -1 * a = 0\n [_] 6300 * x2 ^ 2 + -100800 * x3 ^ 2 + -504000 * (x3 * x4) + -630000 * x4 ^ 2 + -1008000 * (x3 * x5) +\n -2520000 * (x4 * x5) +\n -2520000 * x5 ^ 2 +\n -382200 * (x4 * a) +\n -2352000 * (x5 * a) +\n -12600 * x2 +\n 302400 * x3 +\n 8635200 * x4 +\n 71400000 * x5 =\n 0\n [_] 90 * (x2 * x3) + 360 * x3 ^ 2 + 288 * (x2 * x4) + 2052 * (x3 * x4) + 2880 * x4 ^ 2 + 630 * (x2 * x5) +\n 4320 * (x3 * x5) +\n 12060 * (x4 * x5) +\n 12600 * x5 ^ 2 +\n -135 * (x3 * a) +\n -768 * (x4 * a) +\n -2625 * (x5 * a) +\n 135 * x3 +\n 768 * x4 +\n 2625 * x5 =\n 0\n [_] 504 * (x2 * x4) + 2016 * (x3 * x4) + 5040 * x4 ^ 2 + 1440 * (x2 * x5) + 5760 * (x3 * x5) + 24480 * (x4 * x5) +\n 28800 * x5 ^ 2 +\n 360 * (x3 * a) +\n -444 * (x4 * a) +\n -4200 * (x5 * a) +\n -3240 * x3 +\n -13056 * x4 +\n -39000 * x5 =\n 0\n [_] 1350 * (x2 * x5) + 5400 * (x3 * x5) + 13500 * (x4 * x5) + 27000 * x5 ^ 2 + 600 * (x3 * a) + 3600 * (x4 * a) +\n 1575 * (x5 * a) +\n -5400 * x3 +\n -57600 * x4 +\n -174375 * x5 =\n 0\n [_] 6 * (x2 * a) + 24 * (x3 * a) + 60 * (x4 * a) + 120 * (x5 * a) + -24 * x2 + -216 * x3 + -960 * x4 +\n -3000 * x5 =\n 0\n [_] 504000 * x3 ^ 2 + 3024000 * (x3 * x4) + 10584000 * (x3 * x5) + 6955200 * (x4 * a) + 37837800 * (x5 * a) +\n -1512000 * x3 +\n -111283200 * x4 +\n -945945000 * x5 =\n 0\n [_] 151200 * (x3 * x4) + 907200 * x4 ^ 2 + 3175200 * (x4 * x5) + -771120 * (x4 * a) + 8709120 * x4 = 0\n [_] 189000 * (x3 * x5) + 1134000 * (x4 * x5) + 3969000 * x5 ^ 2 + -2565675 * (x5 * a) + 44296875 * x5 = 0\n [_] 4200 * (x3 * a) + 25200 * (x4 * a) + 88200 * (x5 * a) + -37800 * x3 + -403200 * x4 + -2205000 * x5 = 0\n [_] 54010152000 * x4 ^ 2 + 510984936000 * (x4 * x5) + -88905600000 * x5 ^ 2 + 673821892800 * (x5 * a) +\n -216040608000 * x4 +\n -16401019320000 * x5 =\n 0\n [_] 3937248000 * (x4 * x5) + 40642560000 * x5 ^ 2 + -38363673600 * (x5 * a) + 755879040000 * x5 = 0\n [_] 176400 * (x4 * a) + 1411200 * (x5 * a) + -2822400 * x4 + -35280000 * x5 = 0\n [_] 70304807688030720000 * x5 ^ 2 + -75465877862219040000 * (x5 * a) + 1535122908115322400000 * x5 = 0\n [_] 1172640644729414816256000 * (x5 * a) + -29316016118235370406400000 * x5 = 0\n [_] a ^ 2 + -6 * x2 + -24 * x3 + -60 * x4 + -120 * x5 + -1 * a = 0\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n {0, 1, 4, 9, 16, 25}\n has type\n Set \u211d : Type\n but is expected to have type\n Std.ExtDHashMap \u211d ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n {0, 1, 4, 9, 16, 25}\n has type\n Set \u211d : Type\n but is expected to have type\n Std.DHashMap \u211d ?\u03b2 : Type"], "timeout_s": 600.0, "latency_s": 2.2811, "verified_at": "2026-03-26T18:16:45.834783+00:00"}} | false | true | false | 2.2811 |
compfiles_Imo1979P6 | compfiles | Copyright (c) 2026 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1979, Problem 6
Let $A$ and $E$ be opposite vertices of an octagon.
A frog starts at vertex $A.$ From any vertex except $E$ it jumps to one of the two adjacent vertices.
When it reaches $E$ it stops. Let $a_n$ be the number of distinct paths of exactly $n$ jumps ending at $E$.
Prove that: \[a_{2n-1}=0, \quad a_{2n}={(2+\sqrt2)^{n-1} - (2-\sqrt2)^{n-1} \over\sqrt2}.\]
-/
namespace Imo1979P6
open SimpleGraph
abbrev Octagon := cycleGraph 8
abbrev A : Fin 8 := 0
abbrev E : Fin 8 := 4
def isTerminalWalk {V : Type} {G : SimpleGraph V} {u v : V} (w : G.Walk u v) := v ∉ w.support.dropLast
noncomputable def a (n : ℕ) := Set.ncard {w : Octagon.Walk A E | isTerminalWalk w ∧ w.length = n}
instance instFintypeAnd {α : Type} [DecidableEq α] (p q : α → Prop) [inst : Fintype (Subtype p)] [DecidablePred q] : Fintype (Subtype (fun x => q x ∧ p x)) := {
elems := (inst.elems.filter (fun x => q x.val)).attach.image (fun x => ⟨x.val.val, by grind⟩)
complete := by
simp only [Finset.mem_image, Finset.mem_attach, true_and, Subtype.exists, Finset.mem_filter,
Subtype.forall, Subtype.mk.injEq, exists_prop, exists_and_right, exists_eq_right, and_imp]
intro a h1 h2
and_intros
· use h2
apply Fintype.complete
· exact h1
}
instance Set.instFintypeElemOfSubtype {α : Type} (p: α → Prop) [inst : Fintype {x // p x}] : Fintype ({x | p x}) := {
elems := inst.elems
complete := by
simp only [Set.coe_setOf, Subtype.forall]
intro a h
apply Fintype.complete
}
@[simp]
theorem Walk.append_getVert {V : Type} {G : SimpleGraph V} {u v w : V}
(w1 : G.Walk u v) (w2 : G.Walk v w) : (w1.append w2).getVert w1.length = v
:= by simp [Walk.getVert_append]
@[simp]
theorem Walk.take_append {V : Type} {G : SimpleGraph V} {u v w : V}
(w1 : G.Walk u v) (w2 : G.Walk v w) :
(w1.append w2).take w1.length = w1.copy rfl (by simp) := by
apply Walk.ext_support
rw [Walk.take_support_eq_support_take_succ, Walk.support_append]
simp
@[simp]
theorem Walk.drop_append_of_length_eq {V : Type} {G : SimpleGraph V} {u v w : V}
(w1 : G.Walk u v) (w2 : G.Walk v w) :
(w1.append w2).drop w1.length = w2.copy (by simp) rfl := by
apply Walk.ext_support
rw [Walk.drop_support_eq_support_drop_min, Walk.support_append_eq_support_dropLast_append]
simp
theorem isTerminalWalk_copy {V : Type} {G : SimpleGraph V} {u v u' v' : V} (h1 : u = u') (h2 : v = v') (w : G.Walk u v) : isTerminalWalk w → isTerminalWalk (w.copy h1 h2) := by
unfold isTerminalWalk
intro h
simp [<-h2, h]
theorem isTerminalWalk_map {V V' : Type} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G ↪g G') {u v : V} (w : G.Walk u v) :
isTerminalWalk w → isTerminalWalk (w.map f.toHom) := by
unfold isTerminalWalk
intro h
simp
contrapose! h
rw [List.dropLast_eq_take, List.mem_take_iff_getElem] at h ⊢
simp only [List.getElem_map, EmbeddingLike.apply_eq_iff_eq] at h
grind only [= List.length_map]
theorem isTerminalWalk_of_isSubwalk {V : Type} {G : SimpleGraph V} {u u' t : V} {w : G.Walk u t} {w' : G.Walk u' t} (htw : isTerminalWalk w) (hsub : w'.IsSubwalk w)
: isTerminalWalk w' := by
unfold isTerminalWalk at htw ⊢
rw [Walk.isSubwalk_iff_support_isInfix, List.IsInfix] at hsub
let ⟨ru, rv, h⟩ := hsub
rw [<-h, List.append_assoc, List.dropLast_append_of_ne_nil (by simp), List.dropLast_append] at htw
contrapose! htw
split_ifs with h
· exact List.mem_append_right ru htw
· apply List.mem_append_right
apply List.mem_append_left
exact Walk.end_mem_support w'
instance instDecidableIsTerminalWalk {V : Type} [DecidableEq V] {G : SimpleGraph V} {u v : V} : DecidablePred (fun (w : G.Walk u v) => isTerminalWalk w) := fun w => by
unfold isTerminalWalk
use inferInstance
abbrev C : Fin 8 := 2
abbrev G : Fin 8 := 6
noncomputable def b (n : ℕ) := Set.ncard {w : Octagon.Walk C E | isTerminalWalk w ∧ w.length = n}
def Octagon.mirror : Octagon ≃g Octagon := {
toFun x := -x
invFun x := -x
map_rel_iff' := by
intro a b
rw [Equiv.coe_fn_mk, Octagon, cycleGraph_adj', cycleGraph_adj']
grind only [= Fin.val_sub]
left_inv := by simp [Function.LeftInverse.eq_1]
right_inv := by simp [Function.RightInverse.eq_1, Function.LeftInverse.eq_1]
}
def C_G_symm (n : ℕ) : {w : Octagon.Walk C E // isTerminalWalk w ∧ w.length = n} ≃ {w : Octagon.Walk G E // isTerminalWalk w ∧ w.length = n} := {
toFun := fun ⟨w, h⟩ => ⟨(w.map Octagon.mirror.toHom).copy (by decide) (by decide), by {
and_intros
· apply isTerminalWalk_copy
apply isTerminalWalk_map
exact h.left
·
simp [h.right]
}⟩
invFun := fun ⟨w, h⟩ => ⟨(w.map Octagon.mirror.toHom).copy (by decide) (by decide), by {
and_intros
· apply isTerminalWalk_copy
apply isTerminalWalk_map
exact h.left
·
simp [h.right]
}⟩
left_inv := fun ⟨w, h⟩ => by
simp only [RelEmbedding.coe_toRelHom, RelIso.coe_toRelEmbedding, Walk.copy_rfl_rfl,
Walk.map_map, Subtype.mk.injEq]
apply Walk.ext_support
unfold Octagon.mirror
simp
right_inv := fun ⟨w, h⟩ => by
simp only [RelEmbedding.coe_toRelHom, RelIso.coe_toRelEmbedding, Walk.copy_rfl_rfl,
Walk.map_map, Subtype.mk.injEq]
apply Walk.ext_support
unfold Octagon.mirror
simp
}
def isTerminalWalk_length_cons_equiv {V : Type} {G : SimpleGraph V} {u t : V} (m n : ℕ) (npos : 0 < n) :
{w : G.Walk u t // isTerminalWalk w ∧ w.length = m+n} ≃ Σ (v:V), {w : G.Walk u v // t ∉ w.support ∧ w.length = m} × {w : G.Walk v t // isTerminalWalk w ∧ w.length = n}
:= {
toFun := fun ⟨w, h⟩ => ⟨w.getVert m, ⟨w.take m, by {
and_intros
· unfold isTerminalWalk at h
rw [Walk.take_support_eq_support_take_succ]
rw [List.dropLast_eq_take] at h
have : m+1 ≤ w.support.length - 1 := by
rw [Walk.length_support]
omega
have := List.take_subset_take_left w.support this
grind only [= List.subset_def]
· simp [h.right]
}⟩, ⟨w.drop m, by {
and_intros
· apply isTerminalWalk_of_isSubwalk h.left
exact Walk.isSubwalk_drop w m
· simp [h.right]
}⟩⟩
invFun := fun ⟨v, ⟨⟨w1, h1⟩, ⟨w2, h2⟩⟩⟩ => ⟨w1.append w2, by {
and_intros
· unfold isTerminalWalk at h2 ⊢
rw [Walk.support_append_eq_support_dropLast_append, List.dropLast_append_of_ne_nil (by simp), List.mem_append, not_or]
and_intros
· grind only [List.mem_of_mem_dropLast]
· exact h2.left
· simp [h1.right, h2.right]
}⟩
left_inv := fun ⟨w, h⟩ => by
simp
right_inv := fun ⟨v, ⟨⟨w1, h1, h1'⟩, ⟨w2, h2, h2'⟩⟩⟩ => by
subst m n
simp only [Walk.take_append, Walk.drop_append_of_length_eq, Sigma.mk.injEq,
Walk.append_getVert, true_and]
congr! 1
· rw [Walk.append_getVert]
· rw [Walk.append_getVert]
· congr! 1
· simp
· rw [Walk.append_getVert]
· simp [Walk.copy]
· congr! 1
· simp
· rw [Walk.append_getVert]
· simp [Walk.copy]
}
theorem a_b_recurrence_1 (n : ℕ) (npos : 0 < n) : a (n+2) = 2 * a n + 2 * b n := by
have walks_from_A (v) : Fintype.card { w : Octagon.Walk A v // E ∉ w.support ∧ w.length = 2 } =
match v with
| 0 => 2
| 2 => 1
| 6 => 1
| _ => 0
:= by
decide +revert
unfold a b
calc
_ = Fintype.card {w : Octagon.Walk A E // isTerminalWalk w ∧ w.length = 2 + n} := by
rw [Set.ncard_eq_toFinset_card', add_comm]
simp
_ = ∑ v ∈ {A,C,G}, Fintype.card {w : Octagon.Walk A v // E ∉ w.support ∧ w.length = 2} * Fintype.card {w : Octagon.Walk v E // isTerminalWalk w ∧ w.length = n} := by
rw [Fintype.card_eq.mpr (Nonempty.intro (isTerminalWalk_length_cons_equiv _ _ npos))]
rw [Fintype.card_sigma]
simp_rw [Fintype.card_prod]
rw [eq_comm, Finset.sum_subset]
· simp
· intro _ _ _
apply mul_eq_zero_of_left
decide +revert
_ = _ := by
repeat rw [Finset.sum_insert (by decide)]
rw [Finset.sum_singleton]
repeat rw [walks_from_A]
simp only [Set.ncard_eq_toFinset_card', Set.toFinset_card, Set.coe_setOf]
rw [<-Fintype.card_eq.mpr (Nonempty.intro (C_G_symm _))]
omega
theorem a_b_recurrence_2 (n : ℕ) (npos : 0 < n) : b (n+2) = a n + 2 * b n := by
have walks_from_C (v) : Fintype.card { w : Octagon.Walk C v // E ∉ w.support ∧ w.length = 2 } =
match v with
| 0 => 1
| 2 => 2
| _ => 0
:= by
decide +revert
unfold a b
calc
_ = Fintype.card {w : Octagon.Walk C E // isTerminalWalk w ∧ w.length = 2 + n} := by
rw [Set.ncard_eq_toFinset_card', add_comm]
simp
_ = ∑ v ∈ {A,C}, Fintype.card {w : Octagon.Walk C v // E ∉ w.support ∧ w.length = 2} * Fintype.card {w : Octagon.Walk v E // isTerminalWalk w ∧ w.length = n} := by
rw [Fintype.card_eq.mpr (Nonempty.intro (isTerminalWalk_length_cons_equiv _ _ npos))]
rw [Fintype.card_sigma]
simp_rw [Fintype.card_prod]
rw [eq_comm, Finset.sum_subset]
· simp
· intro _ _ _
apply mul_eq_zero_of_left
decide +revert
_ = _ := by
repeat rw [Finset.sum_insert (by decide)]
rw [Finset.sum_singleton]
repeat rw [walks_from_C]
simp only [Set.ncard_eq_toFinset_card', Set.toFinset_card, Set.coe_setOf]
omega
theorem a_even (n : ℕ) (npos : 0 < n) : a (2*n) = ((2+√2)^(n-1) - (2-√2)^(n-1)) / √2 := by
suffices a (2*n) = ((2+√2)^(n-1) - (2-√2)^(n-1)) / √2 ∧ b (2*n) = ((2+√2)^(n-1) + (2-√2)^(n-1)) / 2 by exact this.left
revert n
apply Nat.le_induction
· unfold a b
simp [Set.ncard_eq_toFinset_card']
decide
· intro n npos ih
rw [mul_add, mul_one]
rw [show n + 1 - 1 = (n - 1 + 1) by omega]
repeat rw [pow_succ]
and_intros
· rw [a_b_recurrence_1 _ (by omega)]
rw [Nat.cast_add, Nat.cast_mul, Nat.cast_mul, ih.left, ih.right]
field
· rw [a_b_recurrence_2 _ (by omega)]
rw [Nat.cast_add, Nat.cast_mul, ih.left, ih.right]
generalize (2+√2)^(n-1) = α, (2-√2)^(n-1) = β
simp only [Nat.cast_ofNat]
field_simp
rw [show 2 * (α - β + √2 * (α + β)) = √2 * (2+√2) * α + √2 * (2-√2) * β by grind]
field
theorem walk_even (w : Octagon.Walk A E) : Even w.length := by
let coloring := cycleGraph.bicoloring_of_even 8 (by simp [Nat.even_iff])
rw [coloring.even_length_iff_congr]
decide
theorem a_odd (n : ℕ) (npos : 0 < n) : a (2*n-1) = 0 := by
unfold a
rw [Set.ncard_eq_toFinset_card', Finset.card_eq_zero]
apply Finset.eq_empty_of_forall_notMem
intro w
have := walk_even w
grind only [= Nat.even_iff, = Set.mem_toFinset, usr Set.mem_setOf_eq]
theorem imo1979_p6 (n : ℕ) (npos : 0 < n) : a (2*n-1) = 0 ∧ a (2*n) = ((2+√2)^(n-1) - (2-√2)^(n-1)) / √2 := by
and_intros
· exact a_odd n npos
· exact a_even n npos
end Imo1979P6 | /- | /-
Copyright (c) 2026 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1979, Problem 6
Let $A$ and $E$ be opposite vertices of an octagon.
A frog starts at vertex $A.$ From any vertex except $E$ it jumps to one of the two adjacent vertices.
When it reaches $E$ it stops. Let $a_n$ be the number of distinct paths of exactly $n$ jumps ending at $E$.
Prove that: \[a_{2n-1}=0, \quad a_{2n}={(2+\sqrt2)^{n-1} - (2-\sqrt2)^{n-1} \over\sqrt2}.\]
-/
namespace Imo1979P6
open SimpleGraph
abbrev Octagon := cycleGraph 8
abbrev A : Fin 8 := 0
abbrev E : Fin 8 := 4
def isTerminalWalk {V : Type} {G : SimpleGraph V} {u v : V} (w : G.Walk u v) := v ∉ w.support.dropLast
noncomputable def a (n : ℕ) := Set.ncard {w : Octagon.Walk A E | isTerminalWalk w ∧ w.length = n}
instance instFintypeAnd {α : Type} [DecidableEq α] (p q : α → Prop) [inst : Fintype (Subtype p)] [DecidablePred q] : Fintype (Subtype (fun x => q x ∧ p x)) := {
elems := (inst.elems.filter (fun x => q x.val)).attach.image (fun x => ⟨x.val.val, by grind⟩)
complete := by
simp only [Finset.mem_image, Finset.mem_attach, true_and, Subtype.exists, Finset.mem_filter,
Subtype.forall, Subtype.mk.injEq, exists_prop, exists_and_right, exists_eq_right, and_imp]
intro a h1 h2
and_intros
· use h2
apply Fintype.complete
· exact h1
}
instance Set.instFintypeElemOfSubtype {α : Type} (p: α → Prop) [inst : Fintype {x // p x}] : Fintype ({x | p x}) := {
elems := inst.elems
complete := by
simp only [Set.coe_setOf, Subtype.forall]
intro a h
apply Fintype.complete
}
@[simp]
theorem Walk.append_getVert {V : Type} {G : SimpleGraph V} {u v w : V}
(w1 : G.Walk u v) (w2 : G.Walk v w) : (w1.append w2).getVert w1.length = v
:= by simp [Walk.getVert_append]
@[simp]
theorem Walk.take_append {V : Type} {G : SimpleGraph V} {u v w : V}
(w1 : G.Walk u v) (w2 : G.Walk v w) :
(w1.append w2).take w1.length = w1.copy rfl (by simp) := by
apply Walk.ext_support
rw [Walk.take_support_eq_support_take_succ, Walk.support_append]
simp
@[simp]
theorem Walk.drop_append_of_length_eq {V : Type} {G : SimpleGraph V} {u v w : V}
(w1 : G.Walk u v) (w2 : G.Walk v w) :
(w1.append w2).drop w1.length = w2.copy (by simp) rfl := by
apply Walk.ext_support
rw [Walk.drop_support_eq_support_drop_min, Walk.support_append_eq_support_dropLast_append]
simp
theorem isTerminalWalk_copy {V : Type} {G : SimpleGraph V} {u v u' v' : V} (h1 : u = u') (h2 : v = v') (w : G.Walk u v) : isTerminalWalk w → isTerminalWalk (w.copy h1 h2) := by
unfold isTerminalWalk
intro h
simp [<-h2, h]
theorem isTerminalWalk_map {V V' : Type} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G ↪g G') {u v : V} (w : G.Walk u v) :
isTerminalWalk w → isTerminalWalk (w.map f.toHom) := by
unfold isTerminalWalk
intro h
simp
contrapose! h
rw [List.dropLast_eq_take, List.mem_take_iff_getElem] at h ⊢
simp only [List.getElem_map, EmbeddingLike.apply_eq_iff_eq] at h
grind only [= List.length_map]
theorem isTerminalWalk_of_isSubwalk {V : Type} {G : SimpleGraph V} {u u' t : V} {w : G.Walk u t} {w' : G.Walk u' t} (htw : isTerminalWalk w) (hsub : w'.IsSubwalk w)
: isTerminalWalk w' := by
unfold isTerminalWalk at htw ⊢
rw [Walk.isSubwalk_iff_support_isInfix, List.IsInfix] at hsub
let ⟨ru, rv, h⟩ := hsub
rw [<-h, List.append_assoc, List.dropLast_append_of_ne_nil (by simp), List.dropLast_append] at htw
contrapose! htw
split_ifs with h
· exact List.mem_append_right ru htw
· apply List.mem_append_right
apply List.mem_append_left
exact Walk.end_mem_support w'
instance instDecidableIsTerminalWalk {V : Type} [DecidableEq V] {G : SimpleGraph V} {u v : V} : DecidablePred (fun (w : G.Walk u v) => isTerminalWalk w) := fun w => by
unfold isTerminalWalk
use inferInstance
abbrev C : Fin 8 := 2
abbrev G : Fin 8 := 6
noncomputable def b (n : ℕ) := Set.ncard {w : Octagon.Walk C E | isTerminalWalk w ∧ w.length = n}
def Octagon.mirror : Octagon ≃g Octagon := {
toFun x := -x
invFun x := -x
map_rel_iff' := by
intro a b
rw [Equiv.coe_fn_mk, Octagon, cycleGraph_adj', cycleGraph_adj']
grind only [= Fin.val_sub]
left_inv := by simp [Function.LeftInverse.eq_1]
right_inv := by simp [Function.RightInverse.eq_1, Function.LeftInverse.eq_1]
}
def C_G_symm (n : ℕ) : {w : Octagon.Walk C E // isTerminalWalk w ∧ w.length = n} ≃ {w : Octagon.Walk G E // isTerminalWalk w ∧ w.length = n} := {
toFun := fun ⟨w, h⟩ => ⟨(w.map Octagon.mirror.toHom).copy (by decide) (by decide), by {
and_intros
· apply isTerminalWalk_copy
apply isTerminalWalk_map
exact h.left
·
simp [h.right]
}⟩
invFun := fun ⟨w, h⟩ => ⟨(w.map Octagon.mirror.toHom).copy (by decide) (by decide), by {
and_intros
· apply isTerminalWalk_copy
apply isTerminalWalk_map
exact h.left
·
simp [h.right]
}⟩
left_inv := fun ⟨w, h⟩ => by
simp only [RelEmbedding.coe_toRelHom, RelIso.coe_toRelEmbedding, Walk.copy_rfl_rfl,
Walk.map_map, Subtype.mk.injEq]
apply Walk.ext_support
unfold Octagon.mirror
simp
right_inv := fun ⟨w, h⟩ => by
simp only [RelEmbedding.coe_toRelHom, RelIso.coe_toRelEmbedding, Walk.copy_rfl_rfl,
Walk.map_map, Subtype.mk.injEq]
apply Walk.ext_support
unfold Octagon.mirror
simp
}
def isTerminalWalk_length_cons_equiv {V : Type} {G : SimpleGraph V} {u t : V} (m n : ℕ) (npos : 0 < n) :
{w : G.Walk u t // isTerminalWalk w ∧ w.length = m+n} ≃ Σ (v:V), {w : G.Walk u v // t ∉ w.support ∧ w.length = m} × {w : G.Walk v t // isTerminalWalk w ∧ w.length = n}
:= {
toFun := fun ⟨w, h⟩ => ⟨w.getVert m, ⟨w.take m, by {
and_intros
· unfold isTerminalWalk at h
rw [Walk.take_support_eq_support_take_succ]
rw [List.dropLast_eq_take] at h
have : m+1 ≤ w.support.length - 1 := by
rw [Walk.length_support]
omega
have := List.take_subset_take_left w.support this
grind only [= List.subset_def]
· simp [h.right]
}⟩, ⟨w.drop m, by {
and_intros
· apply isTerminalWalk_of_isSubwalk h.left
exact Walk.isSubwalk_drop w m
· simp [h.right]
}⟩⟩
invFun := fun ⟨v, ⟨⟨w1, h1⟩, ⟨w2, h2⟩⟩⟩ => ⟨w1.append w2, by {
and_intros
· unfold isTerminalWalk at h2 ⊢
rw [Walk.support_append_eq_support_dropLast_append, List.dropLast_append_of_ne_nil (by simp), List.mem_append, not_or]
and_intros
· grind only [List.mem_of_mem_dropLast]
· exact h2.left
· simp [h1.right, h2.right]
}⟩
left_inv := fun ⟨w, h⟩ => by
simp
right_inv := fun ⟨v, ⟨⟨w1, h1, h1'⟩, ⟨w2, h2, h2'⟩⟩⟩ => by
subst m n
simp only [Walk.take_append, Walk.drop_append_of_length_eq, Sigma.mk.injEq,
Walk.append_getVert, true_and]
congr! 1
· rw [Walk.append_getVert]
· rw [Walk.append_getVert]
· congr! 1
· simp
· rw [Walk.append_getVert]
· simp [Walk.copy]
· congr! 1
· simp
· rw [Walk.append_getVert]
· simp [Walk.copy]
}
theorem a_b_recurrence_1 (n : ℕ) (npos : 0 < n) : a (n+2) = 2 * a n + 2 * b n := by
have walks_from_A (v) : Fintype.card { w : Octagon.Walk A v // E ∉ w.support ∧ w.length = 2 } =
match v with
| 0 => 2
| 2 => 1
| 6 => 1
| _ => 0
:= by
decide +revert
unfold a b
calc
_ = Fintype.card {w : Octagon.Walk A E // isTerminalWalk w ∧ w.length = 2 + n} := by
rw [Set.ncard_eq_toFinset_card', add_comm]
simp
_ = ∑ v ∈ {A,C,G}, Fintype.card {w : Octagon.Walk A v // E ∉ w.support ∧ w.length = 2} * Fintype.card {w : Octagon.Walk v E // isTerminalWalk w ∧ w.length = n} := by
rw [Fintype.card_eq.mpr (Nonempty.intro (isTerminalWalk_length_cons_equiv _ _ npos))]
rw [Fintype.card_sigma]
simp_rw [Fintype.card_prod]
rw [eq_comm, Finset.sum_subset]
· simp
· intro _ _ _
apply mul_eq_zero_of_left
decide +revert
_ = _ := by
repeat rw [Finset.sum_insert (by decide)]
rw [Finset.sum_singleton]
repeat rw [walks_from_A]
simp only [Set.ncard_eq_toFinset_card', Set.toFinset_card, Set.coe_setOf]
rw [<-Fintype.card_eq.mpr (Nonempty.intro (C_G_symm _))]
omega
theorem a_b_recurrence_2 (n : ℕ) (npos : 0 < n) : b (n+2) = a n + 2 * b n := by
have walks_from_C (v) : Fintype.card { w : Octagon.Walk C v // E ∉ w.support ∧ w.length = 2 } =
match v with
| 0 => 1
| 2 => 2
| _ => 0
:= by
decide +revert
unfold a b
calc
_ = Fintype.card {w : Octagon.Walk C E // isTerminalWalk w ∧ w.length = 2 + n} := by
rw [Set.ncard_eq_toFinset_card', add_comm]
simp
_ = ∑ v ∈ {A,C}, Fintype.card {w : Octagon.Walk C v // E ∉ w.support ∧ w.length = 2} * Fintype.card {w : Octagon.Walk v E // isTerminalWalk w ∧ w.length = n} := by
rw [Fintype.card_eq.mpr (Nonempty.intro (isTerminalWalk_length_cons_equiv _ _ npos))]
rw [Fintype.card_sigma]
simp_rw [Fintype.card_prod]
rw [eq_comm, Finset.sum_subset]
· simp
· intro _ _ _
apply mul_eq_zero_of_left
decide +revert
_ = _ := by
repeat rw [Finset.sum_insert (by decide)]
rw [Finset.sum_singleton]
repeat rw [walks_from_C]
simp only [Set.ncard_eq_toFinset_card', Set.toFinset_card, Set.coe_setOf]
omega
theorem a_even (n : ℕ) (npos : 0 < n) : a (2*n) = ((2+√2)^(n-1) - (2-√2)^(n-1)) / √2 := by
suffices a (2*n) = ((2+√2)^(n-1) - (2-√2)^(n-1)) / √2 ∧ b (2*n) = ((2+√2)^(n-1) + (2-√2)^(n-1)) / 2 by exact this.left
revert n
apply Nat.le_induction
· unfold a b
simp [Set.ncard_eq_toFinset_card']
decide
· intro n npos ih
rw [mul_add, mul_one]
rw [show n + 1 - 1 = (n - 1 + 1) by omega]
repeat rw [pow_succ]
and_intros
· rw [a_b_recurrence_1 _ (by omega)]
rw [Nat.cast_add, Nat.cast_mul, Nat.cast_mul, ih.left, ih.right]
field
· rw [a_b_recurrence_2 _ (by omega)]
rw [Nat.cast_add, Nat.cast_mul, ih.left, ih.right]
generalize (2+√2)^(n-1) = α, (2-√2)^(n-1) = β
simp only [Nat.cast_ofNat]
field_simp
rw [show 2 * (α - β + √2 * (α + β)) = √2 * (2+√2) * α + √2 * (2-√2) * β by grind]
field
theorem walk_even (w : Octagon.Walk A E) : Even w.length := by
let coloring := cycleGraph.bicoloring_of_even 8 (by simp [Nat.even_iff])
rw [coloring.even_length_iff_congr]
decide
theorem a_odd (n : ℕ) (npos : 0 < n) : a (2*n-1) = 0 := by
unfold a
rw [Set.ncard_eq_toFinset_card', Finset.card_eq_zero]
apply Finset.eq_empty_of_forall_notMem
intro w
have := walk_even w
grind only [= Nat.even_iff, = Set.mem_toFinset, usr Set.mem_setOf_eq]
theorem imo1979_p6 (n : ℕ) (npos : 0 < n) : a (2*n-1) = 0 ∧ a (2*n) = ((2+√2)^(n-1) - (2-√2)^(n-1)) / √2 := by
and_intros
· exact a_odd n npos
· exact a_even n npos
end Imo1979P6
| true | Copyright (c) 2026 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
/-!
# International Mathematical Olympiad 1979, Problem 6
Let $A$ and $E$ be opposite vertices of an octagon.
A frog starts at vertex $A.$ From any vertex except $E$ it jumps to one of the two adjacent vertices.
When it reaches $E$ it stops. Let $a_n$ be the number of distinct paths of exactly $n$ jumps ending at $E$.
Prove that: \[a_{2n-1}=0, \quad a_{2n}={(2+\sqrt2)^{n-1} - (2-\sqrt2)^{n-1} \over\sqrt2}.\]
-/
namespace Imo1979P6
open SimpleGraph
abbrev Octagon := cycleGraph 8
abbrev A : Fin 8 := 0
abbrev E : Fin 8 := 4
def isTerminalWalk {V : Type} {G : SimpleGraph V} {u v : V} (w : G.Walk u v) := v ∉ w.support.dropLast
noncomputable def a (n : ℕ) := Set.ncard {w : Octagon.Walk A E | isTerminalWalk w ∧ w.length = n}
instance instFintypeAnd {α : Type} [DecidableEq α] (p q : α → Prop) [inst : Fintype (Subtype p)] [DecidablePred q] : Fintype (Subtype (fun x => q x ∧ p x)) := {
elems := (inst.elems.filter (fun x => q x.val)).attach.image (fun x => ⟨x.val.val, by grind⟩)
complete := by
simp only [Finset.mem_image, Finset.mem_attach, true_and, Subtype.exists, Finset.mem_filter,
Subtype.forall, Subtype.mk.injEq, exists_prop, exists_and_right, exists_eq_right, and_imp]
intro a h1 h2
and_intros
· use h2
apply Fintype.complete
· exact h1
}
instance Set.instFintypeElemOfSubtype {α : Type} (p: α → Prop) [inst : Fintype {x // p x}] : Fintype ({x | p x}) := {
elems := inst.elems
complete := by
simp only [Set.coe_setOf, Subtype.forall]
intro a h
apply Fintype.complete
}
@[simp]
theorem Walk.append_getVert {V : Type} {G : SimpleGraph V} {u v w : V}
(w1 : G.Walk u v) (w2 : G.Walk v w) : (w1.append w2).getVert w1.length = v
:= by simp [Walk.getVert_append]
@[simp]
theorem Walk.take_append {V : Type} {G : SimpleGraph V} {u v w : V}
(w1 : G.Walk u v) (w2 : G.Walk v w) :
(w1.append w2).take w1.length = w1.copy rfl (by simp) := by
apply Walk.ext_support
rw [Walk.take_support_eq_support_take_succ, Walk.support_append]
simp
@[simp]
theorem Walk.drop_append_of_length_eq {V : Type} {G : SimpleGraph V} {u v w : V}
(w1 : G.Walk u v) (w2 : G.Walk v w) :
(w1.append w2).drop w1.length = w2.copy (by simp) rfl := by
apply Walk.ext_support
rw [Walk.drop_support_eq_support_drop_min, Walk.support_append_eq_support_dropLast_append]
simp
theorem isTerminalWalk_copy {V : Type} {G : SimpleGraph V} {u v u' v' : V} (h1 : u = u') (h2 : v = v') (w : G.Walk u v) : isTerminalWalk w → isTerminalWalk (w.copy h1 h2) := by
unfold isTerminalWalk
intro h
simp [<-h2, h]
theorem isTerminalWalk_map {V V' : Type} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G ↪g G') {u v : V} (w : G.Walk u v) :
isTerminalWalk w → isTerminalWalk (w.map f.toHom) := by
unfold isTerminalWalk
intro h
simp
contrapose! h
rw [List.dropLast_eq_take, List.mem_take_iff_getElem] at h ⊢
simp only [List.getElem_map, EmbeddingLike.apply_eq_iff_eq] at h
grind only [= List.length_map]
theorem isTerminalWalk_of_isSubwalk {V : Type} {G : SimpleGraph V} {u u' t : V} {w : G.Walk u t} {w' : G.Walk u' t} (htw : isTerminalWalk w) (hsub : w'.IsSubwalk w)
: isTerminalWalk w' := by
unfold isTerminalWalk at htw ⊢
rw [Walk.isSubwalk_iff_support_isInfix, List.IsInfix] at hsub
let ⟨ru, rv, h⟩ := hsub
rw [<-h, List.append_assoc, List.dropLast_append_of_ne_nil (by simp), List.dropLast_append] at htw
contrapose! htw
split_ifs with h
· exact List.mem_append_right ru htw
· apply List.mem_append_right
apply List.mem_append_left
exact Walk.end_mem_support w'
instance instDecidableIsTerminalWalk {V : Type} [DecidableEq V] {G : SimpleGraph V} {u v : V} : DecidablePred (fun (w : G.Walk u v) => isTerminalWalk w) := fun w => by
unfold isTerminalWalk
use inferInstance
abbrev C : Fin 8 := 2
abbrev G : Fin 8 := 6
noncomputable def b (n : ℕ) := Set.ncard {w : Octagon.Walk C E | isTerminalWalk w ∧ w.length = n}
def Octagon.mirror : Octagon ≃g Octagon := {
toFun x := -x
invFun x := -x
map_rel_iff' := by
intro a b
rw [Equiv.coe_fn_mk, Octagon, cycleGraph_adj', cycleGraph_adj']
grind only [= Fin.val_sub]
left_inv := by simp [Function.LeftInverse.eq_1]
right_inv := by simp [Function.RightInverse.eq_1, Function.LeftInverse.eq_1]
}
def C_G_symm (n : ℕ) : {w : Octagon.Walk C E // isTerminalWalk w ∧ w.length = n} ≃ {w : Octagon.Walk G E // isTerminalWalk w ∧ w.length = n} := {
toFun := fun ⟨w, h⟩ => ⟨(w.map Octagon.mirror.toHom).copy (by decide) (by decide), by {
and_intros
· apply isTerminalWalk_copy
apply isTerminalWalk_map
exact h.left
·
simp [h.right]
}⟩
invFun := fun ⟨w, h⟩ => ⟨(w.map Octagon.mirror.toHom).copy (by decide) (by decide), by {
and_intros
· apply isTerminalWalk_copy
apply isTerminalWalk_map
exact h.left
·
simp [h.right]
}⟩
left_inv := fun ⟨w, h⟩ => by
simp only [RelEmbedding.coe_toRelHom, RelIso.coe_toRelEmbedding, Walk.copy_rfl_rfl,
Walk.map_map, Subtype.mk.injEq]
apply Walk.ext_support
unfold Octagon.mirror
simp
right_inv := fun ⟨w, h⟩ => by
simp only [RelEmbedding.coe_toRelHom, RelIso.coe_toRelEmbedding, Walk.copy_rfl_rfl,
Walk.map_map, Subtype.mk.injEq]
apply Walk.ext_support
unfold Octagon.mirror
simp
}
def isTerminalWalk_length_cons_equiv {V : Type} {G : SimpleGraph V} {u t : V} (m n : ℕ) (npos : 0 < n) :
{w : G.Walk u t // isTerminalWalk w ∧ w.length = m+n} ≃ Σ (v:V), {w : G.Walk u v // t ∉ w.support ∧ w.length = m} × {w : G.Walk v t // isTerminalWalk w ∧ w.length = n}
:= {
toFun := fun ⟨w, h⟩ => ⟨w.getVert m, ⟨w.take m, by {
and_intros
· unfold isTerminalWalk at h
rw [Walk.take_support_eq_support_take_succ]
rw [List.dropLast_eq_take] at h
have : m+1 ≤ w.support.length - 1 := by
rw [Walk.length_support]
omega
have := List.take_subset_take_left w.support this
grind only [= List.subset_def]
· simp [h.right]
}⟩, ⟨w.drop m, by {
and_intros
· apply isTerminalWalk_of_isSubwalk h.left
exact Walk.isSubwalk_drop w m
· simp [h.right]
}⟩⟩
invFun := fun ⟨v, ⟨⟨w1, h1⟩, ⟨w2, h2⟩⟩⟩ => ⟨w1.append w2, by {
and_intros
· unfold isTerminalWalk at h2 ⊢
rw [Walk.support_append_eq_support_dropLast_append, List.dropLast_append_of_ne_nil (by simp), List.mem_append, not_or]
and_intros
· grind only [List.mem_of_mem_dropLast]
· exact h2.left
· simp [h1.right, h2.right]
}⟩
left_inv := fun ⟨w, h⟩ => by
simp
right_inv := fun ⟨v, ⟨⟨w1, h1, h1'⟩, ⟨w2, h2, h2'⟩⟩⟩ => by
subst m n
simp only [Walk.take_append, Walk.drop_append_of_length_eq, Sigma.mk.injEq,
Walk.append_getVert, true_and]
congr! 1
· rw [Walk.append_getVert]
· rw [Walk.append_getVert]
· congr! 1
· simp
· rw [Walk.append_getVert]
· simp [Walk.copy]
· congr! 1
· simp
· rw [Walk.append_getVert]
· simp [Walk.copy]
}
theorem a_b_recurrence_1 (n : ℕ) (npos : 0 < n) : a (n+2) = 2 * a n + 2 * b n := by
have walks_from_A (v) : Fintype.card { w : Octagon.Walk A v // E ∉ w.support ∧ w.length = 2 } =
match v with
| 0 => 2
| 2 => 1
| 6 => 1
| _ => 0
:= by
decide +revert
unfold a b
calc
_ = Fintype.card {w : Octagon.Walk A E // isTerminalWalk w ∧ w.length = 2 + n} := by
rw [Set.ncard_eq_toFinset_card', add_comm]
simp
_ = ∑ v ∈ {A,C,G}, Fintype.card {w : Octagon.Walk A v // E ∉ w.support ∧ w.length = 2} * Fintype.card {w : Octagon.Walk v E // isTerminalWalk w ∧ w.length = n} := by
rw [Fintype.card_eq.mpr (Nonempty.intro (isTerminalWalk_length_cons_equiv _ _ npos))]
rw [Fintype.card_sigma]
simp_rw [Fintype.card_prod]
rw [eq_comm, Finset.sum_subset]
· simp
· intro _ _ _
apply mul_eq_zero_of_left
decide +revert
_ = _ := by
repeat rw [Finset.sum_insert (by decide)]
rw [Finset.sum_singleton]
repeat rw [walks_from_A]
simp only [Set.ncard_eq_toFinset_card', Set.toFinset_card, Set.coe_setOf]
rw [<-Fintype.card_eq.mpr (Nonempty.intro (C_G_symm _))]
omega
theorem a_b_recurrence_2 (n : ℕ) (npos : 0 < n) : b (n+2) = a n + 2 * b n := by
have walks_from_C (v) : Fintype.card { w : Octagon.Walk C v // E ∉ w.support ∧ w.length = 2 } =
match v with
| 0 => 1
| 2 => 2
| _ => 0
:= by
decide +revert
unfold a b
calc
_ = Fintype.card {w : Octagon.Walk C E // isTerminalWalk w ∧ w.length = 2 + n} := by
rw [Set.ncard_eq_toFinset_card', add_comm]
simp
_ = ∑ v ∈ {A,C}, Fintype.card {w : Octagon.Walk C v // E ∉ w.support ∧ w.length = 2} * Fintype.card {w : Octagon.Walk v E // isTerminalWalk w ∧ w.length = n} := by
rw [Fintype.card_eq.mpr (Nonempty.intro (isTerminalWalk_length_cons_equiv _ _ npos))]
rw [Fintype.card_sigma]
simp_rw [Fintype.card_prod]
rw [eq_comm, Finset.sum_subset]
· simp
· intro _ _ _
apply mul_eq_zero_of_left
decide +revert
_ = _ := by
repeat rw [Finset.sum_insert (by decide)]
rw [Finset.sum_singleton]
repeat rw [walks_from_C]
simp only [Set.ncard_eq_toFinset_card', Set.toFinset_card, Set.coe_setOf]
omega
theorem a_even (n : ℕ) (npos : 0 < n) : a (2*n) = ((2+√2)^(n-1) - (2-√2)^(n-1)) / √2 := by
suffices a (2*n) = ((2+√2)^(n-1) - (2-√2)^(n-1)) / √2 ∧ b (2*n) = ((2+√2)^(n-1) + (2-√2)^(n-1)) / 2 by exact this.left
revert n
apply Nat.le_induction
· unfold a b
simp [Set.ncard_eq_toFinset_card']
decide
· intro n npos ih
rw [mul_add, mul_one]
rw [show n + 1 - 1 = (n - 1 + 1) by omega]
repeat rw [pow_succ]
and_intros
· rw [a_b_recurrence_1 _ (by omega)]
rw [Nat.cast_add, Nat.cast_mul, Nat.cast_mul, ih.left, ih.right]
field
· rw [a_b_recurrence_2 _ (by omega)]
rw [Nat.cast_add, Nat.cast_mul, ih.left, ih.right]
generalize (2+√2)^(n-1) = α, (2-√2)^(n-1) = β
simp only [Nat.cast_ofNat]
field_simp
rw [show 2 * (α - β + √2 * (α + β)) = √2 * (2+√2) * α + √2 * (2-√2) * β by grind]
field
theorem walk_even (w : Octagon.Walk A E) : Even w.length := by
let coloring := cycleGraph.bicoloring_of_even 8 (by simp [Nat.even_iff])
rw [coloring.even_length_iff_congr]
decide
theorem a_odd (n : ℕ) (npos : 0 < n) : a (2*n-1) = 0 := by
unfold a
rw [Set.ncard_eq_toFinset_card', Finset.card_eq_zero]
apply Finset.eq_empty_of_forall_notMem
intro w
have := walk_even w
grind only [= Nat.even_iff, = Set.mem_toFinset, usr Set.mem_setOf_eq]
theorem imo1979_p6 (n : ℕ) (npos : 0 < n) : a (2*n-1) = 0 ∧ a (2*n) = ((2+√2)^(n-1) - (2-√2)^(n-1)) / √2 := by
and_intros
· exact a_odd n npos
· exact a_even n npos
end Imo1979P6 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1979P6.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["`grind` failed\ncase grind\n\u03b1 : Type\ninst : (a b : \u03b1) \u2192 Decidable (a = b)\np q : \u03b1 \u2192 Prop\ninst_1 : Fintype (Subtype p)\ninst_2 : (a : \u03b1) \u2192 Decidable (q a)\nval_1 : \u03b1\nproperty : p val_1\nproperty_1 : \u27e8val_1, \u22ef\u27e9 \u2208 {x \u2208 Fintype.elems | q \u2191x}\nh : \u00acq val_1 \u2228 \u00acp val_1\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] p val_1\n [prop] \u27e8val_1, \u22ef\u27e9 \u2208 {x \u2208 Fintype.elems | q \u2191x}\n [prop] \u00acq val_1 \u2228 \u00acp val_1\n [eqc] True propositions\n [prop] p val_1\n [prop] \u27e8val_1, \u22ef\u27e9 \u2208 {x \u2208 Fintype.elems | q \u2191x}\n [prop] \u00acq val_1 \u2228 \u00acp val_1\n [prop] \u00acq val_1\n [eqc] False propositions\n [prop] \u00acp val_1\n [prop] q val_1\n [ematch] E-matching patterns\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n {x \u2208 Fintype.elems | q \u2191x}\n has type\n Finset (Subtype p) : Type\n but is expected to have type\n Std.ExtDHashMap (Subtype p) ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n {x \u2208 Fintype.elems | q \u2191x}\n has type\n Finset (Subtype p) : Type\n but is expected to have type\n Std.DHashMap (Subtype p) ?\u03b2 : Type\n[grind] Diagnostics\n [cases] Cases instances\n [cases] Subtype \u21a6 2", "invalid field notation, type is not of the form (C ...) where C is a constant\n Walk\nhas type\n SimpleGraph ?m.4669 \u2192 ?m.4669 \u2192 ?m.4669 \u2192 Type ?u.4668", "unsolved goals\ncase h\nV : Type\nG : SimpleGraph V\nu v w : V\nw1 : G.Walk u v\nw2 : G.Walk v w\n\u22a2 ((w1.append w2).take w1.length).support = (w1.copy \u22ef \u22ef).support", "invalid field notation, type is not of the form (C ...) where C is a constant\n Walk\nhas type\n SimpleGraph ?m.4964 \u2192 ?m.4964 \u2192 ?m.4964 \u2192 Type ?u.4963", "unsolved goals\ncase h\nV : Type\nG : SimpleGraph V\nu v w : V\nw1 : G.Walk u v\nw2 : G.Walk v w\n\u22a2 ((w1.append w2).drop w1.length).support = (w2.copy \u22ef \u22ef).support", "unknown option 'backward.isDefEq.respectTransparency'", "invalid field 'IsSubwalk', the environment does not contain 'SimpleGraph.Walk.IsSubwalk'\n w'\nhas type\n G.Walk u' t", "invalid field notation, type is not of the form (C ...) where C is a constant\n Walk\nhas type\n SimpleGraph ?m.5400 \u2192 ?m.5400 \u2192 ?m.5400 \u2192 Type ?u.5399", "unsolved goals\nV : Type\nG : SimpleGraph V\nu u' t : V\nw : G.Walk u t\nw' : G.Walk u' t\nhtw : t \u2209 w.support.dropLast\nhsub : sorry\n\u22a2 t \u2209 w'.support.dropLast", "unknown constant 'Fin.val_sub'", "unknown option 'backward.isDefEq.respectTransparency'", "unknown option 'backward.isDefEq.respectTransparency'", "unknown option 'backward.isDefEq.respectTransparency'", "unknown option 'backward.isDefEq.respectTransparency'", "unknown tactic", "invalid field notation, type is not of the form (C ...) where C is a constant\n Walk\nhas type\n SimpleGraph ?m.11919 \u2192 ?m.11919 \u2192 ?m.11919 \u2192 Type ?u.11918", "unknown tactic", "unknown tactic", "unknown tactic", "unsolved goals\nn : \u2115\nnpos : Nat.succ 0 \u2264 n\nih :\n \u2191(a (2 * n)) = ((2 + \u221a2) ^ (n - 1) - (2 - \u221a2) ^ (n - 1)) / \u221a2 \u2227\n \u2191(b (2 * n)) = ((2 + \u221a2) ^ (n - 1) + (2 - \u221a2) ^ (n - 1)) / 2\n\u22a2 n + 1 - 1 = n - 1 + 1", "unsolved goals\ncase succ\nn : \u2115\nnpos : Nat.succ 0 \u2264 n\nih :\n \u2191(a (2 * n)) = ((2 + \u221a2) ^ (n - 1) - (2 - \u221a2) ^ (n - 1)) / \u221a2 \u2227\n \u2191(b (2 * n)) = ((2 + \u221a2) ^ (n - 1) + (2 - \u221a2) ^ (n - 1)) / 2\n\u22a2 \u2191(a (2 * n + 2)) = ((2 + \u221a2) ^ (n - 1 + 1) - (2 - \u221a2) ^ (n - 1 + 1)) / \u221a2 \u2227\n \u2191(b (2 * n + 2)) = ((2 + \u221a2) ^ (n - 1 + 1) + (2 - \u221a2) ^ (n - 1 + 1)) / 2", "invalid use of `usr` modifier, `Set.mem_setOf_eq` does not have patterns specified with the command `grind_pattern`"], "timeout_s": 600.0, "latency_s": 2.319, "verified_at": "2026-03-26T18:16:46.506780+00:00"}} | false | true | false | 2.319 |
compfiles_Imo1981P2 | compfiles | Copyright (c) 2026 Constantin Seebach. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
namespace Imo1981P2
/-!
# International Mathematical Olympiad 1981, Problem 2
Let $1 \le r \le n$ and consider all subsets of $r$ elements of the set $\{ 1, 2, \ldots , n \}$.
Each of these subsets has a smallest member. Let $F(n,r)$ denote the arithmetic mean of these smallest numbers; prove that
\[ F(n,r) = \frac{n+1}{r+1}. \]
-/
open Finset
variable (n r : ℕ)
def arith_mean (ms : Multiset ℕ) : ℚ := ms.sum / ms.card
def F : ℚ := arith_mean <| ((Icc 1 n).powersetCard r).val.map (fun s => s.min.getD 0)
open SimpleGraph
def eraseMin (s : Finset ℕ) :=
if h : s.Nonempty then
s.erase (s.min' h)
else
s
@[simp]
theorem insert_min'_eraseMin {s : Finset ℕ} (hne : s.Nonempty) : insert (s.min' hne) (eraseMin s) = s := by
unfold eraseMin
simp only [hne, ↓reduceDIte]
apply insert_erase
exact min'_mem s hne
theorem eraseMin_insert {s : Finset ℕ} (x : ℕ) (h : ∀ y ∈ s, x < y) : eraseMin (insert x s) = s := by
unfold eraseMin
simp only [insert_nonempty, ↓reduceDIte]
rw [show ∀ h, (insert x s).min' h = x by {
simp only [insert_nonempty, forall_true_left]
rw [min'_eq_iff]
grind only [= mem_insert]
}]
apply erase_insert
grind only
theorem eraseMin_mem_powersetCard {s : Finset ℕ} (h : s ∈ powersetCard (r + 1) (Icc 0 n)) : eraseMin s ∈ powersetCard r (Icc 1 n) := by
suffices #(eraseMin s) = r ∧ 0 ∉ eraseMin s by
grind [eraseMin]
and_intros
· unfold eraseMin
split_ifs with sne
· rw [card_erase_of_mem]
· grind only [= mem_powersetCard]
· exact min'_mem s sne
· grind only [= mem_powersetCard, card_ne_zero]
· unfold eraseMin
split_ifs with sne
· rw [mem_erase, not_and', not_ne_iff, eq_comm, min'_eq_iff]
simp
· grind only [= nonempty_def]
abbrev V := (powersetCard (r+1) (Icc 0 n)) ⊕ (powersetCard r (Icc 1 n))
def G : SimpleGraph (V n r) := {
Adj u v := match (u, v) with
| (.inl a, .inr b) | (.inr b, .inl a) => eraseMin a = b
| _ => False
symm := by
grind only [swap_eq_iff]
}
instance : DecidableRel (G n r).Adj := fun u v =>
match h : (u, v) with
| (.inl a, .inr b) | (.inr b, .inl a) => if h' : eraseMin a = b then .isTrue (by simp_all [G]) else .isFalse (by simp_all [G])
| (.inl a, .inl b) | (.inr b, .inr a) => .isFalse (by simp_all [G])
theorem bipartite_edge {α β : Type} {G : SimpleGraph (α ⊕ β)} (hbip : G ≤ completeBipartiteGraph α β) (e : Sym2 (α ⊕ β)) (he : e ∈ G.edgeSet)
: ∃ (a : α) (b : β), e = s(Sum.inl a, Sum.inr b) := by
obtain ⟨u,v,h⟩ : ∃ u v, e = s(u,v) := by
rw [<-Sym2.exists]
use e
subst e
rw [mem_edgeSet] at he
have : (completeBipartiteGraph α β).Adj u v := by
exact le_iff_adj.mp hbip _ _ he
apply Or.elim this
· intro ⟨h1, h2⟩
use u.getLeft h1, v.getRight h2
grind
· intro ⟨h1, h2⟩
use v.getLeft h2, u.getRight h1
grind
theorem G.bipartite : G n r ≤ completeBipartiteGraph _ _ := by
rw [le_iff_adj]
intro u v hadj
grind [G, completeBipartiteGraph_adj]
theorem G.card_edgeFinset : #(G n r).edgeFinset = Nat.choose (n+1) (r+1) := by
rw [show n+1 = #(Icc 0 n) by simp, <-card_powersetCard, eq_comm]
apply card_bij (fun s h => s(.inl ⟨s, h⟩, .inr ⟨eraseMin s, by grind only [eraseMin_mem_powersetCard]⟩))
· intro s hs
rw [mem_edgeFinset, mem_edgeSet]
simp [G]
· simp_all
· intro e he
rw [mem_edgeFinset] at he
let ⟨a, b, h⟩ := bipartite_edge (G.bipartite n r) _ he
subst e
rw [mem_edgeSet, G] at he
grind
theorem G.degree_b (rpos : 1 ≤ r) (b : powersetCard r (Icc 1 n)) : (G n r).degree (Sum.inr b) = b.val.min := by
match hm : b.val.min with
| none =>
rw [WithTop.none_eq_top, Finset.min_eq_top] at hm
grind only [= mem_powersetCard, = card_empty]
| some m =>
have h_bd : ∀ x ∈ b.val, m ≤ x := by
intro x hx
apply Finset.min_le_of_eq hx
exact hm
have mmem : m ∈ b.val := by
apply Finset.mem_of_min
exact hm
have h_bd' : m ≤ n := by
grind only [= mem_powersetCard, = subset_iff, = mem_Icc]
congr
rw [degree, <-Finset.card_range m, eq_comm]
apply card_bij (fun i hi => Sum.inl ⟨insert i b.val, by grind⟩)
· intro i hi
rw [mem_neighborFinset, G]
grind [eraseMin_insert]
· intro i1 hi1 i2 hi2 e
simp only [Sum.inl.injEq, Subtype.mk.injEq] at e
apply (insert_inj _).mp e
grind only [= mem_range]
· intro v hv
rw [mem_neighborFinset, G] at hv
simp only at hv
split at hv
· simp_all
· expose_names
simp only [Prod.mk.injEq, Sum.inr.injEq] at heq
have := heq.left
have := heq.right
subst b_1 v
simp_rw [<-hv]
have ane : a.val.Nonempty := by
grind only [= mem_powersetCard, card_ne_zero]
use a.val.min' ane, ?_
· rw [Sum.inl.injEq, <-Subtype.val_inj]
simp
· simp only [mem_range]
apply Finset.min'_lt_of_mem_erase_min'
unfold eraseMin at hv
simp only [ane, ↓reduceDIte] at hv
simp_rw [hv]
exact mmem
· contradiction
theorem imo1981_p2 (rpos : 1 ≤ r) (hrn : r ≤ n) : F n r = (n+1)/(r+1) := by
have npos : 1 ≤ n := by omega
unfold F arith_mean
simp
conv =>
enter [1, 1]
norm_cast
arg 1
rw [<-Finset.sum_attach]
arg 2
intro v
rw [<-G.degree_b _ _ rpos, <-WithTop.coe_natCast, WithTop.some, Option.getD_some, Nat.cast_id, <-Function.Embedding.inr_apply]
conv =>
enter [1, 1, 1]
rw [<-Finset.sum_map _ Function.Embedding.inr (fun v => (G n r).degree v)]
rw [isBipartiteWith_sum_degrees_eq_card_edges' (s:=Finset.univ.map Function.Embedding.inl) ?bip]
case bip => tactic =>
unfold G
constructor
· simp [Set.disjoint_range_iff]
· intro u v adj
simp
grind
rw [G.card_edgeFinset]
rw [<-mul_div_mul_left (c:=↑(n+1)) _ _ (by grind only), <-Nat.cast_mul, <-Nat.cast_mul, Nat.add_one_mul_choose_eq]
qify
have : (n + 1).choose (r + 1) ≠ 0 := by
rw [Nat.choose_ne_zero_iff]
omega
field
end Imo1981P2 | /- | /-
Copyright (c) 2026 Constantin Seebach. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
namespace Imo1981P2
/-!
# International Mathematical Olympiad 1981, Problem 2
Let $1 \le r \le n$ and consider all subsets of $r$ elements of the set $\{ 1, 2, \ldots , n \}$.
Each of these subsets has a smallest member. Let $F(n,r)$ denote the arithmetic mean of these smallest numbers; prove that
\[ F(n,r) = \frac{n+1}{r+1}. \]
-/
open Finset
variable (n r : ℕ)
def arith_mean (ms : Multiset ℕ) : ℚ := ms.sum / ms.card
def F : ℚ := arith_mean <| ((Icc 1 n).powersetCard r).val.map (fun s => s.min.getD 0)
open SimpleGraph
def eraseMin (s : Finset ℕ) :=
if h : s.Nonempty then
s.erase (s.min' h)
else
s
@[simp]
theorem insert_min'_eraseMin {s : Finset ℕ} (hne : s.Nonempty) : insert (s.min' hne) (eraseMin s) = s := by
unfold eraseMin
simp only [hne, ↓reduceDIte]
apply insert_erase
exact min'_mem s hne
theorem eraseMin_insert {s : Finset ℕ} (x : ℕ) (h : ∀ y ∈ s, x < y) : eraseMin (insert x s) = s := by
unfold eraseMin
simp only [insert_nonempty, ↓reduceDIte]
rw [show ∀ h, (insert x s).min' h = x by {
simp only [insert_nonempty, forall_true_left]
rw [min'_eq_iff]
grind only [= mem_insert]
}]
apply erase_insert
grind only
theorem eraseMin_mem_powersetCard {s : Finset ℕ} (h : s ∈ powersetCard (r + 1) (Icc 0 n)) : eraseMin s ∈ powersetCard r (Icc 1 n) := by
suffices #(eraseMin s) = r ∧ 0 ∉ eraseMin s by
grind [eraseMin]
and_intros
· unfold eraseMin
split_ifs with sne
· rw [card_erase_of_mem]
· grind only [= mem_powersetCard]
· exact min'_mem s sne
· grind only [= mem_powersetCard, card_ne_zero]
· unfold eraseMin
split_ifs with sne
· rw [mem_erase, not_and', not_ne_iff, eq_comm, min'_eq_iff]
simp
· grind only [= nonempty_def]
abbrev V := (powersetCard (r+1) (Icc 0 n)) ⊕ (powersetCard r (Icc 1 n))
def G : SimpleGraph (V n r) := {
Adj u v := match (u, v) with
| (.inl a, .inr b) | (.inr b, .inl a) => eraseMin a = b
| _ => False
symm := by
grind only [swap_eq_iff]
}
instance : DecidableRel (G n r).Adj := fun u v =>
match h : (u, v) with
| (.inl a, .inr b) | (.inr b, .inl a) => if h' : eraseMin a = b then .isTrue (by simp_all [G]) else .isFalse (by simp_all [G])
| (.inl a, .inl b) | (.inr b, .inr a) => .isFalse (by simp_all [G])
theorem bipartite_edge {α β : Type} {G : SimpleGraph (α ⊕ β)} (hbip : G ≤ completeBipartiteGraph α β) (e : Sym2 (α ⊕ β)) (he : e ∈ G.edgeSet)
: ∃ (a : α) (b : β), e = s(Sum.inl a, Sum.inr b) := by
obtain ⟨u,v,h⟩ : ∃ u v, e = s(u,v) := by
rw [<-Sym2.exists]
use e
subst e
rw [mem_edgeSet] at he
have : (completeBipartiteGraph α β).Adj u v := by
exact le_iff_adj.mp hbip _ _ he
apply Or.elim this
· intro ⟨h1, h2⟩
use u.getLeft h1, v.getRight h2
grind
· intro ⟨h1, h2⟩
use v.getLeft h2, u.getRight h1
grind
theorem G.bipartite : G n r ≤ completeBipartiteGraph _ _ := by
rw [le_iff_adj]
intro u v hadj
grind [G, completeBipartiteGraph_adj]
theorem G.card_edgeFinset : #(G n r).edgeFinset = Nat.choose (n+1) (r+1) := by
rw [show n+1 = #(Icc 0 n) by simp, <-card_powersetCard, eq_comm]
apply card_bij (fun s h => s(.inl ⟨s, h⟩, .inr ⟨eraseMin s, by grind only [eraseMin_mem_powersetCard]⟩))
· intro s hs
rw [mem_edgeFinset, mem_edgeSet]
simp [G]
· simp_all
· intro e he
rw [mem_edgeFinset] at he
let ⟨a, b, h⟩ := bipartite_edge (G.bipartite n r) _ he
subst e
rw [mem_edgeSet, G] at he
grind
theorem G.degree_b (rpos : 1 ≤ r) (b : powersetCard r (Icc 1 n)) : (G n r).degree (Sum.inr b) = b.val.min := by
match hm : b.val.min with
| none =>
rw [WithTop.none_eq_top, Finset.min_eq_top] at hm
grind only [= mem_powersetCard, = card_empty]
| some m =>
have h_bd : ∀ x ∈ b.val, m ≤ x := by
intro x hx
apply Finset.min_le_of_eq hx
exact hm
have mmem : m ∈ b.val := by
apply Finset.mem_of_min
exact hm
have h_bd' : m ≤ n := by
grind only [= mem_powersetCard, = subset_iff, = mem_Icc]
congr
rw [degree, <-Finset.card_range m, eq_comm]
apply card_bij (fun i hi => Sum.inl ⟨insert i b.val, by grind⟩)
· intro i hi
rw [mem_neighborFinset, G]
grind [eraseMin_insert]
· intro i1 hi1 i2 hi2 e
simp only [Sum.inl.injEq, Subtype.mk.injEq] at e
apply (insert_inj _).mp e
grind only [= mem_range]
· intro v hv
rw [mem_neighborFinset, G] at hv
simp only at hv
split at hv
· simp_all
· expose_names
simp only [Prod.mk.injEq, Sum.inr.injEq] at heq
have := heq.left
have := heq.right
subst b_1 v
simp_rw [<-hv]
have ane : a.val.Nonempty := by
grind only [= mem_powersetCard, card_ne_zero]
use a.val.min' ane, ?_
· rw [Sum.inl.injEq, <-Subtype.val_inj]
simp
· simp only [mem_range]
apply Finset.min'_lt_of_mem_erase_min'
unfold eraseMin at hv
simp only [ane, ↓reduceDIte] at hv
simp_rw [hv]
exact mmem
· contradiction
theorem imo1981_p2 (rpos : 1 ≤ r) (hrn : r ≤ n) : F n r = (n+1)/(r+1) := by
have npos : 1 ≤ n := by omega
unfold F arith_mean
simp
conv =>
enter [1, 1]
norm_cast
arg 1
rw [<-Finset.sum_attach]
arg 2
intro v
rw [<-G.degree_b _ _ rpos, <-WithTop.coe_natCast, WithTop.some, Option.getD_some, Nat.cast_id, <-Function.Embedding.inr_apply]
conv =>
enter [1, 1, 1]
rw [<-Finset.sum_map _ Function.Embedding.inr (fun v => (G n r).degree v)]
rw [isBipartiteWith_sum_degrees_eq_card_edges' (s:=Finset.univ.map Function.Embedding.inl) ?bip]
case bip => tactic =>
unfold G
constructor
· simp [Set.disjoint_range_iff]
· intro u v adj
simp
grind
rw [G.card_edgeFinset]
rw [<-mul_div_mul_left (c:=↑(n+1)) _ _ (by grind only), <-Nat.cast_mul, <-Nat.cast_mul, Nat.add_one_mul_choose_eq]
qify
have : (n + 1).choose (r + 1) ≠ 0 := by
rw [Nat.choose_ne_zero_iff]
omega
field
end Imo1981P2
| true | Copyright (c) 2026 Constantin Seebach. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
namespace Imo1981P2
/-!
# International Mathematical Olympiad 1981, Problem 2
Let $1 \le r \le n$ and consider all subsets of $r$ elements of the set $\{ 1, 2, \ldots , n \}$.
Each of these subsets has a smallest member. Let $F(n,r)$ denote the arithmetic mean of these smallest numbers; prove that
\[ F(n,r) = \frac{n+1}{r+1}. \]
-/
open Finset
variable (n r : ℕ)
def arith_mean (ms : Multiset ℕ) : ℚ := ms.sum / ms.card
def F : ℚ := arith_mean <| ((Icc 1 n).powersetCard r).val.map (fun s => s.min.getD 0)
open SimpleGraph
def eraseMin (s : Finset ℕ) :=
if h : s.Nonempty then
s.erase (s.min' h)
else
s
@[simp]
theorem insert_min'_eraseMin {s : Finset ℕ} (hne : s.Nonempty) : insert (s.min' hne) (eraseMin s) = s := by
unfold eraseMin
simp only [hne, ↓reduceDIte]
apply insert_erase
exact min'_mem s hne
theorem eraseMin_insert {s : Finset ℕ} (x : ℕ) (h : ∀ y ∈ s, x < y) : eraseMin (insert x s) = s := by
unfold eraseMin
simp only [insert_nonempty, ↓reduceDIte]
rw [show ∀ h, (insert x s).min' h = x by {
simp only [insert_nonempty, forall_true_left]
rw [min'_eq_iff]
grind only [= mem_insert]
}]
apply erase_insert
grind only
theorem eraseMin_mem_powersetCard {s : Finset ℕ} (h : s ∈ powersetCard (r + 1) (Icc 0 n)) : eraseMin s ∈ powersetCard r (Icc 1 n) := by
suffices #(eraseMin s) = r ∧ 0 ∉ eraseMin s by
grind [eraseMin]
and_intros
· unfold eraseMin
split_ifs with sne
· rw [card_erase_of_mem]
· grind only [= mem_powersetCard]
· exact min'_mem s sne
· grind only [= mem_powersetCard, card_ne_zero]
· unfold eraseMin
split_ifs with sne
· rw [mem_erase, not_and', not_ne_iff, eq_comm, min'_eq_iff]
simp
· grind only [= nonempty_def]
abbrev V := (powersetCard (r+1) (Icc 0 n)) ⊕ (powersetCard r (Icc 1 n))
def G : SimpleGraph (V n r) := {
Adj u v := match (u, v) with
| (.inl a, .inr b) | (.inr b, .inl a) => eraseMin a = b
| _ => False
symm := by
grind only [swap_eq_iff]
}
instance : DecidableRel (G n r).Adj := fun u v =>
match h : (u, v) with
| (.inl a, .inr b) | (.inr b, .inl a) => if h' : eraseMin a = b then .isTrue (by simp_all [G]) else .isFalse (by simp_all [G])
| (.inl a, .inl b) | (.inr b, .inr a) => .isFalse (by simp_all [G])
theorem bipartite_edge {α β : Type} {G : SimpleGraph (α ⊕ β)} (hbip : G ≤ completeBipartiteGraph α β) (e : Sym2 (α ⊕ β)) (he : e ∈ G.edgeSet)
: ∃ (a : α) (b : β), e = s(Sum.inl a, Sum.inr b) := by
obtain ⟨u,v,h⟩ : ∃ u v, e = s(u,v) := by
rw [<-Sym2.exists]
use e
subst e
rw [mem_edgeSet] at he
have : (completeBipartiteGraph α β).Adj u v := by
exact le_iff_adj.mp hbip _ _ he
apply Or.elim this
· intro ⟨h1, h2⟩
use u.getLeft h1, v.getRight h2
grind
· intro ⟨h1, h2⟩
use v.getLeft h2, u.getRight h1
grind
theorem G.bipartite : G n r ≤ completeBipartiteGraph _ _ := by
rw [le_iff_adj]
intro u v hadj
grind [G, completeBipartiteGraph_adj]
theorem G.card_edgeFinset : #(G n r).edgeFinset = Nat.choose (n+1) (r+1) := by
rw [show n+1 = #(Icc 0 n) by simp, <-card_powersetCard, eq_comm]
apply card_bij (fun s h => s(.inl ⟨s, h⟩, .inr ⟨eraseMin s, by grind only [eraseMin_mem_powersetCard]⟩))
· intro s hs
rw [mem_edgeFinset, mem_edgeSet]
simp [G]
· simp_all
· intro e he
rw [mem_edgeFinset] at he
let ⟨a, b, h⟩ := bipartite_edge (G.bipartite n r) _ he
subst e
rw [mem_edgeSet, G] at he
grind
theorem G.degree_b (rpos : 1 ≤ r) (b : powersetCard r (Icc 1 n)) : (G n r).degree (Sum.inr b) = b.val.min := by
match hm : b.val.min with
| none =>
rw [WithTop.none_eq_top, Finset.min_eq_top] at hm
grind only [= mem_powersetCard, = card_empty]
| some m =>
have h_bd : ∀ x ∈ b.val, m ≤ x := by
intro x hx
apply Finset.min_le_of_eq hx
exact hm
have mmem : m ∈ b.val := by
apply Finset.mem_of_min
exact hm
have h_bd' : m ≤ n := by
grind only [= mem_powersetCard, = subset_iff, = mem_Icc]
congr
rw [degree, <-Finset.card_range m, eq_comm]
apply card_bij (fun i hi => Sum.inl ⟨insert i b.val, by grind⟩)
· intro i hi
rw [mem_neighborFinset, G]
grind [eraseMin_insert]
· intro i1 hi1 i2 hi2 e
simp only [Sum.inl.injEq, Subtype.mk.injEq] at e
apply (insert_inj _).mp e
grind only [= mem_range]
· intro v hv
rw [mem_neighborFinset, G] at hv
simp only at hv
split at hv
· simp_all
· expose_names
simp only [Prod.mk.injEq, Sum.inr.injEq] at heq
have := heq.left
have := heq.right
subst b_1 v
simp_rw [<-hv]
have ane : a.val.Nonempty := by
grind only [= mem_powersetCard, card_ne_zero]
use a.val.min' ane, ?_
· rw [Sum.inl.injEq, <-Subtype.val_inj]
simp
· simp only [mem_range]
apply Finset.min'_lt_of_mem_erase_min'
unfold eraseMin at hv
simp only [ane, ↓reduceDIte] at hv
simp_rw [hv]
exact mmem
· contradiction
theorem imo1981_p2 (rpos : 1 ≤ r) (hrn : r ≤ n) : F n r = (n+1)/(r+1) := by
have npos : 1 ≤ n := by omega
unfold F arith_mean
simp
conv =>
enter [1, 1]
norm_cast
arg 1
rw [<-Finset.sum_attach]
arg 2
intro v
rw [<-G.degree_b _ _ rpos, <-WithTop.coe_natCast, WithTop.some, Option.getD_some, Nat.cast_id, <-Function.Embedding.inr_apply]
conv =>
enter [1, 1, 1]
rw [<-Finset.sum_map _ Function.Embedding.inr (fun v => (G n r).degree v)]
rw [isBipartiteWith_sum_degrees_eq_card_edges' (s:=Finset.univ.map Function.Embedding.inl) ?bip]
case bip => tactic =>
unfold G
constructor
· simp [Set.disjoint_range_iff]
· intro u v adj
simp
grind
rw [G.card_edgeFinset]
rw [<-mul_div_mul_left (c:=↑(n+1)) _ _ (by grind only), <-Nat.cast_mul, <-Nat.cast_mul, Nat.add_one_mul_choose_eq]
qify
have : (n + 1).choose (r + 1) ≠ 0 := by
rw [Nat.choose_ne_zero_iff]
omega
field
end Imo1981P2 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1981P2.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown identifier 'min'_eq_iff'", "`grind` failed\ncase grind.1\nn r : \u2115\ns : Finset \u2115\nh : s \u2208 powersetCard (r + 1) (Icc 0 n)\nleft : #(eraseMin s) = r\nright : 0 \u2209 eraseMin s\nh_1 : eraseMin s \u2209 powersetCard r (Icc 1 n)\nh_2 : s.Nonempty\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] s \u2208 powersetCard (r + 1) (Icc 0 n)\n [prop] #(eraseMin s) = r\n [prop] 0 \u2209 eraseMin s\n [prop] eraseMin s \u2209 powersetCard r (Icc 1 n)\n [prop] eraseMin s = if h : s.Nonempty then s.erase (s.min' h) else s\n [prop] s.Nonempty\n [eqc] True propositions\n [prop] s \u2208 powersetCard (r + 1) (Icc 0 n)\n [prop] s.Nonempty\n [eqc] False propositions\n [prop] 0 \u2208 eraseMin s\n [prop] eraseMin s \u2208 powersetCard r (Icc 1 n)\n [eqc] Equivalence classes\n [eqc] {eraseMin s, s.erase (s.min' \u22ef), if h : s.Nonempty then s.erase (s.min' h) else s}\n [eqc] {#(eraseMin s), r}\n [cases] Case analyses\n [cases] [1/2]: if h : s.Nonempty then s.erase (s.min' h) else s\n [ematch] E-matching patterns\n [thm] eraseMin.eq_1: [eraseMin #0]\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [cutsat] Assignment satisfying linear constraints\n [assign] n := 2\n [assign] r := 0\n [assign] #(eraseMin s) := 0\n [assign] s.min' \u22ef := 3\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n powersetCard r (Icc 1 n)\n has type\n Finset (Finset \u2115) : Type\n but is expected to have type\n Std.ExtDHashMap (Finset \u2115) ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n eraseMin s\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n powersetCard (r + 1) (Icc 0 n)\n has type\n Finset (Finset \u2115) : Type\n but is expected to have type\n Std.ExtDHashMap (Finset \u2115) ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n powersetCard r (Icc 1 n)\n has type\n Finset (Finset \u2115) : Type\n but is expected to have type\n Std.DHashMap (Finset \u2115) ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n eraseMin s\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n powersetCard (r + 1) (Icc 0 n)\n has type\n Finset (Finset \u2115) : Type\n but is expected to have type\n Std.DHashMap (Finset \u2115) ?\u03b2 : Type\n[grind] Diagnostics\n [thm] E-Matching instances\n [thm] eraseMin.eq_1 \u21a6 1", "unknown identifier 'min'_eq_iff'", "unknown constant 'nonempty_def'", "`grind` failed\ncase grind.1.3.3\nn r : \u2115\nh :\n \u00acSymmetric fun u v =>\n match (u, v) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\nw : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) } \u2295 { x // x \u2208 powersetCard r (Icc 1 n) }\nh_1 :\n \u00ac(fun x =>\n match (x, w) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False) =\n fun v =>\n match (w, v) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\nw_1 : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) } \u2295 { x // x \u2208 powersetCard r (Icc 1 n) }\nh_2 :\n (match (w_1, w) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False) =\n \u00acmatch (w, w_1) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\nleft :\n match (w_1, w) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\nright :\n \u00acmatch (w, w_1) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\nx : V n r \u00d7 V n r\nh_4 :\n \u2200 (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }) (b : { x // x \u2208 powersetCard r (Icc 1 n) }),\n x = (Sum.inl a, Sum.inr b) \u2192 False\nh_5 :\n \u2200 (b : { x // x \u2208 powersetCard r (Icc 1 n) }) (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }),\n x = (Sum.inr b, Sum.inl a) \u2192 False\nh_6 : (w_1, w) = x\nx_1 : V n r \u00d7 V n r\nh_7 :\n \u2200 (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }) (b : { x // x \u2208 powersetCard r (Icc 1 n) }),\n x_1 = (Sum.inl a, Sum.inr b) \u2192 False\nh_8 :\n \u2200 (b : { x // x \u2208 powersetCard r (Icc 1 n) }) (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }),\n x_1 = (Sum.inr b, Sum.inl a) \u2192 False\nh_9 : (w, w_1) = x_1\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] \u00acSymmetric fun u v =>\n match (u, v) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] ((fun y x =>\n (fun u v =>\n match (u, v) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False)\n x y) =\n fun u v =>\n match (u, v) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False) =\n Symmetric fun u v =>\n match (u, v) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] \u2203 x,\n \u00ac(fun x_2 =>\n match (x_2, x) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False) =\n fun v =>\n match (x, v) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] \u00ac(fun x =>\n match (x, w) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False) =\n fun v =>\n match (w, v) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] \u2203 x,\n (match (x, w) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False) =\n \u00acmatch (w, x) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] (match (w_1, w) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False) =\n \u00acmatch (w, w_1) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] (\u2200 (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }) (b : { x // x \u2208 powersetCard r (Icc 1 n) }),\n (w, w_1) = (Sum.inl a, Sum.inr b) \u2192 False) \u2192\n (\u2200 (b : { x // x \u2208 powersetCard r (Icc 1 n) }) (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }),\n (w, w_1) = (Sum.inr b, Sum.inl a) \u2192 False) \u2192\n \u00acmatch (w, w_1) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] (\u2200 (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }) (b : { x // x \u2208 powersetCard r (Icc 1 n) }),\n (w_1, w) = (Sum.inl a, Sum.inr b) \u2192 False) \u2192\n (\u2200 (b : { x // x \u2208 powersetCard r (Icc 1 n) }) (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }),\n (w_1, w) = (Sum.inr b, Sum.inl a) \u2192 False) \u2192\n \u00acmatch (w_1, w) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] match (w_1, w) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] \u00acmatch (w, w_1) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] \u2200 (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }) (b : { x // x \u2208 powersetCard r (Icc 1 n) }),\n x = (Sum.inl a, Sum.inr b) \u2192 False\n [prop] \u2200 (b : { x // x \u2208 powersetCard r (Icc 1 n) }) (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }),\n x = (Sum.inr b, Sum.inl a) \u2192 False\n [prop] (w_1, w) = x\n [prop] \u2200 (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }) (b : { x // x \u2208 powersetCard r (Icc 1 n) }),\n x_1 = (Sum.inl a, Sum.inr b) \u2192 False\n [prop] \u2200 (b : { x // x \u2208 powersetCard r (Icc 1 n) }) (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }),\n x_1 = (Sum.inr b, Sum.inl a) \u2192 False\n [prop] (w, w_1) = x_1\n [eqc] True propositions\n [prop] ((fun y x =>\n (fun u v =>\n match (u, v) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False)\n x y) =\n fun u v =>\n match (u, v) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False) =\n Symmetric fun u v =>\n match (u, v) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] \u2203 x,\n \u00ac(fun x_2 =>\n match (x_2, x) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False) =\n fun v =>\n match (x, v) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] \u2203 x,\n (match (x, w) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False) =\n \u00acmatch (w, x) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] (match (w_1, w) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False) =\n \u00acmatch (w, w_1) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] (\u2200 (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }) (b : { x // x \u2208 powersetCard r (Icc 1 n) }),\n (w, w_1) = (Sum.inl a, Sum.inr b) \u2192 False) \u2192\n (\u2200 (b : { x // x \u2208 powersetCard r (Icc 1 n) }) (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }),\n (w, w_1) = (Sum.inr b, Sum.inl a) \u2192 False) \u2192\n \u00acmatch (w, w_1) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] (\u2200 (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }) (b : { x // x \u2208 powersetCard r (Icc 1 n) }),\n (w_1, w) = (Sum.inl a, Sum.inr b) \u2192 False) \u2192\n (\u2200 (b : { x // x \u2208 powersetCard r (Icc 1 n) }) (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }),\n (w_1, w) = (Sum.inr b, Sum.inl a) \u2192 False) \u2192\n \u00acmatch (w_1, w) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] \u00acmatch (w, w_1) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] match (w_1, w) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] (\u2200 (b : { x // x \u2208 powersetCard r (Icc 1 n) }) (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }),\n (w, w_1) = (Sum.inr b, Sum.inl a) \u2192 False) \u2192\n \u00acmatch (w, w_1) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] \u2200 (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }) (b : { x // x \u2208 powersetCard r (Icc 1 n) }),\n x = (Sum.inl a, Sum.inr b) \u2192 False\n [prop] (fun x_0 =>\n \u2200 (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }) (b : { x // x \u2208 powersetCard r (Icc 1 n) }),\n x_0 = (Sum.inl a, Sum.inr b) \u2192 False)\n x\n [prop] \u2200 (b : { x // x \u2208 powersetCard r (Icc 1 n) }) (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }),\n x = (Sum.inr b, Sum.inl a) \u2192 False\n [prop] (fun x_0 =>\n \u2200 (b : { x // x \u2208 powersetCard r (Icc 1 n) }) (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }),\n x_0 = (Sum.inr b, Sum.inl a) \u2192 False)\n x\n [prop] \u2200 (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }) (b : { x // x \u2208 powersetCard r (Icc 1 n) }),\n x_1 = (Sum.inl a, Sum.inr b) \u2192 False\n [prop] (fun x_0 =>\n \u2200 (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }) (b : { x // x \u2208 powersetCard r (Icc 1 n) }),\n x_0 = (Sum.inl a, Sum.inr b) \u2192 False)\n x_1\n [prop] \u2200 (b : { x // x \u2208 powersetCard r (Icc 1 n) }) (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }),\n x_1 = (Sum.inr b, Sum.inl a) \u2192 False\n [prop] (fun x_0 =>\n \u2200 (b : { x // x \u2208 powersetCard r (Icc 1 n) }) (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }),\n x_0 = (Sum.inr b, Sum.inl a) \u2192 False)\n x_1\n [eqc] False propositions\n [prop] Symmetric fun u v =>\n match (u, v) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] (fun y x =>\n (fun u v =>\n match (u, v) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False)\n x y) =\n fun u v =>\n match (u, v) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] (fun x =>\n match (x, w) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False) =\n fun v =>\n match (w, v) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] match (w, w_1) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [prop] \u00acmatch (w_1, w) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [eqc] Equivalence classes\n [eqc] {x_1, (w, w_1), (x_1.1, x_1.2)}\n [eqc] {(x.1, x.2).2, w, x_1.1, (x_1.1, x_1.2).1, x.2}\n [eqc] {(x.1, x.2).1, w_1, x_1.2, (x_1.1, x_1.2).2, x.1}\n [eqc] {x, (w_1, w), (x.1, x.2)}\n [eqc] {\u2200 (b : { x // x \u2208 powersetCard r (Icc 1 n) }) (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }),\n (w_1, w) = (Sum.inr b, Sum.inl a) \u2192 False,\n (fun x_0 =>\n \u2200 (b : { x // x \u2208 powersetCard r (Icc 1 n) }) (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }),\n x_0 = (Sum.inr b, Sum.inl a) \u2192 False)\n (w_1, w)}\n [eqc] {\u2200 (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }) (b : { x // x \u2208 powersetCard r (Icc 1 n) }),\n (w_1, w) = (Sum.inl a, Sum.inr b) \u2192 False,\n (fun x_0 =>\n \u2200 (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }) (b : { x // x \u2208 powersetCard r (Icc 1 n) }),\n x_0 = (Sum.inl a, Sum.inr b) \u2192 False)\n (w_1, w)}\n [eqc] {\u2200 (b : { x // x \u2208 powersetCard r (Icc 1 n) }) (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }),\n (w, w_1) = (Sum.inr b, Sum.inl a) \u2192 False,\n (fun x_0 =>\n \u2200 (b : { x // x \u2208 powersetCard r (Icc 1 n) }) (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }),\n x_0 = (Sum.inr b, Sum.inl a) \u2192 False)\n (w, w_1)}\n [eqc] {\u2200 (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }) (b : { x // x \u2208 powersetCard r (Icc 1 n) }),\n (w, w_1) = (Sum.inl a, Sum.inr b) \u2192 False,\n (fun x_0 =>\n \u2200 (a : { x // x \u2208 powersetCard (r + 1) (Icc 0 n) }) (b : { x // x \u2208 powersetCard r (Icc 1 n) }),\n x_0 = (Sum.inl a, Sum.inr b) \u2192 False)\n (w, w_1)}\n [eqc] {fun x => x \u2208 powersetCard r (Icc 1 n), Membership.mem (powersetCard r (Icc 1 n))}\n [eqc] {fun x => x \u2208 powersetCard (r + 1) (Icc 0 n), Membership.mem (powersetCard (r + 1) (Icc 0 n))}\n [cases] Case analyses\n [cases] [1/1]: \u2203 x,\n \u00ac(fun x_2 =>\n match (x_2, x) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False) =\n fun v =>\n match (x, v) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [cases] [1/1]: \u2203 x,\n (match (x, w) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False) =\n \u00acmatch (w, x) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [cases] [1/2]: (match (w_1, w) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False) =\n \u00acmatch (w, w_1) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [cases] [3/3]: match (w_1, w) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [cases] [3/3]: match (w, w_1) with\n | (Sum.inl a, Sum.inr b) => eraseMin \u2191a = \u2191b\n | (Sum.inr b, Sum.inl a) => eraseMin \u2191a = \u2191b\n | x => False\n [ematch] E-matching patterns\n [thm] swap_eq_iff: [@Symmetric #1 #0]\n [thm] Imo1981P2.G.match_1.congr_eq_1: [G.match_1 #9 #8 #7 (@Lean.Grind.genPattern (Prod (Sum (@Subtype `[Finset\n \u2115] _) (@Subtype `[Finset\n \u2115] _)) (Sum (@Subtype `[Finset\n \u2115] _) (@Subtype `[Finset\n \u2115] _))) #0 #6 (@Prod.mk (Sum (@Subtype `[Finset\n \u2115] _) (@Subtype `[Finset\n \u2115] _)) (Sum (@Subtype `[Finset\n \u2115] _) (@Subtype `[Finset\n \u2115] _)) (@Sum.inl (@Subtype `[Finset\n \u2115] _) (@Subtype `[Finset\n \u2115] _) #2) (@Sum.inr (@Subtype `[Finset \u2115] _) (@Subtype `[Finset \u2115] _) #1))) #5 #4 #3]\n [thm] Imo1981P2.G.match_1.congr_eq_2: [G.match_1 #9 #8 #7 (@Lean.Grind.genPattern (Prod (Sum (@Subtype `[Finset\n \u2115] _) (@Subtype `[Finset\n \u2115] _)) (Sum (@Subtype `[Finset\n \u2115] _) (@Subtype `[Finset\n \u2115] _))) #0 #6 (@Prod.mk (Sum (@Subtype `[Finset\n \u2115] _) (@Subtype `[Finset\n \u2115] _)) (Sum (@Subtype `[Finset\n \u2115] _) (@Subtype `[Finset\n \u2115] _)) (@Sum.inr (@Subtype `[Finset\n \u2115] _) (@Subtype `[Finset\n \u2115] _) #2) (@Sum.inl (@Subtype `[Finset \u2115] _) (@Subtype `[Finset \u2115] _) #1))) #5 #4 #3]\n [thm] Imo1981P2.G.match_1.congr_eq_3: [G.match_1 #10 #9 #8 (@Lean.Grind.genPattern (Prod (Sum (@Subtype `[Finset\n \u2115] _) (@Subtype `[Finset\n \u2115] _)) (Sum (@Subtype `[Finset \u2115] _) (@Subtype `[Finset \u2115] _))) #2 #7 #3) #6 #5 #4]\n [cutsat] Assignment satisfying linear constraints\n [assign] n := 2\n [assign] r := 0\n[grind] Diagnostics\n [thm] E-Matching instances\n [thm] Imo1981P2.G.match_1.congr_eq_1 \u21a6 4\n [thm] Imo1981P2.G.match_1.congr_eq_2 \u21a6 4\n [thm] Imo1981P2.G.match_1.congr_eq_3 \u21a6 2\n [thm] swap_eq_iff \u21a6 1", "unknown identifier 'le_iff_adj.mp'", "`grind` failed\ncase grind\n\u03b1 \u03b2 : Type\nG : SimpleGraph (\u03b1 \u2295 \u03b2)\nhbip : G \u2264 completeBipartiteGraph \u03b1 \u03b2\nu v : \u03b1 \u2295 \u03b2\nhe : G.Adj u v\nthis : (completeBipartiteGraph \u03b1 \u03b2).Adj u v\nh1 : u.isLeft = true\nh2 : v.isRight = true\nh : \u00acQuot.mk (Sym2.Rel (\u03b1 \u2295 \u03b2)) (u, v) = Quot.mk (Sym2.Rel (\u03b1 \u2295 \u03b2)) (Sum.inl (u.getLeft \u22ef), Sum.inr (v.getRight \u22ef))\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] G \u2264 completeBipartiteGraph \u03b1 \u03b2\n [prop] G.Adj u v\n [prop] (completeBipartiteGraph \u03b1 \u03b2).Adj u v\n [prop] u.isLeft = true\n [prop] v.isRight = true\n [prop] \u00acQuot.mk (Sym2.Rel (\u03b1 \u2295 \u03b2)) (u, v) =\n Quot.mk (Sym2.Rel (\u03b1 \u2295 \u03b2)) (Sum.inl (u.getLeft \u22ef), Sum.inr (v.getRight \u22ef))\n [eqc] True propositions\n [prop] G \u2264 completeBipartiteGraph \u03b1 \u03b2\n [prop] G.Adj u v\n [prop] (completeBipartiteGraph \u03b1 \u03b2).Adj u v\n [prop] v.isRight = true\n [prop] u.isLeft = true\n [eqc] False propositions\n [prop] Quot.mk (Sym2.Rel (\u03b1 \u2295 \u03b2)) (u, v) =\n Quot.mk (Sym2.Rel (\u03b1 \u2295 \u03b2)) (Sum.inl (u.getLeft \u22ef), Sum.inr (v.getRight \u22ef))\n [eqc] Equivalence classes\n [eqc] {u.isLeft, v.isRight, true}", "`grind` failed\ncase grind\n\u03b1 \u03b2 : Type\nG : SimpleGraph (\u03b1 \u2295 \u03b2)\nhbip : G \u2264 completeBipartiteGraph \u03b1 \u03b2\nu v : \u03b1 \u2295 \u03b2\nhe : G.Adj u v\nthis : (completeBipartiteGraph \u03b1 \u03b2).Adj u v\nh1 : u.isRight = true\nh2 : v.isLeft = true\nh : \u00acQuot.mk (Sym2.Rel (\u03b1 \u2295 \u03b2)) (u, v) = Quot.mk (Sym2.Rel (\u03b1 \u2295 \u03b2)) (Sum.inl (v.getLeft \u22ef), Sum.inr (u.getRight \u22ef))\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] G \u2264 completeBipartiteGraph \u03b1 \u03b2\n [prop] G.Adj u v\n [prop] (completeBipartiteGraph \u03b1 \u03b2).Adj u v\n [prop] u.isRight = true\n [prop] v.isLeft = true\n [prop] \u00acQuot.mk (Sym2.Rel (\u03b1 \u2295 \u03b2)) (u, v) =\n Quot.mk (Sym2.Rel (\u03b1 \u2295 \u03b2)) (Sum.inl (v.getLeft \u22ef), Sum.inr (u.getRight \u22ef))\n [eqc] True propositions\n [prop] G \u2264 completeBipartiteGraph \u03b1 \u03b2\n [prop] G.Adj u v\n [prop] (completeBipartiteGraph \u03b1 \u03b2).Adj u v\n [prop] u.isRight = true\n [prop] v.isLeft = true\n [eqc] False propositions\n [prop] Quot.mk (Sym2.Rel (\u03b1 \u2295 \u03b2)) (u, v) =\n Quot.mk (Sym2.Rel (\u03b1 \u2295 \u03b2)) (Sum.inl (v.getLeft \u22ef), Sum.inr (u.getRight \u22ef))\n [eqc] Equivalence classes\n [eqc] {u.isRight, v.isLeft, true}", "unknown identifier 'le_iff_adj'", "unsolved goals\nn r : \u2115\n\u22a2 G n r \u2264 completeBipartiteGraph { x // x \u2208 powersetCard (r + 1) (Icc 0 n) } { x // x \u2208 powersetCard r (Icc 1 n) }", "`grind` failed\ncase grind\nn r : \u2115\nval : Finset \u2115\nproperty : val \u2208 powersetCard (r + 1) (Icc 0 n)\nval_1 : Finset \u2115\nproperty_1 : val_1 \u2208 powersetCard r (Icc 1 n)\nhe : eraseMin val = val_1\nh :\n \u2200 (x : Finset \u2115) (x_1 : x \u2208 powersetCard (r + 1) (Icc 0 n)),\n \u00acQuot.mk (Sym2.Rel ({ x // x \u2208 powersetCard (r + 1) (Icc 0 n) } \u2295 { x // x \u2208 powersetCard r (Icc 1 n) }))\n (Sum.inl \u27e8x, x_1\u27e9, Sum.inr \u27e8eraseMin x, \u22ef\u27e9) =\n Quot.mk (Sym2.Rel ({ x // x \u2208 powersetCard (r + 1) (Icc 0 n) } \u2295 { x // x \u2208 powersetCard r (Icc 1 n) }))\n (Sum.inl \u27e8val, property\u27e9, Sum.inr \u27e8val_1, property_1\u27e9)\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] val \u2208 powersetCard (r + 1) (Icc 0 n)\n [prop] val_1 \u2208 powersetCard r (Icc 1 n)\n [prop] eraseMin val = val_1\n [prop] \u2200 (x : Finset \u2115) (x_1 : x \u2208 powersetCard (r + 1) (Icc 0 n)),\n \u00acQuot.mk (Sym2.Rel ({ x // x \u2208 powersetCard (r + 1) (Icc 0 n) } \u2295 { x // x \u2208 powersetCard r (Icc 1 n) }))\n (Sum.inl \u27e8x, x_1\u27e9, Sum.inr \u27e8eraseMin x, \u22ef\u27e9) =\n Quot.mk (Sym2.Rel ({ x // x \u2208 powersetCard (r + 1) (Icc 0 n) } \u2295 { x // x \u2208 powersetCard r (Icc 1 n) }))\n (Sum.inl \u27e8val, property\u27e9, Sum.inr \u27e8val_1, property_1\u27e9)\n [eqc] True propositions\n [prop] val \u2208 powersetCard (r + 1) (Icc 0 n)\n [prop] val_1 \u2208 powersetCard r (Icc 1 n)\n [prop] \u2200 (x : Finset \u2115) (x_1 : x \u2208 powersetCard (r + 1) (Icc 0 n)),\n \u00acQuot.mk (Sym2.Rel ({ x // x \u2208 powersetCard (r + 1) (Icc 0 n) } \u2295 { x // x \u2208 powersetCard r (Icc 1 n) }))\n (Sum.inl \u27e8x, x_1\u27e9, Sum.inr \u27e8eraseMin x, \u22ef\u27e9) =\n Quot.mk (Sym2.Rel ({ x // x \u2208 powersetCard (r + 1) (Icc 0 n) } \u2295 { x // x \u2208 powersetCard r (Icc 1 n) }))\n (Sum.inl \u27e8val, property\u27e9, Sum.inr \u27e8val_1, property_1\u27e9)\n [eqc] Equivalence classes\n [eqc] {fun x => x \u2208 powersetCard (r + 1) (Icc 0 n), Membership.mem (powersetCard (r + 1) (Icc 0 n))}\n [eqc] {eraseMin val, val_1}\n [ematch] E-matching patterns\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [thm] h: [@Membership.mem `[Finset \u2115] `[Finset (Finset \u2115)] `[instMembership] `[powersetCard (r + 1) (Icc 0 n)] #1]\n [thm] h: [@Subtype.mk `[Finset \u2115] `[fun x => x \u2208 powersetCard (r + 1) (Icc 0 n)] #1 #0]\n [cutsat] Assignment satisfying linear constraints\n [assign] n := 2\n [assign] r := 0\n [assign] r + 1 := 3\n [assign] 1 := 1\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n powersetCard r (Icc 1 n)\n has type\n Finset (Finset \u2115) : Type\n but is expected to have type\n Std.ExtDHashMap (Finset \u2115) ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n powersetCard (r + 1) (Icc 0 n)\n has type\n Finset (Finset \u2115) : Type\n but is expected to have type\n Std.ExtDHashMap (Finset \u2115) ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n powersetCard r (Icc 1 n)\n has type\n Finset (Finset \u2115) : Type\n but is expected to have type\n Std.DHashMap (Finset \u2115) ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n powersetCard (r + 1) (Icc 0 n)\n has type\n Finset (Finset \u2115) : Type\n but is expected to have type\n Std.DHashMap (Finset \u2115) ?\u03b2 : Type\n[grind] Diagnostics\n [cases] Cases instances\n [cases] Subtype \u21a6 2", "`grind` failed\ncase grind.1\nn r : \u2115\nrpos : 1 \u2264 r\nval : Finset \u2115\nproperty : val \u2208 powersetCard r (Icc 1 n)\nm : \u2115\nhm : val.min = some m\nh_bd : \u2200 x \u2208 val, m \u2264 x\nmmem : m \u2208 val\nh_bd' : m \u2264 n\ni : \u2115\nhi : i \u2208 range m\nh : insert i val \u2209 powersetCard (r + 1) (Icc 0 n)\nh_1 : n = m\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] 1 \u2264 r\n [prop] val \u2208 powersetCard r (Icc 1 n)\n [prop] val.min = some m\n [prop] \u2200 x \u2208 val, m \u2264 x\n [prop] m \u2208 val\n [prop] m \u2264 n\n [prop] i \u2208 range m\n [prop] insert i val \u2209 powersetCard (r + 1) (Icc 0 n)\n [prop] n \u2208 val \u2192 m \u2264 n\n [prop] n = m\n [eqc] True propositions\n [prop] 1 \u2264 r\n [prop] val \u2208 powersetCard r (Icc 1 n)\n [prop] \u2200 x \u2208 val, m \u2264 x\n [prop] m \u2208 val\n [prop] m \u2264 n\n [prop] i \u2208 range m\n [prop] n \u2208 val \u2192 m \u2264 n\n [prop] n = m\n [prop] n \u2208 val\n [eqc] False propositions\n [prop] insert i val \u2208 powersetCard (r + 1) (Icc 0 n)\n [eqc] Equivalence classes\n [eqc] {\u2191n, \u2191m}\n [eqc] {n, m}\n [eqc] {val.min, some m}\n [cases] Case analyses\n [cases] [1/2]: n = m\n [ematch] E-matching patterns\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [thm] h_bd: [@Membership.mem `[\u2115] `[Finset \u2115] `[instMembership] `[val] #1]\n [thm] h_bd: [@LE.le `[\u2115] `[instLENat] `[m] #1]\n [cutsat] Assignment satisfying linear constraints\n [assign] n := 0\n [assign] r := 1\n [assign] m := 0\n [assign] i := 3\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n powersetCard (r + 1) (Icc 0 n)\n has type\n Finset (Finset \u2115) : Type\n but is expected to have type\n Std.ExtDHashMap (Finset \u2115) ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n range m\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n val\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n powersetCard r (Icc 1 n)\n has type\n Finset (Finset \u2115) : Type\n but is expected to have type\n Std.ExtDHashMap (Finset \u2115) ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n powersetCard (r + 1) (Icc 0 n)\n has type\n Finset (Finset \u2115) : Type\n but is expected to have type\n Std.DHashMap (Finset \u2115) ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n range m\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n val\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n powersetCard r (Icc 1 n)\n has type\n Finset (Finset \u2115) : Type\n but is expected to have type\n Std.DHashMap (Finset \u2115) ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n val\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n val\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type\n[grind] Diagnostics\n [cases] Cases instances\n [cases] Subtype \u21a6 1", "`grind` failed\ncase grind.1.1.1\nn r : \u2115\nrpos : 1 \u2264 r\nval : Finset \u2115\nproperty : val \u2208 powersetCard r (Icc 1 n)\nm : \u2115\nhm : val.min = some m\nh_bd : \u2200 x \u2208 val, m \u2264 x\nmmem : m \u2208 val\nh_bd' : m \u2264 n\ni : \u2115\nhi : i \u2208 range m\nh : \u00aceraseMin (insert i val) = val\nw : \u2115\nleft : w \u2208 val\nright : w \u2264 i\nh_2 : m = w\nh_3 : n = w\nh_4 : m = i\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] 1 \u2264 r\n [prop] val \u2208 powersetCard r (Icc 1 n)\n [prop] val.min = some m\n [prop] \u2200 x \u2208 val, m \u2264 x\n [prop] m \u2208 val\n [prop] m \u2264 n\n [prop] i \u2208 range m\n [prop] \u00aceraseMin (insert i val) = val\n [prop] (\u2203 a \u2208 val, a \u2264 i) \u2228 eraseMin (insert i val) = val\n [prop] n \u2208 val \u2192 m \u2264 n\n [prop] w \u2208 val\n [prop] w \u2264 i\n [prop] w \u2208 val \u2192 m \u2264 w\n [prop] m = w\n [prop] i \u2208 val \u2192 m \u2264 i\n [prop] n = w\n [prop] m = i\n [eqc] True propositions\n [prop] 1 \u2264 r\n [prop] val \u2208 powersetCard r (Icc 1 n)\n [prop] \u2200 x \u2208 val, m \u2264 x\n [prop] m \u2208 val\n [prop] m \u2264 n\n [prop] i \u2208 range m\n [prop] (\u2203 a \u2208 val, a \u2264 i) \u2228 eraseMin (insert i val) = val\n [prop] \u2203 a \u2208 val, a \u2264 i\n [prop] n \u2208 val \u2192 m \u2264 n\n [prop] w \u2208 val\n [prop] w \u2264 i\n [prop] w \u2208 val \u2192 m \u2264 w\n [prop] m \u2264 w\n [prop] m = w\n [prop] i \u2208 val \u2192 m \u2264 i\n [prop] m \u2264 i\n [prop] n = w\n [prop] n = m\n [prop] n \u2208 val\n [prop] i = w\n [prop] m = i\n [prop] n = i\n [prop] i \u2208 val\n [eqc] False propositions\n [prop] eraseMin (insert i val) = val\n [eqc] Equivalence classes\n [eqc] {\u2191m, \u2191n, \u2191i, \u2191w}\n [eqc] {m, n, i, w}\n [eqc] {val.min, some m}\n [cases] Case analyses\n [cases] [1/1]: \u2203 a \u2208 val, a \u2264 i\n [cases] [1/2]: m = w\n [cases] [1/2]: n = w\n [cases] [1/2]: m = i\n [ematch] E-matching patterns\n [thm] eraseMin_insert: [@insert `[\u2115] `[Finset \u2115] `[instInsert] #1 #2]\n [thm] Std.ExtDHashMap.contains_iff_mem: [@Membership.mem #7 _ _ #3 #0]\n [thm] Std.DHashMap.contains_iff_mem: [@Membership.mem #5 _ _ #1 #0]\n [thm] h_bd: [@Membership.mem `[\u2115] `[Finset \u2115] `[instMembership] `[val] #1]\n [thm] h_bd: [@LE.le `[\u2115] `[instLENat] `[m] #1]\n [cutsat] Assignment satisfying linear constraints\n [assign] n := 0\n [assign] r := 1\n [assign] m := 0\n [assign] i := 0\n [assign] w := 0\n[grind] Issues\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n range m\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n val\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n powersetCard r (Icc 1 n)\n has type\n Finset (Finset \u2115) : Type\n but is expected to have type\n Std.ExtDHashMap (Finset \u2115) ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n range m\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n val\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n powersetCard r (Icc 1 n)\n has type\n Finset (Finset \u2115) : Type\n but is expected to have type\n Std.DHashMap (Finset \u2115) ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n val\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n val\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n val\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n val\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.ExtDHashMap.contains_iff_mem\n when assigning metavariable ?m with \n val\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.ExtDHashMap \u2115 ?\u03b2 : Type\n [issue] type error constructing proof for Std.DHashMap.contains_iff_mem\n when assigning metavariable ?m with \n val\n has type\n Finset \u2115 : Type\n but is expected to have type\n Std.DHashMap \u2115 ?\u03b2 : Type\n[grind] Diagnostics\n [thm] E-Matching instances\n [thm] eraseMin_insert \u21a6 1\n [cases] Cases instances\n [cases] Subtype \u21a6 1", "unknown tactic", "unsolved goals\nn r : \u2115\nrpos : 1 \u2264 r\nhrn : r \u2264 n\n\u22a2 1 \u2264 n", "unsolved goals\nn r : \u2115\nrpos : 1 \u2264 r\nhrn : r \u2264 n\nnpos : 1 \u2264 n\n\u22a2 F n r = (\u2191n + 1) / (\u2191r + 1)"], "timeout_s": 600.0, "latency_s": 7.0621, "verified_at": "2026-03-26T18:16:51.291306+00:00"}} | false | true | false | 7.0621 |
compfiles_Imo1981P3 | compfiles | Copyright (c) 2020 Kevin Lacker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Lacker
-/
import Mathlib
open Int Nat Set
namespace Imo1981P3
/-!
# International Mathematical Olympiad 1981, Problem 3
Determine the maximum value of `m ^ 2 + n ^ 2`, where `m` and `n` are integers in
`{1, 2, ..., 1981}` and `(n ^ 2 - m * n - m ^ 2) ^ 2 = 1`.
-/
/-
We generalize the problem to `{1, 2, ..., N}` and then specialize to `N = 1981`.
-/
variable (N : ℕ)
-- N = 1981
@[mk_iff]
structure ProblemPredicate (m n : ℤ) : Prop where
m_range : m ∈ Ioc 0 (N : ℤ)
n_range : n ∈ Ioc 0 (N : ℤ)
eq_one : (n ^ 2 - m * n - m ^ 2) ^ 2 = 1
def specifiedSet : Set ℤ :=
{k : ℤ | ∃ m : ℤ, ∃ n : ℤ, k = m ^ 2 + n ^ 2 ∧ ProblemPredicate N m n}
/-
The trick to this problem is that `m` and `n` have to be consecutive Fibonacci numbers,
because you can reduce any solution to a smaller one using the Fibonacci recurrence.
-/
/-
We want to reduce every solution to a smaller solution. Specifically,
we show that when `(m, n)` is a solution, `(n - m, m)` is also a solution,
except for the base case of `(1, 1)`.
-/
namespace ProblemPredicate
variable {N}
theorem m_le_n {m n : ℤ} (h1 : ProblemPredicate N m n) : m ≤ n := by
by_contra h2
have h3 : 1 = (n * (n - m) - m ^ 2) ^ 2 := by linear_combination - h1.eq_one
have h4 : n * (n - m) - m ^ 2 < -1 := by nlinarith [h1.n_range.left]
have h5 : 1 < (n * (n - m) - m ^ 2) ^ 2 := by nlinarith
exact h5.ne h3
theorem eq_imp_1 {n : ℤ} (h1 : ProblemPredicate N n n) : n = 1 :=
have : n * (n * (n * n)) = 1 := by linear_combination h1.eq_one
eq_one_of_mul_eq_one_right h1.m_range.left.le this
theorem reduction {m n : ℤ} (h1 : ProblemPredicate N m n) (h2 : 1 < n) :
ProblemPredicate N (n - m) m := by
obtain (rfl : m = n) | (h3 : m < n) := h1.m_le_n.eq_or_lt
· have h4 : m = 1 := h1.eq_imp_1
exact absurd h4.symm h2.ne
exact
{ n_range := h1.m_range
m_range := by
have h5 : 0 < n - m := sub_pos.mpr h3
have h6 : n - m < N := by
calc
_ < n := sub_lt_self n h1.m_range.left
_ ≤ N := h1.n_range.right
exact ⟨h5, h6.le⟩
eq_one := by linear_combination h1.eq_one }
end ProblemPredicate
/-
It will be convenient to have the lemmas above in their natural number form.
Most of these can be proved with the `norm_cast` family of tactics.
-/
def NatPredicate (m n : ℕ) : Prop :=
ProblemPredicate N ↑m ↑n
namespace NatPredicate
variable {N}
nonrec theorem m_le_n {m n : ℕ} (h1 : NatPredicate N m n) : m ≤ n := mod_cast h1.m_le_n
nonrec theorem eq_imp_1 {n : ℕ} (h1 : NatPredicate N n n) : n = 1 := mod_cast h1.eq_imp_1
nonrec theorem reduction {m n : ℕ} (h1 : NatPredicate N m n) (h2 : 1 < n) :
NatPredicate N (n - m) m := by
have : m ≤ n := h1.m_le_n
exact mod_cast h1.reduction (mod_cast h2)
theorem n_pos {m n : ℕ} (h1 : NatPredicate N m n) : 0 < n := mod_cast h1.n_range.left
theorem m_pos {m n : ℕ} (h1 : NatPredicate N m n) : 0 < m := mod_cast h1.m_range.left
theorem n_le_N {m n : ℕ} (h1 : NatPredicate N m n) : n ≤ N := mod_cast h1.n_range.right
/-
Now we can use induction to show that solutions must be Fibonacci numbers.
-/
theorem imp_fib {n : ℕ} : ∀ m : ℕ, NatPredicate N m n → ∃ k : ℕ, m = fib k ∧ n = fib (k + 1) := by
refine Nat.strong_induction_on n ?_
intro n h1 m h2
have h3 : m ≤ n := h2.m_le_n
obtain (rfl : 1 = n) | (h4 : 1 < n) := (succ_le_iff.mpr h2.n_pos).eq_or_lt
· use 1
have h5 : 1 ≤ m := succ_le_iff.mpr h2.m_pos
simpa [fib_one, fib_two, (by decide : 1 + 1 = 2)] using (h3.antisymm h5 : m = 1)
· obtain (rfl : m = n) | (h6 : m < n) := h3.eq_or_lt
· exact absurd h2.eq_imp_1 (Nat.ne_of_gt h4)
· have h7 : NatPredicate N (n - m) m := h2.reduction h4
obtain ⟨k : ℕ, hnm : n - m = fib k, rfl : m = fib (k + 1)⟩ := h1 m h6 (n - m) h7
use k + 1, rfl
rw [fib_add_two, ← hnm, tsub_add_cancel_of_le h3]
end NatPredicate
/-
Next, we prove that if `N < fib K + fib (K+1)`, then the largest `m` and `n`
satisfying `NatPredicate m n N` are `fib K` and `fib (K+1)`, respectively.
-/
variable {K : ℕ} (HK : N < fib K + fib (K + 1)) {N}
include HK in
theorem m_n_bounds {m n : ℕ} (h1 : NatPredicate N m n) : m ≤ fib K ∧ n ≤ fib (K + 1) := by
obtain ⟨k : ℕ, hm : m = fib k, hn : n = fib (k + 1)⟩ := h1.imp_fib m
by_cases h2 : k < K + 1
· have h3 : k ≤ K := Nat.lt_succ_iff.mp h2
constructor
· calc
m = fib k := hm
_ ≤ fib K := fib_mono h3
· have h6 : k + 1 ≤ K + 1 := succ_le_succ h3
calc
n = fib (k + 1) := hn
_ ≤ fib (K + 1) := fib_mono h6
· have h7 : N < n := by
have h8 : K + 2 ≤ k + 1 := succ_le_succ (not_lt.mp h2)
rw [← fib_add_two] at HK
calc
N < fib (K + 2) := HK
_ ≤ fib (k + 1) := (fib_mono h8)
_ = n := hn.symm
have h9 : n ≤ N := h1.n_le_N
exact absurd h7 h9.not_gt
/-
We spell out the consequences of this result for `specifiedSet N` here.
-/
variable {M : ℕ} (HM : M = fib K ^ 2 + fib (K + 1) ^ 2)
include HM HK in
theorem k_bound {m n : ℤ} (h1 : ProblemPredicate N m n) : m ^ 2 + n ^ 2 ≤ M := by
have h2 : 0 ≤ m := h1.m_range.left.le
have h3 : 0 ≤ n := h1.n_range.left.le
rw [← natAbs_of_nonneg h2, ← natAbs_of_nonneg h3] at h1; clear h2 h3
obtain ⟨h4 : m.natAbs ≤ fib K, h5 : n.natAbs ≤ fib (K + 1)⟩ := m_n_bounds HK h1
have h6 : m ^ 2 ≤ (fib K : ℤ) ^ 2 := Int.natAbs_le_iff_sq_le.mp h4
have h7 : n ^ 2 ≤ (fib (K + 1) : ℤ) ^ 2 := Int.natAbs_le_iff_sq_le.mp h5
linarith
include HM HK in
theorem solution_bound : ∀ {k : ℤ}, k ∈ specifiedSet N → k ≤ M
| _, ⟨_, _, rfl, h⟩ => k_bound HK HM h
include HM HK in
theorem solution_greatest (H : ProblemPredicate N (fib K) (fib (K + 1))) :
IsGreatest (specifiedSet N) M :=
⟨⟨fib K, fib (K + 1), by simp [HM], H⟩, fun k h => solution_bound HK HM h⟩
/-
Now we just have to demonstrate that 987 and 1597 are in fact the largest Fibonacci
numbers in this range, and thus provide the maximum of `specifiedSet`.
-/
abbrev solution : ℕ := 3524578
theorem imo1981_p3 : IsGreatest (specifiedSet 1981) solution := by
have := fun h => @solution_greatest 1981 16 h solution
norm_num at this
apply this
· decide
· decide
· norm_num [problemPredicate_iff]; decide
end Imo1981P3 | /- | /-
Copyright (c) 2020 Kevin Lacker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Lacker
-/
import Mathlib
open Int Nat Set
namespace Imo1981P3
/-!
# International Mathematical Olympiad 1981, Problem 3
Determine the maximum value of `m ^ 2 + n ^ 2`, where `m` and `n` are integers in
`{1, 2, ..., 1981}` and `(n ^ 2 - m * n - m ^ 2) ^ 2 = 1`.
-/
/-
We generalize the problem to `{1, 2, ..., N}` and then specialize to `N = 1981`.
-/
variable (N : ℕ)
-- N = 1981
@[mk_iff]
structure ProblemPredicate (m n : ℤ) : Prop where
m_range : m ∈ Ioc 0 (N : ℤ)
n_range : n ∈ Ioc 0 (N : ℤ)
eq_one : (n ^ 2 - m * n - m ^ 2) ^ 2 = 1
def specifiedSet : Set ℤ :=
{k : ℤ | ∃ m : ℤ, ∃ n : ℤ, k = m ^ 2 + n ^ 2 ∧ ProblemPredicate N m n}
/-
The trick to this problem is that `m` and `n` have to be consecutive Fibonacci numbers,
because you can reduce any solution to a smaller one using the Fibonacci recurrence.
-/
/-
We want to reduce every solution to a smaller solution. Specifically,
we show that when `(m, n)` is a solution, `(n - m, m)` is also a solution,
except for the base case of `(1, 1)`.
-/
namespace ProblemPredicate
variable {N}
theorem m_le_n {m n : ℤ} (h1 : ProblemPredicate N m n) : m ≤ n := by
by_contra h2
have h3 : 1 = (n * (n - m) - m ^ 2) ^ 2 := by linear_combination - h1.eq_one
have h4 : n * (n - m) - m ^ 2 < -1 := by nlinarith [h1.n_range.left]
have h5 : 1 < (n * (n - m) - m ^ 2) ^ 2 := by nlinarith
exact h5.ne h3
theorem eq_imp_1 {n : ℤ} (h1 : ProblemPredicate N n n) : n = 1 :=
have : n * (n * (n * n)) = 1 := by linear_combination h1.eq_one
eq_one_of_mul_eq_one_right h1.m_range.left.le this
theorem reduction {m n : ℤ} (h1 : ProblemPredicate N m n) (h2 : 1 < n) :
ProblemPredicate N (n - m) m := by
obtain (rfl : m = n) | (h3 : m < n) := h1.m_le_n.eq_or_lt
· have h4 : m = 1 := h1.eq_imp_1
exact absurd h4.symm h2.ne
exact
{ n_range := h1.m_range
m_range := by
have h5 : 0 < n - m := sub_pos.mpr h3
have h6 : n - m < N := by
calc
_ < n := sub_lt_self n h1.m_range.left
_ ≤ N := h1.n_range.right
exact ⟨h5, h6.le⟩
eq_one := by linear_combination h1.eq_one }
end ProblemPredicate
/-
It will be convenient to have the lemmas above in their natural number form.
Most of these can be proved with the `norm_cast` family of tactics.
-/
def NatPredicate (m n : ℕ) : Prop :=
ProblemPredicate N ↑m ↑n
namespace NatPredicate
variable {N}
nonrec theorem m_le_n {m n : ℕ} (h1 : NatPredicate N m n) : m ≤ n := mod_cast h1.m_le_n
nonrec theorem eq_imp_1 {n : ℕ} (h1 : NatPredicate N n n) : n = 1 := mod_cast h1.eq_imp_1
nonrec theorem reduction {m n : ℕ} (h1 : NatPredicate N m n) (h2 : 1 < n) :
NatPredicate N (n - m) m := by
have : m ≤ n := h1.m_le_n
exact mod_cast h1.reduction (mod_cast h2)
theorem n_pos {m n : ℕ} (h1 : NatPredicate N m n) : 0 < n := mod_cast h1.n_range.left
theorem m_pos {m n : ℕ} (h1 : NatPredicate N m n) : 0 < m := mod_cast h1.m_range.left
theorem n_le_N {m n : ℕ} (h1 : NatPredicate N m n) : n ≤ N := mod_cast h1.n_range.right
/-
Now we can use induction to show that solutions must be Fibonacci numbers.
-/
theorem imp_fib {n : ℕ} : ∀ m : ℕ, NatPredicate N m n → ∃ k : ℕ, m = fib k ∧ n = fib (k + 1) := by
refine Nat.strong_induction_on n ?_
intro n h1 m h2
have h3 : m ≤ n := h2.m_le_n
obtain (rfl : 1 = n) | (h4 : 1 < n) := (succ_le_iff.mpr h2.n_pos).eq_or_lt
· use 1
have h5 : 1 ≤ m := succ_le_iff.mpr h2.m_pos
simpa [fib_one, fib_two, (by decide : 1 + 1 = 2)] using (h3.antisymm h5 : m = 1)
· obtain (rfl : m = n) | (h6 : m < n) := h3.eq_or_lt
· exact absurd h2.eq_imp_1 (Nat.ne_of_gt h4)
· have h7 : NatPredicate N (n - m) m := h2.reduction h4
obtain ⟨k : ℕ, hnm : n - m = fib k, rfl : m = fib (k + 1)⟩ := h1 m h6 (n - m) h7
use k + 1, rfl
rw [fib_add_two, ← hnm, tsub_add_cancel_of_le h3]
end NatPredicate
/-
Next, we prove that if `N < fib K + fib (K+1)`, then the largest `m` and `n`
satisfying `NatPredicate m n N` are `fib K` and `fib (K+1)`, respectively.
-/
variable {K : ℕ} (HK : N < fib K + fib (K + 1)) {N}
include HK in
theorem m_n_bounds {m n : ℕ} (h1 : NatPredicate N m n) : m ≤ fib K ∧ n ≤ fib (K + 1) := by
obtain ⟨k : ℕ, hm : m = fib k, hn : n = fib (k + 1)⟩ := h1.imp_fib m
by_cases h2 : k < K + 1
· have h3 : k ≤ K := Nat.lt_succ_iff.mp h2
constructor
· calc
m = fib k := hm
_ ≤ fib K := fib_mono h3
· have h6 : k + 1 ≤ K + 1 := succ_le_succ h3
calc
n = fib (k + 1) := hn
_ ≤ fib (K + 1) := fib_mono h6
· have h7 : N < n := by
have h8 : K + 2 ≤ k + 1 := succ_le_succ (not_lt.mp h2)
rw [← fib_add_two] at HK
calc
N < fib (K + 2) := HK
_ ≤ fib (k + 1) := (fib_mono h8)
_ = n := hn.symm
have h9 : n ≤ N := h1.n_le_N
exact absurd h7 h9.not_gt
/-
We spell out the consequences of this result for `specifiedSet N` here.
-/
variable {M : ℕ} (HM : M = fib K ^ 2 + fib (K + 1) ^ 2)
include HM HK in
theorem k_bound {m n : ℤ} (h1 : ProblemPredicate N m n) : m ^ 2 + n ^ 2 ≤ M := by
have h2 : 0 ≤ m := h1.m_range.left.le
have h3 : 0 ≤ n := h1.n_range.left.le
rw [← natAbs_of_nonneg h2, ← natAbs_of_nonneg h3] at h1; clear h2 h3
obtain ⟨h4 : m.natAbs ≤ fib K, h5 : n.natAbs ≤ fib (K + 1)⟩ := m_n_bounds HK h1
have h6 : m ^ 2 ≤ (fib K : ℤ) ^ 2 := Int.natAbs_le_iff_sq_le.mp h4
have h7 : n ^ 2 ≤ (fib (K + 1) : ℤ) ^ 2 := Int.natAbs_le_iff_sq_le.mp h5
linarith
include HM HK in
theorem solution_bound : ∀ {k : ℤ}, k ∈ specifiedSet N → k ≤ M
| _, ⟨_, _, rfl, h⟩ => k_bound HK HM h
include HM HK in
theorem solution_greatest (H : ProblemPredicate N (fib K) (fib (K + 1))) :
IsGreatest (specifiedSet N) M :=
⟨⟨fib K, fib (K + 1), by simp [HM], H⟩, fun k h => solution_bound HK HM h⟩
/-
Now we just have to demonstrate that 987 and 1597 are in fact the largest Fibonacci
numbers in this range, and thus provide the maximum of `specifiedSet`.
-/
abbrev solution : ℕ := 3524578
theorem imo1981_p3 : IsGreatest (specifiedSet 1981) solution := by
have := fun h => @solution_greatest 1981 16 h solution
norm_num at this
apply this
· decide
· decide
· norm_num [problemPredicate_iff]; decide
end Imo1981P3
| true | Copyright (c) 2020 Kevin Lacker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Lacker
-/
import Mathlib
open Int Nat Set
namespace Imo1981P3
/-!
# International Mathematical Olympiad 1981, Problem 3
Determine the maximum value of `m ^ 2 + n ^ 2`, where `m` and `n` are integers in
`{1, 2, ..., 1981}` and `(n ^ 2 - m * n - m ^ 2) ^ 2 = 1`.
-/
/-
We generalize the problem to `{1, 2, ..., N}` and then specialize to `N = 1981`.
-/
variable (N : ℕ)
-- N = 1981
@[mk_iff]
structure ProblemPredicate (m n : ℤ) : Prop where
m_range : m ∈ Ioc 0 (N : ℤ)
n_range : n ∈ Ioc 0 (N : ℤ)
eq_one : (n ^ 2 - m * n - m ^ 2) ^ 2 = 1
def specifiedSet : Set ℤ :=
{k : ℤ | ∃ m : ℤ, ∃ n : ℤ, k = m ^ 2 + n ^ 2 ∧ ProblemPredicate N m n}
/-
The trick to this problem is that `m` and `n` have to be consecutive Fibonacci numbers,
because you can reduce any solution to a smaller one using the Fibonacci recurrence.
-/
/-
We want to reduce every solution to a smaller solution. Specifically,
we show that when `(m, n)` is a solution, `(n - m, m)` is also a solution,
except for the base case of `(1, 1)`.
-/
namespace ProblemPredicate
variable {N}
theorem m_le_n {m n : ℤ} (h1 : ProblemPredicate N m n) : m ≤ n := by
by_contra h2
have h3 : 1 = (n * (n - m) - m ^ 2) ^ 2 := by linear_combination - h1.eq_one
have h4 : n * (n - m) - m ^ 2 < -1 := by nlinarith [h1.n_range.left]
have h5 : 1 < (n * (n - m) - m ^ 2) ^ 2 := by nlinarith
exact h5.ne h3
theorem eq_imp_1 {n : ℤ} (h1 : ProblemPredicate N n n) : n = 1 :=
have : n * (n * (n * n)) = 1 := by linear_combination h1.eq_one
eq_one_of_mul_eq_one_right h1.m_range.left.le this
theorem reduction {m n : ℤ} (h1 : ProblemPredicate N m n) (h2 : 1 < n) :
ProblemPredicate N (n - m) m := by
obtain (rfl : m = n) | (h3 : m < n) := h1.m_le_n.eq_or_lt
· have h4 : m = 1 := h1.eq_imp_1
exact absurd h4.symm h2.ne
exact
{ n_range := h1.m_range
m_range := by
have h5 : 0 < n - m := sub_pos.mpr h3
have h6 : n - m < N := by
calc
_ < n := sub_lt_self n h1.m_range.left
_ ≤ N := h1.n_range.right
exact ⟨h5, h6.le⟩
eq_one := by linear_combination h1.eq_one }
end ProblemPredicate
/-
It will be convenient to have the lemmas above in their natural number form.
Most of these can be proved with the `norm_cast` family of tactics.
-/
def NatPredicate (m n : ℕ) : Prop :=
ProblemPredicate N ↑m ↑n
namespace NatPredicate
variable {N}
nonrec theorem m_le_n {m n : ℕ} (h1 : NatPredicate N m n) : m ≤ n := mod_cast h1.m_le_n
nonrec theorem eq_imp_1 {n : ℕ} (h1 : NatPredicate N n n) : n = 1 := mod_cast h1.eq_imp_1
nonrec theorem reduction {m n : ℕ} (h1 : NatPredicate N m n) (h2 : 1 < n) :
NatPredicate N (n - m) m := by
have : m ≤ n := h1.m_le_n
exact mod_cast h1.reduction (mod_cast h2)
theorem n_pos {m n : ℕ} (h1 : NatPredicate N m n) : 0 < n := mod_cast h1.n_range.left
theorem m_pos {m n : ℕ} (h1 : NatPredicate N m n) : 0 < m := mod_cast h1.m_range.left
theorem n_le_N {m n : ℕ} (h1 : NatPredicate N m n) : n ≤ N := mod_cast h1.n_range.right
/-
Now we can use induction to show that solutions must be Fibonacci numbers.
-/
theorem imp_fib {n : ℕ} : ∀ m : ℕ, NatPredicate N m n → ∃ k : ℕ, m = fib k ∧ n = fib (k + 1) := by
refine Nat.strong_induction_on n ?_
intro n h1 m h2
have h3 : m ≤ n := h2.m_le_n
obtain (rfl : 1 = n) | (h4 : 1 < n) := (succ_le_iff.mpr h2.n_pos).eq_or_lt
· use 1
have h5 : 1 ≤ m := succ_le_iff.mpr h2.m_pos
simpa [fib_one, fib_two, (by decide : 1 + 1 = 2)] using (h3.antisymm h5 : m = 1)
· obtain (rfl : m = n) | (h6 : m < n) := h3.eq_or_lt
· exact absurd h2.eq_imp_1 (Nat.ne_of_gt h4)
· have h7 : NatPredicate N (n - m) m := h2.reduction h4
obtain ⟨k : ℕ, hnm : n - m = fib k, rfl : m = fib (k + 1)⟩ := h1 m h6 (n - m) h7
use k + 1, rfl
rw [fib_add_two, ← hnm, tsub_add_cancel_of_le h3]
end NatPredicate
/-
Next, we prove that if `N < fib K + fib (K+1)`, then the largest `m` and `n`
satisfying `NatPredicate m n N` are `fib K` and `fib (K+1)`, respectively.
-/
variable {K : ℕ} (HK : N < fib K + fib (K + 1)) {N}
include HK in
theorem m_n_bounds {m n : ℕ} (h1 : NatPredicate N m n) : m ≤ fib K ∧ n ≤ fib (K + 1) := by
obtain ⟨k : ℕ, hm : m = fib k, hn : n = fib (k + 1)⟩ := h1.imp_fib m
by_cases h2 : k < K + 1
· have h3 : k ≤ K := Nat.lt_succ_iff.mp h2
constructor
· calc
m = fib k := hm
_ ≤ fib K := fib_mono h3
· have h6 : k + 1 ≤ K + 1 := succ_le_succ h3
calc
n = fib (k + 1) := hn
_ ≤ fib (K + 1) := fib_mono h6
· have h7 : N < n := by
have h8 : K + 2 ≤ k + 1 := succ_le_succ (not_lt.mp h2)
rw [← fib_add_two] at HK
calc
N < fib (K + 2) := HK
_ ≤ fib (k + 1) := (fib_mono h8)
_ = n := hn.symm
have h9 : n ≤ N := h1.n_le_N
exact absurd h7 h9.not_gt
/-
We spell out the consequences of this result for `specifiedSet N` here.
-/
variable {M : ℕ} (HM : M = fib K ^ 2 + fib (K + 1) ^ 2)
include HM HK in
theorem k_bound {m n : ℤ} (h1 : ProblemPredicate N m n) : m ^ 2 + n ^ 2 ≤ M := by
have h2 : 0 ≤ m := h1.m_range.left.le
have h3 : 0 ≤ n := h1.n_range.left.le
rw [← natAbs_of_nonneg h2, ← natAbs_of_nonneg h3] at h1; clear h2 h3
obtain ⟨h4 : m.natAbs ≤ fib K, h5 : n.natAbs ≤ fib (K + 1)⟩ := m_n_bounds HK h1
have h6 : m ^ 2 ≤ (fib K : ℤ) ^ 2 := Int.natAbs_le_iff_sq_le.mp h4
have h7 : n ^ 2 ≤ (fib (K + 1) : ℤ) ^ 2 := Int.natAbs_le_iff_sq_le.mp h5
linarith
include HM HK in
theorem solution_bound : ∀ {k : ℤ}, k ∈ specifiedSet N → k ≤ M
| _, ⟨_, _, rfl, h⟩ => k_bound HK HM h
include HM HK in
theorem solution_greatest (H : ProblemPredicate N (fib K) (fib (K + 1))) :
IsGreatest (specifiedSet N) M :=
⟨⟨fib K, fib (K + 1), by simp [HM], H⟩, fun k h => solution_bound HK HM h⟩
/-
Now we just have to demonstrate that 987 and 1597 are in fact the largest Fibonacci
numbers in this range, and thus provide the maximum of `specifiedSet`.
-/
abbrev solution : ℕ := 3524578
theorem imo1981_p3 : IsGreatest (specifiedSet 1981) solution := by
have := fun h => @solution_greatest 1981 16 h solution
norm_num at this
apply this
· decide
· decide
· norm_num [problemPredicate_iff]; decide
end Imo1981P3 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1981P3.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["failed to synthesize\n Decidable (ProblemPredicate 1981 987 1597)\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "no goals to be solved"], "timeout_s": 600.0, "latency_s": 6.8505, "verified_at": "2026-03-26T18:16:52.685383+00:00"}} | false | true | false | 6.8505 |
compfiles_Imo1981P4 | compfiles | Copyright (c) 2026 Constantin Seebach. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
namespace Imo1981P4
/-!
# International Mathematical Olympiad 1981, Problem 4
(a) For which values of $n>2$ is there a set of $n$ consecutive positive integers such that
the largest number in the set is a divisor of the least common multiple of the remaining $n-1$ numbers?
(b) For which values of $n>2$ is there exactly one set having the stated property?
-/
open Finset
def last_divides_lcm_remaining (n k : ℕ) : Prop := k+n ∣ lcm (Icc (k+1) (k+n-1)) id
theorem not_existsUnique_of_not_exists {α : Type} {p : α → Prop} : (¬∃ x, p x) → ¬∃! x, p x := by
grind only [ExistsUnique]
theorem not_existsUnique_of_exists_ne {α : Type} {p : α → Prop} (a b : α) : p a → p b → a ≠ b → ¬∃! x, p x := by
grind only [ExistsUnique]
theorem dvd_factorial {n k : ℕ} (h : last_divides_lcm_remaining n k) : k+n ∣ Nat.factorial (n-1) := by
have := dvd_trans h (lcm_dvd_prod (Icc (k+1) (k+n-1)) id)
rw [Nat.dvd_iff_mod_eq_zero, prod_nat_mod] at this
zify at this
rw [prod_bij (t:=Finset.range (n-1)) (g:=fun x => -(x+1:ℤ) % (↑k + ↑n)) (fun i _ => k+n-i-1), <-prod_int_mod, prod_neg] at this
· rw [<-Int.dvd_iff_emod_eq_zero] at this
conv at this =>
lhs
norm_cast
rw [<-ZMod.intCast_zmod_eq_zero_iff_dvd] at this
simp only [Int.reduceNeg, Int.cast_mul, Int.cast_pow, Int.cast_neg, Int.cast_one, neg_one_pow_mul_eq_zero_iff] at this
rw [ZMod.intCast_zmod_eq_zero_iff_dvd] at this
rw [Nat.factorial_eq_prod_range_add_one]
norm_cast at this
· grind
· grind
· intro j hj
use (n+k-1-j), ?_ <;> grind
· intro i hi
rw [Nat.cast_sub, Nat.cast_sub, Nat.cast_add]
· simp
· grind only [= mem_Icc]
· grind only [= mem_Icc]
theorem not_3 : ¬ ∃ k, last_divides_lcm_remaining 3 k := by
by_contra! c
let ⟨k, h⟩ := c
have := dvd_factorial h
clear h c
rw [show Nat.factorial (3 - 1) = 2 by rfl] at this
have := Nat.le_of_dvd (by simp) this
omega
theorem unique_4 : ∃! k, last_divides_lcm_remaining 4 k := by
use 2
and_intros
· unfold last_divides_lcm_remaining
decide
· by_contra! c
let ⟨k, h, kne⟩ := c
have hdvd := dvd_factorial h
clear h c
rw [show Nat.factorial (4 - 1) = 6 by rfl] at hdvd
have := Nat.le_of_dvd (by simp) hdvd
have bd : k ≤ 1 := by omega
clear this kne
revert hdvd
decide +revert
theorem coprime_sub_succ {n d : ℕ} (h : d < n) : Nat.Coprime (n-d) (n-(d+1)) := by
rw [Nat.sub_succ', Nat.coprime_self_sub_right]
· simp
· omega
theorem lcm_sub_succ {n d : ℕ} (h : d < n) : Nat.lcm (n-d) (n-(d+1)) = (n-d)*(n-(d+1)) := by
refine Nat.Coprime.lcm_eq_mul ?_
apply coprime_sub_succ h
theorem ge_5 (n d : ℕ) (hge : 5 ≤ n) (hd : d = 1 ∨ d = 2) : last_divides_lcm_remaining n (Nat.lcm (n-d) (n-(d+1)) - n) := by
rw [lcm_sub_succ (by omega)]
unfold last_divides_lcm_remaining
rw [Nat.sub_add_cancel]
· apply (coprime_sub_succ (by omega)).mul_dvd_of_dvd_of_dvd
· trans (n-d)*(n-(d+2))
· simp
· apply dvd_lcm
rw [show n - (d + 2) = n - (d + 1) - 1 by omega, Nat.mul_sub _ _ 1, mul_one, mem_Icc]
and_intros
· apply Nat.sub_lt_sub_left
· refine (Nat.lt_mul_iff_one_lt_right ?_).mpr ?_ <;> omega
· omega
· apply Nat.sub_le_sub_left
omega
· trans (n-(d+1))*(n-(d+1))
· simp
· apply dvd_lcm
nth_rw 3 [show n - (d+1) = n - d - 1 by omega]
rw [Nat.sub_mul _ 1, one_mul, mem_Icc]
and_intros
· apply Nat.sub_lt_sub_left
· refine (Nat.lt_mul_iff_one_lt_left ?_).mpr ?_ <;> omega
· omega
· apply Nat.sub_le_sub_left
omega
· zify
repeat rw [Nat.cast_sub (by omega)]
rw [sub_mul, mul_sub, mul_sub, <-sub_nonneg]
apply hd.elim <;> {
intro _
subst d
simp only [Nat.reduceAdd, Nat.cast_ofNat, Nat.cast_one, one_mul]
nlinarith
}
abbrev values_a : Set ℕ := Set.Ici 4
abbrev values_b : Set ℕ := {4}
theorem imo1981_p4 (n : ℕ) :
(n ∈ values_a ↔ 2 < n ∧ ∃ k, last_divides_lcm_remaining n k)
∧ (n ∈ values_b ↔ 2 < n ∧ ∃! k, last_divides_lcm_remaining n k) := by
and_intros
· unfold values_a
apply Iff.intro _ (not_imp_not.mp _)
· intro h
have : n = 4 ∨ 5 ≤ n := by grind only [= Set.mem_Ici]
apply this.elim
· intro h
subst n
use (by omega)
exact unique_4.exists
· intro h
use (by omega), ?_
exact (ge_5 n 1 h (by simp))
· simp only [not_and]
intro _ _
have : n = 3 := by grind
subst n
exact not_3
· unfold values_b
apply Iff.intro _ (not_imp_not.mp _)
· simp only [Set.mem_singleton_iff]
intro h
subst n
simp [unique_4]
· simp only [Set.mem_singleton_iff, not_and]
intro h1 h2
have : n = 3 ∨ 5 ≤ n := by omega
apply this.elim
· intro h
subst n
apply not_existsUnique_of_not_exists not_3
· intro h
apply not_existsUnique_of_exists_ne _ _ (ge_5 n 1 h (by simp)) (ge_5 n 2 h (by simp))
repeat rw [lcm_sub_succ (by omega)]
simp
zify
rw [Nat.cast_sub, Nat.cast_sub, mul_comm]
· simp
omega
· zify
repeat rw [Nat.cast_sub (by omega)]
rw [sub_mul, mul_sub, mul_sub, <-sub_nonneg]
simp
nlinarith
· zify
repeat rw [Nat.cast_sub (by omega)]
rw [sub_mul, mul_sub, mul_sub, <-sub_nonneg]
simp
nlinarith
end Imo1981P4 | /- | /-
Copyright (c) 2026 Constantin Seebach. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
namespace Imo1981P4
/-!
# International Mathematical Olympiad 1981, Problem 4
(a) For which values of $n>2$ is there a set of $n$ consecutive positive integers such that
the largest number in the set is a divisor of the least common multiple of the remaining $n-1$ numbers?
(b) For which values of $n>2$ is there exactly one set having the stated property?
-/
open Finset
def last_divides_lcm_remaining (n k : ℕ) : Prop := k+n ∣ lcm (Icc (k+1) (k+n-1)) id
theorem not_existsUnique_of_not_exists {α : Type} {p : α → Prop} : (¬∃ x, p x) → ¬∃! x, p x := by
grind only [ExistsUnique]
theorem not_existsUnique_of_exists_ne {α : Type} {p : α → Prop} (a b : α) : p a → p b → a ≠ b → ¬∃! x, p x := by
grind only [ExistsUnique]
theorem dvd_factorial {n k : ℕ} (h : last_divides_lcm_remaining n k) : k+n ∣ Nat.factorial (n-1) := by
have := dvd_trans h (lcm_dvd_prod (Icc (k+1) (k+n-1)) id)
rw [Nat.dvd_iff_mod_eq_zero, prod_nat_mod] at this
zify at this
rw [prod_bij (t:=Finset.range (n-1)) (g:=fun x => -(x+1:ℤ) % (↑k + ↑n)) (fun i _ => k+n-i-1), <-prod_int_mod, prod_neg] at this
· rw [<-Int.dvd_iff_emod_eq_zero] at this
conv at this =>
lhs
norm_cast
rw [<-ZMod.intCast_zmod_eq_zero_iff_dvd] at this
simp only [Int.reduceNeg, Int.cast_mul, Int.cast_pow, Int.cast_neg, Int.cast_one, neg_one_pow_mul_eq_zero_iff] at this
rw [ZMod.intCast_zmod_eq_zero_iff_dvd] at this
rw [Nat.factorial_eq_prod_range_add_one]
norm_cast at this
· grind
· grind
· intro j hj
use (n+k-1-j), ?_ <;> grind
· intro i hi
rw [Nat.cast_sub, Nat.cast_sub, Nat.cast_add]
· simp
· grind only [= mem_Icc]
· grind only [= mem_Icc]
theorem not_3 : ¬ ∃ k, last_divides_lcm_remaining 3 k := by
by_contra! c
let ⟨k, h⟩ := c
have := dvd_factorial h
clear h c
rw [show Nat.factorial (3 - 1) = 2 by rfl] at this
have := Nat.le_of_dvd (by simp) this
omega
theorem unique_4 : ∃! k, last_divides_lcm_remaining 4 k := by
use 2
and_intros
· unfold last_divides_lcm_remaining
decide
· by_contra! c
let ⟨k, h, kne⟩ := c
have hdvd := dvd_factorial h
clear h c
rw [show Nat.factorial (4 - 1) = 6 by rfl] at hdvd
have := Nat.le_of_dvd (by simp) hdvd
have bd : k ≤ 1 := by omega
clear this kne
revert hdvd
decide +revert
theorem coprime_sub_succ {n d : ℕ} (h : d < n) : Nat.Coprime (n-d) (n-(d+1)) := by
rw [Nat.sub_succ', Nat.coprime_self_sub_right]
· simp
· omega
theorem lcm_sub_succ {n d : ℕ} (h : d < n) : Nat.lcm (n-d) (n-(d+1)) = (n-d)*(n-(d+1)) := by
refine Nat.Coprime.lcm_eq_mul ?_
apply coprime_sub_succ h
theorem ge_5 (n d : ℕ) (hge : 5 ≤ n) (hd : d = 1 ∨ d = 2) : last_divides_lcm_remaining n (Nat.lcm (n-d) (n-(d+1)) - n) := by
rw [lcm_sub_succ (by omega)]
unfold last_divides_lcm_remaining
rw [Nat.sub_add_cancel]
· apply (coprime_sub_succ (by omega)).mul_dvd_of_dvd_of_dvd
· trans (n-d)*(n-(d+2))
· simp
· apply dvd_lcm
rw [show n - (d + 2) = n - (d + 1) - 1 by omega, Nat.mul_sub _ _ 1, mul_one, mem_Icc]
and_intros
· apply Nat.sub_lt_sub_left
· refine (Nat.lt_mul_iff_one_lt_right ?_).mpr ?_ <;> omega
· omega
· apply Nat.sub_le_sub_left
omega
· trans (n-(d+1))*(n-(d+1))
· simp
· apply dvd_lcm
nth_rw 3 [show n - (d+1) = n - d - 1 by omega]
rw [Nat.sub_mul _ 1, one_mul, mem_Icc]
and_intros
· apply Nat.sub_lt_sub_left
· refine (Nat.lt_mul_iff_one_lt_left ?_).mpr ?_ <;> omega
· omega
· apply Nat.sub_le_sub_left
omega
· zify
repeat rw [Nat.cast_sub (by omega)]
rw [sub_mul, mul_sub, mul_sub, <-sub_nonneg]
apply hd.elim <;> {
intro _
subst d
simp only [Nat.reduceAdd, Nat.cast_ofNat, Nat.cast_one, one_mul]
nlinarith
}
abbrev values_a : Set ℕ := Set.Ici 4
abbrev values_b : Set ℕ := {4}
theorem imo1981_p4 (n : ℕ) :
(n ∈ values_a ↔ 2 < n ∧ ∃ k, last_divides_lcm_remaining n k)
∧ (n ∈ values_b ↔ 2 < n ∧ ∃! k, last_divides_lcm_remaining n k) := by
and_intros
· unfold values_a
apply Iff.intro _ (not_imp_not.mp _)
· intro h
have : n = 4 ∨ 5 ≤ n := by grind only [= Set.mem_Ici]
apply this.elim
· intro h
subst n
use (by omega)
exact unique_4.exists
· intro h
use (by omega), ?_
exact (ge_5 n 1 h (by simp))
· simp only [not_and]
intro _ _
have : n = 3 := by grind
subst n
exact not_3
· unfold values_b
apply Iff.intro _ (not_imp_not.mp _)
· simp only [Set.mem_singleton_iff]
intro h
subst n
simp [unique_4]
· simp only [Set.mem_singleton_iff, not_and]
intro h1 h2
have : n = 3 ∨ 5 ≤ n := by omega
apply this.elim
· intro h
subst n
apply not_existsUnique_of_not_exists not_3
· intro h
apply not_existsUnique_of_exists_ne _ _ (ge_5 n 1 h (by simp)) (ge_5 n 2 h (by simp))
repeat rw [lcm_sub_succ (by omega)]
simp
zify
rw [Nat.cast_sub, Nat.cast_sub, mul_comm]
· simp
omega
· zify
repeat rw [Nat.cast_sub (by omega)]
rw [sub_mul, mul_sub, mul_sub, <-sub_nonneg]
simp
nlinarith
· zify
repeat rw [Nat.cast_sub (by omega)]
rw [sub_mul, mul_sub, mul_sub, <-sub_nonneg]
simp
nlinarith
end Imo1981P4
| true | Copyright (c) 2026 Constantin Seebach. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Constantin Seebach
-/
import Mathlib
namespace Imo1981P4
/-!
# International Mathematical Olympiad 1981, Problem 4
(a) For which values of $n>2$ is there a set of $n$ consecutive positive integers such that
the largest number in the set is a divisor of the least common multiple of the remaining $n-1$ numbers?
(b) For which values of $n>2$ is there exactly one set having the stated property?
-/
open Finset
def last_divides_lcm_remaining (n k : ℕ) : Prop := k+n ∣ lcm (Icc (k+1) (k+n-1)) id
theorem not_existsUnique_of_not_exists {α : Type} {p : α → Prop} : (¬∃ x, p x) → ¬∃! x, p x := by
grind only [ExistsUnique]
theorem not_existsUnique_of_exists_ne {α : Type} {p : α → Prop} (a b : α) : p a → p b → a ≠ b → ¬∃! x, p x := by
grind only [ExistsUnique]
theorem dvd_factorial {n k : ℕ} (h : last_divides_lcm_remaining n k) : k+n ∣ Nat.factorial (n-1) := by
have := dvd_trans h (lcm_dvd_prod (Icc (k+1) (k+n-1)) id)
rw [Nat.dvd_iff_mod_eq_zero, prod_nat_mod] at this
zify at this
rw [prod_bij (t:=Finset.range (n-1)) (g:=fun x => -(x+1:ℤ) % (↑k + ↑n)) (fun i _ => k+n-i-1), <-prod_int_mod, prod_neg] at this
· rw [<-Int.dvd_iff_emod_eq_zero] at this
conv at this =>
lhs
norm_cast
rw [<-ZMod.intCast_zmod_eq_zero_iff_dvd] at this
simp only [Int.reduceNeg, Int.cast_mul, Int.cast_pow, Int.cast_neg, Int.cast_one, neg_one_pow_mul_eq_zero_iff] at this
rw [ZMod.intCast_zmod_eq_zero_iff_dvd] at this
rw [Nat.factorial_eq_prod_range_add_one]
norm_cast at this
· grind
· grind
· intro j hj
use (n+k-1-j), ?_ <;> grind
· intro i hi
rw [Nat.cast_sub, Nat.cast_sub, Nat.cast_add]
· simp
· grind only [= mem_Icc]
· grind only [= mem_Icc]
theorem not_3 : ¬ ∃ k, last_divides_lcm_remaining 3 k := by
by_contra! c
let ⟨k, h⟩ := c
have := dvd_factorial h
clear h c
rw [show Nat.factorial (3 - 1) = 2 by rfl] at this
have := Nat.le_of_dvd (by simp) this
omega
theorem unique_4 : ∃! k, last_divides_lcm_remaining 4 k := by
use 2
and_intros
· unfold last_divides_lcm_remaining
decide
· by_contra! c
let ⟨k, h, kne⟩ := c
have hdvd := dvd_factorial h
clear h c
rw [show Nat.factorial (4 - 1) = 6 by rfl] at hdvd
have := Nat.le_of_dvd (by simp) hdvd
have bd : k ≤ 1 := by omega
clear this kne
revert hdvd
decide +revert
theorem coprime_sub_succ {n d : ℕ} (h : d < n) : Nat.Coprime (n-d) (n-(d+1)) := by
rw [Nat.sub_succ', Nat.coprime_self_sub_right]
· simp
· omega
theorem lcm_sub_succ {n d : ℕ} (h : d < n) : Nat.lcm (n-d) (n-(d+1)) = (n-d)*(n-(d+1)) := by
refine Nat.Coprime.lcm_eq_mul ?_
apply coprime_sub_succ h
theorem ge_5 (n d : ℕ) (hge : 5 ≤ n) (hd : d = 1 ∨ d = 2) : last_divides_lcm_remaining n (Nat.lcm (n-d) (n-(d+1)) - n) := by
rw [lcm_sub_succ (by omega)]
unfold last_divides_lcm_remaining
rw [Nat.sub_add_cancel]
· apply (coprime_sub_succ (by omega)).mul_dvd_of_dvd_of_dvd
· trans (n-d)*(n-(d+2))
· simp
· apply dvd_lcm
rw [show n - (d + 2) = n - (d + 1) - 1 by omega, Nat.mul_sub _ _ 1, mul_one, mem_Icc]
and_intros
· apply Nat.sub_lt_sub_left
· refine (Nat.lt_mul_iff_one_lt_right ?_).mpr ?_ <;> omega
· omega
· apply Nat.sub_le_sub_left
omega
· trans (n-(d+1))*(n-(d+1))
· simp
· apply dvd_lcm
nth_rw 3 [show n - (d+1) = n - d - 1 by omega]
rw [Nat.sub_mul _ 1, one_mul, mem_Icc]
and_intros
· apply Nat.sub_lt_sub_left
· refine (Nat.lt_mul_iff_one_lt_left ?_).mpr ?_ <;> omega
· omega
· apply Nat.sub_le_sub_left
omega
· zify
repeat rw [Nat.cast_sub (by omega)]
rw [sub_mul, mul_sub, mul_sub, <-sub_nonneg]
apply hd.elim <;> {
intro _
subst d
simp only [Nat.reduceAdd, Nat.cast_ofNat, Nat.cast_one, one_mul]
nlinarith
}
abbrev values_a : Set ℕ := Set.Ici 4
abbrev values_b : Set ℕ := {4}
theorem imo1981_p4 (n : ℕ) :
(n ∈ values_a ↔ 2 < n ∧ ∃ k, last_divides_lcm_remaining n k)
∧ (n ∈ values_b ↔ 2 < n ∧ ∃! k, last_divides_lcm_remaining n k) := by
and_intros
· unfold values_a
apply Iff.intro _ (not_imp_not.mp _)
· intro h
have : n = 4 ∨ 5 ≤ n := by grind only [= Set.mem_Ici]
apply this.elim
· intro h
subst n
use (by omega)
exact unique_4.exists
· intro h
use (by omega), ?_
exact (ge_5 n 1 h (by simp))
· simp only [not_and]
intro _ _
have : n = 3 := by grind
subst n
exact not_3
· unfold values_b
apply Iff.intro _ (not_imp_not.mp _)
· simp only [Set.mem_singleton_iff]
intro h
subst n
simp [unique_4]
· simp only [Set.mem_singleton_iff, not_and]
intro h1 h2
have : n = 3 ∨ 5 ≤ n := by omega
apply this.elim
· intro h
subst n
apply not_existsUnique_of_not_exists not_3
· intro h
apply not_existsUnique_of_exists_ne _ _ (ge_5 n 1 h (by simp)) (ge_5 n 2 h (by simp))
repeat rw [lcm_sub_succ (by omega)]
simp
zify
rw [Nat.cast_sub, Nat.cast_sub, mul_comm]
· simp
omega
· zify
repeat rw [Nat.cast_sub (by omega)]
rw [sub_mul, mul_sub, mul_sub, <-sub_nonneg]
simp
nlinarith
· zify
repeat rw [Nat.cast_sub (by omega)]
rw [sub_mul, mul_sub, mul_sub, <-sub_nonneg]
simp
nlinarith
end Imo1981P4 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1981P4.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown identifier 'lcm_dvd_prod'", "unsolved goals\nn k : \u2115\nh : last_divides_lcm_remaining n k\n\u22a2 k + n \u2223 (n - 1).factorial", "unknown tactic", "unsolved goals\nk : \u2115\nthis\u271d : k + 3 \u2223 2\nthis : k + 3 \u2264 2\n\u22a2 False", "unknown tactic", "unsolved goals\nk : \u2115\nkne : k \u2260 2\nhdvd : k + 4 \u2223 6\nthis : k + 4 \u2264 6\n\u22a2 k \u2264 1", "unsolved goals\ncase h.refine_2\nk : \u2115\nkne : k \u2260 2\nhdvd : k + 4 \u2223 6\nthis : k + 4 \u2264 6\nbd : k \u2264 1\n\u22a2 False", "unknown tactic", "unsolved goals\nn d : \u2115\nh : d < n\n\u22a2 1 \u2264 n - d", "unknown tactic", "unsolved goals\nn d : \u2115\nhge : 5 \u2264 n\nhd : d = 1 \u2228 d = 2\n\u22a2 d < n", "unsolved goals\nn d : \u2115\nhge : 5 \u2264 n\nhd : d = 1 \u2228 d = 2\n\u22a2 last_divides_lcm_remaining n ((n - d) * (n - (d + 1)) - n)", "unknown tactic", "unsolved goals\nh : 4 \u2208 Set.Ici 4\nthis : 4 = 4 \u2228 5 \u2264 4\n\u22a2 2 < 4", "unsolved goals\ncase right\nh : 4 \u2208 Set.Ici 4\nthis : 4 = 4 \u2228 5 \u2264 4\n\u22a2 \u2203 k, last_divides_lcm_remaining 4 k", "unsolved goals\ncase right\nn : \u2115\nh : n \u2208 Set.Ici 4\nthis : n = 4 \u2228 5 \u2264 n\n\u22a2 5 \u2264 n \u2192 2 < n \u2227 \u2203 k, last_divides_lcm_remaining n k", "unsolved goals\nn : \u2115\n\u22a2 n \u2209 Set.Ici 4 \u2192 \u00ac(2 < n \u2227 \u2203 k, last_divides_lcm_remaining n k)", "unsolved goals\ncase refine_2\nn : \u2115\n\u22a2 n \u2208 values_b \u2194 2 < n \u2227 \u2203! k, last_divides_lcm_remaining n k"], "timeout_s": 600.0, "latency_s": 0.3095, "verified_at": "2026-03-26T18:16:46.211606+00:00"}} | false | true | false | 0.3095 |
compfiles_Imo1981P6 | compfiles | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1981, Problem 6
Suppose that f : ℕ × ℕ → ℕ satisfies
1) f (0, y) = y + 1
2) f (x + 1, 0) = f (x, 1),
3) f (x + 1, y + 1) = f (x, f (x + 1, y))
for all x y ∈ ℕ.
Determine f (4, 1981).
-/
namespace Imo1981P6
/--
Wrapper to prevent the Lean kernel from eagerly trying to normalize
the solution value, which happens to be way too large to normalize.
-/
def no_eval (x : ℕ) : ℕ := x
abbrev solution_value : ℕ := no_eval ((2^·)^[1984] 1 - 3)
theorem imo1981_p6 (f : ℕ → ℕ → ℕ)
(h1 : ∀ y, f 0 y = y + 1)
(h2 : ∀ x, f (x + 1) 0 = f x 1)
(h3 : ∀ x y, f (x + 1) (y + 1) = f x (f (x + 1) y)) :
f 4 1981 = solution_value := by
have h4 : ∀ y, f 1 y = y + 2 := by
intro y
induction y using Nat.strongRecOn with | ind y ih =>
cases y with
| zero => simp [h1, h2]
| succ y =>
rw [h3 0 y, ih y (Nat.lt_add_one y)]
rw [h1 (y + 2)]
have h20 : ∀ y, f 2 y = 2 * y + 3 := by
intro y;
induction y with
| zero => simp [h1, h2, h3]
| succ y ih =>
rw [h3, ih, h3, h3, h3, h4, h1, h1, h1]
ring
have h21 : ∀ y, f 3 y + 3 = 2^(y + 3) := by
intro y
induction y with
| zero => simp (config := {decide := true}) [h1, h2, h3]
| succ y ih =>
rw [h3, h20]
rw [show 2 * f (2 + 1) y + 3 + 3 = 2 * (f 3 y + 3) by ring]
rw [ih, ←Nat.pow_succ']
have h6 : ∀ y, f 4 (y + 1) + 3 = 2^(f 4 y + 3) := by
intro y
induction y with
| zero => rw [h3 3 0, h2 3, h21]
| succ y ih => rw [h3, ih, h21, ih]
have h7' : ∀ y, f 4 y + 3 = (2^·)^[y + 3] 1 := by
intro y
induction y with
| zero => simp (config := {decide := true}) [h1, h2, h3]
| succ y ih =>
rw [show Nat.succ y + 3 = Nat.succ (y + 3) by rfl]
rw [Function.iterate_succ']
rw [h6 y, ih]
rfl
have h7 : ∀ y, f 4 y = no_eval ((2^·)^[y + 3] 1 - 3) := by
intro y
exact eq_tsub_of_add_eq (h7' y)
have h8 := h7 1981
rw [show 1981 + 3 = 1984 by rfl] at h8
exact h8
end Imo1981P6 | /- | /-
Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1981, Problem 6
Suppose that f : ℕ × ℕ → ℕ satisfies
1) f (0, y) = y + 1
2) f (x + 1, 0) = f (x, 1),
3) f (x + 1, y + 1) = f (x, f (x + 1, y))
for all x y ∈ ℕ.
Determine f (4, 1981).
-/
namespace Imo1981P6
/--
Wrapper to prevent the Lean kernel from eagerly trying to normalize
the solution value, which happens to be way too large to normalize.
-/
def no_eval (x : ℕ) : ℕ := x
abbrev solution_value : ℕ := no_eval ((2^·)^[1984] 1 - 3)
theorem imo1981_p6 (f : ℕ → ℕ → ℕ)
(h1 : ∀ y, f 0 y = y + 1)
(h2 : ∀ x, f (x + 1) 0 = f x 1)
(h3 : ∀ x y, f (x + 1) (y + 1) = f x (f (x + 1) y)) :
f 4 1981 = solution_value := by
have h4 : ∀ y, f 1 y = y + 2 := by
intro y
induction y using Nat.strongRecOn with | ind y ih =>
cases y with
| zero => simp [h1, h2]
| succ y =>
rw [h3 0 y, ih y (Nat.lt_add_one y)]
rw [h1 (y + 2)]
have h20 : ∀ y, f 2 y = 2 * y + 3 := by
intro y;
induction y with
| zero => simp [h1, h2, h3]
| succ y ih =>
rw [h3, ih, h3, h3, h3, h4, h1, h1, h1]
ring
have h21 : ∀ y, f 3 y + 3 = 2^(y + 3) := by
intro y
induction y with
| zero => simp (config := {decide := true}) [h1, h2, h3]
| succ y ih =>
rw [h3, h20]
rw [show 2 * f (2 + 1) y + 3 + 3 = 2 * (f 3 y + 3) by ring]
rw [ih, ←Nat.pow_succ']
have h6 : ∀ y, f 4 (y + 1) + 3 = 2^(f 4 y + 3) := by
intro y
induction y with
| zero => rw [h3 3 0, h2 3, h21]
| succ y ih => rw [h3, ih, h21, ih]
have h7' : ∀ y, f 4 y + 3 = (2^·)^[y + 3] 1 := by
intro y
induction y with
| zero => simp (config := {decide := true}) [h1, h2, h3]
| succ y ih =>
rw [show Nat.succ y + 3 = Nat.succ (y + 3) by rfl]
rw [Function.iterate_succ']
rw [h6 y, ih]
rfl
have h7 : ∀ y, f 4 y = no_eval ((2^·)^[y + 3] 1 - 3) := by
intro y
exact eq_tsub_of_add_eq (h7' y)
have h8 := h7 1981
rw [show 1981 + 3 = 1984 by rfl] at h8
exact h8
end Imo1981P6
| true | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1981, Problem 6
Suppose that f : ℕ × ℕ → ℕ satisfies
1) f (0, y) = y + 1
2) f (x + 1, 0) = f (x, 1),
3) f (x + 1, y + 1) = f (x, f (x + 1, y))
for all x y ∈ ℕ.
Determine f (4, 1981).
-/
namespace Imo1981P6
/--
Wrapper to prevent the Lean kernel from eagerly trying to normalize
the solution value, which happens to be way too large to normalize.
-/
def no_eval (x : ℕ) : ℕ := x
abbrev solution_value : ℕ := no_eval ((2^·)^[1984] 1 - 3)
theorem imo1981_p6 (f : ℕ → ℕ → ℕ)
(h1 : ∀ y, f 0 y = y + 1)
(h2 : ∀ x, f (x + 1) 0 = f x 1)
(h3 : ∀ x y, f (x + 1) (y + 1) = f x (f (x + 1) y)) :
f 4 1981 = solution_value := by
have h4 : ∀ y, f 1 y = y + 2 := by
intro y
induction y using Nat.strongRecOn with | ind y ih =>
cases y with
| zero => simp [h1, h2]
| succ y =>
rw [h3 0 y, ih y (Nat.lt_add_one y)]
rw [h1 (y + 2)]
have h20 : ∀ y, f 2 y = 2 * y + 3 := by
intro y;
induction y with
| zero => simp [h1, h2, h3]
| succ y ih =>
rw [h3, ih, h3, h3, h3, h4, h1, h1, h1]
ring
have h21 : ∀ y, f 3 y + 3 = 2^(y + 3) := by
intro y
induction y with
| zero => simp (config := {decide := true}) [h1, h2, h3]
| succ y ih =>
rw [h3, h20]
rw [show 2 * f (2 + 1) y + 3 + 3 = 2 * (f 3 y + 3) by ring]
rw [ih, ←Nat.pow_succ']
have h6 : ∀ y, f 4 (y + 1) + 3 = 2^(f 4 y + 3) := by
intro y
induction y with
| zero => rw [h3 3 0, h2 3, h21]
| succ y ih => rw [h3, ih, h21, ih]
have h7' : ∀ y, f 4 y + 3 = (2^·)^[y + 3] 1 := by
intro y
induction y with
| zero => simp (config := {decide := true}) [h1, h2, h3]
| succ y ih =>
rw [show Nat.succ y + 3 = Nat.succ (y + 3) by rfl]
rw [Function.iterate_succ']
rw [h6 y, ih]
rfl
have h7 : ∀ y, f 4 y = no_eval ((2^·)^[y + 3] 1 - 3) := by
intro y
exact eq_tsub_of_add_eq (h7' y)
have h8 := h7 1981
rw [show 1981 + 3 = 1984 by rfl] at h8
exact h8
end Imo1981P6 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1981P6.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 600.0, "latency_s": 0.3745, "verified_at": "2026-03-26T18:16:46.586193+00:00"}} | true | true | false | 0.3745 |
compfiles_Imo1982P1 | compfiles | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1982, Problem 1
Let f be a function from positive integers to nonnegative integers such that
1) f(2) = 0
2) f(3) > 0
3) f(9999) = 3333
4) for all m,n > 0, f (m + n) - f (m) - f(n) = 1 or 0
Determine the value of f(1982).
-/
namespace Imo1982P1
abbrev solution_value : ℕ := 660
theorem imo1982_p1 (f : ℕ → ℕ)
(h2 : f 2 = 0)
(h3 : 0 < f 3)
(h9999 : f 9999 = 3333)
(hf : ∀ m n, 0 < m → 0 < n → f (m + n) = f m + f n ∨ f (m + n) = f m + f n + 1) :
f 1982 = solution_value := by
-- Follows Solution 1 by sayantanchakraborty at
-- https://artofproblemsolving.com/wiki/index.php/1982_IMO_Problems/Problem_1
have h4 : f 1 = 0 := by
have h5 := hf 1 1 Nat.one_pos Nat.one_pos
rw [h2] at h5
omega
have h5 : f 3 = 1 := by
have := hf 1 2 Nat.one_pos two_pos
aesop
have h7 : ∀ m n, 0 < m → 0 < n → f m + f n ≤ f (m + n) := by
intro m n hm hn
obtain h8 | h8 := hf m n hm hn
· exact Nat.le_of_eq h8.symm
· exact Nat.le.intro h8.symm
have h6 : ∀ k, 0 < k → f (3 * k) < f (3 * k + 3) := fun k hk ↦ by
calc _ < f (3 * k) + f 3 := Nat.lt_add_of_pos_right h3
_ ≤ _ := h7 _ _ (Nat.succ_mul_pos 2 hk) three_pos
have h9 : ∀ k l, 0 < k → f (3 * k) + l ≤ f (3 * (k + l)) := by
intro k l hk
induction' l with l ih
· simp
· have h10 := h6 (k + l) (Nat.add_pos_left hk l)
have h11 : 3 * (k + l) + 3 = 3 * (k + Nat.succ l) := by omega
have h12 : f (3 * k) + Nat.succ l = f (3 * k) + l + 1 := by omega
rw [←h11, h12]
omega
have h8 : ∀ k, 0 < k → k ≤ 3333 → f (3 * k) = k := by
intro k hk0 hk1
by_contra! H
have h11 := h9 1 (k - 1) zero_lt_one
have h12 : 1 + (k - 1) = k := Nat.add_sub_of_le hk0
rw [mul_one, h5, h12] at h11
have h13 : k < f (3 * k) := Nat.lt_of_le_of_ne h11 H.symm
have h14 := h9 k (3333 - k) hk0
have h15 : k + (3333 - k) = 3333 := Nat.add_sub_of_le hk1
rw [h15, h9999] at h14
omega
have h20 : ∀ k, 0 < k → f k ≤ f (k + 1) := by grind
have h30 : ∀ k l, 0 < k → l ≤ f k → l + l ≤ f (k + k) := by grind
have h10 : ∀ k, 0 < k → 12 * k + 9 ≤ 9999 → f (3 * k + 2) = k := by
intro k hk hk1
obtain h11 | h11 := hf (3*k) 2 (Nat.succ_mul_pos 2 hk) two_pos
· rw [h11, h2, add_zero]
exact h8 k hk (by omega)
· rw [h2, add_zero, h8 k hk (by omega)] at h11
exfalso
have h12 : 2 * k + 2 ≤ f (6 * k + 4) := by
have h14 : 3 * k + 2 + (3 * k + 2) = 6 * k + 4 := by ring
have h15 : k + 1 + (k + 1) = 2 * k + 2 := by ring
rw [←h14, ←h15]
exact h30 _ _ (Nat.succ_pos _) (Nat.le_of_eq h11.symm)
have h13 : 4 * k + 4 ≤ f (12 * k + 8) := by
have h14 : 6 * k + 4 + (6 * k + 4) = 12 * k + 8 := by ring
have h15 : 2 * k + 2 + (2 * k + 2) = 4 * k + 4 := by ring
rw [←h14, ←h15]
exact h30 _ _ (Nat.succ_pos _) h12
have h14 : f (12 * k + 8) ≤ f (12 * k + 9) := by
have h15 : 12 * k + 8 + 1 = 12 * k + 9 := by ring
rw [←h15]
exact h20 _ (Nat.succ_pos _)
have h15 : f (12 * k + 9) = 4 * k + 3 := by
have h16 : 3 * (4 * k + 3) = 12 * k + 9 := by ring
have h17 := h8 (4 * k + 3) (Nat.succ_pos _) (by omega)
rw [h16] at h17
exact h17
rw [h15] at h14
exact Nat.lt_le_asymm h13 h14
exact h10 660 (Nat.succ_pos _) (by norm_num)
end Imo1982P1 | /- | /-
Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1982, Problem 1
Let f be a function from positive integers to nonnegative integers such that
1) f(2) = 0
2) f(3) > 0
3) f(9999) = 3333
4) for all m,n > 0, f (m + n) - f (m) - f(n) = 1 or 0
Determine the value of f(1982).
-/
namespace Imo1982P1
abbrev solution_value : ℕ := 660
theorem imo1982_p1 (f : ℕ → ℕ)
(h2 : f 2 = 0)
(h3 : 0 < f 3)
(h9999 : f 9999 = 3333)
(hf : ∀ m n, 0 < m → 0 < n → f (m + n) = f m + f n ∨ f (m + n) = f m + f n + 1) :
f 1982 = solution_value := by
-- Follows Solution 1 by sayantanchakraborty at
-- https://artofproblemsolving.com/wiki/index.php/1982_IMO_Problems/Problem_1
have h4 : f 1 = 0 := by
have h5 := hf 1 1 Nat.one_pos Nat.one_pos
rw [h2] at h5
omega
have h5 : f 3 = 1 := by
have := hf 1 2 Nat.one_pos two_pos
aesop
have h7 : ∀ m n, 0 < m → 0 < n → f m + f n ≤ f (m + n) := by
intro m n hm hn
obtain h8 | h8 := hf m n hm hn
· exact Nat.le_of_eq h8.symm
· exact Nat.le.intro h8.symm
have h6 : ∀ k, 0 < k → f (3 * k) < f (3 * k + 3) := fun k hk ↦ by
calc _ < f (3 * k) + f 3 := Nat.lt_add_of_pos_right h3
_ ≤ _ := h7 _ _ (Nat.succ_mul_pos 2 hk) three_pos
have h9 : ∀ k l, 0 < k → f (3 * k) + l ≤ f (3 * (k + l)) := by
intro k l hk
induction' l with l ih
· simp
· have h10 := h6 (k + l) (Nat.add_pos_left hk l)
have h11 : 3 * (k + l) + 3 = 3 * (k + Nat.succ l) := by omega
have h12 : f (3 * k) + Nat.succ l = f (3 * k) + l + 1 := by omega
rw [←h11, h12]
omega
have h8 : ∀ k, 0 < k → k ≤ 3333 → f (3 * k) = k := by
intro k hk0 hk1
by_contra! H
have h11 := h9 1 (k - 1) zero_lt_one
have h12 : 1 + (k - 1) = k := Nat.add_sub_of_le hk0
rw [mul_one, h5, h12] at h11
have h13 : k < f (3 * k) := Nat.lt_of_le_of_ne h11 H.symm
have h14 := h9 k (3333 - k) hk0
have h15 : k + (3333 - k) = 3333 := Nat.add_sub_of_le hk1
rw [h15, h9999] at h14
omega
have h20 : ∀ k, 0 < k → f k ≤ f (k + 1) := by grind
have h30 : ∀ k l, 0 < k → l ≤ f k → l + l ≤ f (k + k) := by grind
have h10 : ∀ k, 0 < k → 12 * k + 9 ≤ 9999 → f (3 * k + 2) = k := by
intro k hk hk1
obtain h11 | h11 := hf (3*k) 2 (Nat.succ_mul_pos 2 hk) two_pos
· rw [h11, h2, add_zero]
exact h8 k hk (by omega)
· rw [h2, add_zero, h8 k hk (by omega)] at h11
exfalso
have h12 : 2 * k + 2 ≤ f (6 * k + 4) := by
have h14 : 3 * k + 2 + (3 * k + 2) = 6 * k + 4 := by ring
have h15 : k + 1 + (k + 1) = 2 * k + 2 := by ring
rw [←h14, ←h15]
exact h30 _ _ (Nat.succ_pos _) (Nat.le_of_eq h11.symm)
have h13 : 4 * k + 4 ≤ f (12 * k + 8) := by
have h14 : 6 * k + 4 + (6 * k + 4) = 12 * k + 8 := by ring
have h15 : 2 * k + 2 + (2 * k + 2) = 4 * k + 4 := by ring
rw [←h14, ←h15]
exact h30 _ _ (Nat.succ_pos _) h12
have h14 : f (12 * k + 8) ≤ f (12 * k + 9) := by
have h15 : 12 * k + 8 + 1 = 12 * k + 9 := by ring
rw [←h15]
exact h20 _ (Nat.succ_pos _)
have h15 : f (12 * k + 9) = 4 * k + 3 := by
have h16 : 3 * (4 * k + 3) = 12 * k + 9 := by ring
have h17 := h8 (4 * k + 3) (Nat.succ_pos _) (by omega)
rw [h16] at h17
exact h17
rw [h15] at h14
exact Nat.lt_le_asymm h13 h14
exact h10 660 (Nat.succ_pos _) (by norm_num)
end Imo1982P1
| true | Copyright (c) 2023 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1982, Problem 1
Let f be a function from positive integers to nonnegative integers such that
1) f(2) = 0
2) f(3) > 0
3) f(9999) = 3333
4) for all m,n > 0, f (m + n) - f (m) - f(n) = 1 or 0
Determine the value of f(1982).
-/
namespace Imo1982P1
abbrev solution_value : ℕ := 660
theorem imo1982_p1 (f : ℕ → ℕ)
(h2 : f 2 = 0)
(h3 : 0 < f 3)
(h9999 : f 9999 = 3333)
(hf : ∀ m n, 0 < m → 0 < n → f (m + n) = f m + f n ∨ f (m + n) = f m + f n + 1) :
f 1982 = solution_value := by
-- Follows Solution 1 by sayantanchakraborty at
-- https://artofproblemsolving.com/wiki/index.php/1982_IMO_Problems/Problem_1
have h4 : f 1 = 0 := by
have h5 := hf 1 1 Nat.one_pos Nat.one_pos
rw [h2] at h5
omega
have h5 : f 3 = 1 := by
have := hf 1 2 Nat.one_pos two_pos
aesop
have h7 : ∀ m n, 0 < m → 0 < n → f m + f n ≤ f (m + n) := by
intro m n hm hn
obtain h8 | h8 := hf m n hm hn
· exact Nat.le_of_eq h8.symm
· exact Nat.le.intro h8.symm
have h6 : ∀ k, 0 < k → f (3 * k) < f (3 * k + 3) := fun k hk ↦ by
calc _ < f (3 * k) + f 3 := Nat.lt_add_of_pos_right h3
_ ≤ _ := h7 _ _ (Nat.succ_mul_pos 2 hk) three_pos
have h9 : ∀ k l, 0 < k → f (3 * k) + l ≤ f (3 * (k + l)) := by
intro k l hk
induction' l with l ih
· simp
· have h10 := h6 (k + l) (Nat.add_pos_left hk l)
have h11 : 3 * (k + l) + 3 = 3 * (k + Nat.succ l) := by omega
have h12 : f (3 * k) + Nat.succ l = f (3 * k) + l + 1 := by omega
rw [←h11, h12]
omega
have h8 : ∀ k, 0 < k → k ≤ 3333 → f (3 * k) = k := by
intro k hk0 hk1
by_contra! H
have h11 := h9 1 (k - 1) zero_lt_one
have h12 : 1 + (k - 1) = k := Nat.add_sub_of_le hk0
rw [mul_one, h5, h12] at h11
have h13 : k < f (3 * k) := Nat.lt_of_le_of_ne h11 H.symm
have h14 := h9 k (3333 - k) hk0
have h15 : k + (3333 - k) = 3333 := Nat.add_sub_of_le hk1
rw [h15, h9999] at h14
omega
have h20 : ∀ k, 0 < k → f k ≤ f (k + 1) := by grind
have h30 : ∀ k l, 0 < k → l ≤ f k → l + l ≤ f (k + k) := by grind
have h10 : ∀ k, 0 < k → 12 * k + 9 ≤ 9999 → f (3 * k + 2) = k := by
intro k hk hk1
obtain h11 | h11 := hf (3*k) 2 (Nat.succ_mul_pos 2 hk) two_pos
· rw [h11, h2, add_zero]
exact h8 k hk (by omega)
· rw [h2, add_zero, h8 k hk (by omega)] at h11
exfalso
have h12 : 2 * k + 2 ≤ f (6 * k + 4) := by
have h14 : 3 * k + 2 + (3 * k + 2) = 6 * k + 4 := by ring
have h15 : k + 1 + (k + 1) = 2 * k + 2 := by ring
rw [←h14, ←h15]
exact h30 _ _ (Nat.succ_pos _) (Nat.le_of_eq h11.symm)
have h13 : 4 * k + 4 ≤ f (12 * k + 8) := by
have h14 : 6 * k + 4 + (6 * k + 4) = 12 * k + 8 := by ring
have h15 : 2 * k + 2 + (2 * k + 2) = 4 * k + 4 := by ring
rw [←h14, ←h15]
exact h30 _ _ (Nat.succ_pos _) h12
have h14 : f (12 * k + 8) ≤ f (12 * k + 9) := by
have h15 : 12 * k + 8 + 1 = 12 * k + 9 := by ring
rw [←h15]
exact h20 _ (Nat.succ_pos _)
have h15 : f (12 * k + 9) = 4 * k + 3 := by
have h16 : 3 * (4 * k + 3) = 12 * k + 9 := by ring
have h17 := h8 (4 * k + 3) (Nat.succ_pos _) (by omega)
rw [h16] at h17
exact h17
rw [h15] at h14
exact Nat.lt_le_asymm h13 h14
exact h10 660 (Nat.succ_pos _) (by norm_num)
end Imo1982P1 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1982P1.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 120, "latency_s": 1.7846, "verified_at": "2026-03-30T14:41:51.094513+00:00"}} | true | true | false | 1.7846 |
compfiles_Imo1982P3 | compfiles | Copyright (c) 2024 Violeta Hernández Palacios. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Violeta Hernández Palacios, Alex Brodbelt
-/
import Mathlib
/-!
# International Mathematical Olympiad 1982, Problem 3
Consider infinite sequences $\{x_n \}$ of positive reals such that $x_0 = 0$ and
$x_0 \geq x_1 \geq x_2 \geq ...$
a) Prove that for every such sequence there is an $n \geq 1$ such that:
$\frac{x_0^2}{x_1} + \ldots + \frac{x_{n-1}^2}{x_n} \geq 3.999$
b) Find such a sequence such that for all n:
$\frac{x_0^2}{x_1} + \ldots + \frac{x_{n-1}^2}{x_n} < 4$
-/
namespace Imo1982P3
/-
The solution is based on Solution 1 from the
[Art of Problem Solving](https://artofproblemsolving.com/wiki/index.php/1982_IMO_Problems/Problem_3)
website. For part a, we use Sedrakyan's lemma to show the sum is bounded below by
$\frac{4n}{n + 1}$, which can be made arbitrarily close to $4$ by taking large $n$. For part b, we
show the sequence $x_n = 2^{-n}$ satisfies the desired inequality.
-/
/-- `x n` is at most the average of all previous terms in the sequence.
This is expressed here with `∑ k ∈ range n, x k` added to both sides. -/
lemma le_avg {x : ℕ → ℝ} {n : ℕ} (hn : n ≠ 0) (hx : Antitone x) :
∑ k ∈ Finset.range (n + 1), x k ≤ (∑ k ∈ Finset.range n, x k) * (1 + 1 / n) := by
rw [Finset.sum_range_succ, mul_one_add, add_le_add_iff_left, mul_one_div,
le_div_iff₀ (mod_cast hn.bot_lt), mul_comm, ← nsmul_eq_mul]
conv_lhs => rw [← Finset.card_range n, ← Finset.sum_const]
refine Finset.sum_le_sum fun k hk ↦ hx (le_of_lt ?_)
simpa using hk
/-- The main inequality used for part a. -/
lemma ineq {x : ℕ → ℝ} {n : ℕ} (hn : n ≠ 0) (hx : Antitone x)
(h0 : x 0 = 1) (hp : ∀ k, 0 < x k) :
4 * n / (n + 1) ≤ ∑ k ∈ Finset.range (n + 1), x k ^ 2 / x (k + 1) := by
calc
-- We first use AM-GM.
_ ≤ (∑ k ∈ Finset.range n, x (k + 1) + 1) ^ 2 /
(∑ k ∈ Finset.range n, x (k + 1)) * n / (n + 1) := by
gcongr
rw [le_div_iff₀]
· simpa using four_mul_le_sq_add (∑ k ∈ Finset.range n, x (k + 1)) 1
· exact Finset.sum_pos (fun k _ ↦ hp _) (Finset.nonempty_range_iff.2 hn)
-- We move the fraction into the denominator.
_ = (∑ k ∈ Finset.range n, x (k + 1) + 1) ^ 2 /
((∑ k ∈ Finset.range n, x (k + 1)) * (1 + 1 / n)) := by
field_simp
-- We make use of the `le_avg` lemma.
_ ≤ (∑ k ∈ Finset.range (n + 1), x k) ^ 2 /
∑ k ∈ Finset.range (n + 1), x (k + 1) := by
gcongr
· exact Finset.sum_pos (fun k _ ↦ hp _) Finset.nonempty_range_add_one
· exact add_nonneg (Finset.sum_nonneg fun k _ ↦ (hp _).le) zero_le_one
· rw [Finset.sum_range_succ', h0]
· exact le_avg hn (hx.comp_monotone @Nat.succ_le_succ)
-- We conclude by Sedrakyan.
_ ≤ _ := Finset.sq_sum_div_le_sum_sq_div _ x fun k _ ↦ hp (k + 1)
theorem imo1982_p3a {x : ℕ → ℝ} (hx : Antitone x) (h0 : x 0 = 1) (hp : ∀ k, 0 < x k) :
∃ n : ℕ, 3.999 ≤ ∑ k ∈ Finset.range n, (x k) ^ 2 / x (k + 1) := by
use 4000
convert Imo1982P3.ineq (Nat.succ_ne_zero 3998) hx h0 hp
norm_num
noncomputable abbrev sol : ℕ → ℝ := fun k ↦ 2⁻¹ ^ k
theorem imo1982_p3b : Antitone sol ∧ sol 0 = 1 ∧ (∀ k, 0 < sol k)
∧ ∀ n, ∑ k ∈ Finset.range n, sol k ^ 2 / sol (k + 1) < 4 := by
refine ⟨?_, pow_zero _, ?_, fun n ↦ ?_⟩
· apply (pow_right_strictAnti₀ _ _).antitone <;> norm_num
· simp
· have {k : ℕ} : (2 : ℝ)⁻¹ ^ (k * 2) * ((2 : ℝ)⁻¹ ^ k)⁻¹ = (2 : ℝ)⁻¹ ^ k := by
rw [← pow_sub₀] <;> simp [mul_two]
simp_rw [← pow_mul, pow_succ, ← div_eq_mul_inv, div_div_eq_mul_div, mul_comm, mul_div_assoc,
← Finset.mul_sum, div_eq_mul_inv, this, ← two_add_two_eq_four, ← mul_two,
mul_lt_mul_iff_of_pos_left two_pos]
convert NNReal.coe_lt_coe.2 <| geom_sum_lt (inv_ne_zero two_ne_zero) two_inv_lt_one n
· simp
· norm_num | /- | /-
Copyright (c) 2024 Violeta Hernández Palacios. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Violeta Hernández Palacios, Alex Brodbelt
-/
import Mathlib
/-!
# International Mathematical Olympiad 1982, Problem 3
Consider infinite sequences $\{x_n \}$ of positive reals such that $x_0 = 0$ and
$x_0 \geq x_1 \geq x_2 \geq ...$
a) Prove that for every such sequence there is an $n \geq 1$ such that:
$\frac{x_0^2}{x_1} + \ldots + \frac{x_{n-1}^2}{x_n} \geq 3.999$
b) Find such a sequence such that for all n:
$\frac{x_0^2}{x_1} + \ldots + \frac{x_{n-1}^2}{x_n} < 4$
-/
namespace Imo1982P3
/-
The solution is based on Solution 1 from the
[Art of Problem Solving](https://artofproblemsolving.com/wiki/index.php/1982_IMO_Problems/Problem_3)
website. For part a, we use Sedrakyan's lemma to show the sum is bounded below by
$\frac{4n}{n + 1}$, which can be made arbitrarily close to $4$ by taking large $n$. For part b, we
show the sequence $x_n = 2^{-n}$ satisfies the desired inequality.
-/
/-- `x n` is at most the average of all previous terms in the sequence.
This is expressed here with `∑ k ∈ range n, x k` added to both sides. -/
lemma le_avg {x : ℕ → ℝ} {n : ℕ} (hn : n ≠ 0) (hx : Antitone x) :
∑ k ∈ Finset.range (n + 1), x k ≤ (∑ k ∈ Finset.range n, x k) * (1 + 1 / n) := by
rw [Finset.sum_range_succ, mul_one_add, add_le_add_iff_left, mul_one_div,
le_div_iff₀ (mod_cast hn.bot_lt), mul_comm, ← nsmul_eq_mul]
conv_lhs => rw [← Finset.card_range n, ← Finset.sum_const]
refine Finset.sum_le_sum fun k hk ↦ hx (le_of_lt ?_)
simpa using hk
/-- The main inequality used for part a. -/
lemma ineq {x : ℕ → ℝ} {n : ℕ} (hn : n ≠ 0) (hx : Antitone x)
(h0 : x 0 = 1) (hp : ∀ k, 0 < x k) :
4 * n / (n + 1) ≤ ∑ k ∈ Finset.range (n + 1), x k ^ 2 / x (k + 1) := by
calc
-- We first use AM-GM.
_ ≤ (∑ k ∈ Finset.range n, x (k + 1) + 1) ^ 2 /
(∑ k ∈ Finset.range n, x (k + 1)) * n / (n + 1) := by
gcongr
rw [le_div_iff₀]
· simpa using four_mul_le_sq_add (∑ k ∈ Finset.range n, x (k + 1)) 1
· exact Finset.sum_pos (fun k _ ↦ hp _) (Finset.nonempty_range_iff.2 hn)
-- We move the fraction into the denominator.
_ = (∑ k ∈ Finset.range n, x (k + 1) + 1) ^ 2 /
((∑ k ∈ Finset.range n, x (k + 1)) * (1 + 1 / n)) := by
field_simp
-- We make use of the `le_avg` lemma.
_ ≤ (∑ k ∈ Finset.range (n + 1), x k) ^ 2 /
∑ k ∈ Finset.range (n + 1), x (k + 1) := by
gcongr
· exact Finset.sum_pos (fun k _ ↦ hp _) Finset.nonempty_range_add_one
· exact add_nonneg (Finset.sum_nonneg fun k _ ↦ (hp _).le) zero_le_one
· rw [Finset.sum_range_succ', h0]
· exact le_avg hn (hx.comp_monotone @Nat.succ_le_succ)
-- We conclude by Sedrakyan.
_ ≤ _ := Finset.sq_sum_div_le_sum_sq_div _ x fun k _ ↦ hp (k + 1)
theorem imo1982_p3a {x : ℕ → ℝ} (hx : Antitone x) (h0 : x 0 = 1) (hp : ∀ k, 0 < x k) :
∃ n : ℕ, 3.999 ≤ ∑ k ∈ Finset.range n, (x k) ^ 2 / x (k + 1) := by
use 4000
convert Imo1982P3.ineq (Nat.succ_ne_zero 3998) hx h0 hp
norm_num
noncomputable abbrev sol : ℕ → ℝ := fun k ↦ 2⁻¹ ^ k
theorem imo1982_p3b : Antitone sol ∧ sol 0 = 1 ∧ (∀ k, 0 < sol k)
∧ ∀ n, ∑ k ∈ Finset.range n, sol k ^ 2 / sol (k + 1) < 4 := by
refine ⟨?_, pow_zero _, ?_, fun n ↦ ?_⟩
· apply (pow_right_strictAnti₀ _ _).antitone <;> norm_num
· simp
· have {k : ℕ} : (2 : ℝ)⁻¹ ^ (k * 2) * ((2 : ℝ)⁻¹ ^ k)⁻¹ = (2 : ℝ)⁻¹ ^ k := by
rw [← pow_sub₀] <;> simp [mul_two]
simp_rw [← pow_mul, pow_succ, ← div_eq_mul_inv, div_div_eq_mul_div, mul_comm, mul_div_assoc,
← Finset.mul_sum, div_eq_mul_inv, this, ← two_add_two_eq_four, ← mul_two,
mul_lt_mul_iff_of_pos_left two_pos]
convert NNReal.coe_lt_coe.2 <| geom_sum_lt (inv_ne_zero two_ne_zero) two_inv_lt_one n
· simp
· norm_num
| true | Copyright (c) 2024 Violeta Hernández Palacios. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Violeta Hernández Palacios, Alex Brodbelt
-/
import Mathlib
/-!
# International Mathematical Olympiad 1982, Problem 3
Consider infinite sequences $\{x_n \}$ of positive reals such that $x_0 = 0$ and
$x_0 \geq x_1 \geq x_2 \geq ...$
a) Prove that for every such sequence there is an $n \geq 1$ such that:
$\frac{x_0^2}{x_1} + \ldots + \frac{x_{n-1}^2}{x_n} \geq 3.999$
b) Find such a sequence such that for all n:
$\frac{x_0^2}{x_1} + \ldots + \frac{x_{n-1}^2}{x_n} < 4$
-/
namespace Imo1982P3
/-
The solution is based on Solution 1 from the
[Art of Problem Solving](https://artofproblemsolving.com/wiki/index.php/1982_IMO_Problems/Problem_3)
website. For part a, we use Sedrakyan's lemma to show the sum is bounded below by
$\frac{4n}{n + 1}$, which can be made arbitrarily close to $4$ by taking large $n$. For part b, we
show the sequence $x_n = 2^{-n}$ satisfies the desired inequality.
-/
/-- `x n` is at most the average of all previous terms in the sequence.
This is expressed here with `∑ k ∈ range n, x k` added to both sides. -/
lemma le_avg {x : ℕ → ℝ} {n : ℕ} (hn : n ≠ 0) (hx : Antitone x) :
∑ k ∈ Finset.range (n + 1), x k ≤ (∑ k ∈ Finset.range n, x k) * (1 + 1 / n) := by
rw [Finset.sum_range_succ, mul_one_add, add_le_add_iff_left, mul_one_div,
le_div_iff₀ (mod_cast hn.bot_lt), mul_comm, ← nsmul_eq_mul]
conv_lhs => rw [← Finset.card_range n, ← Finset.sum_const]
refine Finset.sum_le_sum fun k hk ↦ hx (le_of_lt ?_)
simpa using hk
/-- The main inequality used for part a. -/
lemma ineq {x : ℕ → ℝ} {n : ℕ} (hn : n ≠ 0) (hx : Antitone x)
(h0 : x 0 = 1) (hp : ∀ k, 0 < x k) :
4 * n / (n + 1) ≤ ∑ k ∈ Finset.range (n + 1), x k ^ 2 / x (k + 1) := by
calc
-- We first use AM-GM.
_ ≤ (∑ k ∈ Finset.range n, x (k + 1) + 1) ^ 2 /
(∑ k ∈ Finset.range n, x (k + 1)) * n / (n + 1) := by
gcongr
rw [le_div_iff₀]
· simpa using four_mul_le_sq_add (∑ k ∈ Finset.range n, x (k + 1)) 1
· exact Finset.sum_pos (fun k _ ↦ hp _) (Finset.nonempty_range_iff.2 hn)
-- We move the fraction into the denominator.
_ = (∑ k ∈ Finset.range n, x (k + 1) + 1) ^ 2 /
((∑ k ∈ Finset.range n, x (k + 1)) * (1 + 1 / n)) := by
field_simp
-- We make use of the `le_avg` lemma.
_ ≤ (∑ k ∈ Finset.range (n + 1), x k) ^ 2 /
∑ k ∈ Finset.range (n + 1), x (k + 1) := by
gcongr
· exact Finset.sum_pos (fun k _ ↦ hp _) Finset.nonempty_range_add_one
· exact add_nonneg (Finset.sum_nonneg fun k _ ↦ (hp _).le) zero_le_one
· rw [Finset.sum_range_succ', h0]
· exact le_avg hn (hx.comp_monotone @Nat.succ_le_succ)
-- We conclude by Sedrakyan.
_ ≤ _ := Finset.sq_sum_div_le_sum_sq_div _ x fun k _ ↦ hp (k + 1)
theorem imo1982_p3a {x : ℕ → ℝ} (hx : Antitone x) (h0 : x 0 = 1) (hp : ∀ k, 0 < x k) :
∃ n : ℕ, 3.999 ≤ ∑ k ∈ Finset.range n, (x k) ^ 2 / x (k + 1) := by
use 4000
convert Imo1982P3.ineq (Nat.succ_ne_zero 3998) hx h0 hp
norm_num
noncomputable abbrev sol : ℕ → ℝ := fun k ↦ 2⁻¹ ^ k
theorem imo1982_p3b : Antitone sol ∧ sol 0 = 1 ∧ (∀ k, 0 < sol k)
∧ ∀ n, ∑ k ∈ Finset.range n, sol k ^ 2 / sol (k + 1) < 4 := by
refine ⟨?_, pow_zero _, ?_, fun n ↦ ?_⟩
· apply (pow_right_strictAnti₀ _ _).antitone <;> norm_num
· simp
· have {k : ℕ} : (2 : ℝ)⁻¹ ^ (k * 2) * ((2 : ℝ)⁻¹ ^ k)⁻¹ = (2 : ℝ)⁻¹ ^ k := by
rw [← pow_sub₀] <;> simp [mul_two]
simp_rw [← pow_mul, pow_succ, ← div_eq_mul_inv, div_div_eq_mul_div, mul_comm, mul_div_assoc,
← Finset.mul_sum, div_eq_mul_inv, this, ← two_add_two_eq_four, ← mul_two,
mul_lt_mul_iff_of_pos_left two_pos]
convert NNReal.coe_lt_coe.2 <| geom_sum_lt (inv_ne_zero two_ne_zero) two_inv_lt_one n
· simp
· norm_num | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1982P3.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown constant 'Finset.nonempty_range_add_one'"], "timeout_s": 600.0, "latency_s": 2.3867, "verified_at": "2026-03-26T18:16:55.073628+00:00"}} | false | true | false | 2.3867 |
compfiles_Imo1982P4 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Goedel-Prover-V2
-/
import Mathlib
/-!
# International Mathematical Olympiad 1982, Problem 4
Prove that if n is a positive integer such that the equation
x3 - 3xy^2 + y^3 = n
has a solution in integers x, y, then it has at least three such solutions.
Show that the equation has no solutions in integers for n = 2891.
-/
namespace Imo1982P4
lemma lemma1 {x' y' : ZMod 7}
(hxy : x' ^ 3 - 3 * x' * y' ^ 2 + y' ^ 3 = 0) : x' = 0 ∧ y' = 0 := by
fin_cases x' <;> fin_cases y' <;> simp (config := { decide := true })at hxy ⊢
theorem imo1982_p4 (n : ℕ)
(hn : 0 < n)
(hxy : ∃ x y : ℤ, x^3 - 3 * x * y^2 + y^3 = n) :
(n ≠ 2891) ∧
∃ x1 x2 x3 y1 y2 y3 : ℤ, (x1^3 - 3 * x1 * y1^2 + y1^3 = n ∧
x2^3 - 3 * x2 * y2^2 + y2^3 = n ∧
x3^3 - 3 * x3 * y3^2 + y3^3 = n ∧
(x1 ≠ x2 ∨ y1 ≠ y2) ∧
(x1 ≠ x3 ∨ y1 ≠ y3) ∧
(x2 ≠ x3 ∨ y2 ≠ y3)) := by
have h_part1 : n ≠ 2891 := by
rintro rfl
rcases hxy with ⟨x, y, hxy⟩
replace hxy : (x : ℤ) ^ 3 - 3 * x * y ^ 2 + y ^ 3 = 2891 := by simpa using hxy
have ⟨h₂, h₃⟩ : (x : ℤ) % 7 = 0 ∧ (y : ℤ) % 7 = 0 := by
replace hxy : (x : ℤ) ^ 3 - 3 * x * y ^ 2 + y ^ 3 ≡ 0 [ZMOD (7:ℕ)] := by
norm_num [Int.ModEq] at hxy ⊢
omega
replace hxy : (x : ZMod 7) ^ 3 - 3 * (x : ZMod 7) * (y : ZMod 7) ^ 2 +
(y : ZMod 7) ^ 3 = 0 := by
rw [←ZMod.intCast_eq_intCast_iff] at hxy
norm_cast
have ⟨h1, h2⟩ := lemma1 hxy
constructor
· rw [ZMod.intCast_zmod_eq_zero_iff_dvd, ←Int.modEq_zero_iff_dvd] at h1
exact h1
· rw [ZMod.intCast_zmod_eq_zero_iff_dvd, ←Int.modEq_zero_iff_dvd] at h2
exact h2
have h₄ : (x : ℤ) % 7 = 0 := h₂
have h₅ : (y : ℤ) % 7 = 0 := h₃
have h₆ : ∃ (a : ℤ), x = 7 * a := by
use x / 7
exact (Int.mul_ediv_cancel_of_emod_eq_zero h₂).symm
have h₇ : ∃ (b : ℤ), y = 7 * b := by
use y / 7
exact (Int.mul_ediv_cancel_of_emod_eq_zero h₃).symm
obtain ⟨a, ha⟩ := h₆
obtain ⟨b, hb⟩ := h₇
rw [ha, hb] at hxy
ring_nf at hxy
have h₉ : (7 : ℤ) ∣ 59 := by
use (a ^ 3 + b ^ 3 - 3 * a * b ^ 2)
omega
norm_num at h₉
have h_part2 : ∃ x1 x2 x3 y1 y2 y3 : ℤ,
(x1^3 - 3 * x1 * y1^2 + y1^3 = n ∧ x2^3 - 3 * x2 * y2^2 + y2^3 = n ∧
x3^3 - 3 * x3 * y3^2 + y3^3 = n ∧ (x1 ≠ x2 ∨ y1 ≠ y2) ∧
(x1 ≠ x3 ∨ y1 ≠ y3) ∧ (x2 ≠ x3 ∨ y2 ≠ y3)) := by
obtain ⟨x, y, hxy⟩ := hxy
have h1 : (y - x)^3 - 3 * (y - x) * (-x)^2 + (-x)^3 =
(x : ℤ)^3 - 3 * x * (y : ℤ)^2 + (y : ℤ)^3 := by
ring_nf
have h2 : (-y)^3 - 3 * (-y) * (x - y)^2 + (x - y)^3 =
(x : ℤ)^3 - 3 * x * (y : ℤ)^2 + (y : ℤ)^3 := by
ring_nf
refine' ⟨x, y - x, -y, y, -x, x - y, _, _, _, _, _, _⟩ <;>
(try simp_all [pow_three]) <;>
(try ring_nf at * ; simp_all) <;>
(try {
by_contra! h
have h₃ : x = 0 := by grind
have h₄ : y = 0 := by grind
simp [h₃, h₄] at hxy
norm_cast at hxy
omega
})
exact ⟨h_part1, h_part2⟩
end Imo1982P4 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Goedel-Prover-V2
-/
import Mathlib
/-!
# International Mathematical Olympiad 1982, Problem 4
Prove that if n is a positive integer such that the equation
x3 - 3xy^2 + y^3 = n
has a solution in integers x, y, then it has at least three such solutions.
Show that the equation has no solutions in integers for n = 2891.
-/
namespace Imo1982P4
lemma lemma1 {x' y' : ZMod 7}
(hxy : x' ^ 3 - 3 * x' * y' ^ 2 + y' ^ 3 = 0) : x' = 0 ∧ y' = 0 := by
fin_cases x' <;> fin_cases y' <;> simp (config := { decide := true })at hxy ⊢
theorem imo1982_p4 (n : ℕ)
(hn : 0 < n)
(hxy : ∃ x y : ℤ, x^3 - 3 * x * y^2 + y^3 = n) :
(n ≠ 2891) ∧
∃ x1 x2 x3 y1 y2 y3 : ℤ, (x1^3 - 3 * x1 * y1^2 + y1^3 = n ∧
x2^3 - 3 * x2 * y2^2 + y2^3 = n ∧
x3^3 - 3 * x3 * y3^2 + y3^3 = n ∧
(x1 ≠ x2 ∨ y1 ≠ y2) ∧
(x1 ≠ x3 ∨ y1 ≠ y3) ∧
(x2 ≠ x3 ∨ y2 ≠ y3)) := by
have h_part1 : n ≠ 2891 := by
rintro rfl
rcases hxy with ⟨x, y, hxy⟩
replace hxy : (x : ℤ) ^ 3 - 3 * x * y ^ 2 + y ^ 3 = 2891 := by simpa using hxy
have ⟨h₂, h₃⟩ : (x : ℤ) % 7 = 0 ∧ (y : ℤ) % 7 = 0 := by
replace hxy : (x : ℤ) ^ 3 - 3 * x * y ^ 2 + y ^ 3 ≡ 0 [ZMOD (7:ℕ)] := by
norm_num [Int.ModEq] at hxy ⊢
omega
replace hxy : (x : ZMod 7) ^ 3 - 3 * (x : ZMod 7) * (y : ZMod 7) ^ 2 +
(y : ZMod 7) ^ 3 = 0 := by
rw [←ZMod.intCast_eq_intCast_iff] at hxy
norm_cast
have ⟨h1, h2⟩ := lemma1 hxy
constructor
· rw [ZMod.intCast_zmod_eq_zero_iff_dvd, ←Int.modEq_zero_iff_dvd] at h1
exact h1
· rw [ZMod.intCast_zmod_eq_zero_iff_dvd, ←Int.modEq_zero_iff_dvd] at h2
exact h2
have h₄ : (x : ℤ) % 7 = 0 := h₂
have h₅ : (y : ℤ) % 7 = 0 := h₃
have h₆ : ∃ (a : ℤ), x = 7 * a := by
use x / 7
exact (Int.mul_ediv_cancel_of_emod_eq_zero h₂).symm
have h₇ : ∃ (b : ℤ), y = 7 * b := by
use y / 7
exact (Int.mul_ediv_cancel_of_emod_eq_zero h₃).symm
obtain ⟨a, ha⟩ := h₆
obtain ⟨b, hb⟩ := h₇
rw [ha, hb] at hxy
ring_nf at hxy
have h₉ : (7 : ℤ) ∣ 59 := by
use (a ^ 3 + b ^ 3 - 3 * a * b ^ 2)
omega
norm_num at h₉
have h_part2 : ∃ x1 x2 x3 y1 y2 y3 : ℤ,
(x1^3 - 3 * x1 * y1^2 + y1^3 = n ∧ x2^3 - 3 * x2 * y2^2 + y2^3 = n ∧
x3^3 - 3 * x3 * y3^2 + y3^3 = n ∧ (x1 ≠ x2 ∨ y1 ≠ y2) ∧
(x1 ≠ x3 ∨ y1 ≠ y3) ∧ (x2 ≠ x3 ∨ y2 ≠ y3)) := by
obtain ⟨x, y, hxy⟩ := hxy
have h1 : (y - x)^3 - 3 * (y - x) * (-x)^2 + (-x)^3 =
(x : ℤ)^3 - 3 * x * (y : ℤ)^2 + (y : ℤ)^3 := by
ring_nf
have h2 : (-y)^3 - 3 * (-y) * (x - y)^2 + (x - y)^3 =
(x : ℤ)^3 - 3 * x * (y : ℤ)^2 + (y : ℤ)^3 := by
ring_nf
refine' ⟨x, y - x, -y, y, -x, x - y, _, _, _, _, _, _⟩ <;>
(try simp_all [pow_three]) <;>
(try ring_nf at * ; simp_all) <;>
(try {
by_contra! h
have h₃ : x = 0 := by grind
have h₄ : y = 0 := by grind
simp [h₃, h₄] at hxy
norm_cast at hxy
omega
})
exact ⟨h_part1, h_part2⟩
end Imo1982P4
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Goedel-Prover-V2
-/
import Mathlib
/-!
# International Mathematical Olympiad 1982, Problem 4
Prove that if n is a positive integer such that the equation
x3 - 3xy^2 + y^3 = n
has a solution in integers x, y, then it has at least three such solutions.
Show that the equation has no solutions in integers for n = 2891.
-/
namespace Imo1982P4
lemma lemma1 {x' y' : ZMod 7}
(hxy : x' ^ 3 - 3 * x' * y' ^ 2 + y' ^ 3 = 0) : x' = 0 ∧ y' = 0 := by
fin_cases x' <;> fin_cases y' <;> simp (config := { decide := true })at hxy ⊢
theorem imo1982_p4 (n : ℕ)
(hn : 0 < n)
(hxy : ∃ x y : ℤ, x^3 - 3 * x * y^2 + y^3 = n) :
(n ≠ 2891) ∧
∃ x1 x2 x3 y1 y2 y3 : ℤ, (x1^3 - 3 * x1 * y1^2 + y1^3 = n ∧
x2^3 - 3 * x2 * y2^2 + y2^3 = n ∧
x3^3 - 3 * x3 * y3^2 + y3^3 = n ∧
(x1 ≠ x2 ∨ y1 ≠ y2) ∧
(x1 ≠ x3 ∨ y1 ≠ y3) ∧
(x2 ≠ x3 ∨ y2 ≠ y3)) := by
have h_part1 : n ≠ 2891 := by
rintro rfl
rcases hxy with ⟨x, y, hxy⟩
replace hxy : (x : ℤ) ^ 3 - 3 * x * y ^ 2 + y ^ 3 = 2891 := by simpa using hxy
have ⟨h₂, h₃⟩ : (x : ℤ) % 7 = 0 ∧ (y : ℤ) % 7 = 0 := by
replace hxy : (x : ℤ) ^ 3 - 3 * x * y ^ 2 + y ^ 3 ≡ 0 [ZMOD (7:ℕ)] := by
norm_num [Int.ModEq] at hxy ⊢
omega
replace hxy : (x : ZMod 7) ^ 3 - 3 * (x : ZMod 7) * (y : ZMod 7) ^ 2 +
(y : ZMod 7) ^ 3 = 0 := by
rw [←ZMod.intCast_eq_intCast_iff] at hxy
norm_cast
have ⟨h1, h2⟩ := lemma1 hxy
constructor
· rw [ZMod.intCast_zmod_eq_zero_iff_dvd, ←Int.modEq_zero_iff_dvd] at h1
exact h1
· rw [ZMod.intCast_zmod_eq_zero_iff_dvd, ←Int.modEq_zero_iff_dvd] at h2
exact h2
have h₄ : (x : ℤ) % 7 = 0 := h₂
have h₅ : (y : ℤ) % 7 = 0 := h₃
have h₆ : ∃ (a : ℤ), x = 7 * a := by
use x / 7
exact (Int.mul_ediv_cancel_of_emod_eq_zero h₂).symm
have h₇ : ∃ (b : ℤ), y = 7 * b := by
use y / 7
exact (Int.mul_ediv_cancel_of_emod_eq_zero h₃).symm
obtain ⟨a, ha⟩ := h₆
obtain ⟨b, hb⟩ := h₇
rw [ha, hb] at hxy
ring_nf at hxy
have h₉ : (7 : ℤ) ∣ 59 := by
use (a ^ 3 + b ^ 3 - 3 * a * b ^ 2)
omega
norm_num at h₉
have h_part2 : ∃ x1 x2 x3 y1 y2 y3 : ℤ,
(x1^3 - 3 * x1 * y1^2 + y1^3 = n ∧ x2^3 - 3 * x2 * y2^2 + y2^3 = n ∧
x3^3 - 3 * x3 * y3^2 + y3^3 = n ∧ (x1 ≠ x2 ∨ y1 ≠ y2) ∧
(x1 ≠ x3 ∨ y1 ≠ y3) ∧ (x2 ≠ x3 ∨ y2 ≠ y3)) := by
obtain ⟨x, y, hxy⟩ := hxy
have h1 : (y - x)^3 - 3 * (y - x) * (-x)^2 + (-x)^3 =
(x : ℤ)^3 - 3 * x * (y : ℤ)^2 + (y : ℤ)^3 := by
ring_nf
have h2 : (-y)^3 - 3 * (-y) * (x - y)^2 + (x - y)^3 =
(x : ℤ)^3 - 3 * x * (y : ℤ)^2 + (y : ℤ)^3 := by
ring_nf
refine' ⟨x, y - x, -y, y, -x, x - y, _, _, _, _, _, _⟩ <;>
(try simp_all [pow_three]) <;>
(try ring_nf at * ; simp_all) <;>
(try {
by_contra! h
have h₃ : x = 0 := by grind
have h₄ : y = 0 := by grind
simp [h₃, h₄] at hxy
norm_cast at hxy
omega
})
exact ⟨h_part1, h_part2⟩
end Imo1982P4 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1982P4.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 120, "latency_s": 6.682, "verified_at": "2026-03-30T14:41:55.245255+00:00"}} | true | true | false | 6.682 |
compfiles_Imo1983P1 | compfiles | Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1983, Problem 1
Let ℝ+ be the set of positive real numbers.
Determine all functions f : ℝ+ → ℝ+ which satisfy:
i) f(xf(y)) = yf(x) for all x y ∈ ℝ+.
ii) f(x) → 0 as x → ∞.
-/
namespace Imo1983P1
abbrev PosReal : Type := { x : ℝ // 0 < x }
notation "ℝ+" => PosReal
abbrev SolutionSet : Set (ℝ+ → ℝ+) := { fun x ↦ 1 / x }
theorem imo1983_p1 (f : ℝ+ → ℝ+) :
f ∈ SolutionSet ↔
((∀ x y, f (x * f y) = y * f x) ∧
(∀ ε, ∃ x, ∀ y, x < y → f y < ε)) := by
-- following the informal solution at
-- https://artofproblemsolving.com/wiki/index.php/1983_IMO_Problems/Problem_1
constructor
· rintro rfl
constructor
· intro x y; simp
· intro x
use 1/x
intro y hy
dsimp
exact div_lt_comm.mp hy
rintro ⟨hi, hii⟩
rw [Set.mem_singleton_iff]
have h1 : f 1 = 1 := by
have h2 := hi 1 1
have h3 := hi 1 (f 1)
simp only [one_mul] at h2 h3
rw [h2, h2, left_eq_mul] at h3
exact h3
suffices h3 : ∀ a, f a = a → a = 1 by
funext x
exact eq_one_div_of_mul_eq_one_right (h3 (x * f x) (hi x x))
intro a ha
by_contra! H
have hi1 : ∀ x, f (x * a) = a * f x := fun x ↦ by
have := hi x a
rwa [ha] at this
have h4 : f (1 / a) = 1 / a := by
have h5 := hi1 (1 / a)
rw [one_div, inv_mul_cancel, h1, ← one_div] at h5
exact eq_one_div_of_mul_eq_one_right h5.symm
wlog H1 : 1 < a generalizing a with h
· refine h (1/a) h4 ?_ ?_ ?_ ?_
· exact div_ne_one.mpr (Ne.symm H)
· intro x
have h7 := hi x (1/a)
rwa [h4] at h7
· simp [ha]
· have h6 : a < 1 := by
push_neg at H1
exact lt_of_le_of_ne H1 H
exact one_lt_div'.mpr h6
have hi3 : ∀ m, f (a^m) = a^m := by
intro m
induction' m with pm ih
· simp [h1]
· rw [pow_succ']
nth_rewrite 1 [mul_comm]
rw [hi1, ih]
-- a > 1, so a^m approaches ∞ as m → ∞
-- but a^m = f (a^m), so that contradicts hii
obtain ⟨x0, hx0⟩ := hii 1
have h12 : ∃ m, x0 < a^m := by
-- 1 + (a-1) * m ≤ (1 + (a-1)) ^ m
-- suffices to choose m such that
-- x0 < 1 + (a-1) * m
-- suffices to choose m such that
-- x0 < (a-1) * m
-- x0 / (a - 1) < m
-- choose m = Ceil((x0 / (a - 1))
obtain ⟨x, hx⟩ := x0
obtain ⟨a, ha0⟩ := a
use Nat.ceil (x / (a - 1))
change x < a ^ ⌈ _⌉₊
change 1 < a at H1
clear f hi hii h1 hx0 ha H hi1 h4 hi3
nth_rewrite 1 [show a = 1 + (a - 1) by ring]
have h20 : 1 + ((⌈(x / (a - 1))⌉₊:ℕ):ℝ) * (a - 1) ≤
(1 + (a - 1)) ^ ⌈x / (a - 1)⌉₊
:= by
have h30 : -2 ≤ a - 1 := by linarith
exact one_add_mul_le_pow h30 _
suffices x < 1 + (((⌈(x / (a - 1))⌉₊):ℕ):ℝ) * (a - 1)
from lt_of_le_of_lt' h20 this
have h21 := Nat.le_ceil (x / (a - 1))
have h24 : 0 < a - 1 := sub_pos.mpr H1
suffices x < 1 + (x / (a - 1)) * (a - 1) by
have h25 := (mul_le_mul_iff_of_pos_right h24).mpr h21
exact lt_add_of_lt_add_left this h25
rw [div_mul_cancel₀ _ (ne_of_lt h24).symm]
exact lt_one_add x
obtain ⟨m0, hm1⟩ := h12
have h13 := hx0 (a ^ m0) hm1
rw [hi3] at h13
have h14 : 1 ≤ a ^ m0 :=
one_le_pow_of_one_le' (le_of_lt H1) m0
rw [lt_iff_not_ge] at h13
contradiction
end Imo1983P1 | /- | /-
Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1983, Problem 1
Let ℝ+ be the set of positive real numbers.
Determine all functions f : ℝ+ → ℝ+ which satisfy:
i) f(xf(y)) = yf(x) for all x y ∈ ℝ+.
ii) f(x) → 0 as x → ∞.
-/
namespace Imo1983P1
abbrev PosReal : Type := { x : ℝ // 0 < x }
notation "ℝ+" => PosReal
abbrev SolutionSet : Set (ℝ+ → ℝ+) := { fun x ↦ 1 / x }
theorem imo1983_p1 (f : ℝ+ → ℝ+) :
f ∈ SolutionSet ↔
((∀ x y, f (x * f y) = y * f x) ∧
(∀ ε, ∃ x, ∀ y, x < y → f y < ε)) := by
-- following the informal solution at
-- https://artofproblemsolving.com/wiki/index.php/1983_IMO_Problems/Problem_1
constructor
· rintro rfl
constructor
· intro x y; simp
· intro x
use 1/x
intro y hy
dsimp
exact div_lt_comm.mp hy
rintro ⟨hi, hii⟩
rw [Set.mem_singleton_iff]
have h1 : f 1 = 1 := by
have h2 := hi 1 1
have h3 := hi 1 (f 1)
simp only [one_mul] at h2 h3
rw [h2, h2, left_eq_mul] at h3
exact h3
suffices h3 : ∀ a, f a = a → a = 1 by
funext x
exact eq_one_div_of_mul_eq_one_right (h3 (x * f x) (hi x x))
intro a ha
by_contra! H
have hi1 : ∀ x, f (x * a) = a * f x := fun x ↦ by
have := hi x a
rwa [ha] at this
have h4 : f (1 / a) = 1 / a := by
have h5 := hi1 (1 / a)
rw [one_div, inv_mul_cancel, h1, ← one_div] at h5
exact eq_one_div_of_mul_eq_one_right h5.symm
wlog H1 : 1 < a generalizing a with h
· refine h (1/a) h4 ?_ ?_ ?_ ?_
· exact div_ne_one.mpr (Ne.symm H)
· intro x
have h7 := hi x (1/a)
rwa [h4] at h7
· simp [ha]
· have h6 : a < 1 := by
push_neg at H1
exact lt_of_le_of_ne H1 H
exact one_lt_div'.mpr h6
have hi3 : ∀ m, f (a^m) = a^m := by
intro m
induction' m with pm ih
· simp [h1]
· rw [pow_succ']
nth_rewrite 1 [mul_comm]
rw [hi1, ih]
-- a > 1, so a^m approaches ∞ as m → ∞
-- but a^m = f (a^m), so that contradicts hii
obtain ⟨x0, hx0⟩ := hii 1
have h12 : ∃ m, x0 < a^m := by
-- 1 + (a-1) * m ≤ (1 + (a-1)) ^ m
-- suffices to choose m such that
-- x0 < 1 + (a-1) * m
-- suffices to choose m such that
-- x0 < (a-1) * m
-- x0 / (a - 1) < m
-- choose m = Ceil((x0 / (a - 1))
obtain ⟨x, hx⟩ := x0
obtain ⟨a, ha0⟩ := a
use Nat.ceil (x / (a - 1))
change x < a ^ ⌈ _⌉₊
change 1 < a at H1
clear f hi hii h1 hx0 ha H hi1 h4 hi3
nth_rewrite 1 [show a = 1 + (a - 1) by ring]
have h20 : 1 + ((⌈(x / (a - 1))⌉₊:ℕ):ℝ) * (a - 1) ≤
(1 + (a - 1)) ^ ⌈x / (a - 1)⌉₊
:= by
have h30 : -2 ≤ a - 1 := by linarith
exact one_add_mul_le_pow h30 _
suffices x < 1 + (((⌈(x / (a - 1))⌉₊):ℕ):ℝ) * (a - 1)
from lt_of_le_of_lt' h20 this
have h21 := Nat.le_ceil (x / (a - 1))
have h24 : 0 < a - 1 := sub_pos.mpr H1
suffices x < 1 + (x / (a - 1)) * (a - 1) by
have h25 := (mul_le_mul_iff_of_pos_right h24).mpr h21
exact lt_add_of_lt_add_left this h25
rw [div_mul_cancel₀ _ (ne_of_lt h24).symm]
exact lt_one_add x
obtain ⟨m0, hm1⟩ := h12
have h13 := hx0 (a ^ m0) hm1
rw [hi3] at h13
have h14 : 1 ≤ a ^ m0 :=
one_le_pow_of_one_le' (le_of_lt H1) m0
rw [lt_iff_not_ge] at h13
contradiction
end Imo1983P1
| true | Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1983, Problem 1
Let ℝ+ be the set of positive real numbers.
Determine all functions f : ℝ+ → ℝ+ which satisfy:
i) f(xf(y)) = yf(x) for all x y ∈ ℝ+.
ii) f(x) → 0 as x → ∞.
-/
namespace Imo1983P1
abbrev PosReal : Type := { x : ℝ // 0 < x }
notation "ℝ+" => PosReal
abbrev SolutionSet : Set (ℝ+ → ℝ+) := { fun x ↦ 1 / x }
theorem imo1983_p1 (f : ℝ+ → ℝ+) :
f ∈ SolutionSet ↔
((∀ x y, f (x * f y) = y * f x) ∧
(∀ ε, ∃ x, ∀ y, x < y → f y < ε)) := by
-- following the informal solution at
-- https://artofproblemsolving.com/wiki/index.php/1983_IMO_Problems/Problem_1
constructor
· rintro rfl
constructor
· intro x y; simp
· intro x
use 1/x
intro y hy
dsimp
exact div_lt_comm.mp hy
rintro ⟨hi, hii⟩
rw [Set.mem_singleton_iff]
have h1 : f 1 = 1 := by
have h2 := hi 1 1
have h3 := hi 1 (f 1)
simp only [one_mul] at h2 h3
rw [h2, h2, left_eq_mul] at h3
exact h3
suffices h3 : ∀ a, f a = a → a = 1 by
funext x
exact eq_one_div_of_mul_eq_one_right (h3 (x * f x) (hi x x))
intro a ha
by_contra! H
have hi1 : ∀ x, f (x * a) = a * f x := fun x ↦ by
have := hi x a
rwa [ha] at this
have h4 : f (1 / a) = 1 / a := by
have h5 := hi1 (1 / a)
rw [one_div, inv_mul_cancel, h1, ← one_div] at h5
exact eq_one_div_of_mul_eq_one_right h5.symm
wlog H1 : 1 < a generalizing a with h
· refine h (1/a) h4 ?_ ?_ ?_ ?_
· exact div_ne_one.mpr (Ne.symm H)
· intro x
have h7 := hi x (1/a)
rwa [h4] at h7
· simp [ha]
· have h6 : a < 1 := by
push_neg at H1
exact lt_of_le_of_ne H1 H
exact one_lt_div'.mpr h6
have hi3 : ∀ m, f (a^m) = a^m := by
intro m
induction' m with pm ih
· simp [h1]
· rw [pow_succ']
nth_rewrite 1 [mul_comm]
rw [hi1, ih]
-- a > 1, so a^m approaches ∞ as m → ∞
-- but a^m = f (a^m), so that contradicts hii
obtain ⟨x0, hx0⟩ := hii 1
have h12 : ∃ m, x0 < a^m := by
-- 1 + (a-1) * m ≤ (1 + (a-1)) ^ m
-- suffices to choose m such that
-- x0 < 1 + (a-1) * m
-- suffices to choose m such that
-- x0 < (a-1) * m
-- x0 / (a - 1) < m
-- choose m = Ceil((x0 / (a - 1))
obtain ⟨x, hx⟩ := x0
obtain ⟨a, ha0⟩ := a
use Nat.ceil (x / (a - 1))
change x < a ^ ⌈ _⌉₊
change 1 < a at H1
clear f hi hii h1 hx0 ha H hi1 h4 hi3
nth_rewrite 1 [show a = 1 + (a - 1) by ring]
have h20 : 1 + ((⌈(x / (a - 1))⌉₊:ℕ):ℝ) * (a - 1) ≤
(1 + (a - 1)) ^ ⌈x / (a - 1)⌉₊
:= by
have h30 : -2 ≤ a - 1 := by linarith
exact one_add_mul_le_pow h30 _
suffices x < 1 + (((⌈(x / (a - 1))⌉₊):ℕ):ℝ) * (a - 1)
from lt_of_le_of_lt' h20 this
have h21 := Nat.le_ceil (x / (a - 1))
have h24 : 0 < a - 1 := sub_pos.mpr H1
suffices x < 1 + (x / (a - 1)) * (a - 1) by
have h25 := (mul_le_mul_iff_of_pos_right h24).mpr h21
exact lt_add_of_lt_add_left this h25
rw [div_mul_cancel₀ _ (ne_of_lt h24).symm]
exact lt_one_add x
obtain ⟨m0, hm1⟩ := h12
have h13 := hx0 (a ^ m0) hm1
rw [hi3] at h13
have h14 : 1 ≤ a ^ m0 :=
one_le_pow_of_one_le' (le_of_lt H1) m0
rw [lt_iff_not_ge] at h13
contradiction
end Imo1983P1 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1983P1.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 600.0, "latency_s": 6.3627, "verified_at": "2026-03-26T18:16:59.050015+00:00"}} | true | true | false | 6.3627 |
compfiles_Imo1983P5 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Benpigchu
-/
import Mathlib
/-!
# International Mathematical Olympiad 1983, Problem 5
Is it possible to choose $1983$ distinct positive integers,
all less than or equal to $10^5$,
no three of which are consecutive terms of an arithmetic progression?
Justify your answer.
-/
namespace Imo1983P5
lemma Nat.ofDigits_eq (b : ℕ) (L : List ℕ)
: Nat.ofDigits b L = ∑ i ∈ Finset.range L.length, (L.getI i) * b ^ i := by
induction L with
| nil => simp
| cons d L' h =>
simp only [Nat.ofDigits_cons, List.length_cons, Finset.sum_range_succ',
List.getI_cons_zero, pow_zero, mul_one, List.getI_cons_succ]
rw [h, add_comm, mul_comm, Finset.sum_mul]
congr 1
apply Finset.sum_congr rfl fun i _ ↦ by ring
lemma Nat.getI_digits_lt (n i : ℕ) {b : ℕ} (h : 2 ≤ b) : (b.digits n).getI i < b := by
simp only [← List.getD_default_eq_getI, Nat.default_eq_zero, Nat.getD_digits n i h]
exact Nat.mod_lt _ (by omega)
lemma Nat.getI_digits_add (m n : ℕ) {b : ℕ} (hb : 2 ≤ b)
(h : ∀ i : ℕ, (b.digits m).getI i + (b.digits n).getI i < b)
: ∀ i : ℕ, (b.digits m).getI i + (b.digits n).getI i = (b.digits (m + n)).getI i := by
induction' m using Nat.strong_induction_on with m h' generalizing n
by_cases! h'' : m = 0 ∨ n = 0
· rcases h'' with rfl | rfl <;> simp [Nat.digits_zero, List.getI_nil]
· rw [Nat.ne_zero_iff_zero_lt, Nat.ne_zero_iff_zero_lt] at h''
rw [Nat.digits_of_two_le_of_pos hb h''.left] at h ⊢
rw [Nat.digits_of_two_le_of_pos hb h''.right] at h ⊢
have hmn : 0 < m + n := add_pos h''.left h''.right
rw [Nat.digits_of_two_le_of_pos hb hmn]
have h0 := h 0
rw [List.getI_cons_zero, List.getI_cons_zero] at h0
intro i
by_cases! hi : i = 0
· rw [hi, List.getI_cons_zero, List.getI_cons_zero, List.getI_cons_zero]
exact (Nat.add_mod_of_add_mod_lt h0).symm
· rcases Nat.exists_eq_succ_of_ne_zero hi with ⟨i', hi'⟩
rw [hi', List.getI_cons_succ, List.getI_cons_succ, List.getI_cons_succ]
have hm' : m / b < m := Nat.div_lt_self h''.left (by omega)
have h'mn : ∀ (i : ℕ), (b.digits (m / b)).getI i + (b.digits (n / b)).getI i < b := by
intro i
rw [← List.getI_cons_succ (m / b)]
nth_rw 2 [← List.getI_cons_succ (n / b)]
exact h (i + 1)
have h'm'n' := h' (m / b) hm' (n / b) h'mn
rw [h'm'n' i']
congr
exact (Nat.add_div_eq_of_add_mod_lt h0).symm
lemma Nat.eq_iff_getI_digits_eq (m n b: ℕ)
: m = n ↔ (∀ i : ℕ, (b.digits m).getI i = (b.digits n).getI i) := by
constructor
· intro hmn i
rw [hmn]
· intro h
rw [← Nat.ofDigits_digits b m, ← Nat.ofDigits_digits b n]
rw [Nat.ofDigits_eq, Nat.ofDigits_eq]
rw [← Finset.sdiff_union_inter (Finset.range (b.digits m).length) (Finset.range (b.digits n).length)]
nth_rw 3 [← Finset.sdiff_union_inter (Finset.range (b.digits n).length) (Finset.range (b.digits m).length)]
rw [Finset.sum_union (Finset.disjoint_sdiff_inter _ _)]
rw [Finset.sum_union (Finset.disjoint_sdiff_inter _ _)]
have h₁ : ∀ i ∈ Finset.range (b.digits m).length \ Finset.range (b.digits n).length,
(b.digits m).getI i * b ^ i = 0 := by
intro i hi
rw [h i]
apply mul_eq_zero_of_left
rw [← Nat.default_eq_zero]
apply List.getI_eq_default
rw [Finset.mem_sdiff, Finset.mem_range, Finset.mem_range, not_lt] at hi
exact hi.right
have h₂ : ∀ i ∈ Finset.range (b.digits n).length \ Finset.range (b.digits m).length,
(b.digits n).getI i * b ^ i = 0 := by
intro i hi
rw [← h i]
apply mul_eq_zero_of_left
rw [← Nat.default_eq_zero]
apply List.getI_eq_default
rw [Finset.mem_sdiff, Finset.mem_range, Finset.mem_range, not_lt] at hi
exact hi.right
rw [Finset.sum_eq_zero h₁, Finset.sum_eq_zero h₂, zero_add, zero_add]
apply Finset.sum_congr (Finset.inter_comm _ _)
intro i hi
rw [h i]
def base_two_to_base_three (n : ℕ) := Nat.ofDigits 3 (Nat.digits 2 n)
lemma digits_base_two_to_base_three (n : ℕ)
: Nat.digits 2 n = Nat.digits 3 (base_two_to_base_three n) := by
symm; rw [base_two_to_base_three]; apply Nat.digits_ofDigits
· norm_num
· exact fun l hl => lt_trans (Nat.digits_lt_base (by norm_num) hl) (by norm_num)
· exact fun h => Nat.getLast_digit_ne_zero 2 (Nat.digits_ne_nil_iff_ne_zero.mp h)
lemma base_two_to_base_three_inj : Function.Injective base_two_to_base_three := fun m n hmn =>
Nat.digits_inj_iff.mp (by rw [digits_base_two_to_base_three, digits_base_two_to_base_three, hmn])
lemma base_two_to_base_three_zero : base_two_to_base_three 0 = 0 := rfl
lemma base_two_to_base_three_pos {m : ℕ} (hm : 0 < m) : 0 < base_two_to_base_three m :=
Nat.pos_of_ne_zero (base_two_to_base_three_zero ▸ base_two_to_base_three_inj.ne hm.ne')
def zero_or_one_in_base_three (n : ℕ) :=
∀ i : ℕ, (Nat.digits 3 n).getI i = 0 ∨ (Nat.digits 3 n).getI i = 1
lemma zero_or_one_in_base_three_of_eq_base_two_to_base_three
{m n : ℕ} (hmn : base_two_to_base_three n = m)
: zero_or_one_in_base_three m := by
rw [← hmn, zero_or_one_in_base_three]
intro i
rw [← Nat.le_one_iff_eq_zero_or_eq_one, ← digits_base_two_to_base_three]
rw [← Nat.lt_succ_iff]
apply Nat.getI_digits_lt
rfl
lemma eq_iff_of_zero_or_one_in_base {m n : ℕ} (hm : zero_or_one_in_base_three m) (hn : zero_or_one_in_base_three n)
: (∀ i : ℕ, (Nat.digits 3 (m + n)).getI i = 0 ∨ (Nat.digits 3 (m + n)).getI i = 2)
↔ m = n := by
rw [zero_or_one_in_base_three] at hm hn
rw [Nat.eq_iff_getI_digits_eq m n 3]
have h : ∀ i : ℕ, (Nat.digits 3 m).getI i + (Nat.digits 3 n).getI i < 3 := fun i ↦ by
have := hm i; have := hn i; omega
apply Nat.getI_digits_add _ _ (by norm_num) at h
constructor <;> intro h' i
· have := hm i; have := hn i; have := h i; have := h' i; omega
· have := hn i; have := h i; have := h' i; omega
theorem generalized (n : ℕ+) :
∃ S : Finset ℕ+, S.card = 2 ^ n.val - 1 ∧
(∀ x ∈ S, x.val ≤ (3 ^ n.val - 1) / 2) ∧
∀ x ∈ S, ∀ y ∈ S, ∀ z ∈ S, x < y ∧ y < z → x + z ≠ 2 * y := by
set S' := Finset.image base_two_to_base_three (Finset.range (2 ^ n.val) \ Finset.range 1) with hS'
use Finset.subtype (fun n ↦ 0 < n) S'
constructorm* _ ∧ _
·
rw [Finset.card_subtype]
have hS'_filter : ∀ n ∈ S', 0 < n := by
simp only [hS', Finset.mem_image, Finset.mem_sdiff, Finset.mem_range, Nat.lt_one_iff,
forall_exists_index, and_imp]
intro _ m _ hm0 rfl
exact base_two_to_base_three_pos (Nat.pos_of_ne_zero hm0)
rw [Finset.card_filter_eq_iff.mpr hS'_filter, Finset.card_image_of_injective _ base_two_to_base_three_inj]
rw [Finset.card_sdiff, Finset.range_inter_range, Finset.card_range, Finset.card_range]
congr 1
exact min_eq_left (Nat.one_le_pow _ _ (by norm_num))
· intro x hx
rw [Finset.mem_subtype, hS', Finset.mem_image] at hx
rcases hx with ⟨m, hm, hmx⟩
rw [PNat.val, ← hmx, base_two_to_base_three, Nat.ofDigits_eq]
have h' : ∀ i ∈ Finset.range (Nat.digits 2 m).length, (Nat.digits 2 m).getI i * 3 ^ i ≤ 3 ^ i := by
intro i _; nth_rw 2 [← one_mul (3 ^ i)]
exact Nat.mul_le_mul_right _ (Nat.lt_succ_iff.mp (Nat.getI_digits_lt (b := 2) m i le_rfl))
apply le_trans (Finset.sum_le_sum h')
rw [Nat.le_div_iff_mul_le (by norm_num)]
zify
nth_rw 2 [(by norm_num : (2 : ℤ) = 3 - 1)]
rw [geom_sum_mul, Nat.cast_sub (Nat.one_le_pow _ 3 (by norm_num)), Nat.cast_one]
rw [sub_le_sub_iff_right]
push_cast
rw [pow_le_pow_iff_right₀ (by norm_num), Nat.digits_length_le_iff (by norm_num)]
rw [Finset.mem_sdiff, Finset.mem_range] at hm
exact hm.left
· rintro x hx y hy z hz h'
contrapose! h'
rw [Finset.mem_subtype, hS', Finset.mem_image] at hx hy hz
rcases hx with ⟨x', hx', hx'x⟩
rcases hy with ⟨y', hy', hy'y⟩
rcases hz with ⟨z', hz', hz'z⟩
rw [← PNat.coe_inj] at h'
rw [← PNat.coe_lt_coe, ← PNat.coe_le_coe]
push_cast at h'
rw [two_mul] at h'
rw [PNat.val] at h' ⊢
apply zero_or_one_in_base_three_of_eq_base_two_to_base_three at hx'x
apply zero_or_one_in_base_three_of_eq_base_two_to_base_three at hy'y
apply zero_or_one_in_base_three_of_eq_base_two_to_base_three at hz'z
have hzx : Subtype.val x = Subtype.val z := by
rw [← eq_iff_of_zero_or_one_in_base hx'x hz'z, h']
rw [eq_iff_of_zero_or_one_in_base hy'y hy'y]
rw [hzx]
apply le_of_lt
theorem imo1983_p5 :
∃ S : Finset ℕ+, S.card = 1983 ∧
(∀ x ∈ S, x ≤ 10^5) ∧
∀ x ∈ S, ∀ y ∈ S, ∀ z ∈ S, x < y ∧ y < z → x + z ≠ 2 * y := by
rcases generalized 11 with ⟨S', hS'₁, hS'₂, hS'₃⟩
have h : 1983 ≤ S'.card := by rw [hS'₁]; norm_num
rcases Finset.exists_subset_card_eq h with ⟨S, hS₁, hS₂⟩
use S
constructorm* _ ∧ _
· exact hS₂
· exact fun x hx ↦ by rw [← PNat.coe_le_coe]; exact le_trans (hS'₂ x (hS₁ hx)) (by norm_num)
· exact fun x hx y hy z hz ↦ hS'₃ x (hS₁ hx) y (hS₁ hy) z (hS₁ hz)
end Imo1983P5 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Benpigchu
-/
import Mathlib
/-!
# International Mathematical Olympiad 1983, Problem 5
Is it possible to choose $1983$ distinct positive integers,
all less than or equal to $10^5$,
no three of which are consecutive terms of an arithmetic progression?
Justify your answer.
-/
namespace Imo1983P5
lemma Nat.ofDigits_eq (b : ℕ) (L : List ℕ)
: Nat.ofDigits b L = ∑ i ∈ Finset.range L.length, (L.getI i) * b ^ i := by
induction L with
| nil => simp
| cons d L' h =>
simp only [Nat.ofDigits_cons, List.length_cons, Finset.sum_range_succ',
List.getI_cons_zero, pow_zero, mul_one, List.getI_cons_succ]
rw [h, add_comm, mul_comm, Finset.sum_mul]
congr 1
apply Finset.sum_congr rfl fun i _ ↦ by ring
lemma Nat.getI_digits_lt (n i : ℕ) {b : ℕ} (h : 2 ≤ b) : (b.digits n).getI i < b := by
simp only [← List.getD_default_eq_getI, Nat.default_eq_zero, Nat.getD_digits n i h]
exact Nat.mod_lt _ (by omega)
lemma Nat.getI_digits_add (m n : ℕ) {b : ℕ} (hb : 2 ≤ b)
(h : ∀ i : ℕ, (b.digits m).getI i + (b.digits n).getI i < b)
: ∀ i : ℕ, (b.digits m).getI i + (b.digits n).getI i = (b.digits (m + n)).getI i := by
induction' m using Nat.strong_induction_on with m h' generalizing n
by_cases! h'' : m = 0 ∨ n = 0
· rcases h'' with rfl | rfl <;> simp [Nat.digits_zero, List.getI_nil]
· rw [Nat.ne_zero_iff_zero_lt, Nat.ne_zero_iff_zero_lt] at h''
rw [Nat.digits_of_two_le_of_pos hb h''.left] at h ⊢
rw [Nat.digits_of_two_le_of_pos hb h''.right] at h ⊢
have hmn : 0 < m + n := add_pos h''.left h''.right
rw [Nat.digits_of_two_le_of_pos hb hmn]
have h0 := h 0
rw [List.getI_cons_zero, List.getI_cons_zero] at h0
intro i
by_cases! hi : i = 0
· rw [hi, List.getI_cons_zero, List.getI_cons_zero, List.getI_cons_zero]
exact (Nat.add_mod_of_add_mod_lt h0).symm
· rcases Nat.exists_eq_succ_of_ne_zero hi with ⟨i', hi'⟩
rw [hi', List.getI_cons_succ, List.getI_cons_succ, List.getI_cons_succ]
have hm' : m / b < m := Nat.div_lt_self h''.left (by omega)
have h'mn : ∀ (i : ℕ), (b.digits (m / b)).getI i + (b.digits (n / b)).getI i < b := by
intro i
rw [← List.getI_cons_succ (m / b)]
nth_rw 2 [← List.getI_cons_succ (n / b)]
exact h (i + 1)
have h'm'n' := h' (m / b) hm' (n / b) h'mn
rw [h'm'n' i']
congr
exact (Nat.add_div_eq_of_add_mod_lt h0).symm
lemma Nat.eq_iff_getI_digits_eq (m n b: ℕ)
: m = n ↔ (∀ i : ℕ, (b.digits m).getI i = (b.digits n).getI i) := by
constructor
· intro hmn i
rw [hmn]
· intro h
rw [← Nat.ofDigits_digits b m, ← Nat.ofDigits_digits b n]
rw [Nat.ofDigits_eq, Nat.ofDigits_eq]
rw [← Finset.sdiff_union_inter (Finset.range (b.digits m).length) (Finset.range (b.digits n).length)]
nth_rw 3 [← Finset.sdiff_union_inter (Finset.range (b.digits n).length) (Finset.range (b.digits m).length)]
rw [Finset.sum_union (Finset.disjoint_sdiff_inter _ _)]
rw [Finset.sum_union (Finset.disjoint_sdiff_inter _ _)]
have h₁ : ∀ i ∈ Finset.range (b.digits m).length \ Finset.range (b.digits n).length,
(b.digits m).getI i * b ^ i = 0 := by
intro i hi
rw [h i]
apply mul_eq_zero_of_left
rw [← Nat.default_eq_zero]
apply List.getI_eq_default
rw [Finset.mem_sdiff, Finset.mem_range, Finset.mem_range, not_lt] at hi
exact hi.right
have h₂ : ∀ i ∈ Finset.range (b.digits n).length \ Finset.range (b.digits m).length,
(b.digits n).getI i * b ^ i = 0 := by
intro i hi
rw [← h i]
apply mul_eq_zero_of_left
rw [← Nat.default_eq_zero]
apply List.getI_eq_default
rw [Finset.mem_sdiff, Finset.mem_range, Finset.mem_range, not_lt] at hi
exact hi.right
rw [Finset.sum_eq_zero h₁, Finset.sum_eq_zero h₂, zero_add, zero_add]
apply Finset.sum_congr (Finset.inter_comm _ _)
intro i hi
rw [h i]
def base_two_to_base_three (n : ℕ) := Nat.ofDigits 3 (Nat.digits 2 n)
lemma digits_base_two_to_base_three (n : ℕ)
: Nat.digits 2 n = Nat.digits 3 (base_two_to_base_three n) := by
symm; rw [base_two_to_base_three]; apply Nat.digits_ofDigits
· norm_num
· exact fun l hl => lt_trans (Nat.digits_lt_base (by norm_num) hl) (by norm_num)
· exact fun h => Nat.getLast_digit_ne_zero 2 (Nat.digits_ne_nil_iff_ne_zero.mp h)
lemma base_two_to_base_three_inj : Function.Injective base_two_to_base_three := fun m n hmn =>
Nat.digits_inj_iff.mp (by rw [digits_base_two_to_base_three, digits_base_two_to_base_three, hmn])
lemma base_two_to_base_three_zero : base_two_to_base_three 0 = 0 := rfl
lemma base_two_to_base_three_pos {m : ℕ} (hm : 0 < m) : 0 < base_two_to_base_three m :=
Nat.pos_of_ne_zero (base_two_to_base_three_zero ▸ base_two_to_base_three_inj.ne hm.ne')
def zero_or_one_in_base_three (n : ℕ) :=
∀ i : ℕ, (Nat.digits 3 n).getI i = 0 ∨ (Nat.digits 3 n).getI i = 1
lemma zero_or_one_in_base_three_of_eq_base_two_to_base_three
{m n : ℕ} (hmn : base_two_to_base_three n = m)
: zero_or_one_in_base_three m := by
rw [← hmn, zero_or_one_in_base_three]
intro i
rw [← Nat.le_one_iff_eq_zero_or_eq_one, ← digits_base_two_to_base_three]
rw [← Nat.lt_succ_iff]
apply Nat.getI_digits_lt
rfl
lemma eq_iff_of_zero_or_one_in_base {m n : ℕ} (hm : zero_or_one_in_base_three m) (hn : zero_or_one_in_base_three n)
: (∀ i : ℕ, (Nat.digits 3 (m + n)).getI i = 0 ∨ (Nat.digits 3 (m + n)).getI i = 2)
↔ m = n := by
rw [zero_or_one_in_base_three] at hm hn
rw [Nat.eq_iff_getI_digits_eq m n 3]
have h : ∀ i : ℕ, (Nat.digits 3 m).getI i + (Nat.digits 3 n).getI i < 3 := fun i ↦ by
have := hm i; have := hn i; omega
apply Nat.getI_digits_add _ _ (by norm_num) at h
constructor <;> intro h' i
· have := hm i; have := hn i; have := h i; have := h' i; omega
· have := hn i; have := h i; have := h' i; omega
theorem generalized (n : ℕ+) :
∃ S : Finset ℕ+, S.card = 2 ^ n.val - 1 ∧
(∀ x ∈ S, x.val ≤ (3 ^ n.val - 1) / 2) ∧
∀ x ∈ S, ∀ y ∈ S, ∀ z ∈ S, x < y ∧ y < z → x + z ≠ 2 * y := by
set S' := Finset.image base_two_to_base_three (Finset.range (2 ^ n.val) \ Finset.range 1) with hS'
use Finset.subtype (fun n ↦ 0 < n) S'
constructorm* _ ∧ _
·
rw [Finset.card_subtype]
have hS'_filter : ∀ n ∈ S', 0 < n := by
simp only [hS', Finset.mem_image, Finset.mem_sdiff, Finset.mem_range, Nat.lt_one_iff,
forall_exists_index, and_imp]
intro _ m _ hm0 rfl
exact base_two_to_base_three_pos (Nat.pos_of_ne_zero hm0)
rw [Finset.card_filter_eq_iff.mpr hS'_filter, Finset.card_image_of_injective _ base_two_to_base_three_inj]
rw [Finset.card_sdiff, Finset.range_inter_range, Finset.card_range, Finset.card_range]
congr 1
exact min_eq_left (Nat.one_le_pow _ _ (by norm_num))
· intro x hx
rw [Finset.mem_subtype, hS', Finset.mem_image] at hx
rcases hx with ⟨m, hm, hmx⟩
rw [PNat.val, ← hmx, base_two_to_base_three, Nat.ofDigits_eq]
have h' : ∀ i ∈ Finset.range (Nat.digits 2 m).length, (Nat.digits 2 m).getI i * 3 ^ i ≤ 3 ^ i := by
intro i _; nth_rw 2 [← one_mul (3 ^ i)]
exact Nat.mul_le_mul_right _ (Nat.lt_succ_iff.mp (Nat.getI_digits_lt (b := 2) m i le_rfl))
apply le_trans (Finset.sum_le_sum h')
rw [Nat.le_div_iff_mul_le (by norm_num)]
zify
nth_rw 2 [(by norm_num : (2 : ℤ) = 3 - 1)]
rw [geom_sum_mul, Nat.cast_sub (Nat.one_le_pow _ 3 (by norm_num)), Nat.cast_one]
rw [sub_le_sub_iff_right]
push_cast
rw [pow_le_pow_iff_right₀ (by norm_num), Nat.digits_length_le_iff (by norm_num)]
rw [Finset.mem_sdiff, Finset.mem_range] at hm
exact hm.left
· rintro x hx y hy z hz h'
contrapose! h'
rw [Finset.mem_subtype, hS', Finset.mem_image] at hx hy hz
rcases hx with ⟨x', hx', hx'x⟩
rcases hy with ⟨y', hy', hy'y⟩
rcases hz with ⟨z', hz', hz'z⟩
rw [← PNat.coe_inj] at h'
rw [← PNat.coe_lt_coe, ← PNat.coe_le_coe]
push_cast at h'
rw [two_mul] at h'
rw [PNat.val] at h' ⊢
apply zero_or_one_in_base_three_of_eq_base_two_to_base_three at hx'x
apply zero_or_one_in_base_three_of_eq_base_two_to_base_three at hy'y
apply zero_or_one_in_base_three_of_eq_base_two_to_base_three at hz'z
have hzx : Subtype.val x = Subtype.val z := by
rw [← eq_iff_of_zero_or_one_in_base hx'x hz'z, h']
rw [eq_iff_of_zero_or_one_in_base hy'y hy'y]
rw [hzx]
apply le_of_lt
theorem imo1983_p5 :
∃ S : Finset ℕ+, S.card = 1983 ∧
(∀ x ∈ S, x ≤ 10^5) ∧
∀ x ∈ S, ∀ y ∈ S, ∀ z ∈ S, x < y ∧ y < z → x + z ≠ 2 * y := by
rcases generalized 11 with ⟨S', hS'₁, hS'₂, hS'₃⟩
have h : 1983 ≤ S'.card := by rw [hS'₁]; norm_num
rcases Finset.exists_subset_card_eq h with ⟨S, hS₁, hS₂⟩
use S
constructorm* _ ∧ _
· exact hS₂
· exact fun x hx ↦ by rw [← PNat.coe_le_coe]; exact le_trans (hS'₂ x (hS₁ hx)) (by norm_num)
· exact fun x hx y hy z hz ↦ hS'₃ x (hS₁ hx) y (hS₁ hy) z (hS₁ hz)
end Imo1983P5
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Benpigchu
-/
import Mathlib
/-!
# International Mathematical Olympiad 1983, Problem 5
Is it possible to choose $1983$ distinct positive integers,
all less than or equal to $10^5$,
no three of which are consecutive terms of an arithmetic progression?
Justify your answer.
-/
namespace Imo1983P5
lemma Nat.ofDigits_eq (b : ℕ) (L : List ℕ)
: Nat.ofDigits b L = ∑ i ∈ Finset.range L.length, (L.getI i) * b ^ i := by
induction L with
| nil => simp
| cons d L' h =>
simp only [Nat.ofDigits_cons, List.length_cons, Finset.sum_range_succ',
List.getI_cons_zero, pow_zero, mul_one, List.getI_cons_succ]
rw [h, add_comm, mul_comm, Finset.sum_mul]
congr 1
apply Finset.sum_congr rfl fun i _ ↦ by ring
lemma Nat.getI_digits_lt (n i : ℕ) {b : ℕ} (h : 2 ≤ b) : (b.digits n).getI i < b := by
simp only [← List.getD_default_eq_getI, Nat.default_eq_zero, Nat.getD_digits n i h]
exact Nat.mod_lt _ (by omega)
lemma Nat.getI_digits_add (m n : ℕ) {b : ℕ} (hb : 2 ≤ b)
(h : ∀ i : ℕ, (b.digits m).getI i + (b.digits n).getI i < b)
: ∀ i : ℕ, (b.digits m).getI i + (b.digits n).getI i = (b.digits (m + n)).getI i := by
induction' m using Nat.strong_induction_on with m h' generalizing n
by_cases! h'' : m = 0 ∨ n = 0
· rcases h'' with rfl | rfl <;> simp [Nat.digits_zero, List.getI_nil]
· rw [Nat.ne_zero_iff_zero_lt, Nat.ne_zero_iff_zero_lt] at h''
rw [Nat.digits_of_two_le_of_pos hb h''.left] at h ⊢
rw [Nat.digits_of_two_le_of_pos hb h''.right] at h ⊢
have hmn : 0 < m + n := add_pos h''.left h''.right
rw [Nat.digits_of_two_le_of_pos hb hmn]
have h0 := h 0
rw [List.getI_cons_zero, List.getI_cons_zero] at h0
intro i
by_cases! hi : i = 0
· rw [hi, List.getI_cons_zero, List.getI_cons_zero, List.getI_cons_zero]
exact (Nat.add_mod_of_add_mod_lt h0).symm
· rcases Nat.exists_eq_succ_of_ne_zero hi with ⟨i', hi'⟩
rw [hi', List.getI_cons_succ, List.getI_cons_succ, List.getI_cons_succ]
have hm' : m / b < m := Nat.div_lt_self h''.left (by omega)
have h'mn : ∀ (i : ℕ), (b.digits (m / b)).getI i + (b.digits (n / b)).getI i < b := by
intro i
rw [← List.getI_cons_succ (m / b)]
nth_rw 2 [← List.getI_cons_succ (n / b)]
exact h (i + 1)
have h'm'n' := h' (m / b) hm' (n / b) h'mn
rw [h'm'n' i']
congr
exact (Nat.add_div_eq_of_add_mod_lt h0).symm
lemma Nat.eq_iff_getI_digits_eq (m n b: ℕ)
: m = n ↔ (∀ i : ℕ, (b.digits m).getI i = (b.digits n).getI i) := by
constructor
· intro hmn i
rw [hmn]
· intro h
rw [← Nat.ofDigits_digits b m, ← Nat.ofDigits_digits b n]
rw [Nat.ofDigits_eq, Nat.ofDigits_eq]
rw [← Finset.sdiff_union_inter (Finset.range (b.digits m).length) (Finset.range (b.digits n).length)]
nth_rw 3 [← Finset.sdiff_union_inter (Finset.range (b.digits n).length) (Finset.range (b.digits m).length)]
rw [Finset.sum_union (Finset.disjoint_sdiff_inter _ _)]
rw [Finset.sum_union (Finset.disjoint_sdiff_inter _ _)]
have h₁ : ∀ i ∈ Finset.range (b.digits m).length \ Finset.range (b.digits n).length,
(b.digits m).getI i * b ^ i = 0 := by
intro i hi
rw [h i]
apply mul_eq_zero_of_left
rw [← Nat.default_eq_zero]
apply List.getI_eq_default
rw [Finset.mem_sdiff, Finset.mem_range, Finset.mem_range, not_lt] at hi
exact hi.right
have h₂ : ∀ i ∈ Finset.range (b.digits n).length \ Finset.range (b.digits m).length,
(b.digits n).getI i * b ^ i = 0 := by
intro i hi
rw [← h i]
apply mul_eq_zero_of_left
rw [← Nat.default_eq_zero]
apply List.getI_eq_default
rw [Finset.mem_sdiff, Finset.mem_range, Finset.mem_range, not_lt] at hi
exact hi.right
rw [Finset.sum_eq_zero h₁, Finset.sum_eq_zero h₂, zero_add, zero_add]
apply Finset.sum_congr (Finset.inter_comm _ _)
intro i hi
rw [h i]
def base_two_to_base_three (n : ℕ) := Nat.ofDigits 3 (Nat.digits 2 n)
lemma digits_base_two_to_base_three (n : ℕ)
: Nat.digits 2 n = Nat.digits 3 (base_two_to_base_three n) := by
symm; rw [base_two_to_base_three]; apply Nat.digits_ofDigits
· norm_num
· exact fun l hl => lt_trans (Nat.digits_lt_base (by norm_num) hl) (by norm_num)
· exact fun h => Nat.getLast_digit_ne_zero 2 (Nat.digits_ne_nil_iff_ne_zero.mp h)
lemma base_two_to_base_three_inj : Function.Injective base_two_to_base_three := fun m n hmn =>
Nat.digits_inj_iff.mp (by rw [digits_base_two_to_base_three, digits_base_two_to_base_three, hmn])
lemma base_two_to_base_three_zero : base_two_to_base_three 0 = 0 := rfl
lemma base_two_to_base_three_pos {m : ℕ} (hm : 0 < m) : 0 < base_two_to_base_three m :=
Nat.pos_of_ne_zero (base_two_to_base_three_zero ▸ base_two_to_base_three_inj.ne hm.ne')
def zero_or_one_in_base_three (n : ℕ) :=
∀ i : ℕ, (Nat.digits 3 n).getI i = 0 ∨ (Nat.digits 3 n).getI i = 1
lemma zero_or_one_in_base_three_of_eq_base_two_to_base_three
{m n : ℕ} (hmn : base_two_to_base_three n = m)
: zero_or_one_in_base_three m := by
rw [← hmn, zero_or_one_in_base_three]
intro i
rw [← Nat.le_one_iff_eq_zero_or_eq_one, ← digits_base_two_to_base_three]
rw [← Nat.lt_succ_iff]
apply Nat.getI_digits_lt
rfl
lemma eq_iff_of_zero_or_one_in_base {m n : ℕ} (hm : zero_or_one_in_base_three m) (hn : zero_or_one_in_base_three n)
: (∀ i : ℕ, (Nat.digits 3 (m + n)).getI i = 0 ∨ (Nat.digits 3 (m + n)).getI i = 2)
↔ m = n := by
rw [zero_or_one_in_base_three] at hm hn
rw [Nat.eq_iff_getI_digits_eq m n 3]
have h : ∀ i : ℕ, (Nat.digits 3 m).getI i + (Nat.digits 3 n).getI i < 3 := fun i ↦ by
have := hm i; have := hn i; omega
apply Nat.getI_digits_add _ _ (by norm_num) at h
constructor <;> intro h' i
· have := hm i; have := hn i; have := h i; have := h' i; omega
· have := hn i; have := h i; have := h' i; omega
theorem generalized (n : ℕ+) :
∃ S : Finset ℕ+, S.card = 2 ^ n.val - 1 ∧
(∀ x ∈ S, x.val ≤ (3 ^ n.val - 1) / 2) ∧
∀ x ∈ S, ∀ y ∈ S, ∀ z ∈ S, x < y ∧ y < z → x + z ≠ 2 * y := by
set S' := Finset.image base_two_to_base_three (Finset.range (2 ^ n.val) \ Finset.range 1) with hS'
use Finset.subtype (fun n ↦ 0 < n) S'
constructorm* _ ∧ _
·
rw [Finset.card_subtype]
have hS'_filter : ∀ n ∈ S', 0 < n := by
simp only [hS', Finset.mem_image, Finset.mem_sdiff, Finset.mem_range, Nat.lt_one_iff,
forall_exists_index, and_imp]
intro _ m _ hm0 rfl
exact base_two_to_base_three_pos (Nat.pos_of_ne_zero hm0)
rw [Finset.card_filter_eq_iff.mpr hS'_filter, Finset.card_image_of_injective _ base_two_to_base_three_inj]
rw [Finset.card_sdiff, Finset.range_inter_range, Finset.card_range, Finset.card_range]
congr 1
exact min_eq_left (Nat.one_le_pow _ _ (by norm_num))
· intro x hx
rw [Finset.mem_subtype, hS', Finset.mem_image] at hx
rcases hx with ⟨m, hm, hmx⟩
rw [PNat.val, ← hmx, base_two_to_base_three, Nat.ofDigits_eq]
have h' : ∀ i ∈ Finset.range (Nat.digits 2 m).length, (Nat.digits 2 m).getI i * 3 ^ i ≤ 3 ^ i := by
intro i _; nth_rw 2 [← one_mul (3 ^ i)]
exact Nat.mul_le_mul_right _ (Nat.lt_succ_iff.mp (Nat.getI_digits_lt (b := 2) m i le_rfl))
apply le_trans (Finset.sum_le_sum h')
rw [Nat.le_div_iff_mul_le (by norm_num)]
zify
nth_rw 2 [(by norm_num : (2 : ℤ) = 3 - 1)]
rw [geom_sum_mul, Nat.cast_sub (Nat.one_le_pow _ 3 (by norm_num)), Nat.cast_one]
rw [sub_le_sub_iff_right]
push_cast
rw [pow_le_pow_iff_right₀ (by norm_num), Nat.digits_length_le_iff (by norm_num)]
rw [Finset.mem_sdiff, Finset.mem_range] at hm
exact hm.left
· rintro x hx y hy z hz h'
contrapose! h'
rw [Finset.mem_subtype, hS', Finset.mem_image] at hx hy hz
rcases hx with ⟨x', hx', hx'x⟩
rcases hy with ⟨y', hy', hy'y⟩
rcases hz with ⟨z', hz', hz'z⟩
rw [← PNat.coe_inj] at h'
rw [← PNat.coe_lt_coe, ← PNat.coe_le_coe]
push_cast at h'
rw [two_mul] at h'
rw [PNat.val] at h' ⊢
apply zero_or_one_in_base_three_of_eq_base_two_to_base_three at hx'x
apply zero_or_one_in_base_three_of_eq_base_two_to_base_three at hy'y
apply zero_or_one_in_base_three_of_eq_base_two_to_base_three at hz'z
have hzx : Subtype.val x = Subtype.val z := by
rw [← eq_iff_of_zero_or_one_in_base hx'x hz'z, h']
rw [eq_iff_of_zero_or_one_in_base hy'y hy'y]
rw [hzx]
apply le_of_lt
theorem imo1983_p5 :
∃ S : Finset ℕ+, S.card = 1983 ∧
(∀ x ∈ S, x ≤ 10^5) ∧
∀ x ∈ S, ∀ y ∈ S, ∀ z ∈ S, x < y ∧ y < z → x + z ≠ 2 * y := by
rcases generalized 11 with ⟨S', hS'₁, hS'₂, hS'₃⟩
have h : 1983 ≤ S'.card := by rw [hS'₁]; norm_num
rcases Finset.exists_subset_card_eq h with ⟨S, hS₁, hS₂⟩
use S
constructorm* _ ∧ _
· exact hS₂
· exact fun x hx ↦ by rw [← PNat.coe_le_coe]; exact le_trans (hS'₂ x (hS₁ hx)) (by norm_num)
· exact fun x hx y hy z hz ↦ hS'₃ x (hS₁ hx) y (hS₁ hy) z (hS₁ hz)
end Imo1983P5 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1983P5.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unknown constant 'Nat.getD_digits'", "unsolved goals\nn i b : \u2115\nh : 2 \u2264 b\n\u22a2 ?m.3734 > 0", "unknown tactic", "unsolved goals\ncase h\nb : \u2115\nhb : 2 \u2264 b\nm : \u2115\nh' :\n \u2200 m_1 < m,\n \u2200 (n : \u2115),\n (\u2200 (i : \u2115), (b.digits m_1).getI i + (b.digits n).getI i < b) \u2192\n \u2200 (i : \u2115), (b.digits m_1).getI i + (b.digits n).getI i = (b.digits (m_1 + n)).getI i\nn : \u2115\nh : \u2200 (i : \u2115), (b.digits m).getI i + (b.digits n).getI i < b\n\u22a2 \u2200 (i : \u2115), (b.digits m).getI i + (b.digits n).getI i = (b.digits (m + n)).getI i", "type mismatch\n rfl\nhas type\n ?m.13336 = ?m.13336 : Prop\nbut is expected to have type\n base_two_to_base_three 0 = 0 : Prop", "unknown tactic", "unsolved goals\nm n : \u2115\nhm : \u2200 (i : \u2115), (Nat.digits 3 m).getI i = 0 \u2228 (Nat.digits 3 m).getI i = 1\nhn : \u2200 (i : \u2115), (Nat.digits 3 n).getI i = 0 \u2228 (Nat.digits 3 n).getI i = 1\ni : \u2115\nthis\u271d : (Nat.digits 3 m).getI i = 0 \u2228 (Nat.digits 3 m).getI i = 1\nthis : (Nat.digits 3 n).getI i = 0 \u2228 (Nat.digits 3 n).getI i = 1\n\u22a2 (Nat.digits 3 m).getI i + (Nat.digits 3 n).getI i < 3", "unsolved goals\nm n : \u2115\nhm : \u2200 (i : \u2115), (Nat.digits 3 m).getI i = 0 \u2228 (Nat.digits 3 m).getI i = 1\nhn : \u2200 (i : \u2115), (Nat.digits 3 n).getI i = 0 \u2228 (Nat.digits 3 n).getI i = 1\nh : \u2200 (i : \u2115), (Nat.digits 3 m).getI i + (Nat.digits 3 n).getI i < 3\n\u22a2 (\u2200 (i : \u2115), (Nat.digits 3 (m + n)).getI i = 0 \u2228 (Nat.digits 3 (m + n)).getI i = 2) \u2194\n \u2200 (i : \u2115), (Nat.digits 3 m).getI i = (Nat.digits 3 n).getI i", "unknown option 'backward.isDefEq.respectTransparency'", "unknown option 'backward.isDefEq.respectTransparency'", "unknown option 'backward.isDefEq.respectTransparency'"], "timeout_s": 600.0, "latency_s": 0.6645, "verified_at": "2026-03-26T18:16:53.352105+00:00"}} | false | true | false | 0.6645 |
compfiles_Imo1983P6 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh, David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1983, Problem 6
Suppose that a,b,c are the side lengths of a triangle. Prove that
a²b(a - b) + b²c(b - c) + c²a(c - a) ≥ 0.
Determine when equality occurs.
-/
namespace Imo1983P6
/-- Equality in Cauchy-Schwarz implies linear dependence. -/
lemma cauchy_schwarz_equals {ι: Type*} (s : Finset ι)
(f g : ι → ℝ) (hf : ∃ i ∈ s, f i ≠ 0) :
(∑ i ∈ s, f i * g i) ^ 2 = (∑ i ∈ s, f i ^ 2) * ∑ i ∈ s, g i ^ 2 →
∃ r, ∀ i ∈ s, r * f i = g i := by
intro h0
let q t := ∑ i ∈ s, (t * f i - g i) * (t * f i - g i)
have h1 : ∀ t, q t =
(∑ i ∈ s, f i^2) * (t * t) + ((- 2) * ∑ i ∈ s, f i * g i) * t + ∑ i ∈ s, g i^2 := by
intro t
unfold q
simp only [Finset.mul_sum, Finset.sum_mul, ←Finset.sum_add_distrib]
apply Finset.sum_congr rfl
intro i hi
ring
have h2 : discrim (∑ i ∈ s, f i^2) ((- 2) * ∑ i ∈ s, f i * g i) (∑ i ∈ s, g i^2) = 0 := by
unfold discrim
linarith
have h3 : ∑ i ∈ s, f i^2 ≠ 0 := by
obtain ⟨ii, hii, hiif⟩ := hf
have h6 : ∀ i ∈ s, f i ^ 2 = f i * f i := by
intro h hi
exact pow_two (f h)
rw [Finset.sum_congr rfl h6]
intro H
rw [Finset.sum_mul_self_eq_zero_iff] at H
specialize H ii hii
contradiction
obtain ⟨t0, ht0, -⟩ := (discrim_eq_zero_iff h3).mp h2
rw [←h1] at ht0
unfold q at ht0
use t0
rw [Finset.sum_mul_self_eq_zero_iff] at ht0
intro i hi
specialize ht0 i hi
linarith
theorem lemma1 {x y z : ℝ} (hx : 0 < x) (hy : 0 < y) (hz : 0 < z)
(hxyz : x * y * z * (z + x + y) = x * y ^ 3 + y * z ^ 3 + z * x ^ 3) :
x = y ∧ x = z := by
let f : Fin 3 → ℝ := ![√x * √(y^3), √y * √(z^3), √z * √(x^3)]
let g : Fin 3 → ℝ := ![√z, √x, √y]
suffices H : ∃ r : ℝ, ∀ i ∈ Finset.univ, r * f i = g i by
obtain ⟨r, hr⟩ := H
dsimp [f, g] at hr
simp only [Finset.mem_univ, forall_const] at hr
have hr0 := hr 0
have hr1 := hr 1
have hr2 := hr 2
clear hr
apply_fun (·)^2 at hr0 hr1 hr2
dsimp at hr0 hr1 hr2
simp only [mul_pow] at hr0 hr1 hr2
rw [Real.sq_sqrt hx.le, Real.sq_sqrt hy.le] at hr1
rw [Real.sq_sqrt hz.le, Real.sq_sqrt hx.le] at hr0
rw [Real.sq_sqrt hy.le, Real.sq_sqrt hz.le] at hr2
rw [Real.sq_sqrt (by positivity)] at hr0 hr1 hr2
have h0 : x * y^3 ≠ 0 := by positivity
have h1 : y * z^3 ≠ 0 := by positivity
have h2 : z * x^3 ≠ 0 := by positivity
replace hr0 : r^2 = z / (x * y^3) := (div_eq_of_eq_mul h0 hr0.symm).symm
replace hr1 : r^2 = x / (y * z^3) := (div_eq_of_eq_mul h1 hr1.symm).symm
replace hr2 : r^2 = y / (z * x^3) := (div_eq_of_eq_mul h2 hr2.symm).symm
clear hxyz f g
constructor
· rw [hr0] at hr1 hr2
have h3 : z^4 = x^2 * y^2 := by
field_simp at hr1 ⊢
exact hr1
have h3' : z^2 = x * y := by
rw [show z ^ 4 = (z^2)^2 by ring, show x ^ 2 * y ^ 2 = (x * y)^2 by ring] at h3
exact (pow_left_inj₀ (by positivity) (by positivity) (by positivity)).mp h3
have h4 : z^2 = y^4 / x^2 := by
field_simp at hr2 ⊢
exact hr2
rw [h3'] at h4
have h5 : x^3 = y ^ 3 := by
field_simp at h4
exact h4
exact (pow_left_inj₀ (by positivity) (by positivity) (by positivity)).mp h5
· rw [hr2] at hr0 hr1
have h3 : y^4 = x^2 * z^2 := by
field_simp at hr0 ⊢
exact hr0
have h3' : y^2 = x * z := by
rw [show y ^ 4 = (y^2)^2 by ring, show x ^ 2 * z ^ 2 = (x * z)^2 by ring] at h3
exact (pow_left_inj₀ (by positivity) (by positivity) (by positivity)).mp h3
have h4 : y^2 = x^4 / z^2 := by
field_simp at hr1 ⊢
exact hr1
rw [h3'] at h4
have h5 : z^3 = x ^ 3 := by
field_simp at h4
exact h4
symm
exact (pow_left_inj₀ (by positivity) (by positivity) (by positivity)).mp h5
refine cauchy_schwarz_equals _ f g ?_ ?_
· use 0
simp [f]
change _ ≠ 0 ∧ _ ≠ 0
constructor
· positivity
· positivity
simp only [Fin.sum_univ_three, f, g]
dsimp
rw [show x^3 = x^2 * x from rfl, show y^3 = y^2 * y from rfl,
show z^3 = z^2 * z from rfl]
rw [Real.sqrt_mul (by positivity), Real.sqrt_mul (by positivity),
Real.sqrt_mul (by positivity)]
rw [Real.sqrt_sq hx.le, Real.sqrt_sq hy.le, Real.sqrt_sq hz.le]
grind
abbrev EqualityCondition (a b c : ℝ) : Prop := a = b ∧ a = c
theorem imo1983_p6 (T : Affine.Triangle ℝ (EuclideanSpace ℝ (Fin 2))) :
let a := dist (T.points 1) (T.points 2)
let b := dist (T.points 0) (T.points 2)
let c := dist (T.points 0) (T.points 1)
0 ≤ a^2 * b * (a - b) + b^2 * c * (b - c) + c^2 * a * (c - a) ∧
(0 = a^2 * b * (a - b) + b^2 * c * (b - c) + c^2 * a * (c - a) ↔
EqualityCondition a b c) := by
intro a b c
have h₁ : c < a + b := by
have := AffineIndependent.not_wbtw_of_injective (0 : Fin 3) 2 1 (by decide) T.independent
rw [←dist_lt_dist_add_dist_iff, dist_comm (T.points 2)] at this
linarith
have h₂ : b < a + c := by
have := AffineIndependent.not_wbtw_of_injective (0 : Fin 3) 1 2 (by decide) T.independent
rw [←dist_lt_dist_add_dist_iff] at this
linarith
have h₃ : a < b + c := by
have := AffineIndependent.not_wbtw_of_injective (1 : Fin 3) 0 2 (by decide) T.independent
rw [←dist_lt_dist_add_dist_iff, dist_comm (T.points 1) (T.points 0)] at this
linarith
-- https://prase.cz/kalva/imo/isoln/isoln836.html
set x := (-a + b + c) / 2
set y := (a - b + c) / 2
set z := (a + b - c) / 2
have hx : 0 < x := by unfold x; linarith
have hy : 0 < y := by unfold y; linarith
have hz : 0 < z := by unfold z; linarith
constructor
· suffices H : x * y * z * (z + x + y) ≤ x * y ^3 + y * z^3 + z * x ^3 by
unfold x y z at H
nlinarith
let f : Fin 3 → ℝ := ![√x * √(y^3), √y * √(z^3), √z * √(x^3)]
let g : Fin 3 → ℝ := ![√z, √x, √y]
have hsum := Finset.sum_mul_sq_le_sq_mul_sq (Finset.univ) f g
simp only [Fin.sum_univ_three, f, g] at hsum
dsimp at hsum
rw [show x^3 = x^2 * x from rfl, show y^3 = y^2 * y from rfl,
show z^3 = z^2 * z from rfl] at hsum
rw [Real.sqrt_mul (by positivity), Real.sqrt_mul (by positivity),
Real.sqrt_mul (by positivity)] at hsum
rw [Real.sqrt_sq hx.le, Real.sqrt_sq hy.le, Real.sqrt_sq hz.le] at hsum
have h1 : √x * (y * √y) * √z + √y * (z * √z) * √x + √z * (x * √x) * √y =
(√x * √y * √z) * (z + x + y) := by ring
rw [h1] at hsum; clear h1
simp only [mul_pow] at hsum
simp only [Real.sq_sqrt hx.le, Real.sq_sqrt hy.le, Real.sq_sqrt hz.le] at hsum
rw [pow_two (z + x + y), ←mul_assoc] at hsum
have h2 : 0 < z + x + y := by positivity
rw [show x^2 * x = x^3 from rfl, show y^2 * y = y^3 from rfl,
show z^2 * z = z^3 from rfl] at hsum
exact le_of_mul_le_mul_right hsum h2
constructor
· intro h
have hxyz : x * y * z * (z + x + y) = x * y ^3 + y * z^3 + z * x ^3 := by
unfold x y z
linarith
clear h h₁ h₂ h₃
unfold EqualityCondition
suffices H : x = y ∧ x = z by
unfold x y z at H
obtain ⟨H1, H2⟩ := H
constructor
· linarith
· linarith
exact lemma1 hx hy hz hxyz
· rintro ⟨h1, h2⟩
simp [←h1, ←h2]
end Imo1983P6 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh, David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1983, Problem 6
Suppose that a,b,c are the side lengths of a triangle. Prove that
a²b(a - b) + b²c(b - c) + c²a(c - a) ≥ 0.
Determine when equality occurs.
-/
namespace Imo1983P6
/-- Equality in Cauchy-Schwarz implies linear dependence. -/
lemma cauchy_schwarz_equals {ι: Type*} (s : Finset ι)
(f g : ι → ℝ) (hf : ∃ i ∈ s, f i ≠ 0) :
(∑ i ∈ s, f i * g i) ^ 2 = (∑ i ∈ s, f i ^ 2) * ∑ i ∈ s, g i ^ 2 →
∃ r, ∀ i ∈ s, r * f i = g i := by
intro h0
let q t := ∑ i ∈ s, (t * f i - g i) * (t * f i - g i)
have h1 : ∀ t, q t =
(∑ i ∈ s, f i^2) * (t * t) + ((- 2) * ∑ i ∈ s, f i * g i) * t + ∑ i ∈ s, g i^2 := by
intro t
unfold q
simp only [Finset.mul_sum, Finset.sum_mul, ←Finset.sum_add_distrib]
apply Finset.sum_congr rfl
intro i hi
ring
have h2 : discrim (∑ i ∈ s, f i^2) ((- 2) * ∑ i ∈ s, f i * g i) (∑ i ∈ s, g i^2) = 0 := by
unfold discrim
linarith
have h3 : ∑ i ∈ s, f i^2 ≠ 0 := by
obtain ⟨ii, hii, hiif⟩ := hf
have h6 : ∀ i ∈ s, f i ^ 2 = f i * f i := by
intro h hi
exact pow_two (f h)
rw [Finset.sum_congr rfl h6]
intro H
rw [Finset.sum_mul_self_eq_zero_iff] at H
specialize H ii hii
contradiction
obtain ⟨t0, ht0, -⟩ := (discrim_eq_zero_iff h3).mp h2
rw [←h1] at ht0
unfold q at ht0
use t0
rw [Finset.sum_mul_self_eq_zero_iff] at ht0
intro i hi
specialize ht0 i hi
linarith
theorem lemma1 {x y z : ℝ} (hx : 0 < x) (hy : 0 < y) (hz : 0 < z)
(hxyz : x * y * z * (z + x + y) = x * y ^ 3 + y * z ^ 3 + z * x ^ 3) :
x = y ∧ x = z := by
let f : Fin 3 → ℝ := ![√x * √(y^3), √y * √(z^3), √z * √(x^3)]
let g : Fin 3 → ℝ := ![√z, √x, √y]
suffices H : ∃ r : ℝ, ∀ i ∈ Finset.univ, r * f i = g i by
obtain ⟨r, hr⟩ := H
dsimp [f, g] at hr
simp only [Finset.mem_univ, forall_const] at hr
have hr0 := hr 0
have hr1 := hr 1
have hr2 := hr 2
clear hr
apply_fun (·)^2 at hr0 hr1 hr2
dsimp at hr0 hr1 hr2
simp only [mul_pow] at hr0 hr1 hr2
rw [Real.sq_sqrt hx.le, Real.sq_sqrt hy.le] at hr1
rw [Real.sq_sqrt hz.le, Real.sq_sqrt hx.le] at hr0
rw [Real.sq_sqrt hy.le, Real.sq_sqrt hz.le] at hr2
rw [Real.sq_sqrt (by positivity)] at hr0 hr1 hr2
have h0 : x * y^3 ≠ 0 := by positivity
have h1 : y * z^3 ≠ 0 := by positivity
have h2 : z * x^3 ≠ 0 := by positivity
replace hr0 : r^2 = z / (x * y^3) := (div_eq_of_eq_mul h0 hr0.symm).symm
replace hr1 : r^2 = x / (y * z^3) := (div_eq_of_eq_mul h1 hr1.symm).symm
replace hr2 : r^2 = y / (z * x^3) := (div_eq_of_eq_mul h2 hr2.symm).symm
clear hxyz f g
constructor
· rw [hr0] at hr1 hr2
have h3 : z^4 = x^2 * y^2 := by
field_simp at hr1 ⊢
exact hr1
have h3' : z^2 = x * y := by
rw [show z ^ 4 = (z^2)^2 by ring, show x ^ 2 * y ^ 2 = (x * y)^2 by ring] at h3
exact (pow_left_inj₀ (by positivity) (by positivity) (by positivity)).mp h3
have h4 : z^2 = y^4 / x^2 := by
field_simp at hr2 ⊢
exact hr2
rw [h3'] at h4
have h5 : x^3 = y ^ 3 := by
field_simp at h4
exact h4
exact (pow_left_inj₀ (by positivity) (by positivity) (by positivity)).mp h5
· rw [hr2] at hr0 hr1
have h3 : y^4 = x^2 * z^2 := by
field_simp at hr0 ⊢
exact hr0
have h3' : y^2 = x * z := by
rw [show y ^ 4 = (y^2)^2 by ring, show x ^ 2 * z ^ 2 = (x * z)^2 by ring] at h3
exact (pow_left_inj₀ (by positivity) (by positivity) (by positivity)).mp h3
have h4 : y^2 = x^4 / z^2 := by
field_simp at hr1 ⊢
exact hr1
rw [h3'] at h4
have h5 : z^3 = x ^ 3 := by
field_simp at h4
exact h4
symm
exact (pow_left_inj₀ (by positivity) (by positivity) (by positivity)).mp h5
refine cauchy_schwarz_equals _ f g ?_ ?_
· use 0
simp [f]
change _ ≠ 0 ∧ _ ≠ 0
constructor
· positivity
· positivity
simp only [Fin.sum_univ_three, f, g]
dsimp
rw [show x^3 = x^2 * x from rfl, show y^3 = y^2 * y from rfl,
show z^3 = z^2 * z from rfl]
rw [Real.sqrt_mul (by positivity), Real.sqrt_mul (by positivity),
Real.sqrt_mul (by positivity)]
rw [Real.sqrt_sq hx.le, Real.sqrt_sq hy.le, Real.sqrt_sq hz.le]
grind
abbrev EqualityCondition (a b c : ℝ) : Prop := a = b ∧ a = c
theorem imo1983_p6 (T : Affine.Triangle ℝ (EuclideanSpace ℝ (Fin 2))) :
let a := dist (T.points 1) (T.points 2)
let b := dist (T.points 0) (T.points 2)
let c := dist (T.points 0) (T.points 1)
0 ≤ a^2 * b * (a - b) + b^2 * c * (b - c) + c^2 * a * (c - a) ∧
(0 = a^2 * b * (a - b) + b^2 * c * (b - c) + c^2 * a * (c - a) ↔
EqualityCondition a b c) := by
intro a b c
have h₁ : c < a + b := by
have := AffineIndependent.not_wbtw_of_injective (0 : Fin 3) 2 1 (by decide) T.independent
rw [←dist_lt_dist_add_dist_iff, dist_comm (T.points 2)] at this
linarith
have h₂ : b < a + c := by
have := AffineIndependent.not_wbtw_of_injective (0 : Fin 3) 1 2 (by decide) T.independent
rw [←dist_lt_dist_add_dist_iff] at this
linarith
have h₃ : a < b + c := by
have := AffineIndependent.not_wbtw_of_injective (1 : Fin 3) 0 2 (by decide) T.independent
rw [←dist_lt_dist_add_dist_iff, dist_comm (T.points 1) (T.points 0)] at this
linarith
-- https://prase.cz/kalva/imo/isoln/isoln836.html
set x := (-a + b + c) / 2
set y := (a - b + c) / 2
set z := (a + b - c) / 2
have hx : 0 < x := by unfold x; linarith
have hy : 0 < y := by unfold y; linarith
have hz : 0 < z := by unfold z; linarith
constructor
· suffices H : x * y * z * (z + x + y) ≤ x * y ^3 + y * z^3 + z * x ^3 by
unfold x y z at H
nlinarith
let f : Fin 3 → ℝ := ![√x * √(y^3), √y * √(z^3), √z * √(x^3)]
let g : Fin 3 → ℝ := ![√z, √x, √y]
have hsum := Finset.sum_mul_sq_le_sq_mul_sq (Finset.univ) f g
simp only [Fin.sum_univ_three, f, g] at hsum
dsimp at hsum
rw [show x^3 = x^2 * x from rfl, show y^3 = y^2 * y from rfl,
show z^3 = z^2 * z from rfl] at hsum
rw [Real.sqrt_mul (by positivity), Real.sqrt_mul (by positivity),
Real.sqrt_mul (by positivity)] at hsum
rw [Real.sqrt_sq hx.le, Real.sqrt_sq hy.le, Real.sqrt_sq hz.le] at hsum
have h1 : √x * (y * √y) * √z + √y * (z * √z) * √x + √z * (x * √x) * √y =
(√x * √y * √z) * (z + x + y) := by ring
rw [h1] at hsum; clear h1
simp only [mul_pow] at hsum
simp only [Real.sq_sqrt hx.le, Real.sq_sqrt hy.le, Real.sq_sqrt hz.le] at hsum
rw [pow_two (z + x + y), ←mul_assoc] at hsum
have h2 : 0 < z + x + y := by positivity
rw [show x^2 * x = x^3 from rfl, show y^2 * y = y^3 from rfl,
show z^2 * z = z^3 from rfl] at hsum
exact le_of_mul_le_mul_right hsum h2
constructor
· intro h
have hxyz : x * y * z * (z + x + y) = x * y ^3 + y * z^3 + z * x ^3 := by
unfold x y z
linarith
clear h h₁ h₂ h₃
unfold EqualityCondition
suffices H : x = y ∧ x = z by
unfold x y z at H
obtain ⟨H1, H2⟩ := H
constructor
· linarith
· linarith
exact lemma1 hx hy hz hxyz
· rintro ⟨h1, h2⟩
simp [←h1, ←h2]
end Imo1983P6
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh, David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1983, Problem 6
Suppose that a,b,c are the side lengths of a triangle. Prove that
a²b(a - b) + b²c(b - c) + c²a(c - a) ≥ 0.
Determine when equality occurs.
-/
namespace Imo1983P6
/-- Equality in Cauchy-Schwarz implies linear dependence. -/
lemma cauchy_schwarz_equals {ι: Type*} (s : Finset ι)
(f g : ι → ℝ) (hf : ∃ i ∈ s, f i ≠ 0) :
(∑ i ∈ s, f i * g i) ^ 2 = (∑ i ∈ s, f i ^ 2) * ∑ i ∈ s, g i ^ 2 →
∃ r, ∀ i ∈ s, r * f i = g i := by
intro h0
let q t := ∑ i ∈ s, (t * f i - g i) * (t * f i - g i)
have h1 : ∀ t, q t =
(∑ i ∈ s, f i^2) * (t * t) + ((- 2) * ∑ i ∈ s, f i * g i) * t + ∑ i ∈ s, g i^2 := by
intro t
unfold q
simp only [Finset.mul_sum, Finset.sum_mul, ←Finset.sum_add_distrib]
apply Finset.sum_congr rfl
intro i hi
ring
have h2 : discrim (∑ i ∈ s, f i^2) ((- 2) * ∑ i ∈ s, f i * g i) (∑ i ∈ s, g i^2) = 0 := by
unfold discrim
linarith
have h3 : ∑ i ∈ s, f i^2 ≠ 0 := by
obtain ⟨ii, hii, hiif⟩ := hf
have h6 : ∀ i ∈ s, f i ^ 2 = f i * f i := by
intro h hi
exact pow_two (f h)
rw [Finset.sum_congr rfl h6]
intro H
rw [Finset.sum_mul_self_eq_zero_iff] at H
specialize H ii hii
contradiction
obtain ⟨t0, ht0, -⟩ := (discrim_eq_zero_iff h3).mp h2
rw [←h1] at ht0
unfold q at ht0
use t0
rw [Finset.sum_mul_self_eq_zero_iff] at ht0
intro i hi
specialize ht0 i hi
linarith
theorem lemma1 {x y z : ℝ} (hx : 0 < x) (hy : 0 < y) (hz : 0 < z)
(hxyz : x * y * z * (z + x + y) = x * y ^ 3 + y * z ^ 3 + z * x ^ 3) :
x = y ∧ x = z := by
let f : Fin 3 → ℝ := ![√x * √(y^3), √y * √(z^3), √z * √(x^3)]
let g : Fin 3 → ℝ := ![√z, √x, √y]
suffices H : ∃ r : ℝ, ∀ i ∈ Finset.univ, r * f i = g i by
obtain ⟨r, hr⟩ := H
dsimp [f, g] at hr
simp only [Finset.mem_univ, forall_const] at hr
have hr0 := hr 0
have hr1 := hr 1
have hr2 := hr 2
clear hr
apply_fun (·)^2 at hr0 hr1 hr2
dsimp at hr0 hr1 hr2
simp only [mul_pow] at hr0 hr1 hr2
rw [Real.sq_sqrt hx.le, Real.sq_sqrt hy.le] at hr1
rw [Real.sq_sqrt hz.le, Real.sq_sqrt hx.le] at hr0
rw [Real.sq_sqrt hy.le, Real.sq_sqrt hz.le] at hr2
rw [Real.sq_sqrt (by positivity)] at hr0 hr1 hr2
have h0 : x * y^3 ≠ 0 := by positivity
have h1 : y * z^3 ≠ 0 := by positivity
have h2 : z * x^3 ≠ 0 := by positivity
replace hr0 : r^2 = z / (x * y^3) := (div_eq_of_eq_mul h0 hr0.symm).symm
replace hr1 : r^2 = x / (y * z^3) := (div_eq_of_eq_mul h1 hr1.symm).symm
replace hr2 : r^2 = y / (z * x^3) := (div_eq_of_eq_mul h2 hr2.symm).symm
clear hxyz f g
constructor
· rw [hr0] at hr1 hr2
have h3 : z^4 = x^2 * y^2 := by
field_simp at hr1 ⊢
exact hr1
have h3' : z^2 = x * y := by
rw [show z ^ 4 = (z^2)^2 by ring, show x ^ 2 * y ^ 2 = (x * y)^2 by ring] at h3
exact (pow_left_inj₀ (by positivity) (by positivity) (by positivity)).mp h3
have h4 : z^2 = y^4 / x^2 := by
field_simp at hr2 ⊢
exact hr2
rw [h3'] at h4
have h5 : x^3 = y ^ 3 := by
field_simp at h4
exact h4
exact (pow_left_inj₀ (by positivity) (by positivity) (by positivity)).mp h5
· rw [hr2] at hr0 hr1
have h3 : y^4 = x^2 * z^2 := by
field_simp at hr0 ⊢
exact hr0
have h3' : y^2 = x * z := by
rw [show y ^ 4 = (y^2)^2 by ring, show x ^ 2 * z ^ 2 = (x * z)^2 by ring] at h3
exact (pow_left_inj₀ (by positivity) (by positivity) (by positivity)).mp h3
have h4 : y^2 = x^4 / z^2 := by
field_simp at hr1 ⊢
exact hr1
rw [h3'] at h4
have h5 : z^3 = x ^ 3 := by
field_simp at h4
exact h4
symm
exact (pow_left_inj₀ (by positivity) (by positivity) (by positivity)).mp h5
refine cauchy_schwarz_equals _ f g ?_ ?_
· use 0
simp [f]
change _ ≠ 0 ∧ _ ≠ 0
constructor
· positivity
· positivity
simp only [Fin.sum_univ_three, f, g]
dsimp
rw [show x^3 = x^2 * x from rfl, show y^3 = y^2 * y from rfl,
show z^3 = z^2 * z from rfl]
rw [Real.sqrt_mul (by positivity), Real.sqrt_mul (by positivity),
Real.sqrt_mul (by positivity)]
rw [Real.sqrt_sq hx.le, Real.sqrt_sq hy.le, Real.sqrt_sq hz.le]
grind
abbrev EqualityCondition (a b c : ℝ) : Prop := a = b ∧ a = c
theorem imo1983_p6 (T : Affine.Triangle ℝ (EuclideanSpace ℝ (Fin 2))) :
let a := dist (T.points 1) (T.points 2)
let b := dist (T.points 0) (T.points 2)
let c := dist (T.points 0) (T.points 1)
0 ≤ a^2 * b * (a - b) + b^2 * c * (b - c) + c^2 * a * (c - a) ∧
(0 = a^2 * b * (a - b) + b^2 * c * (b - c) + c^2 * a * (c - a) ↔
EqualityCondition a b c) := by
intro a b c
have h₁ : c < a + b := by
have := AffineIndependent.not_wbtw_of_injective (0 : Fin 3) 2 1 (by decide) T.independent
rw [←dist_lt_dist_add_dist_iff, dist_comm (T.points 2)] at this
linarith
have h₂ : b < a + c := by
have := AffineIndependent.not_wbtw_of_injective (0 : Fin 3) 1 2 (by decide) T.independent
rw [←dist_lt_dist_add_dist_iff] at this
linarith
have h₃ : a < b + c := by
have := AffineIndependent.not_wbtw_of_injective (1 : Fin 3) 0 2 (by decide) T.independent
rw [←dist_lt_dist_add_dist_iff, dist_comm (T.points 1) (T.points 0)] at this
linarith
-- https://prase.cz/kalva/imo/isoln/isoln836.html
set x := (-a + b + c) / 2
set y := (a - b + c) / 2
set z := (a + b - c) / 2
have hx : 0 < x := by unfold x; linarith
have hy : 0 < y := by unfold y; linarith
have hz : 0 < z := by unfold z; linarith
constructor
· suffices H : x * y * z * (z + x + y) ≤ x * y ^3 + y * z^3 + z * x ^3 by
unfold x y z at H
nlinarith
let f : Fin 3 → ℝ := ![√x * √(y^3), √y * √(z^3), √z * √(x^3)]
let g : Fin 3 → ℝ := ![√z, √x, √y]
have hsum := Finset.sum_mul_sq_le_sq_mul_sq (Finset.univ) f g
simp only [Fin.sum_univ_three, f, g] at hsum
dsimp at hsum
rw [show x^3 = x^2 * x from rfl, show y^3 = y^2 * y from rfl,
show z^3 = z^2 * z from rfl] at hsum
rw [Real.sqrt_mul (by positivity), Real.sqrt_mul (by positivity),
Real.sqrt_mul (by positivity)] at hsum
rw [Real.sqrt_sq hx.le, Real.sqrt_sq hy.le, Real.sqrt_sq hz.le] at hsum
have h1 : √x * (y * √y) * √z + √y * (z * √z) * √x + √z * (x * √x) * √y =
(√x * √y * √z) * (z + x + y) := by ring
rw [h1] at hsum; clear h1
simp only [mul_pow] at hsum
simp only [Real.sq_sqrt hx.le, Real.sq_sqrt hy.le, Real.sq_sqrt hz.le] at hsum
rw [pow_two (z + x + y), ←mul_assoc] at hsum
have h2 : 0 < z + x + y := by positivity
rw [show x^2 * x = x^3 from rfl, show y^2 * y = y^3 from rfl,
show z^2 * z = z^3 from rfl] at hsum
exact le_of_mul_le_mul_right hsum h2
constructor
· intro h
have hxyz : x * y * z * (z + x + y) = x * y ^3 + y * z^3 + z * x ^3 := by
unfold x y z
linarith
clear h h₁ h₂ h₃
unfold EqualityCondition
suffices H : x = y ∧ x = z by
unfold x y z at H
obtain ⟨H1, H2⟩ := H
constructor
· linarith
· linarith
exact lemma1 hx hy hz hxyz
· rintro ⟨h1, h2⟩
simp [←h1, ←h2]
end Imo1983P6 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1983P6.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["type mismatch\n hr1\nhas type\n z * (y * z ^ 3) = x * (x * y ^ 3) : Prop\nbut is expected to have type\n z ^ 4 = x ^ 2 * y ^ 2 : Prop", "type mismatch\n hr2\nhas type\n z * (z * x ^ 3) = y * (x * y ^ 3) : Prop\nbut is expected to have type\n z ^ 2 * x ^ 2 = y ^ 4 : Prop", "type mismatch\n h4\nhas type\n x * y * x ^ 2 = y ^ 4 : Prop\nbut is expected to have type\n x ^ 3 = y ^ 3 : Prop", "type mismatch\n hr0\nhas type\n y * (x * y ^ 3) = z * (z * x ^ 3) : Prop\nbut is expected to have type\n y ^ 4 = x ^ 2 * z ^ 2 : Prop", "type mismatch\n hr1\nhas type\n y * (y * z ^ 3) = x * (z * x ^ 3) : Prop\nbut is expected to have type\n y ^ 2 * z ^ 2 = x ^ 4 : Prop", "type mismatch\n h4\nhas type\n x * z * z ^ 2 = x ^ 4 : Prop\nbut is expected to have type\n z ^ 3 = x ^ 3 : Prop", "`grind` failed\ncase grind\nx y z : \u211d\nhx : 0 < x\nhy : 0 < y\nhz : 0 < z\nhxyz : x * y * z * (z + x + y) = x * y ^ 3 + y * z ^ 3 + z * x ^ 3\nh :\n \u00ac(\u221ax * (y * \u221ay) * \u221az + \u221ay * (z * \u221az) * \u221ax + \u221az * (x * \u221ax) * \u221ay) ^ 2 =\n ((\u221ax * (y * \u221ay)) ^ 2 + (\u221ay * (z * \u221az)) ^ 2 + (\u221az * (x * \u221ax)) ^ 2) * (\u221az ^ 2 + \u221ax ^ 2 + \u221ay ^ 2)\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] 0 < x\n [prop] 0 < y\n [prop] 0 < z\n [prop] x * y * z * (z + x + y) = x * y ^ 3 + y * z ^ 3 + z * x ^ 3\n [prop] \u00ac(\u221ax * (y * \u221ay) * \u221az + \u221ay * (z * \u221az) * \u221ax + \u221az * (x * \u221ax) * \u221ay) ^ 2 =\n ((\u221ax * (y * \u221ay)) ^ 2 + (\u221ay * (z * \u221az)) ^ 2 + (\u221az * (x * \u221ax)) ^ 2) * (\u221az ^ 2 + \u221ax ^ 2 + \u221ay ^ 2)\n [eqc] True propositions\n [prop] 0 < x\n [prop] 0 < y\n [prop] 0 < z\n [eqc] False propositions\n [prop] (\u221ax * (y * \u221ay) * \u221az + \u221ay * (z * \u221az) * \u221ax + \u221az * (x * \u221ax) * \u221ay) ^ 2 =\n ((\u221ax * (y * \u221ay)) ^ 2 + (\u221ay * (z * \u221az)) ^ 2 + (\u221az * (x * \u221ax)) ^ 2) * (\u221az ^ 2 + \u221ax ^ 2 + \u221ay ^ 2)\n [eqc] Equivalence classes\n [eqc] {x * y * z * (z + x + y), x * y ^ 3 + y * z ^ 3 + z * x ^ 3}\n [ring] Ring `\u211d`\n [basis] Basis\n [_] x * y ^ 3 + x ^ 3 * z + -1 * (x ^ 2 * y * z) + -1 * (x * y ^ 2 * z) + -1 * (x * y * z ^ 2) + y * z ^ 3 = 0\n [diseqs] Disequalities\n [_] \u00ac-1 * (y ^ 2 * \u221ax ^ 4 * \u221ay ^ 2) + -1 * (y ^ 2 * \u221ax ^ 2 * \u221ay ^ 4) + -1 * (x ^ 2 * \u221ax ^ 4 * \u221az ^ 2) +\n 2 * (x * y * \u221ax ^ 2 * \u221ay ^ 2 * \u221az ^ 2) +\n 2 * (x * z * \u221ax ^ 2 * \u221ay ^ 2 * \u221az ^ 2) +\n 2 * (y * z * \u221ax ^ 2 * \u221ay ^ 2 * \u221az ^ 2) +\n -1 * (z ^ 2 * \u221ay ^ 4 * \u221az ^ 2) +\n -1 * (x ^ 2 * \u221ax ^ 2 * \u221az ^ 4) +\n -1 * (z ^ 2 * \u221ay ^ 2 * \u221az ^ 4) =\n 0"], "timeout_s": 600.0, "latency_s": 7.2555, "verified_at": "2026-03-26T18:17:00.607833+00:00"}} | false | true | false | 7.2555 |
compfiles_Imo1984P1 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Hongyu Ouyang
-/
import Mathlib
/-!
# International Mathematical Olympiad 1984, Problem 1
Let $x$, $y$, $z$ be nonnegative real numbers with $x + y + z = 1$.
Show that $0 \leq xy+yz+zx-2xyz \leq \frac{7}{27}$
-/
namespace Imo1984P1
lemma geom_mean_le_arith_mean_3 {a b c : ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) (hc : 0 ≤ c) :
a * b * c ≤ ((a + b + c) / 3) ^ (3 : ℝ) := by
have abc_pos : 0 ≤ a * b * c := by positivity
rw [show a * b * c = ((a * b * c) ^ ((1:ℝ) / 3)) ^ (3 : ℝ) by
rw [←(Real.rpow_mul abc_pos ((1 : ℝ)/3) 3)]; simp]
apply Real.rpow_le_rpow; rotate_right
· norm_num
· apply Real.rpow_nonneg abc_pos
· let w := (1 : ℝ) / 3
change (a * b * c) ^ w ≤ (a + b + c) / 3
trans w * a + w * b + w * c; rotate_left
· unfold w
field_simp
exact Std.IsPreorder.le_refl (a + b + c)
rw [Real.mul_rpow (by positivity) hc]
rw [Real.mul_rpow ha hb]
apply Real.geom_mean_le_arith_mean3_weighted; all_goals try norm_num; try positivity
theorem imo1984_p1 (x y z : ℝ)
(h₀ : 0 ≤ x ∧ 0 ≤ y ∧ 0 ≤ z)
(h₁ : x + y + z = 1) :
0 ≤ x * y + y * z + z * x - 2 * x * y * z ∧ x * y + y * z + z * x - 2 * x * y * z ≤
(7:ℝ) / 27 := by
rw [calc x * y + y * z + z * x - 2 * x * y * z
= (1 : ℝ) / 4 * (4 * (y * z + z * x + x * y) - 8 * x * y * z) := by ring_nf
_ = (1 : ℝ) / 4 * (4 * (y * z + z * x + x * y) -
8 * x * y * z + 1 - 2 * (x + y + z) + 1) :=
by rw [h₁]; ring_nf
_ = (1 : ℝ) / 4 * ((1 - 2 * x) * (1 - 2 * y) * (1 - 2 * z) + 1) := by ring_nf]
have hx0 : 0 ≤ x := h₀.1
have hy0 : 0 ≤ y := h₀.2.1
have hz0 : 0 ≤ z := h₀.2.2
-- TODO: smarter wlog needed.
wlog hxy : x ≤ y generalizing x y z
· rw [show (1 - 2 * x) * (1 - 2 * y) * (1 - 2 * z) = (1 - 2 * y) * (1 - 2 * x) * (1 - 2 * z)
by linarith]
exact this y x z ⟨hy0, hx0, hz0⟩ (by rw [←h₁]; linarith) hy0 hx0 hz0 (by linarith)
· wlog hxz : x ≤ z generalizing x y z
· rw [show (1 - 2 * x) * (1 - 2 * y) * (1 - 2 * z) = (1 - 2 * z) * (1 - 2 * x) * (1 - 2 * y)
by linarith]
exact this z x y ⟨hz0, hx0, hy0⟩
(by rw [←h₁]; linarith) hz0 hx0 hy0 (by linarith) ((le_of_not_ge hxz).trans hxy)
· wlog hyz : y ≤ z generalizing x y z
· rw [show (1 - 2 * x) * (1 - 2 * y) * (1 - 2 * z) = (1 - 2 * x) * (1 - 2 * z) * (1 - 2 * y)
by linarith]
exact this x z y ⟨hx0, hz0, hy0⟩ (by rw [←h₁]; linarith) hx0 hz0 hy0 hxz hxy (by linarith)
· constructor
· suffices habs : abs ((1 - 2 * x) * (1 - 2 * y) * (1 - 2 * z)) ≤ 1 by
have ⟨i, _⟩ := abs_le.mp habs; linarith only [i]
rw [abs_mul, abs_mul]
refine mul_le_one₀ (mul_le_one₀ ?_ (by positivity) ?_) (by positivity) ?_ <;>
(rw [abs_le]; constructor) <;> linarith
· suffices habs : ((1 - 2 * x) * (1 - 2 * y) * (1 - 2 * z)) ≤ (1 : ℝ) / 27 by linarith [habs]
conv => lhs; rw [← h₁]
have h1 : 0 ≤ (x + y + z - 2 * x) := by linarith
have h2 : 0 ≤ (x + y + z - 2 * y) := by linarith
by_cases h3 : 0 ≤ (x + y + z - 2 * z); rotate_left
· trans 0; rotate_left
· norm_num
apply nonpos_of_neg_nonneg
rw [←mul_neg]
apply mul_nonneg
· positivity
· linarith
· apply le_trans (geom_mean_le_arith_mean_3 h1 h2 h3)
rw [show (x + y + z - 2 * x + (x + y + z - 2 * y) + (x + y + z - 2 * z)) = 1
by rw [←h₁]; ring_nf]
norm_num
end Imo1984P1 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Hongyu Ouyang
-/
import Mathlib
/-!
# International Mathematical Olympiad 1984, Problem 1
Let $x$, $y$, $z$ be nonnegative real numbers with $x + y + z = 1$.
Show that $0 \leq xy+yz+zx-2xyz \leq \frac{7}{27}$
-/
namespace Imo1984P1
lemma geom_mean_le_arith_mean_3 {a b c : ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) (hc : 0 ≤ c) :
a * b * c ≤ ((a + b + c) / 3) ^ (3 : ℝ) := by
have abc_pos : 0 ≤ a * b * c := by positivity
rw [show a * b * c = ((a * b * c) ^ ((1:ℝ) / 3)) ^ (3 : ℝ) by
rw [←(Real.rpow_mul abc_pos ((1 : ℝ)/3) 3)]; simp]
apply Real.rpow_le_rpow; rotate_right
· norm_num
· apply Real.rpow_nonneg abc_pos
· let w := (1 : ℝ) / 3
change (a * b * c) ^ w ≤ (a + b + c) / 3
trans w * a + w * b + w * c; rotate_left
· unfold w
field_simp
exact Std.IsPreorder.le_refl (a + b + c)
rw [Real.mul_rpow (by positivity) hc]
rw [Real.mul_rpow ha hb]
apply Real.geom_mean_le_arith_mean3_weighted; all_goals try norm_num; try positivity
theorem imo1984_p1 (x y z : ℝ)
(h₀ : 0 ≤ x ∧ 0 ≤ y ∧ 0 ≤ z)
(h₁ : x + y + z = 1) :
0 ≤ x * y + y * z + z * x - 2 * x * y * z ∧ x * y + y * z + z * x - 2 * x * y * z ≤
(7:ℝ) / 27 := by
rw [calc x * y + y * z + z * x - 2 * x * y * z
= (1 : ℝ) / 4 * (4 * (y * z + z * x + x * y) - 8 * x * y * z) := by ring_nf
_ = (1 : ℝ) / 4 * (4 * (y * z + z * x + x * y) -
8 * x * y * z + 1 - 2 * (x + y + z) + 1) :=
by rw [h₁]; ring_nf
_ = (1 : ℝ) / 4 * ((1 - 2 * x) * (1 - 2 * y) * (1 - 2 * z) + 1) := by ring_nf]
have hx0 : 0 ≤ x := h₀.1
have hy0 : 0 ≤ y := h₀.2.1
have hz0 : 0 ≤ z := h₀.2.2
-- TODO: smarter wlog needed.
wlog hxy : x ≤ y generalizing x y z
· rw [show (1 - 2 * x) * (1 - 2 * y) * (1 - 2 * z) = (1 - 2 * y) * (1 - 2 * x) * (1 - 2 * z)
by linarith]
exact this y x z ⟨hy0, hx0, hz0⟩ (by rw [←h₁]; linarith) hy0 hx0 hz0 (by linarith)
· wlog hxz : x ≤ z generalizing x y z
· rw [show (1 - 2 * x) * (1 - 2 * y) * (1 - 2 * z) = (1 - 2 * z) * (1 - 2 * x) * (1 - 2 * y)
by linarith]
exact this z x y ⟨hz0, hx0, hy0⟩
(by rw [←h₁]; linarith) hz0 hx0 hy0 (by linarith) ((le_of_not_ge hxz).trans hxy)
· wlog hyz : y ≤ z generalizing x y z
· rw [show (1 - 2 * x) * (1 - 2 * y) * (1 - 2 * z) = (1 - 2 * x) * (1 - 2 * z) * (1 - 2 * y)
by linarith]
exact this x z y ⟨hx0, hz0, hy0⟩ (by rw [←h₁]; linarith) hx0 hz0 hy0 hxz hxy (by linarith)
· constructor
· suffices habs : abs ((1 - 2 * x) * (1 - 2 * y) * (1 - 2 * z)) ≤ 1 by
have ⟨i, _⟩ := abs_le.mp habs; linarith only [i]
rw [abs_mul, abs_mul]
refine mul_le_one₀ (mul_le_one₀ ?_ (by positivity) ?_) (by positivity) ?_ <;>
(rw [abs_le]; constructor) <;> linarith
· suffices habs : ((1 - 2 * x) * (1 - 2 * y) * (1 - 2 * z)) ≤ (1 : ℝ) / 27 by linarith [habs]
conv => lhs; rw [← h₁]
have h1 : 0 ≤ (x + y + z - 2 * x) := by linarith
have h2 : 0 ≤ (x + y + z - 2 * y) := by linarith
by_cases h3 : 0 ≤ (x + y + z - 2 * z); rotate_left
· trans 0; rotate_left
· norm_num
apply nonpos_of_neg_nonneg
rw [←mul_neg]
apply mul_nonneg
· positivity
· linarith
· apply le_trans (geom_mean_le_arith_mean_3 h1 h2 h3)
rw [show (x + y + z - 2 * x + (x + y + z - 2 * y) + (x + y + z - 2 * z)) = 1
by rw [←h₁]; ring_nf]
norm_num
end Imo1984P1
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Hongyu Ouyang
-/
import Mathlib
/-!
# International Mathematical Olympiad 1984, Problem 1
Let $x$, $y$, $z$ be nonnegative real numbers with $x + y + z = 1$.
Show that $0 \leq xy+yz+zx-2xyz \leq \frac{7}{27}$
-/
namespace Imo1984P1
lemma geom_mean_le_arith_mean_3 {a b c : ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) (hc : 0 ≤ c) :
a * b * c ≤ ((a + b + c) / 3) ^ (3 : ℝ) := by
have abc_pos : 0 ≤ a * b * c := by positivity
rw [show a * b * c = ((a * b * c) ^ ((1:ℝ) / 3)) ^ (3 : ℝ) by
rw [←(Real.rpow_mul abc_pos ((1 : ℝ)/3) 3)]; simp]
apply Real.rpow_le_rpow; rotate_right
· norm_num
· apply Real.rpow_nonneg abc_pos
· let w := (1 : ℝ) / 3
change (a * b * c) ^ w ≤ (a + b + c) / 3
trans w * a + w * b + w * c; rotate_left
· unfold w
field_simp
exact Std.IsPreorder.le_refl (a + b + c)
rw [Real.mul_rpow (by positivity) hc]
rw [Real.mul_rpow ha hb]
apply Real.geom_mean_le_arith_mean3_weighted; all_goals try norm_num; try positivity
theorem imo1984_p1 (x y z : ℝ)
(h₀ : 0 ≤ x ∧ 0 ≤ y ∧ 0 ≤ z)
(h₁ : x + y + z = 1) :
0 ≤ x * y + y * z + z * x - 2 * x * y * z ∧ x * y + y * z + z * x - 2 * x * y * z ≤
(7:ℝ) / 27 := by
rw [calc x * y + y * z + z * x - 2 * x * y * z
= (1 : ℝ) / 4 * (4 * (y * z + z * x + x * y) - 8 * x * y * z) := by ring_nf
_ = (1 : ℝ) / 4 * (4 * (y * z + z * x + x * y) -
8 * x * y * z + 1 - 2 * (x + y + z) + 1) :=
by rw [h₁]; ring_nf
_ = (1 : ℝ) / 4 * ((1 - 2 * x) * (1 - 2 * y) * (1 - 2 * z) + 1) := by ring_nf]
have hx0 : 0 ≤ x := h₀.1
have hy0 : 0 ≤ y := h₀.2.1
have hz0 : 0 ≤ z := h₀.2.2
-- TODO: smarter wlog needed.
wlog hxy : x ≤ y generalizing x y z
· rw [show (1 - 2 * x) * (1 - 2 * y) * (1 - 2 * z) = (1 - 2 * y) * (1 - 2 * x) * (1 - 2 * z)
by linarith]
exact this y x z ⟨hy0, hx0, hz0⟩ (by rw [←h₁]; linarith) hy0 hx0 hz0 (by linarith)
· wlog hxz : x ≤ z generalizing x y z
· rw [show (1 - 2 * x) * (1 - 2 * y) * (1 - 2 * z) = (1 - 2 * z) * (1 - 2 * x) * (1 - 2 * y)
by linarith]
exact this z x y ⟨hz0, hx0, hy0⟩
(by rw [←h₁]; linarith) hz0 hx0 hy0 (by linarith) ((le_of_not_ge hxz).trans hxy)
· wlog hyz : y ≤ z generalizing x y z
· rw [show (1 - 2 * x) * (1 - 2 * y) * (1 - 2 * z) = (1 - 2 * x) * (1 - 2 * z) * (1 - 2 * y)
by linarith]
exact this x z y ⟨hx0, hz0, hy0⟩ (by rw [←h₁]; linarith) hx0 hz0 hy0 hxz hxy (by linarith)
· constructor
· suffices habs : abs ((1 - 2 * x) * (1 - 2 * y) * (1 - 2 * z)) ≤ 1 by
have ⟨i, _⟩ := abs_le.mp habs; linarith only [i]
rw [abs_mul, abs_mul]
refine mul_le_one₀ (mul_le_one₀ ?_ (by positivity) ?_) (by positivity) ?_ <;>
(rw [abs_le]; constructor) <;> linarith
· suffices habs : ((1 - 2 * x) * (1 - 2 * y) * (1 - 2 * z)) ≤ (1 : ℝ) / 27 by linarith [habs]
conv => lhs; rw [← h₁]
have h1 : 0 ≤ (x + y + z - 2 * x) := by linarith
have h2 : 0 ≤ (x + y + z - 2 * y) := by linarith
by_cases h3 : 0 ≤ (x + y + z - 2 * z); rotate_left
· trans 0; rotate_left
· norm_num
apply nonpos_of_neg_nonneg
rw [←mul_neg]
apply mul_nonneg
· positivity
· linarith
· apply le_trans (geom_mean_le_arith_mean_3 h1 h2 h3)
rw [show (x + y + z - 2 * x + (x + y + z - 2 * y) + (x + y + z - 2 * z)) = 1
by rw [←h₁]; ring_nf]
norm_num
end Imo1984P1 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1984P1.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["no goals to be solved"], "timeout_s": 600.0, "latency_s": 3.0178, "verified_at": "2026-03-26T18:16:57.415356+00:00"}} | false | true | false | 3.0178 |
compfiles_Imo1984P2 | compfiles | Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1984, Problem 2
Find a pair of positive integers a and b such that
(i) ab(a + b) is not divisible by 7.
(ii) (a + b)⁷ - a⁷ - b⁷ is divisible by 7⁷.
-/
namespace Imo1984P2
abbrev a : ℤ := 18
abbrev b : ℤ := 1
theorem imo1984_p2 :
(0 < a) ∧ (0 < b) ∧
(¬ 7 ∣ a * b * (a + b)) ∧
7^7 ∣ (a + b)^7 - a^7 - b^7 := by
decide
end Imo1984P2 | /- | /-
Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1984, Problem 2
Find a pair of positive integers a and b such that
(i) ab(a + b) is not divisible by 7.
(ii) (a + b)⁷ - a⁷ - b⁷ is divisible by 7⁷.
-/
namespace Imo1984P2
abbrev a : ℤ := 18
abbrev b : ℤ := 1
theorem imo1984_p2 :
(0 < a) ∧ (0 < b) ∧
(¬ 7 ∣ a * b * (a + b)) ∧
7^7 ∣ (a + b)^7 - a^7 - b^7 := by
decide
end Imo1984P2
| true | Copyright (c) 2024 David Renshaw. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1984, Problem 2
Find a pair of positive integers a and b such that
(i) ab(a + b) is not divisible by 7.
(ii) (a + b)⁷ - a⁷ - b⁷ is divisible by 7⁷.
-/
namespace Imo1984P2
abbrev a : ℤ := 18
abbrev b : ℤ := 1
theorem imo1984_p2 :
(0 < a) ∧ (0 < b) ∧
(¬ 7 ∣ a * b * (a + b)) ∧
7^7 ∣ (a + b)^7 - a^7 - b^7 := by
decide
end Imo1984P2 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1984P2.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 600.0, "latency_s": 0.0625, "verified_at": "2026-03-26T18:16:55.136288+00:00"}} | true | true | false | 0.0625 |
compfiles_Imo1984P6 | compfiles | Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1984, Problem 6
Let a, b, c, and d be odd integers such that 0 < a < b < c < d and ad = bc.
Prove that if a + d = 2ᵏ and b + c = 2ᵐ for some integers k and m, then
a = 1.
-/
namespace Imo1984P6
lemma mylemma_sub_sq
(a b : ℕ)
(h₀: b < a) :
((a - b) ^ 2 = a ^ 2 + b ^ 2 - 2 * a * b) := by
have h₁: b^2 ≤ a * b := by
rw [pow_two]
refine Nat.mul_le_mul_right _ ?_
exact Nat.le_of_lt h₀
have h₂: a * b ≤ a ^ 2 := by
rw [pow_two]
refine Nat.mul_le_mul_left _ ?_
exact Nat.le_of_lt h₀
repeat rw [pow_two]
repeat rw [Nat.mul_sub_left_distrib]
repeat rw [Nat.mul_sub_right_distrib a b a]
rw [Nat.sub_right_comm]
repeat rw [Nat.mul_sub_right_distrib a b b]
ring_nf
omega
lemma mylemma_k_le_m_alt
(a b c d k m : ℕ)
(h₂ : a < b ∧ b < c ∧ c < d)
(h₃ : a * d = b * c)
(h₄ : a + d = 2 ^ k)
(h₅ : b + c = 2 ^ m)
(hkm : k ≤ m) :
False := by
have h₆: (a + d) ^ 2 ≤ (b + c) ^ 2 := by
refine Nat.pow_le_pow_left ?_ 2
rw [h₄,h₅]
exact pow_le_pow_right₀ (by norm_num) hkm
rw [add_sq, add_sq, mul_assoc, h₃, mul_assoc] at h₆
have h₇: (d - a) ^ 2 ≤ (c - b) ^ 2 := by
have hda: a < d := by
refine lt_trans h₂.1 ?_
exact lt_trans h₂.2.1 h₂.2.2
rw [mylemma_sub_sq d a hda]
rw [mylemma_sub_sq c b h₂.2.1]
rw [mul_assoc, mul_assoc]
rw [mul_comm d a, mul_comm c b]
rw [h₃]
refine Nat.sub_le_sub_right ?_ (2 * (b * c))
linarith
have h₈: (c - b) ^ 2 < (d - a) ^ 2 := by
refine Nat.pow_lt_pow_left ?_ (by norm_num)
have h₈₀: c - a < d - a := by
have g₀: c - a + a < d - a + a := by
rw [Nat.sub_add_cancel ?_]
· rw [Nat.sub_add_cancel ?_]
· exact h₂.2.2
· linarith
· linarith
exact Nat.lt_of_add_lt_add_right g₀
refine lt_trans ?_ h₈₀
refine Nat.sub_lt_sub_left ?_ h₂.1
exact lt_trans h₂.1 h₂.2.1
omega
lemma mylemma_h8
(a b c d k m : ℕ)
(h₀ : 0 < a ∧ 0 < b ∧ 0 < c ∧ 0 < d)
(h₁ : Odd a ∧ Odd b ∧ Odd c ∧ Odd d)
(h₂ : a < b ∧ b < c ∧ c < d)
(h₅ : b + c = 2 ^ m)
(hkm : m < k)
(h₆ : b * 2 ^ m - a * 2 ^ k = (b - a) * (b + a))
(h₇ : 2 ^ m ∣ (b - a) * (b + a)) :
(b + a = 2 ^ (m - 1)) := by
have h₇₁: ∃ y z, y ∣ b - a ∧ z ∣ b + a ∧ y * z = 2 ^ m := by
exact Nat.dvd_mul.mp h₇
let ⟨p, q, hpd, hqd, hpq⟩ := h₇₁
have hm1: 1 ≤ m := by
by_contra! hc
interval_cases m
omega
have h₈₀: b - a < 2 ^ (m - 1) := by
have g₀: b < (b + c) / 2 := by
refine (Nat.lt_div_iff_mul_lt' ?_ b).mpr ?_
· refine even_iff_two_dvd.mp ?_
exact Odd.add_odd h₁.2.1 h₁.2.2.1
· omega
have g₁: (b + c) / 2 = 2 ^ (m-1) := by
rw [h₅]
rw [← Nat.pow_sub_mul_pow 2 hm1]
simp
rw [← g₁]
exact tsub_lt_of_lt g₀
have hp: p = 2 := by
have hp₀: 2 * b < 2 ^ m := by
rw [← h₅, two_mul]
exact Nat.add_lt_add_left h₂.2.1 b
have hp₁: b + a < 2 ^ (m) := by
have g₀: b + a < b + b := by
exact Nat.add_lt_add_left h₂.1 b
refine Nat.lt_trans g₀ ?_
rw [← two_mul]
exact hp₀
have hp₂: q < 2 ^ m := by
refine Nat.lt_of_le_of_lt (Nat.le_of_dvd ?_ hqd) hp₁
exact Nat.add_pos_right b h₀.1
have hp₃: 1 < p := by
rw [← hpq] at hp₂
exact one_lt_of_lt_mul_left hp₂
have h2prime: Nat.Prime 2 := Nat.prime_two
have hp₅: ∀ i j:ℕ , 2 ^ i ∣ (b - a) ∧ 2 ^ j ∣ (b + a) → (i < 2 ∨ j < 2) := by
by_contra! hc
let ⟨i, j, hi⟩ := hc
have hti: 2 ^ 2 ∣ 2 ^ i := by exact Nat.pow_dvd_pow 2 hi.2.1
have htj: 2 ^ 2 ∣ 2 ^ j := by exact Nat.pow_dvd_pow 2 hi.2.2
norm_num at hti htj
have hi₄: 4 ∣ b - a := by exact Nat.dvd_trans hti hi.1.1
have hi₅: 4 ∣ b + a := by exact Nat.dvd_trans htj hi.1.2
have hi₆: 4 ∣ (b - a) + (b + a) := by exact Nat.dvd_add hi₄ hi₅
have hi₇: 2 ∣ b := by
have g₀: 0 < 2 := by norm_num
refine Nat.dvd_of_mul_dvd_mul_left g₀ ?_
rw [← Nat.add_sub_cancel (2 * b) a, Nat.two_mul b]
rw [add_assoc, Nat.sub_add_comm (le_of_lt h₂.1)]
exact hi₆
have hi₈: Even b := by
exact even_iff_two_dvd.mpr hi₇
apply Nat.not_odd_iff_even.mpr hi₈
exact h₁.2.1
have hp₆: ∀ i j:ℕ , i + j = m ∧ 2 ^ i ∣ (b - a) ∧ 2 ^ j ∣ (b + a) → (¬ j < 2) := by
by_contra! hc
let ⟨i, j, hi⟩ := hc
have hi₀: m - 1 ≤ i := by
rw [← hi.1.1]
simp
exact Nat.le_pred_of_lt hi.2
have hi₁: 2 ^ (m - 1) ≤ 2 ^ i := by exact Nat.pow_le_pow_right (by norm_num) hi₀
have hi₂: 2 ^ i < 2 ^ (m - 1) := by
refine lt_of_le_of_lt ?_ h₈₀
refine Nat.le_of_dvd ?_ hi.1.2.1
exact Nat.sub_pos_of_lt h₂.1
linarith [hi₁, hi₂]
have hi₀: ∃ i ≤ m, p = 2 ^ i := by
have g₀: p ∣ 2 ^ m := Dvd.intro q hpq
exact (Nat.dvd_prime_pow h2prime).mp g₀
let ⟨i, him, hp⟩ := hi₀
let j:ℕ := m - i
have hj₀: j = m - i := by linarith
have hj₁: i + j = m := by
rw [add_comm, ← Nat.sub_add_cancel him]
have hq: q = 2 ^ j := by
rw [hp] at hpq
rw [hj₀, ← Nat.pow_div him (by norm_num)]
refine Nat.eq_div_of_mul_eq_right ?_ hpq
positivity
rw [hp] at hpd
rw [hq] at hqd
have hj₃: ¬ j < 2 := by
exact hp₆ i j {left:= hj₁ , right:= { left := hpd , right:= hqd} }
have hi₂: i < 2 := by
have g₀: i < 2 ∨ j < 2 := by
exact hp₅ i j { left := hpd , right:= hqd }
omega
have hi₃: 0 < i := by
rw [hp] at hp₃
refine Nat.zero_lt_of_ne_zero ?_
exact (Nat.one_lt_two_pow_iff).mp hp₃
have hi₄: i = 1 := by
interval_cases i
rfl
rw [hi₄] at hp
exact hp
have hq: q = 2 ^ (m - 1) := by
rw [hp, ← Nat.pow_sub_mul_pow 2 hm1, pow_one, mul_comm] at hpq
exact Nat.mul_right_cancel (by norm_num) hpq
rw [hq] at hqd
have h₈₂: ∃ c, (b + a) = c * 2 ^ (m - 1) := by
exact exists_eq_mul_left_of_dvd hqd
let ⟨f, hf⟩ := h₈₂
have hfeq1: f = 1 := by
have hf₀: f * 2 ^ (m - 1) < 2 * 2 ^ (m - 1) := by
rw [← hf, ← Nat.pow_succ', ← Nat.succ_sub hm1]
rw [Nat.succ_sub_one, ← h₅]
refine Nat.add_lt_add_left ?_ b
exact lt_trans h₂.1 h₂.2.1
have hf₁: f < 2 := by
exact Nat.lt_of_mul_lt_mul_right hf₀
interval_cases f
· omega
· rfl
rw [hfeq1, one_mul] at hf
exact hf
theorem imo_1984_p6
(a b c d k m : ℕ)
(h₀ : 0 < a ∧ 0 < b ∧ 0 < c ∧ 0 < d)
(h₁ : Odd a ∧ Odd b ∧ Odd c ∧ Odd d)
(h₂ : a < b ∧ b < c ∧ c < d)
(h₃ : a * d = b * c)
(h₄ : a + d = 2^k)
(h₅ : b + c = 2^m) :
a = 1 := by
by_cases hkm: k ≤ m
· exfalso
exact mylemma_k_le_m_alt a b c d k m h₂ h₃ h₄ h₅ hkm
· push_neg at hkm
have h₆: b * 2 ^ m - a * 2 ^ k = (b - a) * (b + a) := by
have h₆₀: c = 2 ^ m - b := by exact (tsub_eq_of_eq_add_rev (id h₅.symm)).symm
have h₆₁: d = 2 ^ k - a := by exact (tsub_eq_of_eq_add_rev (id h₄.symm)).symm
rw [h₆₀, h₆₁] at h₃
repeat rw [Nat.mul_sub_left_distrib, ← pow_two] at h₃
have h₆₂: b * 2 ^ m - a * 2 ^ k = b ^ 2 - a ^ 2 := by
symm at h₃
refine Nat.sub_eq_of_eq_add ?_
rw [add_comm, ← Nat.add_sub_assoc]
· rw [Nat.sub_add_comm]
· refine Nat.eq_add_of_sub_eq ?_ h₃
rw [pow_two]
refine le_of_lt ?_
refine mul_lt_mul' (by omega) ?_ (le_of_lt h₀.2.1) h₀.2.1
omega
· rw [pow_two]
refine le_of_lt ?_
refine mul_lt_mul' (by omega) ?_ (le_of_lt h₀.1) h₀.1
omega
· refine le_of_lt ?_
rw [pow_two, pow_two]
exact mul_lt_mul h₂.1 (le_of_lt h₂.1) h₀.1 (le_of_lt h₀.2.1)
rw [Nat.sq_sub_sq b a] at h₆₂
linarith
have h₇: 2 ^ m ∣ (b - a) * (b + a) := by
have h₇₀: k = (k - m) + m := by exact (Nat.sub_add_cancel (le_of_lt hkm)).symm
rw [h₇₀, pow_add] at h₆
have h₇₁: (b - a * 2 ^ (k - m)) * (2 ^ m) = (b - a) * (b + a) := by
rw [Nat.mul_sub_right_distrib]
rw [mul_assoc a _ _]
exact h₆
exact Dvd.intro_left (b - a * 2 ^ (k - m)) h₇₁
have h₈: b + a = 2 ^ (m - 1) := by
exact mylemma_h8 a b c d k m h₀ h₁ h₂ h₅ hkm h₆ h₇
have h₉: a = 2 ^ (2 * m - 2) / 2 ^ k := by
have ga: 1 ≤ a := Nat.succ_le_of_lt h₀.1
have gb: 3 ≤ b := by
by_contra! hc
interval_cases b
· omega
· omega
· have g₀: ¬ Odd 2 := by decide
exact g₀ h₁.2.1
have gm: 3 ≤ m := by
have gm₀: 2 ^ 2 ≤ 2 ^ (m - 1) := by
norm_num
rw [← h₈]
omega
have gm₁: 2 ≤ m - 1 := by
exact (Nat.pow_le_pow_iff_right (by norm_num)).mp gm₀
omega
have g₀: a < 2 ^ (m - 2) := by
have g₀₀: a + a < b + a := by simp [h₂.1]
rw [h₈, ← mul_two a] at g₀₀
have g₀₁: m - 1 = Nat.succ (m - 2) := by
rw [← Nat.succ_sub ?_]
· rw [Nat.succ_eq_add_one]
omega
· omega
rw [g₀₁, Nat.pow_succ 2 _] at g₀₀
exact Nat.lt_of_mul_lt_mul_right g₀₀
have h₉₀: b = 2 ^ (m - 1) - a := by
symm
exact Nat.sub_eq_of_eq_add h₈.symm
rw [h₈, h₉₀] at h₆
repeat rw [Nat.mul_sub_right_distrib] at h₆
repeat rw [← Nat.pow_add] at h₆
have hm1: 1 ≤ m := by omega
repeat rw [← Nat.sub_add_comm hm1] at h₆
repeat rw [← Nat.add_sub_assoc hm1] at h₆
ring_nf at h₆
rw [← Nat.sub_add_eq _ 1 1] at h₆
norm_num at h₆
rw [← Nat.sub_add_eq _ (a * 2 ^ (m - 1)) (a * 2 ^ (m - 1))] at h₆
rw [← two_mul (a * 2 ^ (m - 1))] at h₆
rw [mul_comm 2 _] at h₆
rw [mul_assoc a (2 ^ (m - 1)) 2] at h₆
rw [← Nat.pow_succ, Nat.succ_eq_add_one] at h₆
rw [Nat.sub_add_cancel hm1] at h₆
rw [← Nat.sub_add_eq ] at h₆
have h₉₁: 2 ^ (m * 2 - 1) = 2 ^ (m * 2 - 2) - a * 2 ^ m + (a * 2 ^ m + a * 2 ^ k) := by
refine Nat.eq_add_of_sub_eq ?_ h₆
by_contra! hc
have g₁: 2 ^ (m * 2 - 1) - (a * 2 ^ m + a * 2 ^ k) = 0 := by
exact Nat.sub_eq_zero_of_le (le_of_lt hc)
rw [g₁] at h₆
have g₂: 2 ^ (m * 2 - 2) ≤ a * 2 ^ m := by exact Nat.le_of_sub_eq_zero h₆.symm
have g₃: 2 ^ (m - 2) ≤ a := by
rw [mul_two, Nat.add_sub_assoc (by omega) m] at g₂
rw [Nat.pow_add, mul_comm] at g₂
refine Nat.le_of_mul_le_mul_right g₂ ?_
exact Nat.two_pow_pos m
linarith [g₀, g₃]
rw [← Nat.add_assoc] at h₉₁
have h₉₂: a * 2 ^ k = 2 * 2 ^ (2 * m - 2) - 2 ^ (2 * m - 2) := by
rw [Nat.sub_add_cancel ?_] at h₉₁
· rw [add_comm] at h₉₁
symm
rw [← Nat.pow_succ', Nat.succ_eq_add_one]
omega
· refine le_of_lt ?_
rw [mul_two, Nat.add_sub_assoc, Nat.pow_add, mul_comm (2 ^ m) _]
· refine (Nat.mul_lt_mul_right (by omega)).mpr g₀
omega
nth_rewrite 2 [← Nat.one_mul (2 ^ (2 * m - 2))] at h₉₂
rw [← Nat.mul_sub_right_distrib 2 1 (2 ^ (2 * m - 2))] at h₉₂
norm_num at h₉₂
refine Nat.eq_div_of_mul_eq_left ?_ h₉₂
exact Ne.symm (NeZero.ne' (2 ^ k))
by_cases hk2m: k ≤ 2 * m - 2
· rw [Nat.pow_div hk2m (by norm_num)] at h₉
rw [Nat.sub_right_comm (2*m) 2 k] at h₉
by_contra! hc
obtain hc₀ | hc₁ := lt_or_gt_of_ne hc
· interval_cases a
omega
· have hc₂: ¬ Odd a := by
refine (Nat.not_odd_iff_even).mpr ?_
have hc₃: 1 ≤ 2 * m - k - 2 := by
by_contra! hc₄
interval_cases (2 * m - k - 2)
rw [pow_zero] at h₉
exact hc h₉
have hc₄: 2 * m - k - 2 = Nat.succ (2 * m - k - 3) := by
rw [Nat.succ_eq_add_one]
exact Nat.eq_add_of_sub_eq hc₃ rfl
rw [h₉, hc₄, Nat.pow_succ']
exact even_two_mul (2 ^ (2 * m - k - 3))
exact hc₂ h₁.1
· push_neg at hk2m
exfalso
have ha: a = 0 := by
rw [h₉]
refine (Nat.div_eq_zero_iff).mpr ?_
right
exact Nat.pow_lt_pow_right (by norm_num) hk2m
omega
end Imo1984P6 | /- | /-
Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1984, Problem 6
Let a, b, c, and d be odd integers such that 0 < a < b < c < d and ad = bc.
Prove that if a + d = 2ᵏ and b + c = 2ᵐ for some integers k and m, then
a = 1.
-/
namespace Imo1984P6
lemma mylemma_sub_sq
(a b : ℕ)
(h₀: b < a) :
((a - b) ^ 2 = a ^ 2 + b ^ 2 - 2 * a * b) := by
have h₁: b^2 ≤ a * b := by
rw [pow_two]
refine Nat.mul_le_mul_right _ ?_
exact Nat.le_of_lt h₀
have h₂: a * b ≤ a ^ 2 := by
rw [pow_two]
refine Nat.mul_le_mul_left _ ?_
exact Nat.le_of_lt h₀
repeat rw [pow_two]
repeat rw [Nat.mul_sub_left_distrib]
repeat rw [Nat.mul_sub_right_distrib a b a]
rw [Nat.sub_right_comm]
repeat rw [Nat.mul_sub_right_distrib a b b]
ring_nf
omega
lemma mylemma_k_le_m_alt
(a b c d k m : ℕ)
(h₂ : a < b ∧ b < c ∧ c < d)
(h₃ : a * d = b * c)
(h₄ : a + d = 2 ^ k)
(h₅ : b + c = 2 ^ m)
(hkm : k ≤ m) :
False := by
have h₆: (a + d) ^ 2 ≤ (b + c) ^ 2 := by
refine Nat.pow_le_pow_left ?_ 2
rw [h₄,h₅]
exact pow_le_pow_right₀ (by norm_num) hkm
rw [add_sq, add_sq, mul_assoc, h₃, mul_assoc] at h₆
have h₇: (d - a) ^ 2 ≤ (c - b) ^ 2 := by
have hda: a < d := by
refine lt_trans h₂.1 ?_
exact lt_trans h₂.2.1 h₂.2.2
rw [mylemma_sub_sq d a hda]
rw [mylemma_sub_sq c b h₂.2.1]
rw [mul_assoc, mul_assoc]
rw [mul_comm d a, mul_comm c b]
rw [h₃]
refine Nat.sub_le_sub_right ?_ (2 * (b * c))
linarith
have h₈: (c - b) ^ 2 < (d - a) ^ 2 := by
refine Nat.pow_lt_pow_left ?_ (by norm_num)
have h₈₀: c - a < d - a := by
have g₀: c - a + a < d - a + a := by
rw [Nat.sub_add_cancel ?_]
· rw [Nat.sub_add_cancel ?_]
· exact h₂.2.2
· linarith
· linarith
exact Nat.lt_of_add_lt_add_right g₀
refine lt_trans ?_ h₈₀
refine Nat.sub_lt_sub_left ?_ h₂.1
exact lt_trans h₂.1 h₂.2.1
omega
lemma mylemma_h8
(a b c d k m : ℕ)
(h₀ : 0 < a ∧ 0 < b ∧ 0 < c ∧ 0 < d)
(h₁ : Odd a ∧ Odd b ∧ Odd c ∧ Odd d)
(h₂ : a < b ∧ b < c ∧ c < d)
(h₅ : b + c = 2 ^ m)
(hkm : m < k)
(h₆ : b * 2 ^ m - a * 2 ^ k = (b - a) * (b + a))
(h₇ : 2 ^ m ∣ (b - a) * (b + a)) :
(b + a = 2 ^ (m - 1)) := by
have h₇₁: ∃ y z, y ∣ b - a ∧ z ∣ b + a ∧ y * z = 2 ^ m := by
exact Nat.dvd_mul.mp h₇
let ⟨p, q, hpd, hqd, hpq⟩ := h₇₁
have hm1: 1 ≤ m := by
by_contra! hc
interval_cases m
omega
have h₈₀: b - a < 2 ^ (m - 1) := by
have g₀: b < (b + c) / 2 := by
refine (Nat.lt_div_iff_mul_lt' ?_ b).mpr ?_
· refine even_iff_two_dvd.mp ?_
exact Odd.add_odd h₁.2.1 h₁.2.2.1
· omega
have g₁: (b + c) / 2 = 2 ^ (m-1) := by
rw [h₅]
rw [← Nat.pow_sub_mul_pow 2 hm1]
simp
rw [← g₁]
exact tsub_lt_of_lt g₀
have hp: p = 2 := by
have hp₀: 2 * b < 2 ^ m := by
rw [← h₅, two_mul]
exact Nat.add_lt_add_left h₂.2.1 b
have hp₁: b + a < 2 ^ (m) := by
have g₀: b + a < b + b := by
exact Nat.add_lt_add_left h₂.1 b
refine Nat.lt_trans g₀ ?_
rw [← two_mul]
exact hp₀
have hp₂: q < 2 ^ m := by
refine Nat.lt_of_le_of_lt (Nat.le_of_dvd ?_ hqd) hp₁
exact Nat.add_pos_right b h₀.1
have hp₃: 1 < p := by
rw [← hpq] at hp₂
exact one_lt_of_lt_mul_left hp₂
have h2prime: Nat.Prime 2 := Nat.prime_two
have hp₅: ∀ i j:ℕ , 2 ^ i ∣ (b - a) ∧ 2 ^ j ∣ (b + a) → (i < 2 ∨ j < 2) := by
by_contra! hc
let ⟨i, j, hi⟩ := hc
have hti: 2 ^ 2 ∣ 2 ^ i := by exact Nat.pow_dvd_pow 2 hi.2.1
have htj: 2 ^ 2 ∣ 2 ^ j := by exact Nat.pow_dvd_pow 2 hi.2.2
norm_num at hti htj
have hi₄: 4 ∣ b - a := by exact Nat.dvd_trans hti hi.1.1
have hi₅: 4 ∣ b + a := by exact Nat.dvd_trans htj hi.1.2
have hi₆: 4 ∣ (b - a) + (b + a) := by exact Nat.dvd_add hi₄ hi₅
have hi₇: 2 ∣ b := by
have g₀: 0 < 2 := by norm_num
refine Nat.dvd_of_mul_dvd_mul_left g₀ ?_
rw [← Nat.add_sub_cancel (2 * b) a, Nat.two_mul b]
rw [add_assoc, Nat.sub_add_comm (le_of_lt h₂.1)]
exact hi₆
have hi₈: Even b := by
exact even_iff_two_dvd.mpr hi₇
apply Nat.not_odd_iff_even.mpr hi₈
exact h₁.2.1
have hp₆: ∀ i j:ℕ , i + j = m ∧ 2 ^ i ∣ (b - a) ∧ 2 ^ j ∣ (b + a) → (¬ j < 2) := by
by_contra! hc
let ⟨i, j, hi⟩ := hc
have hi₀: m - 1 ≤ i := by
rw [← hi.1.1]
simp
exact Nat.le_pred_of_lt hi.2
have hi₁: 2 ^ (m - 1) ≤ 2 ^ i := by exact Nat.pow_le_pow_right (by norm_num) hi₀
have hi₂: 2 ^ i < 2 ^ (m - 1) := by
refine lt_of_le_of_lt ?_ h₈₀
refine Nat.le_of_dvd ?_ hi.1.2.1
exact Nat.sub_pos_of_lt h₂.1
linarith [hi₁, hi₂]
have hi₀: ∃ i ≤ m, p = 2 ^ i := by
have g₀: p ∣ 2 ^ m := Dvd.intro q hpq
exact (Nat.dvd_prime_pow h2prime).mp g₀
let ⟨i, him, hp⟩ := hi₀
let j:ℕ := m - i
have hj₀: j = m - i := by linarith
have hj₁: i + j = m := by
rw [add_comm, ← Nat.sub_add_cancel him]
have hq: q = 2 ^ j := by
rw [hp] at hpq
rw [hj₀, ← Nat.pow_div him (by norm_num)]
refine Nat.eq_div_of_mul_eq_right ?_ hpq
positivity
rw [hp] at hpd
rw [hq] at hqd
have hj₃: ¬ j < 2 := by
exact hp₆ i j {left:= hj₁ , right:= { left := hpd , right:= hqd} }
have hi₂: i < 2 := by
have g₀: i < 2 ∨ j < 2 := by
exact hp₅ i j { left := hpd , right:= hqd }
omega
have hi₃: 0 < i := by
rw [hp] at hp₃
refine Nat.zero_lt_of_ne_zero ?_
exact (Nat.one_lt_two_pow_iff).mp hp₃
have hi₄: i = 1 := by
interval_cases i
rfl
rw [hi₄] at hp
exact hp
have hq: q = 2 ^ (m - 1) := by
rw [hp, ← Nat.pow_sub_mul_pow 2 hm1, pow_one, mul_comm] at hpq
exact Nat.mul_right_cancel (by norm_num) hpq
rw [hq] at hqd
have h₈₂: ∃ c, (b + a) = c * 2 ^ (m - 1) := by
exact exists_eq_mul_left_of_dvd hqd
let ⟨f, hf⟩ := h₈₂
have hfeq1: f = 1 := by
have hf₀: f * 2 ^ (m - 1) < 2 * 2 ^ (m - 1) := by
rw [← hf, ← Nat.pow_succ', ← Nat.succ_sub hm1]
rw [Nat.succ_sub_one, ← h₅]
refine Nat.add_lt_add_left ?_ b
exact lt_trans h₂.1 h₂.2.1
have hf₁: f < 2 := by
exact Nat.lt_of_mul_lt_mul_right hf₀
interval_cases f
· omega
· rfl
rw [hfeq1, one_mul] at hf
exact hf
theorem imo_1984_p6
(a b c d k m : ℕ)
(h₀ : 0 < a ∧ 0 < b ∧ 0 < c ∧ 0 < d)
(h₁ : Odd a ∧ Odd b ∧ Odd c ∧ Odd d)
(h₂ : a < b ∧ b < c ∧ c < d)
(h₃ : a * d = b * c)
(h₄ : a + d = 2^k)
(h₅ : b + c = 2^m) :
a = 1 := by
by_cases hkm: k ≤ m
· exfalso
exact mylemma_k_le_m_alt a b c d k m h₂ h₃ h₄ h₅ hkm
· push_neg at hkm
have h₆: b * 2 ^ m - a * 2 ^ k = (b - a) * (b + a) := by
have h₆₀: c = 2 ^ m - b := by exact (tsub_eq_of_eq_add_rev (id h₅.symm)).symm
have h₆₁: d = 2 ^ k - a := by exact (tsub_eq_of_eq_add_rev (id h₄.symm)).symm
rw [h₆₀, h₆₁] at h₃
repeat rw [Nat.mul_sub_left_distrib, ← pow_two] at h₃
have h₆₂: b * 2 ^ m - a * 2 ^ k = b ^ 2 - a ^ 2 := by
symm at h₃
refine Nat.sub_eq_of_eq_add ?_
rw [add_comm, ← Nat.add_sub_assoc]
· rw [Nat.sub_add_comm]
· refine Nat.eq_add_of_sub_eq ?_ h₃
rw [pow_two]
refine le_of_lt ?_
refine mul_lt_mul' (by omega) ?_ (le_of_lt h₀.2.1) h₀.2.1
omega
· rw [pow_two]
refine le_of_lt ?_
refine mul_lt_mul' (by omega) ?_ (le_of_lt h₀.1) h₀.1
omega
· refine le_of_lt ?_
rw [pow_two, pow_two]
exact mul_lt_mul h₂.1 (le_of_lt h₂.1) h₀.1 (le_of_lt h₀.2.1)
rw [Nat.sq_sub_sq b a] at h₆₂
linarith
have h₇: 2 ^ m ∣ (b - a) * (b + a) := by
have h₇₀: k = (k - m) + m := by exact (Nat.sub_add_cancel (le_of_lt hkm)).symm
rw [h₇₀, pow_add] at h₆
have h₇₁: (b - a * 2 ^ (k - m)) * (2 ^ m) = (b - a) * (b + a) := by
rw [Nat.mul_sub_right_distrib]
rw [mul_assoc a _ _]
exact h₆
exact Dvd.intro_left (b - a * 2 ^ (k - m)) h₇₁
have h₈: b + a = 2 ^ (m - 1) := by
exact mylemma_h8 a b c d k m h₀ h₁ h₂ h₅ hkm h₆ h₇
have h₉: a = 2 ^ (2 * m - 2) / 2 ^ k := by
have ga: 1 ≤ a := Nat.succ_le_of_lt h₀.1
have gb: 3 ≤ b := by
by_contra! hc
interval_cases b
· omega
· omega
· have g₀: ¬ Odd 2 := by decide
exact g₀ h₁.2.1
have gm: 3 ≤ m := by
have gm₀: 2 ^ 2 ≤ 2 ^ (m - 1) := by
norm_num
rw [← h₈]
omega
have gm₁: 2 ≤ m - 1 := by
exact (Nat.pow_le_pow_iff_right (by norm_num)).mp gm₀
omega
have g₀: a < 2 ^ (m - 2) := by
have g₀₀: a + a < b + a := by simp [h₂.1]
rw [h₈, ← mul_two a] at g₀₀
have g₀₁: m - 1 = Nat.succ (m - 2) := by
rw [← Nat.succ_sub ?_]
· rw [Nat.succ_eq_add_one]
omega
· omega
rw [g₀₁, Nat.pow_succ 2 _] at g₀₀
exact Nat.lt_of_mul_lt_mul_right g₀₀
have h₉₀: b = 2 ^ (m - 1) - a := by
symm
exact Nat.sub_eq_of_eq_add h₈.symm
rw [h₈, h₉₀] at h₆
repeat rw [Nat.mul_sub_right_distrib] at h₆
repeat rw [← Nat.pow_add] at h₆
have hm1: 1 ≤ m := by omega
repeat rw [← Nat.sub_add_comm hm1] at h₆
repeat rw [← Nat.add_sub_assoc hm1] at h₆
ring_nf at h₆
rw [← Nat.sub_add_eq _ 1 1] at h₆
norm_num at h₆
rw [← Nat.sub_add_eq _ (a * 2 ^ (m - 1)) (a * 2 ^ (m - 1))] at h₆
rw [← two_mul (a * 2 ^ (m - 1))] at h₆
rw [mul_comm 2 _] at h₆
rw [mul_assoc a (2 ^ (m - 1)) 2] at h₆
rw [← Nat.pow_succ, Nat.succ_eq_add_one] at h₆
rw [Nat.sub_add_cancel hm1] at h₆
rw [← Nat.sub_add_eq ] at h₆
have h₉₁: 2 ^ (m * 2 - 1) = 2 ^ (m * 2 - 2) - a * 2 ^ m + (a * 2 ^ m + a * 2 ^ k) := by
refine Nat.eq_add_of_sub_eq ?_ h₆
by_contra! hc
have g₁: 2 ^ (m * 2 - 1) - (a * 2 ^ m + a * 2 ^ k) = 0 := by
exact Nat.sub_eq_zero_of_le (le_of_lt hc)
rw [g₁] at h₆
have g₂: 2 ^ (m * 2 - 2) ≤ a * 2 ^ m := by exact Nat.le_of_sub_eq_zero h₆.symm
have g₃: 2 ^ (m - 2) ≤ a := by
rw [mul_two, Nat.add_sub_assoc (by omega) m] at g₂
rw [Nat.pow_add, mul_comm] at g₂
refine Nat.le_of_mul_le_mul_right g₂ ?_
exact Nat.two_pow_pos m
linarith [g₀, g₃]
rw [← Nat.add_assoc] at h₉₁
have h₉₂: a * 2 ^ k = 2 * 2 ^ (2 * m - 2) - 2 ^ (2 * m - 2) := by
rw [Nat.sub_add_cancel ?_] at h₉₁
· rw [add_comm] at h₉₁
symm
rw [← Nat.pow_succ', Nat.succ_eq_add_one]
omega
· refine le_of_lt ?_
rw [mul_two, Nat.add_sub_assoc, Nat.pow_add, mul_comm (2 ^ m) _]
· refine (Nat.mul_lt_mul_right (by omega)).mpr g₀
omega
nth_rewrite 2 [← Nat.one_mul (2 ^ (2 * m - 2))] at h₉₂
rw [← Nat.mul_sub_right_distrib 2 1 (2 ^ (2 * m - 2))] at h₉₂
norm_num at h₉₂
refine Nat.eq_div_of_mul_eq_left ?_ h₉₂
exact Ne.symm (NeZero.ne' (2 ^ k))
by_cases hk2m: k ≤ 2 * m - 2
· rw [Nat.pow_div hk2m (by norm_num)] at h₉
rw [Nat.sub_right_comm (2*m) 2 k] at h₉
by_contra! hc
obtain hc₀ | hc₁ := lt_or_gt_of_ne hc
· interval_cases a
omega
· have hc₂: ¬ Odd a := by
refine (Nat.not_odd_iff_even).mpr ?_
have hc₃: 1 ≤ 2 * m - k - 2 := by
by_contra! hc₄
interval_cases (2 * m - k - 2)
rw [pow_zero] at h₉
exact hc h₉
have hc₄: 2 * m - k - 2 = Nat.succ (2 * m - k - 3) := by
rw [Nat.succ_eq_add_one]
exact Nat.eq_add_of_sub_eq hc₃ rfl
rw [h₉, hc₄, Nat.pow_succ']
exact even_two_mul (2 ^ (2 * m - k - 3))
exact hc₂ h₁.1
· push_neg at hk2m
exfalso
have ha: a = 0 := by
rw [h₉]
refine (Nat.div_eq_zero_iff).mpr ?_
right
exact Nat.pow_lt_pow_right (by norm_num) hk2m
omega
end Imo1984P6
| true | Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1984, Problem 6
Let a, b, c, and d be odd integers such that 0 < a < b < c < d and ad = bc.
Prove that if a + d = 2ᵏ and b + c = 2ᵐ for some integers k and m, then
a = 1.
-/
namespace Imo1984P6
lemma mylemma_sub_sq
(a b : ℕ)
(h₀: b < a) :
((a - b) ^ 2 = a ^ 2 + b ^ 2 - 2 * a * b) := by
have h₁: b^2 ≤ a * b := by
rw [pow_two]
refine Nat.mul_le_mul_right _ ?_
exact Nat.le_of_lt h₀
have h₂: a * b ≤ a ^ 2 := by
rw [pow_two]
refine Nat.mul_le_mul_left _ ?_
exact Nat.le_of_lt h₀
repeat rw [pow_two]
repeat rw [Nat.mul_sub_left_distrib]
repeat rw [Nat.mul_sub_right_distrib a b a]
rw [Nat.sub_right_comm]
repeat rw [Nat.mul_sub_right_distrib a b b]
ring_nf
omega
lemma mylemma_k_le_m_alt
(a b c d k m : ℕ)
(h₂ : a < b ∧ b < c ∧ c < d)
(h₃ : a * d = b * c)
(h₄ : a + d = 2 ^ k)
(h₅ : b + c = 2 ^ m)
(hkm : k ≤ m) :
False := by
have h₆: (a + d) ^ 2 ≤ (b + c) ^ 2 := by
refine Nat.pow_le_pow_left ?_ 2
rw [h₄,h₅]
exact pow_le_pow_right₀ (by norm_num) hkm
rw [add_sq, add_sq, mul_assoc, h₃, mul_assoc] at h₆
have h₇: (d - a) ^ 2 ≤ (c - b) ^ 2 := by
have hda: a < d := by
refine lt_trans h₂.1 ?_
exact lt_trans h₂.2.1 h₂.2.2
rw [mylemma_sub_sq d a hda]
rw [mylemma_sub_sq c b h₂.2.1]
rw [mul_assoc, mul_assoc]
rw [mul_comm d a, mul_comm c b]
rw [h₃]
refine Nat.sub_le_sub_right ?_ (2 * (b * c))
linarith
have h₈: (c - b) ^ 2 < (d - a) ^ 2 := by
refine Nat.pow_lt_pow_left ?_ (by norm_num)
have h₈₀: c - a < d - a := by
have g₀: c - a + a < d - a + a := by
rw [Nat.sub_add_cancel ?_]
· rw [Nat.sub_add_cancel ?_]
· exact h₂.2.2
· linarith
· linarith
exact Nat.lt_of_add_lt_add_right g₀
refine lt_trans ?_ h₈₀
refine Nat.sub_lt_sub_left ?_ h₂.1
exact lt_trans h₂.1 h₂.2.1
omega
lemma mylemma_h8
(a b c d k m : ℕ)
(h₀ : 0 < a ∧ 0 < b ∧ 0 < c ∧ 0 < d)
(h₁ : Odd a ∧ Odd b ∧ Odd c ∧ Odd d)
(h₂ : a < b ∧ b < c ∧ c < d)
(h₅ : b + c = 2 ^ m)
(hkm : m < k)
(h₆ : b * 2 ^ m - a * 2 ^ k = (b - a) * (b + a))
(h₇ : 2 ^ m ∣ (b - a) * (b + a)) :
(b + a = 2 ^ (m - 1)) := by
have h₇₁: ∃ y z, y ∣ b - a ∧ z ∣ b + a ∧ y * z = 2 ^ m := by
exact Nat.dvd_mul.mp h₇
let ⟨p, q, hpd, hqd, hpq⟩ := h₇₁
have hm1: 1 ≤ m := by
by_contra! hc
interval_cases m
omega
have h₈₀: b - a < 2 ^ (m - 1) := by
have g₀: b < (b + c) / 2 := by
refine (Nat.lt_div_iff_mul_lt' ?_ b).mpr ?_
· refine even_iff_two_dvd.mp ?_
exact Odd.add_odd h₁.2.1 h₁.2.2.1
· omega
have g₁: (b + c) / 2 = 2 ^ (m-1) := by
rw [h₅]
rw [← Nat.pow_sub_mul_pow 2 hm1]
simp
rw [← g₁]
exact tsub_lt_of_lt g₀
have hp: p = 2 := by
have hp₀: 2 * b < 2 ^ m := by
rw [← h₅, two_mul]
exact Nat.add_lt_add_left h₂.2.1 b
have hp₁: b + a < 2 ^ (m) := by
have g₀: b + a < b + b := by
exact Nat.add_lt_add_left h₂.1 b
refine Nat.lt_trans g₀ ?_
rw [← two_mul]
exact hp₀
have hp₂: q < 2 ^ m := by
refine Nat.lt_of_le_of_lt (Nat.le_of_dvd ?_ hqd) hp₁
exact Nat.add_pos_right b h₀.1
have hp₃: 1 < p := by
rw [← hpq] at hp₂
exact one_lt_of_lt_mul_left hp₂
have h2prime: Nat.Prime 2 := Nat.prime_two
have hp₅: ∀ i j:ℕ , 2 ^ i ∣ (b - a) ∧ 2 ^ j ∣ (b + a) → (i < 2 ∨ j < 2) := by
by_contra! hc
let ⟨i, j, hi⟩ := hc
have hti: 2 ^ 2 ∣ 2 ^ i := by exact Nat.pow_dvd_pow 2 hi.2.1
have htj: 2 ^ 2 ∣ 2 ^ j := by exact Nat.pow_dvd_pow 2 hi.2.2
norm_num at hti htj
have hi₄: 4 ∣ b - a := by exact Nat.dvd_trans hti hi.1.1
have hi₅: 4 ∣ b + a := by exact Nat.dvd_trans htj hi.1.2
have hi₆: 4 ∣ (b - a) + (b + a) := by exact Nat.dvd_add hi₄ hi₅
have hi₇: 2 ∣ b := by
have g₀: 0 < 2 := by norm_num
refine Nat.dvd_of_mul_dvd_mul_left g₀ ?_
rw [← Nat.add_sub_cancel (2 * b) a, Nat.two_mul b]
rw [add_assoc, Nat.sub_add_comm (le_of_lt h₂.1)]
exact hi₆
have hi₈: Even b := by
exact even_iff_two_dvd.mpr hi₇
apply Nat.not_odd_iff_even.mpr hi₈
exact h₁.2.1
have hp₆: ∀ i j:ℕ , i + j = m ∧ 2 ^ i ∣ (b - a) ∧ 2 ^ j ∣ (b + a) → (¬ j < 2) := by
by_contra! hc
let ⟨i, j, hi⟩ := hc
have hi₀: m - 1 ≤ i := by
rw [← hi.1.1]
simp
exact Nat.le_pred_of_lt hi.2
have hi₁: 2 ^ (m - 1) ≤ 2 ^ i := by exact Nat.pow_le_pow_right (by norm_num) hi₀
have hi₂: 2 ^ i < 2 ^ (m - 1) := by
refine lt_of_le_of_lt ?_ h₈₀
refine Nat.le_of_dvd ?_ hi.1.2.1
exact Nat.sub_pos_of_lt h₂.1
linarith [hi₁, hi₂]
have hi₀: ∃ i ≤ m, p = 2 ^ i := by
have g₀: p ∣ 2 ^ m := Dvd.intro q hpq
exact (Nat.dvd_prime_pow h2prime).mp g₀
let ⟨i, him, hp⟩ := hi₀
let j:ℕ := m - i
have hj₀: j = m - i := by linarith
have hj₁: i + j = m := by
rw [add_comm, ← Nat.sub_add_cancel him]
have hq: q = 2 ^ j := by
rw [hp] at hpq
rw [hj₀, ← Nat.pow_div him (by norm_num)]
refine Nat.eq_div_of_mul_eq_right ?_ hpq
positivity
rw [hp] at hpd
rw [hq] at hqd
have hj₃: ¬ j < 2 := by
exact hp₆ i j {left:= hj₁ , right:= { left := hpd , right:= hqd} }
have hi₂: i < 2 := by
have g₀: i < 2 ∨ j < 2 := by
exact hp₅ i j { left := hpd , right:= hqd }
omega
have hi₃: 0 < i := by
rw [hp] at hp₃
refine Nat.zero_lt_of_ne_zero ?_
exact (Nat.one_lt_two_pow_iff).mp hp₃
have hi₄: i = 1 := by
interval_cases i
rfl
rw [hi₄] at hp
exact hp
have hq: q = 2 ^ (m - 1) := by
rw [hp, ← Nat.pow_sub_mul_pow 2 hm1, pow_one, mul_comm] at hpq
exact Nat.mul_right_cancel (by norm_num) hpq
rw [hq] at hqd
have h₈₂: ∃ c, (b + a) = c * 2 ^ (m - 1) := by
exact exists_eq_mul_left_of_dvd hqd
let ⟨f, hf⟩ := h₈₂
have hfeq1: f = 1 := by
have hf₀: f * 2 ^ (m - 1) < 2 * 2 ^ (m - 1) := by
rw [← hf, ← Nat.pow_succ', ← Nat.succ_sub hm1]
rw [Nat.succ_sub_one, ← h₅]
refine Nat.add_lt_add_left ?_ b
exact lt_trans h₂.1 h₂.2.1
have hf₁: f < 2 := by
exact Nat.lt_of_mul_lt_mul_right hf₀
interval_cases f
· omega
· rfl
rw [hfeq1, one_mul] at hf
exact hf
theorem imo_1984_p6
(a b c d k m : ℕ)
(h₀ : 0 < a ∧ 0 < b ∧ 0 < c ∧ 0 < d)
(h₁ : Odd a ∧ Odd b ∧ Odd c ∧ Odd d)
(h₂ : a < b ∧ b < c ∧ c < d)
(h₃ : a * d = b * c)
(h₄ : a + d = 2^k)
(h₅ : b + c = 2^m) :
a = 1 := by
by_cases hkm: k ≤ m
· exfalso
exact mylemma_k_le_m_alt a b c d k m h₂ h₃ h₄ h₅ hkm
· push_neg at hkm
have h₆: b * 2 ^ m - a * 2 ^ k = (b - a) * (b + a) := by
have h₆₀: c = 2 ^ m - b := by exact (tsub_eq_of_eq_add_rev (id h₅.symm)).symm
have h₆₁: d = 2 ^ k - a := by exact (tsub_eq_of_eq_add_rev (id h₄.symm)).symm
rw [h₆₀, h₆₁] at h₃
repeat rw [Nat.mul_sub_left_distrib, ← pow_two] at h₃
have h₆₂: b * 2 ^ m - a * 2 ^ k = b ^ 2 - a ^ 2 := by
symm at h₃
refine Nat.sub_eq_of_eq_add ?_
rw [add_comm, ← Nat.add_sub_assoc]
· rw [Nat.sub_add_comm]
· refine Nat.eq_add_of_sub_eq ?_ h₃
rw [pow_two]
refine le_of_lt ?_
refine mul_lt_mul' (by omega) ?_ (le_of_lt h₀.2.1) h₀.2.1
omega
· rw [pow_two]
refine le_of_lt ?_
refine mul_lt_mul' (by omega) ?_ (le_of_lt h₀.1) h₀.1
omega
· refine le_of_lt ?_
rw [pow_two, pow_two]
exact mul_lt_mul h₂.1 (le_of_lt h₂.1) h₀.1 (le_of_lt h₀.2.1)
rw [Nat.sq_sub_sq b a] at h₆₂
linarith
have h₇: 2 ^ m ∣ (b - a) * (b + a) := by
have h₇₀: k = (k - m) + m := by exact (Nat.sub_add_cancel (le_of_lt hkm)).symm
rw [h₇₀, pow_add] at h₆
have h₇₁: (b - a * 2 ^ (k - m)) * (2 ^ m) = (b - a) * (b + a) := by
rw [Nat.mul_sub_right_distrib]
rw [mul_assoc a _ _]
exact h₆
exact Dvd.intro_left (b - a * 2 ^ (k - m)) h₇₁
have h₈: b + a = 2 ^ (m - 1) := by
exact mylemma_h8 a b c d k m h₀ h₁ h₂ h₅ hkm h₆ h₇
have h₉: a = 2 ^ (2 * m - 2) / 2 ^ k := by
have ga: 1 ≤ a := Nat.succ_le_of_lt h₀.1
have gb: 3 ≤ b := by
by_contra! hc
interval_cases b
· omega
· omega
· have g₀: ¬ Odd 2 := by decide
exact g₀ h₁.2.1
have gm: 3 ≤ m := by
have gm₀: 2 ^ 2 ≤ 2 ^ (m - 1) := by
norm_num
rw [← h₈]
omega
have gm₁: 2 ≤ m - 1 := by
exact (Nat.pow_le_pow_iff_right (by norm_num)).mp gm₀
omega
have g₀: a < 2 ^ (m - 2) := by
have g₀₀: a + a < b + a := by simp [h₂.1]
rw [h₈, ← mul_two a] at g₀₀
have g₀₁: m - 1 = Nat.succ (m - 2) := by
rw [← Nat.succ_sub ?_]
· rw [Nat.succ_eq_add_one]
omega
· omega
rw [g₀₁, Nat.pow_succ 2 _] at g₀₀
exact Nat.lt_of_mul_lt_mul_right g₀₀
have h₉₀: b = 2 ^ (m - 1) - a := by
symm
exact Nat.sub_eq_of_eq_add h₈.symm
rw [h₈, h₉₀] at h₆
repeat rw [Nat.mul_sub_right_distrib] at h₆
repeat rw [← Nat.pow_add] at h₆
have hm1: 1 ≤ m := by omega
repeat rw [← Nat.sub_add_comm hm1] at h₆
repeat rw [← Nat.add_sub_assoc hm1] at h₆
ring_nf at h₆
rw [← Nat.sub_add_eq _ 1 1] at h₆
norm_num at h₆
rw [← Nat.sub_add_eq _ (a * 2 ^ (m - 1)) (a * 2 ^ (m - 1))] at h₆
rw [← two_mul (a * 2 ^ (m - 1))] at h₆
rw [mul_comm 2 _] at h₆
rw [mul_assoc a (2 ^ (m - 1)) 2] at h₆
rw [← Nat.pow_succ, Nat.succ_eq_add_one] at h₆
rw [Nat.sub_add_cancel hm1] at h₆
rw [← Nat.sub_add_eq ] at h₆
have h₉₁: 2 ^ (m * 2 - 1) = 2 ^ (m * 2 - 2) - a * 2 ^ m + (a * 2 ^ m + a * 2 ^ k) := by
refine Nat.eq_add_of_sub_eq ?_ h₆
by_contra! hc
have g₁: 2 ^ (m * 2 - 1) - (a * 2 ^ m + a * 2 ^ k) = 0 := by
exact Nat.sub_eq_zero_of_le (le_of_lt hc)
rw [g₁] at h₆
have g₂: 2 ^ (m * 2 - 2) ≤ a * 2 ^ m := by exact Nat.le_of_sub_eq_zero h₆.symm
have g₃: 2 ^ (m - 2) ≤ a := by
rw [mul_two, Nat.add_sub_assoc (by omega) m] at g₂
rw [Nat.pow_add, mul_comm] at g₂
refine Nat.le_of_mul_le_mul_right g₂ ?_
exact Nat.two_pow_pos m
linarith [g₀, g₃]
rw [← Nat.add_assoc] at h₉₁
have h₉₂: a * 2 ^ k = 2 * 2 ^ (2 * m - 2) - 2 ^ (2 * m - 2) := by
rw [Nat.sub_add_cancel ?_] at h₉₁
· rw [add_comm] at h₉₁
symm
rw [← Nat.pow_succ', Nat.succ_eq_add_one]
omega
· refine le_of_lt ?_
rw [mul_two, Nat.add_sub_assoc, Nat.pow_add, mul_comm (2 ^ m) _]
· refine (Nat.mul_lt_mul_right (by omega)).mpr g₀
omega
nth_rewrite 2 [← Nat.one_mul (2 ^ (2 * m - 2))] at h₉₂
rw [← Nat.mul_sub_right_distrib 2 1 (2 ^ (2 * m - 2))] at h₉₂
norm_num at h₉₂
refine Nat.eq_div_of_mul_eq_left ?_ h₉₂
exact Ne.symm (NeZero.ne' (2 ^ k))
by_cases hk2m: k ≤ 2 * m - 2
· rw [Nat.pow_div hk2m (by norm_num)] at h₉
rw [Nat.sub_right_comm (2*m) 2 k] at h₉
by_contra! hc
obtain hc₀ | hc₁ := lt_or_gt_of_ne hc
· interval_cases a
omega
· have hc₂: ¬ Odd a := by
refine (Nat.not_odd_iff_even).mpr ?_
have hc₃: 1 ≤ 2 * m - k - 2 := by
by_contra! hc₄
interval_cases (2 * m - k - 2)
rw [pow_zero] at h₉
exact hc h₉
have hc₄: 2 * m - k - 2 = Nat.succ (2 * m - k - 3) := by
rw [Nat.succ_eq_add_one]
exact Nat.eq_add_of_sub_eq hc₃ rfl
rw [h₉, hc₄, Nat.pow_succ']
exact even_two_mul (2 ^ (2 * m - k - 3))
exact hc₂ h₁.1
· push_neg at hk2m
exfalso
have ha: a = 0 := by
rw [h₉]
refine (Nat.div_eq_zero_iff).mpr ?_
right
exact Nat.pow_lt_pow_right (by norm_num) hk2m
omega
end Imo1984P6 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1984P6.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unsolved goals\na b : \u2115\nh\u2080 : b < a\nh\u2081 : b ^ 2 \u2264 a * b\nh\u2082 : a * b \u2264 a ^ 2\n\u22a2 a ^ 2 - (a * b - b ^ 2) - a * b = a ^ 2 + b ^ 2 - a * b * 2", "unknown tactic", "unsolved goals\na b c d k m : \u2115\nh\u2082 : a < b \u2227 b < c \u2227 c < d\nh\u2083 : a * d = b * c\nh\u2084 : a + d = 2 ^ k\nh\u2085 : b + c = 2 ^ m\nhkm : k \u2264 m\nh\u2086 : a ^ 2 + 2 * (b * c) + d ^ 2 \u2264 b ^ 2 + 2 * (b * c) + c ^ 2\nh\u2087 : (d - a) ^ 2 \u2264 (c - b) ^ 2\nh\u2088 : (c - b) ^ 2 < (d - a) ^ 2\n\u22a2 False", "unknown tactic", "unsolved goals\ncase \u00ab0\u00bb\na b c d k m : \u2115\nh\u2080 : 0 < a \u2227 0 < b \u2227 0 < c \u2227 0 < d\nh\u2081 : Odd a \u2227 Odd b \u2227 Odd c \u2227 Odd d\nh\u2082 : a < b \u2227 b < c \u2227 c < d\np q : \u2115\nhpd : p \u2223 b - a\nhqd : q \u2223 b + a\nh\u2085 : b + c = 2 ^ 0\nhkm : 0 < k\nh\u2086 : b * 2 ^ 0 - a * 2 ^ k = (b - a) * (b + a)\nh\u2087 : 2 ^ 0 \u2223 (b - a) * (b + a)\nh\u2087\u2081 : \u2203 y z, y \u2223 b - a \u2227 z \u2223 b + a \u2227 y * z = 2 ^ 0\nhpq : p * q = 2 ^ 0\nhc : 0 < 1\n\u22a2 False", "unsolved goals\na b c d k m : \u2115\nh\u2080 : 0 < a \u2227 0 < b \u2227 0 < c \u2227 0 < d\nh\u2081 : Odd a \u2227 Odd b \u2227 Odd c \u2227 Odd d\nh\u2082 : a < b \u2227 b < c \u2227 c < d\nh\u2085 : b + c = 2 ^ m\nhkm : m < k\nh\u2086 : b * 2 ^ m - a * 2 ^ k = (b - a) * (b + a)\nh\u2087 : 2 ^ m \u2223 (b - a) * (b + a)\nh\u2087\u2081 : \u2203 y z, y \u2223 b - a \u2227 z \u2223 b + a \u2227 y * z = 2 ^ m\np q : \u2115\nhpd : p \u2223 b - a\nhqd : q \u2223 b + a\nhpq : p * q = 2 ^ m\nhm1 : 1 \u2264 m\n\u22a2 b + a = 2 ^ (m - 1)", "unknown tactic", "unsolved goals\na b c d k m : \u2115\nh\u2080 : 0 < a \u2227 0 < b \u2227 0 < c \u2227 0 < d\nh\u2081 : Odd a \u2227 Odd b \u2227 Odd c \u2227 Odd d\nh\u2082 : a < b \u2227 b < c \u2227 c < d\nh\u2083 : b * 2 ^ m - b ^ 2 = a * 2 ^ k - a ^ 2\nh\u2084 : a + d = 2 ^ k\nh\u2085 : b + c = 2 ^ m\nhkm : m < k\nh\u2086\u2080 : c = 2 ^ m - b\nh\u2086\u2081 : d = 2 ^ k - a\n\u22a2 ?m.69464 \u2264 ?m.69465", "unsolved goals\na b c d k m : \u2115\nh\u2080 : 0 < a \u2227 0 < b \u2227 0 < c \u2227 0 < d\nh\u2081 : Odd a \u2227 Odd b \u2227 Odd c \u2227 Odd d\nh\u2082 : a < b \u2227 b < c \u2227 c < d\nh\u2083 : b * 2 ^ m - b ^ 2 = a * 2 ^ k - a ^ 2\nh\u2084 : a + d = 2 ^ k\nh\u2085 : b + c = 2 ^ m\nhkm : m < k\nh\u2086\u2080 : c = 2 ^ m - b\nh\u2086\u2081 : d = 2 ^ k - a\n\u22a2 a ^ 2 \u2264 a * 2 ^ k", "unsolved goals\ncase h\na b c d k m : \u2115\nh\u2080 : 0 < a \u2227 0 < b \u2227 0 < c \u2227 0 < d\nh\u2081 : Odd a \u2227 Odd b \u2227 Odd c \u2227 Odd d\nh\u2082 : a < b \u2227 b < c \u2227 c < d\nh\u2083 : b * 2 ^ m - b ^ 2 = a * 2 ^ k - a ^ 2\nh\u2084 : a + d = 2 ^ k\nh\u2085 : b + c = 2 ^ m\nhkm : m < k\nh\u2086\u2080 : c = 2 ^ m - b\nh\u2086\u2081 : d = 2 ^ k - a\n\u22a2 a ^ 2 \u2264 b ^ 2", "unsolved goals\na b c d k m : \u2115\nh\u2080 : 0 < a \u2227 0 < b \u2227 0 < c \u2227 0 < d\nh\u2081 : Odd a \u2227 Odd b \u2227 Odd c \u2227 Odd d\nh\u2082 : a < b \u2227 b < c \u2227 c < d\nh\u2083 : a * 2 ^ k - a ^ 2 = b * 2 ^ m - b ^ 2\nh\u2084 : a + d = 2 ^ k\nh\u2085 : b + c = 2 ^ m\nhkm : m < k\nh\u2086\u2080 : c = 2 ^ m - b\nh\u2086\u2081 : d = 2 ^ k - a\nh\u2086\u2082 : b * 2 ^ m - a * 2 ^ k = b ^ 2 - a ^ 2\n\u22a2 b * 2 ^ m - a * 2 ^ k = (b - a) * (b + a)", "unsolved goals\ncase neg\na b c d k m : \u2115\nh\u2080 : 0 < a \u2227 0 < b \u2227 0 < c \u2227 0 < d\nh\u2081 : Odd a \u2227 Odd b \u2227 Odd c \u2227 Odd d\nh\u2082 : a < b \u2227 b < c \u2227 c < d\nh\u2083 : a * d = b * c\nh\u2084 : a + d = 2 ^ k\nh\u2085 : b + c = 2 ^ m\nhkm : m < k\nh\u2086 : b * 2 ^ m - a * 2 ^ k = (b - a) * (b + a)\n\u22a2 a = 1"], "timeout_s": 600.0, "latency_s": 1.5153, "verified_at": "2026-03-26T18:16:56.651896+00:00"}} | false | true | false | 1.5153 |
compfiles_Imo1985P2 | compfiles | Copyright (c) 2025 Jeremy Tan. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Tan
-/
import Mathlib
/-!
# International Mathematical Olympiad 1985, Problem 2
Fix a natural number $n ≥ 3$ and define $N=\{1, 2, 3, \dots, n-1\}$.
Fix another natural number $j ∈ N$ coprime to $n$. Each number in
$N$ is now colored with one of two colors, say red or black, so that:
1. $i$ and $n-i$ always receive the same color, and
2. $i$ and $|j-i|$ receive the same color for all $i ∈ N, i ≠ j$.
Prove that all numbers in $N$ must receive the same color.
-/
namespace Imo1985P2
/-- The conditions on the problem's coloring `C`.
Although its domain is all of `ℕ`, we only care about its values in `Set.Ico 1 n`. -/
def Condition (n j : ℕ) (C : ℕ → Fin 2) : Prop :=
(∀ i ∈ Set.Ico 1 n, C i = C (n - i)) ∧
∀ i ∈ Set.Ico 1 n, i ≠ j → C i = C (j - i : ℤ).natAbs
/-
# Solution
Let $a \sim b$ denote that $a$ and $b$ have the same color.
Because $j$ is coprime to $n$, every number in $N$ is of the form $kj\bmod n$ for a unique
$1 ≤ k < n$, so it suffices to show that $kj\bmod n \sim (k-1)j\bmod n$ for $1 < k < n$.
In this range of $k$, $kj\bmod n ≠ j$, so
* if $kj\bmod n > j$, $kj\bmod n \sim kj\bmod n - j = (k-1)j\bmod n$ using rule 2;
* if $kj\bmod n < j$, $kj\bmod n \sim j - kj\bmod n \sim n - j + kj\bmod n = (k-1)j\bmod n$
using rule 2 then rule 1.
-/
/-- For `1 ≤ k < n`, `k * j % n` has the same color as `j`. -/
lemma C_mul_mod {n j : ℕ} (hn : 3 ≤ n) (hj : j ∈ Set.Ico 1 n) (cpj : Nat.Coprime n j)
{C : ℕ → Fin 2} (hC : Condition n j C) {k : ℕ} (hk : k ∈ Set.Ico 1 n) :
C (k * j % n) = C j := by
induction k, hk.1 using Nat.le_induction with
| base => rw [one_mul, Nat.mod_eq_of_lt hj.2]
| succ k hk₁ ih =>
have nej : (k + 1) * j % n ≠ j := by
by_contra! h; nth_rw 2 [← Nat.mod_eq_of_lt hj.2, ← one_mul j] at h
replace h : (k + 1) % n = 1 % n := Nat.ModEq.cancel_right_of_coprime cpj h
rw [Nat.mod_eq_of_lt hk.2, Nat.mod_eq_of_lt (by omega)] at h
omega
have b₁ : (k + 1) * j % n ∈ Set.Ico 1 n := by
refine ⟨?_, Nat.mod_lt _ (by omega)⟩
by_contra! h; rw [Nat.lt_one_iff, ← Nat.dvd_iff_mod_eq_zero] at h
have ek := Nat.eq_zero_of_dvd_of_lt (cpj.dvd_of_dvd_mul_right h) hk.2
omega
rw [← ih ⟨hk₁, Nat.lt_of_succ_lt hk.2⟩, hC.2 _ b₁ nej]
rcases nej.lt_or_gt with h | h
· rw [Int.natAbs_natCast_sub_natCast_of_ge h.le]
have b₂ : j - (k + 1) * j % n ∈ Set.Ico 1 n :=
⟨Nat.sub_pos_iff_lt.mpr h, (Nat.sub_le ..).trans_lt hj.2⟩
have q : n - (j - (k + 1) * j % n) = (k + 1) * j % n + (n - j) % n := by
rw [tsub_tsub_eq_add_tsub_of_le h.le, add_comm, Nat.add_sub_assoc hj.2.le,
Nat.mod_eq_of_lt (show n - j < n by omega)]
rw [hC.1 _ b₂, q, ← Nat.add_mod_of_add_mod_lt (by omega), ← Nat.add_sub_assoc hj.2.le, add_comm,
Nat.add_sub_assoc (Nat.le_mul_of_pos_left _ hk.1), ← tsub_one_mul,
Nat.add_mod_left, add_tsub_cancel_right]
· rw [Int.natAbs_natCast_sub_natCast_of_le h.le, Nat.mod_sub_of_le h.le]
rw [add_mul, one_mul, add_tsub_cancel_right]
theorem imo1985_p2 {n j : ℕ} (hn : 3 ≤ n) (hj : j ∈ Set.Ico 1 n)
(cpj : Nat.Coprime n j) {C : ℕ → Fin 2} (hC : Condition n j C)
{i : ℕ} (hi : i ∈ Set.Ico 1 n) :
C i = C j := by
obtain ⟨v, hv⟩ := Nat.exists_mul_mod_eq_one_of_coprime cpj.symm (by omega)
have hvi : i = (v * i % n) * j % n := by
rw [Nat.mod_mul_mod, ← mul_rotate, ← Nat.mod_mul_mod, hv.2, one_mul, Nat.mod_eq_of_lt hi.2]
have vib : v * i % n ∈ Set.Ico 1 n := by
refine ⟨(?_ : 0 < _), Nat.mod_lt _ (by omega)⟩
by_contra! h; rw [Nat.le_zero, ← Nat.dvd_iff_mod_eq_zero] at h
rw [mul_comm, ← Nat.mod_eq_of_lt (show 1 < n by omega)] at hv
have i0 := Nat.eq_zero_of_dvd_of_lt
((Nat.coprime_of_mul_modEq_one _ hv.2).symm.dvd_of_dvd_mul_left h) hi.2
subst i; simp at hi
rw [hvi, C_mul_mod hn hj cpj hC vib]
end Imo1985P2 | /- | /-
Copyright (c) 2025 Jeremy Tan. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Tan
-/
import Mathlib
/-!
# International Mathematical Olympiad 1985, Problem 2
Fix a natural number $n ≥ 3$ and define $N=\{1, 2, 3, \dots, n-1\}$.
Fix another natural number $j ∈ N$ coprime to $n$. Each number in
$N$ is now colored with one of two colors, say red or black, so that:
1. $i$ and $n-i$ always receive the same color, and
2. $i$ and $|j-i|$ receive the same color for all $i ∈ N, i ≠ j$.
Prove that all numbers in $N$ must receive the same color.
-/
namespace Imo1985P2
/-- The conditions on the problem's coloring `C`.
Although its domain is all of `ℕ`, we only care about its values in `Set.Ico 1 n`. -/
def Condition (n j : ℕ) (C : ℕ → Fin 2) : Prop :=
(∀ i ∈ Set.Ico 1 n, C i = C (n - i)) ∧
∀ i ∈ Set.Ico 1 n, i ≠ j → C i = C (j - i : ℤ).natAbs
/-
# Solution
Let $a \sim b$ denote that $a$ and $b$ have the same color.
Because $j$ is coprime to $n$, every number in $N$ is of the form $kj\bmod n$ for a unique
$1 ≤ k < n$, so it suffices to show that $kj\bmod n \sim (k-1)j\bmod n$ for $1 < k < n$.
In this range of $k$, $kj\bmod n ≠ j$, so
* if $kj\bmod n > j$, $kj\bmod n \sim kj\bmod n - j = (k-1)j\bmod n$ using rule 2;
* if $kj\bmod n < j$, $kj\bmod n \sim j - kj\bmod n \sim n - j + kj\bmod n = (k-1)j\bmod n$
using rule 2 then rule 1.
-/
/-- For `1 ≤ k < n`, `k * j % n` has the same color as `j`. -/
lemma C_mul_mod {n j : ℕ} (hn : 3 ≤ n) (hj : j ∈ Set.Ico 1 n) (cpj : Nat.Coprime n j)
{C : ℕ → Fin 2} (hC : Condition n j C) {k : ℕ} (hk : k ∈ Set.Ico 1 n) :
C (k * j % n) = C j := by
induction k, hk.1 using Nat.le_induction with
| base => rw [one_mul, Nat.mod_eq_of_lt hj.2]
| succ k hk₁ ih =>
have nej : (k + 1) * j % n ≠ j := by
by_contra! h; nth_rw 2 [← Nat.mod_eq_of_lt hj.2, ← one_mul j] at h
replace h : (k + 1) % n = 1 % n := Nat.ModEq.cancel_right_of_coprime cpj h
rw [Nat.mod_eq_of_lt hk.2, Nat.mod_eq_of_lt (by omega)] at h
omega
have b₁ : (k + 1) * j % n ∈ Set.Ico 1 n := by
refine ⟨?_, Nat.mod_lt _ (by omega)⟩
by_contra! h; rw [Nat.lt_one_iff, ← Nat.dvd_iff_mod_eq_zero] at h
have ek := Nat.eq_zero_of_dvd_of_lt (cpj.dvd_of_dvd_mul_right h) hk.2
omega
rw [← ih ⟨hk₁, Nat.lt_of_succ_lt hk.2⟩, hC.2 _ b₁ nej]
rcases nej.lt_or_gt with h | h
· rw [Int.natAbs_natCast_sub_natCast_of_ge h.le]
have b₂ : j - (k + 1) * j % n ∈ Set.Ico 1 n :=
⟨Nat.sub_pos_iff_lt.mpr h, (Nat.sub_le ..).trans_lt hj.2⟩
have q : n - (j - (k + 1) * j % n) = (k + 1) * j % n + (n - j) % n := by
rw [tsub_tsub_eq_add_tsub_of_le h.le, add_comm, Nat.add_sub_assoc hj.2.le,
Nat.mod_eq_of_lt (show n - j < n by omega)]
rw [hC.1 _ b₂, q, ← Nat.add_mod_of_add_mod_lt (by omega), ← Nat.add_sub_assoc hj.2.le, add_comm,
Nat.add_sub_assoc (Nat.le_mul_of_pos_left _ hk.1), ← tsub_one_mul,
Nat.add_mod_left, add_tsub_cancel_right]
· rw [Int.natAbs_natCast_sub_natCast_of_le h.le, Nat.mod_sub_of_le h.le]
rw [add_mul, one_mul, add_tsub_cancel_right]
theorem imo1985_p2 {n j : ℕ} (hn : 3 ≤ n) (hj : j ∈ Set.Ico 1 n)
(cpj : Nat.Coprime n j) {C : ℕ → Fin 2} (hC : Condition n j C)
{i : ℕ} (hi : i ∈ Set.Ico 1 n) :
C i = C j := by
obtain ⟨v, hv⟩ := Nat.exists_mul_mod_eq_one_of_coprime cpj.symm (by omega)
have hvi : i = (v * i % n) * j % n := by
rw [Nat.mod_mul_mod, ← mul_rotate, ← Nat.mod_mul_mod, hv.2, one_mul, Nat.mod_eq_of_lt hi.2]
have vib : v * i % n ∈ Set.Ico 1 n := by
refine ⟨(?_ : 0 < _), Nat.mod_lt _ (by omega)⟩
by_contra! h; rw [Nat.le_zero, ← Nat.dvd_iff_mod_eq_zero] at h
rw [mul_comm, ← Nat.mod_eq_of_lt (show 1 < n by omega)] at hv
have i0 := Nat.eq_zero_of_dvd_of_lt
((Nat.coprime_of_mul_modEq_one _ hv.2).symm.dvd_of_dvd_mul_left h) hi.2
subst i; simp at hi
rw [hvi, C_mul_mod hn hj cpj hC vib]
end Imo1985P2
| true | Copyright (c) 2025 Jeremy Tan. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Tan
-/
import Mathlib
/-!
# International Mathematical Olympiad 1985, Problem 2
Fix a natural number $n ≥ 3$ and define $N=\{1, 2, 3, \dots, n-1\}$.
Fix another natural number $j ∈ N$ coprime to $n$. Each number in
$N$ is now colored with one of two colors, say red or black, so that:
1. $i$ and $n-i$ always receive the same color, and
2. $i$ and $|j-i|$ receive the same color for all $i ∈ N, i ≠ j$.
Prove that all numbers in $N$ must receive the same color.
-/
namespace Imo1985P2
/-- The conditions on the problem's coloring `C`.
Although its domain is all of `ℕ`, we only care about its values in `Set.Ico 1 n`. -/
def Condition (n j : ℕ) (C : ℕ → Fin 2) : Prop :=
(∀ i ∈ Set.Ico 1 n, C i = C (n - i)) ∧
∀ i ∈ Set.Ico 1 n, i ≠ j → C i = C (j - i : ℤ).natAbs
/-
# Solution
Let $a \sim b$ denote that $a$ and $b$ have the same color.
Because $j$ is coprime to $n$, every number in $N$ is of the form $kj\bmod n$ for a unique
$1 ≤ k < n$, so it suffices to show that $kj\bmod n \sim (k-1)j\bmod n$ for $1 < k < n$.
In this range of $k$, $kj\bmod n ≠ j$, so
* if $kj\bmod n > j$, $kj\bmod n \sim kj\bmod n - j = (k-1)j\bmod n$ using rule 2;
* if $kj\bmod n < j$, $kj\bmod n \sim j - kj\bmod n \sim n - j + kj\bmod n = (k-1)j\bmod n$
using rule 2 then rule 1.
-/
/-- For `1 ≤ k < n`, `k * j % n` has the same color as `j`. -/
lemma C_mul_mod {n j : ℕ} (hn : 3 ≤ n) (hj : j ∈ Set.Ico 1 n) (cpj : Nat.Coprime n j)
{C : ℕ → Fin 2} (hC : Condition n j C) {k : ℕ} (hk : k ∈ Set.Ico 1 n) :
C (k * j % n) = C j := by
induction k, hk.1 using Nat.le_induction with
| base => rw [one_mul, Nat.mod_eq_of_lt hj.2]
| succ k hk₁ ih =>
have nej : (k + 1) * j % n ≠ j := by
by_contra! h; nth_rw 2 [← Nat.mod_eq_of_lt hj.2, ← one_mul j] at h
replace h : (k + 1) % n = 1 % n := Nat.ModEq.cancel_right_of_coprime cpj h
rw [Nat.mod_eq_of_lt hk.2, Nat.mod_eq_of_lt (by omega)] at h
omega
have b₁ : (k + 1) * j % n ∈ Set.Ico 1 n := by
refine ⟨?_, Nat.mod_lt _ (by omega)⟩
by_contra! h; rw [Nat.lt_one_iff, ← Nat.dvd_iff_mod_eq_zero] at h
have ek := Nat.eq_zero_of_dvd_of_lt (cpj.dvd_of_dvd_mul_right h) hk.2
omega
rw [← ih ⟨hk₁, Nat.lt_of_succ_lt hk.2⟩, hC.2 _ b₁ nej]
rcases nej.lt_or_gt with h | h
· rw [Int.natAbs_natCast_sub_natCast_of_ge h.le]
have b₂ : j - (k + 1) * j % n ∈ Set.Ico 1 n :=
⟨Nat.sub_pos_iff_lt.mpr h, (Nat.sub_le ..).trans_lt hj.2⟩
have q : n - (j - (k + 1) * j % n) = (k + 1) * j % n + (n - j) % n := by
rw [tsub_tsub_eq_add_tsub_of_le h.le, add_comm, Nat.add_sub_assoc hj.2.le,
Nat.mod_eq_of_lt (show n - j < n by omega)]
rw [hC.1 _ b₂, q, ← Nat.add_mod_of_add_mod_lt (by omega), ← Nat.add_sub_assoc hj.2.le, add_comm,
Nat.add_sub_assoc (Nat.le_mul_of_pos_left _ hk.1), ← tsub_one_mul,
Nat.add_mod_left, add_tsub_cancel_right]
· rw [Int.natAbs_natCast_sub_natCast_of_le h.le, Nat.mod_sub_of_le h.le]
rw [add_mul, one_mul, add_tsub_cancel_right]
theorem imo1985_p2 {n j : ℕ} (hn : 3 ≤ n) (hj : j ∈ Set.Ico 1 n)
(cpj : Nat.Coprime n j) {C : ℕ → Fin 2} (hC : Condition n j C)
{i : ℕ} (hi : i ∈ Set.Ico 1 n) :
C i = C j := by
obtain ⟨v, hv⟩ := Nat.exists_mul_mod_eq_one_of_coprime cpj.symm (by omega)
have hvi : i = (v * i % n) * j % n := by
rw [Nat.mod_mul_mod, ← mul_rotate, ← Nat.mod_mul_mod, hv.2, one_mul, Nat.mod_eq_of_lt hi.2]
have vib : v * i % n ∈ Set.Ico 1 n := by
refine ⟨(?_ : 0 < _), Nat.mod_lt _ (by omega)⟩
by_contra! h; rw [Nat.le_zero, ← Nat.dvd_iff_mod_eq_zero] at h
rw [mul_comm, ← Nat.mod_eq_of_lt (show 1 < n by omega)] at hv
have i0 := Nat.eq_zero_of_dvd_of_lt
((Nat.coprime_of_mul_modEq_one _ hv.2).symm.dvd_of_dvd_mul_left h) hi.2
subst i; simp at hi
rw [hvi, C_mul_mod hn hj cpj hC vib]
end Imo1985P2 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1985P2.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "tactic 'rewrite' failed, did not find instance of the pattern in the target expression\n (k + 1) % n\nn j : \u2115\nhn : 3 \u2264 n\nhj : j \u2208 Set.Ico 1 n\ncpj : n.Coprime j\nC : \u2115 \u2192 Fin 2\nhC : Condition n j C\nk\u271d k : \u2115\nhk\u2081 : 1 \u2264 k\nih : k \u2208 Set.Ico 1 n \u2192 C (k * j % n) = C j\nhk : k + 1 \u2208 Set.Ico 1 n\nh : (k + 1) % n = 1 % n\n\u22a2 False", "unsolved goals\ncase succ\nn j : \u2115\nhn : 3 \u2264 n\nhj : j \u2208 Set.Ico 1 n\ncpj : n.Coprime j\nC : \u2115 \u2192 Fin 2\nhC : Condition n j C\nk\u271d k : \u2115\nhk\u2081 : 1 \u2264 k\nih : k \u2208 Set.Ico 1 n \u2192 C (k * j % n) = C j\nhk : k + 1 \u2208 Set.Ico 1 n\nnej : (k + 1) * j % n \u2260 j\n\u22a2 C ((k + 1) * j % n) = C j", "unknown tactic", "unknown constant 'Nat.exists_mul_mod_eq_one_of_coprime'"], "timeout_s": 600.0, "latency_s": 0.102, "verified_at": "2026-03-26T18:16:56.754095+00:00"}} | false | true | false | 0.102 |
compfiles_Imo1985P4 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Benpigchu
-/
import Mathlib
/-!
# International Mathematical Olympiad 1985, Problem 4
Given a set M of 1985 distinct positive integers, none of which has a prime
divisor greater than 23, prove that M contains a subset of 4 elements
whose product is the 4th power of an integer.
-/
namespace Imo1985P4
universe u v w
lemma extended_pigeonhole {α : Type u} {β : Type v} [DecidableEq α] [DecidableEq β]
{s : Finset α} {f: α → β} {s' : Finset β} (hf : ∀ n ∈ s, f n ∈ s')
(n : ℕ) (hn : 2 * n + s'.card - 1 ≤ s.card)
: ∃ t : Finset (Finset α), t.card = n
∧ (∀ t' : Finset α, t' ∈ t → t' ⊆ s)
∧ (∀ t' : Finset α, t' ∈ t → t'.card = 2)
∧ ((t : Set (Finset α)).PairwiseDisjoint id)
∧ (∀ t' : Finset α, t' ∈ t → ∃ p : β, ∀ n : α, n ∈ t' → f n = p) := by
induction' n with n' hn'
· use ∅; simp
· have h'n' : 2 * n' + s'.card - 1 ≤ s.card := by omega
rcases hn' h'n' with ⟨tn', ⟨htn'₁, htn'₂, htn'₃, htn'₄, htn'₅⟩⟩
let s'' := s \ (Finset.disjiUnion tn' id htn'₄)
have hs'' : s''.card = s.card - 2 * n' := by
calc s''.card
= s.card - (Finset.disjiUnion tn' id htn'₄).card := by
apply Finset.card_sdiff_of_subset
intro x hx
simp at hx
rcases hx with ⟨t', ⟨ht'₁, ht'₂⟩⟩
exact (htn'₂ t' ht'₁) ht'₂
_ = s.card - ∑ x ∈ tn', x.card := by
rw [Finset.card_disjiUnion]
simp
_ = s.card - ∑ x ∈ tn', 2 := by rw [Finset.sum_congr rfl htn'₃]
_ = s.card - 2 * n' := by
rw [Finset.sum_const]
simp
omega
have hf' : Set.MapsTo f s'' s' := by
intro x hxs''
rw [Finset.mem_coe] at *
exact hf x (Finset.mem_sdiff.mp hxs'').left
have h's'' : s'.card < s''.card := by omega
rcases Finset.exists_ne_map_eq_of_card_lt_of_maps_to h's'' hf' with ⟨p, hp, q, hq, hpq₁, hpq₂⟩
use insert {p, q} tn'
have hpqs'' : {p, q} ⊆ s'' := Finset.insert_subset hp (Finset.singleton_subset_iff.mpr hq)
constructorm* _ ∧ _
· rw [← htn'₁]
apply Finset.card_insert_of_notMem
rw [Finset.subset_sdiff] at hpqs''
have h' := hpqs''.right
contrapose! h'
simp
intro htn'
use {p, q}
constructor
· exact h'
· simp
· intro t' ht'
rw [Finset.mem_insert] at ht'
rcases ht' with (ht'pq|ht'tn')
· rw [ht'pq]
exact subset_trans hpqs'' Finset.sdiff_subset
· exact htn'₂ t' ht'tn'
· intro t' ht'
rw [Finset.mem_insert] at ht'
rcases ht' with (ht'pq|ht'tn')
· rw [ht'pq]
exact Finset.card_pair hpq₁
· exact htn'₃ t' ht'tn'
· rw [Finset.coe_insert, Set.pairwiseDisjoint_insert]
constructor
· exact htn'₄
· intro j hj hpqj
simp only [id_eq, Finset.disjoint_iff_ne]
intro a ha b hb
have has'' := hpqs'' ha
rw [Finset.mem_sdiff] at has''
have hatn' := has''.right
contrapose! hatn'
rw [hatn']
simp
use j
exact ⟨hj, hb⟩
· intro t' ht'
rw [Finset.mem_insert] at ht'
rcases ht' with (ht'pq|ht'tn')
· use (f p)
intro m hm
rw [ht'pq, Finset.mem_insert, Finset.mem_singleton] at hm
omega
· exact htn'₅ t' ht'tn'
lemma double_pigeonhole {α : Type u} {β : Type v} {γ : Type w} [DecidableEq α] [DecidableEq β] [DecidableEq γ]
{s : Finset α} {f₁: α → β} {f₂: (Finset α) → γ} {s₁ : Finset β} {s₂ : Finset γ}
(hf₁ : ∀ n ∈ s, f₁ n ∈ s₁) (hf₂ : ∀ s' ⊆ s, f₂ s' ∈ s₂)
(hs: 2 * s₂.card + s₁.card + 1 ≤ s.card)
: ∃ t₁ t₂ : (Finset α), t₁.card = 2 ∧ t₂.card = 2
∧ t₁ ⊆ s ∧ t₂ ⊆ s ∧ Disjoint t₁ t₂
∧ (∃ p : β, ∀ n : α, n ∈ t₁ → f₁ n = p)
∧ (∃ p : β, ∀ n : α, n ∈ t₂ → f₁ n = p)
∧ (f₂ t₁ = f₂ t₂) := by
have h's : 2 * (s₂.card + 1) + s₁.card - 1 ≤ s.card := by omega
rcases extended_pigeonhole hf₁ (s₂.card + 1) h's with ⟨t, ⟨ht₁, ht₂, ht₃, ht₄, ht₅⟩⟩
have h't : s₂.card < t.card := by omega
have h'f₂ : Set.MapsTo f₂ t s₂ := by
intro x hxt
rw [Finset.mem_coe] at *
exact hf₂ x (ht₂ x hxt)
rcases Finset.exists_ne_map_eq_of_card_lt_of_maps_to h't h'f₂ with ⟨p, hp, q, hq, hpq₁, hpq₂⟩
use p, q
constructorm* _ ∧ _
· exact ht₃ p hp
· exact ht₃ q hq
· exact ht₂ p hp
· exact ht₂ q hq
· exact ht₄ hp hq hpq₁
· exact ht₅ p hp
· exact ht₅ q hq
· exact hpq₂
noncomputable def pow_of_kth_prime_mod_two (k : ℕ) (n : ℕ) : ℕ :=
(padicValNat (Nat.nth Nat.Prime k) n) % 2
def two_pow_k_finset (k : ℕ) := Finset.pi (Finset.range k) (fun _ ↦ Finset.range 2)
noncomputable def pow_of_first_k_prime_mod_two (k : ℕ) (n : ℕ) :=
fun (k' : ℕ) ↦ fun (_ : k' ∈ Finset.range k) ↦ pow_of_kth_prime_mod_two k' n
lemma pow_of_first_k_prime_mod_two_mem_two_pow_k_finset (k : ℕ) (n : ℕ) :
pow_of_first_k_prime_mod_two k n ∈ two_pow_k_finset k := by
rw [two_pow_k_finset, Finset.mem_pi]
intro a ha
simp [pow_of_first_k_prime_mod_two, pow_of_kth_prime_mod_two]
apply Nat.mod_lt
norm_num
lemma square_of_pow_of_pow_of_kth_prime_mod_two_eq {m n : ℕ}
(hm₀ : m ≠ 0) (hn₀ : n ≠ 0)
(hmn : ∀ k , pow_of_kth_prime_mod_two k m = pow_of_kth_prime_mod_two k n) :
∃ k, m * n = k ^ 2 := by
let k := ∏ p ∈ Finset.range (m * n + 1) with Nat.Prime p, p ^ ((padicValNat p m + padicValNat p n) / 2)
use k
have hmn₀ : m * n ≠ 0 := Nat.mul_ne_zero hm₀ hn₀
rw [← Nat.prod_pow_prime_padicValNat (m * n) hmn₀ (m * n + 1) (by omega:_)]
rw [← Finset.prod_pow]
apply Finset.prod_congr rfl
intro p hp
simp at hp
have hp' := hp.right
rw [← pow_mul]
congr
have : Fact (Nat.Prime p) := { out := hp' }
rw [padicValNat.mul hm₀ hn₀]
symm
apply Nat.div_mul_cancel
apply Nat.dvd_of_mod_eq_zero
have hmn':= hmn (Nat.primeCounting' p)
simp [pow_of_kth_prime_mod_two, Nat.primeCounting'] at hmn'
rw [Nat.nth_count hp'] at hmn'
omega
lemma padicValNat_eq_zero_of_divisors {k m k': ℕ} (hm₀ : m ≠ 0)
(hm : ∀ p, p.Prime ∧ p ∣ m → p ≤ Nat.nth Nat.Prime k) (hk' : k < k'):
padicValNat (Nat.nth Nat.Prime k') m = 0 := by
by_contra! hdiv
have : Fact (Nat.Prime (Nat.nth Nat.Prime k')) := Fact.mk (Nat.prime_nth_prime k')
rw [← dvd_iff_padicValNat_ne_zero hm₀] at hdiv
have hdiv' := hm (Nat.nth Nat.Prime k') ⟨Nat.prime_nth_prime k', hdiv⟩
rw [Nat.nth_le_nth Nat.infinite_setOf_prime] at hdiv'
omega
lemma square_of_pow_of_first_k_prime_mod_two_eq {k m n : ℕ}
(hm₀ : m ≠ 0) (hn₀ : n ≠ 0)
(hmn : pow_of_first_k_prime_mod_two (k + 1) m = pow_of_first_k_prime_mod_two (k + 1) n)
(hm : ∀ p, p.Prime ∧ p ∣ m → p ≤ Nat.nth Nat.Prime k)
(hn : ∀ p, p.Prime ∧ p ∣ n → p ≤ Nat.nth Nat.Prime k) :
∃ k, m * n = k ^ 2 := by
have hmn' : ∀ k' , pow_of_kth_prime_mod_two k' m = pow_of_kth_prime_mod_two k' n := by
intro k'
by_cases hk' : k' ≤ k
· rw [funext_iff] at hmn
have hmn'' := hmn k'
rw [funext_iff] at hmn''
have h'k' : k' ∈ Finset.range (k + 1) := by exact Finset.mem_range_succ_iff.mpr hk'
have hmn''' := hmn'' h'k'
simp only [pow_of_first_k_prime_mod_two] at hmn'''
exact hmn'''
· push_neg at hk'
simp only [pow_of_kth_prime_mod_two]
rw [padicValNat_eq_zero_of_divisors hm₀ hm hk']
rw [padicValNat_eq_zero_of_divisors hn₀ hn hk']
exact square_of_pow_of_pow_of_kth_prime_mod_two_eq hm₀ hn₀ hmn'
lemma prod_square_of_pow_of_first_k_prime_mod_two_eq {M : Finset ℕ} {k : ℕ}
(Mdivisors : ∀ m ∈ M, ∀ n, n.Prime ∧ n ∣ m → n ≤ Nat.nth Nat.Prime k)
(Mpos : ∀ m ∈ M, 0 < m) {s : Finset ℕ} (hs₁ : s.card = 2) (hs₂ : s ⊆ M)
(hs₃ : ∃ f, ∀ n ∈ s, pow_of_first_k_prime_mod_two (k+1) n = f) :
∃ k, s.prod id = k ^ 2 := by
rw [Finset.card_eq_two] at hs₁
rcases hs₁ with ⟨m, n, hmn₁, hmn₂⟩
rw [hmn₂, Finset.prod_insert (Finset.notMem_singleton.mpr hmn₁), Finset.prod_singleton, id_eq, id_eq]
have hm' : m ∈ M := by
apply hs₂
simp [hmn₂]
have hn' : n ∈ M := by
apply hs₂
simp [hmn₂]
have hm₀ : m ≠ 0 := Nat.ne_zero_iff_zero_lt.mpr (Mpos m hm')
have hn₀ : n ≠ 0 := Nat.ne_zero_iff_zero_lt.mpr (Mpos n hn')
have hmn : pow_of_first_k_prime_mod_two (k + 1) m = pow_of_first_k_prime_mod_two (k + 1) n := by
rcases hs₃ with ⟨f, hf⟩
rw [hf m (by simp [hmn₂]:_), hf n (by simp [hmn₂]:_)]
exact square_of_pow_of_first_k_prime_mod_two_eq
hm₀ hn₀ hmn (Mdivisors m hm') (Mdivisors n hn')
lemma sqrt_prod_subset_ne_zero {M s : Finset ℕ} {k : ℕ}
(Mpos : ∀ m ∈ M, 0 < m) (hs: s ⊆ M) (hk : s.prod id = k ^ 2) :
k ≠ 0 := by
contrapose! hk
rw [hk]
simp
rw [Finset.prod_eq_zero_iff]
push_neg
intro n hn
exact Nat.ne_zero_iff_zero_lt.mpr (Mpos n (hs hn))
lemma sqrt_divisors_subset {M s : Finset ℕ} {k k₁: ℕ}
(Mdivisors : ∀ m ∈ M, ∀ n, n.Prime ∧ n ∣ m → n ≤ Nat.nth Nat.Prime k)
(hs: s ⊆ M) (hk₁ : s.prod id = k₁ ^ 2) : ∀ p, p.Prime ∧ p ∣ k₁ → p ≤ Nat.nth Nat.Prime k := by
rintro p' ⟨hp', h'p'⟩
rw [← Prime.dvd_pow_iff_dvd (Nat.Prime.prime hp') (by norm_num:2 ≠ 0)] at h'p'
rw [← hk₁] at h'p'
apply Prime.exists_mem_finset_dvd (Nat.Prime.prime hp') at h'p'
rcases h'p' with ⟨n, hn, hn'⟩
exact Mdivisors n (hs hn) p' ⟨hp', hn'⟩
theorem generalized (M : Finset ℕ) (k : ℕ)
(Mcard : 3 * 2 ^ (k + 1) + 1 ≤ M.card) (Mpos : ∀ m ∈ M, 0 < m)
(Mdivisors : ∀ m ∈ M, ∀ n, n.Prime ∧ n ∣ m → n ≤ Nat.nth Nat.Prime k) :
∃ M' : Finset ℕ, M' ⊆ M ∧ M'.card = 4 ∧ ∃ k, M'.prod id = k^4 := by
let f₁ := fun (n : ℕ) ↦ pow_of_first_k_prime_mod_two (k+1) n
have hf₁ : ∀ n ∈ M, f₁ n ∈ two_pow_k_finset (k + 1) := by
intro m hm
simp [f₁]
apply pow_of_first_k_prime_mod_two_mem_two_pow_k_finset
let f₂ := fun (n : Finset ℕ) ↦ pow_of_first_k_prime_mod_two (k+1) (Nat.sqrt (∏ x ∈ n, x))
have hf₂ : ∀ n ⊆ M, f₂ n ∈ two_pow_k_finset (k + 1) := by
intro m hm
simp [f₂]
apply pow_of_first_k_prime_mod_two_mem_two_pow_k_finset
have hs : 2 * (two_pow_k_finset (k + 1)).card + (two_pow_k_finset (k + 1)).card + 1 ≤ M.card := by
rw [two_pow_k_finset, Finset.card_pi, Finset.card_range, Finset.prod_const, Finset.card_range]
omega
rcases double_pigeonhole hf₁ hf₂ hs with ⟨p, q, hp₁, hq₁, hp₂, hq₂, hpq₁, hp₃, hq₃, hpq₂⟩
use p ∪ q
constructorm* _ ∧ _
· exact Finset.union_subset hp₂ hq₂
· rw [← Finset.card_union_eq_card_add_card] at hpq₁
omega
· rw [Finset.prod_union hpq₁]
rcases prod_square_of_pow_of_first_k_prime_mod_two_eq Mdivisors Mpos hp₁ hp₂ hp₃ with ⟨k₁, hk₁⟩
rcases prod_square_of_pow_of_first_k_prime_mod_two_eq Mdivisors Mpos hq₁ hq₂ hq₃ with ⟨k₂, hk₂⟩
rw [hk₁, hk₂]
have h₀k₁ : k₁ ≠ 0 := sqrt_prod_subset_ne_zero Mpos hp₂ hk₁
have h₀k₂ : k₂ ≠ 0 := sqrt_prod_subset_ne_zero Mpos hq₂ hk₂
have hk₁k₂ : pow_of_first_k_prime_mod_two (k + 1) k₁ = pow_of_first_k_prime_mod_two (k + 1) k₂ := by
simp [f₂] at hpq₂
simp at hk₁ hk₂
rw [hk₁, hk₂, Nat.sqrt_eq' k₁, Nat.sqrt_eq' k₂] at hpq₂
exact hpq₂
have h'k₁ : ∀ p, p.Prime ∧ p ∣ k₁ → p ≤ Nat.nth Nat.Prime k :=
sqrt_divisors_subset Mdivisors hp₂ hk₁
have h'k₂ : ∀ p, p.Prime ∧ p ∣ k₂ → p ≤ Nat.nth Nat.Prime k :=
sqrt_divisors_subset Mdivisors hq₂ hk₂
rcases square_of_pow_of_first_k_prime_mod_two_eq h₀k₁ h₀k₂ hk₁k₂ h'k₁ h'k₂ with ⟨k, hk⟩
use k
rw [← mul_pow, hk, ← pow_mul]
theorem imo1985_p4 (M : Finset ℕ) (Mcard : M.card = 1985) (Mpos : ∀ m ∈ M, 0 < m)
(Mdivisors : ∀ m ∈ M, ∀ n, n ∈ m.primeFactors → n ≤ 23)
: ∃ M' : Finset ℕ, M' ⊆ M ∧ M'.card = 4 ∧ ∃ k, M'.prod id = k^4 := by
replace Mdivisors : ∀ m ∈ M, ∀ n, n.Prime ∧ n ∣ m → n ≤ 23 := fun m hm n ↦ by
rw [←Nat.mem_primeFactors_of_ne_zero (Mpos m hm).ne.symm]
grind
let k := 8
have h₁ : Nat.nth Nat.Prime k = 23 := by
have h' : Nat.count Nat.Prime 23 = k := by decide
rw [← h']
apply Nat.nth_count
decide
rw [← h₁] at Mdivisors
have h₂ : 3 * 2 ^ (k + 1) + 1 ≤ M.card := by norm_num [Mcard]
exact generalized M k h₂ Mpos Mdivisors
end Imo1985P4 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Benpigchu
-/
import Mathlib
/-!
# International Mathematical Olympiad 1985, Problem 4
Given a set M of 1985 distinct positive integers, none of which has a prime
divisor greater than 23, prove that M contains a subset of 4 elements
whose product is the 4th power of an integer.
-/
namespace Imo1985P4
universe u v w
lemma extended_pigeonhole {α : Type u} {β : Type v} [DecidableEq α] [DecidableEq β]
{s : Finset α} {f: α → β} {s' : Finset β} (hf : ∀ n ∈ s, f n ∈ s')
(n : ℕ) (hn : 2 * n + s'.card - 1 ≤ s.card)
: ∃ t : Finset (Finset α), t.card = n
∧ (∀ t' : Finset α, t' ∈ t → t' ⊆ s)
∧ (∀ t' : Finset α, t' ∈ t → t'.card = 2)
∧ ((t : Set (Finset α)).PairwiseDisjoint id)
∧ (∀ t' : Finset α, t' ∈ t → ∃ p : β, ∀ n : α, n ∈ t' → f n = p) := by
induction' n with n' hn'
· use ∅; simp
· have h'n' : 2 * n' + s'.card - 1 ≤ s.card := by omega
rcases hn' h'n' with ⟨tn', ⟨htn'₁, htn'₂, htn'₃, htn'₄, htn'₅⟩⟩
let s'' := s \ (Finset.disjiUnion tn' id htn'₄)
have hs'' : s''.card = s.card - 2 * n' := by
calc s''.card
= s.card - (Finset.disjiUnion tn' id htn'₄).card := by
apply Finset.card_sdiff_of_subset
intro x hx
simp at hx
rcases hx with ⟨t', ⟨ht'₁, ht'₂⟩⟩
exact (htn'₂ t' ht'₁) ht'₂
_ = s.card - ∑ x ∈ tn', x.card := by
rw [Finset.card_disjiUnion]
simp
_ = s.card - ∑ x ∈ tn', 2 := by rw [Finset.sum_congr rfl htn'₃]
_ = s.card - 2 * n' := by
rw [Finset.sum_const]
simp
omega
have hf' : Set.MapsTo f s'' s' := by
intro x hxs''
rw [Finset.mem_coe] at *
exact hf x (Finset.mem_sdiff.mp hxs'').left
have h's'' : s'.card < s''.card := by omega
rcases Finset.exists_ne_map_eq_of_card_lt_of_maps_to h's'' hf' with ⟨p, hp, q, hq, hpq₁, hpq₂⟩
use insert {p, q} tn'
have hpqs'' : {p, q} ⊆ s'' := Finset.insert_subset hp (Finset.singleton_subset_iff.mpr hq)
constructorm* _ ∧ _
· rw [← htn'₁]
apply Finset.card_insert_of_notMem
rw [Finset.subset_sdiff] at hpqs''
have h' := hpqs''.right
contrapose! h'
simp
intro htn'
use {p, q}
constructor
· exact h'
· simp
· intro t' ht'
rw [Finset.mem_insert] at ht'
rcases ht' with (ht'pq|ht'tn')
· rw [ht'pq]
exact subset_trans hpqs'' Finset.sdiff_subset
· exact htn'₂ t' ht'tn'
· intro t' ht'
rw [Finset.mem_insert] at ht'
rcases ht' with (ht'pq|ht'tn')
· rw [ht'pq]
exact Finset.card_pair hpq₁
· exact htn'₃ t' ht'tn'
· rw [Finset.coe_insert, Set.pairwiseDisjoint_insert]
constructor
· exact htn'₄
· intro j hj hpqj
simp only [id_eq, Finset.disjoint_iff_ne]
intro a ha b hb
have has'' := hpqs'' ha
rw [Finset.mem_sdiff] at has''
have hatn' := has''.right
contrapose! hatn'
rw [hatn']
simp
use j
exact ⟨hj, hb⟩
· intro t' ht'
rw [Finset.mem_insert] at ht'
rcases ht' with (ht'pq|ht'tn')
· use (f p)
intro m hm
rw [ht'pq, Finset.mem_insert, Finset.mem_singleton] at hm
omega
· exact htn'₅ t' ht'tn'
lemma double_pigeonhole {α : Type u} {β : Type v} {γ : Type w} [DecidableEq α] [DecidableEq β] [DecidableEq γ]
{s : Finset α} {f₁: α → β} {f₂: (Finset α) → γ} {s₁ : Finset β} {s₂ : Finset γ}
(hf₁ : ∀ n ∈ s, f₁ n ∈ s₁) (hf₂ : ∀ s' ⊆ s, f₂ s' ∈ s₂)
(hs: 2 * s₂.card + s₁.card + 1 ≤ s.card)
: ∃ t₁ t₂ : (Finset α), t₁.card = 2 ∧ t₂.card = 2
∧ t₁ ⊆ s ∧ t₂ ⊆ s ∧ Disjoint t₁ t₂
∧ (∃ p : β, ∀ n : α, n ∈ t₁ → f₁ n = p)
∧ (∃ p : β, ∀ n : α, n ∈ t₂ → f₁ n = p)
∧ (f₂ t₁ = f₂ t₂) := by
have h's : 2 * (s₂.card + 1) + s₁.card - 1 ≤ s.card := by omega
rcases extended_pigeonhole hf₁ (s₂.card + 1) h's with ⟨t, ⟨ht₁, ht₂, ht₃, ht₄, ht₅⟩⟩
have h't : s₂.card < t.card := by omega
have h'f₂ : Set.MapsTo f₂ t s₂ := by
intro x hxt
rw [Finset.mem_coe] at *
exact hf₂ x (ht₂ x hxt)
rcases Finset.exists_ne_map_eq_of_card_lt_of_maps_to h't h'f₂ with ⟨p, hp, q, hq, hpq₁, hpq₂⟩
use p, q
constructorm* _ ∧ _
· exact ht₃ p hp
· exact ht₃ q hq
· exact ht₂ p hp
· exact ht₂ q hq
· exact ht₄ hp hq hpq₁
· exact ht₅ p hp
· exact ht₅ q hq
· exact hpq₂
noncomputable def pow_of_kth_prime_mod_two (k : ℕ) (n : ℕ) : ℕ :=
(padicValNat (Nat.nth Nat.Prime k) n) % 2
def two_pow_k_finset (k : ℕ) := Finset.pi (Finset.range k) (fun _ ↦ Finset.range 2)
noncomputable def pow_of_first_k_prime_mod_two (k : ℕ) (n : ℕ) :=
fun (k' : ℕ) ↦ fun (_ : k' ∈ Finset.range k) ↦ pow_of_kth_prime_mod_two k' n
lemma pow_of_first_k_prime_mod_two_mem_two_pow_k_finset (k : ℕ) (n : ℕ) :
pow_of_first_k_prime_mod_two k n ∈ two_pow_k_finset k := by
rw [two_pow_k_finset, Finset.mem_pi]
intro a ha
simp [pow_of_first_k_prime_mod_two, pow_of_kth_prime_mod_two]
apply Nat.mod_lt
norm_num
lemma square_of_pow_of_pow_of_kth_prime_mod_two_eq {m n : ℕ}
(hm₀ : m ≠ 0) (hn₀ : n ≠ 0)
(hmn : ∀ k , pow_of_kth_prime_mod_two k m = pow_of_kth_prime_mod_two k n) :
∃ k, m * n = k ^ 2 := by
let k := ∏ p ∈ Finset.range (m * n + 1) with Nat.Prime p, p ^ ((padicValNat p m + padicValNat p n) / 2)
use k
have hmn₀ : m * n ≠ 0 := Nat.mul_ne_zero hm₀ hn₀
rw [← Nat.prod_pow_prime_padicValNat (m * n) hmn₀ (m * n + 1) (by omega:_)]
rw [← Finset.prod_pow]
apply Finset.prod_congr rfl
intro p hp
simp at hp
have hp' := hp.right
rw [← pow_mul]
congr
have : Fact (Nat.Prime p) := { out := hp' }
rw [padicValNat.mul hm₀ hn₀]
symm
apply Nat.div_mul_cancel
apply Nat.dvd_of_mod_eq_zero
have hmn':= hmn (Nat.primeCounting' p)
simp [pow_of_kth_prime_mod_two, Nat.primeCounting'] at hmn'
rw [Nat.nth_count hp'] at hmn'
omega
lemma padicValNat_eq_zero_of_divisors {k m k': ℕ} (hm₀ : m ≠ 0)
(hm : ∀ p, p.Prime ∧ p ∣ m → p ≤ Nat.nth Nat.Prime k) (hk' : k < k'):
padicValNat (Nat.nth Nat.Prime k') m = 0 := by
by_contra! hdiv
have : Fact (Nat.Prime (Nat.nth Nat.Prime k')) := Fact.mk (Nat.prime_nth_prime k')
rw [← dvd_iff_padicValNat_ne_zero hm₀] at hdiv
have hdiv' := hm (Nat.nth Nat.Prime k') ⟨Nat.prime_nth_prime k', hdiv⟩
rw [Nat.nth_le_nth Nat.infinite_setOf_prime] at hdiv'
omega
lemma square_of_pow_of_first_k_prime_mod_two_eq {k m n : ℕ}
(hm₀ : m ≠ 0) (hn₀ : n ≠ 0)
(hmn : pow_of_first_k_prime_mod_two (k + 1) m = pow_of_first_k_prime_mod_two (k + 1) n)
(hm : ∀ p, p.Prime ∧ p ∣ m → p ≤ Nat.nth Nat.Prime k)
(hn : ∀ p, p.Prime ∧ p ∣ n → p ≤ Nat.nth Nat.Prime k) :
∃ k, m * n = k ^ 2 := by
have hmn' : ∀ k' , pow_of_kth_prime_mod_two k' m = pow_of_kth_prime_mod_two k' n := by
intro k'
by_cases hk' : k' ≤ k
· rw [funext_iff] at hmn
have hmn'' := hmn k'
rw [funext_iff] at hmn''
have h'k' : k' ∈ Finset.range (k + 1) := by exact Finset.mem_range_succ_iff.mpr hk'
have hmn''' := hmn'' h'k'
simp only [pow_of_first_k_prime_mod_two] at hmn'''
exact hmn'''
· push_neg at hk'
simp only [pow_of_kth_prime_mod_two]
rw [padicValNat_eq_zero_of_divisors hm₀ hm hk']
rw [padicValNat_eq_zero_of_divisors hn₀ hn hk']
exact square_of_pow_of_pow_of_kth_prime_mod_two_eq hm₀ hn₀ hmn'
lemma prod_square_of_pow_of_first_k_prime_mod_two_eq {M : Finset ℕ} {k : ℕ}
(Mdivisors : ∀ m ∈ M, ∀ n, n.Prime ∧ n ∣ m → n ≤ Nat.nth Nat.Prime k)
(Mpos : ∀ m ∈ M, 0 < m) {s : Finset ℕ} (hs₁ : s.card = 2) (hs₂ : s ⊆ M)
(hs₃ : ∃ f, ∀ n ∈ s, pow_of_first_k_prime_mod_two (k+1) n = f) :
∃ k, s.prod id = k ^ 2 := by
rw [Finset.card_eq_two] at hs₁
rcases hs₁ with ⟨m, n, hmn₁, hmn₂⟩
rw [hmn₂, Finset.prod_insert (Finset.notMem_singleton.mpr hmn₁), Finset.prod_singleton, id_eq, id_eq]
have hm' : m ∈ M := by
apply hs₂
simp [hmn₂]
have hn' : n ∈ M := by
apply hs₂
simp [hmn₂]
have hm₀ : m ≠ 0 := Nat.ne_zero_iff_zero_lt.mpr (Mpos m hm')
have hn₀ : n ≠ 0 := Nat.ne_zero_iff_zero_lt.mpr (Mpos n hn')
have hmn : pow_of_first_k_prime_mod_two (k + 1) m = pow_of_first_k_prime_mod_two (k + 1) n := by
rcases hs₃ with ⟨f, hf⟩
rw [hf m (by simp [hmn₂]:_), hf n (by simp [hmn₂]:_)]
exact square_of_pow_of_first_k_prime_mod_two_eq
hm₀ hn₀ hmn (Mdivisors m hm') (Mdivisors n hn')
lemma sqrt_prod_subset_ne_zero {M s : Finset ℕ} {k : ℕ}
(Mpos : ∀ m ∈ M, 0 < m) (hs: s ⊆ M) (hk : s.prod id = k ^ 2) :
k ≠ 0 := by
contrapose! hk
rw [hk]
simp
rw [Finset.prod_eq_zero_iff]
push_neg
intro n hn
exact Nat.ne_zero_iff_zero_lt.mpr (Mpos n (hs hn))
lemma sqrt_divisors_subset {M s : Finset ℕ} {k k₁: ℕ}
(Mdivisors : ∀ m ∈ M, ∀ n, n.Prime ∧ n ∣ m → n ≤ Nat.nth Nat.Prime k)
(hs: s ⊆ M) (hk₁ : s.prod id = k₁ ^ 2) : ∀ p, p.Prime ∧ p ∣ k₁ → p ≤ Nat.nth Nat.Prime k := by
rintro p' ⟨hp', h'p'⟩
rw [← Prime.dvd_pow_iff_dvd (Nat.Prime.prime hp') (by norm_num:2 ≠ 0)] at h'p'
rw [← hk₁] at h'p'
apply Prime.exists_mem_finset_dvd (Nat.Prime.prime hp') at h'p'
rcases h'p' with ⟨n, hn, hn'⟩
exact Mdivisors n (hs hn) p' ⟨hp', hn'⟩
theorem generalized (M : Finset ℕ) (k : ℕ)
(Mcard : 3 * 2 ^ (k + 1) + 1 ≤ M.card) (Mpos : ∀ m ∈ M, 0 < m)
(Mdivisors : ∀ m ∈ M, ∀ n, n.Prime ∧ n ∣ m → n ≤ Nat.nth Nat.Prime k) :
∃ M' : Finset ℕ, M' ⊆ M ∧ M'.card = 4 ∧ ∃ k, M'.prod id = k^4 := by
let f₁ := fun (n : ℕ) ↦ pow_of_first_k_prime_mod_two (k+1) n
have hf₁ : ∀ n ∈ M, f₁ n ∈ two_pow_k_finset (k + 1) := by
intro m hm
simp [f₁]
apply pow_of_first_k_prime_mod_two_mem_two_pow_k_finset
let f₂ := fun (n : Finset ℕ) ↦ pow_of_first_k_prime_mod_two (k+1) (Nat.sqrt (∏ x ∈ n, x))
have hf₂ : ∀ n ⊆ M, f₂ n ∈ two_pow_k_finset (k + 1) := by
intro m hm
simp [f₂]
apply pow_of_first_k_prime_mod_two_mem_two_pow_k_finset
have hs : 2 * (two_pow_k_finset (k + 1)).card + (two_pow_k_finset (k + 1)).card + 1 ≤ M.card := by
rw [two_pow_k_finset, Finset.card_pi, Finset.card_range, Finset.prod_const, Finset.card_range]
omega
rcases double_pigeonhole hf₁ hf₂ hs with ⟨p, q, hp₁, hq₁, hp₂, hq₂, hpq₁, hp₃, hq₃, hpq₂⟩
use p ∪ q
constructorm* _ ∧ _
· exact Finset.union_subset hp₂ hq₂
· rw [← Finset.card_union_eq_card_add_card] at hpq₁
omega
· rw [Finset.prod_union hpq₁]
rcases prod_square_of_pow_of_first_k_prime_mod_two_eq Mdivisors Mpos hp₁ hp₂ hp₃ with ⟨k₁, hk₁⟩
rcases prod_square_of_pow_of_first_k_prime_mod_two_eq Mdivisors Mpos hq₁ hq₂ hq₃ with ⟨k₂, hk₂⟩
rw [hk₁, hk₂]
have h₀k₁ : k₁ ≠ 0 := sqrt_prod_subset_ne_zero Mpos hp₂ hk₁
have h₀k₂ : k₂ ≠ 0 := sqrt_prod_subset_ne_zero Mpos hq₂ hk₂
have hk₁k₂ : pow_of_first_k_prime_mod_two (k + 1) k₁ = pow_of_first_k_prime_mod_two (k + 1) k₂ := by
simp [f₂] at hpq₂
simp at hk₁ hk₂
rw [hk₁, hk₂, Nat.sqrt_eq' k₁, Nat.sqrt_eq' k₂] at hpq₂
exact hpq₂
have h'k₁ : ∀ p, p.Prime ∧ p ∣ k₁ → p ≤ Nat.nth Nat.Prime k :=
sqrt_divisors_subset Mdivisors hp₂ hk₁
have h'k₂ : ∀ p, p.Prime ∧ p ∣ k₂ → p ≤ Nat.nth Nat.Prime k :=
sqrt_divisors_subset Mdivisors hq₂ hk₂
rcases square_of_pow_of_first_k_prime_mod_two_eq h₀k₁ h₀k₂ hk₁k₂ h'k₁ h'k₂ with ⟨k, hk⟩
use k
rw [← mul_pow, hk, ← pow_mul]
theorem imo1985_p4 (M : Finset ℕ) (Mcard : M.card = 1985) (Mpos : ∀ m ∈ M, 0 < m)
(Mdivisors : ∀ m ∈ M, ∀ n, n ∈ m.primeFactors → n ≤ 23)
: ∃ M' : Finset ℕ, M' ⊆ M ∧ M'.card = 4 ∧ ∃ k, M'.prod id = k^4 := by
replace Mdivisors : ∀ m ∈ M, ∀ n, n.Prime ∧ n ∣ m → n ≤ 23 := fun m hm n ↦ by
rw [←Nat.mem_primeFactors_of_ne_zero (Mpos m hm).ne.symm]
grind
let k := 8
have h₁ : Nat.nth Nat.Prime k = 23 := by
have h' : Nat.count Nat.Prime 23 = k := by decide
rw [← h']
apply Nat.nth_count
decide
rw [← h₁] at Mdivisors
have h₂ : 3 * 2 ^ (k + 1) + 1 ≤ M.card := by norm_num [Mcard]
exact generalized M k h₂ Mpos Mdivisors
end Imo1985P4
| true | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Benpigchu
-/
import Mathlib
/-!
# International Mathematical Olympiad 1985, Problem 4
Given a set M of 1985 distinct positive integers, none of which has a prime
divisor greater than 23, prove that M contains a subset of 4 elements
whose product is the 4th power of an integer.
-/
namespace Imo1985P4
universe u v w
lemma extended_pigeonhole {α : Type u} {β : Type v} [DecidableEq α] [DecidableEq β]
{s : Finset α} {f: α → β} {s' : Finset β} (hf : ∀ n ∈ s, f n ∈ s')
(n : ℕ) (hn : 2 * n + s'.card - 1 ≤ s.card)
: ∃ t : Finset (Finset α), t.card = n
∧ (∀ t' : Finset α, t' ∈ t → t' ⊆ s)
∧ (∀ t' : Finset α, t' ∈ t → t'.card = 2)
∧ ((t : Set (Finset α)).PairwiseDisjoint id)
∧ (∀ t' : Finset α, t' ∈ t → ∃ p : β, ∀ n : α, n ∈ t' → f n = p) := by
induction' n with n' hn'
· use ∅; simp
· have h'n' : 2 * n' + s'.card - 1 ≤ s.card := by omega
rcases hn' h'n' with ⟨tn', ⟨htn'₁, htn'₂, htn'₃, htn'₄, htn'₅⟩⟩
let s'' := s \ (Finset.disjiUnion tn' id htn'₄)
have hs'' : s''.card = s.card - 2 * n' := by
calc s''.card
= s.card - (Finset.disjiUnion tn' id htn'₄).card := by
apply Finset.card_sdiff_of_subset
intro x hx
simp at hx
rcases hx with ⟨t', ⟨ht'₁, ht'₂⟩⟩
exact (htn'₂ t' ht'₁) ht'₂
_ = s.card - ∑ x ∈ tn', x.card := by
rw [Finset.card_disjiUnion]
simp
_ = s.card - ∑ x ∈ tn', 2 := by rw [Finset.sum_congr rfl htn'₃]
_ = s.card - 2 * n' := by
rw [Finset.sum_const]
simp
omega
have hf' : Set.MapsTo f s'' s' := by
intro x hxs''
rw [Finset.mem_coe] at *
exact hf x (Finset.mem_sdiff.mp hxs'').left
have h's'' : s'.card < s''.card := by omega
rcases Finset.exists_ne_map_eq_of_card_lt_of_maps_to h's'' hf' with ⟨p, hp, q, hq, hpq₁, hpq₂⟩
use insert {p, q} tn'
have hpqs'' : {p, q} ⊆ s'' := Finset.insert_subset hp (Finset.singleton_subset_iff.mpr hq)
constructorm* _ ∧ _
· rw [← htn'₁]
apply Finset.card_insert_of_notMem
rw [Finset.subset_sdiff] at hpqs''
have h' := hpqs''.right
contrapose! h'
simp
intro htn'
use {p, q}
constructor
· exact h'
· simp
· intro t' ht'
rw [Finset.mem_insert] at ht'
rcases ht' with (ht'pq|ht'tn')
· rw [ht'pq]
exact subset_trans hpqs'' Finset.sdiff_subset
· exact htn'₂ t' ht'tn'
· intro t' ht'
rw [Finset.mem_insert] at ht'
rcases ht' with (ht'pq|ht'tn')
· rw [ht'pq]
exact Finset.card_pair hpq₁
· exact htn'₃ t' ht'tn'
· rw [Finset.coe_insert, Set.pairwiseDisjoint_insert]
constructor
· exact htn'₄
· intro j hj hpqj
simp only [id_eq, Finset.disjoint_iff_ne]
intro a ha b hb
have has'' := hpqs'' ha
rw [Finset.mem_sdiff] at has''
have hatn' := has''.right
contrapose! hatn'
rw [hatn']
simp
use j
exact ⟨hj, hb⟩
· intro t' ht'
rw [Finset.mem_insert] at ht'
rcases ht' with (ht'pq|ht'tn')
· use (f p)
intro m hm
rw [ht'pq, Finset.mem_insert, Finset.mem_singleton] at hm
omega
· exact htn'₅ t' ht'tn'
lemma double_pigeonhole {α : Type u} {β : Type v} {γ : Type w} [DecidableEq α] [DecidableEq β] [DecidableEq γ]
{s : Finset α} {f₁: α → β} {f₂: (Finset α) → γ} {s₁ : Finset β} {s₂ : Finset γ}
(hf₁ : ∀ n ∈ s, f₁ n ∈ s₁) (hf₂ : ∀ s' ⊆ s, f₂ s' ∈ s₂)
(hs: 2 * s₂.card + s₁.card + 1 ≤ s.card)
: ∃ t₁ t₂ : (Finset α), t₁.card = 2 ∧ t₂.card = 2
∧ t₁ ⊆ s ∧ t₂ ⊆ s ∧ Disjoint t₁ t₂
∧ (∃ p : β, ∀ n : α, n ∈ t₁ → f₁ n = p)
∧ (∃ p : β, ∀ n : α, n ∈ t₂ → f₁ n = p)
∧ (f₂ t₁ = f₂ t₂) := by
have h's : 2 * (s₂.card + 1) + s₁.card - 1 ≤ s.card := by omega
rcases extended_pigeonhole hf₁ (s₂.card + 1) h's with ⟨t, ⟨ht₁, ht₂, ht₃, ht₄, ht₅⟩⟩
have h't : s₂.card < t.card := by omega
have h'f₂ : Set.MapsTo f₂ t s₂ := by
intro x hxt
rw [Finset.mem_coe] at *
exact hf₂ x (ht₂ x hxt)
rcases Finset.exists_ne_map_eq_of_card_lt_of_maps_to h't h'f₂ with ⟨p, hp, q, hq, hpq₁, hpq₂⟩
use p, q
constructorm* _ ∧ _
· exact ht₃ p hp
· exact ht₃ q hq
· exact ht₂ p hp
· exact ht₂ q hq
· exact ht₄ hp hq hpq₁
· exact ht₅ p hp
· exact ht₅ q hq
· exact hpq₂
noncomputable def pow_of_kth_prime_mod_two (k : ℕ) (n : ℕ) : ℕ :=
(padicValNat (Nat.nth Nat.Prime k) n) % 2
def two_pow_k_finset (k : ℕ) := Finset.pi (Finset.range k) (fun _ ↦ Finset.range 2)
noncomputable def pow_of_first_k_prime_mod_two (k : ℕ) (n : ℕ) :=
fun (k' : ℕ) ↦ fun (_ : k' ∈ Finset.range k) ↦ pow_of_kth_prime_mod_two k' n
lemma pow_of_first_k_prime_mod_two_mem_two_pow_k_finset (k : ℕ) (n : ℕ) :
pow_of_first_k_prime_mod_two k n ∈ two_pow_k_finset k := by
rw [two_pow_k_finset, Finset.mem_pi]
intro a ha
simp [pow_of_first_k_prime_mod_two, pow_of_kth_prime_mod_two]
apply Nat.mod_lt
norm_num
lemma square_of_pow_of_pow_of_kth_prime_mod_two_eq {m n : ℕ}
(hm₀ : m ≠ 0) (hn₀ : n ≠ 0)
(hmn : ∀ k , pow_of_kth_prime_mod_two k m = pow_of_kth_prime_mod_two k n) :
∃ k, m * n = k ^ 2 := by
let k := ∏ p ∈ Finset.range (m * n + 1) with Nat.Prime p, p ^ ((padicValNat p m + padicValNat p n) / 2)
use k
have hmn₀ : m * n ≠ 0 := Nat.mul_ne_zero hm₀ hn₀
rw [← Nat.prod_pow_prime_padicValNat (m * n) hmn₀ (m * n + 1) (by omega:_)]
rw [← Finset.prod_pow]
apply Finset.prod_congr rfl
intro p hp
simp at hp
have hp' := hp.right
rw [← pow_mul]
congr
have : Fact (Nat.Prime p) := { out := hp' }
rw [padicValNat.mul hm₀ hn₀]
symm
apply Nat.div_mul_cancel
apply Nat.dvd_of_mod_eq_zero
have hmn':= hmn (Nat.primeCounting' p)
simp [pow_of_kth_prime_mod_two, Nat.primeCounting'] at hmn'
rw [Nat.nth_count hp'] at hmn'
omega
lemma padicValNat_eq_zero_of_divisors {k m k': ℕ} (hm₀ : m ≠ 0)
(hm : ∀ p, p.Prime ∧ p ∣ m → p ≤ Nat.nth Nat.Prime k) (hk' : k < k'):
padicValNat (Nat.nth Nat.Prime k') m = 0 := by
by_contra! hdiv
have : Fact (Nat.Prime (Nat.nth Nat.Prime k')) := Fact.mk (Nat.prime_nth_prime k')
rw [← dvd_iff_padicValNat_ne_zero hm₀] at hdiv
have hdiv' := hm (Nat.nth Nat.Prime k') ⟨Nat.prime_nth_prime k', hdiv⟩
rw [Nat.nth_le_nth Nat.infinite_setOf_prime] at hdiv'
omega
lemma square_of_pow_of_first_k_prime_mod_two_eq {k m n : ℕ}
(hm₀ : m ≠ 0) (hn₀ : n ≠ 0)
(hmn : pow_of_first_k_prime_mod_two (k + 1) m = pow_of_first_k_prime_mod_two (k + 1) n)
(hm : ∀ p, p.Prime ∧ p ∣ m → p ≤ Nat.nth Nat.Prime k)
(hn : ∀ p, p.Prime ∧ p ∣ n → p ≤ Nat.nth Nat.Prime k) :
∃ k, m * n = k ^ 2 := by
have hmn' : ∀ k' , pow_of_kth_prime_mod_two k' m = pow_of_kth_prime_mod_two k' n := by
intro k'
by_cases hk' : k' ≤ k
· rw [funext_iff] at hmn
have hmn'' := hmn k'
rw [funext_iff] at hmn''
have h'k' : k' ∈ Finset.range (k + 1) := by exact Finset.mem_range_succ_iff.mpr hk'
have hmn''' := hmn'' h'k'
simp only [pow_of_first_k_prime_mod_two] at hmn'''
exact hmn'''
· push_neg at hk'
simp only [pow_of_kth_prime_mod_two]
rw [padicValNat_eq_zero_of_divisors hm₀ hm hk']
rw [padicValNat_eq_zero_of_divisors hn₀ hn hk']
exact square_of_pow_of_pow_of_kth_prime_mod_two_eq hm₀ hn₀ hmn'
lemma prod_square_of_pow_of_first_k_prime_mod_two_eq {M : Finset ℕ} {k : ℕ}
(Mdivisors : ∀ m ∈ M, ∀ n, n.Prime ∧ n ∣ m → n ≤ Nat.nth Nat.Prime k)
(Mpos : ∀ m ∈ M, 0 < m) {s : Finset ℕ} (hs₁ : s.card = 2) (hs₂ : s ⊆ M)
(hs₃ : ∃ f, ∀ n ∈ s, pow_of_first_k_prime_mod_two (k+1) n = f) :
∃ k, s.prod id = k ^ 2 := by
rw [Finset.card_eq_two] at hs₁
rcases hs₁ with ⟨m, n, hmn₁, hmn₂⟩
rw [hmn₂, Finset.prod_insert (Finset.notMem_singleton.mpr hmn₁), Finset.prod_singleton, id_eq, id_eq]
have hm' : m ∈ M := by
apply hs₂
simp [hmn₂]
have hn' : n ∈ M := by
apply hs₂
simp [hmn₂]
have hm₀ : m ≠ 0 := Nat.ne_zero_iff_zero_lt.mpr (Mpos m hm')
have hn₀ : n ≠ 0 := Nat.ne_zero_iff_zero_lt.mpr (Mpos n hn')
have hmn : pow_of_first_k_prime_mod_two (k + 1) m = pow_of_first_k_prime_mod_two (k + 1) n := by
rcases hs₃ with ⟨f, hf⟩
rw [hf m (by simp [hmn₂]:_), hf n (by simp [hmn₂]:_)]
exact square_of_pow_of_first_k_prime_mod_two_eq
hm₀ hn₀ hmn (Mdivisors m hm') (Mdivisors n hn')
lemma sqrt_prod_subset_ne_zero {M s : Finset ℕ} {k : ℕ}
(Mpos : ∀ m ∈ M, 0 < m) (hs: s ⊆ M) (hk : s.prod id = k ^ 2) :
k ≠ 0 := by
contrapose! hk
rw [hk]
simp
rw [Finset.prod_eq_zero_iff]
push_neg
intro n hn
exact Nat.ne_zero_iff_zero_lt.mpr (Mpos n (hs hn))
lemma sqrt_divisors_subset {M s : Finset ℕ} {k k₁: ℕ}
(Mdivisors : ∀ m ∈ M, ∀ n, n.Prime ∧ n ∣ m → n ≤ Nat.nth Nat.Prime k)
(hs: s ⊆ M) (hk₁ : s.prod id = k₁ ^ 2) : ∀ p, p.Prime ∧ p ∣ k₁ → p ≤ Nat.nth Nat.Prime k := by
rintro p' ⟨hp', h'p'⟩
rw [← Prime.dvd_pow_iff_dvd (Nat.Prime.prime hp') (by norm_num:2 ≠ 0)] at h'p'
rw [← hk₁] at h'p'
apply Prime.exists_mem_finset_dvd (Nat.Prime.prime hp') at h'p'
rcases h'p' with ⟨n, hn, hn'⟩
exact Mdivisors n (hs hn) p' ⟨hp', hn'⟩
theorem generalized (M : Finset ℕ) (k : ℕ)
(Mcard : 3 * 2 ^ (k + 1) + 1 ≤ M.card) (Mpos : ∀ m ∈ M, 0 < m)
(Mdivisors : ∀ m ∈ M, ∀ n, n.Prime ∧ n ∣ m → n ≤ Nat.nth Nat.Prime k) :
∃ M' : Finset ℕ, M' ⊆ M ∧ M'.card = 4 ∧ ∃ k, M'.prod id = k^4 := by
let f₁ := fun (n : ℕ) ↦ pow_of_first_k_prime_mod_two (k+1) n
have hf₁ : ∀ n ∈ M, f₁ n ∈ two_pow_k_finset (k + 1) := by
intro m hm
simp [f₁]
apply pow_of_first_k_prime_mod_two_mem_two_pow_k_finset
let f₂ := fun (n : Finset ℕ) ↦ pow_of_first_k_prime_mod_two (k+1) (Nat.sqrt (∏ x ∈ n, x))
have hf₂ : ∀ n ⊆ M, f₂ n ∈ two_pow_k_finset (k + 1) := by
intro m hm
simp [f₂]
apply pow_of_first_k_prime_mod_two_mem_two_pow_k_finset
have hs : 2 * (two_pow_k_finset (k + 1)).card + (two_pow_k_finset (k + 1)).card + 1 ≤ M.card := by
rw [two_pow_k_finset, Finset.card_pi, Finset.card_range, Finset.prod_const, Finset.card_range]
omega
rcases double_pigeonhole hf₁ hf₂ hs with ⟨p, q, hp₁, hq₁, hp₂, hq₂, hpq₁, hp₃, hq₃, hpq₂⟩
use p ∪ q
constructorm* _ ∧ _
· exact Finset.union_subset hp₂ hq₂
· rw [← Finset.card_union_eq_card_add_card] at hpq₁
omega
· rw [Finset.prod_union hpq₁]
rcases prod_square_of_pow_of_first_k_prime_mod_two_eq Mdivisors Mpos hp₁ hp₂ hp₃ with ⟨k₁, hk₁⟩
rcases prod_square_of_pow_of_first_k_prime_mod_two_eq Mdivisors Mpos hq₁ hq₂ hq₃ with ⟨k₂, hk₂⟩
rw [hk₁, hk₂]
have h₀k₁ : k₁ ≠ 0 := sqrt_prod_subset_ne_zero Mpos hp₂ hk₁
have h₀k₂ : k₂ ≠ 0 := sqrt_prod_subset_ne_zero Mpos hq₂ hk₂
have hk₁k₂ : pow_of_first_k_prime_mod_two (k + 1) k₁ = pow_of_first_k_prime_mod_two (k + 1) k₂ := by
simp [f₂] at hpq₂
simp at hk₁ hk₂
rw [hk₁, hk₂, Nat.sqrt_eq' k₁, Nat.sqrt_eq' k₂] at hpq₂
exact hpq₂
have h'k₁ : ∀ p, p.Prime ∧ p ∣ k₁ → p ≤ Nat.nth Nat.Prime k :=
sqrt_divisors_subset Mdivisors hp₂ hk₁
have h'k₂ : ∀ p, p.Prime ∧ p ∣ k₂ → p ≤ Nat.nth Nat.Prime k :=
sqrt_divisors_subset Mdivisors hq₂ hk₂
rcases square_of_pow_of_first_k_prime_mod_two_eq h₀k₁ h₀k₂ hk₁k₂ h'k₁ h'k₂ with ⟨k, hk⟩
use k
rw [← mul_pow, hk, ← pow_mul]
theorem imo1985_p4 (M : Finset ℕ) (Mcard : M.card = 1985) (Mpos : ∀ m ∈ M, 0 < m)
(Mdivisors : ∀ m ∈ M, ∀ n, n ∈ m.primeFactors → n ≤ 23)
: ∃ M' : Finset ℕ, M' ⊆ M ∧ M'.card = 4 ∧ ∃ k, M'.prod id = k^4 := by
replace Mdivisors : ∀ m ∈ M, ∀ n, n.Prime ∧ n ∣ m → n ≤ 23 := fun m hm n ↦ by
rw [←Nat.mem_primeFactors_of_ne_zero (Mpos m hm).ne.symm]
grind
let k := 8
have h₁ : Nat.nth Nat.Prime k = 23 := by
have h' : Nat.count Nat.Prime 23 = k := by decide
rw [← h']
apply Nat.nth_count
decide
rw [← h₁] at Mdivisors
have h₂ : 3 * 2 ^ (k + 1) + 1 ≤ M.card := by norm_num [Mcard]
exact generalized M k h₂ Mpos Mdivisors
end Imo1985P4 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1985P4.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unsolved goals\n\u03b1 : Type u\n\u03b2 : Type v\ninst\u271d\u00b9 : DecidableEq \u03b1\ninst\u271d : DecidableEq \u03b2\ns : Finset \u03b1\nf : \u03b1 \u2192 \u03b2\ns' : Finset \u03b2\nhf : \u2200 n \u2208 s, f n \u2208 s'\nn' : \u2115\nhn' :\n 2 * n' + s'.card - 1 \u2264 s.card \u2192\n \u2203 t,\n t.card = n' \u2227\n (\u2200 t' \u2208 t, t' \u2286 s) \u2227 (\u2200 t' \u2208 t, t'.card = 2) \u2227 (\u2191t).PairwiseDisjoint id \u2227 \u2200 t' \u2208 t, \u2203 p, \u2200 n \u2208 t', f n = p\nhn : 2 * (n' + 1) + s'.card - 1 \u2264 s.card\n\u22a2 2 * n' + s'.card - 1 \u2264 s.card", "unsolved goals\ncase succ\n\u03b1 : Type u\n\u03b2 : Type v\ninst\u271d\u00b9 : DecidableEq \u03b1\ninst\u271d : DecidableEq \u03b2\ns : Finset \u03b1\nf : \u03b1 \u2192 \u03b2\ns' : Finset \u03b2\nhf : \u2200 n \u2208 s, f n \u2208 s'\nn' : \u2115\nhn' :\n 2 * n' + s'.card - 1 \u2264 s.card \u2192\n \u2203 t,\n t.card = n' \u2227\n (\u2200 t' \u2208 t, t' \u2286 s) \u2227 (\u2200 t' \u2208 t, t'.card = 2) \u2227 (\u2191t).PairwiseDisjoint id \u2227 \u2200 t' \u2208 t, \u2203 p, \u2200 n \u2208 t', f n = p\nhn : 2 * (n' + 1) + s'.card - 1 \u2264 s.card\nh'n' : 2 * n' + s'.card - 1 \u2264 s.card\n\u22a2 \u2203 t,\n t.card = n' + 1 \u2227\n (\u2200 t' \u2208 t, t' \u2286 s) \u2227 (\u2200 t' \u2208 t, t'.card = 2) \u2227 (\u2191t).PairwiseDisjoint id \u2227 \u2200 t' \u2208 t, \u2203 p, \u2200 n \u2208 t', f n = p", "unknown tactic", "unsolved goals\n\u03b1 : Type u\n\u03b2 : Type v\n\u03b3 : Type w\ninst\u271d\u00b2 : DecidableEq \u03b1\ninst\u271d\u00b9 : DecidableEq \u03b2\ninst\u271d : DecidableEq \u03b3\ns : Finset \u03b1\nf\u2081 : \u03b1 \u2192 \u03b2\nf\u2082 : Finset \u03b1 \u2192 \u03b3\ns\u2081 : Finset \u03b2\ns\u2082 : Finset \u03b3\nhf\u2081 : \u2200 n \u2208 s, f\u2081 n \u2208 s\u2081\nhf\u2082 : \u2200 s' \u2286 s, f\u2082 s' \u2208 s\u2082\nhs : 2 * s\u2082.card + s\u2081.card + 1 \u2264 s.card\n\u22a2 2 * (s\u2082.card + 1) + s\u2081.card - 1 \u2264 s.card", "unsolved goals\n\u03b1 : Type u\n\u03b2 : Type v\n\u03b3 : Type w\ninst\u271d\u00b2 : DecidableEq \u03b1\ninst\u271d\u00b9 : DecidableEq \u03b2\ninst\u271d : DecidableEq \u03b3\ns : Finset \u03b1\nf\u2081 : \u03b1 \u2192 \u03b2\nf\u2082 : Finset \u03b1 \u2192 \u03b3\ns\u2081 : Finset \u03b2\ns\u2082 : Finset \u03b3\nhf\u2081 : \u2200 n \u2208 s, f\u2081 n \u2208 s\u2081\nhf\u2082 : \u2200 s' \u2286 s, f\u2082 s' \u2208 s\u2082\nhs : 2 * s\u2082.card + s\u2081.card + 1 \u2264 s.card\nh's : 2 * (s\u2082.card + 1) + s\u2081.card - 1 \u2264 s.card\n\u22a2 \u2203 t\u2081 t\u2082,\n t\u2081.card = 2 \u2227\n t\u2082.card = 2 \u2227\n t\u2081 \u2286 s \u2227 t\u2082 \u2286 s \u2227 Disjoint t\u2081 t\u2082 \u2227 (\u2203 p, \u2200 n \u2208 t\u2081, f\u2081 n = p) \u2227 (\u2203 p, \u2200 n \u2208 t\u2082, f\u2081 n = p) \u2227 f\u2082 t\u2081 = f\u2082 t\u2082", "unknown tactic", "unsolved goals\nm n : \u2115\nhm\u2080 : m \u2260 0\nhn\u2080 : n \u2260 0\nhmn : \u2200 (k : \u2115), pow_of_kth_prime_mod_two k m = pow_of_kth_prime_mod_two k n\nk : \u2115 := \u220f p \u2208 Finset.range (m * n + 1)with Nat.Prime p, p ^ ((padicValNat p m + padicValNat p n) / 2)\nhmn\u2080 : m * n \u2260 0\n\u22a2 m * n < m * n + 1", "unsolved goals\ncase h\nm n : \u2115\nhm\u2080 : m \u2260 0\nhn\u2080 : n \u2260 0\nhmn : \u2200 (k : \u2115), pow_of_kth_prime_mod_two k m = pow_of_kth_prime_mod_two k n\nk : \u2115 := \u220f p \u2208 Finset.range (m * n + 1)with Nat.Prime p, p ^ ((padicValNat p m + padicValNat p n) / 2)\nhmn\u2080 : m * n \u2260 0\n\u22a2 \u220f p \u2208 Finset.range (m * n + 1)with Nat.Prime p, p ^ padicValNat p (m * n) = k ^ 2", "unknown tactic", "unsolved goals\nk m k' : \u2115\nhm\u2080 : m \u2260 0\nhm : \u2200 (p : \u2115), Nat.Prime p \u2227 p \u2223 m \u2192 p \u2264 Nat.nth Nat.Prime k\nhk' : k < k'\nhdiv : Nat.nth Nat.Prime k' \u2223 m\nthis : Fact (Nat.Prime (Nat.nth Nat.Prime k'))\nhdiv' : k' \u2264 k\n\u22a2 False", "unknown tactic", "unsolved goals\nM : Finset \u2115\nk : \u2115\nMcard : 3 * 2 ^ (k + 1) + 1 \u2264 M.card\nMpos : \u2200 m \u2208 M, 0 < m\nMdivisors : \u2200 m \u2208 M, \u2200 (n : \u2115), Nat.Prime n \u2227 n \u2223 m \u2192 n \u2264 Nat.nth Nat.Prime k\nf\u2081 : \u2115 \u2192 (k' : \u2115) \u2192 k' \u2208 Finset.range (k + 1) \u2192 \u2115 := fun n => pow_of_first_k_prime_mod_two (k + 1) n\nhf\u2081 : \u2200 n \u2208 M, f\u2081 n \u2208 two_pow_k_finset (k + 1)\nf\u2082 : Finset \u2115 \u2192 (k' : \u2115) \u2192 k' \u2208 Finset.range (k + 1) \u2192 \u2115 :=\n fun n => pow_of_first_k_prime_mod_two (k + 1) (\u220f x \u2208 n, x).sqrt\nhf\u2082 : \u2200 n \u2286 M, f\u2082 n \u2208 two_pow_k_finset (k + 1)\n\u22a2 2 * 2 ^ (k + 1) + 2 ^ (k + 1) + 1 \u2264 M.card", "unsolved goals\nM : Finset \u2115\nk : \u2115\nMcard : 3 * 2 ^ (k + 1) + 1 \u2264 M.card\nMpos : \u2200 m \u2208 M, 0 < m\nMdivisors : \u2200 m \u2208 M, \u2200 (n : \u2115), Nat.Prime n \u2227 n \u2223 m \u2192 n \u2264 Nat.nth Nat.Prime k\nf\u2081 : \u2115 \u2192 (k' : \u2115) \u2192 k' \u2208 Finset.range (k + 1) \u2192 \u2115 := fun n => pow_of_first_k_prime_mod_two (k + 1) n\nhf\u2081 : \u2200 n \u2208 M, f\u2081 n \u2208 two_pow_k_finset (k + 1)\nf\u2082 : Finset \u2115 \u2192 (k' : \u2115) \u2192 k' \u2208 Finset.range (k + 1) \u2192 \u2115 :=\n fun n => pow_of_first_k_prime_mod_two (k + 1) (\u220f x \u2208 n, x).sqrt\nhf\u2082 : \u2200 n \u2286 M, f\u2082 n \u2208 two_pow_k_finset (k + 1)\nhs : 2 * (two_pow_k_finset (k + 1)).card + (two_pow_k_finset (k + 1)).card + 1 \u2264 M.card\n\u22a2 \u2203 M' \u2286 M, M'.card = 4 \u2227 \u2203 k, M'.prod id = k ^ 4"], "timeout_s": 600.0, "latency_s": 0.9721, "verified_at": "2026-03-26T18:16:57.726520+00:00"}} | false | true | false | 0.9721 |
compfiles_Imo1985P6 | compfiles | Copyright (c) 2025 Roozbeh Yousefzadeh. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1985, Problem 6
For every real number x_1, construct the sequence {x_1,x_2, ...}
by setting x_{n+1} = x_n * (x_n + 1 / n) for each n >= 1.
Prove that there exists exactly one value of x_1 for which
0 < x_n , x_n < x_{n+1}, and x_{n+1} < 1 for every n.
-/
namespace Imo1985P6
lemma aux_1
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ x, f 1 x = x)
(h₁ : ∀ n x, 0 < n → f (n + 1) x = f n x * (f n x + 1 / n)) :
∀ n x, 0 < n ∧ 0 < x → 0 < f n x := by
rintro n x ⟨hn, hx⟩
induction n, hn using Nat.le_induction with
| base =>
rw [h₀]
exact hx
| succ m hm ih =>
rw [h₁ m x (Nat.zero_lt_of_lt hm)]
positivity
lemma aux_2
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ x, f 1 x = x)
(h₁ : ∀ n x, 0 < n → f (n + 1) x = f n x * (f n x + 1 / n))
(h₃ : ∀ n x, 0 < n → 0 ≤ f n x) :
∀ n x y, 0 < n → x < y → f n x < f n y := by
intro n x y hn hxy
induction n using Nat.strong_induction_on with
| h n ih =>
cases n with
| zero => exact absurd hn (Nat.lt_irrefl _)
| succ n =>
cases n with
| zero => simpa [h₀] using hxy
| succ n =>
have pos_n : 0 < n.succ := Nat.succ_pos _
have IH := ih n.succ (Nat.lt_succ_self _) pos_n
rw [h₁ n.succ x pos_n, h₁ n.succ y pos_n]
refine mul_lt_mul IH ?_ ?_ ?_
· apply add_le_add (le_of_lt IH) le_rfl
· exact add_pos_of_nonneg_of_pos (h₃ _ _ pos_n) (by positivity)
· exact h₃ _ _ pos_n
lemma aux_3
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ (x : NNReal), f 1 x = ↑x)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(h₄ : ∀ (n : ℕ) (x y : NNReal), 0 < n → x < y → f n x < f n y) :
∀ (n : ℕ) (x : NNReal), 1 < n ∧ 1 ≤ x → 1 < f n x := by
intro n x hx₀
obtain ⟨hn₀, hx₁⟩ := hx₀
have g₂₀: f n 1 ≤ f n x := by
obtain hx_gt | hx_eq := lt_or_eq_of_le hx₁
· exact le_of_lt (h₄ n 1 x (Nat.zero_lt_of_lt hn₀) hx_gt)
· rw [hx_eq]
have g₂₁: f 1 1 < f n 1 := by
rw [h₀]
refine Nat.le_induction ?_ ?_ n hn₀
· rw [h₁ 1 1 (by norm_num), h₀]
norm_num
· intro m hm₀ hm₁
rw [h₁ m 1 (by omega)]
refine one_lt_mul_of_lt_of_le hm₁ ?_
nth_rw 1 [← add_zero 1]
refine add_le_add ?_ ?_
· exact le_of_lt hm₁
· exact Nat.one_div_cast_nonneg m
refine lt_of_lt_of_le ?_ g₂₀
exact (lt_iff_lt_of_cmp_eq_cmp (congrFun (congrArg cmp (h₀ 1)) (f n 1))).mp g₂₁
lemma aux_4
(f : ℕ → NNReal → ℝ)
(h₃ : ∀ (n : ℕ) (x : NNReal), 0 < n → 0 ≤ f n x)
(h₄ : ∀ (n : ℕ) (x y : NNReal), 0 < n → x < y → f n x < f n y)
(f₀ : ℕ → NNReal → NNReal)
(hf₀ : f₀ = fun n x => (f n x).toNNReal) :
∀ (n : ℕ), 0 < n → StrictMono (f₀ n) := by
intro n hn x y hxy
rw [hf₀]
exact (Real.toNNReal_lt_toNNReal_iff_of_nonneg (h₃ n x hn)).mpr (h₄ n x y hn hxy)
lemma aux_5
(f : ℕ → NNReal → ℝ)
(hmo₁ : ∀ (n : ℕ), 0 < n → Function.Injective (f n))
(f₀ : ℕ → NNReal → NNReal)
(hmo₂ : ∀ (n : ℕ), 0 < n → StrictMono (f₀ n))
(fi : ℕ → NNReal → NNReal)
(hfi : fi = fun n => Function.invFun (f₀ n)) :
∀ (n : ℕ) (x y : NNReal), 0 < n → f₀ n x = y → fi n y = x := by
intro n x y hn₀ hn₁
have hf₃: ∀ n y, fi n y = Function.invFun (f₀ n) y := by
exact fun n y => congrFun (congrFun hfi n) y
rw [← hn₁, hf₃]
have hmo₃: ∀ n, 0 < n → Function.Injective (f₀ n) := by
exact fun n a => StrictMono.injective (hmo₂ n a)
have hn₂: (Function.invFun (f₀ n)) ∘ (f₀ n) = id := by exact Function.invFun_comp (hmo₃ n hn₀)
rw [Function.comp_def (Function.invFun (f₀ n)) (f₀ n)] at hn₂
have hn₃ : (fun x => Function.invFun (f₀ n) (f₀ n x)) x = id x :=
(NNReal.eq (congrArg NNReal.toReal (congrFun hn₂.symm x))).symm
exact hmo₁ n hn₀ (congrArg (f n) hn₃)
lemma aux_6
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ (x : NNReal), f 1 x = ↑x)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(f₀ : ℕ → NNReal → NNReal)
(hf₀ : f₀ = fun n x => (f n x).toNNReal) :
∀ (n : ℕ), 0 < n → Continuous (f₀ n) := by
intro n hn₀
rw [hf₀]
apply Continuous.comp continuous_real_toNNReal
induction n, hn₀ using Nat.le_induction with
| base =>
have : f 1 = fun x => ↑x := funext h₀
rw [this]
exact NNReal.continuous_coe
| succ d hd_pos hd_cont =>
have : f (d + 1) = fun x => f d x * (f d x + 1 / d) := funext (h₁ d · hd_pos)
rw [this]
fun_prop
lemma aux_7
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ (x : NNReal), f 1 x = ↑x)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(h₃ : ∀ (n : ℕ) (x : NNReal), 0 < n → 0 ≤ f n x)
(h₅ : ∀ (n : ℕ) (x : NNReal), 1 < n ∧ 1 ≤ x → 1 < f n x)
(f₀ : ℕ → NNReal → NNReal)
(hf₂ : ∀ (n : ℕ) (x : NNReal), 0 < n → f₀ n x = (f n x).toNNReal)
(hmo₂ : ∀ (n : ℕ), 0 < n → StrictMono (f₀ n))
(hmo₄ : ∀ (n : ℕ), 0 < n → Continuous (f₀ n)) :
∀ (n : ℕ), 0 < n → Function.Surjective (f₀ n) := by
intro n hn₀
refine Continuous.surjective (hmo₄ n hn₀) ?_ ?_
· refine Monotone.tendsto_atTop_atTop ?_ ?_
· exact StrictMono.monotone (hmo₂ n hn₀)
· intro b
use (b + 1)
refine Nat.le_induction ?_ ?_ n hn₀
· rw [hf₂ 1 (b + 1) (by omega), h₀]
simp
· intro d hd₀ hd₁
rw [hf₂ (d + 1) (b + 1) (by omega), h₁ d (b + 1) (by omega)]
have hd₂: b ≤ f d (b + 1) := by
rw [hf₂ d (b + 1) (by omega)] at hd₁
exact (Real.le_toNNReal_iff_coe_le (h₃ d (b + 1) hd₀)).mp hd₁
have hd₃: 1 < (f d (b + 1) + 1 / ↑d) := by
by_cases hd₄: 1 < d
· refine lt_add_of_lt_of_pos ?_ ?_
· exact h₅ d (b + 1) ⟨hd₄, le_add_self⟩
· positivity
· have hd₅: d = 1 := by omega
rw [hd₅, h₀]
simp
positivity
refine NNReal.le_toNNReal_of_coe_le ?_
nth_rw 1 [← mul_one (↑b:ℝ)]
refine mul_le_mul hd₂ (le_of_lt hd₃) zero_le_one ?_
exact h₃ d (b + 1) hd₀
· refine Filter.tendsto_atBot_atBot.mpr ?_
intro b
use 0
intro a ha₀
have ha₁: a = 0 := nonpos_iff_eq_zero.mp ha₀
have ha₂: f₀ n 0 = 0 := by
refine Nat.le_induction ?_ ?_ n hn₀
· rw [hf₂ 1 0 (by omega), h₀]
exact Real.toNNReal_coe
· intro d hd₀ hd₁
rw [hf₂ (d + 1) 0 (by omega), h₁ d 0 (by omega)]
have hd₂: 0 ≤ f d 0 := by exact h₃ d 0 hd₀
have hd₃: f d 0 = 0 := by
rw [hf₂ d 0 (by omega)] at hd₁
apply Real.toNNReal_eq_zero.mp at hd₁
exact eq_of_le_of_ge hd₁ hd₂
rw [hd₃, zero_mul]
exact Real.toNNReal_zero
rw [ha₁, ha₂]
exact _root_.zero_le b
lemma aux_8
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ (x : NNReal), f 1 x = ↑x)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(hmo₀ : ∀ (n : ℕ), 0 < n → StrictMono (f n))
(hmo₁ : ∀ (n : ℕ), 0 < n → Function.Injective (f n))
(f₀ : ℕ → NNReal → NNReal)
(hf₂ : ∀ (n : ℕ) (x : NNReal), 0 < n → f₀ n x = (f n x).toNNReal)
(sn : Set ℕ)
(fb : ↑sn → NNReal)
(hsn₁ : ∀ (n : ↑sn), ↑n ∈ sn ∧ 0 < n.1)
(hfb₁ : ∀ (n : ↑sn), f₀ (↑n) (fb n) = 1 - 1 / ↑↑n) :
∀ (n : ↑sn), fb n < 1 := by
intro n
have hn₀: 0 < (n:ℕ) := by exact (hsn₁ n).2
let z := fb n
have hz₀: z = fb n := by rfl
rw [← hz₀]
by_contra! hc₀
have hc₁: 1 ≤ f n z := by
by_cases hn₁: 1 < (n:ℕ)
· refine le_of_lt ?_
refine aux_3 f h₀ h₁ ?_ (↑n) z ?_
· exact fun n x y a a_1 => hmo₀ n a a_1
· exact ⟨hn₁, hc₀⟩
· have hn₂: (n:ℕ) = 1 := by omega
rw [hn₂, h₀]
exact hc₀
have hz₁: f₀ n z = 1 - 1 / n := by
exact hfb₁ n
have hz₃: f n z = 1 - 1 / n := by
rw [hf₂ n z hn₀] at hz₁
by_cases hn₁: 1 < (n:ℕ)
· have hz₂: 1 - 1 / (n:NNReal) ≠ 0 := by
have g₀: (n:NNReal) ≠ 0 := by
norm_cast
omega
nth_rw 1 [← div_self g₀, ← NNReal.sub_div]
refine div_ne_zero ?_ g₀
norm_cast
exact Nat.sub_ne_zero_iff_lt.mpr hn₁
apply (Real.toNNReal_eq_iff_eq_coe hz₂).mp at hz₁
rw [hz₁]
exact ((fun {r} {p:NNReal} hp =>
(Real.toNNReal_eq_iff_eq_coe hp).mp) hz₂ (hmo₁ n hn₀ rfl)).symm
· have hn₂: (n:ℕ) = 1 := by omega
rw [hn₂, h₀] at hz₁
simp at hz₁
rw [hn₂, h₀, hz₁]
simp
rw [hz₃] at hc₁
have hz₄: 0 < 1 / (n:ℝ) := by
refine div_pos zero_lt_one ?_
exact Nat.cast_pos'.mpr hn₀
linarith
lemma aux_9
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ (x : NNReal), f 1 x = ↑x)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(f₀ : ℕ → NNReal → NNReal)
(hf₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f n x = ↑(f₀ n x))
(hf₂ : ∀ (n : ℕ) (x : NNReal), 0 < n → f₀ n x = (f n x).toNNReal)
(hmo₂ : ∀ (n : ℕ), 0 < n → StrictMono (f₀ n))
(fi : ℕ → NNReal → NNReal)
(hf₅ : ∀ (x : NNReal), fi 1 x = x)
(hmo₇ : ∀ (n : ℕ), 0 < n → Function.RightInverse (fi n) (f₀ n))
(hf₇ : ∀ (n : ℕ) (x y : NNReal), 0 < n → (f₀ n x = y ↔ fi n y = x))
(fb : ℕ → NNReal)
(hfb₀ : fb = fun n => fi n (1 - 1 / ↑n))
(sn : Set ℕ)
(hsn : sn = Set.Ici 1) :
StrictMonoOn fb sn := by
rw [hsn]
refine strictMonoOn_Ici_of_pred_lt ?hψ
intro m hm₀
rw [hfb₀]
refine Nat.le_induction ?_ ?_ m hm₀
· have g₁: fi 1 0 = 0 := by exact hf₅ 0
have g₂: (2:NNReal).HolderConjugate (2:NNReal) := NNReal.HolderConjugate.two_two
simp
norm_cast
rw [g₁, NNReal.HolderConjugate.one_sub_inv g₂]
let x := fi 2 2⁻¹
have hx₀: x = fi 2 2⁻¹ := by rfl
have hx₁: f₀ 2 x = 2⁻¹ := by
rw [hx₀]
have g₃: Function.RightInverse (fi 2) (f₀ 2) := by exact hmo₇ 2 (by omega)
exact g₃ 2⁻¹
rw [← hx₀]
contrapose! hx₁
have hc₁: x = 0 := by exact nonpos_iff_eq_zero.mp hx₁
have hc₃: f₀ 2 x = 0 := by
rw [hc₁, hf₂ 2 0 (by omega), h₁ 1 0 (by omega), h₀ 0]
norm_cast
rw [zero_mul]
exact Real.toNNReal_zero
rw [hc₃]
exact Ne.symm (NNReal.HolderTriple.inv_ne_zero g₂)
· simp
intro n hn₀ _
let i := fi n (1 - (↑n)⁻¹)
let j := fi (n + 1) (1 - ((↑n:NNReal) + 1)⁻¹)
have hi₀: i = fi n (1 - (↑n)⁻¹) := by rfl
have hj₀: j = fi (n + 1) (1 - ((↑n:NNReal) + 1)⁻¹) := by rfl
have hi₁: f₀ n i = (1 - (↑n)⁻¹) := (hf₇ n i (1 - (↑n:NNReal)⁻¹) (by omega)).mpr hi₀.symm
have hj₁: f₀ (n + 1) j = (1 - ((↑n:NNReal) + 1)⁻¹) := by
exact (hf₇ (n + 1) j _ (by omega)).mpr hj₀.symm
have hj₂: (1 - ((↑n:NNReal) + 1)⁻¹) = (1 - ((n:ℝ) + 1)⁻¹).toNNReal := by
exact rfl
have hn₂: f₀ (n + 1) i < f₀ (n + 1) j := by
rw [hj₁, hj₂, hf₂ (n + 1) _ (by omega), h₁ n i (by omega)]
rw [hf₁ n i (by omega), hi₁]
refine (Real.toNNReal_lt_toNNReal_iff ?_).mpr ?_
· refine sub_pos.mpr ?_
refine inv_lt_one_of_one_lt₀ ?_
norm_cast
exact Nat.lt_add_right 1 hn₀
· have g₀: (↑n:NNReal)⁻¹ ≤ 1 := by exact Nat.cast_inv_le_one n
rw [NNReal.coe_sub g₀, NNReal.coe_inv]
simp
refine inv_strictAnti₀ ?_ ?_
· positivity
· norm_cast
exact lt_add_one n
refine (StrictMono.lt_iff_lt ?_).mp hn₂
exact hmo₂ (n + 1) (by omega)
lemma aux_10
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ (x : NNReal), f 1 x = ↑x)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(f₀ : ℕ → NNReal → NNReal)
(hf₂ : ∀ (n : ℕ) (x : NNReal), 0 < n → f₀ n x = (f n x).toNNReal)
(fi : ℕ → NNReal → NNReal)
(hmo₇ : ∀ (n : ℕ), 0 < n → Function.RightInverse (fi n) (f₀ n))
(sn : Set ℕ)
(sb : Set NNReal)
(fb : ↑sn → NNReal)
(hsn₀ : sn = Set.Ici 1)
(hfb₀ : fb = fun n:↑sn => fi (↑n) (1 - 1 / ↑↑n))
(hsb₀ : sb = Set.range fb)
(fr : NNReal → ℝ)
(hfr: fr = fun x => ↑x)
(sbr : Set ℝ)
(hsbr: sbr = fr '' sb)
(br: ℝ)
(hbr₀ : IsLUB sbr br) :
0 < br := by
have hnb₀: 2 ∈ sn := by
rw [hsn₀]
decide
let nb : ↑sn := ⟨2, hnb₀⟩
have g₀: 0 < fb nb := by
have g₁: (2:NNReal).HolderConjugate (2:NNReal) := NNReal.HolderConjugate.two_two
rw [hfb₀]
simp
have hnb₁: nb.val = 2 := by exact rfl
rw [hnb₁]
norm_cast
rw [NNReal.HolderConjugate.one_sub_inv g₁]
let x := fi 2 2⁻¹
have hx₀: x = fi 2 2⁻¹ := by rfl
have hx₁: f₀ 2 x = 2⁻¹ := by
rw [hx₀]
have g₃: Function.RightInverse (fi 2) (f₀ 2) := by exact hmo₇ 2 (by omega)
exact g₃ 2⁻¹
rw [← hx₀]
contrapose! hx₁
have hc₁: x = 0 := by exact nonpos_iff_eq_zero.mp hx₁
have hc₃: f₀ 2 x = 0 := by
rw [hc₁, hf₂ 2 0 (by omega), h₁ 1 0 (by omega), h₀ 0]
norm_cast
rw [zero_mul]
exact Real.toNNReal_zero
rw [hc₃]
exact Ne.symm (NNReal.HolderTriple.inv_ne_zero g₁)
have g₁: ∃ x, 0 < x ∧ x ∈ sbr := by
use (fb nb).toReal
constructor
· exact g₀
· rw [hsbr]
simp
use fb ↑nb
constructor
· rw [hsb₀]
exact Set.mem_range_self nb
· exact congrFun hfr (fb ↑nb)
obtain ⟨x, hx₀, hx₁⟩ := g₁
have hx₂: br ∈ upperBounds sbr := by
refine (isLUB_le_iff hbr₀).mp ?_
exact Preorder.le_refl br
exact lt_of_le_of_lt' (hx₂ hx₁) hx₀
lemma aux_11
(sn : Set ℕ)
(fb fc : ↑sn → NNReal)
(hfc₂ : ∀ (n : ↑sn), fb n < fc n)
(hfb₃ : StrictMono fb)
(hfc₃ : StrictAnti fc)
(sb sc : Set NNReal)
(hsb₀ : sb = Set.range fb)
(hsc₀ : sc = Set.range fc)
(fr : NNReal → ℝ)
(hfr : fr = fun x ↦ ↑x)
(sbr scr : Set ℝ)
(hsbr : sbr = fr '' sb)
(hscr : scr = fr '' sc)
(br cr : ℝ)
(hbr₀ : IsLUB sbr br)
(hcr₀ : IsGLB scr cr) :
br ≤ cr := by
have hfc₄: ∀ nb nc, fb nb < fc nc := by
intro nb nc
obtain hn₀ | hn₀ := lt_or_ge nb nc
· exact lt_trans (hfb₃ hn₀) (hfc₂ nc)
obtain hn₁ | hn₁ := lt_or_eq_of_le hn₀
· refine lt_trans (hfc₂ nb) ?_
exact hfc₃ hn₁
· rw [hn₁]
exact hfc₂ nb
by_contra! hc₀
have hc₁: ∃ x ∈ sbr, cr < x ∧ x ≤ br := by exact IsLUB.exists_between hbr₀ hc₀
let ⟨x, hx₀, hx₁, _⟩ := hc₁
have hc₂: ∃ y ∈ scr, cr ≤ y ∧ y < x := by exact IsGLB.exists_between hcr₀ hx₁
let ⟨y, hy₀, _, hy₂⟩ := hc₂
have hc₃: x < y := by
have hx₃: x.toNNReal ∈ sb := by
rw [hsbr] at hx₀
apply (Set.mem_image fr sb x).mp at hx₀
obtain ⟨z, hz₀, hz₁⟩ := hx₀
rw [← hz₁, hfr, Real.toNNReal_coe]
exact hz₀
have hy₃: y.toNNReal ∈ sc := by
rw [hscr] at hy₀
apply (Set.mem_image fr sc y).mp at hy₀
obtain ⟨z, hz₀, hz₁⟩ := hy₀
rw [← hz₁, hfr, Real.toNNReal_coe]
exact hz₀
rw [hsb₀] at hx₃
rw [hsc₀] at hy₃
apply Set.mem_range.mp at hx₃
apply Set.mem_range.mp at hy₃
let ⟨nx, hnx₀⟩ := hx₃
let ⟨ny, hny₀⟩ := hy₃
have hy₄: 0 < y := by
contrapose! hy₃
have hy₅: y.toNNReal = 0 := by exact Real.toNNReal_of_nonpos hy₃
intro z
rw [hy₅]
exact ne_zero_of_lt (hfc₂ z)
refine (Real.toNNReal_lt_toNNReal_iff hy₄).mp ?_
rw [← hnx₀, ← hny₀]
exact hfc₄ nx ny
refine (lt_self_iff_false x).mp ?_
exact lt_trans hc₃ hy₂
lemma aux_exists
(f : ℕ → NNReal → ℝ)
(h₂ : ∀ (n : ℕ) (x : NNReal), 0 < n ∧ 0 < x → 0 < f n x)
(hmo₀ : ∀ (n : ℕ), 0 < n → StrictMono (f n))
(f₀ : ℕ → NNReal → NNReal)
(hf₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f n x = ↑(f₀ n x))
(sn : Set ℕ)
(hsn₀ : sn = Set.Ici 1)
(fb fc : ↑sn → NNReal)
(hfb₁ : ∀ (n : ↑sn), f₀ (↑n) (fb n) = 1 - 1 / ↑↑n)
(hfc₁ : ∀ (n : ↑sn), f₀ (↑n) (fc n) = 1)
(hfb₃ : StrictMono fb)
(hfc₃ : StrictAnti fc)
(sb sc : Set NNReal)
(hsb₀ : sb = Set.range fb)
(hsc₀ : sc = Set.range fc)
(fr : NNReal → ℝ)
(hfr : fr = fun x => ↑x)
(sbr scr : Set ℝ)
(hsbr : sbr = fr '' sb)
(hscr : scr = fr '' sc)
(br cr : ℝ)
(h₈ : ∀ (n : ℕ) (x : NNReal), 0 < n → 0 < x → 1 - 1 / ↑n < f n x → f n x < f (n + 1) x)
(hbr₁ : 0 < br)
(hu₅ : br ≤ cr)
(hbr₃ : ∀ x ∈ sbr, x ≤ br)
(hcr₃ : ∀ x ∈ scr, cr ≤ x) :
∃ x, ∀ (n : ℕ), 0 < n → 0 < f n x ∧ f n x < f (n + 1) x ∧ f (n + 1) x < 1 := by
obtain hu₆ | hu₆ := lt_or_eq_of_le hu₅
· apply exists_between at hu₆
let ⟨a, ha₀, ha₁⟩ := hu₆
have ha₂: 0 < a := by exact gt_trans ha₀ hbr₁
have ha₃: 0 < a.toNNReal := by exact Real.toNNReal_pos.mpr ha₂
use a.toNNReal
intro n hn₀
have hn₁: n ∈ sn := by
rw [hsn₀]
exact hn₀
constructor
· exact h₂ n a.toNNReal ⟨hn₀, ha₃⟩
constructor
· refine h₈ n a.toNNReal hn₀ ?_ ?_
· exact Real.toNNReal_pos.mpr ha₂
· let nn : ↑sn := ⟨n, hn₁⟩
have hn₂: f n (fb nn) = 1 - 1 / n := by
rw [hf₁ n _ hn₀, hfb₁ nn]
refine NNReal.coe_sub ?_
refine div_le_self ?_ ?_
· exact zero_le_one' NNReal
· exact Nat.one_le_cast.mpr hn₀
rw [← hn₂]
refine hmo₀ n hn₀ ?_
refine Real.lt_toNNReal_iff_coe_lt.mpr ?_
refine lt_of_le_of_lt ?_ ha₀
refine hbr₃ _ ?_
rw [hsbr]
refine (Set.mem_image fr sb _).mpr ?_
use (fb nn)
rw [hfr, hsb₀]
refine ⟨?_, rfl⟩
exact Set.mem_range_self nn
· have hn₂: n + 1 ∈ sn := by
rw [hsn₀]
exact Set.mem_Ici.mpr (by omega)
let nn : ↑sn := ⟨n + 1, hn₂⟩
have hn₃: f (n + 1) (fc (nn)) = 1 := by
rw [hf₁ (n + 1) _ (by omega), hfc₁ nn]
exact rfl
rw [← hn₃]
refine hmo₀ (n + 1) (by omega) ?_
refine (Real.toNNReal_lt_iff_lt_coe (le_of_lt ha₂)).mpr ?_
refine lt_of_lt_of_le ha₁ ?_
refine hcr₃ _ ?_
rw [hscr]
refine (Set.mem_image fr sc _).mpr ?_
use (fc nn)
rw [hfr, hsc₀]
refine ⟨?_, rfl⟩
exact Set.mem_range_self nn
· use br.toNNReal
intro n hn₀
have hn₁: n ∈ sn := by
rw [hsn₀]
exact hn₀
constructor
· refine h₂ n br.toNNReal ⟨hn₀, ?_⟩
exact Real.toNNReal_pos.mpr hbr₁
constructor
· refine h₈ n br.toNNReal hn₀ ?_ ?_
· exact Real.toNNReal_pos.mpr hbr₁
· let nn : ↑sn := ⟨n, hn₁⟩
have hn₂: fb nn < br := by
by_contra! hc₀
have hbr₅: (fb nn) = br := by
refine eq_of_le_of_ge ?_ hc₀
refine hbr₃ _ ?_
rw [hsbr]
refine (Set.mem_image fr sb _).mpr ?_
use (fb nn)
rw [hfr, hsb₀]
exact ⟨Set.mem_range_self nn, rfl⟩
have hn₂: n + 1 ∈ sn := by
rw [hsn₀]
refine Set.mem_Ici.mpr ?_
exact Nat.le_add_right_of_le hn₀
let ns : ↑sn := ⟨n + 1, hn₂⟩
have hc₁: fb nn < fb ns := by
refine hfb₃ ?_
refine Subtype.mk_lt_mk.mpr ?_
exact lt_add_one n
have hbr₆: fb ns ≤ fb nn := by
refine NNReal.coe_le_coe.mp ?_
rw [hbr₅]
refine hbr₃ _ ?_
rw [hsbr]
refine (Set.mem_image fr sb _).mpr ?_
use (fb ns)
rw [hfr, hsb₀]
refine ⟨?_, rfl⟩
exact Set.mem_range_self ns
refine (lt_self_iff_false (fb nn)).mp ?_
exact lt_of_lt_of_le hc₁ hbr₆
have hn₃: f n (fb nn) = 1 - 1 / n := by
rw [hf₁ n _ hn₀, hfb₁ nn]
refine NNReal.coe_sub ?_
refine div_le_self ?_ ?_
· exact zero_le_one' NNReal
· exact Nat.one_le_cast.mpr hn₀
rw [← hn₃]
refine hmo₀ n hn₀ ?_
exact Real.lt_toNNReal_iff_coe_lt.mpr hn₂
· have hn₂: n + 1 ∈ sn := by
rw [hsn₀]
exact Set.mem_Ici.mpr (by omega)
let nn : ↑sn := ⟨n + 1, hn₂⟩
have hcr₁: 0 < cr := lt_of_le_of_lt' hu₅ hbr₁
have hn₃: f (n + 1) (fc (nn)) = 1 := by
rw [hf₁ (n + 1) _ (by omega), hfc₁ nn]
exact rfl
rw [← hn₃, hu₆]
refine hmo₀ (n + 1) (by omega) ?_
refine (Real.toNNReal_lt_iff_lt_coe (le_of_lt hcr₁)).mpr ?_
by_contra! hc₀
have hc₁: fc nn = cr := by
refine eq_of_le_of_ge hc₀ ?_
refine hcr₃ _ ?_
rw [hscr]
refine (Set.mem_image fr sc _).mpr ?_
use (fc nn)
rw [hfr, hsc₀]
refine ⟨?_, rfl⟩
exact Set.mem_range_self nn
have hn₄: n + 2 ∈ sn := by
rw [hsn₀]
refine Set.mem_Ici.mpr ?_
exact Nat.le_add_right_of_le hn₀
let ns : ↑sn := ⟨n + 2, hn₄⟩
have hn₅: fc ns < fc nn := by
refine hfc₃ ?_
refine Subtype.mk_lt_mk.mpr ?_
exact Nat.lt_add_one (n + 1)
have hc₂: fc nn ≤ fc ns := by
refine NNReal.coe_le_coe.mp ?_
rw [hc₁]
refine hcr₃ _ ?_
rw [hscr]
refine (Set.mem_image fr sc _).mpr ?_
use (fc ns)
rw [hfr, hsc₀]
refine ⟨?_, rfl⟩
exact Set.mem_range_self ns
refine (lt_self_iff_false (fc ns)).mp ?_
exact lt_of_lt_of_le hn₅ hc₂
lemma aux_unique_top_ind
(f : ℕ → NNReal → ℝ)
(sd : Set ℕ)
(hsd : sd = Set.Ici 2)
(fd : NNReal → NNReal → ↑sd → ℝ)
(hfd₁ : ∀ (y₁ y₂ : NNReal) (n : ↑sd), fd y₁ y₂ n = f (↑n) y₂ - f (↑n) y₁)
(hd₁ : ∀ (n : ↑sd) (a b : NNReal), a < b → 0 < fd a b n)
(a b : NNReal)
(ha₀ : a < b)
(hd₃ : ∀ (nd : ↑sd), nd.1 + (1 : ℕ) ∈ sd)
(hd₂ : ∀ (nd : ↑sd), fd a b nd * (2 - 1 / ↑↑nd) ≤ fd a b ⟨nd.1 + 1, hd₃ nd⟩)
(hi₀ : 2 ∈ sd)
(i : ↑sd)
(hi₁ : i = ⟨2, hi₀⟩) :
∀ (nd : ↑sd), fd a b i * (3 / 2) ^ (nd.1 - 2) ≤ fd a b nd := by
intro nd
rw [hfd₁ a b nd]
have hnd₀: 2 ≤ nd.1 := by
refine Set.mem_Ici.mp ?_
rw [← hsd]
exact nd.2
refine Nat.le_induction ?_ ?_ nd.1 hnd₀
· have hi₂: i.val = (2:ℕ) := by
simp_all only [Subtype.forall]
rw [hfd₁ a b i, hi₂]
simp
· simp
intro n hn₀ hn₁
have hn₂: n - 1 = n - 2 + 1 := by omega
have hn₃: n ∈ sd := by
rw [hsd]
exact hn₀
let nn : ↑sd := ⟨n, hn₃⟩
have hn₄: nn.1 + 1 ∈ sd := hd₃ nn
have hn₅: fd a b nn * (2 - 1 / ↑n) ≤ fd a b ⟨nn.1 + 1, hn₄⟩ := by exact hd₂ nn
rw [hfd₁ a b ⟨nn.1 + 1, hn₄⟩] at hn₅
have hn₆: f (↑nn + 1) b - f (↑nn + 1) a = f (n + 1) b - f (n + 1) a := by exact rfl
rw [hn₆] at hn₅
refine le_trans ?_ hn₅
rw [hn₂, pow_succ (3/2) (n - 2), ← mul_assoc (fd a b i)]
refine mul_le_mul ?_ ?_ (by norm_num1) ?_
· refine le_of_le_of_eq hn₁ ?_
rw [hfd₁]
· refine (div_le_iff₀ (two_pos)).mpr ?_
rw [sub_mul, one_div_mul_eq_div _ 2]
refine le_sub_iff_add_le.mpr ?_
refine le_sub_iff_add_le'.mp ?_
refine (div_le_iff₀ ?_).mpr ?_
· positivity
· ring_nf
exact Nat.ofNat_le_cast.mpr hn₀
· exact le_of_lt (hd₁ nn a b ha₀)
lemma aux_unique_top
(f : ℕ → NNReal → ℝ)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(h₇ : ∀ (n : ℕ) (x : NNReal), 0 < n → f n x < f (n + 1) x → 1 - 1 / ↑n < f n x)
(sd : Set ℕ)
(hsd : sd = Set.Ici 2)
(fd : NNReal → NNReal → ↑sd → ℝ)
(hfd₁ : ∀ (y₁ y₂ : NNReal) (n : ↑sd), fd y₁ y₂ n = f (↑n) y₂ - f (↑n) y₁)
(hd₁ : ∀ (n : ↑sd) (a b : NNReal), a < b → 0 < fd a b n) :
∀ (a b : NNReal),
a < b →
(∀ (n : ↑sd), f (↑n) a < f (↑n + 1) a ∧ f (↑n) b < f (↑n + 1) b)
→ Filter.Tendsto (fd a b) Filter.atTop Filter.atTop := by
intro a b ha₀ ha₁
have hd₀: ∀ (nd:↑sd), (nd.1 + 1) ∈ sd := by
intro nd
let t : ℕ := nd.1
have ht: t = nd.1 := by rfl
rw [← ht, hsd]
refine Set.mem_Ici.mpr ?_
refine Nat.le_add_right_of_le ?_
refine Set.mem_Ici.mp ?_
rw [ht, ← hsd]
exact nd.2
have hd₂: ∀ nd, fd a b nd * (2 - 1 / nd.1) ≤ fd a b ⟨nd.1 + 1, hd₀ nd⟩ := by
intro nd
have hnd₀: 0 < nd.1 := by
have g₀: 2 ≤ nd.1 := by
refine Set.mem_Ici.mp ?_
rw [← hsd]
exact nd.2
exact Nat.zero_lt_of_lt g₀
rw [hfd₁, hfd₁, h₁ nd.1 _ hnd₀, h₁ nd.1 _ hnd₀]
have hnd₁: f (↑nd) b * (f (↑nd) b + 1 / ↑↑nd) - f (↑nd) a * (f (↑nd) a + 1 / ↑↑nd) =
(f (↑nd) b - f (↑nd) a) * (f (↑nd) b + f (↑nd) a + 1 / nd.1) := by
ring_nf
rw [hnd₁]
refine (mul_le_mul_iff_right₀ ?_).mpr ?_
· rw [← hfd₁]
exact hd₁ nd a b ha₀
· refine le_sub_iff_add_le.mp ?_
rw [sub_neg_eq_add]
have hnd₂: 1 - 1 / nd.1 < f (↑nd) b := by
exact h₇ nd.1 b hnd₀ (ha₁ nd).2
have hnd₃: 1 - 1 / nd.1 < f (↑nd) a := by
exact h₇ nd.1 a hnd₀ (ha₁ nd).1
linarith
have hi: 2 ∈ sd := by
rw [hsd]
decide
let i : ↑sd := ⟨(2:ℕ), hi⟩
have hd₃: ∀ nd, fd a b i * (3 / 2) ^ (nd.1 - 2) ≤ fd a b nd := by
intro nd
exact aux_unique_top_ind f sd hsd fd hfd₁ hd₁ a b ha₀ hd₀ hd₂ hi i rfl nd
have hsd₁: Nonempty ↑sd := Nonempty.intro i
refine Filter.tendsto_atTop_atTop.mpr ?_
intro z
by_cases hz₀: z ≤ fd a b i
· use i
intro j _
refine le_trans hz₀ ?_
refine le_trans ?_ (hd₃ j)
refine le_mul_of_one_le_right ?_ ?_
· refine le_of_lt ?_
exact hd₁ i a b ha₀
· refine one_le_pow₀ ?_
norm_num
· push_neg at hz₀
have hz₁: 0 < fd a b i := by exact hd₁ i a b ha₀
have hz₂: 0 < Real.log (z / fd a b i) := by
refine Real.log_pos ?_
exact (one_lt_div hz₁).mpr hz₀
let j : ℕ := Nat.ceil (2 + Real.log (z / fd a b i) / Real.log (3 / 2))
have hj₀: 2 < j := by
refine Nat.lt_ceil.mpr ?_
norm_cast
refine lt_add_of_pos_right 2 ?_
refine div_pos ?_ ?_
· exact hz₂
· positivity
have hj₁: j ∈ sd := by
rw [hsd]
exact Set.mem_Ici_of_Ioi hj₀
use ⟨j, hj₁⟩
intro k hk₀
have hk₁: fd a b i * (3 / 2) ^ (k.1 - 2) ≤ fd a b k := by
exact hd₃ k
have hk₂: i < k := lt_of_lt_of_le hj₀ hk₀
refine le_trans ?_ hk₁
refine (div_le_iff₀' ?_).mp ?_
· exact hz₁
· refine Real.le_pow_of_log_le (by norm_num1) ?_
refine (div_le_iff₀ ?_).mp ?_
· positivity
· rw [Nat.cast_sub ?_]
· rw [Nat.cast_two]
refine le_sub_iff_add_le'.mpr ?_
exact Nat.le_of_ceil_le hk₀
· exact Nat.le_of_succ_le hk₂
lemma aux_unique_nhds
(f : ℕ → NNReal → ℝ)
(sd : Set ℕ)
(hsd : sd = Set.Ici 2)
(fd : NNReal → NNReal → ↑sd → ℝ)
(hfd₁ : ∀ (y₁ y₂ : NNReal) (n : ↑sd), fd y₁ y₂ n = f (↑n) y₂ - f (↑n) y₁)
(hd₁ : ∀ (n : ↑sd) (a b : NNReal), a < b → 0 < fd a b n) :
∀ (a b : NNReal),
a < b →
(∀ (n : ↑sd),
(1 - 1 / ↑↑n < f (↑n) a ∧ 1 - 1 / ↑↑n < f (↑n) b) ∧ f (↑n) a < 1 ∧ f (↑n) b < 1) →
Filter.Tendsto (fd a b) Filter.atTop (nhds 0) := by
intro a b ha₀ ha₁
have hsd₁: Nonempty ↑sd := by
rw [hsd]
exact Set.nonempty_Ici_subtype
refine tendsto_atTop_nhds.mpr ?_
intro U hU₀ hU₁
have hU₂: U ∈ nhds 0 := by exact IsOpen.mem_nhds hU₁ hU₀
apply mem_nhds_iff_exists_Ioo_subset.mp at hU₂
obtain ⟨l, u, hl₀, hl₁⟩ := hU₂
have hl₂: 0 < u := by exact (Set.mem_Ioo.mpr hl₀).2
let nd := 2 + Nat.ceil (1/u)
have hnd₀: nd ∈ sd := by
rw [hsd]
refine Set.mem_Ici.mpr ?_
exact Nat.le_add_right 2 ⌈1 / u⌉₊
use ⟨nd, hnd₀⟩
intro n hn₀
refine (IsOpen.mem_nhds_iff hU₁).mp ?_
refine mem_nhds_iff.mpr ?_
use Set.Ioo l u
refine ⟨hl₁, isOpen_Ioo, Set.mem_Ioo.mpr ?_⟩
constructor
· refine lt_trans ?_ (hd₁ n a b ha₀)
exact (Set.mem_Ioo.mp hl₀).1
· have hn₁: fd a b n < 1 / n := by
rw [hfd₁]
have ha₂: 1 - 1 / n < f n a := by exact (ha₁ n).1.1
have hb₁: f n b < 1 := by exact (ha₁ n).2.2
refine sub_lt_iff_lt_add.mpr ?_
refine lt_trans hb₁ ?_
exact sub_lt_iff_lt_add'.mp ha₂
have hn₂: (1:ℝ) / n ≤ 1 / nd := by
refine one_div_le_one_div_of_le ?_ ?_
· positivity
· exact Nat.cast_le.mpr hn₀
refine lt_of_lt_of_le hn₁ ?_
refine le_trans hn₂ ?_
refine div_le_of_le_mul₀ ?_ ?_ ?_
· exact Nat.cast_nonneg' nd
· exact le_of_lt hl₂
· have hl₃: u * (2 + 1 / u) ≤ u * ↑((2:ℕ) + ⌈(1:ℝ) / u⌉₊) := by
refine (mul_le_mul_iff_right₀ hl₂).mpr ?_
rw [Nat.cast_add 2 _, Nat.cast_two]
refine add_le_add_right ?_ 2
exact Nat.le_ceil (1 / u)
refine le_trans ?_ hl₃
rw [mul_add, mul_one_div u u, div_self (ne_of_gt hl₂)]
refine le_of_lt ?_
refine sub_lt_iff_lt_add.mp ?_
rw [sub_self 1]
exact mul_pos hl₂ two_pos
lemma aux_unique
(f : ℕ → NNReal → ℝ)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(hmo₀ : ∀ (n : ℕ), 0 < n → StrictMono (f n))
(h₇ : ∀ (n : ℕ) (x : NNReal), 0 < n → f n x < f (n + 1) x → 1 - 1 / ↑n < f n x) :
∀ (y₁ y₂ : NNReal),
(∀ (n : ℕ), 0 < n → 0 < f n y₁ ∧ f n y₁ < f (n + 1) y₁ ∧ f (n + 1) y₁ < 1) →
(∀ (n : ℕ), 0 < n → 0 < f n y₂ ∧ f n y₂ < f (n + 1) y₂ ∧ f (n + 1) y₂ < 1) → y₁ = y₂ := by
intro x y hx₀ hy₀
let sd : Set ℕ := Set.Ici 2
let fd : NNReal → NNReal → ↑sd → ℝ := fun y₁ y₂ n => (f n.1 y₂ - f n.1 y₁)
have hfd₁: ∀ y₁ y₂ n, fd y₁ y₂ n = f n.1 y₂ - f n.1 y₁ := by exact fun y₁ y₂ n => rfl
have hd₁: ∀ n a b, a < b → 0 < fd a b n := by
intro nd a b hnd₀
rw [hfd₁]
refine sub_pos.mpr ?_
refine hmo₀ nd.1 ?_ hnd₀
exact lt_of_lt_of_le (Nat.zero_lt_two) nd.2
have hfd₂: ∀ a b, a < b → (∀ n:↑sd, f n.1 a < f (n.1 + 1) a ∧ f n.1 b < f (n.1 + 1) b)
→ Filter.Tendsto (fd a b) Filter.atTop Filter.atTop := by
intro a b ha₀ ha₁
exact aux_unique_top f h₁ h₇ sd rfl fd hfd₁ hd₁ a b ha₀ ha₁
have hfd₃: ∀ a b, a < b →
(∀ (n:↑sd), (1 - 1 / n.1 < f n.1 a ∧ 1 - 1 / n.1 < f n.1 b) ∧ (f n.1 a < 1 ∧ f n.1 b < 1))
→ Filter.Tendsto (fd a b) Filter.atTop (nhds 0) := by
intro a b ha₀ ha₁
exact aux_unique_nhds f sd rfl fd hfd₁ hd₁ a b ha₀ ha₁
by_contra! hc₀
by_cases hy₁: x < y
· have hy₂: Filter.Tendsto (fd x y) Filter.atTop Filter.atTop := by
refine hfd₂ x y hy₁ ?_
intro nd
have hnd₀: 0 < nd.1 := by exact lt_of_lt_of_le (two_pos) nd.2
constructor
· exact (hx₀ nd.1 hnd₀).2.1
· exact (hy₀ nd.1 hnd₀).2.1
have hy₃: Filter.Tendsto (fd x y) Filter.atTop (nhds 0) := by
refine hfd₃ x y hy₁ ?_
intro nd
have hnd₀: 0 < nd.1 := by
refine lt_of_lt_of_le ?_ nd.2
exact Nat.zero_lt_two
have hnd₁: nd.1 - 1 + 1 = nd.1 := by exact Nat.sub_add_cancel hnd₀
have hnd₂: 0 < nd.1 - 1 := by
refine Nat.sub_pos_of_lt ?_
refine lt_of_lt_of_le ?_ nd.2
exact Nat.one_lt_two
constructor
· constructor
· refine h₇ nd.1 x hnd₀ ?_
exact (hx₀ (nd.1) hnd₀).2.1
· refine h₇ nd.1 y hnd₀ ?_
exact (hy₀ (nd.1) hnd₀).2.1
· constructor
· rw [← hnd₁]
exact (hx₀ (nd.1 - 1) hnd₂).2.2
· rw [← hnd₁]
exact (hy₀ (nd.1 - 1) hnd₂).2.2
apply Filter.tendsto_atTop_atTop.mp at hy₂
apply tendsto_atTop_nhds.mp at hy₃
contrapose! hy₃
clear hy₃
let sx : Set ℝ := Set.Ioo (-1) 1
use sx
constructor
· refine Set.mem_Ioo.mpr ?_
simp
constructor
· exact isOpen_Ioo
· intro N
have hy₅: ∃ i, ∀ (a : ↑sd), i ≤ a → N + 3 ≤ fd x y a := by exact hy₂ (N + 3)
obtain ⟨i, hi₀⟩ := hy₅
have hi₁: (N.1 + i.1) ∈ sd := by
refine Set.mem_Ici.mpr ?_
rw [← add_zero 2]
exact Nat.add_le_add N.2 (Nat.zero_le ↑i)
let a : ↑sd := ⟨N + i, hi₁⟩
use a
constructor
· refine Subtype.mk_le_mk.mpr ?_
exact Nat.le_add_right ↑N ↑i
· refine Set.notMem_Ioo_of_ge ?_
have hi₂: ↑↑N + 3 ≤ fd x y a := by
refine hi₀ a ?_
refine Subtype.mk_le_mk.mpr ?_
exact Nat.le_add_left ↑i ↑N
refine le_trans ?_ hi₂
norm_cast
exact Nat.le_add_left 1 (↑N + 2)
· have hy₂: y < x := by
push_neg at hy₁
exact lt_of_le_of_ne hy₁ hc₀.symm
have hy₃: Filter.Tendsto (fd y x) Filter.atTop Filter.atTop := by
refine hfd₂ y x hy₂ ?_
intro nd
have hnd₀: 0 < nd.1 := by exact lt_of_lt_of_le (two_pos) nd.2
constructor
· exact (hy₀ nd.1 hnd₀).2.1
· exact (hx₀ nd.1 hnd₀).2.1
have hy₄: Filter.Tendsto (fd y x) Filter.atTop (nhds 0) := by
refine hfd₃ y x hy₂ ?_
intro nd
have hnd₀: 0 < nd.1 := by exact lt_of_lt_of_le (Nat.zero_lt_two) nd.2
have hnd₁: nd.1 - 1 + 1 = nd.1 := by exact Nat.sub_add_cancel hnd₀
have hnd₂: 0 < nd.1 - 1 := by
refine Nat.sub_pos_of_lt ?_
exact lt_of_lt_of_le (Nat.one_lt_two) nd.2
constructor
· constructor
· refine h₇ nd.1 y hnd₀ ?_
exact (hy₀ (nd.1) hnd₀).2.1
· refine h₇ nd.1 x hnd₀ ?_
exact (hx₀ (nd.1) hnd₀).2.1
· constructor
· rw [← hnd₁]
exact (hy₀ (nd.1 - 1) hnd₂).2.2
· rw [← hnd₁]
exact (hx₀ (nd.1 - 1) hnd₂).2.2
apply Filter.tendsto_atTop_atTop.mp at hy₃
apply tendsto_atTop_nhds.mp at hy₄
contrapose! hy₄
clear hy₄
let sx : Set ℝ := Set.Ioo (-1) 1
use sx
constructor
· refine Set.mem_Ioo.mpr ?_
simp
constructor
· exact isOpen_Ioo
· intro N
have hy₅: ∃ i, ∀ (a : ↑sd), i ≤ a → N + 3 ≤ fd y x a := by exact hy₃ (N + 3)
obtain ⟨i, hi₀⟩ := hy₅
have hi₁: (N.1 + i.1) ∈ sd := by
refine Set.mem_Ici.mpr ?_
rw [← add_zero 2]
exact Nat.add_le_add N.2 (Nat.zero_le ↑i)
let a : ↑sd := ⟨N + i, hi₁⟩
use a
constructor
· refine Subtype.mk_le_mk.mpr ?_
exact Nat.le_add_right ↑N ↑i
· refine Set.notMem_Ioo_of_ge ?_
have hi₂: ↑↑N + 3 ≤ fd y x a := by
refine hi₀ a ?_
refine Subtype.mk_le_mk.mpr ?_
exact Nat.le_add_left ↑i ↑N
refine le_trans ?_ hi₂
norm_cast
exact Nat.le_add_left 1 (↑N + 2)
lemma imo_1985_p6_nnreal
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ x, f 1 x = x)
(h₁ : ∀ n x, 0 < n → f (n + 1) x = f n x * (f n x + 1 / n)) :
∃! a, ∀ n, 0 < n → 0 < f n a ∧ f n a < f (n + 1) a ∧ f (n + 1) a < 1 := by
have h₂: ∀ n x, 0 < n ∧ 0 < x → 0 < f n x := by
exact fun n x a => aux_1 f h₀ h₁ n x a
have h₃: ∀ n x, 0 < n → 0 ≤ f n x := by
intro n x hn
refine Nat.le_induction ?_ ?_ n hn
· rw [h₀ x]
exact NNReal.zero_le_coe
· intro d hd₀ hd₁
rw [h₁ d x hd₀]
positivity
have hmo₀: ∀ n, 0 < n → StrictMono (f n) := by
intro n hn₀
refine Monotone.strictMono_of_injective ?h₁ ?h₂
· refine monotone_iff_forall_lt.mpr ?h₁.a
intro a b hab
refine le_of_lt ?_
exact aux_2 f h₀ h₁ h₃ n a b hn₀ hab
· intro p q hpq
contrapose! hpq
apply lt_or_gt_of_ne at hpq
obtain hpq | hpq := hpq
· refine ne_of_lt ?_
exact aux_2 f h₀ h₁ h₃ n p q hn₀ hpq
· symm
refine ne_of_lt ?_
exact aux_2 f h₀ h₁ h₃ n q p hn₀ hpq
have hmo₁: ∀ n, 0 < n → Function.Injective (f n) := fun n a => StrictMono.injective (hmo₀ n a)
let f₀: ℕ → NNReal → NNReal := fun n x => (f n x).toNNReal
have hf₀: f₀ = fun n x => (f n x).toNNReal := by rfl
have hf₁: ∀ n x, 0 < n → f n x = f₀ n x := by
intro n x hn₀
rw [hf₀]
simp
exact h₃ n x hn₀
have hf₂: ∀ n x, 0 < n → f₀ n x = (f n x).toNNReal := by
intro n x _
rw [hf₀]
have hmo₂: ∀ n, 0 < n → StrictMono (f₀ n) := by
intro n hn₀
refine aux_4 f h₃ ?_ f₀ hf₀ n hn₀
exact fun n x y a a_1 => hmo₀ n a a_1
let fi : ℕ → NNReal → NNReal := fun n => Function.invFun (f₀ n)
have hmo₇: ∀ n, 0 < n → Function.RightInverse (fi n) (f₀ n) := by
intro n hn₀
refine Function.rightInverse_invFun ?_
have h₄: ∀ n x y, 0 < n → x < y → f n x < f n y := by
exact fun n x y a a_1 => aux_2 f h₀ h₁ h₃ n x y a a_1
refine aux_7 f h₀ h₁ h₃ ?_ f₀ hf₂ hmo₂ ?_ n hn₀
· exact fun n x a => aux_3 f h₀ h₁ h₄ n x a
· intro m hm₀
exact aux_6 f h₀ h₁ f₀ hf₀ m hm₀
have hf₇: ∀ n x y, 0 < n → (f₀ n x = y ↔ fi n y = x) := by
intro n x y hn₀
constructor
· intro hn₁
exact aux_5 f hmo₁ f₀ hmo₂ fi rfl n x y hn₀ hn₁
· intro hn₁
rw [← hn₁]
exact hmo₁ n hn₀ (congrArg (f n) (hmo₇ n hn₀ y))
let sn : Set ℕ := Set.Ici 1
let fb : ↑sn → NNReal := sn.restrict (fun (n:ℕ) => fi n (1 - 1 / (n:NNReal)))
let fc : ↑sn → NNReal := sn.restrict (fun (n:ℕ) => fi n 1)
have hsn₁: ∀ n:↑sn, ↑n ∈ sn ∧ 0 < (↑n:ℕ) := by
intro n
have hn₀: ↑n ∈ sn := by exact Subtype.coe_prop n
constructor
· exact Subtype.coe_prop n
· exact hn₀
have hfb₀: fb = fun (n:↑sn) => fi n (1 - 1 / (n:NNReal)) := by rfl
have hfc₀: fc = fun (n:↑sn) => fi n 1 := by rfl
have hfb₁: ∀ n:↑sn, f₀ n (fb n) = 1 - 1 / (n:NNReal) := by
intro n
have hn₀: 0 < (n:ℕ) := by exact (hsn₁ n).2
rw [hfb₀]
exact hmo₁ n hn₀ (congrArg (f n) (hmo₇ n hn₀ (1 - 1 / (n:NNReal))))
have hfc₁: ∀ n:↑sn, f₀ n (fc n) = 1 := by
intro n
have hn₀: 0 < (n:ℕ) := by exact (hsn₁ n).2
rw [hfc₀]
exact hmo₁ n hn₀ (congrArg (f n) (hmo₇ n hn₀ 1))
have hu₁: ∀ n:↑sn, fb n < 1 := by
exact aux_8 f h₀ h₁ hmo₀ hmo₁ f₀ hf₂ sn fb hsn₁ hfb₁
have hfc₂: ∀ n:↑sn, fb n < fc n := by
intro n
have hn₀: 0 < (n:ℕ) := by exact (hsn₁ n).2
have g₀: f₀ n (fb n) < f₀ n (fc n) := by
rw [hfb₁ n, hfc₁ n]
simp
exact (hsn₁ n).2
exact (StrictMono.lt_iff_lt (hmo₂ n hn₀)).mp g₀
have hfb₃: StrictMono fb := by
refine StrictMonoOn.restrict ?_
refine aux_9 f h₀ h₁ f₀ hf₁ hf₂ hmo₂ fi ?_ hmo₇ hf₇ _ (by rfl) sn (by rfl)
intro x
refine (hf₇ 1 x x (by omega)).mp ?_
rw [hf₂ 1 x (by omega), h₀]
exact Real.toNNReal_coe
have hfc₃: StrictAnti fc := by
have g₀: StrictAntiOn (fun n => fi n 1) sn := by
refine strictAntiOn_Ici_of_lt_pred ?_
intro m hm₀
have hm₁: 0 < m - 1 := by exact Nat.zero_lt_sub_of_lt hm₀
have hm₂: m = m - 1 + 1 := by rw [Nat.sub_add_cancel (le_of_lt hm₀)]
have hm₃: 0 < m := by exact Nat.zero_lt_of_lt hm₀
simp
let x := fi m 1
let y := fi (m - 1) 1
have hx₀: x = fi m 1 := by rfl
have hy₀: y = fi (m - 1) 1 := by rfl
have hx₁: f₀ m x = 1 := by exact (hf₇ m x 1 (by omega)).mpr hx₀.symm
have hy₁: f₀ (m - 1) y = 1 := by
exact (hf₇ (m - 1) y 1 hm₁).mpr hy₀.symm
have hy₂: f (m - 1) y = 1 := by
rw [hf₁ (m - 1) y hm₁, hy₁]
exact rfl
have hf: StrictMono (f m) := by exact hmo₀ m hm₃
refine (StrictMono.lt_iff_lt hf).mp ?_
rw [← hx₀, ← hy₀]
rw [hf₁ m x hm₃, hf₁ m y hm₃]
refine NNReal.coe_lt_coe.mpr ?_
rw [hx₁, hf₂ m y hm₃, hm₂, h₁ (m - 1) y hm₁, hy₂]
simp
exact hm₀
intro m n hmn
rw [hfc₀]
simp
let mn : ℕ := ↑m
let nn : ℕ := ↑n
have hm₀: mn ∈ sn := by exact Subtype.coe_prop m
have hn₀: nn ∈ sn := by exact Subtype.coe_prop n
exact g₀ hm₀ hn₀ hmn
let sb := Set.range fb
let sc := Set.range fc
have hsb₀: sb = Set.range fb := by rfl
have hsc₀: sc = Set.range fc := by rfl
let fr : NNReal → ℝ := fun x => x.toReal
let sbr := Set.image fr sb
let scr := Set.image fr sc
have hu₃: ∃ br, IsLUB sbr br := by
refine Real.exists_isLUB ?_ ?_
· exact Set.Nonempty.of_subtype
· refine NNReal.bddAbove_coe.mpr ?_
refine (bddAbove_iff_exists_ge 1).mpr ?_
use 1
constructor
· exact Preorder.le_refl 1
· intro y hy₀
apply Set.mem_range.mp at hy₀
obtain ⟨na, hna₀⟩ := hy₀
refine le_of_lt ?_
rw [← hna₀]
exact hu₁ na
have hu₄: ∃ cr, IsGLB scr cr := by
refine Real.exists_isGLB ?_ ?_
· exact Set.Nonempty.of_subtype
· exact NNReal.bddBelow_coe sc
obtain ⟨br, hbr₀⟩ := hu₃
obtain ⟨cr, hcr₀⟩ := hu₄
have h₇: ∀ n x, 0 < n → (f n x < f (n + 1) x → 1 - 1 / n < f n x) := by
intro n x hn₀ hn₁
rw [h₁ n x hn₀] at hn₁
nth_rw 1 [← mul_one (f n x)] at hn₁
suffices g₀: 1 < f n x + 1 / ↑n
· exact sub_right_lt_of_lt_add g₀
· refine lt_of_mul_lt_mul_left hn₁ ?_
exact h₃ n x hn₀
have h₈: ∀ n x, 0 < n → 0 < x → 1 - 1 / n < f n x → f n x < f (n + 1) x := by
intro n x hn₀ hx₀ hn₁
rw [h₁ n x hn₀]
suffices g₀: 1 < f n x + 1 / ↑n
· nth_rw 1 [← mul_one (f n x)]
refine mul_lt_mul' ?_ g₀ ?_ ?_
· exact Preorder.le_refl (f n x)
· exact zero_le_one' ℝ
· exact lt_of_lt_of_le' (hmo₀ n hn₀ hx₀) (h₃ n 0 hn₀)
· exact lt_add_of_tsub_lt_right hn₁
have hbr₁: 0 < br := by
exact aux_10 f h₀ h₁ f₀ hf₂ fi hmo₇ sn sb fb (by rfl) hfb₀ hsb₀ fr (by rfl) sbr (by rfl) br hbr₀
have hu₅: br ≤ cr := by
exact aux_11 sn fb fc hfc₂ hfb₃ hfc₃ sb sc hsb₀ hsc₀ fr
(by rfl) sbr scr (by rfl) (by rfl) br cr hbr₀ hcr₀
have hbr₃: ∀ x ∈ sbr, x ≤ br := by
refine mem_upperBounds.mp ?_
refine (isLUB_le_iff hbr₀).mp ?_
exact Preorder.le_refl br
have hcr₃: ∀ x ∈ scr, cr ≤ x := by
refine mem_lowerBounds.mp ?_
refine (le_isGLB_iff hcr₀).mp ?_
exact Preorder.le_refl cr
refine existsUnique_of_exists_of_unique ?_ ?_
· exact aux_exists f h₂ hmo₀ f₀ hf₁ sn (by rfl)
fb fc hfb₁ hfc₁ hfb₃ hfc₃ sb sc hsb₀ hsc₀
fr (by rfl) sbr scr (by rfl) (by rfl) br cr h₈ hbr₁ hu₅ hbr₃ hcr₃
· intro x y hx₀ hy₀
exact aux_unique f h₁ hmo₀ h₇ x y hx₀ hy₀
theorem imo_1985_p6
(f : ℕ → ℝ → ℝ)
(h₀ : ∀ x, f 1 x = x)
(h₁ : ∀ n x, 0 < n → f (n + 1) x = f n x * (f n x + 1 / n)) :
∃! a, ∀ n, 0 < n → 0 < f n a ∧ f n a < f (n + 1) a ∧ f (n + 1) a < 1 := by
let fn : ℕ → NNReal → ℝ := fun n x => f n x
have hfn₁: ∀ n x, 0 < n → 0 ≤ x → fn n x = f n x := by
exact fun n x a a ↦ rfl
have h₂: ∃! a, ∀ (n : ℕ), 0 < n → 0 < fn n a ∧ fn n a < fn (n + 1) a ∧ fn (n + 1) a < 1 := by
exact imo_1985_p6_nnreal fn (fun x ↦ h₀ ↑x) fun n x ↦ h₁ n ↑x
obtain ⟨a, ha₀, ha₁⟩ := h₂
refine ⟨a, ha₀, fun y hy₀ ↦ ?_⟩
have hy₁: 0 ≤ y.toNNReal := by exact zero_le y.toNNReal
by_cases hy₂: 0 ≤ y
· refine (Real.toNNReal_eq_toNNReal_iff hy₂ ?_).mp ?_
· exact NNReal.zero_le_coe
· rw [Real.toNNReal_coe]
refine ha₁ y.toNNReal ?_
intro n hn₀
rw [hfn₁ n _ hn₀ hy₁, hfn₁ (n + 1) _ (by omega) hy₁]
rw [Real.coe_toNNReal y hy₂]
exact hy₀ n hn₀
· exfalso
push_neg at hy₂
have hy₃: f 1 y < 0 := by
rw [h₀]
exact hy₂
have hy₄: 0 < f 1 y := by
exact (hy₀ 1 (by decide)).1
order
end Imo1985P6 | /- | /-
Copyright (c) 2025 Roozbeh Yousefzadeh. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1985, Problem 6
For every real number x_1, construct the sequence {x_1,x_2, ...}
by setting x_{n+1} = x_n * (x_n + 1 / n) for each n >= 1.
Prove that there exists exactly one value of x_1 for which
0 < x_n , x_n < x_{n+1}, and x_{n+1} < 1 for every n.
-/
namespace Imo1985P6
lemma aux_1
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ x, f 1 x = x)
(h₁ : ∀ n x, 0 < n → f (n + 1) x = f n x * (f n x + 1 / n)) :
∀ n x, 0 < n ∧ 0 < x → 0 < f n x := by
rintro n x ⟨hn, hx⟩
induction n, hn using Nat.le_induction with
| base =>
rw [h₀]
exact hx
| succ m hm ih =>
rw [h₁ m x (Nat.zero_lt_of_lt hm)]
positivity
lemma aux_2
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ x, f 1 x = x)
(h₁ : ∀ n x, 0 < n → f (n + 1) x = f n x * (f n x + 1 / n))
(h₃ : ∀ n x, 0 < n → 0 ≤ f n x) :
∀ n x y, 0 < n → x < y → f n x < f n y := by
intro n x y hn hxy
induction n using Nat.strong_induction_on with
| h n ih =>
cases n with
| zero => exact absurd hn (Nat.lt_irrefl _)
| succ n =>
cases n with
| zero => simpa [h₀] using hxy
| succ n =>
have pos_n : 0 < n.succ := Nat.succ_pos _
have IH := ih n.succ (Nat.lt_succ_self _) pos_n
rw [h₁ n.succ x pos_n, h₁ n.succ y pos_n]
refine mul_lt_mul IH ?_ ?_ ?_
· apply add_le_add (le_of_lt IH) le_rfl
· exact add_pos_of_nonneg_of_pos (h₃ _ _ pos_n) (by positivity)
· exact h₃ _ _ pos_n
lemma aux_3
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ (x : NNReal), f 1 x = ↑x)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(h₄ : ∀ (n : ℕ) (x y : NNReal), 0 < n → x < y → f n x < f n y) :
∀ (n : ℕ) (x : NNReal), 1 < n ∧ 1 ≤ x → 1 < f n x := by
intro n x hx₀
obtain ⟨hn₀, hx₁⟩ := hx₀
have g₂₀: f n 1 ≤ f n x := by
obtain hx_gt | hx_eq := lt_or_eq_of_le hx₁
· exact le_of_lt (h₄ n 1 x (Nat.zero_lt_of_lt hn₀) hx_gt)
· rw [hx_eq]
have g₂₁: f 1 1 < f n 1 := by
rw [h₀]
refine Nat.le_induction ?_ ?_ n hn₀
· rw [h₁ 1 1 (by norm_num), h₀]
norm_num
· intro m hm₀ hm₁
rw [h₁ m 1 (by omega)]
refine one_lt_mul_of_lt_of_le hm₁ ?_
nth_rw 1 [← add_zero 1]
refine add_le_add ?_ ?_
· exact le_of_lt hm₁
· exact Nat.one_div_cast_nonneg m
refine lt_of_lt_of_le ?_ g₂₀
exact (lt_iff_lt_of_cmp_eq_cmp (congrFun (congrArg cmp (h₀ 1)) (f n 1))).mp g₂₁
lemma aux_4
(f : ℕ → NNReal → ℝ)
(h₃ : ∀ (n : ℕ) (x : NNReal), 0 < n → 0 ≤ f n x)
(h₄ : ∀ (n : ℕ) (x y : NNReal), 0 < n → x < y → f n x < f n y)
(f₀ : ℕ → NNReal → NNReal)
(hf₀ : f₀ = fun n x => (f n x).toNNReal) :
∀ (n : ℕ), 0 < n → StrictMono (f₀ n) := by
intro n hn x y hxy
rw [hf₀]
exact (Real.toNNReal_lt_toNNReal_iff_of_nonneg (h₃ n x hn)).mpr (h₄ n x y hn hxy)
lemma aux_5
(f : ℕ → NNReal → ℝ)
(hmo₁ : ∀ (n : ℕ), 0 < n → Function.Injective (f n))
(f₀ : ℕ → NNReal → NNReal)
(hmo₂ : ∀ (n : ℕ), 0 < n → StrictMono (f₀ n))
(fi : ℕ → NNReal → NNReal)
(hfi : fi = fun n => Function.invFun (f₀ n)) :
∀ (n : ℕ) (x y : NNReal), 0 < n → f₀ n x = y → fi n y = x := by
intro n x y hn₀ hn₁
have hf₃: ∀ n y, fi n y = Function.invFun (f₀ n) y := by
exact fun n y => congrFun (congrFun hfi n) y
rw [← hn₁, hf₃]
have hmo₃: ∀ n, 0 < n → Function.Injective (f₀ n) := by
exact fun n a => StrictMono.injective (hmo₂ n a)
have hn₂: (Function.invFun (f₀ n)) ∘ (f₀ n) = id := by exact Function.invFun_comp (hmo₃ n hn₀)
rw [Function.comp_def (Function.invFun (f₀ n)) (f₀ n)] at hn₂
have hn₃ : (fun x => Function.invFun (f₀ n) (f₀ n x)) x = id x :=
(NNReal.eq (congrArg NNReal.toReal (congrFun hn₂.symm x))).symm
exact hmo₁ n hn₀ (congrArg (f n) hn₃)
lemma aux_6
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ (x : NNReal), f 1 x = ↑x)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(f₀ : ℕ → NNReal → NNReal)
(hf₀ : f₀ = fun n x => (f n x).toNNReal) :
∀ (n : ℕ), 0 < n → Continuous (f₀ n) := by
intro n hn₀
rw [hf₀]
apply Continuous.comp continuous_real_toNNReal
induction n, hn₀ using Nat.le_induction with
| base =>
have : f 1 = fun x => ↑x := funext h₀
rw [this]
exact NNReal.continuous_coe
| succ d hd_pos hd_cont =>
have : f (d + 1) = fun x => f d x * (f d x + 1 / d) := funext (h₁ d · hd_pos)
rw [this]
fun_prop
lemma aux_7
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ (x : NNReal), f 1 x = ↑x)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(h₃ : ∀ (n : ℕ) (x : NNReal), 0 < n → 0 ≤ f n x)
(h₅ : ∀ (n : ℕ) (x : NNReal), 1 < n ∧ 1 ≤ x → 1 < f n x)
(f₀ : ℕ → NNReal → NNReal)
(hf₂ : ∀ (n : ℕ) (x : NNReal), 0 < n → f₀ n x = (f n x).toNNReal)
(hmo₂ : ∀ (n : ℕ), 0 < n → StrictMono (f₀ n))
(hmo₄ : ∀ (n : ℕ), 0 < n → Continuous (f₀ n)) :
∀ (n : ℕ), 0 < n → Function.Surjective (f₀ n) := by
intro n hn₀
refine Continuous.surjective (hmo₄ n hn₀) ?_ ?_
· refine Monotone.tendsto_atTop_atTop ?_ ?_
· exact StrictMono.monotone (hmo₂ n hn₀)
· intro b
use (b + 1)
refine Nat.le_induction ?_ ?_ n hn₀
· rw [hf₂ 1 (b + 1) (by omega), h₀]
simp
· intro d hd₀ hd₁
rw [hf₂ (d + 1) (b + 1) (by omega), h₁ d (b + 1) (by omega)]
have hd₂: b ≤ f d (b + 1) := by
rw [hf₂ d (b + 1) (by omega)] at hd₁
exact (Real.le_toNNReal_iff_coe_le (h₃ d (b + 1) hd₀)).mp hd₁
have hd₃: 1 < (f d (b + 1) + 1 / ↑d) := by
by_cases hd₄: 1 < d
· refine lt_add_of_lt_of_pos ?_ ?_
· exact h₅ d (b + 1) ⟨hd₄, le_add_self⟩
· positivity
· have hd₅: d = 1 := by omega
rw [hd₅, h₀]
simp
positivity
refine NNReal.le_toNNReal_of_coe_le ?_
nth_rw 1 [← mul_one (↑b:ℝ)]
refine mul_le_mul hd₂ (le_of_lt hd₃) zero_le_one ?_
exact h₃ d (b + 1) hd₀
· refine Filter.tendsto_atBot_atBot.mpr ?_
intro b
use 0
intro a ha₀
have ha₁: a = 0 := nonpos_iff_eq_zero.mp ha₀
have ha₂: f₀ n 0 = 0 := by
refine Nat.le_induction ?_ ?_ n hn₀
· rw [hf₂ 1 0 (by omega), h₀]
exact Real.toNNReal_coe
· intro d hd₀ hd₁
rw [hf₂ (d + 1) 0 (by omega), h₁ d 0 (by omega)]
have hd₂: 0 ≤ f d 0 := by exact h₃ d 0 hd₀
have hd₃: f d 0 = 0 := by
rw [hf₂ d 0 (by omega)] at hd₁
apply Real.toNNReal_eq_zero.mp at hd₁
exact eq_of_le_of_ge hd₁ hd₂
rw [hd₃, zero_mul]
exact Real.toNNReal_zero
rw [ha₁, ha₂]
exact _root_.zero_le b
lemma aux_8
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ (x : NNReal), f 1 x = ↑x)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(hmo₀ : ∀ (n : ℕ), 0 < n → StrictMono (f n))
(hmo₁ : ∀ (n : ℕ), 0 < n → Function.Injective (f n))
(f₀ : ℕ → NNReal → NNReal)
(hf₂ : ∀ (n : ℕ) (x : NNReal), 0 < n → f₀ n x = (f n x).toNNReal)
(sn : Set ℕ)
(fb : ↑sn → NNReal)
(hsn₁ : ∀ (n : ↑sn), ↑n ∈ sn ∧ 0 < n.1)
(hfb₁ : ∀ (n : ↑sn), f₀ (↑n) (fb n) = 1 - 1 / ↑↑n) :
∀ (n : ↑sn), fb n < 1 := by
intro n
have hn₀: 0 < (n:ℕ) := by exact (hsn₁ n).2
let z := fb n
have hz₀: z = fb n := by rfl
rw [← hz₀]
by_contra! hc₀
have hc₁: 1 ≤ f n z := by
by_cases hn₁: 1 < (n:ℕ)
· refine le_of_lt ?_
refine aux_3 f h₀ h₁ ?_ (↑n) z ?_
· exact fun n x y a a_1 => hmo₀ n a a_1
· exact ⟨hn₁, hc₀⟩
· have hn₂: (n:ℕ) = 1 := by omega
rw [hn₂, h₀]
exact hc₀
have hz₁: f₀ n z = 1 - 1 / n := by
exact hfb₁ n
have hz₃: f n z = 1 - 1 / n := by
rw [hf₂ n z hn₀] at hz₁
by_cases hn₁: 1 < (n:ℕ)
· have hz₂: 1 - 1 / (n:NNReal) ≠ 0 := by
have g₀: (n:NNReal) ≠ 0 := by
norm_cast
omega
nth_rw 1 [← div_self g₀, ← NNReal.sub_div]
refine div_ne_zero ?_ g₀
norm_cast
exact Nat.sub_ne_zero_iff_lt.mpr hn₁
apply (Real.toNNReal_eq_iff_eq_coe hz₂).mp at hz₁
rw [hz₁]
exact ((fun {r} {p:NNReal} hp =>
(Real.toNNReal_eq_iff_eq_coe hp).mp) hz₂ (hmo₁ n hn₀ rfl)).symm
· have hn₂: (n:ℕ) = 1 := by omega
rw [hn₂, h₀] at hz₁
simp at hz₁
rw [hn₂, h₀, hz₁]
simp
rw [hz₃] at hc₁
have hz₄: 0 < 1 / (n:ℝ) := by
refine div_pos zero_lt_one ?_
exact Nat.cast_pos'.mpr hn₀
linarith
lemma aux_9
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ (x : NNReal), f 1 x = ↑x)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(f₀ : ℕ → NNReal → NNReal)
(hf₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f n x = ↑(f₀ n x))
(hf₂ : ∀ (n : ℕ) (x : NNReal), 0 < n → f₀ n x = (f n x).toNNReal)
(hmo₂ : ∀ (n : ℕ), 0 < n → StrictMono (f₀ n))
(fi : ℕ → NNReal → NNReal)
(hf₅ : ∀ (x : NNReal), fi 1 x = x)
(hmo₇ : ∀ (n : ℕ), 0 < n → Function.RightInverse (fi n) (f₀ n))
(hf₇ : ∀ (n : ℕ) (x y : NNReal), 0 < n → (f₀ n x = y ↔ fi n y = x))
(fb : ℕ → NNReal)
(hfb₀ : fb = fun n => fi n (1 - 1 / ↑n))
(sn : Set ℕ)
(hsn : sn = Set.Ici 1) :
StrictMonoOn fb sn := by
rw [hsn]
refine strictMonoOn_Ici_of_pred_lt ?hψ
intro m hm₀
rw [hfb₀]
refine Nat.le_induction ?_ ?_ m hm₀
· have g₁: fi 1 0 = 0 := by exact hf₅ 0
have g₂: (2:NNReal).HolderConjugate (2:NNReal) := NNReal.HolderConjugate.two_two
simp
norm_cast
rw [g₁, NNReal.HolderConjugate.one_sub_inv g₂]
let x := fi 2 2⁻¹
have hx₀: x = fi 2 2⁻¹ := by rfl
have hx₁: f₀ 2 x = 2⁻¹ := by
rw [hx₀]
have g₃: Function.RightInverse (fi 2) (f₀ 2) := by exact hmo₇ 2 (by omega)
exact g₃ 2⁻¹
rw [← hx₀]
contrapose! hx₁
have hc₁: x = 0 := by exact nonpos_iff_eq_zero.mp hx₁
have hc₃: f₀ 2 x = 0 := by
rw [hc₁, hf₂ 2 0 (by omega), h₁ 1 0 (by omega), h₀ 0]
norm_cast
rw [zero_mul]
exact Real.toNNReal_zero
rw [hc₃]
exact Ne.symm (NNReal.HolderTriple.inv_ne_zero g₂)
· simp
intro n hn₀ _
let i := fi n (1 - (↑n)⁻¹)
let j := fi (n + 1) (1 - ((↑n:NNReal) + 1)⁻¹)
have hi₀: i = fi n (1 - (↑n)⁻¹) := by rfl
have hj₀: j = fi (n + 1) (1 - ((↑n:NNReal) + 1)⁻¹) := by rfl
have hi₁: f₀ n i = (1 - (↑n)⁻¹) := (hf₇ n i (1 - (↑n:NNReal)⁻¹) (by omega)).mpr hi₀.symm
have hj₁: f₀ (n + 1) j = (1 - ((↑n:NNReal) + 1)⁻¹) := by
exact (hf₇ (n + 1) j _ (by omega)).mpr hj₀.symm
have hj₂: (1 - ((↑n:NNReal) + 1)⁻¹) = (1 - ((n:ℝ) + 1)⁻¹).toNNReal := by
exact rfl
have hn₂: f₀ (n + 1) i < f₀ (n + 1) j := by
rw [hj₁, hj₂, hf₂ (n + 1) _ (by omega), h₁ n i (by omega)]
rw [hf₁ n i (by omega), hi₁]
refine (Real.toNNReal_lt_toNNReal_iff ?_).mpr ?_
· refine sub_pos.mpr ?_
refine inv_lt_one_of_one_lt₀ ?_
norm_cast
exact Nat.lt_add_right 1 hn₀
· have g₀: (↑n:NNReal)⁻¹ ≤ 1 := by exact Nat.cast_inv_le_one n
rw [NNReal.coe_sub g₀, NNReal.coe_inv]
simp
refine inv_strictAnti₀ ?_ ?_
· positivity
· norm_cast
exact lt_add_one n
refine (StrictMono.lt_iff_lt ?_).mp hn₂
exact hmo₂ (n + 1) (by omega)
lemma aux_10
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ (x : NNReal), f 1 x = ↑x)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(f₀ : ℕ → NNReal → NNReal)
(hf₂ : ∀ (n : ℕ) (x : NNReal), 0 < n → f₀ n x = (f n x).toNNReal)
(fi : ℕ → NNReal → NNReal)
(hmo₇ : ∀ (n : ℕ), 0 < n → Function.RightInverse (fi n) (f₀ n))
(sn : Set ℕ)
(sb : Set NNReal)
(fb : ↑sn → NNReal)
(hsn₀ : sn = Set.Ici 1)
(hfb₀ : fb = fun n:↑sn => fi (↑n) (1 - 1 / ↑↑n))
(hsb₀ : sb = Set.range fb)
(fr : NNReal → ℝ)
(hfr: fr = fun x => ↑x)
(sbr : Set ℝ)
(hsbr: sbr = fr '' sb)
(br: ℝ)
(hbr₀ : IsLUB sbr br) :
0 < br := by
have hnb₀: 2 ∈ sn := by
rw [hsn₀]
decide
let nb : ↑sn := ⟨2, hnb₀⟩
have g₀: 0 < fb nb := by
have g₁: (2:NNReal).HolderConjugate (2:NNReal) := NNReal.HolderConjugate.two_two
rw [hfb₀]
simp
have hnb₁: nb.val = 2 := by exact rfl
rw [hnb₁]
norm_cast
rw [NNReal.HolderConjugate.one_sub_inv g₁]
let x := fi 2 2⁻¹
have hx₀: x = fi 2 2⁻¹ := by rfl
have hx₁: f₀ 2 x = 2⁻¹ := by
rw [hx₀]
have g₃: Function.RightInverse (fi 2) (f₀ 2) := by exact hmo₇ 2 (by omega)
exact g₃ 2⁻¹
rw [← hx₀]
contrapose! hx₁
have hc₁: x = 0 := by exact nonpos_iff_eq_zero.mp hx₁
have hc₃: f₀ 2 x = 0 := by
rw [hc₁, hf₂ 2 0 (by omega), h₁ 1 0 (by omega), h₀ 0]
norm_cast
rw [zero_mul]
exact Real.toNNReal_zero
rw [hc₃]
exact Ne.symm (NNReal.HolderTriple.inv_ne_zero g₁)
have g₁: ∃ x, 0 < x ∧ x ∈ sbr := by
use (fb nb).toReal
constructor
· exact g₀
· rw [hsbr]
simp
use fb ↑nb
constructor
· rw [hsb₀]
exact Set.mem_range_self nb
· exact congrFun hfr (fb ↑nb)
obtain ⟨x, hx₀, hx₁⟩ := g₁
have hx₂: br ∈ upperBounds sbr := by
refine (isLUB_le_iff hbr₀).mp ?_
exact Preorder.le_refl br
exact lt_of_le_of_lt' (hx₂ hx₁) hx₀
lemma aux_11
(sn : Set ℕ)
(fb fc : ↑sn → NNReal)
(hfc₂ : ∀ (n : ↑sn), fb n < fc n)
(hfb₃ : StrictMono fb)
(hfc₃ : StrictAnti fc)
(sb sc : Set NNReal)
(hsb₀ : sb = Set.range fb)
(hsc₀ : sc = Set.range fc)
(fr : NNReal → ℝ)
(hfr : fr = fun x ↦ ↑x)
(sbr scr : Set ℝ)
(hsbr : sbr = fr '' sb)
(hscr : scr = fr '' sc)
(br cr : ℝ)
(hbr₀ : IsLUB sbr br)
(hcr₀ : IsGLB scr cr) :
br ≤ cr := by
have hfc₄: ∀ nb nc, fb nb < fc nc := by
intro nb nc
obtain hn₀ | hn₀ := lt_or_ge nb nc
· exact lt_trans (hfb₃ hn₀) (hfc₂ nc)
obtain hn₁ | hn₁ := lt_or_eq_of_le hn₀
· refine lt_trans (hfc₂ nb) ?_
exact hfc₃ hn₁
· rw [hn₁]
exact hfc₂ nb
by_contra! hc₀
have hc₁: ∃ x ∈ sbr, cr < x ∧ x ≤ br := by exact IsLUB.exists_between hbr₀ hc₀
let ⟨x, hx₀, hx₁, _⟩ := hc₁
have hc₂: ∃ y ∈ scr, cr ≤ y ∧ y < x := by exact IsGLB.exists_between hcr₀ hx₁
let ⟨y, hy₀, _, hy₂⟩ := hc₂
have hc₃: x < y := by
have hx₃: x.toNNReal ∈ sb := by
rw [hsbr] at hx₀
apply (Set.mem_image fr sb x).mp at hx₀
obtain ⟨z, hz₀, hz₁⟩ := hx₀
rw [← hz₁, hfr, Real.toNNReal_coe]
exact hz₀
have hy₃: y.toNNReal ∈ sc := by
rw [hscr] at hy₀
apply (Set.mem_image fr sc y).mp at hy₀
obtain ⟨z, hz₀, hz₁⟩ := hy₀
rw [← hz₁, hfr, Real.toNNReal_coe]
exact hz₀
rw [hsb₀] at hx₃
rw [hsc₀] at hy₃
apply Set.mem_range.mp at hx₃
apply Set.mem_range.mp at hy₃
let ⟨nx, hnx₀⟩ := hx₃
let ⟨ny, hny₀⟩ := hy₃
have hy₄: 0 < y := by
contrapose! hy₃
have hy₅: y.toNNReal = 0 := by exact Real.toNNReal_of_nonpos hy₃
intro z
rw [hy₅]
exact ne_zero_of_lt (hfc₂ z)
refine (Real.toNNReal_lt_toNNReal_iff hy₄).mp ?_
rw [← hnx₀, ← hny₀]
exact hfc₄ nx ny
refine (lt_self_iff_false x).mp ?_
exact lt_trans hc₃ hy₂
lemma aux_exists
(f : ℕ → NNReal → ℝ)
(h₂ : ∀ (n : ℕ) (x : NNReal), 0 < n ∧ 0 < x → 0 < f n x)
(hmo₀ : ∀ (n : ℕ), 0 < n → StrictMono (f n))
(f₀ : ℕ → NNReal → NNReal)
(hf₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f n x = ↑(f₀ n x))
(sn : Set ℕ)
(hsn₀ : sn = Set.Ici 1)
(fb fc : ↑sn → NNReal)
(hfb₁ : ∀ (n : ↑sn), f₀ (↑n) (fb n) = 1 - 1 / ↑↑n)
(hfc₁ : ∀ (n : ↑sn), f₀ (↑n) (fc n) = 1)
(hfb₃ : StrictMono fb)
(hfc₃ : StrictAnti fc)
(sb sc : Set NNReal)
(hsb₀ : sb = Set.range fb)
(hsc₀ : sc = Set.range fc)
(fr : NNReal → ℝ)
(hfr : fr = fun x => ↑x)
(sbr scr : Set ℝ)
(hsbr : sbr = fr '' sb)
(hscr : scr = fr '' sc)
(br cr : ℝ)
(h₈ : ∀ (n : ℕ) (x : NNReal), 0 < n → 0 < x → 1 - 1 / ↑n < f n x → f n x < f (n + 1) x)
(hbr₁ : 0 < br)
(hu₅ : br ≤ cr)
(hbr₃ : ∀ x ∈ sbr, x ≤ br)
(hcr₃ : ∀ x ∈ scr, cr ≤ x) :
∃ x, ∀ (n : ℕ), 0 < n → 0 < f n x ∧ f n x < f (n + 1) x ∧ f (n + 1) x < 1 := by
obtain hu₆ | hu₆ := lt_or_eq_of_le hu₅
· apply exists_between at hu₆
let ⟨a, ha₀, ha₁⟩ := hu₆
have ha₂: 0 < a := by exact gt_trans ha₀ hbr₁
have ha₃: 0 < a.toNNReal := by exact Real.toNNReal_pos.mpr ha₂
use a.toNNReal
intro n hn₀
have hn₁: n ∈ sn := by
rw [hsn₀]
exact hn₀
constructor
· exact h₂ n a.toNNReal ⟨hn₀, ha₃⟩
constructor
· refine h₈ n a.toNNReal hn₀ ?_ ?_
· exact Real.toNNReal_pos.mpr ha₂
· let nn : ↑sn := ⟨n, hn₁⟩
have hn₂: f n (fb nn) = 1 - 1 / n := by
rw [hf₁ n _ hn₀, hfb₁ nn]
refine NNReal.coe_sub ?_
refine div_le_self ?_ ?_
· exact zero_le_one' NNReal
· exact Nat.one_le_cast.mpr hn₀
rw [← hn₂]
refine hmo₀ n hn₀ ?_
refine Real.lt_toNNReal_iff_coe_lt.mpr ?_
refine lt_of_le_of_lt ?_ ha₀
refine hbr₃ _ ?_
rw [hsbr]
refine (Set.mem_image fr sb _).mpr ?_
use (fb nn)
rw [hfr, hsb₀]
refine ⟨?_, rfl⟩
exact Set.mem_range_self nn
· have hn₂: n + 1 ∈ sn := by
rw [hsn₀]
exact Set.mem_Ici.mpr (by omega)
let nn : ↑sn := ⟨n + 1, hn₂⟩
have hn₃: f (n + 1) (fc (nn)) = 1 := by
rw [hf₁ (n + 1) _ (by omega), hfc₁ nn]
exact rfl
rw [← hn₃]
refine hmo₀ (n + 1) (by omega) ?_
refine (Real.toNNReal_lt_iff_lt_coe (le_of_lt ha₂)).mpr ?_
refine lt_of_lt_of_le ha₁ ?_
refine hcr₃ _ ?_
rw [hscr]
refine (Set.mem_image fr sc _).mpr ?_
use (fc nn)
rw [hfr, hsc₀]
refine ⟨?_, rfl⟩
exact Set.mem_range_self nn
· use br.toNNReal
intro n hn₀
have hn₁: n ∈ sn := by
rw [hsn₀]
exact hn₀
constructor
· refine h₂ n br.toNNReal ⟨hn₀, ?_⟩
exact Real.toNNReal_pos.mpr hbr₁
constructor
· refine h₈ n br.toNNReal hn₀ ?_ ?_
· exact Real.toNNReal_pos.mpr hbr₁
· let nn : ↑sn := ⟨n, hn₁⟩
have hn₂: fb nn < br := by
by_contra! hc₀
have hbr₅: (fb nn) = br := by
refine eq_of_le_of_ge ?_ hc₀
refine hbr₃ _ ?_
rw [hsbr]
refine (Set.mem_image fr sb _).mpr ?_
use (fb nn)
rw [hfr, hsb₀]
exact ⟨Set.mem_range_self nn, rfl⟩
have hn₂: n + 1 ∈ sn := by
rw [hsn₀]
refine Set.mem_Ici.mpr ?_
exact Nat.le_add_right_of_le hn₀
let ns : ↑sn := ⟨n + 1, hn₂⟩
have hc₁: fb nn < fb ns := by
refine hfb₃ ?_
refine Subtype.mk_lt_mk.mpr ?_
exact lt_add_one n
have hbr₆: fb ns ≤ fb nn := by
refine NNReal.coe_le_coe.mp ?_
rw [hbr₅]
refine hbr₃ _ ?_
rw [hsbr]
refine (Set.mem_image fr sb _).mpr ?_
use (fb ns)
rw [hfr, hsb₀]
refine ⟨?_, rfl⟩
exact Set.mem_range_self ns
refine (lt_self_iff_false (fb nn)).mp ?_
exact lt_of_lt_of_le hc₁ hbr₆
have hn₃: f n (fb nn) = 1 - 1 / n := by
rw [hf₁ n _ hn₀, hfb₁ nn]
refine NNReal.coe_sub ?_
refine div_le_self ?_ ?_
· exact zero_le_one' NNReal
· exact Nat.one_le_cast.mpr hn₀
rw [← hn₃]
refine hmo₀ n hn₀ ?_
exact Real.lt_toNNReal_iff_coe_lt.mpr hn₂
· have hn₂: n + 1 ∈ sn := by
rw [hsn₀]
exact Set.mem_Ici.mpr (by omega)
let nn : ↑sn := ⟨n + 1, hn₂⟩
have hcr₁: 0 < cr := lt_of_le_of_lt' hu₅ hbr₁
have hn₃: f (n + 1) (fc (nn)) = 1 := by
rw [hf₁ (n + 1) _ (by omega), hfc₁ nn]
exact rfl
rw [← hn₃, hu₆]
refine hmo₀ (n + 1) (by omega) ?_
refine (Real.toNNReal_lt_iff_lt_coe (le_of_lt hcr₁)).mpr ?_
by_contra! hc₀
have hc₁: fc nn = cr := by
refine eq_of_le_of_ge hc₀ ?_
refine hcr₃ _ ?_
rw [hscr]
refine (Set.mem_image fr sc _).mpr ?_
use (fc nn)
rw [hfr, hsc₀]
refine ⟨?_, rfl⟩
exact Set.mem_range_self nn
have hn₄: n + 2 ∈ sn := by
rw [hsn₀]
refine Set.mem_Ici.mpr ?_
exact Nat.le_add_right_of_le hn₀
let ns : ↑sn := ⟨n + 2, hn₄⟩
have hn₅: fc ns < fc nn := by
refine hfc₃ ?_
refine Subtype.mk_lt_mk.mpr ?_
exact Nat.lt_add_one (n + 1)
have hc₂: fc nn ≤ fc ns := by
refine NNReal.coe_le_coe.mp ?_
rw [hc₁]
refine hcr₃ _ ?_
rw [hscr]
refine (Set.mem_image fr sc _).mpr ?_
use (fc ns)
rw [hfr, hsc₀]
refine ⟨?_, rfl⟩
exact Set.mem_range_self ns
refine (lt_self_iff_false (fc ns)).mp ?_
exact lt_of_lt_of_le hn₅ hc₂
lemma aux_unique_top_ind
(f : ℕ → NNReal → ℝ)
(sd : Set ℕ)
(hsd : sd = Set.Ici 2)
(fd : NNReal → NNReal → ↑sd → ℝ)
(hfd₁ : ∀ (y₁ y₂ : NNReal) (n : ↑sd), fd y₁ y₂ n = f (↑n) y₂ - f (↑n) y₁)
(hd₁ : ∀ (n : ↑sd) (a b : NNReal), a < b → 0 < fd a b n)
(a b : NNReal)
(ha₀ : a < b)
(hd₃ : ∀ (nd : ↑sd), nd.1 + (1 : ℕ) ∈ sd)
(hd₂ : ∀ (nd : ↑sd), fd a b nd * (2 - 1 / ↑↑nd) ≤ fd a b ⟨nd.1 + 1, hd₃ nd⟩)
(hi₀ : 2 ∈ sd)
(i : ↑sd)
(hi₁ : i = ⟨2, hi₀⟩) :
∀ (nd : ↑sd), fd a b i * (3 / 2) ^ (nd.1 - 2) ≤ fd a b nd := by
intro nd
rw [hfd₁ a b nd]
have hnd₀: 2 ≤ nd.1 := by
refine Set.mem_Ici.mp ?_
rw [← hsd]
exact nd.2
refine Nat.le_induction ?_ ?_ nd.1 hnd₀
· have hi₂: i.val = (2:ℕ) := by
simp_all only [Subtype.forall]
rw [hfd₁ a b i, hi₂]
simp
· simp
intro n hn₀ hn₁
have hn₂: n - 1 = n - 2 + 1 := by omega
have hn₃: n ∈ sd := by
rw [hsd]
exact hn₀
let nn : ↑sd := ⟨n, hn₃⟩
have hn₄: nn.1 + 1 ∈ sd := hd₃ nn
have hn₅: fd a b nn * (2 - 1 / ↑n) ≤ fd a b ⟨nn.1 + 1, hn₄⟩ := by exact hd₂ nn
rw [hfd₁ a b ⟨nn.1 + 1, hn₄⟩] at hn₅
have hn₆: f (↑nn + 1) b - f (↑nn + 1) a = f (n + 1) b - f (n + 1) a := by exact rfl
rw [hn₆] at hn₅
refine le_trans ?_ hn₅
rw [hn₂, pow_succ (3/2) (n - 2), ← mul_assoc (fd a b i)]
refine mul_le_mul ?_ ?_ (by norm_num1) ?_
· refine le_of_le_of_eq hn₁ ?_
rw [hfd₁]
· refine (div_le_iff₀ (two_pos)).mpr ?_
rw [sub_mul, one_div_mul_eq_div _ 2]
refine le_sub_iff_add_le.mpr ?_
refine le_sub_iff_add_le'.mp ?_
refine (div_le_iff₀ ?_).mpr ?_
· positivity
· ring_nf
exact Nat.ofNat_le_cast.mpr hn₀
· exact le_of_lt (hd₁ nn a b ha₀)
lemma aux_unique_top
(f : ℕ → NNReal → ℝ)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(h₇ : ∀ (n : ℕ) (x : NNReal), 0 < n → f n x < f (n + 1) x → 1 - 1 / ↑n < f n x)
(sd : Set ℕ)
(hsd : sd = Set.Ici 2)
(fd : NNReal → NNReal → ↑sd → ℝ)
(hfd₁ : ∀ (y₁ y₂ : NNReal) (n : ↑sd), fd y₁ y₂ n = f (↑n) y₂ - f (↑n) y₁)
(hd₁ : ∀ (n : ↑sd) (a b : NNReal), a < b → 0 < fd a b n) :
∀ (a b : NNReal),
a < b →
(∀ (n : ↑sd), f (↑n) a < f (↑n + 1) a ∧ f (↑n) b < f (↑n + 1) b)
→ Filter.Tendsto (fd a b) Filter.atTop Filter.atTop := by
intro a b ha₀ ha₁
have hd₀: ∀ (nd:↑sd), (nd.1 + 1) ∈ sd := by
intro nd
let t : ℕ := nd.1
have ht: t = nd.1 := by rfl
rw [← ht, hsd]
refine Set.mem_Ici.mpr ?_
refine Nat.le_add_right_of_le ?_
refine Set.mem_Ici.mp ?_
rw [ht, ← hsd]
exact nd.2
have hd₂: ∀ nd, fd a b nd * (2 - 1 / nd.1) ≤ fd a b ⟨nd.1 + 1, hd₀ nd⟩ := by
intro nd
have hnd₀: 0 < nd.1 := by
have g₀: 2 ≤ nd.1 := by
refine Set.mem_Ici.mp ?_
rw [← hsd]
exact nd.2
exact Nat.zero_lt_of_lt g₀
rw [hfd₁, hfd₁, h₁ nd.1 _ hnd₀, h₁ nd.1 _ hnd₀]
have hnd₁: f (↑nd) b * (f (↑nd) b + 1 / ↑↑nd) - f (↑nd) a * (f (↑nd) a + 1 / ↑↑nd) =
(f (↑nd) b - f (↑nd) a) * (f (↑nd) b + f (↑nd) a + 1 / nd.1) := by
ring_nf
rw [hnd₁]
refine (mul_le_mul_iff_right₀ ?_).mpr ?_
· rw [← hfd₁]
exact hd₁ nd a b ha₀
· refine le_sub_iff_add_le.mp ?_
rw [sub_neg_eq_add]
have hnd₂: 1 - 1 / nd.1 < f (↑nd) b := by
exact h₇ nd.1 b hnd₀ (ha₁ nd).2
have hnd₃: 1 - 1 / nd.1 < f (↑nd) a := by
exact h₇ nd.1 a hnd₀ (ha₁ nd).1
linarith
have hi: 2 ∈ sd := by
rw [hsd]
decide
let i : ↑sd := ⟨(2:ℕ), hi⟩
have hd₃: ∀ nd, fd a b i * (3 / 2) ^ (nd.1 - 2) ≤ fd a b nd := by
intro nd
exact aux_unique_top_ind f sd hsd fd hfd₁ hd₁ a b ha₀ hd₀ hd₂ hi i rfl nd
have hsd₁: Nonempty ↑sd := Nonempty.intro i
refine Filter.tendsto_atTop_atTop.mpr ?_
intro z
by_cases hz₀: z ≤ fd a b i
· use i
intro j _
refine le_trans hz₀ ?_
refine le_trans ?_ (hd₃ j)
refine le_mul_of_one_le_right ?_ ?_
· refine le_of_lt ?_
exact hd₁ i a b ha₀
· refine one_le_pow₀ ?_
norm_num
· push_neg at hz₀
have hz₁: 0 < fd a b i := by exact hd₁ i a b ha₀
have hz₂: 0 < Real.log (z / fd a b i) := by
refine Real.log_pos ?_
exact (one_lt_div hz₁).mpr hz₀
let j : ℕ := Nat.ceil (2 + Real.log (z / fd a b i) / Real.log (3 / 2))
have hj₀: 2 < j := by
refine Nat.lt_ceil.mpr ?_
norm_cast
refine lt_add_of_pos_right 2 ?_
refine div_pos ?_ ?_
· exact hz₂
· positivity
have hj₁: j ∈ sd := by
rw [hsd]
exact Set.mem_Ici_of_Ioi hj₀
use ⟨j, hj₁⟩
intro k hk₀
have hk₁: fd a b i * (3 / 2) ^ (k.1 - 2) ≤ fd a b k := by
exact hd₃ k
have hk₂: i < k := lt_of_lt_of_le hj₀ hk₀
refine le_trans ?_ hk₁
refine (div_le_iff₀' ?_).mp ?_
· exact hz₁
· refine Real.le_pow_of_log_le (by norm_num1) ?_
refine (div_le_iff₀ ?_).mp ?_
· positivity
· rw [Nat.cast_sub ?_]
· rw [Nat.cast_two]
refine le_sub_iff_add_le'.mpr ?_
exact Nat.le_of_ceil_le hk₀
· exact Nat.le_of_succ_le hk₂
lemma aux_unique_nhds
(f : ℕ → NNReal → ℝ)
(sd : Set ℕ)
(hsd : sd = Set.Ici 2)
(fd : NNReal → NNReal → ↑sd → ℝ)
(hfd₁ : ∀ (y₁ y₂ : NNReal) (n : ↑sd), fd y₁ y₂ n = f (↑n) y₂ - f (↑n) y₁)
(hd₁ : ∀ (n : ↑sd) (a b : NNReal), a < b → 0 < fd a b n) :
∀ (a b : NNReal),
a < b →
(∀ (n : ↑sd),
(1 - 1 / ↑↑n < f (↑n) a ∧ 1 - 1 / ↑↑n < f (↑n) b) ∧ f (↑n) a < 1 ∧ f (↑n) b < 1) →
Filter.Tendsto (fd a b) Filter.atTop (nhds 0) := by
intro a b ha₀ ha₁
have hsd₁: Nonempty ↑sd := by
rw [hsd]
exact Set.nonempty_Ici_subtype
refine tendsto_atTop_nhds.mpr ?_
intro U hU₀ hU₁
have hU₂: U ∈ nhds 0 := by exact IsOpen.mem_nhds hU₁ hU₀
apply mem_nhds_iff_exists_Ioo_subset.mp at hU₂
obtain ⟨l, u, hl₀, hl₁⟩ := hU₂
have hl₂: 0 < u := by exact (Set.mem_Ioo.mpr hl₀).2
let nd := 2 + Nat.ceil (1/u)
have hnd₀: nd ∈ sd := by
rw [hsd]
refine Set.mem_Ici.mpr ?_
exact Nat.le_add_right 2 ⌈1 / u⌉₊
use ⟨nd, hnd₀⟩
intro n hn₀
refine (IsOpen.mem_nhds_iff hU₁).mp ?_
refine mem_nhds_iff.mpr ?_
use Set.Ioo l u
refine ⟨hl₁, isOpen_Ioo, Set.mem_Ioo.mpr ?_⟩
constructor
· refine lt_trans ?_ (hd₁ n a b ha₀)
exact (Set.mem_Ioo.mp hl₀).1
· have hn₁: fd a b n < 1 / n := by
rw [hfd₁]
have ha₂: 1 - 1 / n < f n a := by exact (ha₁ n).1.1
have hb₁: f n b < 1 := by exact (ha₁ n).2.2
refine sub_lt_iff_lt_add.mpr ?_
refine lt_trans hb₁ ?_
exact sub_lt_iff_lt_add'.mp ha₂
have hn₂: (1:ℝ) / n ≤ 1 / nd := by
refine one_div_le_one_div_of_le ?_ ?_
· positivity
· exact Nat.cast_le.mpr hn₀
refine lt_of_lt_of_le hn₁ ?_
refine le_trans hn₂ ?_
refine div_le_of_le_mul₀ ?_ ?_ ?_
· exact Nat.cast_nonneg' nd
· exact le_of_lt hl₂
· have hl₃: u * (2 + 1 / u) ≤ u * ↑((2:ℕ) + ⌈(1:ℝ) / u⌉₊) := by
refine (mul_le_mul_iff_right₀ hl₂).mpr ?_
rw [Nat.cast_add 2 _, Nat.cast_two]
refine add_le_add_right ?_ 2
exact Nat.le_ceil (1 / u)
refine le_trans ?_ hl₃
rw [mul_add, mul_one_div u u, div_self (ne_of_gt hl₂)]
refine le_of_lt ?_
refine sub_lt_iff_lt_add.mp ?_
rw [sub_self 1]
exact mul_pos hl₂ two_pos
lemma aux_unique
(f : ℕ → NNReal → ℝ)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(hmo₀ : ∀ (n : ℕ), 0 < n → StrictMono (f n))
(h₇ : ∀ (n : ℕ) (x : NNReal), 0 < n → f n x < f (n + 1) x → 1 - 1 / ↑n < f n x) :
∀ (y₁ y₂ : NNReal),
(∀ (n : ℕ), 0 < n → 0 < f n y₁ ∧ f n y₁ < f (n + 1) y₁ ∧ f (n + 1) y₁ < 1) →
(∀ (n : ℕ), 0 < n → 0 < f n y₂ ∧ f n y₂ < f (n + 1) y₂ ∧ f (n + 1) y₂ < 1) → y₁ = y₂ := by
intro x y hx₀ hy₀
let sd : Set ℕ := Set.Ici 2
let fd : NNReal → NNReal → ↑sd → ℝ := fun y₁ y₂ n => (f n.1 y₂ - f n.1 y₁)
have hfd₁: ∀ y₁ y₂ n, fd y₁ y₂ n = f n.1 y₂ - f n.1 y₁ := by exact fun y₁ y₂ n => rfl
have hd₁: ∀ n a b, a < b → 0 < fd a b n := by
intro nd a b hnd₀
rw [hfd₁]
refine sub_pos.mpr ?_
refine hmo₀ nd.1 ?_ hnd₀
exact lt_of_lt_of_le (Nat.zero_lt_two) nd.2
have hfd₂: ∀ a b, a < b → (∀ n:↑sd, f n.1 a < f (n.1 + 1) a ∧ f n.1 b < f (n.1 + 1) b)
→ Filter.Tendsto (fd a b) Filter.atTop Filter.atTop := by
intro a b ha₀ ha₁
exact aux_unique_top f h₁ h₇ sd rfl fd hfd₁ hd₁ a b ha₀ ha₁
have hfd₃: ∀ a b, a < b →
(∀ (n:↑sd), (1 - 1 / n.1 < f n.1 a ∧ 1 - 1 / n.1 < f n.1 b) ∧ (f n.1 a < 1 ∧ f n.1 b < 1))
→ Filter.Tendsto (fd a b) Filter.atTop (nhds 0) := by
intro a b ha₀ ha₁
exact aux_unique_nhds f sd rfl fd hfd₁ hd₁ a b ha₀ ha₁
by_contra! hc₀
by_cases hy₁: x < y
· have hy₂: Filter.Tendsto (fd x y) Filter.atTop Filter.atTop := by
refine hfd₂ x y hy₁ ?_
intro nd
have hnd₀: 0 < nd.1 := by exact lt_of_lt_of_le (two_pos) nd.2
constructor
· exact (hx₀ nd.1 hnd₀).2.1
· exact (hy₀ nd.1 hnd₀).2.1
have hy₃: Filter.Tendsto (fd x y) Filter.atTop (nhds 0) := by
refine hfd₃ x y hy₁ ?_
intro nd
have hnd₀: 0 < nd.1 := by
refine lt_of_lt_of_le ?_ nd.2
exact Nat.zero_lt_two
have hnd₁: nd.1 - 1 + 1 = nd.1 := by exact Nat.sub_add_cancel hnd₀
have hnd₂: 0 < nd.1 - 1 := by
refine Nat.sub_pos_of_lt ?_
refine lt_of_lt_of_le ?_ nd.2
exact Nat.one_lt_two
constructor
· constructor
· refine h₇ nd.1 x hnd₀ ?_
exact (hx₀ (nd.1) hnd₀).2.1
· refine h₇ nd.1 y hnd₀ ?_
exact (hy₀ (nd.1) hnd₀).2.1
· constructor
· rw [← hnd₁]
exact (hx₀ (nd.1 - 1) hnd₂).2.2
· rw [← hnd₁]
exact (hy₀ (nd.1 - 1) hnd₂).2.2
apply Filter.tendsto_atTop_atTop.mp at hy₂
apply tendsto_atTop_nhds.mp at hy₃
contrapose! hy₃
clear hy₃
let sx : Set ℝ := Set.Ioo (-1) 1
use sx
constructor
· refine Set.mem_Ioo.mpr ?_
simp
constructor
· exact isOpen_Ioo
· intro N
have hy₅: ∃ i, ∀ (a : ↑sd), i ≤ a → N + 3 ≤ fd x y a := by exact hy₂ (N + 3)
obtain ⟨i, hi₀⟩ := hy₅
have hi₁: (N.1 + i.1) ∈ sd := by
refine Set.mem_Ici.mpr ?_
rw [← add_zero 2]
exact Nat.add_le_add N.2 (Nat.zero_le ↑i)
let a : ↑sd := ⟨N + i, hi₁⟩
use a
constructor
· refine Subtype.mk_le_mk.mpr ?_
exact Nat.le_add_right ↑N ↑i
· refine Set.notMem_Ioo_of_ge ?_
have hi₂: ↑↑N + 3 ≤ fd x y a := by
refine hi₀ a ?_
refine Subtype.mk_le_mk.mpr ?_
exact Nat.le_add_left ↑i ↑N
refine le_trans ?_ hi₂
norm_cast
exact Nat.le_add_left 1 (↑N + 2)
· have hy₂: y < x := by
push_neg at hy₁
exact lt_of_le_of_ne hy₁ hc₀.symm
have hy₃: Filter.Tendsto (fd y x) Filter.atTop Filter.atTop := by
refine hfd₂ y x hy₂ ?_
intro nd
have hnd₀: 0 < nd.1 := by exact lt_of_lt_of_le (two_pos) nd.2
constructor
· exact (hy₀ nd.1 hnd₀).2.1
· exact (hx₀ nd.1 hnd₀).2.1
have hy₄: Filter.Tendsto (fd y x) Filter.atTop (nhds 0) := by
refine hfd₃ y x hy₂ ?_
intro nd
have hnd₀: 0 < nd.1 := by exact lt_of_lt_of_le (Nat.zero_lt_two) nd.2
have hnd₁: nd.1 - 1 + 1 = nd.1 := by exact Nat.sub_add_cancel hnd₀
have hnd₂: 0 < nd.1 - 1 := by
refine Nat.sub_pos_of_lt ?_
exact lt_of_lt_of_le (Nat.one_lt_two) nd.2
constructor
· constructor
· refine h₇ nd.1 y hnd₀ ?_
exact (hy₀ (nd.1) hnd₀).2.1
· refine h₇ nd.1 x hnd₀ ?_
exact (hx₀ (nd.1) hnd₀).2.1
· constructor
· rw [← hnd₁]
exact (hy₀ (nd.1 - 1) hnd₂).2.2
· rw [← hnd₁]
exact (hx₀ (nd.1 - 1) hnd₂).2.2
apply Filter.tendsto_atTop_atTop.mp at hy₃
apply tendsto_atTop_nhds.mp at hy₄
contrapose! hy₄
clear hy₄
let sx : Set ℝ := Set.Ioo (-1) 1
use sx
constructor
· refine Set.mem_Ioo.mpr ?_
simp
constructor
· exact isOpen_Ioo
· intro N
have hy₅: ∃ i, ∀ (a : ↑sd), i ≤ a → N + 3 ≤ fd y x a := by exact hy₃ (N + 3)
obtain ⟨i, hi₀⟩ := hy₅
have hi₁: (N.1 + i.1) ∈ sd := by
refine Set.mem_Ici.mpr ?_
rw [← add_zero 2]
exact Nat.add_le_add N.2 (Nat.zero_le ↑i)
let a : ↑sd := ⟨N + i, hi₁⟩
use a
constructor
· refine Subtype.mk_le_mk.mpr ?_
exact Nat.le_add_right ↑N ↑i
· refine Set.notMem_Ioo_of_ge ?_
have hi₂: ↑↑N + 3 ≤ fd y x a := by
refine hi₀ a ?_
refine Subtype.mk_le_mk.mpr ?_
exact Nat.le_add_left ↑i ↑N
refine le_trans ?_ hi₂
norm_cast
exact Nat.le_add_left 1 (↑N + 2)
lemma imo_1985_p6_nnreal
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ x, f 1 x = x)
(h₁ : ∀ n x, 0 < n → f (n + 1) x = f n x * (f n x + 1 / n)) :
∃! a, ∀ n, 0 < n → 0 < f n a ∧ f n a < f (n + 1) a ∧ f (n + 1) a < 1 := by
have h₂: ∀ n x, 0 < n ∧ 0 < x → 0 < f n x := by
exact fun n x a => aux_1 f h₀ h₁ n x a
have h₃: ∀ n x, 0 < n → 0 ≤ f n x := by
intro n x hn
refine Nat.le_induction ?_ ?_ n hn
· rw [h₀ x]
exact NNReal.zero_le_coe
· intro d hd₀ hd₁
rw [h₁ d x hd₀]
positivity
have hmo₀: ∀ n, 0 < n → StrictMono (f n) := by
intro n hn₀
refine Monotone.strictMono_of_injective ?h₁ ?h₂
· refine monotone_iff_forall_lt.mpr ?h₁.a
intro a b hab
refine le_of_lt ?_
exact aux_2 f h₀ h₁ h₃ n a b hn₀ hab
· intro p q hpq
contrapose! hpq
apply lt_or_gt_of_ne at hpq
obtain hpq | hpq := hpq
· refine ne_of_lt ?_
exact aux_2 f h₀ h₁ h₃ n p q hn₀ hpq
· symm
refine ne_of_lt ?_
exact aux_2 f h₀ h₁ h₃ n q p hn₀ hpq
have hmo₁: ∀ n, 0 < n → Function.Injective (f n) := fun n a => StrictMono.injective (hmo₀ n a)
let f₀: ℕ → NNReal → NNReal := fun n x => (f n x).toNNReal
have hf₀: f₀ = fun n x => (f n x).toNNReal := by rfl
have hf₁: ∀ n x, 0 < n → f n x = f₀ n x := by
intro n x hn₀
rw [hf₀]
simp
exact h₃ n x hn₀
have hf₂: ∀ n x, 0 < n → f₀ n x = (f n x).toNNReal := by
intro n x _
rw [hf₀]
have hmo₂: ∀ n, 0 < n → StrictMono (f₀ n) := by
intro n hn₀
refine aux_4 f h₃ ?_ f₀ hf₀ n hn₀
exact fun n x y a a_1 => hmo₀ n a a_1
let fi : ℕ → NNReal → NNReal := fun n => Function.invFun (f₀ n)
have hmo₇: ∀ n, 0 < n → Function.RightInverse (fi n) (f₀ n) := by
intro n hn₀
refine Function.rightInverse_invFun ?_
have h₄: ∀ n x y, 0 < n → x < y → f n x < f n y := by
exact fun n x y a a_1 => aux_2 f h₀ h₁ h₃ n x y a a_1
refine aux_7 f h₀ h₁ h₃ ?_ f₀ hf₂ hmo₂ ?_ n hn₀
· exact fun n x a => aux_3 f h₀ h₁ h₄ n x a
· intro m hm₀
exact aux_6 f h₀ h₁ f₀ hf₀ m hm₀
have hf₇: ∀ n x y, 0 < n → (f₀ n x = y ↔ fi n y = x) := by
intro n x y hn₀
constructor
· intro hn₁
exact aux_5 f hmo₁ f₀ hmo₂ fi rfl n x y hn₀ hn₁
· intro hn₁
rw [← hn₁]
exact hmo₁ n hn₀ (congrArg (f n) (hmo₇ n hn₀ y))
let sn : Set ℕ := Set.Ici 1
let fb : ↑sn → NNReal := sn.restrict (fun (n:ℕ) => fi n (1 - 1 / (n:NNReal)))
let fc : ↑sn → NNReal := sn.restrict (fun (n:ℕ) => fi n 1)
have hsn₁: ∀ n:↑sn, ↑n ∈ sn ∧ 0 < (↑n:ℕ) := by
intro n
have hn₀: ↑n ∈ sn := by exact Subtype.coe_prop n
constructor
· exact Subtype.coe_prop n
· exact hn₀
have hfb₀: fb = fun (n:↑sn) => fi n (1 - 1 / (n:NNReal)) := by rfl
have hfc₀: fc = fun (n:↑sn) => fi n 1 := by rfl
have hfb₁: ∀ n:↑sn, f₀ n (fb n) = 1 - 1 / (n:NNReal) := by
intro n
have hn₀: 0 < (n:ℕ) := by exact (hsn₁ n).2
rw [hfb₀]
exact hmo₁ n hn₀ (congrArg (f n) (hmo₇ n hn₀ (1 - 1 / (n:NNReal))))
have hfc₁: ∀ n:↑sn, f₀ n (fc n) = 1 := by
intro n
have hn₀: 0 < (n:ℕ) := by exact (hsn₁ n).2
rw [hfc₀]
exact hmo₁ n hn₀ (congrArg (f n) (hmo₇ n hn₀ 1))
have hu₁: ∀ n:↑sn, fb n < 1 := by
exact aux_8 f h₀ h₁ hmo₀ hmo₁ f₀ hf₂ sn fb hsn₁ hfb₁
have hfc₂: ∀ n:↑sn, fb n < fc n := by
intro n
have hn₀: 0 < (n:ℕ) := by exact (hsn₁ n).2
have g₀: f₀ n (fb n) < f₀ n (fc n) := by
rw [hfb₁ n, hfc₁ n]
simp
exact (hsn₁ n).2
exact (StrictMono.lt_iff_lt (hmo₂ n hn₀)).mp g₀
have hfb₃: StrictMono fb := by
refine StrictMonoOn.restrict ?_
refine aux_9 f h₀ h₁ f₀ hf₁ hf₂ hmo₂ fi ?_ hmo₇ hf₇ _ (by rfl) sn (by rfl)
intro x
refine (hf₇ 1 x x (by omega)).mp ?_
rw [hf₂ 1 x (by omega), h₀]
exact Real.toNNReal_coe
have hfc₃: StrictAnti fc := by
have g₀: StrictAntiOn (fun n => fi n 1) sn := by
refine strictAntiOn_Ici_of_lt_pred ?_
intro m hm₀
have hm₁: 0 < m - 1 := by exact Nat.zero_lt_sub_of_lt hm₀
have hm₂: m = m - 1 + 1 := by rw [Nat.sub_add_cancel (le_of_lt hm₀)]
have hm₃: 0 < m := by exact Nat.zero_lt_of_lt hm₀
simp
let x := fi m 1
let y := fi (m - 1) 1
have hx₀: x = fi m 1 := by rfl
have hy₀: y = fi (m - 1) 1 := by rfl
have hx₁: f₀ m x = 1 := by exact (hf₇ m x 1 (by omega)).mpr hx₀.symm
have hy₁: f₀ (m - 1) y = 1 := by
exact (hf₇ (m - 1) y 1 hm₁).mpr hy₀.symm
have hy₂: f (m - 1) y = 1 := by
rw [hf₁ (m - 1) y hm₁, hy₁]
exact rfl
have hf: StrictMono (f m) := by exact hmo₀ m hm₃
refine (StrictMono.lt_iff_lt hf).mp ?_
rw [← hx₀, ← hy₀]
rw [hf₁ m x hm₃, hf₁ m y hm₃]
refine NNReal.coe_lt_coe.mpr ?_
rw [hx₁, hf₂ m y hm₃, hm₂, h₁ (m - 1) y hm₁, hy₂]
simp
exact hm₀
intro m n hmn
rw [hfc₀]
simp
let mn : ℕ := ↑m
let nn : ℕ := ↑n
have hm₀: mn ∈ sn := by exact Subtype.coe_prop m
have hn₀: nn ∈ sn := by exact Subtype.coe_prop n
exact g₀ hm₀ hn₀ hmn
let sb := Set.range fb
let sc := Set.range fc
have hsb₀: sb = Set.range fb := by rfl
have hsc₀: sc = Set.range fc := by rfl
let fr : NNReal → ℝ := fun x => x.toReal
let sbr := Set.image fr sb
let scr := Set.image fr sc
have hu₃: ∃ br, IsLUB sbr br := by
refine Real.exists_isLUB ?_ ?_
· exact Set.Nonempty.of_subtype
· refine NNReal.bddAbove_coe.mpr ?_
refine (bddAbove_iff_exists_ge 1).mpr ?_
use 1
constructor
· exact Preorder.le_refl 1
· intro y hy₀
apply Set.mem_range.mp at hy₀
obtain ⟨na, hna₀⟩ := hy₀
refine le_of_lt ?_
rw [← hna₀]
exact hu₁ na
have hu₄: ∃ cr, IsGLB scr cr := by
refine Real.exists_isGLB ?_ ?_
· exact Set.Nonempty.of_subtype
· exact NNReal.bddBelow_coe sc
obtain ⟨br, hbr₀⟩ := hu₃
obtain ⟨cr, hcr₀⟩ := hu₄
have h₇: ∀ n x, 0 < n → (f n x < f (n + 1) x → 1 - 1 / n < f n x) := by
intro n x hn₀ hn₁
rw [h₁ n x hn₀] at hn₁
nth_rw 1 [← mul_one (f n x)] at hn₁
suffices g₀: 1 < f n x + 1 / ↑n
· exact sub_right_lt_of_lt_add g₀
· refine lt_of_mul_lt_mul_left hn₁ ?_
exact h₃ n x hn₀
have h₈: ∀ n x, 0 < n → 0 < x → 1 - 1 / n < f n x → f n x < f (n + 1) x := by
intro n x hn₀ hx₀ hn₁
rw [h₁ n x hn₀]
suffices g₀: 1 < f n x + 1 / ↑n
· nth_rw 1 [← mul_one (f n x)]
refine mul_lt_mul' ?_ g₀ ?_ ?_
· exact Preorder.le_refl (f n x)
· exact zero_le_one' ℝ
· exact lt_of_lt_of_le' (hmo₀ n hn₀ hx₀) (h₃ n 0 hn₀)
· exact lt_add_of_tsub_lt_right hn₁
have hbr₁: 0 < br := by
exact aux_10 f h₀ h₁ f₀ hf₂ fi hmo₇ sn sb fb (by rfl) hfb₀ hsb₀ fr (by rfl) sbr (by rfl) br hbr₀
have hu₅: br ≤ cr := by
exact aux_11 sn fb fc hfc₂ hfb₃ hfc₃ sb sc hsb₀ hsc₀ fr
(by rfl) sbr scr (by rfl) (by rfl) br cr hbr₀ hcr₀
have hbr₃: ∀ x ∈ sbr, x ≤ br := by
refine mem_upperBounds.mp ?_
refine (isLUB_le_iff hbr₀).mp ?_
exact Preorder.le_refl br
have hcr₃: ∀ x ∈ scr, cr ≤ x := by
refine mem_lowerBounds.mp ?_
refine (le_isGLB_iff hcr₀).mp ?_
exact Preorder.le_refl cr
refine existsUnique_of_exists_of_unique ?_ ?_
· exact aux_exists f h₂ hmo₀ f₀ hf₁ sn (by rfl)
fb fc hfb₁ hfc₁ hfb₃ hfc₃ sb sc hsb₀ hsc₀
fr (by rfl) sbr scr (by rfl) (by rfl) br cr h₈ hbr₁ hu₅ hbr₃ hcr₃
· intro x y hx₀ hy₀
exact aux_unique f h₁ hmo₀ h₇ x y hx₀ hy₀
theorem imo_1985_p6
(f : ℕ → ℝ → ℝ)
(h₀ : ∀ x, f 1 x = x)
(h₁ : ∀ n x, 0 < n → f (n + 1) x = f n x * (f n x + 1 / n)) :
∃! a, ∀ n, 0 < n → 0 < f n a ∧ f n a < f (n + 1) a ∧ f (n + 1) a < 1 := by
let fn : ℕ → NNReal → ℝ := fun n x => f n x
have hfn₁: ∀ n x, 0 < n → 0 ≤ x → fn n x = f n x := by
exact fun n x a a ↦ rfl
have h₂: ∃! a, ∀ (n : ℕ), 0 < n → 0 < fn n a ∧ fn n a < fn (n + 1) a ∧ fn (n + 1) a < 1 := by
exact imo_1985_p6_nnreal fn (fun x ↦ h₀ ↑x) fun n x ↦ h₁ n ↑x
obtain ⟨a, ha₀, ha₁⟩ := h₂
refine ⟨a, ha₀, fun y hy₀ ↦ ?_⟩
have hy₁: 0 ≤ y.toNNReal := by exact zero_le y.toNNReal
by_cases hy₂: 0 ≤ y
· refine (Real.toNNReal_eq_toNNReal_iff hy₂ ?_).mp ?_
· exact NNReal.zero_le_coe
· rw [Real.toNNReal_coe]
refine ha₁ y.toNNReal ?_
intro n hn₀
rw [hfn₁ n _ hn₀ hy₁, hfn₁ (n + 1) _ (by omega) hy₁]
rw [Real.coe_toNNReal y hy₂]
exact hy₀ n hn₀
· exfalso
push_neg at hy₂
have hy₃: f 1 y < 0 := by
rw [h₀]
exact hy₂
have hy₄: 0 < f 1 y := by
exact (hy₀ 1 (by decide)).1
order
end Imo1985P6
| true | Copyright (c) 2025 Roozbeh Yousefzadeh. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Roozbeh Yousefzadeh
-/
import Mathlib
/-!
# International Mathematical Olympiad 1985, Problem 6
For every real number x_1, construct the sequence {x_1,x_2, ...}
by setting x_{n+1} = x_n * (x_n + 1 / n) for each n >= 1.
Prove that there exists exactly one value of x_1 for which
0 < x_n , x_n < x_{n+1}, and x_{n+1} < 1 for every n.
-/
namespace Imo1985P6
lemma aux_1
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ x, f 1 x = x)
(h₁ : ∀ n x, 0 < n → f (n + 1) x = f n x * (f n x + 1 / n)) :
∀ n x, 0 < n ∧ 0 < x → 0 < f n x := by
rintro n x ⟨hn, hx⟩
induction n, hn using Nat.le_induction with
| base =>
rw [h₀]
exact hx
| succ m hm ih =>
rw [h₁ m x (Nat.zero_lt_of_lt hm)]
positivity
lemma aux_2
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ x, f 1 x = x)
(h₁ : ∀ n x, 0 < n → f (n + 1) x = f n x * (f n x + 1 / n))
(h₃ : ∀ n x, 0 < n → 0 ≤ f n x) :
∀ n x y, 0 < n → x < y → f n x < f n y := by
intro n x y hn hxy
induction n using Nat.strong_induction_on with
| h n ih =>
cases n with
| zero => exact absurd hn (Nat.lt_irrefl _)
| succ n =>
cases n with
| zero => simpa [h₀] using hxy
| succ n =>
have pos_n : 0 < n.succ := Nat.succ_pos _
have IH := ih n.succ (Nat.lt_succ_self _) pos_n
rw [h₁ n.succ x pos_n, h₁ n.succ y pos_n]
refine mul_lt_mul IH ?_ ?_ ?_
· apply add_le_add (le_of_lt IH) le_rfl
· exact add_pos_of_nonneg_of_pos (h₃ _ _ pos_n) (by positivity)
· exact h₃ _ _ pos_n
lemma aux_3
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ (x : NNReal), f 1 x = ↑x)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(h₄ : ∀ (n : ℕ) (x y : NNReal), 0 < n → x < y → f n x < f n y) :
∀ (n : ℕ) (x : NNReal), 1 < n ∧ 1 ≤ x → 1 < f n x := by
intro n x hx₀
obtain ⟨hn₀, hx₁⟩ := hx₀
have g₂₀: f n 1 ≤ f n x := by
obtain hx_gt | hx_eq := lt_or_eq_of_le hx₁
· exact le_of_lt (h₄ n 1 x (Nat.zero_lt_of_lt hn₀) hx_gt)
· rw [hx_eq]
have g₂₁: f 1 1 < f n 1 := by
rw [h₀]
refine Nat.le_induction ?_ ?_ n hn₀
· rw [h₁ 1 1 (by norm_num), h₀]
norm_num
· intro m hm₀ hm₁
rw [h₁ m 1 (by omega)]
refine one_lt_mul_of_lt_of_le hm₁ ?_
nth_rw 1 [← add_zero 1]
refine add_le_add ?_ ?_
· exact le_of_lt hm₁
· exact Nat.one_div_cast_nonneg m
refine lt_of_lt_of_le ?_ g₂₀
exact (lt_iff_lt_of_cmp_eq_cmp (congrFun (congrArg cmp (h₀ 1)) (f n 1))).mp g₂₁
lemma aux_4
(f : ℕ → NNReal → ℝ)
(h₃ : ∀ (n : ℕ) (x : NNReal), 0 < n → 0 ≤ f n x)
(h₄ : ∀ (n : ℕ) (x y : NNReal), 0 < n → x < y → f n x < f n y)
(f₀ : ℕ → NNReal → NNReal)
(hf₀ : f₀ = fun n x => (f n x).toNNReal) :
∀ (n : ℕ), 0 < n → StrictMono (f₀ n) := by
intro n hn x y hxy
rw [hf₀]
exact (Real.toNNReal_lt_toNNReal_iff_of_nonneg (h₃ n x hn)).mpr (h₄ n x y hn hxy)
lemma aux_5
(f : ℕ → NNReal → ℝ)
(hmo₁ : ∀ (n : ℕ), 0 < n → Function.Injective (f n))
(f₀ : ℕ → NNReal → NNReal)
(hmo₂ : ∀ (n : ℕ), 0 < n → StrictMono (f₀ n))
(fi : ℕ → NNReal → NNReal)
(hfi : fi = fun n => Function.invFun (f₀ n)) :
∀ (n : ℕ) (x y : NNReal), 0 < n → f₀ n x = y → fi n y = x := by
intro n x y hn₀ hn₁
have hf₃: ∀ n y, fi n y = Function.invFun (f₀ n) y := by
exact fun n y => congrFun (congrFun hfi n) y
rw [← hn₁, hf₃]
have hmo₃: ∀ n, 0 < n → Function.Injective (f₀ n) := by
exact fun n a => StrictMono.injective (hmo₂ n a)
have hn₂: (Function.invFun (f₀ n)) ∘ (f₀ n) = id := by exact Function.invFun_comp (hmo₃ n hn₀)
rw [Function.comp_def (Function.invFun (f₀ n)) (f₀ n)] at hn₂
have hn₃ : (fun x => Function.invFun (f₀ n) (f₀ n x)) x = id x :=
(NNReal.eq (congrArg NNReal.toReal (congrFun hn₂.symm x))).symm
exact hmo₁ n hn₀ (congrArg (f n) hn₃)
lemma aux_6
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ (x : NNReal), f 1 x = ↑x)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(f₀ : ℕ → NNReal → NNReal)
(hf₀ : f₀ = fun n x => (f n x).toNNReal) :
∀ (n : ℕ), 0 < n → Continuous (f₀ n) := by
intro n hn₀
rw [hf₀]
apply Continuous.comp continuous_real_toNNReal
induction n, hn₀ using Nat.le_induction with
| base =>
have : f 1 = fun x => ↑x := funext h₀
rw [this]
exact NNReal.continuous_coe
| succ d hd_pos hd_cont =>
have : f (d + 1) = fun x => f d x * (f d x + 1 / d) := funext (h₁ d · hd_pos)
rw [this]
fun_prop
lemma aux_7
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ (x : NNReal), f 1 x = ↑x)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(h₃ : ∀ (n : ℕ) (x : NNReal), 0 < n → 0 ≤ f n x)
(h₅ : ∀ (n : ℕ) (x : NNReal), 1 < n ∧ 1 ≤ x → 1 < f n x)
(f₀ : ℕ → NNReal → NNReal)
(hf₂ : ∀ (n : ℕ) (x : NNReal), 0 < n → f₀ n x = (f n x).toNNReal)
(hmo₂ : ∀ (n : ℕ), 0 < n → StrictMono (f₀ n))
(hmo₄ : ∀ (n : ℕ), 0 < n → Continuous (f₀ n)) :
∀ (n : ℕ), 0 < n → Function.Surjective (f₀ n) := by
intro n hn₀
refine Continuous.surjective (hmo₄ n hn₀) ?_ ?_
· refine Monotone.tendsto_atTop_atTop ?_ ?_
· exact StrictMono.monotone (hmo₂ n hn₀)
· intro b
use (b + 1)
refine Nat.le_induction ?_ ?_ n hn₀
· rw [hf₂ 1 (b + 1) (by omega), h₀]
simp
· intro d hd₀ hd₁
rw [hf₂ (d + 1) (b + 1) (by omega), h₁ d (b + 1) (by omega)]
have hd₂: b ≤ f d (b + 1) := by
rw [hf₂ d (b + 1) (by omega)] at hd₁
exact (Real.le_toNNReal_iff_coe_le (h₃ d (b + 1) hd₀)).mp hd₁
have hd₃: 1 < (f d (b + 1) + 1 / ↑d) := by
by_cases hd₄: 1 < d
· refine lt_add_of_lt_of_pos ?_ ?_
· exact h₅ d (b + 1) ⟨hd₄, le_add_self⟩
· positivity
· have hd₅: d = 1 := by omega
rw [hd₅, h₀]
simp
positivity
refine NNReal.le_toNNReal_of_coe_le ?_
nth_rw 1 [← mul_one (↑b:ℝ)]
refine mul_le_mul hd₂ (le_of_lt hd₃) zero_le_one ?_
exact h₃ d (b + 1) hd₀
· refine Filter.tendsto_atBot_atBot.mpr ?_
intro b
use 0
intro a ha₀
have ha₁: a = 0 := nonpos_iff_eq_zero.mp ha₀
have ha₂: f₀ n 0 = 0 := by
refine Nat.le_induction ?_ ?_ n hn₀
· rw [hf₂ 1 0 (by omega), h₀]
exact Real.toNNReal_coe
· intro d hd₀ hd₁
rw [hf₂ (d + 1) 0 (by omega), h₁ d 0 (by omega)]
have hd₂: 0 ≤ f d 0 := by exact h₃ d 0 hd₀
have hd₃: f d 0 = 0 := by
rw [hf₂ d 0 (by omega)] at hd₁
apply Real.toNNReal_eq_zero.mp at hd₁
exact eq_of_le_of_ge hd₁ hd₂
rw [hd₃, zero_mul]
exact Real.toNNReal_zero
rw [ha₁, ha₂]
exact _root_.zero_le b
lemma aux_8
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ (x : NNReal), f 1 x = ↑x)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(hmo₀ : ∀ (n : ℕ), 0 < n → StrictMono (f n))
(hmo₁ : ∀ (n : ℕ), 0 < n → Function.Injective (f n))
(f₀ : ℕ → NNReal → NNReal)
(hf₂ : ∀ (n : ℕ) (x : NNReal), 0 < n → f₀ n x = (f n x).toNNReal)
(sn : Set ℕ)
(fb : ↑sn → NNReal)
(hsn₁ : ∀ (n : ↑sn), ↑n ∈ sn ∧ 0 < n.1)
(hfb₁ : ∀ (n : ↑sn), f₀ (↑n) (fb n) = 1 - 1 / ↑↑n) :
∀ (n : ↑sn), fb n < 1 := by
intro n
have hn₀: 0 < (n:ℕ) := by exact (hsn₁ n).2
let z := fb n
have hz₀: z = fb n := by rfl
rw [← hz₀]
by_contra! hc₀
have hc₁: 1 ≤ f n z := by
by_cases hn₁: 1 < (n:ℕ)
· refine le_of_lt ?_
refine aux_3 f h₀ h₁ ?_ (↑n) z ?_
· exact fun n x y a a_1 => hmo₀ n a a_1
· exact ⟨hn₁, hc₀⟩
· have hn₂: (n:ℕ) = 1 := by omega
rw [hn₂, h₀]
exact hc₀
have hz₁: f₀ n z = 1 - 1 / n := by
exact hfb₁ n
have hz₃: f n z = 1 - 1 / n := by
rw [hf₂ n z hn₀] at hz₁
by_cases hn₁: 1 < (n:ℕ)
· have hz₂: 1 - 1 / (n:NNReal) ≠ 0 := by
have g₀: (n:NNReal) ≠ 0 := by
norm_cast
omega
nth_rw 1 [← div_self g₀, ← NNReal.sub_div]
refine div_ne_zero ?_ g₀
norm_cast
exact Nat.sub_ne_zero_iff_lt.mpr hn₁
apply (Real.toNNReal_eq_iff_eq_coe hz₂).mp at hz₁
rw [hz₁]
exact ((fun {r} {p:NNReal} hp =>
(Real.toNNReal_eq_iff_eq_coe hp).mp) hz₂ (hmo₁ n hn₀ rfl)).symm
· have hn₂: (n:ℕ) = 1 := by omega
rw [hn₂, h₀] at hz₁
simp at hz₁
rw [hn₂, h₀, hz₁]
simp
rw [hz₃] at hc₁
have hz₄: 0 < 1 / (n:ℝ) := by
refine div_pos zero_lt_one ?_
exact Nat.cast_pos'.mpr hn₀
linarith
lemma aux_9
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ (x : NNReal), f 1 x = ↑x)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(f₀ : ℕ → NNReal → NNReal)
(hf₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f n x = ↑(f₀ n x))
(hf₂ : ∀ (n : ℕ) (x : NNReal), 0 < n → f₀ n x = (f n x).toNNReal)
(hmo₂ : ∀ (n : ℕ), 0 < n → StrictMono (f₀ n))
(fi : ℕ → NNReal → NNReal)
(hf₅ : ∀ (x : NNReal), fi 1 x = x)
(hmo₇ : ∀ (n : ℕ), 0 < n → Function.RightInverse (fi n) (f₀ n))
(hf₇ : ∀ (n : ℕ) (x y : NNReal), 0 < n → (f₀ n x = y ↔ fi n y = x))
(fb : ℕ → NNReal)
(hfb₀ : fb = fun n => fi n (1 - 1 / ↑n))
(sn : Set ℕ)
(hsn : sn = Set.Ici 1) :
StrictMonoOn fb sn := by
rw [hsn]
refine strictMonoOn_Ici_of_pred_lt ?hψ
intro m hm₀
rw [hfb₀]
refine Nat.le_induction ?_ ?_ m hm₀
· have g₁: fi 1 0 = 0 := by exact hf₅ 0
have g₂: (2:NNReal).HolderConjugate (2:NNReal) := NNReal.HolderConjugate.two_two
simp
norm_cast
rw [g₁, NNReal.HolderConjugate.one_sub_inv g₂]
let x := fi 2 2⁻¹
have hx₀: x = fi 2 2⁻¹ := by rfl
have hx₁: f₀ 2 x = 2⁻¹ := by
rw [hx₀]
have g₃: Function.RightInverse (fi 2) (f₀ 2) := by exact hmo₇ 2 (by omega)
exact g₃ 2⁻¹
rw [← hx₀]
contrapose! hx₁
have hc₁: x = 0 := by exact nonpos_iff_eq_zero.mp hx₁
have hc₃: f₀ 2 x = 0 := by
rw [hc₁, hf₂ 2 0 (by omega), h₁ 1 0 (by omega), h₀ 0]
norm_cast
rw [zero_mul]
exact Real.toNNReal_zero
rw [hc₃]
exact Ne.symm (NNReal.HolderTriple.inv_ne_zero g₂)
· simp
intro n hn₀ _
let i := fi n (1 - (↑n)⁻¹)
let j := fi (n + 1) (1 - ((↑n:NNReal) + 1)⁻¹)
have hi₀: i = fi n (1 - (↑n)⁻¹) := by rfl
have hj₀: j = fi (n + 1) (1 - ((↑n:NNReal) + 1)⁻¹) := by rfl
have hi₁: f₀ n i = (1 - (↑n)⁻¹) := (hf₇ n i (1 - (↑n:NNReal)⁻¹) (by omega)).mpr hi₀.symm
have hj₁: f₀ (n + 1) j = (1 - ((↑n:NNReal) + 1)⁻¹) := by
exact (hf₇ (n + 1) j _ (by omega)).mpr hj₀.symm
have hj₂: (1 - ((↑n:NNReal) + 1)⁻¹) = (1 - ((n:ℝ) + 1)⁻¹).toNNReal := by
exact rfl
have hn₂: f₀ (n + 1) i < f₀ (n + 1) j := by
rw [hj₁, hj₂, hf₂ (n + 1) _ (by omega), h₁ n i (by omega)]
rw [hf₁ n i (by omega), hi₁]
refine (Real.toNNReal_lt_toNNReal_iff ?_).mpr ?_
· refine sub_pos.mpr ?_
refine inv_lt_one_of_one_lt₀ ?_
norm_cast
exact Nat.lt_add_right 1 hn₀
· have g₀: (↑n:NNReal)⁻¹ ≤ 1 := by exact Nat.cast_inv_le_one n
rw [NNReal.coe_sub g₀, NNReal.coe_inv]
simp
refine inv_strictAnti₀ ?_ ?_
· positivity
· norm_cast
exact lt_add_one n
refine (StrictMono.lt_iff_lt ?_).mp hn₂
exact hmo₂ (n + 1) (by omega)
lemma aux_10
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ (x : NNReal), f 1 x = ↑x)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(f₀ : ℕ → NNReal → NNReal)
(hf₂ : ∀ (n : ℕ) (x : NNReal), 0 < n → f₀ n x = (f n x).toNNReal)
(fi : ℕ → NNReal → NNReal)
(hmo₇ : ∀ (n : ℕ), 0 < n → Function.RightInverse (fi n) (f₀ n))
(sn : Set ℕ)
(sb : Set NNReal)
(fb : ↑sn → NNReal)
(hsn₀ : sn = Set.Ici 1)
(hfb₀ : fb = fun n:↑sn => fi (↑n) (1 - 1 / ↑↑n))
(hsb₀ : sb = Set.range fb)
(fr : NNReal → ℝ)
(hfr: fr = fun x => ↑x)
(sbr : Set ℝ)
(hsbr: sbr = fr '' sb)
(br: ℝ)
(hbr₀ : IsLUB sbr br) :
0 < br := by
have hnb₀: 2 ∈ sn := by
rw [hsn₀]
decide
let nb : ↑sn := ⟨2, hnb₀⟩
have g₀: 0 < fb nb := by
have g₁: (2:NNReal).HolderConjugate (2:NNReal) := NNReal.HolderConjugate.two_two
rw [hfb₀]
simp
have hnb₁: nb.val = 2 := by exact rfl
rw [hnb₁]
norm_cast
rw [NNReal.HolderConjugate.one_sub_inv g₁]
let x := fi 2 2⁻¹
have hx₀: x = fi 2 2⁻¹ := by rfl
have hx₁: f₀ 2 x = 2⁻¹ := by
rw [hx₀]
have g₃: Function.RightInverse (fi 2) (f₀ 2) := by exact hmo₇ 2 (by omega)
exact g₃ 2⁻¹
rw [← hx₀]
contrapose! hx₁
have hc₁: x = 0 := by exact nonpos_iff_eq_zero.mp hx₁
have hc₃: f₀ 2 x = 0 := by
rw [hc₁, hf₂ 2 0 (by omega), h₁ 1 0 (by omega), h₀ 0]
norm_cast
rw [zero_mul]
exact Real.toNNReal_zero
rw [hc₃]
exact Ne.symm (NNReal.HolderTriple.inv_ne_zero g₁)
have g₁: ∃ x, 0 < x ∧ x ∈ sbr := by
use (fb nb).toReal
constructor
· exact g₀
· rw [hsbr]
simp
use fb ↑nb
constructor
· rw [hsb₀]
exact Set.mem_range_self nb
· exact congrFun hfr (fb ↑nb)
obtain ⟨x, hx₀, hx₁⟩ := g₁
have hx₂: br ∈ upperBounds sbr := by
refine (isLUB_le_iff hbr₀).mp ?_
exact Preorder.le_refl br
exact lt_of_le_of_lt' (hx₂ hx₁) hx₀
lemma aux_11
(sn : Set ℕ)
(fb fc : ↑sn → NNReal)
(hfc₂ : ∀ (n : ↑sn), fb n < fc n)
(hfb₃ : StrictMono fb)
(hfc₃ : StrictAnti fc)
(sb sc : Set NNReal)
(hsb₀ : sb = Set.range fb)
(hsc₀ : sc = Set.range fc)
(fr : NNReal → ℝ)
(hfr : fr = fun x ↦ ↑x)
(sbr scr : Set ℝ)
(hsbr : sbr = fr '' sb)
(hscr : scr = fr '' sc)
(br cr : ℝ)
(hbr₀ : IsLUB sbr br)
(hcr₀ : IsGLB scr cr) :
br ≤ cr := by
have hfc₄: ∀ nb nc, fb nb < fc nc := by
intro nb nc
obtain hn₀ | hn₀ := lt_or_ge nb nc
· exact lt_trans (hfb₃ hn₀) (hfc₂ nc)
obtain hn₁ | hn₁ := lt_or_eq_of_le hn₀
· refine lt_trans (hfc₂ nb) ?_
exact hfc₃ hn₁
· rw [hn₁]
exact hfc₂ nb
by_contra! hc₀
have hc₁: ∃ x ∈ sbr, cr < x ∧ x ≤ br := by exact IsLUB.exists_between hbr₀ hc₀
let ⟨x, hx₀, hx₁, _⟩ := hc₁
have hc₂: ∃ y ∈ scr, cr ≤ y ∧ y < x := by exact IsGLB.exists_between hcr₀ hx₁
let ⟨y, hy₀, _, hy₂⟩ := hc₂
have hc₃: x < y := by
have hx₃: x.toNNReal ∈ sb := by
rw [hsbr] at hx₀
apply (Set.mem_image fr sb x).mp at hx₀
obtain ⟨z, hz₀, hz₁⟩ := hx₀
rw [← hz₁, hfr, Real.toNNReal_coe]
exact hz₀
have hy₃: y.toNNReal ∈ sc := by
rw [hscr] at hy₀
apply (Set.mem_image fr sc y).mp at hy₀
obtain ⟨z, hz₀, hz₁⟩ := hy₀
rw [← hz₁, hfr, Real.toNNReal_coe]
exact hz₀
rw [hsb₀] at hx₃
rw [hsc₀] at hy₃
apply Set.mem_range.mp at hx₃
apply Set.mem_range.mp at hy₃
let ⟨nx, hnx₀⟩ := hx₃
let ⟨ny, hny₀⟩ := hy₃
have hy₄: 0 < y := by
contrapose! hy₃
have hy₅: y.toNNReal = 0 := by exact Real.toNNReal_of_nonpos hy₃
intro z
rw [hy₅]
exact ne_zero_of_lt (hfc₂ z)
refine (Real.toNNReal_lt_toNNReal_iff hy₄).mp ?_
rw [← hnx₀, ← hny₀]
exact hfc₄ nx ny
refine (lt_self_iff_false x).mp ?_
exact lt_trans hc₃ hy₂
lemma aux_exists
(f : ℕ → NNReal → ℝ)
(h₂ : ∀ (n : ℕ) (x : NNReal), 0 < n ∧ 0 < x → 0 < f n x)
(hmo₀ : ∀ (n : ℕ), 0 < n → StrictMono (f n))
(f₀ : ℕ → NNReal → NNReal)
(hf₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f n x = ↑(f₀ n x))
(sn : Set ℕ)
(hsn₀ : sn = Set.Ici 1)
(fb fc : ↑sn → NNReal)
(hfb₁ : ∀ (n : ↑sn), f₀ (↑n) (fb n) = 1 - 1 / ↑↑n)
(hfc₁ : ∀ (n : ↑sn), f₀ (↑n) (fc n) = 1)
(hfb₃ : StrictMono fb)
(hfc₃ : StrictAnti fc)
(sb sc : Set NNReal)
(hsb₀ : sb = Set.range fb)
(hsc₀ : sc = Set.range fc)
(fr : NNReal → ℝ)
(hfr : fr = fun x => ↑x)
(sbr scr : Set ℝ)
(hsbr : sbr = fr '' sb)
(hscr : scr = fr '' sc)
(br cr : ℝ)
(h₈ : ∀ (n : ℕ) (x : NNReal), 0 < n → 0 < x → 1 - 1 / ↑n < f n x → f n x < f (n + 1) x)
(hbr₁ : 0 < br)
(hu₅ : br ≤ cr)
(hbr₃ : ∀ x ∈ sbr, x ≤ br)
(hcr₃ : ∀ x ∈ scr, cr ≤ x) :
∃ x, ∀ (n : ℕ), 0 < n → 0 < f n x ∧ f n x < f (n + 1) x ∧ f (n + 1) x < 1 := by
obtain hu₆ | hu₆ := lt_or_eq_of_le hu₅
· apply exists_between at hu₆
let ⟨a, ha₀, ha₁⟩ := hu₆
have ha₂: 0 < a := by exact gt_trans ha₀ hbr₁
have ha₃: 0 < a.toNNReal := by exact Real.toNNReal_pos.mpr ha₂
use a.toNNReal
intro n hn₀
have hn₁: n ∈ sn := by
rw [hsn₀]
exact hn₀
constructor
· exact h₂ n a.toNNReal ⟨hn₀, ha₃⟩
constructor
· refine h₈ n a.toNNReal hn₀ ?_ ?_
· exact Real.toNNReal_pos.mpr ha₂
· let nn : ↑sn := ⟨n, hn₁⟩
have hn₂: f n (fb nn) = 1 - 1 / n := by
rw [hf₁ n _ hn₀, hfb₁ nn]
refine NNReal.coe_sub ?_
refine div_le_self ?_ ?_
· exact zero_le_one' NNReal
· exact Nat.one_le_cast.mpr hn₀
rw [← hn₂]
refine hmo₀ n hn₀ ?_
refine Real.lt_toNNReal_iff_coe_lt.mpr ?_
refine lt_of_le_of_lt ?_ ha₀
refine hbr₃ _ ?_
rw [hsbr]
refine (Set.mem_image fr sb _).mpr ?_
use (fb nn)
rw [hfr, hsb₀]
refine ⟨?_, rfl⟩
exact Set.mem_range_self nn
· have hn₂: n + 1 ∈ sn := by
rw [hsn₀]
exact Set.mem_Ici.mpr (by omega)
let nn : ↑sn := ⟨n + 1, hn₂⟩
have hn₃: f (n + 1) (fc (nn)) = 1 := by
rw [hf₁ (n + 1) _ (by omega), hfc₁ nn]
exact rfl
rw [← hn₃]
refine hmo₀ (n + 1) (by omega) ?_
refine (Real.toNNReal_lt_iff_lt_coe (le_of_lt ha₂)).mpr ?_
refine lt_of_lt_of_le ha₁ ?_
refine hcr₃ _ ?_
rw [hscr]
refine (Set.mem_image fr sc _).mpr ?_
use (fc nn)
rw [hfr, hsc₀]
refine ⟨?_, rfl⟩
exact Set.mem_range_self nn
· use br.toNNReal
intro n hn₀
have hn₁: n ∈ sn := by
rw [hsn₀]
exact hn₀
constructor
· refine h₂ n br.toNNReal ⟨hn₀, ?_⟩
exact Real.toNNReal_pos.mpr hbr₁
constructor
· refine h₈ n br.toNNReal hn₀ ?_ ?_
· exact Real.toNNReal_pos.mpr hbr₁
· let nn : ↑sn := ⟨n, hn₁⟩
have hn₂: fb nn < br := by
by_contra! hc₀
have hbr₅: (fb nn) = br := by
refine eq_of_le_of_ge ?_ hc₀
refine hbr₃ _ ?_
rw [hsbr]
refine (Set.mem_image fr sb _).mpr ?_
use (fb nn)
rw [hfr, hsb₀]
exact ⟨Set.mem_range_self nn, rfl⟩
have hn₂: n + 1 ∈ sn := by
rw [hsn₀]
refine Set.mem_Ici.mpr ?_
exact Nat.le_add_right_of_le hn₀
let ns : ↑sn := ⟨n + 1, hn₂⟩
have hc₁: fb nn < fb ns := by
refine hfb₃ ?_
refine Subtype.mk_lt_mk.mpr ?_
exact lt_add_one n
have hbr₆: fb ns ≤ fb nn := by
refine NNReal.coe_le_coe.mp ?_
rw [hbr₅]
refine hbr₃ _ ?_
rw [hsbr]
refine (Set.mem_image fr sb _).mpr ?_
use (fb ns)
rw [hfr, hsb₀]
refine ⟨?_, rfl⟩
exact Set.mem_range_self ns
refine (lt_self_iff_false (fb nn)).mp ?_
exact lt_of_lt_of_le hc₁ hbr₆
have hn₃: f n (fb nn) = 1 - 1 / n := by
rw [hf₁ n _ hn₀, hfb₁ nn]
refine NNReal.coe_sub ?_
refine div_le_self ?_ ?_
· exact zero_le_one' NNReal
· exact Nat.one_le_cast.mpr hn₀
rw [← hn₃]
refine hmo₀ n hn₀ ?_
exact Real.lt_toNNReal_iff_coe_lt.mpr hn₂
· have hn₂: n + 1 ∈ sn := by
rw [hsn₀]
exact Set.mem_Ici.mpr (by omega)
let nn : ↑sn := ⟨n + 1, hn₂⟩
have hcr₁: 0 < cr := lt_of_le_of_lt' hu₅ hbr₁
have hn₃: f (n + 1) (fc (nn)) = 1 := by
rw [hf₁ (n + 1) _ (by omega), hfc₁ nn]
exact rfl
rw [← hn₃, hu₆]
refine hmo₀ (n + 1) (by omega) ?_
refine (Real.toNNReal_lt_iff_lt_coe (le_of_lt hcr₁)).mpr ?_
by_contra! hc₀
have hc₁: fc nn = cr := by
refine eq_of_le_of_ge hc₀ ?_
refine hcr₃ _ ?_
rw [hscr]
refine (Set.mem_image fr sc _).mpr ?_
use (fc nn)
rw [hfr, hsc₀]
refine ⟨?_, rfl⟩
exact Set.mem_range_self nn
have hn₄: n + 2 ∈ sn := by
rw [hsn₀]
refine Set.mem_Ici.mpr ?_
exact Nat.le_add_right_of_le hn₀
let ns : ↑sn := ⟨n + 2, hn₄⟩
have hn₅: fc ns < fc nn := by
refine hfc₃ ?_
refine Subtype.mk_lt_mk.mpr ?_
exact Nat.lt_add_one (n + 1)
have hc₂: fc nn ≤ fc ns := by
refine NNReal.coe_le_coe.mp ?_
rw [hc₁]
refine hcr₃ _ ?_
rw [hscr]
refine (Set.mem_image fr sc _).mpr ?_
use (fc ns)
rw [hfr, hsc₀]
refine ⟨?_, rfl⟩
exact Set.mem_range_self ns
refine (lt_self_iff_false (fc ns)).mp ?_
exact lt_of_lt_of_le hn₅ hc₂
lemma aux_unique_top_ind
(f : ℕ → NNReal → ℝ)
(sd : Set ℕ)
(hsd : sd = Set.Ici 2)
(fd : NNReal → NNReal → ↑sd → ℝ)
(hfd₁ : ∀ (y₁ y₂ : NNReal) (n : ↑sd), fd y₁ y₂ n = f (↑n) y₂ - f (↑n) y₁)
(hd₁ : ∀ (n : ↑sd) (a b : NNReal), a < b → 0 < fd a b n)
(a b : NNReal)
(ha₀ : a < b)
(hd₃ : ∀ (nd : ↑sd), nd.1 + (1 : ℕ) ∈ sd)
(hd₂ : ∀ (nd : ↑sd), fd a b nd * (2 - 1 / ↑↑nd) ≤ fd a b ⟨nd.1 + 1, hd₃ nd⟩)
(hi₀ : 2 ∈ sd)
(i : ↑sd)
(hi₁ : i = ⟨2, hi₀⟩) :
∀ (nd : ↑sd), fd a b i * (3 / 2) ^ (nd.1 - 2) ≤ fd a b nd := by
intro nd
rw [hfd₁ a b nd]
have hnd₀: 2 ≤ nd.1 := by
refine Set.mem_Ici.mp ?_
rw [← hsd]
exact nd.2
refine Nat.le_induction ?_ ?_ nd.1 hnd₀
· have hi₂: i.val = (2:ℕ) := by
simp_all only [Subtype.forall]
rw [hfd₁ a b i, hi₂]
simp
· simp
intro n hn₀ hn₁
have hn₂: n - 1 = n - 2 + 1 := by omega
have hn₃: n ∈ sd := by
rw [hsd]
exact hn₀
let nn : ↑sd := ⟨n, hn₃⟩
have hn₄: nn.1 + 1 ∈ sd := hd₃ nn
have hn₅: fd a b nn * (2 - 1 / ↑n) ≤ fd a b ⟨nn.1 + 1, hn₄⟩ := by exact hd₂ nn
rw [hfd₁ a b ⟨nn.1 + 1, hn₄⟩] at hn₅
have hn₆: f (↑nn + 1) b - f (↑nn + 1) a = f (n + 1) b - f (n + 1) a := by exact rfl
rw [hn₆] at hn₅
refine le_trans ?_ hn₅
rw [hn₂, pow_succ (3/2) (n - 2), ← mul_assoc (fd a b i)]
refine mul_le_mul ?_ ?_ (by norm_num1) ?_
· refine le_of_le_of_eq hn₁ ?_
rw [hfd₁]
· refine (div_le_iff₀ (two_pos)).mpr ?_
rw [sub_mul, one_div_mul_eq_div _ 2]
refine le_sub_iff_add_le.mpr ?_
refine le_sub_iff_add_le'.mp ?_
refine (div_le_iff₀ ?_).mpr ?_
· positivity
· ring_nf
exact Nat.ofNat_le_cast.mpr hn₀
· exact le_of_lt (hd₁ nn a b ha₀)
lemma aux_unique_top
(f : ℕ → NNReal → ℝ)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(h₇ : ∀ (n : ℕ) (x : NNReal), 0 < n → f n x < f (n + 1) x → 1 - 1 / ↑n < f n x)
(sd : Set ℕ)
(hsd : sd = Set.Ici 2)
(fd : NNReal → NNReal → ↑sd → ℝ)
(hfd₁ : ∀ (y₁ y₂ : NNReal) (n : ↑sd), fd y₁ y₂ n = f (↑n) y₂ - f (↑n) y₁)
(hd₁ : ∀ (n : ↑sd) (a b : NNReal), a < b → 0 < fd a b n) :
∀ (a b : NNReal),
a < b →
(∀ (n : ↑sd), f (↑n) a < f (↑n + 1) a ∧ f (↑n) b < f (↑n + 1) b)
→ Filter.Tendsto (fd a b) Filter.atTop Filter.atTop := by
intro a b ha₀ ha₁
have hd₀: ∀ (nd:↑sd), (nd.1 + 1) ∈ sd := by
intro nd
let t : ℕ := nd.1
have ht: t = nd.1 := by rfl
rw [← ht, hsd]
refine Set.mem_Ici.mpr ?_
refine Nat.le_add_right_of_le ?_
refine Set.mem_Ici.mp ?_
rw [ht, ← hsd]
exact nd.2
have hd₂: ∀ nd, fd a b nd * (2 - 1 / nd.1) ≤ fd a b ⟨nd.1 + 1, hd₀ nd⟩ := by
intro nd
have hnd₀: 0 < nd.1 := by
have g₀: 2 ≤ nd.1 := by
refine Set.mem_Ici.mp ?_
rw [← hsd]
exact nd.2
exact Nat.zero_lt_of_lt g₀
rw [hfd₁, hfd₁, h₁ nd.1 _ hnd₀, h₁ nd.1 _ hnd₀]
have hnd₁: f (↑nd) b * (f (↑nd) b + 1 / ↑↑nd) - f (↑nd) a * (f (↑nd) a + 1 / ↑↑nd) =
(f (↑nd) b - f (↑nd) a) * (f (↑nd) b + f (↑nd) a + 1 / nd.1) := by
ring_nf
rw [hnd₁]
refine (mul_le_mul_iff_right₀ ?_).mpr ?_
· rw [← hfd₁]
exact hd₁ nd a b ha₀
· refine le_sub_iff_add_le.mp ?_
rw [sub_neg_eq_add]
have hnd₂: 1 - 1 / nd.1 < f (↑nd) b := by
exact h₇ nd.1 b hnd₀ (ha₁ nd).2
have hnd₃: 1 - 1 / nd.1 < f (↑nd) a := by
exact h₇ nd.1 a hnd₀ (ha₁ nd).1
linarith
have hi: 2 ∈ sd := by
rw [hsd]
decide
let i : ↑sd := ⟨(2:ℕ), hi⟩
have hd₃: ∀ nd, fd a b i * (3 / 2) ^ (nd.1 - 2) ≤ fd a b nd := by
intro nd
exact aux_unique_top_ind f sd hsd fd hfd₁ hd₁ a b ha₀ hd₀ hd₂ hi i rfl nd
have hsd₁: Nonempty ↑sd := Nonempty.intro i
refine Filter.tendsto_atTop_atTop.mpr ?_
intro z
by_cases hz₀: z ≤ fd a b i
· use i
intro j _
refine le_trans hz₀ ?_
refine le_trans ?_ (hd₃ j)
refine le_mul_of_one_le_right ?_ ?_
· refine le_of_lt ?_
exact hd₁ i a b ha₀
· refine one_le_pow₀ ?_
norm_num
· push_neg at hz₀
have hz₁: 0 < fd a b i := by exact hd₁ i a b ha₀
have hz₂: 0 < Real.log (z / fd a b i) := by
refine Real.log_pos ?_
exact (one_lt_div hz₁).mpr hz₀
let j : ℕ := Nat.ceil (2 + Real.log (z / fd a b i) / Real.log (3 / 2))
have hj₀: 2 < j := by
refine Nat.lt_ceil.mpr ?_
norm_cast
refine lt_add_of_pos_right 2 ?_
refine div_pos ?_ ?_
· exact hz₂
· positivity
have hj₁: j ∈ sd := by
rw [hsd]
exact Set.mem_Ici_of_Ioi hj₀
use ⟨j, hj₁⟩
intro k hk₀
have hk₁: fd a b i * (3 / 2) ^ (k.1 - 2) ≤ fd a b k := by
exact hd₃ k
have hk₂: i < k := lt_of_lt_of_le hj₀ hk₀
refine le_trans ?_ hk₁
refine (div_le_iff₀' ?_).mp ?_
· exact hz₁
· refine Real.le_pow_of_log_le (by norm_num1) ?_
refine (div_le_iff₀ ?_).mp ?_
· positivity
· rw [Nat.cast_sub ?_]
· rw [Nat.cast_two]
refine le_sub_iff_add_le'.mpr ?_
exact Nat.le_of_ceil_le hk₀
· exact Nat.le_of_succ_le hk₂
lemma aux_unique_nhds
(f : ℕ → NNReal → ℝ)
(sd : Set ℕ)
(hsd : sd = Set.Ici 2)
(fd : NNReal → NNReal → ↑sd → ℝ)
(hfd₁ : ∀ (y₁ y₂ : NNReal) (n : ↑sd), fd y₁ y₂ n = f (↑n) y₂ - f (↑n) y₁)
(hd₁ : ∀ (n : ↑sd) (a b : NNReal), a < b → 0 < fd a b n) :
∀ (a b : NNReal),
a < b →
(∀ (n : ↑sd),
(1 - 1 / ↑↑n < f (↑n) a ∧ 1 - 1 / ↑↑n < f (↑n) b) ∧ f (↑n) a < 1 ∧ f (↑n) b < 1) →
Filter.Tendsto (fd a b) Filter.atTop (nhds 0) := by
intro a b ha₀ ha₁
have hsd₁: Nonempty ↑sd := by
rw [hsd]
exact Set.nonempty_Ici_subtype
refine tendsto_atTop_nhds.mpr ?_
intro U hU₀ hU₁
have hU₂: U ∈ nhds 0 := by exact IsOpen.mem_nhds hU₁ hU₀
apply mem_nhds_iff_exists_Ioo_subset.mp at hU₂
obtain ⟨l, u, hl₀, hl₁⟩ := hU₂
have hl₂: 0 < u := by exact (Set.mem_Ioo.mpr hl₀).2
let nd := 2 + Nat.ceil (1/u)
have hnd₀: nd ∈ sd := by
rw [hsd]
refine Set.mem_Ici.mpr ?_
exact Nat.le_add_right 2 ⌈1 / u⌉₊
use ⟨nd, hnd₀⟩
intro n hn₀
refine (IsOpen.mem_nhds_iff hU₁).mp ?_
refine mem_nhds_iff.mpr ?_
use Set.Ioo l u
refine ⟨hl₁, isOpen_Ioo, Set.mem_Ioo.mpr ?_⟩
constructor
· refine lt_trans ?_ (hd₁ n a b ha₀)
exact (Set.mem_Ioo.mp hl₀).1
· have hn₁: fd a b n < 1 / n := by
rw [hfd₁]
have ha₂: 1 - 1 / n < f n a := by exact (ha₁ n).1.1
have hb₁: f n b < 1 := by exact (ha₁ n).2.2
refine sub_lt_iff_lt_add.mpr ?_
refine lt_trans hb₁ ?_
exact sub_lt_iff_lt_add'.mp ha₂
have hn₂: (1:ℝ) / n ≤ 1 / nd := by
refine one_div_le_one_div_of_le ?_ ?_
· positivity
· exact Nat.cast_le.mpr hn₀
refine lt_of_lt_of_le hn₁ ?_
refine le_trans hn₂ ?_
refine div_le_of_le_mul₀ ?_ ?_ ?_
· exact Nat.cast_nonneg' nd
· exact le_of_lt hl₂
· have hl₃: u * (2 + 1 / u) ≤ u * ↑((2:ℕ) + ⌈(1:ℝ) / u⌉₊) := by
refine (mul_le_mul_iff_right₀ hl₂).mpr ?_
rw [Nat.cast_add 2 _, Nat.cast_two]
refine add_le_add_right ?_ 2
exact Nat.le_ceil (1 / u)
refine le_trans ?_ hl₃
rw [mul_add, mul_one_div u u, div_self (ne_of_gt hl₂)]
refine le_of_lt ?_
refine sub_lt_iff_lt_add.mp ?_
rw [sub_self 1]
exact mul_pos hl₂ two_pos
lemma aux_unique
(f : ℕ → NNReal → ℝ)
(h₁ : ∀ (n : ℕ) (x : NNReal), 0 < n → f (n + 1) x = f n x * (f n x + 1 / ↑n))
(hmo₀ : ∀ (n : ℕ), 0 < n → StrictMono (f n))
(h₇ : ∀ (n : ℕ) (x : NNReal), 0 < n → f n x < f (n + 1) x → 1 - 1 / ↑n < f n x) :
∀ (y₁ y₂ : NNReal),
(∀ (n : ℕ), 0 < n → 0 < f n y₁ ∧ f n y₁ < f (n + 1) y₁ ∧ f (n + 1) y₁ < 1) →
(∀ (n : ℕ), 0 < n → 0 < f n y₂ ∧ f n y₂ < f (n + 1) y₂ ∧ f (n + 1) y₂ < 1) → y₁ = y₂ := by
intro x y hx₀ hy₀
let sd : Set ℕ := Set.Ici 2
let fd : NNReal → NNReal → ↑sd → ℝ := fun y₁ y₂ n => (f n.1 y₂ - f n.1 y₁)
have hfd₁: ∀ y₁ y₂ n, fd y₁ y₂ n = f n.1 y₂ - f n.1 y₁ := by exact fun y₁ y₂ n => rfl
have hd₁: ∀ n a b, a < b → 0 < fd a b n := by
intro nd a b hnd₀
rw [hfd₁]
refine sub_pos.mpr ?_
refine hmo₀ nd.1 ?_ hnd₀
exact lt_of_lt_of_le (Nat.zero_lt_two) nd.2
have hfd₂: ∀ a b, a < b → (∀ n:↑sd, f n.1 a < f (n.1 + 1) a ∧ f n.1 b < f (n.1 + 1) b)
→ Filter.Tendsto (fd a b) Filter.atTop Filter.atTop := by
intro a b ha₀ ha₁
exact aux_unique_top f h₁ h₇ sd rfl fd hfd₁ hd₁ a b ha₀ ha₁
have hfd₃: ∀ a b, a < b →
(∀ (n:↑sd), (1 - 1 / n.1 < f n.1 a ∧ 1 - 1 / n.1 < f n.1 b) ∧ (f n.1 a < 1 ∧ f n.1 b < 1))
→ Filter.Tendsto (fd a b) Filter.atTop (nhds 0) := by
intro a b ha₀ ha₁
exact aux_unique_nhds f sd rfl fd hfd₁ hd₁ a b ha₀ ha₁
by_contra! hc₀
by_cases hy₁: x < y
· have hy₂: Filter.Tendsto (fd x y) Filter.atTop Filter.atTop := by
refine hfd₂ x y hy₁ ?_
intro nd
have hnd₀: 0 < nd.1 := by exact lt_of_lt_of_le (two_pos) nd.2
constructor
· exact (hx₀ nd.1 hnd₀).2.1
· exact (hy₀ nd.1 hnd₀).2.1
have hy₃: Filter.Tendsto (fd x y) Filter.atTop (nhds 0) := by
refine hfd₃ x y hy₁ ?_
intro nd
have hnd₀: 0 < nd.1 := by
refine lt_of_lt_of_le ?_ nd.2
exact Nat.zero_lt_two
have hnd₁: nd.1 - 1 + 1 = nd.1 := by exact Nat.sub_add_cancel hnd₀
have hnd₂: 0 < nd.1 - 1 := by
refine Nat.sub_pos_of_lt ?_
refine lt_of_lt_of_le ?_ nd.2
exact Nat.one_lt_two
constructor
· constructor
· refine h₇ nd.1 x hnd₀ ?_
exact (hx₀ (nd.1) hnd₀).2.1
· refine h₇ nd.1 y hnd₀ ?_
exact (hy₀ (nd.1) hnd₀).2.1
· constructor
· rw [← hnd₁]
exact (hx₀ (nd.1 - 1) hnd₂).2.2
· rw [← hnd₁]
exact (hy₀ (nd.1 - 1) hnd₂).2.2
apply Filter.tendsto_atTop_atTop.mp at hy₂
apply tendsto_atTop_nhds.mp at hy₃
contrapose! hy₃
clear hy₃
let sx : Set ℝ := Set.Ioo (-1) 1
use sx
constructor
· refine Set.mem_Ioo.mpr ?_
simp
constructor
· exact isOpen_Ioo
· intro N
have hy₅: ∃ i, ∀ (a : ↑sd), i ≤ a → N + 3 ≤ fd x y a := by exact hy₂ (N + 3)
obtain ⟨i, hi₀⟩ := hy₅
have hi₁: (N.1 + i.1) ∈ sd := by
refine Set.mem_Ici.mpr ?_
rw [← add_zero 2]
exact Nat.add_le_add N.2 (Nat.zero_le ↑i)
let a : ↑sd := ⟨N + i, hi₁⟩
use a
constructor
· refine Subtype.mk_le_mk.mpr ?_
exact Nat.le_add_right ↑N ↑i
· refine Set.notMem_Ioo_of_ge ?_
have hi₂: ↑↑N + 3 ≤ fd x y a := by
refine hi₀ a ?_
refine Subtype.mk_le_mk.mpr ?_
exact Nat.le_add_left ↑i ↑N
refine le_trans ?_ hi₂
norm_cast
exact Nat.le_add_left 1 (↑N + 2)
· have hy₂: y < x := by
push_neg at hy₁
exact lt_of_le_of_ne hy₁ hc₀.symm
have hy₃: Filter.Tendsto (fd y x) Filter.atTop Filter.atTop := by
refine hfd₂ y x hy₂ ?_
intro nd
have hnd₀: 0 < nd.1 := by exact lt_of_lt_of_le (two_pos) nd.2
constructor
· exact (hy₀ nd.1 hnd₀).2.1
· exact (hx₀ nd.1 hnd₀).2.1
have hy₄: Filter.Tendsto (fd y x) Filter.atTop (nhds 0) := by
refine hfd₃ y x hy₂ ?_
intro nd
have hnd₀: 0 < nd.1 := by exact lt_of_lt_of_le (Nat.zero_lt_two) nd.2
have hnd₁: nd.1 - 1 + 1 = nd.1 := by exact Nat.sub_add_cancel hnd₀
have hnd₂: 0 < nd.1 - 1 := by
refine Nat.sub_pos_of_lt ?_
exact lt_of_lt_of_le (Nat.one_lt_two) nd.2
constructor
· constructor
· refine h₇ nd.1 y hnd₀ ?_
exact (hy₀ (nd.1) hnd₀).2.1
· refine h₇ nd.1 x hnd₀ ?_
exact (hx₀ (nd.1) hnd₀).2.1
· constructor
· rw [← hnd₁]
exact (hy₀ (nd.1 - 1) hnd₂).2.2
· rw [← hnd₁]
exact (hx₀ (nd.1 - 1) hnd₂).2.2
apply Filter.tendsto_atTop_atTop.mp at hy₃
apply tendsto_atTop_nhds.mp at hy₄
contrapose! hy₄
clear hy₄
let sx : Set ℝ := Set.Ioo (-1) 1
use sx
constructor
· refine Set.mem_Ioo.mpr ?_
simp
constructor
· exact isOpen_Ioo
· intro N
have hy₅: ∃ i, ∀ (a : ↑sd), i ≤ a → N + 3 ≤ fd y x a := by exact hy₃ (N + 3)
obtain ⟨i, hi₀⟩ := hy₅
have hi₁: (N.1 + i.1) ∈ sd := by
refine Set.mem_Ici.mpr ?_
rw [← add_zero 2]
exact Nat.add_le_add N.2 (Nat.zero_le ↑i)
let a : ↑sd := ⟨N + i, hi₁⟩
use a
constructor
· refine Subtype.mk_le_mk.mpr ?_
exact Nat.le_add_right ↑N ↑i
· refine Set.notMem_Ioo_of_ge ?_
have hi₂: ↑↑N + 3 ≤ fd y x a := by
refine hi₀ a ?_
refine Subtype.mk_le_mk.mpr ?_
exact Nat.le_add_left ↑i ↑N
refine le_trans ?_ hi₂
norm_cast
exact Nat.le_add_left 1 (↑N + 2)
lemma imo_1985_p6_nnreal
(f : ℕ → NNReal → ℝ)
(h₀ : ∀ x, f 1 x = x)
(h₁ : ∀ n x, 0 < n → f (n + 1) x = f n x * (f n x + 1 / n)) :
∃! a, ∀ n, 0 < n → 0 < f n a ∧ f n a < f (n + 1) a ∧ f (n + 1) a < 1 := by
have h₂: ∀ n x, 0 < n ∧ 0 < x → 0 < f n x := by
exact fun n x a => aux_1 f h₀ h₁ n x a
have h₃: ∀ n x, 0 < n → 0 ≤ f n x := by
intro n x hn
refine Nat.le_induction ?_ ?_ n hn
· rw [h₀ x]
exact NNReal.zero_le_coe
· intro d hd₀ hd₁
rw [h₁ d x hd₀]
positivity
have hmo₀: ∀ n, 0 < n → StrictMono (f n) := by
intro n hn₀
refine Monotone.strictMono_of_injective ?h₁ ?h₂
· refine monotone_iff_forall_lt.mpr ?h₁.a
intro a b hab
refine le_of_lt ?_
exact aux_2 f h₀ h₁ h₃ n a b hn₀ hab
· intro p q hpq
contrapose! hpq
apply lt_or_gt_of_ne at hpq
obtain hpq | hpq := hpq
· refine ne_of_lt ?_
exact aux_2 f h₀ h₁ h₃ n p q hn₀ hpq
· symm
refine ne_of_lt ?_
exact aux_2 f h₀ h₁ h₃ n q p hn₀ hpq
have hmo₁: ∀ n, 0 < n → Function.Injective (f n) := fun n a => StrictMono.injective (hmo₀ n a)
let f₀: ℕ → NNReal → NNReal := fun n x => (f n x).toNNReal
have hf₀: f₀ = fun n x => (f n x).toNNReal := by rfl
have hf₁: ∀ n x, 0 < n → f n x = f₀ n x := by
intro n x hn₀
rw [hf₀]
simp
exact h₃ n x hn₀
have hf₂: ∀ n x, 0 < n → f₀ n x = (f n x).toNNReal := by
intro n x _
rw [hf₀]
have hmo₂: ∀ n, 0 < n → StrictMono (f₀ n) := by
intro n hn₀
refine aux_4 f h₃ ?_ f₀ hf₀ n hn₀
exact fun n x y a a_1 => hmo₀ n a a_1
let fi : ℕ → NNReal → NNReal := fun n => Function.invFun (f₀ n)
have hmo₇: ∀ n, 0 < n → Function.RightInverse (fi n) (f₀ n) := by
intro n hn₀
refine Function.rightInverse_invFun ?_
have h₄: ∀ n x y, 0 < n → x < y → f n x < f n y := by
exact fun n x y a a_1 => aux_2 f h₀ h₁ h₃ n x y a a_1
refine aux_7 f h₀ h₁ h₃ ?_ f₀ hf₂ hmo₂ ?_ n hn₀
· exact fun n x a => aux_3 f h₀ h₁ h₄ n x a
· intro m hm₀
exact aux_6 f h₀ h₁ f₀ hf₀ m hm₀
have hf₇: ∀ n x y, 0 < n → (f₀ n x = y ↔ fi n y = x) := by
intro n x y hn₀
constructor
· intro hn₁
exact aux_5 f hmo₁ f₀ hmo₂ fi rfl n x y hn₀ hn₁
· intro hn₁
rw [← hn₁]
exact hmo₁ n hn₀ (congrArg (f n) (hmo₇ n hn₀ y))
let sn : Set ℕ := Set.Ici 1
let fb : ↑sn → NNReal := sn.restrict (fun (n:ℕ) => fi n (1 - 1 / (n:NNReal)))
let fc : ↑sn → NNReal := sn.restrict (fun (n:ℕ) => fi n 1)
have hsn₁: ∀ n:↑sn, ↑n ∈ sn ∧ 0 < (↑n:ℕ) := by
intro n
have hn₀: ↑n ∈ sn := by exact Subtype.coe_prop n
constructor
· exact Subtype.coe_prop n
· exact hn₀
have hfb₀: fb = fun (n:↑sn) => fi n (1 - 1 / (n:NNReal)) := by rfl
have hfc₀: fc = fun (n:↑sn) => fi n 1 := by rfl
have hfb₁: ∀ n:↑sn, f₀ n (fb n) = 1 - 1 / (n:NNReal) := by
intro n
have hn₀: 0 < (n:ℕ) := by exact (hsn₁ n).2
rw [hfb₀]
exact hmo₁ n hn₀ (congrArg (f n) (hmo₇ n hn₀ (1 - 1 / (n:NNReal))))
have hfc₁: ∀ n:↑sn, f₀ n (fc n) = 1 := by
intro n
have hn₀: 0 < (n:ℕ) := by exact (hsn₁ n).2
rw [hfc₀]
exact hmo₁ n hn₀ (congrArg (f n) (hmo₇ n hn₀ 1))
have hu₁: ∀ n:↑sn, fb n < 1 := by
exact aux_8 f h₀ h₁ hmo₀ hmo₁ f₀ hf₂ sn fb hsn₁ hfb₁
have hfc₂: ∀ n:↑sn, fb n < fc n := by
intro n
have hn₀: 0 < (n:ℕ) := by exact (hsn₁ n).2
have g₀: f₀ n (fb n) < f₀ n (fc n) := by
rw [hfb₁ n, hfc₁ n]
simp
exact (hsn₁ n).2
exact (StrictMono.lt_iff_lt (hmo₂ n hn₀)).mp g₀
have hfb₃: StrictMono fb := by
refine StrictMonoOn.restrict ?_
refine aux_9 f h₀ h₁ f₀ hf₁ hf₂ hmo₂ fi ?_ hmo₇ hf₇ _ (by rfl) sn (by rfl)
intro x
refine (hf₇ 1 x x (by omega)).mp ?_
rw [hf₂ 1 x (by omega), h₀]
exact Real.toNNReal_coe
have hfc₃: StrictAnti fc := by
have g₀: StrictAntiOn (fun n => fi n 1) sn := by
refine strictAntiOn_Ici_of_lt_pred ?_
intro m hm₀
have hm₁: 0 < m - 1 := by exact Nat.zero_lt_sub_of_lt hm₀
have hm₂: m = m - 1 + 1 := by rw [Nat.sub_add_cancel (le_of_lt hm₀)]
have hm₃: 0 < m := by exact Nat.zero_lt_of_lt hm₀
simp
let x := fi m 1
let y := fi (m - 1) 1
have hx₀: x = fi m 1 := by rfl
have hy₀: y = fi (m - 1) 1 := by rfl
have hx₁: f₀ m x = 1 := by exact (hf₇ m x 1 (by omega)).mpr hx₀.symm
have hy₁: f₀ (m - 1) y = 1 := by
exact (hf₇ (m - 1) y 1 hm₁).mpr hy₀.symm
have hy₂: f (m - 1) y = 1 := by
rw [hf₁ (m - 1) y hm₁, hy₁]
exact rfl
have hf: StrictMono (f m) := by exact hmo₀ m hm₃
refine (StrictMono.lt_iff_lt hf).mp ?_
rw [← hx₀, ← hy₀]
rw [hf₁ m x hm₃, hf₁ m y hm₃]
refine NNReal.coe_lt_coe.mpr ?_
rw [hx₁, hf₂ m y hm₃, hm₂, h₁ (m - 1) y hm₁, hy₂]
simp
exact hm₀
intro m n hmn
rw [hfc₀]
simp
let mn : ℕ := ↑m
let nn : ℕ := ↑n
have hm₀: mn ∈ sn := by exact Subtype.coe_prop m
have hn₀: nn ∈ sn := by exact Subtype.coe_prop n
exact g₀ hm₀ hn₀ hmn
let sb := Set.range fb
let sc := Set.range fc
have hsb₀: sb = Set.range fb := by rfl
have hsc₀: sc = Set.range fc := by rfl
let fr : NNReal → ℝ := fun x => x.toReal
let sbr := Set.image fr sb
let scr := Set.image fr sc
have hu₃: ∃ br, IsLUB sbr br := by
refine Real.exists_isLUB ?_ ?_
· exact Set.Nonempty.of_subtype
· refine NNReal.bddAbove_coe.mpr ?_
refine (bddAbove_iff_exists_ge 1).mpr ?_
use 1
constructor
· exact Preorder.le_refl 1
· intro y hy₀
apply Set.mem_range.mp at hy₀
obtain ⟨na, hna₀⟩ := hy₀
refine le_of_lt ?_
rw [← hna₀]
exact hu₁ na
have hu₄: ∃ cr, IsGLB scr cr := by
refine Real.exists_isGLB ?_ ?_
· exact Set.Nonempty.of_subtype
· exact NNReal.bddBelow_coe sc
obtain ⟨br, hbr₀⟩ := hu₃
obtain ⟨cr, hcr₀⟩ := hu₄
have h₇: ∀ n x, 0 < n → (f n x < f (n + 1) x → 1 - 1 / n < f n x) := by
intro n x hn₀ hn₁
rw [h₁ n x hn₀] at hn₁
nth_rw 1 [← mul_one (f n x)] at hn₁
suffices g₀: 1 < f n x + 1 / ↑n
· exact sub_right_lt_of_lt_add g₀
· refine lt_of_mul_lt_mul_left hn₁ ?_
exact h₃ n x hn₀
have h₈: ∀ n x, 0 < n → 0 < x → 1 - 1 / n < f n x → f n x < f (n + 1) x := by
intro n x hn₀ hx₀ hn₁
rw [h₁ n x hn₀]
suffices g₀: 1 < f n x + 1 / ↑n
· nth_rw 1 [← mul_one (f n x)]
refine mul_lt_mul' ?_ g₀ ?_ ?_
· exact Preorder.le_refl (f n x)
· exact zero_le_one' ℝ
· exact lt_of_lt_of_le' (hmo₀ n hn₀ hx₀) (h₃ n 0 hn₀)
· exact lt_add_of_tsub_lt_right hn₁
have hbr₁: 0 < br := by
exact aux_10 f h₀ h₁ f₀ hf₂ fi hmo₇ sn sb fb (by rfl) hfb₀ hsb₀ fr (by rfl) sbr (by rfl) br hbr₀
have hu₅: br ≤ cr := by
exact aux_11 sn fb fc hfc₂ hfb₃ hfc₃ sb sc hsb₀ hsc₀ fr
(by rfl) sbr scr (by rfl) (by rfl) br cr hbr₀ hcr₀
have hbr₃: ∀ x ∈ sbr, x ≤ br := by
refine mem_upperBounds.mp ?_
refine (isLUB_le_iff hbr₀).mp ?_
exact Preorder.le_refl br
have hcr₃: ∀ x ∈ scr, cr ≤ x := by
refine mem_lowerBounds.mp ?_
refine (le_isGLB_iff hcr₀).mp ?_
exact Preorder.le_refl cr
refine existsUnique_of_exists_of_unique ?_ ?_
· exact aux_exists f h₂ hmo₀ f₀ hf₁ sn (by rfl)
fb fc hfb₁ hfc₁ hfb₃ hfc₃ sb sc hsb₀ hsc₀
fr (by rfl) sbr scr (by rfl) (by rfl) br cr h₈ hbr₁ hu₅ hbr₃ hcr₃
· intro x y hx₀ hy₀
exact aux_unique f h₁ hmo₀ h₇ x y hx₀ hy₀
theorem imo_1985_p6
(f : ℕ → ℝ → ℝ)
(h₀ : ∀ x, f 1 x = x)
(h₁ : ∀ n x, 0 < n → f (n + 1) x = f n x * (f n x + 1 / n)) :
∃! a, ∀ n, 0 < n → 0 < f n a ∧ f n a < f (n + 1) a ∧ f (n + 1) a < 1 := by
let fn : ℕ → NNReal → ℝ := fun n x => f n x
have hfn₁: ∀ n x, 0 < n → 0 ≤ x → fn n x = f n x := by
exact fun n x a a ↦ rfl
have h₂: ∃! a, ∀ (n : ℕ), 0 < n → 0 < fn n a ∧ fn n a < fn (n + 1) a ∧ fn (n + 1) a < 1 := by
exact imo_1985_p6_nnreal fn (fun x ↦ h₀ ↑x) fun n x ↦ h₁ n ↑x
obtain ⟨a, ha₀, ha₁⟩ := h₂
refine ⟨a, ha₀, fun y hy₀ ↦ ?_⟩
have hy₁: 0 ≤ y.toNNReal := by exact zero_le y.toNNReal
by_cases hy₂: 0 ≤ y
· refine (Real.toNNReal_eq_toNNReal_iff hy₂ ?_).mp ?_
· exact NNReal.zero_le_coe
· rw [Real.toNNReal_coe]
refine ha₁ y.toNNReal ?_
intro n hn₀
rw [hfn₁ n _ hn₀ hy₁, hfn₁ (n + 1) _ (by omega) hy₁]
rw [Real.coe_toNNReal y hy₂]
exact hy₀ n hn₀
· exfalso
push_neg at hy₂
have hy₃: f 1 y < 0 := by
rw [h₀]
exact hy₂
have hy₄: 0 < f 1 y := by
exact (hy₀ 1 (by decide)).1
order
end Imo1985P6 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1985P6.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unsolved goals\nf : \u2115 \u2192 NNReal \u2192 \u211d\nh\u2080 : \u2200 (x : NNReal), f 1 x = \u2191x\nh\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / \u2191n)\nh\u2084 : \u2200 (n : \u2115) (x y : NNReal), 0 < n \u2192 x < y \u2192 f n x < f n y\nn : \u2115\nx : NNReal\nhn\u2080 : 1 < n\nhx\u2081 : 1 \u2264 x\ng\u2082\u2080 : f n 1 \u2264 f n x\nm : \u2115\nhm\u2080 : Nat.succ 1 \u2264 m\nhm\u2081 : \u21911 < f m 1\n\u22a2 0 < m", "unsolved goals\ncase refine_2\nf : \u2115 \u2192 NNReal \u2192 \u211d\nh\u2080 : \u2200 (x : NNReal), f 1 x = \u2191x\nh\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / \u2191n)\nh\u2084 : \u2200 (n : \u2115) (x y : NNReal), 0 < n \u2192 x < y \u2192 f n x < f n y\nn : \u2115\nx : NNReal\nhn\u2080 : 1 < n\nhx\u2081 : 1 \u2264 x\ng\u2082\u2080 : f n 1 \u2264 f n x\nm : \u2115\nhm\u2080 : Nat.succ 1 \u2264 m\nhm\u2081 : \u21911 < f m 1\n\u22a2 \u21911 < f m 1 * (f m 1 + 1 / \u2191m)", "unsolved goals\ncase intro\nf : \u2115 \u2192 NNReal \u2192 \u211d\nh\u2080 : \u2200 (x : NNReal), f 1 x = \u2191x\nh\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / \u2191n)\nh\u2084 : \u2200 (n : \u2115) (x y : NNReal), 0 < n \u2192 x < y \u2192 f n x < f n y\nn : \u2115\nx : NNReal\nhn\u2080 : 1 < n\nhx\u2081 : 1 \u2264 x\ng\u2082\u2080 : f n 1 \u2264 f n x\ng\u2082\u2081 : f 1 1 < f n 1\n\u22a2 1 < f n x", "unknown tactic", "unknown tactic", "unsolved goals\nf : \u2115 \u2192 NNReal \u2192 \u211d\nh\u2080 : \u2200 (x : NNReal), f 1 x = \u2191x\nh\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / \u2191n)\nhmo\u2080 : \u2200 (n : \u2115), 0 < n \u2192 StrictMono (f n)\nhmo\u2081 : \u2200 (n : \u2115), 0 < n \u2192 Function.Injective (f n)\nf\u2080 : \u2115 \u2192 NNReal \u2192 NNReal\nhf\u2082 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f\u2080 n x = (f n x).toNNReal\nsn : Set \u2115\nfb : \u2191sn \u2192 NNReal\nhsn\u2081 : \u2200 (n : \u2191sn), \u2191n \u2208 sn \u2227 0 < \u2191n\nhfb\u2081 : \u2200 (n : \u2191sn), f\u2080 (\u2191n) (fb n) = 1 - 1 / \u2191\u2191n\nn : \u2191sn\nhn\u2080 : 0 < \u2191n\nz : NNReal := fb n\nhz\u2080 : z = fb n\nhc\u2080 : 1 \u2264 z\nhn\u2081 : \u00ac1 < \u2191n\n\u22a2 \u2191n = 1", "unsolved goals\ncase neg\nf : \u2115 \u2192 NNReal \u2192 \u211d\nh\u2080 : \u2200 (x : NNReal), f 1 x = \u2191x\nh\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / \u2191n)\nhmo\u2080 : \u2200 (n : \u2115), 0 < n \u2192 StrictMono (f n)\nhmo\u2081 : \u2200 (n : \u2115), 0 < n \u2192 Function.Injective (f n)\nf\u2080 : \u2115 \u2192 NNReal \u2192 NNReal\nhf\u2082 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f\u2080 n x = (f n x).toNNReal\nsn : Set \u2115\nfb : \u2191sn \u2192 NNReal\nhsn\u2081 : \u2200 (n : \u2191sn), \u2191n \u2208 sn \u2227 0 < \u2191n\nhfb\u2081 : \u2200 (n : \u2191sn), f\u2080 (\u2191n) (fb n) = 1 - 1 / \u2191\u2191n\nn : \u2191sn\nhn\u2080 : 0 < \u2191n\nz : NNReal := fb n\nhz\u2080 : z = fb n\nhc\u2080 : 1 \u2264 z\nhn\u2081 : \u00ac1 < \u2191n\nhn\u2082 : \u2191n = 1\n\u22a2 1 \u2264 f (\u2191n) z", "unsolved goals\nf : \u2115 \u2192 NNReal \u2192 \u211d\nh\u2080 : \u2200 (x : NNReal), f 1 x = \u2191x\nh\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / \u2191n)\nhmo\u2080 : \u2200 (n : \u2115), 0 < n \u2192 StrictMono (f n)\nhmo\u2081 : \u2200 (n : \u2115), 0 < n \u2192 Function.Injective (f n)\nf\u2080 : \u2115 \u2192 NNReal \u2192 NNReal\nhf\u2082 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f\u2080 n x = (f n x).toNNReal\nsn : Set \u2115\nfb : \u2191sn \u2192 NNReal\nhsn\u2081 : \u2200 (n : \u2191sn), \u2191n \u2208 sn \u2227 0 < \u2191n\nhfb\u2081 : \u2200 (n : \u2191sn), f\u2080 (\u2191n) (fb n) = 1 - 1 / \u2191\u2191n\nn : \u2191sn\nhn\u2080 : 0 < \u2191n\nz : NNReal := fb n\nhz\u2080 : z = fb n\nhc\u2080 : 1 \u2264 z\nhc\u2081 : 1 \u2264 f (\u2191n) z\n\u22a2 False", "unknown tactic", "unsolved goals\nf : \u2115 \u2192 NNReal \u2192 \u211d\nh\u2080 : \u2200 (x : NNReal), f 1 x = \u2191x\nh\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / \u2191n)\nf\u2080 : \u2115 \u2192 NNReal \u2192 NNReal\nhf\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f n x = \u2191(f\u2080 n x)\nhf\u2082 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f\u2080 n x = (f n x).toNNReal\nhmo\u2082 : \u2200 (n : \u2115), 0 < n \u2192 StrictMono (f\u2080 n)\nfi : \u2115 \u2192 NNReal \u2192 NNReal\nhf\u2085 : \u2200 (x : NNReal), fi 1 x = x\nhmo\u2087 : \u2200 (n : \u2115), 0 < n \u2192 Function.RightInverse (fi n) (f\u2080 n)\nhf\u2087 : \u2200 (n : \u2115) (x y : NNReal), 0 < n \u2192 (f\u2080 n x = y \u2194 fi n y = x)\nfb : \u2115 \u2192 NNReal\nhfb\u2080 : fb = fun n => fi n (1 - 1 / \u2191n)\nsn : Set \u2115\nhsn : sn = Set.Ici 1\nm : \u2115\nhm\u2080 : 1 < m\ng\u2081 : fi 1 0 = 0\ng\u2082 : NNReal.HolderConjugate 2 2\nx : NNReal := fi 2 2\u207b\u00b9\nhx\u2080 : x = fi 2 2\u207b\u00b9\n\u22a2 0 < 2", "unsolved goals\nf : \u2115 \u2192 NNReal \u2192 \u211d\nh\u2080 : \u2200 (x : NNReal), f 1 x = \u2191x\nh\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / \u2191n)\nf\u2080 : \u2115 \u2192 NNReal \u2192 NNReal\nhf\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f n x = \u2191(f\u2080 n x)\nhf\u2082 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f\u2080 n x = (f n x).toNNReal\nhmo\u2082 : \u2200 (n : \u2115), 0 < n \u2192 StrictMono (f\u2080 n)\nfi : \u2115 \u2192 NNReal \u2192 NNReal\nhf\u2085 : \u2200 (x : NNReal), fi 1 x = x\nhmo\u2087 : \u2200 (n : \u2115), 0 < n \u2192 Function.RightInverse (fi n) (f\u2080 n)\nhf\u2087 : \u2200 (n : \u2115) (x y : NNReal), 0 < n \u2192 (f\u2080 n x = y \u2194 fi n y = x)\nfb : \u2115 \u2192 NNReal\nhfb\u2080 : fb = fun n => fi n (1 - 1 / \u2191n)\nsn : Set \u2115\nhsn : sn = Set.Ici 1\nm : \u2115\nhm\u2080 : 1 < m\ng\u2081 : fi 1 0 = 0\ng\u2082 : NNReal.HolderConjugate 2 2\nx : NNReal := fi 2 2\u207b\u00b9\nhx\u2080 : x = fi 2 2\u207b\u00b9\ng\u2083 : Function.RightInverse (fi 2) (f\u2080 2)\n\u22a2 f\u2080 2 (fi 2 2\u207b\u00b9) = 2\u207b\u00b9", "unsolved goals\ncase h\u03c8.refine_1\nf : \u2115 \u2192 NNReal \u2192 \u211d\nh\u2080 : \u2200 (x : NNReal), f 1 x = \u2191x\nh\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / \u2191n)\nf\u2080 : \u2115 \u2192 NNReal \u2192 NNReal\nhf\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f n x = \u2191(f\u2080 n x)\nhf\u2082 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f\u2080 n x = (f n x).toNNReal\nhmo\u2082 : \u2200 (n : \u2115), 0 < n \u2192 StrictMono (f\u2080 n)\nfi : \u2115 \u2192 NNReal \u2192 NNReal\nhf\u2085 : \u2200 (x : NNReal), fi 1 x = x\nhmo\u2087 : \u2200 (n : \u2115), 0 < n \u2192 Function.RightInverse (fi n) (f\u2080 n)\nhf\u2087 : \u2200 (n : \u2115) (x y : NNReal), 0 < n \u2192 (f\u2080 n x = y \u2194 fi n y = x)\nfb : \u2115 \u2192 NNReal\nhfb\u2080 : fb = fun n => fi n (1 - 1 / \u2191n)\nsn : Set \u2115\nhsn : sn = Set.Ici 1\nm : \u2115\nhm\u2080 : 1 < m\ng\u2081 : fi 1 0 = 0\ng\u2082 : NNReal.HolderConjugate 2 2\nx : NNReal := fi 2 2\u207b\u00b9\nhx\u2080 : x = fi 2 2\u207b\u00b9\nhx\u2081 : f\u2080 2 x = 2\u207b\u00b9\n\u22a2 0 < fi 2 2\u207b\u00b9", "unsolved goals\ncase h\u03c8.refine_2\nf : \u2115 \u2192 NNReal \u2192 \u211d\nh\u2080 : \u2200 (x : NNReal), f 1 x = \u2191x\nh\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / \u2191n)\nf\u2080 : \u2115 \u2192 NNReal \u2192 NNReal\nhf\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f n x = \u2191(f\u2080 n x)\nhf\u2082 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f\u2080 n x = (f n x).toNNReal\nhmo\u2082 : \u2200 (n : \u2115), 0 < n \u2192 StrictMono (f\u2080 n)\nfi : \u2115 \u2192 NNReal \u2192 NNReal\nhf\u2085 : \u2200 (x : NNReal), fi 1 x = x\nhmo\u2087 : \u2200 (n : \u2115), 0 < n \u2192 Function.RightInverse (fi n) (f\u2080 n)\nhf\u2087 : \u2200 (n : \u2115) (x y : NNReal), 0 < n \u2192 (f\u2080 n x = y \u2194 fi n y = x)\nfb : \u2115 \u2192 NNReal\nhfb\u2080 : fb = fun n => fi n (1 - 1 / \u2191n)\nsn : Set \u2115\nhsn : sn = Set.Ici 1\nm : \u2115\nhm\u2080 : 1 < m\n\u22a2 \u2200 (n : \u2115),\n Nat.succ 1 \u2264 n \u2192\n (fun n => fi n (1 - 1 / \u2191n)) (Order.pred n) < (fun n => fi n (1 - 1 / \u2191n)) n \u2192\n (fun n => fi n (1 - 1 / \u2191n)) (Order.pred (n + 1)) < (fun n => fi n (1 - 1 / \u2191n)) (n + 1)", "unknown tactic", "unsolved goals\nf : \u2115 \u2192 NNReal \u2192 \u211d\nh\u2080 : \u2200 (x : NNReal), f 1 x = \u2191x\nh\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / \u2191n)\nf\u2080 : \u2115 \u2192 NNReal \u2192 NNReal\nhf\u2082 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f\u2080 n x = (f n x).toNNReal\nfi : \u2115 \u2192 NNReal \u2192 NNReal\nhmo\u2087 : \u2200 (n : \u2115), 0 < n \u2192 Function.RightInverse (fi n) (f\u2080 n)\nsn : Set \u2115\nsb : Set NNReal\nfb : \u2191sn \u2192 NNReal\nhsn\u2080 : sn = Set.Ici 1\nhfb\u2080 : fb = fun n => fi (\u2191n) (1 - 1 / \u2191\u2191n)\nhsb\u2080 : sb = Set.range fb\nfr : NNReal \u2192 \u211d\nhfr : fr = fun x => \u2191x\nsbr : Set \u211d\nhsbr : sbr = fr '' sb\nbr : \u211d\nhbr\u2080 : IsLUB sbr br\nhnb\u2080 : 2 \u2208 sn\nnb : \u2191sn := \u27e82, hnb\u2080\u27e9\ng\u2081 : NNReal.HolderConjugate 2 2\nhnb\u2081 : \u2191nb = 2\nx : NNReal := fi 2 2\u207b\u00b9\nhx\u2080 : x = fi 2 2\u207b\u00b9\n\u22a2 0 < 2", "unsolved goals\nf : \u2115 \u2192 NNReal \u2192 \u211d\nh\u2080 : \u2200 (x : NNReal), f 1 x = \u2191x\nh\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / \u2191n)\nf\u2080 : \u2115 \u2192 NNReal \u2192 NNReal\nhf\u2082 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f\u2080 n x = (f n x).toNNReal\nfi : \u2115 \u2192 NNReal \u2192 NNReal\nhmo\u2087 : \u2200 (n : \u2115), 0 < n \u2192 Function.RightInverse (fi n) (f\u2080 n)\nsn : Set \u2115\nsb : Set NNReal\nfb : \u2191sn \u2192 NNReal\nhsn\u2080 : sn = Set.Ici 1\nhfb\u2080 : fb = fun n => fi (\u2191n) (1 - 1 / \u2191\u2191n)\nhsb\u2080 : sb = Set.range fb\nfr : NNReal \u2192 \u211d\nhfr : fr = fun x => \u2191x\nsbr : Set \u211d\nhsbr : sbr = fr '' sb\nbr : \u211d\nhbr\u2080 : IsLUB sbr br\nhnb\u2080 : 2 \u2208 sn\nnb : \u2191sn := \u27e82, hnb\u2080\u27e9\ng\u2081 : NNReal.HolderConjugate 2 2\nhnb\u2081 : \u2191nb = 2\nx : NNReal := fi 2 2\u207b\u00b9\nhx\u2080 : x = fi 2 2\u207b\u00b9\ng\u2083 : Function.RightInverse (fi 2) (f\u2080 2)\n\u22a2 f\u2080 2 (fi 2 2\u207b\u00b9) = 2\u207b\u00b9", "unsolved goals\nf : \u2115 \u2192 NNReal \u2192 \u211d\nh\u2080 : \u2200 (x : NNReal), f 1 x = \u2191x\nh\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / \u2191n)\nf\u2080 : \u2115 \u2192 NNReal \u2192 NNReal\nhf\u2082 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f\u2080 n x = (f n x).toNNReal\nfi : \u2115 \u2192 NNReal \u2192 NNReal\nhmo\u2087 : \u2200 (n : \u2115), 0 < n \u2192 Function.RightInverse (fi n) (f\u2080 n)\nsn : Set \u2115\nsb : Set NNReal\nfb : \u2191sn \u2192 NNReal\nhsn\u2080 : sn = Set.Ici 1\nhfb\u2080 : fb = fun n => fi (\u2191n) (1 - 1 / \u2191\u2191n)\nhsb\u2080 : sb = Set.range fb\nfr : NNReal \u2192 \u211d\nhfr : fr = fun x => \u2191x\nsbr : Set \u211d\nhsbr : sbr = fr '' sb\nbr : \u211d\nhbr\u2080 : IsLUB sbr br\nhnb\u2080 : 2 \u2208 sn\nnb : \u2191sn := \u27e82, hnb\u2080\u27e9\ng\u2081 : NNReal.HolderConjugate 2 2\nhnb\u2081 : \u2191nb = 2\nx : NNReal := fi 2 2\u207b\u00b9\nhx\u2080 : x = fi 2 2\u207b\u00b9\nhx\u2081 : f\u2080 2 x = 2\u207b\u00b9\n\u22a2 0 < fi 2 2\u207b\u00b9", "unsolved goals\nf : \u2115 \u2192 NNReal \u2192 \u211d\nh\u2080 : \u2200 (x : NNReal), f 1 x = \u2191x\nh\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / \u2191n)\nf\u2080 : \u2115 \u2192 NNReal \u2192 NNReal\nhf\u2082 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f\u2080 n x = (f n x).toNNReal\nfi : \u2115 \u2192 NNReal \u2192 NNReal\nhmo\u2087 : \u2200 (n : \u2115), 0 < n \u2192 Function.RightInverse (fi n) (f\u2080 n)\nsn : Set \u2115\nsb : Set NNReal\nfb : \u2191sn \u2192 NNReal\nhsn\u2080 : sn = Set.Ici 1\nhfb\u2080 : fb = fun n => fi (\u2191n) (1 - 1 / \u2191\u2191n)\nhsb\u2080 : sb = Set.range fb\nfr : NNReal \u2192 \u211d\nhfr : fr = fun x => \u2191x\nsbr : Set \u211d\nhsbr : sbr = fr '' sb\nbr : \u211d\nhbr\u2080 : IsLUB sbr br\nhnb\u2080 : 2 \u2208 sn\nnb : \u2191sn := \u27e82, hnb\u2080\u27e9\ng\u2080 : 0 < fb nb\n\u22a2 0 < br", "unknown tactic", "unsolved goals\nf : \u2115 \u2192 NNReal \u2192 \u211d\nh\u2082 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2227 0 < x \u2192 0 < f n x\nhmo\u2080 : \u2200 (n : \u2115), 0 < n \u2192 StrictMono (f n)\nf\u2080 : \u2115 \u2192 NNReal \u2192 NNReal\nhf\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f n x = \u2191(f\u2080 n x)\nsn : Set \u2115\nhsn\u2080 : sn = Set.Ici 1\nfb fc : \u2191sn \u2192 NNReal\nhfb\u2081 : \u2200 (n : \u2191sn), f\u2080 (\u2191n) (fb n) = 1 - 1 / \u2191\u2191n\nhfc\u2081 : \u2200 (n : \u2191sn), f\u2080 (\u2191n) (fc n) = 1\nhfb\u2083 : StrictMono fb\nhfc\u2083 : StrictAnti fc\nsb sc : Set NNReal\nhsb\u2080 : sb = Set.range fb\nhsc\u2080 : sc = Set.range fc\nfr : NNReal \u2192 \u211d\nhfr : fr = fun x => \u2191x\nsbr scr : Set \u211d\nhsbr : sbr = fr '' sb\nhscr : scr = fr '' sc\nbr cr : \u211d\nh\u2088 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 0 < x \u2192 1 - 1 / \u2191n < f n x \u2192 f n x < f (n + 1) x\nhbr\u2081 : 0 < br\nhu\u2085 : br \u2264 cr\nhbr\u2083 : \u2200 x \u2208 sbr, x \u2264 br\nhcr\u2083 : \u2200 x \u2208 scr, cr \u2264 x\nhu\u2086 : \u2203 a, br < a \u2227 a < cr\na : \u211d\nha\u2080 : br < a\nha\u2081 : a < cr\nha\u2082 : 0 < a\nha\u2083 : 0 < a.toNNReal\nn : \u2115\nhn\u2080 : 0 < n\nhn\u2081 : n \u2208 sn\n\u22a2 1 \u2264 n + 1", "unsolved goals\ncase h.right.right\nf : \u2115 \u2192 NNReal \u2192 \u211d\nh\u2082 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2227 0 < x \u2192 0 < f n x\nhmo\u2080 : \u2200 (n : \u2115), 0 < n \u2192 StrictMono (f n)\nf\u2080 : \u2115 \u2192 NNReal \u2192 NNReal\nhf\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f n x = \u2191(f\u2080 n x)\nsn : Set \u2115\nhsn\u2080 : sn = Set.Ici 1\nfb fc : \u2191sn \u2192 NNReal\nhfb\u2081 : \u2200 (n : \u2191sn), f\u2080 (\u2191n) (fb n) = 1 - 1 / \u2191\u2191n\nhfc\u2081 : \u2200 (n : \u2191sn), f\u2080 (\u2191n) (fc n) = 1\nhfb\u2083 : StrictMono fb\nhfc\u2083 : StrictAnti fc\nsb sc : Set NNReal\nhsb\u2080 : sb = Set.range fb\nhsc\u2080 : sc = Set.range fc\nfr : NNReal \u2192 \u211d\nhfr : fr = fun x => \u2191x\nsbr scr : Set \u211d\nhsbr : sbr = fr '' sb\nhscr : scr = fr '' sc\nbr cr : \u211d\nh\u2088 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 0 < x \u2192 1 - 1 / \u2191n < f n x \u2192 f n x < f (n + 1) x\nhbr\u2081 : 0 < br\nhu\u2085 : br \u2264 cr\nhbr\u2083 : \u2200 x \u2208 sbr, x \u2264 br\nhcr\u2083 : \u2200 x \u2208 scr, cr \u2264 x\nhu\u2086 : \u2203 a, br < a \u2227 a < cr\na : \u211d\nha\u2080 : br < a\nha\u2081 : a < cr\nha\u2082 : 0 < a\nha\u2083 : 0 < a.toNNReal\nn : \u2115\nhn\u2080 : 0 < n\nhn\u2081 : n \u2208 sn\nhn\u2082 : n + 1 \u2208 sn\n\u22a2 f (n + 1) a.toNNReal < 1", "unsolved goals\ncase inr\nf : \u2115 \u2192 NNReal \u2192 \u211d\nh\u2082 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2227 0 < x \u2192 0 < f n x\nhmo\u2080 : \u2200 (n : \u2115), 0 < n \u2192 StrictMono (f n)\nf\u2080 : \u2115 \u2192 NNReal \u2192 NNReal\nhf\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f n x = \u2191(f\u2080 n x)\nsn : Set \u2115\nhsn\u2080 : sn = Set.Ici 1\nfb fc : \u2191sn \u2192 NNReal\nhfb\u2081 : \u2200 (n : \u2191sn), f\u2080 (\u2191n) (fb n) = 1 - 1 / \u2191\u2191n\nhfc\u2081 : \u2200 (n : \u2191sn), f\u2080 (\u2191n) (fc n) = 1\nhfb\u2083 : StrictMono fb\nhfc\u2083 : StrictAnti fc\nsb sc : Set NNReal\nhsb\u2080 : sb = Set.range fb\nhsc\u2080 : sc = Set.range fc\nfr : NNReal \u2192 \u211d\nhfr : fr = fun x => \u2191x\nsbr scr : Set \u211d\nhsbr : sbr = fr '' sb\nhscr : scr = fr '' sc\nbr cr : \u211d\nh\u2088 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 0 < x \u2192 1 - 1 / \u2191n < f n x \u2192 f n x < f (n + 1) x\nhbr\u2081 : 0 < br\nhu\u2085 : br \u2264 cr\nhbr\u2083 : \u2200 x \u2208 sbr, x \u2264 br\nhcr\u2083 : \u2200 x \u2208 scr, cr \u2264 x\nhu\u2086 : br = cr\n\u22a2 \u2203 x, \u2200 (n : \u2115), 0 < n \u2192 0 < f n x \u2227 f n x < f (n + 1) x \u2227 f (n + 1) x < 1", "unknown tactic", "unsolved goals\nf : \u2115 \u2192 NNReal \u2192 \u211d\nsd : Set \u2115\nhsd : sd = Set.Ici 2\nfd : NNReal \u2192 NNReal \u2192 \u2191sd \u2192 \u211d\nhfd\u2081 : \u2200 (y\u2081 y\u2082 : NNReal) (n : \u2191sd), fd y\u2081 y\u2082 n = f (\u2191n) y\u2082 - f (\u2191n) y\u2081\nhd\u2081 : \u2200 (n : \u2191sd) (a b : NNReal), a < b \u2192 0 < fd a b n\na b : NNReal\nha\u2080 : a < b\nhd\u2083 : \u2200 (nd : \u2191sd), \u2191nd + 1 \u2208 sd\nhd\u2082 : \u2200 (nd : \u2191sd), fd a b nd * (2 - 1 / \u2191\u2191nd) \u2264 fd a b \u27e8\u2191nd + 1, \u22ef\u27e9\nhi\u2080 : 2 \u2208 sd\ni : \u2191sd\nhi\u2081 : i = \u27e82, hi\u2080\u27e9\nnd : \u2191sd\nhnd\u2080 : 2 \u2264 \u2191nd\nn : \u2115\nhn\u2080 : 2 \u2264 n\nhn\u2081 : fd a b i * (3 / 2) ^ (n - 2) \u2264 f n b - f n a\n\u22a2 n - 1 = n - 2 + 1", "unsolved goals\ncase refine_2\nf : \u2115 \u2192 NNReal \u2192 \u211d\nsd : Set \u2115\nhsd : sd = Set.Ici 2\nfd : NNReal \u2192 NNReal \u2192 \u2191sd \u2192 \u211d\nhfd\u2081 : \u2200 (y\u2081 y\u2082 : NNReal) (n : \u2191sd), fd y\u2081 y\u2082 n = f (\u2191n) y\u2082 - f (\u2191n) y\u2081\nhd\u2081 : \u2200 (n : \u2191sd) (a b : NNReal), a < b \u2192 0 < fd a b n\na b : NNReal\nha\u2080 : a < b\nhd\u2083 : \u2200 (nd : \u2191sd), \u2191nd + 1 \u2208 sd\nhd\u2082 : \u2200 (nd : \u2191sd), fd a b nd * (2 - 1 / \u2191\u2191nd) \u2264 fd a b \u27e8\u2191nd + 1, \u22ef\u27e9\nhi\u2080 : 2 \u2208 sd\ni : \u2191sd\nhi\u2081 : i = \u27e82, hi\u2080\u27e9\nnd : \u2191sd\nhnd\u2080 : 2 \u2264 \u2191nd\nn : \u2115\nhn\u2080 : 2 \u2264 n\nhn\u2081 : fd a b i * (3 / 2) ^ (n - 2) \u2264 f n b - f n a\nhn\u2082 : n - 1 = n - 2 + 1\n\u22a2 fd a b i * (3 / 2) ^ (n - 1) \u2264 f (n + 1) b - f (n + 1) a", "unknown identifier 'mul_le_mul_iff_right\u2080'", "no goals to be solved", "unknown identifier 'mul_le_mul_iff_right\u2080'", "no goals to be solved", "unknown tactic", "unsolved goals\nf : \u2115 \u2192 NNReal \u2192 \u211d\nh\u2080 : \u2200 (x : NNReal), f 1 x = \u2191x\nh\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / \u2191n)\nh\u2082 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2227 0 < x \u2192 0 < f n x\nh\u2083 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 0 \u2264 f n x\nhmo\u2080 : \u2200 (n : \u2115), 0 < n \u2192 StrictMono (f n)\nhmo\u2081 : \u2200 (n : \u2115), 0 < n \u2192 Function.Injective (f n)\nf\u2080 : \u2115 \u2192 NNReal \u2192 NNReal := fun n x => (f n x).toNNReal\nhf\u2080 : f\u2080 = fun n x => (f n x).toNNReal\nhf\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f n x = \u2191(f\u2080 n x)\nhf\u2082 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f\u2080 n x = (f n x).toNNReal\nhmo\u2082 : \u2200 (n : \u2115), 0 < n \u2192 StrictMono (f\u2080 n)\nfi : \u2115 \u2192 NNReal \u2192 NNReal := fun n => Function.invFun (f\u2080 n)\nhmo\u2087 : \u2200 (n : \u2115), 0 < n \u2192 Function.RightInverse (fi n) (f\u2080 n)\nhf\u2087 : \u2200 (n : \u2115) (x y : NNReal), 0 < n \u2192 (f\u2080 n x = y \u2194 fi n y = x)\nsn : Set \u2115 := Set.Ici 1\nfb : \u2191sn \u2192 NNReal := sn.restrict fun n => fi n (1 - 1 / \u2191n)\nfc : \u2191sn \u2192 NNReal := sn.restrict fun n => fi n 1\nhsn\u2081 : \u2200 (n : \u2191sn), \u2191n \u2208 sn \u2227 0 < \u2191n\nhfb\u2080 : fb = fun n => fi (\u2191n) (1 - 1 / \u2191\u2191n)\nhfc\u2080 : fc = fun n => fi (\u2191n) 1\nhfb\u2081 : \u2200 (n : \u2191sn), f\u2080 (\u2191n) (fb n) = 1 - 1 / \u2191\u2191n\nhfc\u2081 : \u2200 (n : \u2191sn), f\u2080 (\u2191n) (fc n) = 1\nhu\u2081 : \u2200 (n : \u2191sn), fb n < 1\nhfc\u2082 : \u2200 (n : \u2191sn), fb n < fc n\nx : NNReal\n\u22a2 0 < 1", "unsolved goals\nf : \u2115 \u2192 NNReal \u2192 \u211d\nh\u2080 : \u2200 (x : NNReal), f 1 x = \u2191x\nh\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / \u2191n)\nh\u2082 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2227 0 < x \u2192 0 < f n x\nh\u2083 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 0 \u2264 f n x\nhmo\u2080 : \u2200 (n : \u2115), 0 < n \u2192 StrictMono (f n)\nhmo\u2081 : \u2200 (n : \u2115), 0 < n \u2192 Function.Injective (f n)\nf\u2080 : \u2115 \u2192 NNReal \u2192 NNReal := fun n x => (f n x).toNNReal\nhf\u2080 : f\u2080 = fun n x => (f n x).toNNReal\nhf\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f n x = \u2191(f\u2080 n x)\nhf\u2082 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 f\u2080 n x = (f n x).toNNReal\nhmo\u2082 : \u2200 (n : \u2115), 0 < n \u2192 StrictMono (f\u2080 n)\nfi : \u2115 \u2192 NNReal \u2192 NNReal := fun n => Function.invFun (f\u2080 n)\nhmo\u2087 : \u2200 (n : \u2115), 0 < n \u2192 Function.RightInverse (fi n) (f\u2080 n)\nhf\u2087 : \u2200 (n : \u2115) (x y : NNReal), 0 < n \u2192 (f\u2080 n x = y \u2194 fi n y = x)\nsn : Set \u2115 := Set.Ici 1\nfb : \u2191sn \u2192 NNReal := sn.restrict fun n => fi n (1 - 1 / \u2191n)\nfc : \u2191sn \u2192 NNReal := sn.restrict fun n => fi n 1\nhsn\u2081 : \u2200 (n : \u2191sn), \u2191n \u2208 sn \u2227 0 < \u2191n\nhfb\u2080 : fb = fun n => fi (\u2191n) (1 - 1 / \u2191\u2191n)\nhfc\u2080 : fc = fun n => fi (\u2191n) 1\nhfb\u2081 : \u2200 (n : \u2191sn), f\u2080 (\u2191n) (fb n) = 1 - 1 / \u2191\u2191n\nhfc\u2081 : \u2200 (n : \u2191sn), f\u2080 (\u2191n) (fc n) = 1\nhu\u2081 : \u2200 (n : \u2191sn), fb n < 1\nhfc\u2082 : \u2200 (n : \u2191sn), fb n < fc n\nhfb\u2083 : StrictMono fb\n\u22a2 \u2203! a, \u2200 (n : \u2115), 0 < n \u2192 0 < f n a \u2227 f n a < f (n + 1) a \u2227 f (n + 1) a < 1", "unknown tactic", "unsolved goals\nf : \u2115 \u2192 \u211d \u2192 \u211d\nh\u2080 : \u2200 (x : \u211d), f 1 x = x\nh\u2081 : \u2200 (n : \u2115) (x : \u211d), 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / \u2191n)\nfn : \u2115 \u2192 NNReal \u2192 \u211d := fun n x => f n \u2191x\nhfn\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 0 \u2264 x \u2192 fn n x = f n \u2191x\na : NNReal\nha\u2080 : \u2200 (n : \u2115), 0 < n \u2192 0 < fn n a \u2227 fn n a < fn (n + 1) a \u2227 fn (n + 1) a < 1\nha\u2081 : \u2200 (y : NNReal), (fun a => \u2200 (n : \u2115), 0 < n \u2192 0 < fn n a \u2227 fn n a < fn (n + 1) a \u2227 fn (n + 1) a < 1) y \u2192 y = a\ny : \u211d\nhy\u2080 : (fun a => \u2200 (n : \u2115), 0 < n \u2192 0 < f n a \u2227 f n a < f (n + 1) a \u2227 f (n + 1) a < 1) y\nhy\u2081 : 0 \u2264 y.toNNReal\nhy\u2082 : 0 \u2264 y\nn : \u2115\nhn\u2080 : 0 < n\n\u22a2 0 < n + 1", "unsolved goals\ncase pos.refine_2\nf : \u2115 \u2192 \u211d \u2192 \u211d\nh\u2080 : \u2200 (x : \u211d), f 1 x = x\nh\u2081 : \u2200 (n : \u2115) (x : \u211d), 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / \u2191n)\nfn : \u2115 \u2192 NNReal \u2192 \u211d := fun n x => f n \u2191x\nhfn\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 0 \u2264 x \u2192 fn n x = f n \u2191x\na : NNReal\nha\u2080 : \u2200 (n : \u2115), 0 < n \u2192 0 < fn n a \u2227 fn n a < fn (n + 1) a \u2227 fn (n + 1) a < 1\nha\u2081 : \u2200 (y : NNReal), (fun a => \u2200 (n : \u2115), 0 < n \u2192 0 < fn n a \u2227 fn n a < fn (n + 1) a \u2227 fn (n + 1) a < 1) y \u2192 y = a\ny : \u211d\nhy\u2080 : (fun a => \u2200 (n : \u2115), 0 < n \u2192 0 < f n a \u2227 f n a < f (n + 1) a \u2227 f (n + 1) a < 1) y\nhy\u2081 : 0 \u2264 y.toNNReal\nhy\u2082 : 0 \u2264 y\nn : \u2115\nhn\u2080 : 0 < n\n\u22a2 0 < f n \u2191y.toNNReal \u2227 f n \u2191y.toNNReal < f (n + 1) \u2191y.toNNReal \u2227 f (n + 1) \u2191y.toNNReal < 1\n\ncase pos.refine_2\nf : \u2115 \u2192 \u211d \u2192 \u211d\nh\u2080 : \u2200 (x : \u211d), f 1 x = x\nh\u2081 : \u2200 (n : \u2115) (x : \u211d), 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / \u2191n)\nfn : \u2115 \u2192 NNReal \u2192 \u211d := \u22ef\nhfn\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 0 \u2264 x \u2192 fn n x = f n \u2191x\na : NNReal\nha\u2080 : \u2200 (n : \u2115), 0 < n \u2192 0 < fn n a \u2227 fn n a < fn (n + 1) a \u2227 fn (n + 1) a < 1\nha\u2081 : \u2200 (y : NNReal), (fun a => \u2200 (n : \u2115), 0 < n \u2192 0 < fn n a \u2227 fn n a < fn (n + 1) a \u2227 fn (n + 1) a < 1) y \u2192 y = a\ny : \u211d\nhy\u2080 : (fun a => \u2200 (n : \u2115), 0 < n \u2192 0 < f n a \u2227 f n a < f (n + 1) a \u2227 f (n + 1) a < 1) y\nhy\u2081 : 0 \u2264 y.toNNReal\nhy\u2082 : 0 \u2264 y\nn : \u2115\nhn\u2080 : 0 < n\n\u22a2 0 \u2264 y.toNNReal", "unsolved goals\ncase neg\nf : \u2115 \u2192 \u211d \u2192 \u211d\nh\u2080 : \u2200 (x : \u211d), f 1 x = x\nh\u2081 : \u2200 (n : \u2115) (x : \u211d), 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / \u2191n)\nfn : \u2115 \u2192 NNReal \u2192 \u211d := fun n x => f n \u2191x\nhfn\u2081 : \u2200 (n : \u2115) (x : NNReal), 0 < n \u2192 0 \u2264 x \u2192 fn n x = f n \u2191x\na : NNReal\nha\u2080 : \u2200 (n : \u2115), 0 < n \u2192 0 < fn n a \u2227 fn n a < fn (n + 1) a \u2227 fn (n + 1) a < 1\nha\u2081 : \u2200 (y : NNReal), (fun a => \u2200 (n : \u2115), 0 < n \u2192 0 < fn n a \u2227 fn n a < fn (n + 1) a \u2227 fn (n + 1) a < 1) y \u2192 y = a\ny : \u211d\nhy\u2080 : (fun a => \u2200 (n : \u2115), 0 < n \u2192 0 < f n a \u2227 f n a < f (n + 1) a \u2227 f (n + 1) a < 1) y\nhy\u2081 : 0 \u2264 y.toNNReal\nhy\u2082 : \u00ac0 \u2264 y\n\u22a2 y = \u2191a"], "timeout_s": 600.0, "latency_s": 6.8817, "verified_at": "2026-03-26T18:17:04.297774+00:00"}} | false | true | false | 6.8817 |
compfiles_Imo1986P1 | compfiles | Copyright (c) 2023 Moritz Firsching. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Moritz Firsching
-/
import Mathlib
/-!
# International Mathematical Olympiad 1986, Problem 1
Let d be any positive integer not equal to 2, 5 or 13.
Show that one can find distinct a, b in the set {2, 5, 13, d} such that ab - 1
is not a perfect square.
-/
namespace Imo1986P1
/-
We prove a slightly stronger statement, namely:
Let d be any integer, then 2 * d - 1, 5 * d - 1 and 13 * d - 1 can't all be perfect squares.
We follow "Solution 2" on https://artofproblemsolving.com/wiki/index.php/1986_IMO_Problems/Problem_1
by showing a contradiction: we show d is odd and d is even.
First we assume that there are p, q and r such that:
2 * d - 1 = p^2
5 * d - 1 = q^2 and
13 * d - 1 = r^2
The fact that d is odd follows from the fact that p is odd.
The fact that d is even follows from examining the difference 13 * d - 5 * d.
-/
theorem imo1986_p1' (d : ℤ):
¬ ((IsSquare (2 * d - 1)) ∧ (IsSquare (5 * d - 1)) ∧ (IsSquare (d * 13 - 1))) := by
rintro ⟨⟨p, hp⟩, ⟨q, hq⟩, ⟨r, hr⟩⟩
rw [← pow_two] at hp hq hr
have hpodd : Odd p := (Int.odd_pow' two_ne_zero).mp (by use d - 1; rw [← hp]; ring)
obtain ⟨k, hk⟩ := hpodd
have hp := hp.symm
have hdp : d = 2*(k + k^2) + 1 := by
rw [hk, ←(add_left_inj 1), sub_add_cancel _] at hp
ring_nf at hp
have h422 : (4 : ℤ) = 2 * 2 := by norm_num
simp only [h422, ← mul_assoc] at hp
nth_rw 1 [← one_mul 2] at hp
rw [← add_mul, ← add_mul, mul_left_inj' two_ne_zero] at hp
rw [← hp]
ring
have hdodd : Odd d := by use k + k ^ 2
have hd_sub_one : Even (d - 1) := by use (k + k ^ 2); rw [hdp]; ring
have hqeven : Even q := by
refine (Int.even_pow' two_ne_zero).mp ?_
have heq : 5 * d - 1 = 5 * (d - 1) + 4 := by ring_nf
rw [← hq, heq]
exact Even.add (Even.mul_left hd_sub_one 5) (by use 2; rfl)
have hreven : Even (r : ℤ) := by
refine (Int.even_pow' two_ne_zero).mp ?_
have heq : d * 13 - 1 = 13*(d - 1) + 12 := by
rw [mul_comm]
ring_nf
rw [← hr, heq]
exact Even.add (Even.mul_left hd_sub_one 13) (by use 6; rfl)
obtain ⟨n, hqeven'⟩ := hqeven
obtain ⟨m, hreven'⟩ := hreven
have h8d : d * 8 = 4*m^2 - 4*n^2 := by
calc d * 8 = (d * 13 - 1) - (5 * d - 1) := by ring
_ = r^2 - q^2 := by rw [hr, hq]
_ = (m + m)^2 - (n + n)^2 := by rw [hqeven', hreven']
_ = 4*m^2 - 4*n^2 := by ring
have h4d : 4 * (2 * d) = 4 * (m^2 - n^2) := by ring_nf; rw [h8d]; ring_nf
have hnm' : 2*d = (m + n)*(m - n):= by
rw [← pow_two_sub_pow_two]
refine (mul_right_inj' ?_).mp h4d
decide
have h2d : Even ((m + n) * (m - n)) := by use d; rw [← two_mul, hnm']
have hnm_parity : (Even m ↔ Even n) := by grind
have hnm_sub : Even (m - n) := Int.even_sub.mpr hnm_parity
have hnm_add : Even (m + n) := Int.even_add.mpr hnm_parity
have hdeven : Even d := by
obtain ⟨v, hnm_sub⟩ := hnm_sub
obtain ⟨w, hnm_add⟩ := hnm_add
simp only [hnm_sub, hnm_add, ← two_mul] at hnm'
rw [mul_assoc, mul_right_inj' two_ne_zero, ← mul_assoc, mul_comm w, mul_assoc, two_mul] at hnm'
exact ⟨w * v, hnm'⟩
exact Int.not_odd_iff_even.mpr hdeven hdodd
theorem imo1986_p1 (d : ℤ) (_hdpos : 1 ≤ d) (h2 : d ≠ 2) (h5 : d ≠ 5) (h13 : d ≠ 13) :
∃ a b :({2, 5, 13, d} : Finset ℤ), (a ≠ b) ∧ ¬ ∃ z, z^2 = (a * (b : ℤ) - 1) := by
by_contra h
simp only [ne_eq, Subtype.exists, Finset.mem_singleton, Finset.mem_insert,
exists_and_right, Subtype.mk.injEq, exists_prop, exists_eq_or_imp, exists_eq_left, not_or,
not_exists, not_and, not_forall, not_not, and_imp, forall_eq_or_imp, IsEmpty.forall_iff,
forall_eq, true_and, not_true, and_true] at h
have ⟨p, hp⟩ := h.1.2.2 h2.symm
have ⟨q, hq⟩ := h.2.1.2.2 h5.symm
have ⟨r, hr⟩ := h.2.2.2.2.2 h13
have : IsSquare (2 * d - 1) ∧ IsSquare (5 * d - 1) ∧ IsSquare (d * 13 - 1) := by
refine ⟨?_, ?_, ?_⟩
· use p; rw [← pow_two]; exact hp.symm
· use q; rw [← pow_two]; exact hq.symm
· use r; rw [← pow_two]; exact hr.symm
exact imo1986_p1' d this
end Imo1986P1 | /- | /-
Copyright (c) 2023 Moritz Firsching. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Moritz Firsching
-/
import Mathlib
/-!
# International Mathematical Olympiad 1986, Problem 1
Let d be any positive integer not equal to 2, 5 or 13.
Show that one can find distinct a, b in the set {2, 5, 13, d} such that ab - 1
is not a perfect square.
-/
namespace Imo1986P1
/-
We prove a slightly stronger statement, namely:
Let d be any integer, then 2 * d - 1, 5 * d - 1 and 13 * d - 1 can't all be perfect squares.
We follow "Solution 2" on https://artofproblemsolving.com/wiki/index.php/1986_IMO_Problems/Problem_1
by showing a contradiction: we show d is odd and d is even.
First we assume that there are p, q and r such that:
2 * d - 1 = p^2
5 * d - 1 = q^2 and
13 * d - 1 = r^2
The fact that d is odd follows from the fact that p is odd.
The fact that d is even follows from examining the difference 13 * d - 5 * d.
-/
theorem imo1986_p1' (d : ℤ):
¬ ((IsSquare (2 * d - 1)) ∧ (IsSquare (5 * d - 1)) ∧ (IsSquare (d * 13 - 1))) := by
rintro ⟨⟨p, hp⟩, ⟨q, hq⟩, ⟨r, hr⟩⟩
rw [← pow_two] at hp hq hr
have hpodd : Odd p := (Int.odd_pow' two_ne_zero).mp (by use d - 1; rw [← hp]; ring)
obtain ⟨k, hk⟩ := hpodd
have hp := hp.symm
have hdp : d = 2*(k + k^2) + 1 := by
rw [hk, ←(add_left_inj 1), sub_add_cancel _] at hp
ring_nf at hp
have h422 : (4 : ℤ) = 2 * 2 := by norm_num
simp only [h422, ← mul_assoc] at hp
nth_rw 1 [← one_mul 2] at hp
rw [← add_mul, ← add_mul, mul_left_inj' two_ne_zero] at hp
rw [← hp]
ring
have hdodd : Odd d := by use k + k ^ 2
have hd_sub_one : Even (d - 1) := by use (k + k ^ 2); rw [hdp]; ring
have hqeven : Even q := by
refine (Int.even_pow' two_ne_zero).mp ?_
have heq : 5 * d - 1 = 5 * (d - 1) + 4 := by ring_nf
rw [← hq, heq]
exact Even.add (Even.mul_left hd_sub_one 5) (by use 2; rfl)
have hreven : Even (r : ℤ) := by
refine (Int.even_pow' two_ne_zero).mp ?_
have heq : d * 13 - 1 = 13*(d - 1) + 12 := by
rw [mul_comm]
ring_nf
rw [← hr, heq]
exact Even.add (Even.mul_left hd_sub_one 13) (by use 6; rfl)
obtain ⟨n, hqeven'⟩ := hqeven
obtain ⟨m, hreven'⟩ := hreven
have h8d : d * 8 = 4*m^2 - 4*n^2 := by
calc d * 8 = (d * 13 - 1) - (5 * d - 1) := by ring
_ = r^2 - q^2 := by rw [hr, hq]
_ = (m + m)^2 - (n + n)^2 := by rw [hqeven', hreven']
_ = 4*m^2 - 4*n^2 := by ring
have h4d : 4 * (2 * d) = 4 * (m^2 - n^2) := by ring_nf; rw [h8d]; ring_nf
have hnm' : 2*d = (m + n)*(m - n):= by
rw [← pow_two_sub_pow_two]
refine (mul_right_inj' ?_).mp h4d
decide
have h2d : Even ((m + n) * (m - n)) := by use d; rw [← two_mul, hnm']
have hnm_parity : (Even m ↔ Even n) := by grind
have hnm_sub : Even (m - n) := Int.even_sub.mpr hnm_parity
have hnm_add : Even (m + n) := Int.even_add.mpr hnm_parity
have hdeven : Even d := by
obtain ⟨v, hnm_sub⟩ := hnm_sub
obtain ⟨w, hnm_add⟩ := hnm_add
simp only [hnm_sub, hnm_add, ← two_mul] at hnm'
rw [mul_assoc, mul_right_inj' two_ne_zero, ← mul_assoc, mul_comm w, mul_assoc, two_mul] at hnm'
exact ⟨w * v, hnm'⟩
exact Int.not_odd_iff_even.mpr hdeven hdodd
theorem imo1986_p1 (d : ℤ) (_hdpos : 1 ≤ d) (h2 : d ≠ 2) (h5 : d ≠ 5) (h13 : d ≠ 13) :
∃ a b :({2, 5, 13, d} : Finset ℤ), (a ≠ b) ∧ ¬ ∃ z, z^2 = (a * (b : ℤ) - 1) := by
by_contra h
simp only [ne_eq, Subtype.exists, Finset.mem_singleton, Finset.mem_insert,
exists_and_right, Subtype.mk.injEq, exists_prop, exists_eq_or_imp, exists_eq_left, not_or,
not_exists, not_and, not_forall, not_not, and_imp, forall_eq_or_imp, IsEmpty.forall_iff,
forall_eq, true_and, not_true, and_true] at h
have ⟨p, hp⟩ := h.1.2.2 h2.symm
have ⟨q, hq⟩ := h.2.1.2.2 h5.symm
have ⟨r, hr⟩ := h.2.2.2.2.2 h13
have : IsSquare (2 * d - 1) ∧ IsSquare (5 * d - 1) ∧ IsSquare (d * 13 - 1) := by
refine ⟨?_, ?_, ?_⟩
· use p; rw [← pow_two]; exact hp.symm
· use q; rw [← pow_two]; exact hq.symm
· use r; rw [← pow_two]; exact hr.symm
exact imo1986_p1' d this
end Imo1986P1
| true | Copyright (c) 2023 Moritz Firsching. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Moritz Firsching
-/
import Mathlib
/-!
# International Mathematical Olympiad 1986, Problem 1
Let d be any positive integer not equal to 2, 5 or 13.
Show that one can find distinct a, b in the set {2, 5, 13, d} such that ab - 1
is not a perfect square.
-/
namespace Imo1986P1
/-
We prove a slightly stronger statement, namely:
Let d be any integer, then 2 * d - 1, 5 * d - 1 and 13 * d - 1 can't all be perfect squares.
We follow "Solution 2" on https://artofproblemsolving.com/wiki/index.php/1986_IMO_Problems/Problem_1
by showing a contradiction: we show d is odd and d is even.
First we assume that there are p, q and r such that:
2 * d - 1 = p^2
5 * d - 1 = q^2 and
13 * d - 1 = r^2
The fact that d is odd follows from the fact that p is odd.
The fact that d is even follows from examining the difference 13 * d - 5 * d.
-/
theorem imo1986_p1' (d : ℤ):
¬ ((IsSquare (2 * d - 1)) ∧ (IsSquare (5 * d - 1)) ∧ (IsSquare (d * 13 - 1))) := by
rintro ⟨⟨p, hp⟩, ⟨q, hq⟩, ⟨r, hr⟩⟩
rw [← pow_two] at hp hq hr
have hpodd : Odd p := (Int.odd_pow' two_ne_zero).mp (by use d - 1; rw [← hp]; ring)
obtain ⟨k, hk⟩ := hpodd
have hp := hp.symm
have hdp : d = 2*(k + k^2) + 1 := by
rw [hk, ←(add_left_inj 1), sub_add_cancel _] at hp
ring_nf at hp
have h422 : (4 : ℤ) = 2 * 2 := by norm_num
simp only [h422, ← mul_assoc] at hp
nth_rw 1 [← one_mul 2] at hp
rw [← add_mul, ← add_mul, mul_left_inj' two_ne_zero] at hp
rw [← hp]
ring
have hdodd : Odd d := by use k + k ^ 2
have hd_sub_one : Even (d - 1) := by use (k + k ^ 2); rw [hdp]; ring
have hqeven : Even q := by
refine (Int.even_pow' two_ne_zero).mp ?_
have heq : 5 * d - 1 = 5 * (d - 1) + 4 := by ring_nf
rw [← hq, heq]
exact Even.add (Even.mul_left hd_sub_one 5) (by use 2; rfl)
have hreven : Even (r : ℤ) := by
refine (Int.even_pow' two_ne_zero).mp ?_
have heq : d * 13 - 1 = 13*(d - 1) + 12 := by
rw [mul_comm]
ring_nf
rw [← hr, heq]
exact Even.add (Even.mul_left hd_sub_one 13) (by use 6; rfl)
obtain ⟨n, hqeven'⟩ := hqeven
obtain ⟨m, hreven'⟩ := hreven
have h8d : d * 8 = 4*m^2 - 4*n^2 := by
calc d * 8 = (d * 13 - 1) - (5 * d - 1) := by ring
_ = r^2 - q^2 := by rw [hr, hq]
_ = (m + m)^2 - (n + n)^2 := by rw [hqeven', hreven']
_ = 4*m^2 - 4*n^2 := by ring
have h4d : 4 * (2 * d) = 4 * (m^2 - n^2) := by ring_nf; rw [h8d]; ring_nf
have hnm' : 2*d = (m + n)*(m - n):= by
rw [← pow_two_sub_pow_two]
refine (mul_right_inj' ?_).mp h4d
decide
have h2d : Even ((m + n) * (m - n)) := by use d; rw [← two_mul, hnm']
have hnm_parity : (Even m ↔ Even n) := by grind
have hnm_sub : Even (m - n) := Int.even_sub.mpr hnm_parity
have hnm_add : Even (m + n) := Int.even_add.mpr hnm_parity
have hdeven : Even d := by
obtain ⟨v, hnm_sub⟩ := hnm_sub
obtain ⟨w, hnm_add⟩ := hnm_add
simp only [hnm_sub, hnm_add, ← two_mul] at hnm'
rw [mul_assoc, mul_right_inj' two_ne_zero, ← mul_assoc, mul_comm w, mul_assoc, two_mul] at hnm'
exact ⟨w * v, hnm'⟩
exact Int.not_odd_iff_even.mpr hdeven hdodd
theorem imo1986_p1 (d : ℤ) (_hdpos : 1 ≤ d) (h2 : d ≠ 2) (h5 : d ≠ 5) (h13 : d ≠ 13) :
∃ a b :({2, 5, 13, d} : Finset ℤ), (a ≠ b) ∧ ¬ ∃ z, z^2 = (a * (b : ℤ) - 1) := by
by_contra h
simp only [ne_eq, Subtype.exists, Finset.mem_singleton, Finset.mem_insert,
exists_and_right, Subtype.mk.injEq, exists_prop, exists_eq_or_imp, exists_eq_left, not_or,
not_exists, not_and, not_forall, not_not, and_imp, forall_eq_or_imp, IsEmpty.forall_iff,
forall_eq, true_and, not_true, and_true] at h
have ⟨p, hp⟩ := h.1.2.2 h2.symm
have ⟨q, hq⟩ := h.2.1.2.2 h5.symm
have ⟨r, hr⟩ := h.2.2.2.2.2 h13
have : IsSquare (2 * d - 1) ∧ IsSquare (5 * d - 1) ∧ IsSquare (d * 13 - 1) := by
refine ⟨?_, ?_, ?_⟩
· use p; rw [← pow_two]; exact hp.symm
· use q; rw [← pow_two]; exact hq.symm
· use r; rw [← pow_two]; exact hr.symm
exact imo1986_p1' d this
end Imo1986P1 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1986P1.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["`grind` failed\ncase grind.1.1.2.2.2.2.2.2\nd p : \u2124\nhp : 2 * d + -1 * p ^ 2 + -1 = 0\nq : \u2124\nhq : 5 * d + -1 * q ^ 2 + -1 = 0\nr : \u2124\nhr : 13 * d + -1 * r ^ 2 + -1 = 0\nk : \u2124\nhk : p = 2 * k + 1\nhp_1 : -2 * d + p ^ 2 + 1 = 0\nhdp : d + -2 * k + -2 * k ^ 2 + -1 = 0\nhdodd : Odd d\nhd_sub_one : Even (d + -1)\nn : \u2124\nhqeven' : q + -2 * n = 0\nm : \u2124\nhreven' : r + -2 * m = 0\nh8d h4d : 2 * d + n ^ 2 + -1 * m ^ 2 = 0\nhnm' : 2 * d + -1 * ((m + n) * (m - n)) = 0\nh2d : Even ((m + n) * (m - n))\nh : Even m = \u00acEven n\nleft : Even m\nright : \u00acEven n\nh_2 : m = d + -1\nh_3 : \u00acn = d + -1\nh_4 : \u00ack = m\nh_5 : \u00ack = n\nh_6 : \u00acr = m\nh_7 : \u00acr = n\nh_8 : \u00acr = k\n\u22a2 False\n[grind] Goal diagnostics\n [facts] Asserted facts\n [prop] 2 * d + -1 * p ^ 2 + -1 = 0\n [prop] 5 * d + -1 * q ^ 2 + -1 = 0\n [prop] 13 * d + -1 * r ^ 2 + -1 = 0\n [prop] p = 2 * k + 1\n [prop] -2 * d + p ^ 2 + 1 = 0\n [prop] d + -2 * k + -2 * k ^ 2 + -1 = 0\n [prop] Odd d\n [prop] Even (d + -1)\n [prop] q + -2 * n = 0\n [prop] r + -2 * m = 0\n [prop] 2 * d + n ^ 2 + -1 * m ^ 2 = 0\n [prop] 2 * d + n ^ 2 + -1 * m ^ 2 = 0\n [prop] 2 * d + -1 * ((m + n) * (m - n)) = 0\n [prop] Even ((m + n) * (m - n))\n [prop] Even m = \u00acEven n\n [prop] Even m\n [prop] \u00acEven n\n [prop] m = d + -1\n [prop] \u00acn = d + -1\n [prop] \u00ack = m\n [prop] \u00ack = n\n [prop] \u00acr = m\n [prop] \u00acr = n\n [prop] \u00acr = k\n [eqc] True propositions\n [prop] Odd d\n [prop] Even (d + -1)\n [prop] Even ((m + n) * (m - n))\n [prop] Even m = \u00acEven n\n [prop] \u00acEven n\n [prop] Even m\n [prop] m = d + -1\n [eqc] False propositions\n [prop] Even n\n [prop] n = d + -1\n [prop] n = m\n [prop] k = m\n [prop] k = n\n [prop] r = m\n [prop] r = n\n [prop] r = k\n [eqc] Equivalence classes\n [eqc] {m, d + -1}\n [eqc] {p, 2 * k + 1}\n [eqc] {2 * d + -1 * p ^ 2 + -1,\n 5 * d + -1 * q ^ 2 + -1,\n 13 * d + -1 * r ^ 2 + -1,\n -2 * d + p ^ 2 + 1,\n d + -2 * k + -2 * k ^ 2 + -1,\n q + -2 * n,\n r + -2 * m,\n 2 * d + n ^ 2 + -1 * m ^ 2,\n 2 * d + -1 * ((m + n) * (m - n)),\n 0}\n [cases] Case analyses\n [cases] [1/2]: Even m = \u00acEven n\n [cases] [1/2]: m = d + -1\n [cases] [2/2]: n = d + -1\n [cases] [2/2]: k = m\n [cases] [2/2]: k = n\n [cases] [2/2]: r = m\n [cases] [2/2]: r = n\n [cases] [2/2]: r = k\n [cutsat] Assignment satisfying linear constraints\n [assign] d := 3\n [assign] p := 1\n [assign] q := 2\n [assign] r := 4\n [assign] k := 0\n [assign] n := 1\n [assign] m := 2\n [assign] \u300cp ^ 2\u300d := 5\n [assign] \u300cq ^ 2\u300d := 14\n [assign] \u300cr ^ 2\u300d := 38\n [assign] \u300ck ^ 2\u300d := 1\n [assign] \u300cn ^ 2\u300d := 0\n [assign] \u300cm ^ 2\u300d := 6\n [ring] Ring `\u2124`\n [basis] Basis\n [_] d + -1 * m + -1 = 0\n [_] p + -2 * k + -1 = 0\n [_] q + -2 * n = 0\n [_] r + -2 * m = 0\n [_] 2 * k ^ 2 + -1 * d + 2 * k + 1 = 0\n [_] 4 * n ^ 2 + -5 * d + 1 = 0\n [_] 4 * m ^ 2 + -13 * d + 1 = 0\n [diseqs] Disequalities\n [_] \u00acn + -1 * m = 0\n [_] \u00acn + -1 * m = 0\n [_] \u00ack + -1 * m = 0\n [_] \u00ack + -1 * n = 0\n [_] \u00acm = 0\n [_] \u00ac-1 * n + 2 * m = 0\n [_] \u00ac-1 * k + 2 * m = 0\n [limits] Thresholds reached\n [limit] maximum number of case-splits has been reached, threshold: `(splits := 8)`"], "timeout_s": 600.0, "latency_s": 1.654, "verified_at": "2026-03-26T18:16:59.380711+00:00"}} | false | true | false | 1.654 |
compfiles_Imo1986P3 | compfiles | Copyright (c) 2026 lean-tom. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: lean-tom (with assistance from Gemini)
-/
import Mathlib
/-!
# International Mathematical Olympiad 1986, Problem 3
To each vertex of a regular pentagon, an integer is assigned,
in such a way that the sum of all five numbers is positive.
If three consecutive vertices are assigned the numbers $x, y, z$ respectively and $y < 0$,
then the following operation is allowed: $x, y, z$ are replaced by $x+y, -y, z+y$ respectively.
Such an operation is performed repeatedly as long as at least one of the five numbers is negative.
Determine whether this procedure necessarily comes to an end after a finite number of steps.
-/
namespace Imo1986P3
open BigOperators
/-- State of the pentagon: an integer assigned to each vertex. -/
def State := Fin 5 → ℤ
/-- The sum of all integers on the pentagon. -/
def State.sum (s : State) : ℤ := ∑ i : Fin 5, s i
/-- The operation performed at vertex `i` when `s i < 0`. -/
def move (s : State) (i : Fin 5) : State :=
fun j =>
if j == i - 1 then s (i - 1) + s i
else if j == i then -s i
else if j == i + 1 then s (i + 1) + s i
else s j
/--
The transition relation `Step next current` asserts that `next` is obtained
from `current` by applying the move operation at some vertex `i` where `s i < 0`.
The order of arguments `(next current)` is chosen to match the convention of `Acc`.
-/
def Step (next current : State) : Prop :=
∃ i : Fin 5, current i < 0 ∧ next = move current i
/-!
## Solution
We define a potential function $V(s) = \sum (s_i - s_{i+2})^2$.
We show that:
1. The sum of all integers is invariant under the operation.
2. If the sum is positive, the potential strictly decreases.
3. Since the potential is a sum of squares, it is bounded below by 0.
4. Since the potential takes integer values and strictly decreases, the process must terminate.
-/
/-- The potential function $V(s) = \sum (s_i - s_{i+2})^2$. -/
def potential (s : State) : ℤ :=
∑ i : Fin 5, (s i - s (i + 2))^2
/-- Helper lemma to expand sums over `Fin 5`. -/
lemma sum_fin5 (f : Fin 5 → ℤ) :
(∑ i : Fin 5, f i) = f 0 + f 1 + f 2 + f 3 + f 4 := by
simp [Finset.sum]; abel
/-- The sum of the integers is invariant under the move operation. -/
lemma sum_invariant (s : State) (i : Fin 5) : (move s i).sum = s.sum := by
simp only [State.sum, sum_fin5]
fin_cases i
all_goals (
simp (config := { decide := true }) [move]
try simp only [show (-1 : Fin 5) = 4 by decide]
abel
)
/-- The change in potential after a move operation.
$V(s') - V(s) = 2 \cdot s_i \cdot S$ where $S$ is the total sum. -/
lemma potential_diff (s : State) (i : Fin 5) :
potential (move s i) - potential s = 2 * (s i) * s.sum := by
simp only [potential, State.sum, sum_fin5]
fin_cases i
all_goals (
simp (config := { decide := true }) [move]
try simp only [show (-1 : Fin 5) = 4 by decide]
ring
)
/-- If $s_i < 0$ and the total sum is positive, the potential strictly decreases. -/
lemma potential_decreasing (s : State) (i : Fin 5) (h_neg : s i < 0) (h_sum_pos : 0 < s.sum) :
potential (move s i) < potential s := by
have h_diff := potential_diff s i
have h_rhs_neg : 2 * (s i) * s.sum < 0 := by
nlinarith [h_neg, h_sum_pos]
linarith [h_diff, h_rhs_neg]
/-- The potential is always non-negative. -/
lemma potential_nonneg (s : State) : 0 ≤ potential s := by
rw [potential]
exact Finset.sum_nonneg (fun i _ => sq_nonneg (s i - s (i + 2)))
/-- Since the potential is non-negative and decreasing,
its value as a natural number also decreases. -/
lemma potential_measure_decreases (s : State) (i : Fin 5)
(h_neg : s i < 0) (h_sum : 0 < s.sum) :
(potential (move s i)).toNat < (potential s).toNat := by
have h_pos_s : 0 < potential s := by
linarith [potential_decreasing s i h_neg h_sum, potential_nonneg (move s i)]
rw [Int.toNat_lt_toNat h_pos_s]
exact potential_decreasing s i h_neg h_sum
/--
Main Theorem: IMO 1986 Problem 3.
Starting from any state with a positive sum, the process terminates.
-/
theorem imo1986_p3 (s₀ : State) (h_sum : 0 < s₀.sum) :
Acc Step s₀ := by
apply measure_termination s₀ h_sum
where
measure_termination (current : State) (h_current_sum : 0 < current.sum) : Acc Step current := by
generalize h_n : (potential current).toNat = n
revert current h_current_sum h_n
induction n using Nat.strong_induction_on with
| h n ih =>
intro current h_current_sum h_n_eq
subst h_n_eq
apply Acc.intro
intro next_state h_step
rcases h_step with ⟨i, h_neg, rfl⟩
have h_next_sum : 0 < (move current i).sum := by
rw [sum_invariant]
exact h_current_sum
apply ih ((potential (move current i)).toNat)
· apply potential_measure_decreases current i h_neg h_current_sum
· exact h_next_sum
· rfl
end Imo1986P3 | /- | /-
Copyright (c) 2026 lean-tom. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: lean-tom (with assistance from Gemini)
-/
import Mathlib
/-!
# International Mathematical Olympiad 1986, Problem 3
To each vertex of a regular pentagon, an integer is assigned,
in such a way that the sum of all five numbers is positive.
If three consecutive vertices are assigned the numbers $x, y, z$ respectively and $y < 0$,
then the following operation is allowed: $x, y, z$ are replaced by $x+y, -y, z+y$ respectively.
Such an operation is performed repeatedly as long as at least one of the five numbers is negative.
Determine whether this procedure necessarily comes to an end after a finite number of steps.
-/
namespace Imo1986P3
open BigOperators
/-- State of the pentagon: an integer assigned to each vertex. -/
def State := Fin 5 → ℤ
/-- The sum of all integers on the pentagon. -/
def State.sum (s : State) : ℤ := ∑ i : Fin 5, s i
/-- The operation performed at vertex `i` when `s i < 0`. -/
def move (s : State) (i : Fin 5) : State :=
fun j =>
if j == i - 1 then s (i - 1) + s i
else if j == i then -s i
else if j == i + 1 then s (i + 1) + s i
else s j
/--
The transition relation `Step next current` asserts that `next` is obtained
from `current` by applying the move operation at some vertex `i` where `s i < 0`.
The order of arguments `(next current)` is chosen to match the convention of `Acc`.
-/
def Step (next current : State) : Prop :=
∃ i : Fin 5, current i < 0 ∧ next = move current i
/-!
## Solution
We define a potential function $V(s) = \sum (s_i - s_{i+2})^2$.
We show that:
1. The sum of all integers is invariant under the operation.
2. If the sum is positive, the potential strictly decreases.
3. Since the potential is a sum of squares, it is bounded below by 0.
4. Since the potential takes integer values and strictly decreases, the process must terminate.
-/
/-- The potential function $V(s) = \sum (s_i - s_{i+2})^2$. -/
def potential (s : State) : ℤ :=
∑ i : Fin 5, (s i - s (i + 2))^2
/-- Helper lemma to expand sums over `Fin 5`. -/
lemma sum_fin5 (f : Fin 5 → ℤ) :
(∑ i : Fin 5, f i) = f 0 + f 1 + f 2 + f 3 + f 4 := by
simp [Finset.sum]; abel
/-- The sum of the integers is invariant under the move operation. -/
lemma sum_invariant (s : State) (i : Fin 5) : (move s i).sum = s.sum := by
simp only [State.sum, sum_fin5]
fin_cases i
all_goals (
simp (config := { decide := true }) [move]
try simp only [show (-1 : Fin 5) = 4 by decide]
abel
)
/-- The change in potential after a move operation.
$V(s') - V(s) = 2 \cdot s_i \cdot S$ where $S$ is the total sum. -/
lemma potential_diff (s : State) (i : Fin 5) :
potential (move s i) - potential s = 2 * (s i) * s.sum := by
simp only [potential, State.sum, sum_fin5]
fin_cases i
all_goals (
simp (config := { decide := true }) [move]
try simp only [show (-1 : Fin 5) = 4 by decide]
ring
)
/-- If $s_i < 0$ and the total sum is positive, the potential strictly decreases. -/
lemma potential_decreasing (s : State) (i : Fin 5) (h_neg : s i < 0) (h_sum_pos : 0 < s.sum) :
potential (move s i) < potential s := by
have h_diff := potential_diff s i
have h_rhs_neg : 2 * (s i) * s.sum < 0 := by
nlinarith [h_neg, h_sum_pos]
linarith [h_diff, h_rhs_neg]
/-- The potential is always non-negative. -/
lemma potential_nonneg (s : State) : 0 ≤ potential s := by
rw [potential]
exact Finset.sum_nonneg (fun i _ => sq_nonneg (s i - s (i + 2)))
/-- Since the potential is non-negative and decreasing,
its value as a natural number also decreases. -/
lemma potential_measure_decreases (s : State) (i : Fin 5)
(h_neg : s i < 0) (h_sum : 0 < s.sum) :
(potential (move s i)).toNat < (potential s).toNat := by
have h_pos_s : 0 < potential s := by
linarith [potential_decreasing s i h_neg h_sum, potential_nonneg (move s i)]
rw [Int.toNat_lt_toNat h_pos_s]
exact potential_decreasing s i h_neg h_sum
/--
Main Theorem: IMO 1986 Problem 3.
Starting from any state with a positive sum, the process terminates.
-/
theorem imo1986_p3 (s₀ : State) (h_sum : 0 < s₀.sum) :
Acc Step s₀ := by
apply measure_termination s₀ h_sum
where
measure_termination (current : State) (h_current_sum : 0 < current.sum) : Acc Step current := by
generalize h_n : (potential current).toNat = n
revert current h_current_sum h_n
induction n using Nat.strong_induction_on with
| h n ih =>
intro current h_current_sum h_n_eq
subst h_n_eq
apply Acc.intro
intro next_state h_step
rcases h_step with ⟨i, h_neg, rfl⟩
have h_next_sum : 0 < (move current i).sum := by
rw [sum_invariant]
exact h_current_sum
apply ih ((potential (move current i)).toNat)
· apply potential_measure_decreases current i h_neg h_current_sum
· exact h_next_sum
· rfl
end Imo1986P3
| true | Copyright (c) 2026 lean-tom. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: lean-tom (with assistance from Gemini)
-/
import Mathlib
/-!
# International Mathematical Olympiad 1986, Problem 3
To each vertex of a regular pentagon, an integer is assigned,
in such a way that the sum of all five numbers is positive.
If three consecutive vertices are assigned the numbers $x, y, z$ respectively and $y < 0$,
then the following operation is allowed: $x, y, z$ are replaced by $x+y, -y, z+y$ respectively.
Such an operation is performed repeatedly as long as at least one of the five numbers is negative.
Determine whether this procedure necessarily comes to an end after a finite number of steps.
-/
namespace Imo1986P3
open BigOperators
/-- State of the pentagon: an integer assigned to each vertex. -/
def State := Fin 5 → ℤ
/-- The sum of all integers on the pentagon. -/
def State.sum (s : State) : ℤ := ∑ i : Fin 5, s i
/-- The operation performed at vertex `i` when `s i < 0`. -/
def move (s : State) (i : Fin 5) : State :=
fun j =>
if j == i - 1 then s (i - 1) + s i
else if j == i then -s i
else if j == i + 1 then s (i + 1) + s i
else s j
/--
The transition relation `Step next current` asserts that `next` is obtained
from `current` by applying the move operation at some vertex `i` where `s i < 0`.
The order of arguments `(next current)` is chosen to match the convention of `Acc`.
-/
def Step (next current : State) : Prop :=
∃ i : Fin 5, current i < 0 ∧ next = move current i
/-!
## Solution
We define a potential function $V(s) = \sum (s_i - s_{i+2})^2$.
We show that:
1. The sum of all integers is invariant under the operation.
2. If the sum is positive, the potential strictly decreases.
3. Since the potential is a sum of squares, it is bounded below by 0.
4. Since the potential takes integer values and strictly decreases, the process must terminate.
-/
/-- The potential function $V(s) = \sum (s_i - s_{i+2})^2$. -/
def potential (s : State) : ℤ :=
∑ i : Fin 5, (s i - s (i + 2))^2
/-- Helper lemma to expand sums over `Fin 5`. -/
lemma sum_fin5 (f : Fin 5 → ℤ) :
(∑ i : Fin 5, f i) = f 0 + f 1 + f 2 + f 3 + f 4 := by
simp [Finset.sum]; abel
/-- The sum of the integers is invariant under the move operation. -/
lemma sum_invariant (s : State) (i : Fin 5) : (move s i).sum = s.sum := by
simp only [State.sum, sum_fin5]
fin_cases i
all_goals (
simp (config := { decide := true }) [move]
try simp only [show (-1 : Fin 5) = 4 by decide]
abel
)
/-- The change in potential after a move operation.
$V(s') - V(s) = 2 \cdot s_i \cdot S$ where $S$ is the total sum. -/
lemma potential_diff (s : State) (i : Fin 5) :
potential (move s i) - potential s = 2 * (s i) * s.sum := by
simp only [potential, State.sum, sum_fin5]
fin_cases i
all_goals (
simp (config := { decide := true }) [move]
try simp only [show (-1 : Fin 5) = 4 by decide]
ring
)
/-- If $s_i < 0$ and the total sum is positive, the potential strictly decreases. -/
lemma potential_decreasing (s : State) (i : Fin 5) (h_neg : s i < 0) (h_sum_pos : 0 < s.sum) :
potential (move s i) < potential s := by
have h_diff := potential_diff s i
have h_rhs_neg : 2 * (s i) * s.sum < 0 := by
nlinarith [h_neg, h_sum_pos]
linarith [h_diff, h_rhs_neg]
/-- The potential is always non-negative. -/
lemma potential_nonneg (s : State) : 0 ≤ potential s := by
rw [potential]
exact Finset.sum_nonneg (fun i _ => sq_nonneg (s i - s (i + 2)))
/-- Since the potential is non-negative and decreasing,
its value as a natural number also decreases. -/
lemma potential_measure_decreases (s : State) (i : Fin 5)
(h_neg : s i < 0) (h_sum : 0 < s.sum) :
(potential (move s i)).toNat < (potential s).toNat := by
have h_pos_s : 0 < potential s := by
linarith [potential_decreasing s i h_neg h_sum, potential_nonneg (move s i)]
rw [Int.toNat_lt_toNat h_pos_s]
exact potential_decreasing s i h_neg h_sum
/--
Main Theorem: IMO 1986 Problem 3.
Starting from any state with a positive sum, the process terminates.
-/
theorem imo1986_p3 (s₀ : State) (h_sum : 0 < s₀.sum) :
Acc Step s₀ := by
apply measure_termination s₀ h_sum
where
measure_termination (current : State) (h_current_sum : 0 < current.sum) : Acc Step current := by
generalize h_n : (potential current).toNat = n
revert current h_current_sum h_n
induction n using Nat.strong_induction_on with
| h n ih =>
intro current h_current_sum h_n_eq
subst h_n_eq
apply Acc.intro
intro next_state h_step
rcases h_step with ⟨i, h_neg, rfl⟩
have h_next_sum : 0 < (move current i).sum := by
rw [sum_invariant]
exact h_current_sum
apply ih ((potential (move current i)).toNat)
· apply potential_measure_decreases current i h_neg h_current_sum
· exact h_next_sum
· rfl
end Imo1986P3 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1986P3.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 600.0, "latency_s": 2.6326, "verified_at": "2026-03-26T18:17:01.682720+00:00"}} | true | true | false | 2.6326 |
compfiles_Imo1986P5 | compfiles | Copyright (c) 2024 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib
/-!
# International Mathematical Olympiad 1986, Problem 5
Find all functions `f`, defined on the non-negative real numbers and taking nonnegative real values,
such that:
- $f(xf(y))f(y) = f(x + y)$ for all $x, y \ge 0$,
- $f(2) = 0$,
- $f(x) \ne 0$ for $0 \le x < 2$.
-/
open scoped NNReal
namespace Imo1986P5
structure IsGood (f : ℝ≥0 → ℝ≥0) : Prop where
map_add_rev x y : f (x * f y) * f y = f (x + y)
map_two : f 2 = 0
map_ne_zero : ∀ x < 2, f x ≠ 0
namespace IsGood
/-
Note that this formalization relies on the fact that Mathlib uses 0 as the "garbage value",
namely for `2 ≤ x` we have `2 - x = 0` and `2 / (2 - x) = 0`.
Formalization is based on
[Art of Problem Solving](https://artofproblemsolving.com/wiki/index.php/1986_IMO_Problems/Problem_5)
with minor modifications.
-/
variable {f : ℝ≥0 → ℝ≥0} (hf : IsGood f) {x y : ℝ≥0}
include hf
theorem map_add (x y : ℝ≥0) : f (x + y) = f (x * f y) * f y :=
(hf.map_add_rev x y).symm
theorem map_eq_zero : f x = 0 ↔ 2 ≤ x := by
refine ⟨fun hx₀ ↦ not_lt.1 fun hlt ↦ hf.map_ne_zero x hlt hx₀, fun hle ↦ ?_⟩
rcases exists_add_of_le hle with ⟨x, rfl⟩
rw [add_comm, hf.map_add, hf.map_two, mul_zero]
theorem map_ne_zero_iff : f x ≠ 0 ↔ x < 2 := by simp [hf.map_eq_zero]
theorem map_of_lt_two (hx : x < 2) : f x = 2 / (2 - x) := by
have hx' : 0 < 2 - x := tsub_pos_of_lt hx
have hfx : f x ≠ 0 := hf.map_ne_zero_iff.2 hx
apply le_antisymm
· rw [le_div_iff₀ hx', ← le_div_iff₀' hfx.bot_lt,
tsub_le_iff_right, ← hf.map_eq_zero,
hf.map_add, div_mul_cancel₀ _ hfx, hf.map_two, zero_mul]
· rw [div_le_iff₀' hx', ← hf.map_eq_zero]
refine (mul_eq_zero.1 ?_).resolve_right hfx
rw [hf.map_add_rev, hf.map_eq_zero, tsub_add_cancel_of_le hx.le]
theorem map_eq (x : ℝ≥0) : f x = 2 / (2 - x) :=
match lt_or_ge x 2 with
| .inl hx => hf.map_of_lt_two hx
| .inr hx => by rwa [tsub_eq_zero_of_le hx, div_zero, hf.map_eq_zero]
end IsGood
abbrev SolutionSet : Set (ℝ≥0 → ℝ≥0) := { fun x ↦ 2 / (2 - x) }
theorem imo1986_p5 {f : ℝ≥0 → ℝ≥0} : IsGood f ↔ f ∈ SolutionSet := by
refine ⟨fun hf ↦ funext hf.map_eq, ?_⟩
rintro rfl
constructor
case map_two => simp [tsub_self]
case map_ne_zero => intro x hx; simpa [tsub_eq_zero_iff_le]
case map_add_rev =>
intro x y
cases lt_or_ge y 2 with
| inl hy =>
have hy' : 2 - y ≠ 0 := (tsub_pos_of_lt hy).ne'
rw [div_mul_div_comm, tsub_mul, mul_assoc, div_mul_cancel₀ _ hy', mul_comm x,
← mul_tsub, tsub_add_eq_tsub_tsub_swap, mul_div_mul_left _ _ two_ne_zero]
| inr hy =>
have : 2 ≤ x + y := le_add_left hy
simp [tsub_eq_zero_of_le, *]
end Imo1986P5 | /- | /-
Copyright (c) 2024 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib
/-!
# International Mathematical Olympiad 1986, Problem 5
Find all functions `f`, defined on the non-negative real numbers and taking nonnegative real values,
such that:
- $f(xf(y))f(y) = f(x + y)$ for all $x, y \ge 0$,
- $f(2) = 0$,
- $f(x) \ne 0$ for $0 \le x < 2$.
-/
open scoped NNReal
namespace Imo1986P5
structure IsGood (f : ℝ≥0 → ℝ≥0) : Prop where
map_add_rev x y : f (x * f y) * f y = f (x + y)
map_two : f 2 = 0
map_ne_zero : ∀ x < 2, f x ≠ 0
namespace IsGood
/-
Note that this formalization relies on the fact that Mathlib uses 0 as the "garbage value",
namely for `2 ≤ x` we have `2 - x = 0` and `2 / (2 - x) = 0`.
Formalization is based on
[Art of Problem Solving](https://artofproblemsolving.com/wiki/index.php/1986_IMO_Problems/Problem_5)
with minor modifications.
-/
variable {f : ℝ≥0 → ℝ≥0} (hf : IsGood f) {x y : ℝ≥0}
include hf
theorem map_add (x y : ℝ≥0) : f (x + y) = f (x * f y) * f y :=
(hf.map_add_rev x y).symm
theorem map_eq_zero : f x = 0 ↔ 2 ≤ x := by
refine ⟨fun hx₀ ↦ not_lt.1 fun hlt ↦ hf.map_ne_zero x hlt hx₀, fun hle ↦ ?_⟩
rcases exists_add_of_le hle with ⟨x, rfl⟩
rw [add_comm, hf.map_add, hf.map_two, mul_zero]
theorem map_ne_zero_iff : f x ≠ 0 ↔ x < 2 := by simp [hf.map_eq_zero]
theorem map_of_lt_two (hx : x < 2) : f x = 2 / (2 - x) := by
have hx' : 0 < 2 - x := tsub_pos_of_lt hx
have hfx : f x ≠ 0 := hf.map_ne_zero_iff.2 hx
apply le_antisymm
· rw [le_div_iff₀ hx', ← le_div_iff₀' hfx.bot_lt,
tsub_le_iff_right, ← hf.map_eq_zero,
hf.map_add, div_mul_cancel₀ _ hfx, hf.map_two, zero_mul]
· rw [div_le_iff₀' hx', ← hf.map_eq_zero]
refine (mul_eq_zero.1 ?_).resolve_right hfx
rw [hf.map_add_rev, hf.map_eq_zero, tsub_add_cancel_of_le hx.le]
theorem map_eq (x : ℝ≥0) : f x = 2 / (2 - x) :=
match lt_or_ge x 2 with
| .inl hx => hf.map_of_lt_two hx
| .inr hx => by rwa [tsub_eq_zero_of_le hx, div_zero, hf.map_eq_zero]
end IsGood
abbrev SolutionSet : Set (ℝ≥0 → ℝ≥0) := { fun x ↦ 2 / (2 - x) }
theorem imo1986_p5 {f : ℝ≥0 → ℝ≥0} : IsGood f ↔ f ∈ SolutionSet := by
refine ⟨fun hf ↦ funext hf.map_eq, ?_⟩
rintro rfl
constructor
case map_two => simp [tsub_self]
case map_ne_zero => intro x hx; simpa [tsub_eq_zero_iff_le]
case map_add_rev =>
intro x y
cases lt_or_ge y 2 with
| inl hy =>
have hy' : 2 - y ≠ 0 := (tsub_pos_of_lt hy).ne'
rw [div_mul_div_comm, tsub_mul, mul_assoc, div_mul_cancel₀ _ hy', mul_comm x,
← mul_tsub, tsub_add_eq_tsub_tsub_swap, mul_div_mul_left _ _ two_ne_zero]
| inr hy =>
have : 2 ≤ x + y := le_add_left hy
simp [tsub_eq_zero_of_le, *]
end Imo1986P5
| true | Copyright (c) 2024 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib
/-!
# International Mathematical Olympiad 1986, Problem 5
Find all functions `f`, defined on the non-negative real numbers and taking nonnegative real values,
such that:
- $f(xf(y))f(y) = f(x + y)$ for all $x, y \ge 0$,
- $f(2) = 0$,
- $f(x) \ne 0$ for $0 \le x < 2$.
-/
open scoped NNReal
namespace Imo1986P5
structure IsGood (f : ℝ≥0 → ℝ≥0) : Prop where
map_add_rev x y : f (x * f y) * f y = f (x + y)
map_two : f 2 = 0
map_ne_zero : ∀ x < 2, f x ≠ 0
namespace IsGood
/-
Note that this formalization relies on the fact that Mathlib uses 0 as the "garbage value",
namely for `2 ≤ x` we have `2 - x = 0` and `2 / (2 - x) = 0`.
Formalization is based on
[Art of Problem Solving](https://artofproblemsolving.com/wiki/index.php/1986_IMO_Problems/Problem_5)
with minor modifications.
-/
variable {f : ℝ≥0 → ℝ≥0} (hf : IsGood f) {x y : ℝ≥0}
include hf
theorem map_add (x y : ℝ≥0) : f (x + y) = f (x * f y) * f y :=
(hf.map_add_rev x y).symm
theorem map_eq_zero : f x = 0 ↔ 2 ≤ x := by
refine ⟨fun hx₀ ↦ not_lt.1 fun hlt ↦ hf.map_ne_zero x hlt hx₀, fun hle ↦ ?_⟩
rcases exists_add_of_le hle with ⟨x, rfl⟩
rw [add_comm, hf.map_add, hf.map_two, mul_zero]
theorem map_ne_zero_iff : f x ≠ 0 ↔ x < 2 := by simp [hf.map_eq_zero]
theorem map_of_lt_two (hx : x < 2) : f x = 2 / (2 - x) := by
have hx' : 0 < 2 - x := tsub_pos_of_lt hx
have hfx : f x ≠ 0 := hf.map_ne_zero_iff.2 hx
apply le_antisymm
· rw [le_div_iff₀ hx', ← le_div_iff₀' hfx.bot_lt,
tsub_le_iff_right, ← hf.map_eq_zero,
hf.map_add, div_mul_cancel₀ _ hfx, hf.map_two, zero_mul]
· rw [div_le_iff₀' hx', ← hf.map_eq_zero]
refine (mul_eq_zero.1 ?_).resolve_right hfx
rw [hf.map_add_rev, hf.map_eq_zero, tsub_add_cancel_of_le hx.le]
theorem map_eq (x : ℝ≥0) : f x = 2 / (2 - x) :=
match lt_or_ge x 2 with
| .inl hx => hf.map_of_lt_two hx
| .inr hx => by rwa [tsub_eq_zero_of_le hx, div_zero, hf.map_eq_zero]
end IsGood
abbrev SolutionSet : Set (ℝ≥0 → ℝ≥0) := { fun x ↦ 2 / (2 - x) }
theorem imo1986_p5 {f : ℝ≥0 → ℝ≥0} : IsGood f ↔ f ∈ SolutionSet := by
refine ⟨fun hf ↦ funext hf.map_eq, ?_⟩
rintro rfl
constructor
case map_two => simp [tsub_self]
case map_ne_zero => intro x hx; simpa [tsub_eq_zero_iff_le]
case map_add_rev =>
intro x y
cases lt_or_ge y 2 with
| inl hy =>
have hy' : 2 - y ≠ 0 := (tsub_pos_of_lt hy).ne'
rw [div_mul_div_comm, tsub_mul, mul_assoc, div_mul_cancel₀ _ hy', mul_comm x,
← mul_tsub, tsub_add_eq_tsub_tsub_swap, mul_div_mul_left _ _ two_ne_zero]
| inr hy =>
have : 2 ≤ x + y := le_add_left hy
simp [tsub_eq_zero_of_le, *]
end Imo1986P5 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1986P5.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["failed to synthesize\n LE Type\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n LE Type\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n OfNat Type 0\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\n Type\ndue to the absence of the instance above\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n OfNat Type 0\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\n Type\ndue to the absence of the instance above\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n LE Type\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n LE Type\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n LE Type\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n LE Type\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n OfNat Type 0\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\n Type\ndue to the absence of the instance above\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n OfNat Type 0\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\n Type\ndue to the absence of the instance above\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n OfNat Type 0\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\n Type\ndue to the absence of the instance above\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n OfNat Type 0\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\n Type\ndue to the absence of the instance above\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "function expected at\n IsGood\nterm has type\n ?m.15305", "failed to synthesize\n LE Type\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n LE Type\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n OfNat Type 0\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\n Type\ndue to the absence of the instance above\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n OfNat Type 0\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\n Type\ndue to the absence of the instance above\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "unknown identifier 'hf.map_add_rev'", "unknown identifier 'hf.map_ne_zero'", "unknown identifier 'hf.map_eq_zero'", "unsolved goals\nf : sorry \u2192 sorry\nx : sorry\n\u22a2 \u00acf x = sorry () \u2194 sorry ()", "failed to synthesize\n LE Type\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n OfNat Type 0\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\n Type\ndue to the absence of the instance above\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "Invalid dotted identifier notation: not supported on type\n Type u_1", "failed to synthesize\n LE Type\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n LE Type\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n OfNat Type 0\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\n Type\ndue to the absence of the instance above\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n OfNat Type 0\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\n Type\ndue to the absence of the instance above\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "stuck at solving universe constraint\n imax ?u.50235 ?u.50559 =?= ?u.50234+1\nwhile trying to unify\n Sort (imax ?u.50235 ?u.50559) : Type (imax ?u.50235 ?u.50559)\nwith\n Type ?u.50234 : Type (?u.50234 + 1)", "failed to synthesize\n LE Type\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n LE Type\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n OfNat Type 0\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\n Type\ndue to the absence of the instance above\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "failed to synthesize\n OfNat Type 0\nnumerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is\n Type\ndue to the absence of the instance above\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "function expected at\n IsGood\nterm has type\n ?m.51914", "stuck at solving universe constraint\n ?u.52049+1 =?= imax ?u.51987 ?u.52016\nwhile trying to unify\n sorryAx.{?u.51987 + 1} (Unit \u2192 Sort ?u.51987) true\n (Function.const Lean.Name () `53.24.53.27.24.27._sorry._@._hyg.684) \u2192\n sorryAx.{?u.52016 + 1} (Unit \u2192 Sort ?u.52016) true\n (Function.const Lean.Name () `53.30.53.33.30.33._sorry._@._hyg.691) : Sort (imax ?u.51987 ?u.52016)\nwith\n sorryAx.{?u.51987 + 1} (Unit \u2192 Sort ?u.51987) true\n (Function.const Lean.Name () `53.24.53.27.24.27._sorry._@._hyg.684) \u2192\n sorryAx.{?u.52016 + 1} (Unit \u2192 Sort ?u.52016) true\n (Function.const Lean.Name () `53.30.53.33.30.33._sorry._@._hyg.691) : Sort (imax ?u.51987 ?u.52016)"], "timeout_s": 600.0, "latency_s": 1.1394, "verified_at": "2026-03-26T18:17:00.520556+00:00"}} | false | true | false | 1.1394 |
compfiles_Imo1987P1 | compfiles | Copyright (c) 2021 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib
/-!
# International Mathematical Olympiad 1987, Problem 1
Let $p_{n, k}$ be the number of permutations of a set of cardinality `n ≥ 1`
that fix exactly `k` elements. Prove that $∑_{k=0}^n k p_{n,k}=n!$.
-/
namespace Imo1987P1
/-- Given `α : Type*` and `k : ℕ`, `fiber α k` is the set of permutations of
`α` with exactly `k` fixed points. -/
def fiber (α : Type*) [Fintype α] [DecidableEq α] (k : ℕ) : Set (Equiv.Perm α) :=
{σ : Equiv.Perm α | Fintype.card (Function.fixedPoints σ) = k}
instance {k : ℕ} (α : Type*) [Fintype α] [DecidableEq α] :
Fintype (fiber α k) := by unfold fiber; infer_instance
/-- `p α k` is the number of permutations of `α` with exactly `k` fixed points. -/
def p (α : Type*) [Fintype α] [DecidableEq α] (k : ℕ) : ℕ := Fintype.card (fiber α k)
open scoped Nat
section generalization
/-
To prove this identity, we show that both sides are equal to the cardinality of the set
`{(x : α, σ : Perm α) | σ x = x}`, regrouping by `card (fixedPoints σ)` for the left hand side and
by `x` for the right hand side.
-/
/-
The original problem assumes `n ≥ 1`. It turns out that a version with `n * (n - 1)!` in the RHS
holds true for `n = 0` as well, so we first prove it, then deduce the original version in the case
`n ≥ 1`. -/
variable (α : Type*) [Fintype α] [DecidableEq α]
open Equiv Fintype Function
open Finset (sum_const)
open Set (Iic)
/-- The set of pairs `(x : α, σ : Perm α)` such that `σ x = x` is equivalent to the set of pairs
`(x : α, σ : Perm {x}ᶜ)`. -/
def fixedPointsEquiv : { σx : α × Perm α // σx.2 σx.1 = σx.1 } ≃ Σ x : α, Perm ({x}ᶜ : Set α) :=
calc
{ σx : α × Perm α // σx.2 σx.1 = σx.1 } ≃ Σ x : α, { σ : Perm α // σ x = x } :=
setProdEquivSigma _
_ ≃ Σ x : α, { σ : Perm α // ∀ y : ({x} : Set α), σ y = Equiv.refl (↥({x} : Set α)) y } :=
(sigmaCongrRight fun x => Equiv.setCongr <| by simp only [SetCoe.forall]; dsimp; simp)
_ ≃ Σ x : α, Perm ({x}ᶜ : Set α) := sigmaCongrRight fun x => by apply Equiv.Set.compl
theorem card_fixed_points :
card { σx : α × Perm α // σx.2 σx.1 = σx.1 } = card α * (card α - 1)! := by
simp only [card_congr (fixedPointsEquiv α), card_sigma, card_perm]
have (x : _) : ({x}ᶜ : Set α) = Finset.filter (· ≠ x) Finset.univ := by
ext; simp
simp [this]
@[simp]
theorem mem_fiber {σ : Perm α} {k : ℕ} : σ ∈ fiber α k ↔ card (fixedPoints σ) = k :=
Iff.rfl
/-- The set of triples `(k ≤ card α, σ ∈ fiber α k, x ∈ fixedPoints σ)` is equivalent
to the set of pairs `(x : α, σ : Perm α)` such that `σ x = x`. The equivalence sends
`(k, σ, x)` to `(x, σ)` and `(x, σ)` to `(card (fixedPoints σ), σ, x)`.
It is easy to see that the cardinality of the LHS is given by
`∑ k : Fin (card α + 1), k * p α k`. -/
def fixedPointsEquiv' :
(Σ (k : Fin (card α + 1)) (σ : fiber α k), fixedPoints σ.1) ≃
{ σx : α × Perm α // σx.2 σx.1 = σx.1 } where
toFun p := ⟨⟨p.2.2, p.2.1⟩, p.2.2.2⟩
invFun p :=
⟨⟨card (fixedPoints p.1.2), (card_subtype_le _).trans_lt (Nat.lt_succ_self _)⟩, ⟨p.1.2, rfl⟩,
⟨p.1.1, p.2⟩⟩
left_inv := fun ⟨⟨k, hk⟩, ⟨σ, hσ⟩, ⟨x, hx⟩⟩ => by
simp only [mem_fiber] at hσ
subst k; rfl
right_inv := fun ⟨⟨x, σ⟩, h⟩ => rfl
/-- Main statement for any `(α : Type*) [Fintype α]`. -/
theorem main_fintype :
∑ k ∈ Finset.range (card α + 1), k * p α k = card α * (card α - 1)! := by
have A : ∀ (k) (σ : fiber α k), card (fixedPoints (↑σ : Perm α)) = k := fun k σ => σ.2
simpa [A, ← Fin.sum_univ_eq_sum_range, -card_ofFinset, Finset.card_univ, card_fixed_points,
mul_comm] using card_congr (fixedPointsEquiv' α)
/-- Main statement for permutations of `Fin n`, a version that works for `n = 0`. -/
theorem main₀ (n : ℕ) : ∑ k ∈ Finset.range (n + 1), k * p (Fin n) k = n * (n - 1)! := by
simpa using main_fintype (Fin n)
end generalization
theorem imo1987_p1 {n : ℕ} (hn : 1 ≤ n) :
∑ k ∈ Finset.range (n + 1), k * p (Fin n) k = n ! := by
rw [main₀, Nat.mul_factorial_pred (Nat.one_le_iff_ne_zero.mp hn)]
end Imo1987P1 | /- | /-
Copyright (c) 2021 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib
/-!
# International Mathematical Olympiad 1987, Problem 1
Let $p_{n, k}$ be the number of permutations of a set of cardinality `n ≥ 1`
that fix exactly `k` elements. Prove that $∑_{k=0}^n k p_{n,k}=n!$.
-/
namespace Imo1987P1
/-- Given `α : Type*` and `k : ℕ`, `fiber α k` is the set of permutations of
`α` with exactly `k` fixed points. -/
def fiber (α : Type*) [Fintype α] [DecidableEq α] (k : ℕ) : Set (Equiv.Perm α) :=
{σ : Equiv.Perm α | Fintype.card (Function.fixedPoints σ) = k}
instance {k : ℕ} (α : Type*) [Fintype α] [DecidableEq α] :
Fintype (fiber α k) := by unfold fiber; infer_instance
/-- `p α k` is the number of permutations of `α` with exactly `k` fixed points. -/
def p (α : Type*) [Fintype α] [DecidableEq α] (k : ℕ) : ℕ := Fintype.card (fiber α k)
open scoped Nat
section generalization
/-
To prove this identity, we show that both sides are equal to the cardinality of the set
`{(x : α, σ : Perm α) | σ x = x}`, regrouping by `card (fixedPoints σ)` for the left hand side and
by `x` for the right hand side.
-/
/-
The original problem assumes `n ≥ 1`. It turns out that a version with `n * (n - 1)!` in the RHS
holds true for `n = 0` as well, so we first prove it, then deduce the original version in the case
`n ≥ 1`. -/
variable (α : Type*) [Fintype α] [DecidableEq α]
open Equiv Fintype Function
open Finset (sum_const)
open Set (Iic)
/-- The set of pairs `(x : α, σ : Perm α)` such that `σ x = x` is equivalent to the set of pairs
`(x : α, σ : Perm {x}ᶜ)`. -/
def fixedPointsEquiv : { σx : α × Perm α // σx.2 σx.1 = σx.1 } ≃ Σ x : α, Perm ({x}ᶜ : Set α) :=
calc
{ σx : α × Perm α // σx.2 σx.1 = σx.1 } ≃ Σ x : α, { σ : Perm α // σ x = x } :=
setProdEquivSigma _
_ ≃ Σ x : α, { σ : Perm α // ∀ y : ({x} : Set α), σ y = Equiv.refl (↥({x} : Set α)) y } :=
(sigmaCongrRight fun x => Equiv.setCongr <| by simp only [SetCoe.forall]; dsimp; simp)
_ ≃ Σ x : α, Perm ({x}ᶜ : Set α) := sigmaCongrRight fun x => by apply Equiv.Set.compl
theorem card_fixed_points :
card { σx : α × Perm α // σx.2 σx.1 = σx.1 } = card α * (card α - 1)! := by
simp only [card_congr (fixedPointsEquiv α), card_sigma, card_perm]
have (x : _) : ({x}ᶜ : Set α) = Finset.filter (· ≠ x) Finset.univ := by
ext; simp
simp [this]
@[simp]
theorem mem_fiber {σ : Perm α} {k : ℕ} : σ ∈ fiber α k ↔ card (fixedPoints σ) = k :=
Iff.rfl
/-- The set of triples `(k ≤ card α, σ ∈ fiber α k, x ∈ fixedPoints σ)` is equivalent
to the set of pairs `(x : α, σ : Perm α)` such that `σ x = x`. The equivalence sends
`(k, σ, x)` to `(x, σ)` and `(x, σ)` to `(card (fixedPoints σ), σ, x)`.
It is easy to see that the cardinality of the LHS is given by
`∑ k : Fin (card α + 1), k * p α k`. -/
def fixedPointsEquiv' :
(Σ (k : Fin (card α + 1)) (σ : fiber α k), fixedPoints σ.1) ≃
{ σx : α × Perm α // σx.2 σx.1 = σx.1 } where
toFun p := ⟨⟨p.2.2, p.2.1⟩, p.2.2.2⟩
invFun p :=
⟨⟨card (fixedPoints p.1.2), (card_subtype_le _).trans_lt (Nat.lt_succ_self _)⟩, ⟨p.1.2, rfl⟩,
⟨p.1.1, p.2⟩⟩
left_inv := fun ⟨⟨k, hk⟩, ⟨σ, hσ⟩, ⟨x, hx⟩⟩ => by
simp only [mem_fiber] at hσ
subst k; rfl
right_inv := fun ⟨⟨x, σ⟩, h⟩ => rfl
/-- Main statement for any `(α : Type*) [Fintype α]`. -/
theorem main_fintype :
∑ k ∈ Finset.range (card α + 1), k * p α k = card α * (card α - 1)! := by
have A : ∀ (k) (σ : fiber α k), card (fixedPoints (↑σ : Perm α)) = k := fun k σ => σ.2
simpa [A, ← Fin.sum_univ_eq_sum_range, -card_ofFinset, Finset.card_univ, card_fixed_points,
mul_comm] using card_congr (fixedPointsEquiv' α)
/-- Main statement for permutations of `Fin n`, a version that works for `n = 0`. -/
theorem main₀ (n : ℕ) : ∑ k ∈ Finset.range (n + 1), k * p (Fin n) k = n * (n - 1)! := by
simpa using main_fintype (Fin n)
end generalization
theorem imo1987_p1 {n : ℕ} (hn : 1 ≤ n) :
∑ k ∈ Finset.range (n + 1), k * p (Fin n) k = n ! := by
rw [main₀, Nat.mul_factorial_pred (Nat.one_le_iff_ne_zero.mp hn)]
end Imo1987P1
| true | Copyright (c) 2021 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib
/-!
# International Mathematical Olympiad 1987, Problem 1
Let $p_{n, k}$ be the number of permutations of a set of cardinality `n ≥ 1`
that fix exactly `k` elements. Prove that $∑_{k=0}^n k p_{n,k}=n!$.
-/
namespace Imo1987P1
/-- Given `α : Type*` and `k : ℕ`, `fiber α k` is the set of permutations of
`α` with exactly `k` fixed points. -/
def fiber (α : Type*) [Fintype α] [DecidableEq α] (k : ℕ) : Set (Equiv.Perm α) :=
{σ : Equiv.Perm α | Fintype.card (Function.fixedPoints σ) = k}
instance {k : ℕ} (α : Type*) [Fintype α] [DecidableEq α] :
Fintype (fiber α k) := by unfold fiber; infer_instance
/-- `p α k` is the number of permutations of `α` with exactly `k` fixed points. -/
def p (α : Type*) [Fintype α] [DecidableEq α] (k : ℕ) : ℕ := Fintype.card (fiber α k)
open scoped Nat
section generalization
/-
To prove this identity, we show that both sides are equal to the cardinality of the set
`{(x : α, σ : Perm α) | σ x = x}`, regrouping by `card (fixedPoints σ)` for the left hand side and
by `x` for the right hand side.
-/
/-
The original problem assumes `n ≥ 1`. It turns out that a version with `n * (n - 1)!` in the RHS
holds true for `n = 0` as well, so we first prove it, then deduce the original version in the case
`n ≥ 1`. -/
variable (α : Type*) [Fintype α] [DecidableEq α]
open Equiv Fintype Function
open Finset (sum_const)
open Set (Iic)
/-- The set of pairs `(x : α, σ : Perm α)` such that `σ x = x` is equivalent to the set of pairs
`(x : α, σ : Perm {x}ᶜ)`. -/
def fixedPointsEquiv : { σx : α × Perm α // σx.2 σx.1 = σx.1 } ≃ Σ x : α, Perm ({x}ᶜ : Set α) :=
calc
{ σx : α × Perm α // σx.2 σx.1 = σx.1 } ≃ Σ x : α, { σ : Perm α // σ x = x } :=
setProdEquivSigma _
_ ≃ Σ x : α, { σ : Perm α // ∀ y : ({x} : Set α), σ y = Equiv.refl (↥({x} : Set α)) y } :=
(sigmaCongrRight fun x => Equiv.setCongr <| by simp only [SetCoe.forall]; dsimp; simp)
_ ≃ Σ x : α, Perm ({x}ᶜ : Set α) := sigmaCongrRight fun x => by apply Equiv.Set.compl
theorem card_fixed_points :
card { σx : α × Perm α // σx.2 σx.1 = σx.1 } = card α * (card α - 1)! := by
simp only [card_congr (fixedPointsEquiv α), card_sigma, card_perm]
have (x : _) : ({x}ᶜ : Set α) = Finset.filter (· ≠ x) Finset.univ := by
ext; simp
simp [this]
@[simp]
theorem mem_fiber {σ : Perm α} {k : ℕ} : σ ∈ fiber α k ↔ card (fixedPoints σ) = k :=
Iff.rfl
/-- The set of triples `(k ≤ card α, σ ∈ fiber α k, x ∈ fixedPoints σ)` is equivalent
to the set of pairs `(x : α, σ : Perm α)` such that `σ x = x`. The equivalence sends
`(k, σ, x)` to `(x, σ)` and `(x, σ)` to `(card (fixedPoints σ), σ, x)`.
It is easy to see that the cardinality of the LHS is given by
`∑ k : Fin (card α + 1), k * p α k`. -/
def fixedPointsEquiv' :
(Σ (k : Fin (card α + 1)) (σ : fiber α k), fixedPoints σ.1) ≃
{ σx : α × Perm α // σx.2 σx.1 = σx.1 } where
toFun p := ⟨⟨p.2.2, p.2.1⟩, p.2.2.2⟩
invFun p :=
⟨⟨card (fixedPoints p.1.2), (card_subtype_le _).trans_lt (Nat.lt_succ_self _)⟩, ⟨p.1.2, rfl⟩,
⟨p.1.1, p.2⟩⟩
left_inv := fun ⟨⟨k, hk⟩, ⟨σ, hσ⟩, ⟨x, hx⟩⟩ => by
simp only [mem_fiber] at hσ
subst k; rfl
right_inv := fun ⟨⟨x, σ⟩, h⟩ => rfl
/-- Main statement for any `(α : Type*) [Fintype α]`. -/
theorem main_fintype :
∑ k ∈ Finset.range (card α + 1), k * p α k = card α * (card α - 1)! := by
have A : ∀ (k) (σ : fiber α k), card (fixedPoints (↑σ : Perm α)) = k := fun k σ => σ.2
simpa [A, ← Fin.sum_univ_eq_sum_range, -card_ofFinset, Finset.card_univ, card_fixed_points,
mul_comm] using card_congr (fixedPointsEquiv' α)
/-- Main statement for permutations of `Fin n`, a version that works for `n = 0`. -/
theorem main₀ (n : ℕ) : ∑ k ∈ Finset.range (n + 1), k * p (Fin n) k = n * (n - 1)! := by
simpa using main_fintype (Fin n)
end generalization
theorem imo1987_p1 {n : ℕ} (hn : 1 ≤ n) :
∑ k ∈ Finset.range (n + 1), k * p (Fin n) k = n ! := by
rw [main₀, Nat.mul_factorial_pred (Nat.one_le_iff_ne_zero.mp hn)]
end Imo1987P1 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1987P1.lean"} | {"v4.21.0": {"is_valid": true, "has_sorry": false, "errors": [], "timeout_s": 600.0, "latency_s": 11.917, "verified_at": "2026-03-26T18:17:12.437650+00:00"}} | true | true | false | 11.917 |
compfiles_Imo1987P4 | compfiles | Copyright (c) 2023 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1987, Problem 4
Prove that there is no function f : ℕ → ℕ such that f(f(n)) = n + 1987
for every n.
-/
namespace Imo1987P4
theorem imo1987_p4 : ¬∃ f : ℕ → ℕ, ∀ n, f (f n) = n + 1987 := by
-- Informal solution by Sawa Pavlov, listed at
-- https://artofproblemsolving.com/wiki/index.php/1987_IMO_Problems/Problem_4
-- We will prove a more general statement.
suffices generalized : ∀ m : ℕ, ¬∃ f : ℕ → ℕ, ∀ n, f (f n) = n + (2 * m + 1) from
generalized 993
rintro m ⟨f, hf⟩
-- Note that f is injective, because if f(x) = f(y),
-- then f(f(x)) = f(f(y)), so x = y.
have f_injective : f.Injective := by
intro x y hxy
have hfx := hf x
rw [hxy, hf y] at hfx
exact Nat.add_right_cancel hfx.symm
-- Let A := ℕ - f(ℕ) and B := f(A).
let A : Set ℕ := Set.univ \ (f '' Set.univ)
let B : Set ℕ := f '' A
-- A and B have union ℕ - f(f(ℕ)).
have ab_union : A ∪ B = Set.univ \ (f '' (f '' Set.univ)) := by
-- Note that B = f(ℕ) - f(f(ℕ)).
simp only [A, B, Set.image_diff f_injective]
exact Set.diff_union_diff_cancel
(Set.subset_univ _) (Set.image_mono (Set.subset_univ _))
-- ... which is {0, 1, ... , 2 * m}.
have ab_range : A ∪ B = {n | n < 2 * m + 1} := by
rw [ab_union]
ext x
rw [Set.mem_setOf_eq, ←not_iff_not, ←Set.compl_eq_univ_diff]
rw [Set.notMem_compl_iff, not_lt]
simp only [Set.mem_image, Set.mem_univ, true_and, exists_exists_eq_and, hf]
rw [le_iff_exists_add']
simp_rw [eq_comm]
-- A and B are disjoint.
have ab_disjoint : Disjoint A B := by
intro C hca hcb c hc
exact Set.notMem_of_mem_diff (hca hc) (Set.image_mono sdiff_le (hcb hc))
-- But since f is injective, A and B have the
-- same number of elements, which is impossible since {0, 1, ... , 2 * m}
-- has an odd number of elements.
have ab_card : Set.ncard (A ∪ B) = 2 * m + 1 := by
rw [ab_range, Set.Iio_def, ←Finset.coe_range, Set.ncard_coe_finset]
exact Finset.card_range (2 * m + 1)
have ab_finite : (A ∪ B).Finite := by
rw [ab_range]; exact Set.finite_lt_nat _
obtain ⟨a_finite, b_finite⟩ := Set.finite_union.mp ab_finite
rw [Set.ncard_union_eq ab_disjoint a_finite b_finite] at ab_card
rw [Set.ncard_image_of_injective _ f_injective] at ab_card
omega
end Imo1987P4 | /- | /-
Copyright (c) 2023 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1987, Problem 4
Prove that there is no function f : ℕ → ℕ such that f(f(n)) = n + 1987
for every n.
-/
namespace Imo1987P4
theorem imo1987_p4 : ¬∃ f : ℕ → ℕ, ∀ n, f (f n) = n + 1987 := by
-- Informal solution by Sawa Pavlov, listed at
-- https://artofproblemsolving.com/wiki/index.php/1987_IMO_Problems/Problem_4
-- We will prove a more general statement.
suffices generalized : ∀ m : ℕ, ¬∃ f : ℕ → ℕ, ∀ n, f (f n) = n + (2 * m + 1) from
generalized 993
rintro m ⟨f, hf⟩
-- Note that f is injective, because if f(x) = f(y),
-- then f(f(x)) = f(f(y)), so x = y.
have f_injective : f.Injective := by
intro x y hxy
have hfx := hf x
rw [hxy, hf y] at hfx
exact Nat.add_right_cancel hfx.symm
-- Let A := ℕ - f(ℕ) and B := f(A).
let A : Set ℕ := Set.univ \ (f '' Set.univ)
let B : Set ℕ := f '' A
-- A and B have union ℕ - f(f(ℕ)).
have ab_union : A ∪ B = Set.univ \ (f '' (f '' Set.univ)) := by
-- Note that B = f(ℕ) - f(f(ℕ)).
simp only [A, B, Set.image_diff f_injective]
exact Set.diff_union_diff_cancel
(Set.subset_univ _) (Set.image_mono (Set.subset_univ _))
-- ... which is {0, 1, ... , 2 * m}.
have ab_range : A ∪ B = {n | n < 2 * m + 1} := by
rw [ab_union]
ext x
rw [Set.mem_setOf_eq, ←not_iff_not, ←Set.compl_eq_univ_diff]
rw [Set.notMem_compl_iff, not_lt]
simp only [Set.mem_image, Set.mem_univ, true_and, exists_exists_eq_and, hf]
rw [le_iff_exists_add']
simp_rw [eq_comm]
-- A and B are disjoint.
have ab_disjoint : Disjoint A B := by
intro C hca hcb c hc
exact Set.notMem_of_mem_diff (hca hc) (Set.image_mono sdiff_le (hcb hc))
-- But since f is injective, A and B have the
-- same number of elements, which is impossible since {0, 1, ... , 2 * m}
-- has an odd number of elements.
have ab_card : Set.ncard (A ∪ B) = 2 * m + 1 := by
rw [ab_range, Set.Iio_def, ←Finset.coe_range, Set.ncard_coe_finset]
exact Finset.card_range (2 * m + 1)
have ab_finite : (A ∪ B).Finite := by
rw [ab_range]; exact Set.finite_lt_nat _
obtain ⟨a_finite, b_finite⟩ := Set.finite_union.mp ab_finite
rw [Set.ncard_union_eq ab_disjoint a_finite b_finite] at ab_card
rw [Set.ncard_image_of_injective _ f_injective] at ab_card
omega
end Imo1987P4
| true | Copyright (c) 2023 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Renshaw
-/
import Mathlib
/-!
# International Mathematical Olympiad 1987, Problem 4
Prove that there is no function f : ℕ → ℕ such that f(f(n)) = n + 1987
for every n.
-/
namespace Imo1987P4
theorem imo1987_p4 : ¬∃ f : ℕ → ℕ, ∀ n, f (f n) = n + 1987 := by
-- Informal solution by Sawa Pavlov, listed at
-- https://artofproblemsolving.com/wiki/index.php/1987_IMO_Problems/Problem_4
-- We will prove a more general statement.
suffices generalized : ∀ m : ℕ, ¬∃ f : ℕ → ℕ, ∀ n, f (f n) = n + (2 * m + 1) from
generalized 993
rintro m ⟨f, hf⟩
-- Note that f is injective, because if f(x) = f(y),
-- then f(f(x)) = f(f(y)), so x = y.
have f_injective : f.Injective := by
intro x y hxy
have hfx := hf x
rw [hxy, hf y] at hfx
exact Nat.add_right_cancel hfx.symm
-- Let A := ℕ - f(ℕ) and B := f(A).
let A : Set ℕ := Set.univ \ (f '' Set.univ)
let B : Set ℕ := f '' A
-- A and B have union ℕ - f(f(ℕ)).
have ab_union : A ∪ B = Set.univ \ (f '' (f '' Set.univ)) := by
-- Note that B = f(ℕ) - f(f(ℕ)).
simp only [A, B, Set.image_diff f_injective]
exact Set.diff_union_diff_cancel
(Set.subset_univ _) (Set.image_mono (Set.subset_univ _))
-- ... which is {0, 1, ... , 2 * m}.
have ab_range : A ∪ B = {n | n < 2 * m + 1} := by
rw [ab_union]
ext x
rw [Set.mem_setOf_eq, ←not_iff_not, ←Set.compl_eq_univ_diff]
rw [Set.notMem_compl_iff, not_lt]
simp only [Set.mem_image, Set.mem_univ, true_and, exists_exists_eq_and, hf]
rw [le_iff_exists_add']
simp_rw [eq_comm]
-- A and B are disjoint.
have ab_disjoint : Disjoint A B := by
intro C hca hcb c hc
exact Set.notMem_of_mem_diff (hca hc) (Set.image_mono sdiff_le (hcb hc))
-- But since f is injective, A and B have the
-- same number of elements, which is impossible since {0, 1, ... , 2 * m}
-- has an odd number of elements.
have ab_card : Set.ncard (A ∪ B) = 2 * m + 1 := by
rw [ab_range, Set.Iio_def, ←Finset.coe_range, Set.ncard_coe_finset]
exact Finset.card_range (2 * m + 1)
have ab_finite : (A ∪ B).Finite := by
rw [ab_range]; exact Set.finite_lt_nat _
obtain ⟨a_finite, b_finite⟩ := Set.finite_union.mp ab_finite
rw [Set.ncard_union_eq ab_disjoint a_finite b_finite] at ab_card
rw [Set.ncard_image_of_injective _ f_injective] at ab_card
omega
end Imo1987P4 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1987P4.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unknown constant 'Set.ncard_coe_finset'", "unsolved goals\ncase intro.intro\nm : \u2115\nf : \u2115 \u2192 \u2115\nhf : \u2200 (n : \u2115), f (f n) = n + (2 * m + 1)\nf_injective : Function.Injective f\nA : Set \u2115 := Set.univ \\ f '' Set.univ\nB : Set \u2115 := f '' A\nab_union : A \u222a B = Set.univ \\ f '' (f '' Set.univ)\nab_range : A \u222a B = {n | n < 2 * m + 1}\nab_disjoint : Disjoint A B\nab_card : A.ncard + A.ncard = 2 * m + 1\nab_finite : (A \u222a B).Finite\na_finite : A.Finite\nb_finite : B.Finite\n\u22a2 False"], "timeout_s": 600.0, "latency_s": 0.1761, "verified_at": "2026-03-26T18:17:00.784148+00:00"}} | false | true | false | 0.1761 |
compfiles_Imo1987P6 | compfiles | Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jia-Jun Ma
-/
import Mathlib
/-!
# International Mathematical Olympiad 1987, Problem 6
Let $n$ be an integer greater than or equal to 2. Prove that
if $k^2 + k + n$ is prime for all integers $k$ such that
$0 <= k <= \sqrt{n/3}$, then $k^2 + k + n$ is prime for all
integers $k$ such that $0 <= k <= n - 2$.
-/
namespace Imo1987P6
open Nat
lemma minFac_le_sq {n : ℕ} (hnezero : n ≠ 0) (hn : minFac n ≠ n) : (minFac n)^2 ≤ n := by
match n with
| 0 => contradiction
| 1 => simp
| n+2 =>
obtain ⟨r,hr⟩ := Nat.minFac_dvd (n+2)
match r with
| 0 => omega
| 1 => nth_rw 2 [hr] at hn; simp at hn
| r+2 =>
have hh : (r+2) ∣ (n+2) := ⟨minFac (n+2), (by nth_rw 1 [hr,mul_comm])⟩
have hr' : minFac (n+2) ≤ (r+2) := Nat.minFac_le_of_dvd (by omega) hh
calc
_ = (minFac (n+2)) * minFac (n+2) := by ring_nf
_ ≤ minFac (n+2) * (r+2) := Nat.mul_le_mul_left _ hr'
_ = _ := hr.symm
lemma prime_of_coprime' (n : ℕ) (h1 : 1 < n)
(h2 : ∀ m:ℕ, m^2 ≤ n → m ≠ 0 → n.Coprime m) : Nat.Prime n := by
rw [Nat.prime_def_minFac]
by_contra H; push_neg at H
replace H := H (by omega)
let m := minFac n
have nneone : n ≠ 1 := by omega
have mpos := Nat.minFac_pos n
replace h2 := h2 (m) (minFac_le_sq (by omega) H) (by omega)
apply Nat.Prime.not_coprime_iff_dvd.2 ?_ h2
use (minFac n)
simp [Nat.minFac_prime nneone,Nat.minFac_dvd,m]
lemma dyadic {k b : ℕ} (h1 : 1 ≤ k) (h2 : k ≤ b) : ∃ i, b < 2^i * k ∧ 2^i *k ≤ 2* b := by
have hbk : b/k ≠ 0 := by
apply (Nat.div_ne_zero_iff (a:=b) (b:=k)).2
omega
use Nat.log2 (b/k) + 1
constructor
· have h2bk: (b/k).log2 < (b/k).log2 + 1 := Nat.lt_succ_self _
replace h2bk := (Nat.log2_lt hbk).1 h2bk
replace h2bk := succ_le_of_lt h2bk
calc
_ < b/k * k + k := lt_div_mul_add (by omega)
_ = (b/k+1) *k := by ring
_ ≤ 2 ^((b/k).log2 +1) * k := Nat.mul_le_mul_right k h2bk
· have h2 : 2 ^((b/k).log2 +1) = 2 * 2^( (b/k).log2 ):=
by rw [pow_succ _ _,mul_comm]
rw [h2]
have h3 : 2^((b/k).log2) ≤ b/k := Nat.log2_self_le hbk
rw [mul_assoc]
apply Nat.mul_le_mul_left 2
exact (Nat.le_div_iff_mul_le h1).mp h3
lemma key_lemma {m b: ℕ}
(h: ∀ k, b < k → k ≤ 2*b → Coprime m k) :
∀ k, 1 < k → k ≤ 2 * b → Coprime m k := by
intro k hk1 hk2
by_cases hk0 : b < k
· exact h k hk0 hk2
· push_neg at hk0
obtain ⟨i, hi1, hi2⟩ := dyadic (le_of_lt hk1) hk0
exact Coprime.coprime_mul_left_right (h (2 ^ i * k) hi1 hi2)
lemma key_lemma' {m b: ℕ } (h1 : 1 < m)
(h: ∀ k, b < k → k ≤ 2*b → Coprime m k) (h2 : m < (2*b+1)^2) :
Nat.Prime m := by
replace h := key_lemma h
apply prime_of_coprime' m h1
intro k hk1 hk2
by_cases hk0 : k=1
· simp [hk0]
push_neg at hk0
refine h k ?_ ?_
· omega
· replace h2 := lt_of_le_of_lt hk1 h2
rw [pow_two,pow_two] at h2
replace h2 := Nat.mul_self_lt_mul_self_iff.1 h2
omega
lemma dvd_lemma (a b c : ℕ ) (h : c ≠ 0) : a ≤ b → b ∣ c → c < 2 * a → b = c := by
intro h1 ⟨k, hk⟩ h3
match k with
| 0 => simp at hk; exfalso; exact h hk
| 1 => simp [hk]
| k + 2 => omega
lemma zero_of_le_sub_pos {a b : ℕ} : b ≠ 0 → a ≤ a - b → a = 0 := by omega
lemma sub_le_lemma {a b : ℕ} : b ≤ a → b ≠ 0 → a - b < a := by omega
theorem imo1987_p6
(p : ℕ)
(h₁ : ∀ k : ℕ, k ≤ Nat.floor (Real.sqrt ((p:ℝ) / 3)) → Nat.Prime (k^2 + k + p)) :
∀ i ≤ p - 2, Nat.Prime (i^2 + i + p) := by
let f x := x^2 + x + p
let r := Nat.floor (Real.sqrt (p/3))
intro k
apply Nat.case_strong_induction_on k
· intro; exact h₁ 0 (Nat.zero_le _)
intro k IH hk
by_cases h : k+1 ≤ r
· exact h₁ (k+1) h
· push_neg at h
let kk := k+1
let s := kk - r
let N := f kk
have hksr : kk = s + r := Nat.eq_add_of_sub_eq (le_of_lt h) (by rfl)
/- Show that N < ... -/
have hs : 1 ≤ s := by
simp_rw [s, kk]
exact Nat.le_sub_of_add_le' h
have ieq3 : 3*r ≤ 6*r*s := by nlinarith only [hs]
have ieq4 : p ≤ 3*r^2 + 6*r + 2 := by
have ieq5: √ (p/3) < r+1 := Nat.lt_floor_add_one _
replace ieq5 := Real.lt_sq_of_sqrt_lt ieq5 |> (div_lt_iff₀ (by norm_num)).1
replace ieq5: (p) < (3*r^2 + 6*r +3) := cast_lt.1 <| by
have casteq: ((r:ℝ)+1)^2 * 3 = ((3*r^2+6*r+3:ℕ):ℝ) := by simp;ring_nf
rw [←casteq]
exact ieq5
omega
have hN0 : N = kk^2+kk+p := rfl
have hN1 : N < (2 * (s + r) +1)^2 := by
calc
_ = _:= hN0
_ ≤ 3*r^2 + 6*r + 2 + (r+s)*(r+s+1) := by nlinarith only [hN0, ieq4, hs, hksr]
_ = 4*r^2 + 2* r*s + s^2 + 7*r+s+2 := by ring_nf
_ < 4*r^2 +4*s^2 +8*r*s+4*r+4*s+1 := by omega
_ = _ := by ring
rw [←hksr] at hN1
have hP : ∀ i , kk < i → i ≤ 2*(kk) → Coprime N i := by
by_contra H
push_neg at H
obtain ⟨j, hj1,hj2,hj3⟩ := H
have hj1' : s+r +1 ≤ j := by rw [←hksr]; apply succ_le_of_lt hj1
let ss := j-(s+r+1)
have hss0 : j = ss + (s+r+1) := Nat.eq_add_of_sub_eq hj1' (by rfl)
have hp: 2 ≤ p := Nat.lt_of_sub_ne_zero (by omega: p-2 ≠ 0) |> le_of_lt
have hss1 : ss ≤ k := by
apply Nat.le_of_add_le_add_right (b :=s+r+1)
rw [←hss0,←hksr]
calc
_ ≤ _ := hj2
_ = _ := by omega
replace hss1 : Nat.Prime (f ss) := IH ss hss1 (by omega)
have hfss: N = f ss + (2*kk - j+1) *j := by
unfold f
rw [hN0]
zify
rw [Int.natCast_sub hj2,hss0,←hksr]
push_cast
ring_nf
change ¬N.gcd j = 1 at hj3
rw [hfss, ←Nat.coprime_iff_gcd_eq_one, Nat.coprime_add_mul_right_left] at hj3
have hss2 : f ss ∣ j := Nat.Prime.dvd_iff_not_coprime hss1 |>.2 hj3
have hfss1: p ≤ f ss := Nat.le_add_left p (ss ^ 2 + ss)
have hp1 : p - 2 < p := sub_le_lemma hp (by omega)
have hfss2: j < 2*p := by omega
have hj : j ≠ 0 := by omega
have hfss3: f ss = j := dvd_lemma _ _ _ hj hfss1 hss2 hfss2
unfold f at hfss3
rw [hss0,add_comm _ ss,add_assoc] at hfss3
replace hfss3 := add_left_cancel hfss3
have hc1 : p ≤ k + 2 := by
calc
p ≤ ss^2 + p := Nat.le_add_left _ _
_ = _ := hfss3
_ = _ := by rw [←hksr]
have hc2: p ≤ p-1 := by
calc
_ ≤ _ := hc1
_ = (k+1) + 1 := by ring_nf
_ ≤ (p-2)+1 := by omega
_ = p - 1 := by omega
have : p = 0 := zero_of_le_sub_pos (by simp) hc2
omega
have hfk : 1 < f kk := by
unfold f
rw [hksr]
calc
_ < 1 + 1 := by decide
_ ≤ s^2 + s := by nlinarith only [hs]
_ ≤ s^2 + 2 * r *s + r^2 + s + r + p := by omega
_ = _ := by ring
exact key_lemma' (hfk) hP hN1
end Imo1987P6 | /- | /-
Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jia-Jun Ma
-/
import Mathlib
/-!
# International Mathematical Olympiad 1987, Problem 6
Let $n$ be an integer greater than or equal to 2. Prove that
if $k^2 + k + n$ is prime for all integers $k$ such that
$0 <= k <= \sqrt{n/3}$, then $k^2 + k + n$ is prime for all
integers $k$ such that $0 <= k <= n - 2$.
-/
namespace Imo1987P6
open Nat
lemma minFac_le_sq {n : ℕ} (hnezero : n ≠ 0) (hn : minFac n ≠ n) : (minFac n)^2 ≤ n := by
match n with
| 0 => contradiction
| 1 => simp
| n+2 =>
obtain ⟨r,hr⟩ := Nat.minFac_dvd (n+2)
match r with
| 0 => omega
| 1 => nth_rw 2 [hr] at hn; simp at hn
| r+2 =>
have hh : (r+2) ∣ (n+2) := ⟨minFac (n+2), (by nth_rw 1 [hr,mul_comm])⟩
have hr' : minFac (n+2) ≤ (r+2) := Nat.minFac_le_of_dvd (by omega) hh
calc
_ = (minFac (n+2)) * minFac (n+2) := by ring_nf
_ ≤ minFac (n+2) * (r+2) := Nat.mul_le_mul_left _ hr'
_ = _ := hr.symm
lemma prime_of_coprime' (n : ℕ) (h1 : 1 < n)
(h2 : ∀ m:ℕ, m^2 ≤ n → m ≠ 0 → n.Coprime m) : Nat.Prime n := by
rw [Nat.prime_def_minFac]
by_contra H; push_neg at H
replace H := H (by omega)
let m := minFac n
have nneone : n ≠ 1 := by omega
have mpos := Nat.minFac_pos n
replace h2 := h2 (m) (minFac_le_sq (by omega) H) (by omega)
apply Nat.Prime.not_coprime_iff_dvd.2 ?_ h2
use (minFac n)
simp [Nat.minFac_prime nneone,Nat.minFac_dvd,m]
lemma dyadic {k b : ℕ} (h1 : 1 ≤ k) (h2 : k ≤ b) : ∃ i, b < 2^i * k ∧ 2^i *k ≤ 2* b := by
have hbk : b/k ≠ 0 := by
apply (Nat.div_ne_zero_iff (a:=b) (b:=k)).2
omega
use Nat.log2 (b/k) + 1
constructor
· have h2bk: (b/k).log2 < (b/k).log2 + 1 := Nat.lt_succ_self _
replace h2bk := (Nat.log2_lt hbk).1 h2bk
replace h2bk := succ_le_of_lt h2bk
calc
_ < b/k * k + k := lt_div_mul_add (by omega)
_ = (b/k+1) *k := by ring
_ ≤ 2 ^((b/k).log2 +1) * k := Nat.mul_le_mul_right k h2bk
· have h2 : 2 ^((b/k).log2 +1) = 2 * 2^( (b/k).log2 ):=
by rw [pow_succ _ _,mul_comm]
rw [h2]
have h3 : 2^((b/k).log2) ≤ b/k := Nat.log2_self_le hbk
rw [mul_assoc]
apply Nat.mul_le_mul_left 2
exact (Nat.le_div_iff_mul_le h1).mp h3
lemma key_lemma {m b: ℕ}
(h: ∀ k, b < k → k ≤ 2*b → Coprime m k) :
∀ k, 1 < k → k ≤ 2 * b → Coprime m k := by
intro k hk1 hk2
by_cases hk0 : b < k
· exact h k hk0 hk2
· push_neg at hk0
obtain ⟨i, hi1, hi2⟩ := dyadic (le_of_lt hk1) hk0
exact Coprime.coprime_mul_left_right (h (2 ^ i * k) hi1 hi2)
lemma key_lemma' {m b: ℕ } (h1 : 1 < m)
(h: ∀ k, b < k → k ≤ 2*b → Coprime m k) (h2 : m < (2*b+1)^2) :
Nat.Prime m := by
replace h := key_lemma h
apply prime_of_coprime' m h1
intro k hk1 hk2
by_cases hk0 : k=1
· simp [hk0]
push_neg at hk0
refine h k ?_ ?_
· omega
· replace h2 := lt_of_le_of_lt hk1 h2
rw [pow_two,pow_two] at h2
replace h2 := Nat.mul_self_lt_mul_self_iff.1 h2
omega
lemma dvd_lemma (a b c : ℕ ) (h : c ≠ 0) : a ≤ b → b ∣ c → c < 2 * a → b = c := by
intro h1 ⟨k, hk⟩ h3
match k with
| 0 => simp at hk; exfalso; exact h hk
| 1 => simp [hk]
| k + 2 => omega
lemma zero_of_le_sub_pos {a b : ℕ} : b ≠ 0 → a ≤ a - b → a = 0 := by omega
lemma sub_le_lemma {a b : ℕ} : b ≤ a → b ≠ 0 → a - b < a := by omega
theorem imo1987_p6
(p : ℕ)
(h₁ : ∀ k : ℕ, k ≤ Nat.floor (Real.sqrt ((p:ℝ) / 3)) → Nat.Prime (k^2 + k + p)) :
∀ i ≤ p - 2, Nat.Prime (i^2 + i + p) := by
let f x := x^2 + x + p
let r := Nat.floor (Real.sqrt (p/3))
intro k
apply Nat.case_strong_induction_on k
· intro; exact h₁ 0 (Nat.zero_le _)
intro k IH hk
by_cases h : k+1 ≤ r
· exact h₁ (k+1) h
· push_neg at h
let kk := k+1
let s := kk - r
let N := f kk
have hksr : kk = s + r := Nat.eq_add_of_sub_eq (le_of_lt h) (by rfl)
/- Show that N < ... -/
have hs : 1 ≤ s := by
simp_rw [s, kk]
exact Nat.le_sub_of_add_le' h
have ieq3 : 3*r ≤ 6*r*s := by nlinarith only [hs]
have ieq4 : p ≤ 3*r^2 + 6*r + 2 := by
have ieq5: √ (p/3) < r+1 := Nat.lt_floor_add_one _
replace ieq5 := Real.lt_sq_of_sqrt_lt ieq5 |> (div_lt_iff₀ (by norm_num)).1
replace ieq5: (p) < (3*r^2 + 6*r +3) := cast_lt.1 <| by
have casteq: ((r:ℝ)+1)^2 * 3 = ((3*r^2+6*r+3:ℕ):ℝ) := by simp;ring_nf
rw [←casteq]
exact ieq5
omega
have hN0 : N = kk^2+kk+p := rfl
have hN1 : N < (2 * (s + r) +1)^2 := by
calc
_ = _:= hN0
_ ≤ 3*r^2 + 6*r + 2 + (r+s)*(r+s+1) := by nlinarith only [hN0, ieq4, hs, hksr]
_ = 4*r^2 + 2* r*s + s^2 + 7*r+s+2 := by ring_nf
_ < 4*r^2 +4*s^2 +8*r*s+4*r+4*s+1 := by omega
_ = _ := by ring
rw [←hksr] at hN1
have hP : ∀ i , kk < i → i ≤ 2*(kk) → Coprime N i := by
by_contra H
push_neg at H
obtain ⟨j, hj1,hj2,hj3⟩ := H
have hj1' : s+r +1 ≤ j := by rw [←hksr]; apply succ_le_of_lt hj1
let ss := j-(s+r+1)
have hss0 : j = ss + (s+r+1) := Nat.eq_add_of_sub_eq hj1' (by rfl)
have hp: 2 ≤ p := Nat.lt_of_sub_ne_zero (by omega: p-2 ≠ 0) |> le_of_lt
have hss1 : ss ≤ k := by
apply Nat.le_of_add_le_add_right (b :=s+r+1)
rw [←hss0,←hksr]
calc
_ ≤ _ := hj2
_ = _ := by omega
replace hss1 : Nat.Prime (f ss) := IH ss hss1 (by omega)
have hfss: N = f ss + (2*kk - j+1) *j := by
unfold f
rw [hN0]
zify
rw [Int.natCast_sub hj2,hss0,←hksr]
push_cast
ring_nf
change ¬N.gcd j = 1 at hj3
rw [hfss, ←Nat.coprime_iff_gcd_eq_one, Nat.coprime_add_mul_right_left] at hj3
have hss2 : f ss ∣ j := Nat.Prime.dvd_iff_not_coprime hss1 |>.2 hj3
have hfss1: p ≤ f ss := Nat.le_add_left p (ss ^ 2 + ss)
have hp1 : p - 2 < p := sub_le_lemma hp (by omega)
have hfss2: j < 2*p := by omega
have hj : j ≠ 0 := by omega
have hfss3: f ss = j := dvd_lemma _ _ _ hj hfss1 hss2 hfss2
unfold f at hfss3
rw [hss0,add_comm _ ss,add_assoc] at hfss3
replace hfss3 := add_left_cancel hfss3
have hc1 : p ≤ k + 2 := by
calc
p ≤ ss^2 + p := Nat.le_add_left _ _
_ = _ := hfss3
_ = _ := by rw [←hksr]
have hc2: p ≤ p-1 := by
calc
_ ≤ _ := hc1
_ = (k+1) + 1 := by ring_nf
_ ≤ (p-2)+1 := by omega
_ = p - 1 := by omega
have : p = 0 := zero_of_le_sub_pos (by simp) hc2
omega
have hfk : 1 < f kk := by
unfold f
rw [hksr]
calc
_ < 1 + 1 := by decide
_ ≤ s^2 + s := by nlinarith only [hs]
_ ≤ s^2 + 2 * r *s + r^2 + s + r + p := by omega
_ = _ := by ring
exact key_lemma' (hfk) hP hN1
end Imo1987P6
| true | Copyright (c) 2025 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jia-Jun Ma
-/
import Mathlib
/-!
# International Mathematical Olympiad 1987, Problem 6
Let $n$ be an integer greater than or equal to 2. Prove that
if $k^2 + k + n$ is prime for all integers $k$ such that
$0 <= k <= \sqrt{n/3}$, then $k^2 + k + n$ is prime for all
integers $k$ such that $0 <= k <= n - 2$.
-/
namespace Imo1987P6
open Nat
lemma minFac_le_sq {n : ℕ} (hnezero : n ≠ 0) (hn : minFac n ≠ n) : (minFac n)^2 ≤ n := by
match n with
| 0 => contradiction
| 1 => simp
| n+2 =>
obtain ⟨r,hr⟩ := Nat.minFac_dvd (n+2)
match r with
| 0 => omega
| 1 => nth_rw 2 [hr] at hn; simp at hn
| r+2 =>
have hh : (r+2) ∣ (n+2) := ⟨minFac (n+2), (by nth_rw 1 [hr,mul_comm])⟩
have hr' : minFac (n+2) ≤ (r+2) := Nat.minFac_le_of_dvd (by omega) hh
calc
_ = (minFac (n+2)) * minFac (n+2) := by ring_nf
_ ≤ minFac (n+2) * (r+2) := Nat.mul_le_mul_left _ hr'
_ = _ := hr.symm
lemma prime_of_coprime' (n : ℕ) (h1 : 1 < n)
(h2 : ∀ m:ℕ, m^2 ≤ n → m ≠ 0 → n.Coprime m) : Nat.Prime n := by
rw [Nat.prime_def_minFac]
by_contra H; push_neg at H
replace H := H (by omega)
let m := minFac n
have nneone : n ≠ 1 := by omega
have mpos := Nat.minFac_pos n
replace h2 := h2 (m) (minFac_le_sq (by omega) H) (by omega)
apply Nat.Prime.not_coprime_iff_dvd.2 ?_ h2
use (minFac n)
simp [Nat.minFac_prime nneone,Nat.minFac_dvd,m]
lemma dyadic {k b : ℕ} (h1 : 1 ≤ k) (h2 : k ≤ b) : ∃ i, b < 2^i * k ∧ 2^i *k ≤ 2* b := by
have hbk : b/k ≠ 0 := by
apply (Nat.div_ne_zero_iff (a:=b) (b:=k)).2
omega
use Nat.log2 (b/k) + 1
constructor
· have h2bk: (b/k).log2 < (b/k).log2 + 1 := Nat.lt_succ_self _
replace h2bk := (Nat.log2_lt hbk).1 h2bk
replace h2bk := succ_le_of_lt h2bk
calc
_ < b/k * k + k := lt_div_mul_add (by omega)
_ = (b/k+1) *k := by ring
_ ≤ 2 ^((b/k).log2 +1) * k := Nat.mul_le_mul_right k h2bk
· have h2 : 2 ^((b/k).log2 +1) = 2 * 2^( (b/k).log2 ):=
by rw [pow_succ _ _,mul_comm]
rw [h2]
have h3 : 2^((b/k).log2) ≤ b/k := Nat.log2_self_le hbk
rw [mul_assoc]
apply Nat.mul_le_mul_left 2
exact (Nat.le_div_iff_mul_le h1).mp h3
lemma key_lemma {m b: ℕ}
(h: ∀ k, b < k → k ≤ 2*b → Coprime m k) :
∀ k, 1 < k → k ≤ 2 * b → Coprime m k := by
intro k hk1 hk2
by_cases hk0 : b < k
· exact h k hk0 hk2
· push_neg at hk0
obtain ⟨i, hi1, hi2⟩ := dyadic (le_of_lt hk1) hk0
exact Coprime.coprime_mul_left_right (h (2 ^ i * k) hi1 hi2)
lemma key_lemma' {m b: ℕ } (h1 : 1 < m)
(h: ∀ k, b < k → k ≤ 2*b → Coprime m k) (h2 : m < (2*b+1)^2) :
Nat.Prime m := by
replace h := key_lemma h
apply prime_of_coprime' m h1
intro k hk1 hk2
by_cases hk0 : k=1
· simp [hk0]
push_neg at hk0
refine h k ?_ ?_
· omega
· replace h2 := lt_of_le_of_lt hk1 h2
rw [pow_two,pow_two] at h2
replace h2 := Nat.mul_self_lt_mul_self_iff.1 h2
omega
lemma dvd_lemma (a b c : ℕ ) (h : c ≠ 0) : a ≤ b → b ∣ c → c < 2 * a → b = c := by
intro h1 ⟨k, hk⟩ h3
match k with
| 0 => simp at hk; exfalso; exact h hk
| 1 => simp [hk]
| k + 2 => omega
lemma zero_of_le_sub_pos {a b : ℕ} : b ≠ 0 → a ≤ a - b → a = 0 := by omega
lemma sub_le_lemma {a b : ℕ} : b ≤ a → b ≠ 0 → a - b < a := by omega
theorem imo1987_p6
(p : ℕ)
(h₁ : ∀ k : ℕ, k ≤ Nat.floor (Real.sqrt ((p:ℝ) / 3)) → Nat.Prime (k^2 + k + p)) :
∀ i ≤ p - 2, Nat.Prime (i^2 + i + p) := by
let f x := x^2 + x + p
let r := Nat.floor (Real.sqrt (p/3))
intro k
apply Nat.case_strong_induction_on k
· intro; exact h₁ 0 (Nat.zero_le _)
intro k IH hk
by_cases h : k+1 ≤ r
· exact h₁ (k+1) h
· push_neg at h
let kk := k+1
let s := kk - r
let N := f kk
have hksr : kk = s + r := Nat.eq_add_of_sub_eq (le_of_lt h) (by rfl)
/- Show that N < ... -/
have hs : 1 ≤ s := by
simp_rw [s, kk]
exact Nat.le_sub_of_add_le' h
have ieq3 : 3*r ≤ 6*r*s := by nlinarith only [hs]
have ieq4 : p ≤ 3*r^2 + 6*r + 2 := by
have ieq5: √ (p/3) < r+1 := Nat.lt_floor_add_one _
replace ieq5 := Real.lt_sq_of_sqrt_lt ieq5 |> (div_lt_iff₀ (by norm_num)).1
replace ieq5: (p) < (3*r^2 + 6*r +3) := cast_lt.1 <| by
have casteq: ((r:ℝ)+1)^2 * 3 = ((3*r^2+6*r+3:ℕ):ℝ) := by simp;ring_nf
rw [←casteq]
exact ieq5
omega
have hN0 : N = kk^2+kk+p := rfl
have hN1 : N < (2 * (s + r) +1)^2 := by
calc
_ = _:= hN0
_ ≤ 3*r^2 + 6*r + 2 + (r+s)*(r+s+1) := by nlinarith only [hN0, ieq4, hs, hksr]
_ = 4*r^2 + 2* r*s + s^2 + 7*r+s+2 := by ring_nf
_ < 4*r^2 +4*s^2 +8*r*s+4*r+4*s+1 := by omega
_ = _ := by ring
rw [←hksr] at hN1
have hP : ∀ i , kk < i → i ≤ 2*(kk) → Coprime N i := by
by_contra H
push_neg at H
obtain ⟨j, hj1,hj2,hj3⟩ := H
have hj1' : s+r +1 ≤ j := by rw [←hksr]; apply succ_le_of_lt hj1
let ss := j-(s+r+1)
have hss0 : j = ss + (s+r+1) := Nat.eq_add_of_sub_eq hj1' (by rfl)
have hp: 2 ≤ p := Nat.lt_of_sub_ne_zero (by omega: p-2 ≠ 0) |> le_of_lt
have hss1 : ss ≤ k := by
apply Nat.le_of_add_le_add_right (b :=s+r+1)
rw [←hss0,←hksr]
calc
_ ≤ _ := hj2
_ = _ := by omega
replace hss1 : Nat.Prime (f ss) := IH ss hss1 (by omega)
have hfss: N = f ss + (2*kk - j+1) *j := by
unfold f
rw [hN0]
zify
rw [Int.natCast_sub hj2,hss0,←hksr]
push_cast
ring_nf
change ¬N.gcd j = 1 at hj3
rw [hfss, ←Nat.coprime_iff_gcd_eq_one, Nat.coprime_add_mul_right_left] at hj3
have hss2 : f ss ∣ j := Nat.Prime.dvd_iff_not_coprime hss1 |>.2 hj3
have hfss1: p ≤ f ss := Nat.le_add_left p (ss ^ 2 + ss)
have hp1 : p - 2 < p := sub_le_lemma hp (by omega)
have hfss2: j < 2*p := by omega
have hj : j ≠ 0 := by omega
have hfss3: f ss = j := dvd_lemma _ _ _ hj hfss1 hss2 hfss2
unfold f at hfss3
rw [hss0,add_comm _ ss,add_assoc] at hfss3
replace hfss3 := add_left_cancel hfss3
have hc1 : p ≤ k + 2 := by
calc
p ≤ ss^2 + p := Nat.le_add_left _ _
_ = _ := hfss3
_ = _ := by rw [←hksr]
have hc2: p ≤ p-1 := by
calc
_ ≤ _ := hc1
_ = (k+1) + 1 := by ring_nf
_ ≤ (p-2)+1 := by omega
_ = p - 1 := by omega
have : p = 0 := zero_of_le_sub_pos (by simp) hc2
omega
have hfk : 1 < f kk := by
unfold f
rw [hksr]
calc
_ < 1 + 1 := by decide
_ ≤ s^2 + s := by nlinarith only [hs]
_ ≤ s^2 + 2 * r *s + r^2 + s + r + p := by omega
_ = _ := by ring
exact key_lemma' (hfk) hP hN1
end Imo1987P6 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1987P6.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "Missing cases:\n(succ _), _", "unsolved goals\nn\u271d n : \u2115\nhnezero : n + 2 \u2260 0\nhn : (n + 2).minFac \u2260 n + 2\nr : \u2115\nhr : n + 2 = (n + 2).minFac * 0\n\u22a2 (n + 2).minFac ^ 2 \u2264 n + 2", "unknown tactic", "unsolved goals\nn : \u2115\nh1 : 1 < n\nh2 : \u2200 (m : \u2115), m ^ 2 \u2264 n \u2192 m \u2260 0 \u2192 n.Coprime m\nH : 2 \u2264 n \u2192 n.minFac \u2260 n\n\u22a2 2 \u2264 n", "unsolved goals\nn : \u2115\nh1 : 1 < n\nh2 : \u2200 (m : \u2115), m ^ 2 \u2264 n \u2192 m \u2260 0 \u2192 n.Coprime m\nH : n.minFac \u2260 n\n\u22a2 False", "unknown tactic", "unsolved goals\nk b : \u2115\nh1 : 1 \u2264 k\nh2 : k \u2264 b\n\u22a2 k \u2260 0 \u2227 k \u2264 b", "unsolved goals\nk b : \u2115\nh1 : 1 \u2264 k\nh2 : k \u2264 b\nhbk : b / k \u2260 0\n\u22a2 \u2203 i, b < 2 ^ i * k \u2227 2 ^ i * k \u2264 2 * b", "unknown tactic", "unsolved goals\ncase neg.refine_1\nm b : \u2115\nh1 : 1 < m\nh2 : m < (2 * b + 1) ^ 2\nh : \u2200 (k : \u2115), 1 < k \u2192 k \u2264 2 * b \u2192 m.Coprime k\nk : \u2115\nhk1 : k ^ 2 \u2264 m\nhk2 : k \u2260 0\nhk0 : k \u2260 1\n\u22a2 1 < k", "unsolved goals\ncase neg.refine_2\nm b : \u2115\nh1 : 1 < m\nh2 : m < (2 * b + 1) ^ 2\nh : \u2200 (k : \u2115), 1 < k \u2192 k \u2264 2 * b \u2192 m.Coprime k\nk : \u2115\nhk1 : k ^ 2 \u2264 m\nhk2 : k \u2260 0\nhk0 : k \u2260 1\n\u22a2 k \u2264 2 * b", "unknown tactic", "unsolved goals\na b c : \u2115\nh : c \u2260 0\nh1 : a \u2264 b\nk\u271d : \u2115\nh3 : c < 2 * a\nk : \u2115\nhk : c = b * (k + 2)\n\u22a2 b = c", "unknown tactic", "unsolved goals\na b : \u2115\n\u22a2 b \u2260 0 \u2192 a \u2264 a - b \u2192 a = 0", "unknown tactic", "unsolved goals\na b : \u2115\n\u22a2 b \u2264 a \u2192 b \u2260 0 \u2192 a - b < a", "unknown tactic", "unsolved goals\np : \u2115\nh\u2081 : \u2200 k \u2264 \u230a\u221a(\u2191p / 3)\u230b\u208a, Nat.Prime (k ^ 2 + k + p)\nf : \u2115 \u2192 \u2115 := fun x => x ^ 2 + x + p\nr : \u2115 := \u230a\u221a(\u2191p / 3)\u230b\u208a\nk\u271d k : \u2115\nIH : \u2200 m \u2264 k, m \u2264 p - 2 \u2192 Nat.Prime (m ^ 2 + m + p)\nhk : k + 1 \u2264 p - 2\nh : r < k + 1\nkk : \u2115 := k + 1\ns : \u2115 := kk - r\nN : \u2115 := f kk\nhksr : kk = s + r\nhs : 1 \u2264 s\nieq3 : 3 * r \u2264 6 * r * s\nieq5 : p < 3 * r ^ 2 + 6 * r + 3\n\u22a2 p \u2264 3 * r ^ 2 + 6 * r + 2", "unsolved goals\ncase neg\np : \u2115\nh\u2081 : \u2200 k \u2264 \u230a\u221a(\u2191p / 3)\u230b\u208a, Nat.Prime (k ^ 2 + k + p)\nf : \u2115 \u2192 \u2115 := fun x => x ^ 2 + x + p\nr : \u2115 := \u230a\u221a(\u2191p / 3)\u230b\u208a\nk\u271d k : \u2115\nIH : \u2200 m \u2264 k, m \u2264 p - 2 \u2192 Nat.Prime (m ^ 2 + m + p)\nhk : k + 1 \u2264 p - 2\nh : r < k + 1\nkk : \u2115 := k + 1\ns : \u2115 := kk - r\nN : \u2115 := f kk\nhksr : kk = s + r\nhs : 1 \u2264 s\nieq3 : 3 * r \u2264 6 * r * s\nieq4 : p \u2264 3 * r ^ 2 + 6 * r + 2\n\u22a2 Nat.Prime ((k + 1) ^ 2 + (k + 1) + p)"], "timeout_s": 600.0, "latency_s": 0.8114, "verified_at": "2026-03-26T18:17:13.250677+00:00"}} | false | true | false | 0.8114 |
compfiles_Imo1988P3 | compfiles | Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Goedel-Prover-V2
-/
import Mathlib
/-!
# International Mathematical Olympiad 1988, Problem 3
A function $f$ defined on the positive integers (and taking positive integers values) is given by:
f(1) = 1
f(3) = 3
f(2 \cdot n) = f(n)
f(4 \cdot n + 1) = 2 \cdot f(2 \cdot n + 1) - f(n)
f(4 \cdot n + 3) = 3 \cdot f(2 \cdot n + 1) - 2 \cdot f(n)
for all positive integers $n.$
Determine with proof the number of positive integers $\leq 1988$ for which $f(n) = n.$
-/
namespace Imo1988P3
abbrev solution : ℕ := 92
theorem imo1988_p3 (f : ℕ+ → ℕ+)
(h₀ : f 1 = 1)
(h₁ : f 3 = 3)
(h₂ : ∀ n, f (2 * n) = f n)
(h₃ : ∀ n, f (4 * n + 1) + f n = 2 * f (2 * n + 1))
(h₄ : ∀ n, f (4 * n + 3) + 2 * f n = 3 * f (2 * n + 1)) :
Set.ncard {n | n ≤ 1988 ∧ f n = n} = solution := by
sorry
end Imo1988P3 | /- | /-
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: InternLM-MATH LEAN Formalizer v0.1, Goedel-Prover-V2
-/
import Mathlib
/-!
# International Mathematical Olympiad 1988, Problem 3
A function $f$ defined on the positive integers (and taking positive integers values) is given by:
f(1) = 1
f(3) = 3
f(2 \cdot n) = f(n)
f(4 \cdot n + 1) = 2 \cdot f(2 \cdot n + 1) - f(n)
f(4 \cdot n + 3) = 3 \cdot f(2 \cdot n + 1) - 2 \cdot f(n)
for all positive integers $n.$
Determine with proof the number of positive integers $\leq 1988$ for which $f(n) = n.$
-/
namespace Imo1988P3
abbrev solution : ℕ := 92
theorem imo1988_p3 (f : ℕ+ → ℕ+)
(h₀ : f 1 = 1)
(h₁ : f 3 = 3)
(h₂ : ∀ n, f (2 * n) = f n)
(h₃ : ∀ n, f (4 * n + 1) + f n = 2 * f (2 * n + 1))
(h₄ : ∀ n, f (4 * n + 3) + 2 * f n = 3 * f (2 * n + 1)) :
Set.ncard {n | n ≤ 1988 ∧ f n = n} = solution := by
sorry
end Imo1988P3
| false | null | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1988P3.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": true, "errors": [], "timeout_s": 600.0, "latency_s": 0.0558, "verified_at": "2026-03-26T18:17:12.495340+00:00"}} | false | true | true | 0.0558 |
compfiles_Imo1988P6 | compfiles | Copyright (c) 2019 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin
-/
import Mathlib
/-!
# International Mathematical Olympiad 1988, Problem 6
If a and b are two natural numbers such that a*b+1 divides a^2 + b^2,
show that their quotient is a perfect square.
-/
namespace Imo1988P6
/-
Question 6 of IMO1988 is somewhat (in)famous. Several expert problem solvers
could not tackle the question within the given time limit.
The problem lead to the introduction of a new proof technique,
so called “Vieta jumping”.
In this file we formalise constant descent Vieta jumping,
and apply this to prove P6 of IMO1988.
To illustrate the technique, we also prove a similar result.
-/
/-- Constant descent Vieta jumping.
This proof technique allows one to prove an arbitrary proposition `claim`,
by running a descent argument on a hyperbola `H` in the first quadrant of the plane,
under the following conditions:
* `h₀` : There exists an integral point `(x,y)` on the hyperbola `H`.
* `H_symm` : The hyperbola has a symmetry along the diagonal in the plane.
* `H_zero` : If an integral point `(x,0)` lies on the hyperbola `H`, then `claim` is true.
* `H_diag` : If an integral point `(x,x)` lies on the hyperbola `H`, then `claim` is true.
* `H_desc` : If `(x,y)` is an integral point on the hyperbola `H`,
with `x < y` then there exists a “smaller” point on `H`: a point `(x',y')` with `x' < y' ≤ x`.
For reasons of usability, the hyperbola `H` is implemented as an arbitrary predicate.
(In question 6 of IMO1988, where this proof technique was first developped,
the predicate `claim` would be `∃ (d : ℕ), d ^ 2 = k` for some natural number `k`,
and the predicate `H` would be `fun a b ↦ a * a + b * b = (a * b + 1) * k`.)
To ensure that the predicate `H` actually describes a hyperbola,
the user must provide arguments `B` and `C` that are used as coefficients for a quadratic equation.
Finally, `H_quad` is the proof obligation that the quadratic equation
`(y:ℤ) * y - B x * y + C x = 0`
describes the same hyperbola as the predicate `H`.
For extra flexibility, one must provide a predicate `base` on the integral points in the plane.
In the descent step `H_desc` this will give the user the additional assumption that
the point `(x,y)` does not lie in this base locus.
The user must provide a proof that the proposition `claim` is true
if there exists an integral point `(x,y)` on the hyperbola `H` that lies in the base locus.
If such a base locus is not necessary, once can simply let it be `fun x y ↦ False`.
-/
theorem constant_descent_vieta_jumping (x y : ℕ) {claim : Prop} {H : ℕ → ℕ → Prop} (h₀ : H x y)
(B : ℕ → ℤ) (C : ℕ → ℤ) (base : ℕ → ℕ → Prop)
(H_quad : ∀ {x y}, H x y ↔ (y : ℤ) * y - B x * y + C x = 0) (H_symm : ∀ {x y}, H x y ↔ H y x)
(H_zero : ∀ {x}, H x 0 → claim) (H_diag : ∀ {x}, H x x → claim)
(H_desc : ∀ {x y}, 0 < x → x < y → ¬base x y → H x y →
∀ y', y' * y' - B x * y' + C x = 0 → y' = B x - y → y' * y = C x → 0 ≤ y' ∧ y' ≤ x)
(H_base : ∀ {x y}, H x y → base x y → claim) : claim := by
-- First of all, we may assume that x ≤ y.
-- We justify this using H_symm.
wlog hxy : x ≤ y
· rw [H_symm] at h₀; apply this y x h₀ B C base _ _ _ _ _ _ (le_of_not_ge hxy); assumption'
-- In fact, we can easily deal with the case x = y.
by_cases x_eq_y : x = y
· subst x_eq_y; exact H_diag h₀
-- Hence we may assume that x < y.
replace hxy : x < y := lt_of_le_of_ne hxy x_eq_y
clear x_eq_y
-- Consider the upper branch of the hyperbola defined by H.
let upper_branch : Set (ℕ × ℕ) := {p | H p.1 p.2 ∧ p.1 < p.2}
-- Note that the point p = (x,y) lies on the upper branch.
let p : ℕ × ℕ := ⟨x, y⟩
have hp : p ∈ upper_branch := ⟨h₀, hxy⟩
-- We also consider the exceptional set of solutions (a,b) that satisfy
-- a = 0 or a = b or B a = b or B a = b + a or that lie in the base locus.
let exceptional : Set (ℕ × ℕ) :=
{p | H p.1 p.2 ∧ (base p.1 p.2 ∨ p.1 = 0 ∨ p.1 = p.2 ∨ B p.1 = p.2 ∨ B p.1 = p.2 + p.1)}
-- Let S be the projection of the upper branch on to the y-axis
-- after removing the exceptional locus.
let S : Set ℕ := Prod.snd '' (upper_branch \ exceptional)
-- The strategy is to show that the exceptional locus in nonempty
-- by running a descent argument that starts with the given point p = (x,y).
-- Our assumptions ensure that we can then prove the claim.
suffices exc : exceptional.Nonempty by
-- Suppose that there exists an element in the exceptional locus.
simp only [Set.Nonempty, Prod.exists, Set.mem_setOf_eq, exceptional] at exc
-- Let (a,b) be such an element, and consider all the possible cases.
rcases exc with ⟨a, b, hH, hb⟩
rcases hb with (_ | rfl | rfl | hB | hB)
-- The first three cases are rather easy to solve.
· solve_by_elim
· rw [H_symm] at hH; solve_by_elim
· solve_by_elim
-- The final two cases are very similar.
all_goals
-- Consider the quadratic equation that (a,b) satisfies.
rw [H_quad] at hH
-- We find the other root of the equation, and Vieta's formulas.
rcases vieta_formula_quadratic hH with ⟨c, h_root, hV₁, hV₂⟩
-- By substitutions we find that b = 0 or b = a.
simp only [hB, add_eq_left, add_right_inj] at hV₁
subst hV₁
rw [← Int.ofNat_zero] at *
rw [← H_quad] at h_root
-- And hence we are done by H_zero and H_diag.
solve_by_elim
-- To finish the main proof, we need to show that the exceptional locus is nonempty.
-- So we assume that the exceptional locus is empty, and work towards deriving a contradiction.
rw [Set.nonempty_iff_ne_empty]
intro exceptional_empty
-- Observe that S is nonempty.
have S_nonempty : S.Nonempty := by
-- It contains the image of p.
use p.2
apply Set.mem_image_of_mem
-- After all, we assumed that the exceptional locus is empty.
rwa [exceptional_empty, Set.diff_empty]
-- We are now set for an infinite descent argument.
-- Let m be the smallest element of the nonempty set S.
let m : ℕ := WellFounded.min Nat.lt_wfRel.wf S S_nonempty
have m_mem : m ∈ S := WellFounded.min_mem Nat.lt_wfRel.wf S S_nonempty
have m_min : ∀ k ∈ S, ¬k < m := fun k hk => WellFounded.not_lt_min Nat.lt_wfRel.wf S hk
-- It suffices to show that there is point (a,b) with b ∈ S and b < m.
rsuffices ⟨p', p'_mem, p'_small⟩ : ∃ p' : ℕ × ℕ, p'.2 ∈ S ∧ p'.2 < m
· solve_by_elim
-- Let (m_x, m_y) be a point on the upper branch that projects to m ∈ S
-- and that does not lie in the exceptional locus.
rcases m_mem with ⟨⟨mx, my⟩, ⟨⟨hHm, mx_lt_my⟩, h_base⟩, m_eq⟩
-- This means that m_y = m,
-- and the conditions H(m_x, m_y) and m_x < m_y are satisfied.
simp only at mx_lt_my hHm m_eq
simp only [exceptional, hHm, Set.mem_setOf_eq, true_and] at h_base
push_neg at h_base
-- Finally, it also means that (m_x, m_y) does not lie in the base locus,
-- that m_x ≠ 0, m_x ≠ m_y, B(m_x) ≠ m_y, and B(m_x) ≠ m_x + m_y.
rcases h_base with ⟨h_base, hmx, hm_diag, hm_B₁, hm_B₂⟩
replace hmx : 0 < mx := pos_iff_ne_zero.mpr hmx
-- Consider the quadratic equation that (m_x, m_y) satisfies.
have h_quad := hHm
rw [H_quad] at h_quad
-- We find the other root of the equation, and Vieta's formulas.
rcases vieta_formula_quadratic h_quad with ⟨c, h_root, hV₁, hV₂⟩
-- Now we rewrite Vietas formulas a bit, and apply the descent step.
replace hV₁ : c = B mx - my := eq_sub_of_add_eq' hV₁
rw [mul_comm] at hV₂
have Hc := H_desc hmx mx_lt_my h_base hHm c h_root hV₁ hV₂
-- This means that we may assume that c ≥ 0 and c ≤ m_x.
obtain ⟨c_nonneg, c_lt⟩ := Hc
-- In other words, c is a natural number.
lift c to ℕ using c_nonneg
-- Recall that we are trying find a point (a,b) such that b ∈ S and b < m.
-- We claim that p' = (c, m_x) does the job.
let p' : ℕ × ℕ := ⟨c, mx⟩
use p'
-- The second condition is rather easy to check, so we do that first.
constructor; swap
· rwa [m_eq] at mx_lt_my
-- Now we need to show that p' projects onto S. In other words, that c ∈ S.
-- We do that, by showing that it lies in the upper branch
-- (which is sufficient, because we assumed that the exceptional locus is empty).
apply Set.mem_image_of_mem
rw [exceptional_empty, Set.diff_empty]
-- Now we are ready to prove that p' = (c, m_x) lies on the upper branch.
-- We need to check two conditions: H(c, m_x) and c < m_x.
constructor <;> dsimp only
· -- The first condition is not so hard. After all, c is the other root of the quadratic equation.
rw [H_symm, H_quad]
simpa using h_root
· -- For the second condition, we note that it suffices to check that c ≠ m_x.
omega
theorem imo1988_p6 {a b : ℕ} (h : a * b + 1 ∣ a ^ 2 + b ^ 2) :
∃ d, d ^ 2 = (a ^ 2 + b ^ 2) / (a * b + 1) := by
rcases h with ⟨k, hk⟩
rw [hk, Nat.mul_div_cancel_left _ (Nat.succ_pos (a * b))]
simp only [sq] at hk
apply constant_descent_vieta_jumping a b (H := fun a b => a * a + b * b = (a * b + 1) * k)
hk (fun x => k * x) (fun x => x * x - k) fun _ _ => False <;>
clear hk a b
· -- We will now show that the fibers of the solution set are described by a quadratic equation.
omega
· -- Show that the solution set is symmetric in a and b.
intro x y
simp [add_comm (x * x), mul_comm x]
· -- Show that the claim is true if b = 0.
suffices ∀ a, a * a = k → ∃ d, d * d = k by simpa [sq]
rintro x rfl; use x
· -- Show that the claim is true if a = b.
intro x hx
suffices k ≤ 1 by
rw [Nat.le_add_one_iff, Nat.le_zero] at this
rcases this with (rfl | rfl)
· use 0; simp
· use 1; simp
contrapose! hx with k_lt_one
apply ne_of_lt
calc
x * x + x * x = x * x * 2 := by rw [mul_two]
_ ≤ x * x * k := (Nat.mul_le_mul_left (x * x) k_lt_one)
_ < (x * x + 1) * k := by linarith
· -- Show the descent step.
intro x y hx x_lt_y _ _ z h_root _ hV₀
constructor
· have hpos : z * z + x * x > 0 := by
apply add_pos_of_nonneg_of_pos
· apply mul_self_nonneg
· positivity
have hzx : z * z + x * x = (z * x + 1) * k := by
rw [← sub_eq_zero, ← h_root]
ring
rw [hzx] at hpos
replace hpos : z * x + 1 > 0 := pos_of_mul_pos_left hpos (Int.natCast_nonneg k)
replace hpos : z * x ≥ 0 := Int.le_of_lt_add_one hpos
apply nonneg_of_mul_nonneg_left hpos (mod_cast hx)
· contrapose! hV₀ with x_lt_z
apply ne_of_gt
calc
z * y > x * x := by apply mul_lt_mul' <;> omega
_ ≥ x * x - k := sub_le_self _ (Int.natCast_nonneg k)
· -- There is no base case in this application of Vieta jumping.
simp
/-
The following example illustrates the use of constant descent Vieta jumping
in the presence of a non-trivial base case.
-/
example {a b : ℕ} (h : a * b ∣ a ^ 2 + b ^ 2 + 1) : 3 * a * b = a ^ 2 + b ^ 2 + 1 := by
rcases h with ⟨k, hk⟩
suffices k = 3 by simp_all; ring
simp only [sq] at hk
apply constant_descent_vieta_jumping a b (H := fun a b => a * a + b * b + 1 = a * b * k)
hk (fun x => k * x) (fun x => x * x + 1) fun x _ => x ≤ 1 <;>
clear hk a b
· omega
· -- Show that the solution set is symmetric in a and b.
intro x y; ring_nf -- Porting note: Originally, `cc` solved the entire goal
· -- Show that the claim is true if b = 0.
simp
· -- Show that the claim is true if a = b.
intro x hx
have x_sq_dvd : x * x ∣ x * x * k := dvd_mul_right (x * x) k
rw [← hx] at x_sq_dvd
obtain ⟨y, hy⟩ : x * x ∣ 1 := by simpa only [Nat.dvd_add_self_left, add_assoc] using x_sq_dvd
obtain ⟨rfl, rfl⟩ : x = 1 ∧ y = 1 := by simpa [mul_eq_one] using hy.symm
simpa using hx.symm
· -- Show the descent step.
intro x y _ hx h_base _ z _ _ hV₀
constructor
· have zy_pos : z * y ≥ 0 := by rw [hV₀]; exact mod_cast Nat.zero_le _
apply nonneg_of_mul_nonneg_left zy_pos
omega
· contrapose! hV₀ with x_lt_z
apply ne_of_gt
push_neg at h_base
calc
z * y > x * y := by apply mul_lt_mul_of_pos_right <;> omega
_ ≥ x * (x + 1) := by apply mul_le_mul <;> omega
_ > x * x + 1 := by
rw [mul_add, mul_one]
apply add_lt_add_right
assumption_mod_cast
· -- Show the base case.
intro x y h h_base
obtain rfl | rfl : x = 0 ∨ x = 1 := by rwa [Nat.le_add_one_iff, Nat.le_zero] at h_base
· simp at h
· rw [mul_one, one_mul, add_right_comm] at h
have y_dvd : y ∣ y * k := dvd_mul_right y k
rw [← h, Nat.dvd_add_left (dvd_mul_left y y)] at y_dvd
obtain rfl | rfl := (Nat.dvd_prime Nat.prime_two).mp y_dvd <;> apply mul_left_cancel₀
exacts [one_ne_zero, h.symm, two_ne_zero, h.symm]
end Imo1988P6 | /- | /-
Copyright (c) 2019 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin
-/
import Mathlib
/-!
# International Mathematical Olympiad 1988, Problem 6
If a and b are two natural numbers such that a*b+1 divides a^2 + b^2,
show that their quotient is a perfect square.
-/
namespace Imo1988P6
/-
Question 6 of IMO1988 is somewhat (in)famous. Several expert problem solvers
could not tackle the question within the given time limit.
The problem lead to the introduction of a new proof technique,
so called “Vieta jumping”.
In this file we formalise constant descent Vieta jumping,
and apply this to prove P6 of IMO1988.
To illustrate the technique, we also prove a similar result.
-/
/-- Constant descent Vieta jumping.
This proof technique allows one to prove an arbitrary proposition `claim`,
by running a descent argument on a hyperbola `H` in the first quadrant of the plane,
under the following conditions:
* `h₀` : There exists an integral point `(x,y)` on the hyperbola `H`.
* `H_symm` : The hyperbola has a symmetry along the diagonal in the plane.
* `H_zero` : If an integral point `(x,0)` lies on the hyperbola `H`, then `claim` is true.
* `H_diag` : If an integral point `(x,x)` lies on the hyperbola `H`, then `claim` is true.
* `H_desc` : If `(x,y)` is an integral point on the hyperbola `H`,
with `x < y` then there exists a “smaller” point on `H`: a point `(x',y')` with `x' < y' ≤ x`.
For reasons of usability, the hyperbola `H` is implemented as an arbitrary predicate.
(In question 6 of IMO1988, where this proof technique was first developped,
the predicate `claim` would be `∃ (d : ℕ), d ^ 2 = k` for some natural number `k`,
and the predicate `H` would be `fun a b ↦ a * a + b * b = (a * b + 1) * k`.)
To ensure that the predicate `H` actually describes a hyperbola,
the user must provide arguments `B` and `C` that are used as coefficients for a quadratic equation.
Finally, `H_quad` is the proof obligation that the quadratic equation
`(y:ℤ) * y - B x * y + C x = 0`
describes the same hyperbola as the predicate `H`.
For extra flexibility, one must provide a predicate `base` on the integral points in the plane.
In the descent step `H_desc` this will give the user the additional assumption that
the point `(x,y)` does not lie in this base locus.
The user must provide a proof that the proposition `claim` is true
if there exists an integral point `(x,y)` on the hyperbola `H` that lies in the base locus.
If such a base locus is not necessary, once can simply let it be `fun x y ↦ False`.
-/
theorem constant_descent_vieta_jumping (x y : ℕ) {claim : Prop} {H : ℕ → ℕ → Prop} (h₀ : H x y)
(B : ℕ → ℤ) (C : ℕ → ℤ) (base : ℕ → ℕ → Prop)
(H_quad : ∀ {x y}, H x y ↔ (y : ℤ) * y - B x * y + C x = 0) (H_symm : ∀ {x y}, H x y ↔ H y x)
(H_zero : ∀ {x}, H x 0 → claim) (H_diag : ∀ {x}, H x x → claim)
(H_desc : ∀ {x y}, 0 < x → x < y → ¬base x y → H x y →
∀ y', y' * y' - B x * y' + C x = 0 → y' = B x - y → y' * y = C x → 0 ≤ y' ∧ y' ≤ x)
(H_base : ∀ {x y}, H x y → base x y → claim) : claim := by
-- First of all, we may assume that x ≤ y.
-- We justify this using H_symm.
wlog hxy : x ≤ y
· rw [H_symm] at h₀; apply this y x h₀ B C base _ _ _ _ _ _ (le_of_not_ge hxy); assumption'
-- In fact, we can easily deal with the case x = y.
by_cases x_eq_y : x = y
· subst x_eq_y; exact H_diag h₀
-- Hence we may assume that x < y.
replace hxy : x < y := lt_of_le_of_ne hxy x_eq_y
clear x_eq_y
-- Consider the upper branch of the hyperbola defined by H.
let upper_branch : Set (ℕ × ℕ) := {p | H p.1 p.2 ∧ p.1 < p.2}
-- Note that the point p = (x,y) lies on the upper branch.
let p : ℕ × ℕ := ⟨x, y⟩
have hp : p ∈ upper_branch := ⟨h₀, hxy⟩
-- We also consider the exceptional set of solutions (a,b) that satisfy
-- a = 0 or a = b or B a = b or B a = b + a or that lie in the base locus.
let exceptional : Set (ℕ × ℕ) :=
{p | H p.1 p.2 ∧ (base p.1 p.2 ∨ p.1 = 0 ∨ p.1 = p.2 ∨ B p.1 = p.2 ∨ B p.1 = p.2 + p.1)}
-- Let S be the projection of the upper branch on to the y-axis
-- after removing the exceptional locus.
let S : Set ℕ := Prod.snd '' (upper_branch \ exceptional)
-- The strategy is to show that the exceptional locus in nonempty
-- by running a descent argument that starts with the given point p = (x,y).
-- Our assumptions ensure that we can then prove the claim.
suffices exc : exceptional.Nonempty by
-- Suppose that there exists an element in the exceptional locus.
simp only [Set.Nonempty, Prod.exists, Set.mem_setOf_eq, exceptional] at exc
-- Let (a,b) be such an element, and consider all the possible cases.
rcases exc with ⟨a, b, hH, hb⟩
rcases hb with (_ | rfl | rfl | hB | hB)
-- The first three cases are rather easy to solve.
· solve_by_elim
· rw [H_symm] at hH; solve_by_elim
· solve_by_elim
-- The final two cases are very similar.
all_goals
-- Consider the quadratic equation that (a,b) satisfies.
rw [H_quad] at hH
-- We find the other root of the equation, and Vieta's formulas.
rcases vieta_formula_quadratic hH with ⟨c, h_root, hV₁, hV₂⟩
-- By substitutions we find that b = 0 or b = a.
simp only [hB, add_eq_left, add_right_inj] at hV₁
subst hV₁
rw [← Int.ofNat_zero] at *
rw [← H_quad] at h_root
-- And hence we are done by H_zero and H_diag.
solve_by_elim
-- To finish the main proof, we need to show that the exceptional locus is nonempty.
-- So we assume that the exceptional locus is empty, and work towards deriving a contradiction.
rw [Set.nonempty_iff_ne_empty]
intro exceptional_empty
-- Observe that S is nonempty.
have S_nonempty : S.Nonempty := by
-- It contains the image of p.
use p.2
apply Set.mem_image_of_mem
-- After all, we assumed that the exceptional locus is empty.
rwa [exceptional_empty, Set.diff_empty]
-- We are now set for an infinite descent argument.
-- Let m be the smallest element of the nonempty set S.
let m : ℕ := WellFounded.min Nat.lt_wfRel.wf S S_nonempty
have m_mem : m ∈ S := WellFounded.min_mem Nat.lt_wfRel.wf S S_nonempty
have m_min : ∀ k ∈ S, ¬k < m := fun k hk => WellFounded.not_lt_min Nat.lt_wfRel.wf S hk
-- It suffices to show that there is point (a,b) with b ∈ S and b < m.
rsuffices ⟨p', p'_mem, p'_small⟩ : ∃ p' : ℕ × ℕ, p'.2 ∈ S ∧ p'.2 < m
· solve_by_elim
-- Let (m_x, m_y) be a point on the upper branch that projects to m ∈ S
-- and that does not lie in the exceptional locus.
rcases m_mem with ⟨⟨mx, my⟩, ⟨⟨hHm, mx_lt_my⟩, h_base⟩, m_eq⟩
-- This means that m_y = m,
-- and the conditions H(m_x, m_y) and m_x < m_y are satisfied.
simp only at mx_lt_my hHm m_eq
simp only [exceptional, hHm, Set.mem_setOf_eq, true_and] at h_base
push_neg at h_base
-- Finally, it also means that (m_x, m_y) does not lie in the base locus,
-- that m_x ≠ 0, m_x ≠ m_y, B(m_x) ≠ m_y, and B(m_x) ≠ m_x + m_y.
rcases h_base with ⟨h_base, hmx, hm_diag, hm_B₁, hm_B₂⟩
replace hmx : 0 < mx := pos_iff_ne_zero.mpr hmx
-- Consider the quadratic equation that (m_x, m_y) satisfies.
have h_quad := hHm
rw [H_quad] at h_quad
-- We find the other root of the equation, and Vieta's formulas.
rcases vieta_formula_quadratic h_quad with ⟨c, h_root, hV₁, hV₂⟩
-- Now we rewrite Vietas formulas a bit, and apply the descent step.
replace hV₁ : c = B mx - my := eq_sub_of_add_eq' hV₁
rw [mul_comm] at hV₂
have Hc := H_desc hmx mx_lt_my h_base hHm c h_root hV₁ hV₂
-- This means that we may assume that c ≥ 0 and c ≤ m_x.
obtain ⟨c_nonneg, c_lt⟩ := Hc
-- In other words, c is a natural number.
lift c to ℕ using c_nonneg
-- Recall that we are trying find a point (a,b) such that b ∈ S and b < m.
-- We claim that p' = (c, m_x) does the job.
let p' : ℕ × ℕ := ⟨c, mx⟩
use p'
-- The second condition is rather easy to check, so we do that first.
constructor; swap
· rwa [m_eq] at mx_lt_my
-- Now we need to show that p' projects onto S. In other words, that c ∈ S.
-- We do that, by showing that it lies in the upper branch
-- (which is sufficient, because we assumed that the exceptional locus is empty).
apply Set.mem_image_of_mem
rw [exceptional_empty, Set.diff_empty]
-- Now we are ready to prove that p' = (c, m_x) lies on the upper branch.
-- We need to check two conditions: H(c, m_x) and c < m_x.
constructor <;> dsimp only
· -- The first condition is not so hard. After all, c is the other root of the quadratic equation.
rw [H_symm, H_quad]
simpa using h_root
· -- For the second condition, we note that it suffices to check that c ≠ m_x.
omega
theorem imo1988_p6 {a b : ℕ} (h : a * b + 1 ∣ a ^ 2 + b ^ 2) :
∃ d, d ^ 2 = (a ^ 2 + b ^ 2) / (a * b + 1) := by
rcases h with ⟨k, hk⟩
rw [hk, Nat.mul_div_cancel_left _ (Nat.succ_pos (a * b))]
simp only [sq] at hk
apply constant_descent_vieta_jumping a b (H := fun a b => a * a + b * b = (a * b + 1) * k)
hk (fun x => k * x) (fun x => x * x - k) fun _ _ => False <;>
clear hk a b
· -- We will now show that the fibers of the solution set are described by a quadratic equation.
omega
· -- Show that the solution set is symmetric in a and b.
intro x y
simp [add_comm (x * x), mul_comm x]
· -- Show that the claim is true if b = 0.
suffices ∀ a, a * a = k → ∃ d, d * d = k by simpa [sq]
rintro x rfl; use x
· -- Show that the claim is true if a = b.
intro x hx
suffices k ≤ 1 by
rw [Nat.le_add_one_iff, Nat.le_zero] at this
rcases this with (rfl | rfl)
· use 0; simp
· use 1; simp
contrapose! hx with k_lt_one
apply ne_of_lt
calc
x * x + x * x = x * x * 2 := by rw [mul_two]
_ ≤ x * x * k := (Nat.mul_le_mul_left (x * x) k_lt_one)
_ < (x * x + 1) * k := by linarith
· -- Show the descent step.
intro x y hx x_lt_y _ _ z h_root _ hV₀
constructor
· have hpos : z * z + x * x > 0 := by
apply add_pos_of_nonneg_of_pos
· apply mul_self_nonneg
· positivity
have hzx : z * z + x * x = (z * x + 1) * k := by
rw [← sub_eq_zero, ← h_root]
ring
rw [hzx] at hpos
replace hpos : z * x + 1 > 0 := pos_of_mul_pos_left hpos (Int.natCast_nonneg k)
replace hpos : z * x ≥ 0 := Int.le_of_lt_add_one hpos
apply nonneg_of_mul_nonneg_left hpos (mod_cast hx)
· contrapose! hV₀ with x_lt_z
apply ne_of_gt
calc
z * y > x * x := by apply mul_lt_mul' <;> omega
_ ≥ x * x - k := sub_le_self _ (Int.natCast_nonneg k)
· -- There is no base case in this application of Vieta jumping.
simp
/-
The following example illustrates the use of constant descent Vieta jumping
in the presence of a non-trivial base case.
-/
example {a b : ℕ} (h : a * b ∣ a ^ 2 + b ^ 2 + 1) : 3 * a * b = a ^ 2 + b ^ 2 + 1 := by
rcases h with ⟨k, hk⟩
suffices k = 3 by simp_all; ring
simp only [sq] at hk
apply constant_descent_vieta_jumping a b (H := fun a b => a * a + b * b + 1 = a * b * k)
hk (fun x => k * x) (fun x => x * x + 1) fun x _ => x ≤ 1 <;>
clear hk a b
· omega
· -- Show that the solution set is symmetric in a and b.
intro x y; ring_nf -- Porting note: Originally, `cc` solved the entire goal
· -- Show that the claim is true if b = 0.
simp
· -- Show that the claim is true if a = b.
intro x hx
have x_sq_dvd : x * x ∣ x * x * k := dvd_mul_right (x * x) k
rw [← hx] at x_sq_dvd
obtain ⟨y, hy⟩ : x * x ∣ 1 := by simpa only [Nat.dvd_add_self_left, add_assoc] using x_sq_dvd
obtain ⟨rfl, rfl⟩ : x = 1 ∧ y = 1 := by simpa [mul_eq_one] using hy.symm
simpa using hx.symm
· -- Show the descent step.
intro x y _ hx h_base _ z _ _ hV₀
constructor
· have zy_pos : z * y ≥ 0 := by rw [hV₀]; exact mod_cast Nat.zero_le _
apply nonneg_of_mul_nonneg_left zy_pos
omega
· contrapose! hV₀ with x_lt_z
apply ne_of_gt
push_neg at h_base
calc
z * y > x * y := by apply mul_lt_mul_of_pos_right <;> omega
_ ≥ x * (x + 1) := by apply mul_le_mul <;> omega
_ > x * x + 1 := by
rw [mul_add, mul_one]
apply add_lt_add_right
assumption_mod_cast
· -- Show the base case.
intro x y h h_base
obtain rfl | rfl : x = 0 ∨ x = 1 := by rwa [Nat.le_add_one_iff, Nat.le_zero] at h_base
· simp at h
· rw [mul_one, one_mul, add_right_comm] at h
have y_dvd : y ∣ y * k := dvd_mul_right y k
rw [← h, Nat.dvd_add_left (dvd_mul_left y y)] at y_dvd
obtain rfl | rfl := (Nat.dvd_prime Nat.prime_two).mp y_dvd <;> apply mul_left_cancel₀
exacts [one_ne_zero, h.symm, two_ne_zero, h.symm]
end Imo1988P6
| true | Copyright (c) 2019 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin
-/
import Mathlib
/-!
# International Mathematical Olympiad 1988, Problem 6
If a and b are two natural numbers such that a*b+1 divides a^2 + b^2,
show that their quotient is a perfect square.
-/
namespace Imo1988P6
/-
Question 6 of IMO1988 is somewhat (in)famous. Several expert problem solvers
could not tackle the question within the given time limit.
The problem lead to the introduction of a new proof technique,
so called “Vieta jumping”.
In this file we formalise constant descent Vieta jumping,
and apply this to prove P6 of IMO1988.
To illustrate the technique, we also prove a similar result.
-/
/-- Constant descent Vieta jumping.
This proof technique allows one to prove an arbitrary proposition `claim`,
by running a descent argument on a hyperbola `H` in the first quadrant of the plane,
under the following conditions:
* `h₀` : There exists an integral point `(x,y)` on the hyperbola `H`.
* `H_symm` : The hyperbola has a symmetry along the diagonal in the plane.
* `H_zero` : If an integral point `(x,0)` lies on the hyperbola `H`, then `claim` is true.
* `H_diag` : If an integral point `(x,x)` lies on the hyperbola `H`, then `claim` is true.
* `H_desc` : If `(x,y)` is an integral point on the hyperbola `H`,
with `x < y` then there exists a “smaller” point on `H`: a point `(x',y')` with `x' < y' ≤ x`.
For reasons of usability, the hyperbola `H` is implemented as an arbitrary predicate.
(In question 6 of IMO1988, where this proof technique was first developped,
the predicate `claim` would be `∃ (d : ℕ), d ^ 2 = k` for some natural number `k`,
and the predicate `H` would be `fun a b ↦ a * a + b * b = (a * b + 1) * k`.)
To ensure that the predicate `H` actually describes a hyperbola,
the user must provide arguments `B` and `C` that are used as coefficients for a quadratic equation.
Finally, `H_quad` is the proof obligation that the quadratic equation
`(y:ℤ) * y - B x * y + C x = 0`
describes the same hyperbola as the predicate `H`.
For extra flexibility, one must provide a predicate `base` on the integral points in the plane.
In the descent step `H_desc` this will give the user the additional assumption that
the point `(x,y)` does not lie in this base locus.
The user must provide a proof that the proposition `claim` is true
if there exists an integral point `(x,y)` on the hyperbola `H` that lies in the base locus.
If such a base locus is not necessary, once can simply let it be `fun x y ↦ False`.
-/
theorem constant_descent_vieta_jumping (x y : ℕ) {claim : Prop} {H : ℕ → ℕ → Prop} (h₀ : H x y)
(B : ℕ → ℤ) (C : ℕ → ℤ) (base : ℕ → ℕ → Prop)
(H_quad : ∀ {x y}, H x y ↔ (y : ℤ) * y - B x * y + C x = 0) (H_symm : ∀ {x y}, H x y ↔ H y x)
(H_zero : ∀ {x}, H x 0 → claim) (H_diag : ∀ {x}, H x x → claim)
(H_desc : ∀ {x y}, 0 < x → x < y → ¬base x y → H x y →
∀ y', y' * y' - B x * y' + C x = 0 → y' = B x - y → y' * y = C x → 0 ≤ y' ∧ y' ≤ x)
(H_base : ∀ {x y}, H x y → base x y → claim) : claim := by
-- First of all, we may assume that x ≤ y.
-- We justify this using H_symm.
wlog hxy : x ≤ y
· rw [H_symm] at h₀; apply this y x h₀ B C base _ _ _ _ _ _ (le_of_not_ge hxy); assumption'
-- In fact, we can easily deal with the case x = y.
by_cases x_eq_y : x = y
· subst x_eq_y; exact H_diag h₀
-- Hence we may assume that x < y.
replace hxy : x < y := lt_of_le_of_ne hxy x_eq_y
clear x_eq_y
-- Consider the upper branch of the hyperbola defined by H.
let upper_branch : Set (ℕ × ℕ) := {p | H p.1 p.2 ∧ p.1 < p.2}
-- Note that the point p = (x,y) lies on the upper branch.
let p : ℕ × ℕ := ⟨x, y⟩
have hp : p ∈ upper_branch := ⟨h₀, hxy⟩
-- We also consider the exceptional set of solutions (a,b) that satisfy
-- a = 0 or a = b or B a = b or B a = b + a or that lie in the base locus.
let exceptional : Set (ℕ × ℕ) :=
{p | H p.1 p.2 ∧ (base p.1 p.2 ∨ p.1 = 0 ∨ p.1 = p.2 ∨ B p.1 = p.2 ∨ B p.1 = p.2 + p.1)}
-- Let S be the projection of the upper branch on to the y-axis
-- after removing the exceptional locus.
let S : Set ℕ := Prod.snd '' (upper_branch \ exceptional)
-- The strategy is to show that the exceptional locus in nonempty
-- by running a descent argument that starts with the given point p = (x,y).
-- Our assumptions ensure that we can then prove the claim.
suffices exc : exceptional.Nonempty by
-- Suppose that there exists an element in the exceptional locus.
simp only [Set.Nonempty, Prod.exists, Set.mem_setOf_eq, exceptional] at exc
-- Let (a,b) be such an element, and consider all the possible cases.
rcases exc with ⟨a, b, hH, hb⟩
rcases hb with (_ | rfl | rfl | hB | hB)
-- The first three cases are rather easy to solve.
· solve_by_elim
· rw [H_symm] at hH; solve_by_elim
· solve_by_elim
-- The final two cases are very similar.
all_goals
-- Consider the quadratic equation that (a,b) satisfies.
rw [H_quad] at hH
-- We find the other root of the equation, and Vieta's formulas.
rcases vieta_formula_quadratic hH with ⟨c, h_root, hV₁, hV₂⟩
-- By substitutions we find that b = 0 or b = a.
simp only [hB, add_eq_left, add_right_inj] at hV₁
subst hV₁
rw [← Int.ofNat_zero] at *
rw [← H_quad] at h_root
-- And hence we are done by H_zero and H_diag.
solve_by_elim
-- To finish the main proof, we need to show that the exceptional locus is nonempty.
-- So we assume that the exceptional locus is empty, and work towards deriving a contradiction.
rw [Set.nonempty_iff_ne_empty]
intro exceptional_empty
-- Observe that S is nonempty.
have S_nonempty : S.Nonempty := by
-- It contains the image of p.
use p.2
apply Set.mem_image_of_mem
-- After all, we assumed that the exceptional locus is empty.
rwa [exceptional_empty, Set.diff_empty]
-- We are now set for an infinite descent argument.
-- Let m be the smallest element of the nonempty set S.
let m : ℕ := WellFounded.min Nat.lt_wfRel.wf S S_nonempty
have m_mem : m ∈ S := WellFounded.min_mem Nat.lt_wfRel.wf S S_nonempty
have m_min : ∀ k ∈ S, ¬k < m := fun k hk => WellFounded.not_lt_min Nat.lt_wfRel.wf S hk
-- It suffices to show that there is point (a,b) with b ∈ S and b < m.
rsuffices ⟨p', p'_mem, p'_small⟩ : ∃ p' : ℕ × ℕ, p'.2 ∈ S ∧ p'.2 < m
· solve_by_elim
-- Let (m_x, m_y) be a point on the upper branch that projects to m ∈ S
-- and that does not lie in the exceptional locus.
rcases m_mem with ⟨⟨mx, my⟩, ⟨⟨hHm, mx_lt_my⟩, h_base⟩, m_eq⟩
-- This means that m_y = m,
-- and the conditions H(m_x, m_y) and m_x < m_y are satisfied.
simp only at mx_lt_my hHm m_eq
simp only [exceptional, hHm, Set.mem_setOf_eq, true_and] at h_base
push_neg at h_base
-- Finally, it also means that (m_x, m_y) does not lie in the base locus,
-- that m_x ≠ 0, m_x ≠ m_y, B(m_x) ≠ m_y, and B(m_x) ≠ m_x + m_y.
rcases h_base with ⟨h_base, hmx, hm_diag, hm_B₁, hm_B₂⟩
replace hmx : 0 < mx := pos_iff_ne_zero.mpr hmx
-- Consider the quadratic equation that (m_x, m_y) satisfies.
have h_quad := hHm
rw [H_quad] at h_quad
-- We find the other root of the equation, and Vieta's formulas.
rcases vieta_formula_quadratic h_quad with ⟨c, h_root, hV₁, hV₂⟩
-- Now we rewrite Vietas formulas a bit, and apply the descent step.
replace hV₁ : c = B mx - my := eq_sub_of_add_eq' hV₁
rw [mul_comm] at hV₂
have Hc := H_desc hmx mx_lt_my h_base hHm c h_root hV₁ hV₂
-- This means that we may assume that c ≥ 0 and c ≤ m_x.
obtain ⟨c_nonneg, c_lt⟩ := Hc
-- In other words, c is a natural number.
lift c to ℕ using c_nonneg
-- Recall that we are trying find a point (a,b) such that b ∈ S and b < m.
-- We claim that p' = (c, m_x) does the job.
let p' : ℕ × ℕ := ⟨c, mx⟩
use p'
-- The second condition is rather easy to check, so we do that first.
constructor; swap
· rwa [m_eq] at mx_lt_my
-- Now we need to show that p' projects onto S. In other words, that c ∈ S.
-- We do that, by showing that it lies in the upper branch
-- (which is sufficient, because we assumed that the exceptional locus is empty).
apply Set.mem_image_of_mem
rw [exceptional_empty, Set.diff_empty]
-- Now we are ready to prove that p' = (c, m_x) lies on the upper branch.
-- We need to check two conditions: H(c, m_x) and c < m_x.
constructor <;> dsimp only
· -- The first condition is not so hard. After all, c is the other root of the quadratic equation.
rw [H_symm, H_quad]
simpa using h_root
· -- For the second condition, we note that it suffices to check that c ≠ m_x.
omega
theorem imo1988_p6 {a b : ℕ} (h : a * b + 1 ∣ a ^ 2 + b ^ 2) :
∃ d, d ^ 2 = (a ^ 2 + b ^ 2) / (a * b + 1) := by
rcases h with ⟨k, hk⟩
rw [hk, Nat.mul_div_cancel_left _ (Nat.succ_pos (a * b))]
simp only [sq] at hk
apply constant_descent_vieta_jumping a b (H := fun a b => a * a + b * b = (a * b + 1) * k)
hk (fun x => k * x) (fun x => x * x - k) fun _ _ => False <;>
clear hk a b
· -- We will now show that the fibers of the solution set are described by a quadratic equation.
omega
· -- Show that the solution set is symmetric in a and b.
intro x y
simp [add_comm (x * x), mul_comm x]
· -- Show that the claim is true if b = 0.
suffices ∀ a, a * a = k → ∃ d, d * d = k by simpa [sq]
rintro x rfl; use x
· -- Show that the claim is true if a = b.
intro x hx
suffices k ≤ 1 by
rw [Nat.le_add_one_iff, Nat.le_zero] at this
rcases this with (rfl | rfl)
· use 0; simp
· use 1; simp
contrapose! hx with k_lt_one
apply ne_of_lt
calc
x * x + x * x = x * x * 2 := by rw [mul_two]
_ ≤ x * x * k := (Nat.mul_le_mul_left (x * x) k_lt_one)
_ < (x * x + 1) * k := by linarith
· -- Show the descent step.
intro x y hx x_lt_y _ _ z h_root _ hV₀
constructor
· have hpos : z * z + x * x > 0 := by
apply add_pos_of_nonneg_of_pos
· apply mul_self_nonneg
· positivity
have hzx : z * z + x * x = (z * x + 1) * k := by
rw [← sub_eq_zero, ← h_root]
ring
rw [hzx] at hpos
replace hpos : z * x + 1 > 0 := pos_of_mul_pos_left hpos (Int.natCast_nonneg k)
replace hpos : z * x ≥ 0 := Int.le_of_lt_add_one hpos
apply nonneg_of_mul_nonneg_left hpos (mod_cast hx)
· contrapose! hV₀ with x_lt_z
apply ne_of_gt
calc
z * y > x * x := by apply mul_lt_mul' <;> omega
_ ≥ x * x - k := sub_le_self _ (Int.natCast_nonneg k)
· -- There is no base case in this application of Vieta jumping.
simp
/-
The following example illustrates the use of constant descent Vieta jumping
in the presence of a non-trivial base case.
-/
example {a b : ℕ} (h : a * b ∣ a ^ 2 + b ^ 2 + 1) : 3 * a * b = a ^ 2 + b ^ 2 + 1 := by
rcases h with ⟨k, hk⟩
suffices k = 3 by simp_all; ring
simp only [sq] at hk
apply constant_descent_vieta_jumping a b (H := fun a b => a * a + b * b + 1 = a * b * k)
hk (fun x => k * x) (fun x => x * x + 1) fun x _ => x ≤ 1 <;>
clear hk a b
· omega
· -- Show that the solution set is symmetric in a and b.
intro x y; ring_nf -- Porting note: Originally, `cc` solved the entire goal
· -- Show that the claim is true if b = 0.
simp
· -- Show that the claim is true if a = b.
intro x hx
have x_sq_dvd : x * x ∣ x * x * k := dvd_mul_right (x * x) k
rw [← hx] at x_sq_dvd
obtain ⟨y, hy⟩ : x * x ∣ 1 := by simpa only [Nat.dvd_add_self_left, add_assoc] using x_sq_dvd
obtain ⟨rfl, rfl⟩ : x = 1 ∧ y = 1 := by simpa [mul_eq_one] using hy.symm
simpa using hx.symm
· -- Show the descent step.
intro x y _ hx h_base _ z _ _ hV₀
constructor
· have zy_pos : z * y ≥ 0 := by rw [hV₀]; exact mod_cast Nat.zero_le _
apply nonneg_of_mul_nonneg_left zy_pos
omega
· contrapose! hV₀ with x_lt_z
apply ne_of_gt
push_neg at h_base
calc
z * y > x * y := by apply mul_lt_mul_of_pos_right <;> omega
_ ≥ x * (x + 1) := by apply mul_le_mul <;> omega
_ > x * x + 1 := by
rw [mul_add, mul_one]
apply add_lt_add_right
assumption_mod_cast
· -- Show the base case.
intro x y h h_base
obtain rfl | rfl : x = 0 ∨ x = 1 := by rwa [Nat.le_add_one_iff, Nat.le_zero] at h_base
· simp at h
· rw [mul_one, one_mul, add_right_comm] at h
have y_dvd : y ∣ y * k := dvd_mul_right y k
rw [← h, Nat.dvd_add_left (dvd_mul_left y y)] at y_dvd
obtain rfl | rfl := (Nat.dvd_prime Nat.prime_two).mp y_dvd <;> apply mul_left_cancel₀
exacts [one_ne_zero, h.symm, two_ne_zero, h.symm]
end Imo1988P6 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1988P6.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "Application type mismatch: In the application\n @WellFounded.not_lt_min \u2115 WellFoundedRelation.rel WellFoundedRelation.wf S hk\nthe argument\n hk\nhas type\n k \u2208 S : Prop\nbut is expected to have type\n S.Nonempty : Prop", "unknown tactic", "unsolved goals\ncase intro.H_quad\nk : \u2115\n\u22a2 \u2200 {x y : \u2115}, x * x + y * y = (x * y + 1) * k \u2194 \u2191y * \u2191y - \u2191k * \u2191x * \u2191y + (\u2191x * \u2191x - \u2191k) = 0", "unsolved goals\ncase intro.H_symm\nk : \u2115\n\u22a2 \u2200 {x y : \u2115}, x * x + y * y = (x * y + 1) * k \u2194 y * y + x * x = (y * x + 1) * k\n\ncase intro.H_zero\nk : \u2115\n\u22a2 \u2200 {x : \u2115}, x * x + 0 * 0 = (x * 0 + 1) * k \u2192 \u2203 d, d ^ 2 = k\n\ncase intro.H_diag\nk : \u2115\n\u22a2 \u2200 {x : \u2115}, x * x + x * x = (x * x + 1) * k \u2192 \u2203 d, d ^ 2 = k\n\ncase intro.H_desc\nk : \u2115\n\u22a2 \u2200 {x y : \u2115},\n 0 < x \u2192\n x < y \u2192\n \u00acFalse \u2192\n x * x + y * y = (x * y + 1) * k \u2192\n \u2200 (y' : \u2124),\n y' * y' - \u2191k * \u2191x * y' + (\u2191x * \u2191x - \u2191k) = 0 \u2192\n y' = \u2191k * \u2191x - \u2191y \u2192 y' * \u2191y = \u2191x * \u2191x - \u2191k \u2192 0 \u2264 y' \u2227 y' \u2264 \u2191x\n\ncase intro.H_base\nk : \u2115\n\u22a2 \u2200 {x y : \u2115}, x * x + y * y = (x * y + 1) * k \u2192 False \u2192 \u2203 d, d ^ 2 = k", "unknown tactic", "unsolved goals\ncase intro.H_quad\nk : \u2115\n\u22a2 \u2200 {x y : \u2115}, x * x + y * y + 1 = x * y * k \u2194 \u2191y * \u2191y - \u2191k * \u2191x * \u2191y + (\u2191x * \u2191x + 1) = 0", "unsolved goals\ncase intro.H_symm\nk : \u2115\n\u22a2 \u2200 {x y : \u2115}, x * x + y * y + 1 = x * y * k \u2194 y * y + x * x + 1 = y * x * k\n\ncase intro.H_zero\nk : \u2115\n\u22a2 \u2200 {x : \u2115}, x * x + 0 * 0 + 1 = x * 0 * k \u2192 k = 3\n\ncase intro.H_diag\nk : \u2115\n\u22a2 \u2200 {x : \u2115}, x * x + x * x + 1 = x * x * k \u2192 k = 3\n\ncase intro.H_desc\nk : \u2115\n\u22a2 \u2200 {x y : \u2115},\n 0 < x \u2192\n x < y \u2192\n \u00acx \u2264 1 \u2192\n x * x + y * y + 1 = x * y * k \u2192\n \u2200 (y' : \u2124),\n y' * y' - \u2191k * \u2191x * y' + (\u2191x * \u2191x + 1) = 0 \u2192 y' = \u2191k * \u2191x - \u2191y \u2192 y' * \u2191y = \u2191x * \u2191x + 1 \u2192 0 \u2264 y' \u2227 y' \u2264 \u2191x\n\ncase intro.H_base\nk : \u2115\n\u22a2 \u2200 {x y : \u2115}, x * x + y * y + 1 = x * y * k \u2192 x \u2264 1 \u2192 k = 3"], "timeout_s": 600.0, "latency_s": 0.5408, "verified_at": "2026-03-26T18:17:12.980513+00:00"}} | false | true | false | 0.5408 |
compfiles_Imo1989P1 | compfiles | Copyright (c) 2025 Francesco Vercellesi· All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Francesco Vercellesi
-/
import Mathlib
/-!
# International Mathematical Olympiad 1989, Problem 1
Prove that the integers from 1 to 1989 can be partitioned in 117 sets
of 17 elements each, all with the same sum of elements.
-/
namespace Imo1989P1
abbrev S := Finset.Icc 1 1989
def n : ℕ := 117
def row (j : ℕ) (i : Fin n) : ℕ :=
if j < 14 then
if j % 2 = 0 then j * n + i.val + 1
else (j + 1) * n - i.val
else if j = 14 then 14 * n + i.val + 1
else if j = 15 then 15 * n + (i.val + 58) % n + 1
else 16 * n + (2 * n - 1 - 2 * i.val) % n + 1
def A (i : Fin n) : Finset ℕ := (Finset.range 17).image (λ j ↦ row j i)
lemma row_quot (j : ℕ) (hj : j < 17) (i : Fin n) : (row j i - 1) / n = j := by
unfold row; split_ifs <;> (simp [n] at *; omega)
lemma row_inj {j₁ j₂ : ℕ} {i₁ i₂ : Fin n} (hj₁ : j₁ < 17) (hj₂ : j₂ < 17) :
row j₁ i₁ = row j₂ i₂ ↔ j₁ = j₂ ∧ i₁ = i₂ := by
refine ⟨fun h => ?_, fun ⟨rfl, rfl⟩ => rfl⟩
have hj : j₁ = j₂ := by
have h1 := row_quot j₁ hj₁ i₁; have h2 := row_quot j₂ hj₂ i₂
rw [h] at h1; exact h1.symm.trans h2
exact ⟨hj, by subst hj; ext; unfold row at h; split_ifs at h <;> (simp [n] at *; try omega)⟩
private lemma row_injOn (i : Fin n) :
Set.InjOn (fun j => row j i) (Finset.range 17 : Set ℕ) :=
fun _ hj₁ _ hj₂ h =>
((row_inj (Finset.mem_range.mp hj₁) (Finset.mem_range.mp hj₂)).1 h).1
private lemma row_image_inj {j₁ j₂ : ℕ} (hj₁ : j₁ ∈ Finset.range 17)
(hj₂ : j₂ ∈ Finset.range 17) {i : Fin n} (h : row j₁ i = row j₂ i) : j₁ = j₂ :=
((row_inj (Finset.mem_range.mp hj₁) (Finset.mem_range.mp hj₂)).1 h).1
lemma A_card (i : Fin n) : (A i).card = 17 := by
simp [A, Finset.card_image_of_injOn (row_injOn i)]
lemma A_sum (i : Fin n) : (A i).sum id = 16915 := by
simp only [A]
rw [Finset.sum_image fun _ h₁ _ h₂ h => row_image_inj h₁ h₂ h]
simp only [Finset.sum_range_succ, Finset.sum_range_zero, id, row]
norm_num [n]
have hi := i.isLt; simp only [n] at hi
omega
lemma A_injective : Function.Injective A := by
intro i₁ i₂ h
have : row 0 i₁ ∈ A i₂ := h ▸ Finset.mem_image.mpr ⟨0, by simp, rfl⟩
obtain ⟨j, hj, h_eq⟩ := Finset.mem_image.mp this
exact ((row_inj (by omega) (Finset.mem_range.mp hj)).1 h_eq.symm).2
lemma A_le_S (i : Fin n) : A i ≤ S := by
intro x hx; obtain ⟨j, _, rfl⟩ := Finset.mem_image.mp hx
unfold row; simp [S]; split_ifs <;> (simp [n] at *; omega)
lemma A_disjoint {i₁ i₂ : Fin n} (h : i₁ ≠ i₂) : Disjoint (A i₁) (A i₂) := by
rw [Finset.disjoint_left]
rintro _ hx hy
obtain ⟨j₁, hj₁, rfl⟩ := Finset.mem_image.mp hx
obtain ⟨j₂, hj₂, h_eq⟩ := Finset.mem_image.mp hy
exact h ((row_inj (Finset.mem_range.mp hj₁) (Finset.mem_range.mp hj₂)).1 h_eq.symm).2
def P : Finpartition S where
parts := Finset.univ.image A
supIndep := by
rw [Finset.supIndep_iff_pairwiseDisjoint]
simp only [Set.PairwiseDisjoint, Set.Pairwise, Finset.mem_coe, Finset.mem_image,
Finset.mem_univ, true_and, Function.onFun, id]
rintro _ ⟨i, rfl⟩ _ ⟨j, rfl⟩ h
exact A_disjoint fun hij => h (hij ▸ rfl)
sup_parts := by
rw [Finset.sup_image, Function.id_comp, Finset.sup_eq_biUnion]
apply Finset.eq_of_subset_of_card_le
· exact Finset.biUnion_subset.mpr fun i _ => A_le_S i
·
rw [Finset.card_biUnion fun i _ j _ hij => A_disjoint hij]
simp [A_card, S, n]
bot_notMem := by
simp only [Finset.mem_image, Finset.mem_univ, true_and]
rintro ⟨i, hi⟩; exact absurd (hi ▸ A_card i) (by norm_num)
theorem imo1989_p1 : ∃ (P : Finpartition S),
P.parts.card = 117 ∧
(∀ p ∈ P.parts, p.card = 17) ∧
(∀ p ∈ P.parts, ∀ q ∈ P.parts, p.sum id = q.sum id) := by
refine ⟨P, ?_, ?_, ?_⟩
·
simp [P, Finset.card_image_of_injective _ A_injective, n]
· simp only [show P.parts = Finset.univ.image A from rfl, Finset.forall_mem_image]
exact fun _ _ => A_card _
· simp only [show P.parts = Finset.univ.image A from rfl, Finset.forall_mem_image]
intros; rw [A_sum, A_sum]
end Imo1989P1 | /- | /-
Copyright (c) 2025 Francesco Vercellesi· All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Francesco Vercellesi
-/
import Mathlib
/-!
# International Mathematical Olympiad 1989, Problem 1
Prove that the integers from 1 to 1989 can be partitioned in 117 sets
of 17 elements each, all with the same sum of elements.
-/
namespace Imo1989P1
abbrev S := Finset.Icc 1 1989
def n : ℕ := 117
def row (j : ℕ) (i : Fin n) : ℕ :=
if j < 14 then
if j % 2 = 0 then j * n + i.val + 1
else (j + 1) * n - i.val
else if j = 14 then 14 * n + i.val + 1
else if j = 15 then 15 * n + (i.val + 58) % n + 1
else 16 * n + (2 * n - 1 - 2 * i.val) % n + 1
def A (i : Fin n) : Finset ℕ := (Finset.range 17).image (λ j ↦ row j i)
lemma row_quot (j : ℕ) (hj : j < 17) (i : Fin n) : (row j i - 1) / n = j := by
unfold row; split_ifs <;> (simp [n] at *; omega)
lemma row_inj {j₁ j₂ : ℕ} {i₁ i₂ : Fin n} (hj₁ : j₁ < 17) (hj₂ : j₂ < 17) :
row j₁ i₁ = row j₂ i₂ ↔ j₁ = j₂ ∧ i₁ = i₂ := by
refine ⟨fun h => ?_, fun ⟨rfl, rfl⟩ => rfl⟩
have hj : j₁ = j₂ := by
have h1 := row_quot j₁ hj₁ i₁; have h2 := row_quot j₂ hj₂ i₂
rw [h] at h1; exact h1.symm.trans h2
exact ⟨hj, by subst hj; ext; unfold row at h; split_ifs at h <;> (simp [n] at *; try omega)⟩
private lemma row_injOn (i : Fin n) :
Set.InjOn (fun j => row j i) (Finset.range 17 : Set ℕ) :=
fun _ hj₁ _ hj₂ h =>
((row_inj (Finset.mem_range.mp hj₁) (Finset.mem_range.mp hj₂)).1 h).1
private lemma row_image_inj {j₁ j₂ : ℕ} (hj₁ : j₁ ∈ Finset.range 17)
(hj₂ : j₂ ∈ Finset.range 17) {i : Fin n} (h : row j₁ i = row j₂ i) : j₁ = j₂ :=
((row_inj (Finset.mem_range.mp hj₁) (Finset.mem_range.mp hj₂)).1 h).1
lemma A_card (i : Fin n) : (A i).card = 17 := by
simp [A, Finset.card_image_of_injOn (row_injOn i)]
lemma A_sum (i : Fin n) : (A i).sum id = 16915 := by
simp only [A]
rw [Finset.sum_image fun _ h₁ _ h₂ h => row_image_inj h₁ h₂ h]
simp only [Finset.sum_range_succ, Finset.sum_range_zero, id, row]
norm_num [n]
have hi := i.isLt; simp only [n] at hi
omega
lemma A_injective : Function.Injective A := by
intro i₁ i₂ h
have : row 0 i₁ ∈ A i₂ := h ▸ Finset.mem_image.mpr ⟨0, by simp, rfl⟩
obtain ⟨j, hj, h_eq⟩ := Finset.mem_image.mp this
exact ((row_inj (by omega) (Finset.mem_range.mp hj)).1 h_eq.symm).2
lemma A_le_S (i : Fin n) : A i ≤ S := by
intro x hx; obtain ⟨j, _, rfl⟩ := Finset.mem_image.mp hx
unfold row; simp [S]; split_ifs <;> (simp [n] at *; omega)
lemma A_disjoint {i₁ i₂ : Fin n} (h : i₁ ≠ i₂) : Disjoint (A i₁) (A i₂) := by
rw [Finset.disjoint_left]
rintro _ hx hy
obtain ⟨j₁, hj₁, rfl⟩ := Finset.mem_image.mp hx
obtain ⟨j₂, hj₂, h_eq⟩ := Finset.mem_image.mp hy
exact h ((row_inj (Finset.mem_range.mp hj₁) (Finset.mem_range.mp hj₂)).1 h_eq.symm).2
def P : Finpartition S where
parts := Finset.univ.image A
supIndep := by
rw [Finset.supIndep_iff_pairwiseDisjoint]
simp only [Set.PairwiseDisjoint, Set.Pairwise, Finset.mem_coe, Finset.mem_image,
Finset.mem_univ, true_and, Function.onFun, id]
rintro _ ⟨i, rfl⟩ _ ⟨j, rfl⟩ h
exact A_disjoint fun hij => h (hij ▸ rfl)
sup_parts := by
rw [Finset.sup_image, Function.id_comp, Finset.sup_eq_biUnion]
apply Finset.eq_of_subset_of_card_le
· exact Finset.biUnion_subset.mpr fun i _ => A_le_S i
·
rw [Finset.card_biUnion fun i _ j _ hij => A_disjoint hij]
simp [A_card, S, n]
bot_notMem := by
simp only [Finset.mem_image, Finset.mem_univ, true_and]
rintro ⟨i, hi⟩; exact absurd (hi ▸ A_card i) (by norm_num)
theorem imo1989_p1 : ∃ (P : Finpartition S),
P.parts.card = 117 ∧
(∀ p ∈ P.parts, p.card = 17) ∧
(∀ p ∈ P.parts, ∀ q ∈ P.parts, p.sum id = q.sum id) := by
refine ⟨P, ?_, ?_, ?_⟩
·
simp [P, Finset.card_image_of_injective _ A_injective, n]
· simp only [show P.parts = Finset.univ.image A from rfl, Finset.forall_mem_image]
exact fun _ _ => A_card _
· simp only [show P.parts = Finset.univ.image A from rfl, Finset.forall_mem_image]
intros; rw [A_sum, A_sum]
end Imo1989P1
| true | Copyright (c) 2025 Francesco Vercellesi· All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Francesco Vercellesi
-/
import Mathlib
/-!
# International Mathematical Olympiad 1989, Problem 1
Prove that the integers from 1 to 1989 can be partitioned in 117 sets
of 17 elements each, all with the same sum of elements.
-/
namespace Imo1989P1
abbrev S := Finset.Icc 1 1989
def n : ℕ := 117
def row (j : ℕ) (i : Fin n) : ℕ :=
if j < 14 then
if j % 2 = 0 then j * n + i.val + 1
else (j + 1) * n - i.val
else if j = 14 then 14 * n + i.val + 1
else if j = 15 then 15 * n + (i.val + 58) % n + 1
else 16 * n + (2 * n - 1 - 2 * i.val) % n + 1
def A (i : Fin n) : Finset ℕ := (Finset.range 17).image (λ j ↦ row j i)
lemma row_quot (j : ℕ) (hj : j < 17) (i : Fin n) : (row j i - 1) / n = j := by
unfold row; split_ifs <;> (simp [n] at *; omega)
lemma row_inj {j₁ j₂ : ℕ} {i₁ i₂ : Fin n} (hj₁ : j₁ < 17) (hj₂ : j₂ < 17) :
row j₁ i₁ = row j₂ i₂ ↔ j₁ = j₂ ∧ i₁ = i₂ := by
refine ⟨fun h => ?_, fun ⟨rfl, rfl⟩ => rfl⟩
have hj : j₁ = j₂ := by
have h1 := row_quot j₁ hj₁ i₁; have h2 := row_quot j₂ hj₂ i₂
rw [h] at h1; exact h1.symm.trans h2
exact ⟨hj, by subst hj; ext; unfold row at h; split_ifs at h <;> (simp [n] at *; try omega)⟩
private lemma row_injOn (i : Fin n) :
Set.InjOn (fun j => row j i) (Finset.range 17 : Set ℕ) :=
fun _ hj₁ _ hj₂ h =>
((row_inj (Finset.mem_range.mp hj₁) (Finset.mem_range.mp hj₂)).1 h).1
private lemma row_image_inj {j₁ j₂ : ℕ} (hj₁ : j₁ ∈ Finset.range 17)
(hj₂ : j₂ ∈ Finset.range 17) {i : Fin n} (h : row j₁ i = row j₂ i) : j₁ = j₂ :=
((row_inj (Finset.mem_range.mp hj₁) (Finset.mem_range.mp hj₂)).1 h).1
lemma A_card (i : Fin n) : (A i).card = 17 := by
simp [A, Finset.card_image_of_injOn (row_injOn i)]
lemma A_sum (i : Fin n) : (A i).sum id = 16915 := by
simp only [A]
rw [Finset.sum_image fun _ h₁ _ h₂ h => row_image_inj h₁ h₂ h]
simp only [Finset.sum_range_succ, Finset.sum_range_zero, id, row]
norm_num [n]
have hi := i.isLt; simp only [n] at hi
omega
lemma A_injective : Function.Injective A := by
intro i₁ i₂ h
have : row 0 i₁ ∈ A i₂ := h ▸ Finset.mem_image.mpr ⟨0, by simp, rfl⟩
obtain ⟨j, hj, h_eq⟩ := Finset.mem_image.mp this
exact ((row_inj (by omega) (Finset.mem_range.mp hj)).1 h_eq.symm).2
lemma A_le_S (i : Fin n) : A i ≤ S := by
intro x hx; obtain ⟨j, _, rfl⟩ := Finset.mem_image.mp hx
unfold row; simp [S]; split_ifs <;> (simp [n] at *; omega)
lemma A_disjoint {i₁ i₂ : Fin n} (h : i₁ ≠ i₂) : Disjoint (A i₁) (A i₂) := by
rw [Finset.disjoint_left]
rintro _ hx hy
obtain ⟨j₁, hj₁, rfl⟩ := Finset.mem_image.mp hx
obtain ⟨j₂, hj₂, h_eq⟩ := Finset.mem_image.mp hy
exact h ((row_inj (Finset.mem_range.mp hj₁) (Finset.mem_range.mp hj₂)).1 h_eq.symm).2
def P : Finpartition S where
parts := Finset.univ.image A
supIndep := by
rw [Finset.supIndep_iff_pairwiseDisjoint]
simp only [Set.PairwiseDisjoint, Set.Pairwise, Finset.mem_coe, Finset.mem_image,
Finset.mem_univ, true_and, Function.onFun, id]
rintro _ ⟨i, rfl⟩ _ ⟨j, rfl⟩ h
exact A_disjoint fun hij => h (hij ▸ rfl)
sup_parts := by
rw [Finset.sup_image, Function.id_comp, Finset.sup_eq_biUnion]
apply Finset.eq_of_subset_of_card_le
· exact Finset.biUnion_subset.mpr fun i _ => A_le_S i
·
rw [Finset.card_biUnion fun i _ j _ hij => A_disjoint hij]
simp [A_card, S, n]
bot_notMem := by
simp only [Finset.mem_image, Finset.mem_univ, true_and]
rintro ⟨i, hi⟩; exact absurd (hi ▸ A_card i) (by norm_num)
theorem imo1989_p1 : ∃ (P : Finpartition S),
P.parts.card = 117 ∧
(∀ p ∈ P.parts, p.card = 17) ∧
(∀ p ∈ P.parts, ∀ q ∈ P.parts, p.sum id = q.sum id) := by
refine ⟨P, ?_, ?_, ?_⟩
·
simp [P, Finset.card_image_of_injective _ A_injective, n]
· simp only [show P.parts = Finset.univ.image A from rfl, Finset.forall_mem_image]
exact fun _ _ => A_card _
· simp only [show P.parts = Finset.univ.image A from rfl, Finset.forall_mem_image]
intros; rw [A_sum, A_sum]
end Imo1989P1 | null | v4.29.0-rc6 | test | [
"competition",
"imo"
] | null | {"filename": "Imo1989P1.lean"} | {"v4.21.0": {"is_valid": false, "has_sorry": false, "errors": ["unknown tactic", "unsolved goals\ncase pos\nj : \u2115\nhj : j < 17\ni : Fin n\nh\u271d\u00b9 : j < 14\nh\u271d : j % 2 = 0\n\u22a2 (j * 117 + \u2191i) / 117 = j\n\ncase neg\nj : \u2115\nhj : j < 17\ni : Fin n\nh\u271d\u00b9 : j < 14\nh\u271d : j % 2 = 1\n\u22a2 ((j + 1) * 117 - \u2191i - 1) / 117 = j\n\ncase pos\nj : \u2115\nhj : j < 17\ni : Fin n\nh\u271d\u00b9 : j = 14\nh\u271d : 14 \u2264 j\n\u22a2 (1638 + \u2191i) / 117 = j\n\ncase pos\nj : \u2115\nhj : j < 17\ni : Fin n\nh\u271d\u00b2 : \u00acj = 14\nh\u271d\u00b9 : j = 15\nh\u271d : 14 \u2264 j\n\u22a2 (1755 + (\u2191i + 58) % 117) / 117 = j\n\ncase neg\nj : \u2115\nhj : j < 17\ni : Fin n\nh\u271d\u00b2 : \u00acj = 14\nh\u271d\u00b9 : \u00acj = 15\nh\u271d : 14 \u2264 j\n\u22a2 (1872 + (233 - 2 * \u2191i) % 117) / 117 = j", "unknown tactic", "unsolved goals\ncase pos\nj\u2081 : \u2115\ni\u2081 i\u2082 : Fin n\nhj\u2081 hj\u2082 : j\u2081 < 17\nh\u271d\u00b9 : j\u2081 < 14\nh\u271d : j\u2081 % 2 = 0\nh : \u2191i\u2081 = \u2191i\u2082\n\u22a2 \u2191i\u2081 = \u2191i\u2082\n\ncase neg\nj\u2081 : \u2115\ni\u2081 i\u2082 : Fin n\nhj\u2081 hj\u2082 : j\u2081 < 17\nh\u271d\u00b9 : j\u2081 < 14\nh : (j\u2081 + 1) * 117 - \u2191i\u2081 = (j\u2081 + 1) * 117 - \u2191i\u2082\nh\u271d : j\u2081 % 2 = 1\n\u22a2 \u2191i\u2081 = \u2191i\u2082\n\ncase pos\nj\u2081 : \u2115\ni\u2081 i\u2082 : Fin n\nhj\u2081 hj\u2082 : j\u2081 < 17\nh\u271d\u00b9 : j\u2081 = 14\nh\u271d : 14 \u2264 j\u2081\nh : \u2191i\u2081 = \u2191i\u2082\n\u22a2 \u2191i\u2081 = \u2191i\u2082\n\ncase pos\nj\u2081 : \u2115\ni\u2081 i\u2082 : Fin n\nhj\u2081 hj\u2082 : j\u2081 < 17\nh\u271d\u00b2 : \u00acj\u2081 = 14\nh\u271d\u00b9 : j\u2081 = 15\nh\u271d : 14 \u2264 j\u2081\nh : (\u2191i\u2081 + 58) % 117 = (\u2191i\u2082 + 58) % 117\n\u22a2 \u2191i\u2081 = \u2191i\u2082\n\ncase neg\nj\u2081 : \u2115\ni\u2081 i\u2082 : Fin n\nhj\u2081 hj\u2082 : j\u2081 < 17\nh\u271d\u00b2 : \u00acj\u2081 = 14\nh\u271d\u00b9 : \u00acj\u2081 = 15\nh\u271d : 14 \u2264 j\u2081\nh : (233 - 2 * \u2191i\u2081) % 117 = (233 - 2 * \u2191i\u2082) % 117\n\u22a2 \u2191i\u2081 = \u2191i\u2082", "unknown tactic", "unsolved goals\ni : Fin n\nhi : \u2191i < 117\n\u22a2 \u2191i + 1 + (234 - \u2191i) + (234 + \u2191i + 1) + (468 - \u2191i) + (468 + \u2191i + 1) + (702 - \u2191i) + (702 + \u2191i + 1) + (936 - \u2191i) +\n (936 + \u2191i + 1) +\n (1170 - \u2191i) +\n (1170 + \u2191i + 1) +\n (1404 - \u2191i) +\n (1404 + \u2191i + 1) +\n (1638 - \u2191i) +\n (1638 + \u2191i + 1) +\n (1755 + (\u2191i + 58) % 117 + 1) +\n (1872 + (233 - 2 * \u2191i) % 117 + 1) =\n 16915", "unknown tactic", "unsolved goals\ni\u2081 i\u2082 : Fin n\nh : A i\u2081 = A i\u2082\nthis : row 0 i\u2081 \u2208 A i\u2082\nj : \u2115\nhj : j \u2208 Finset.range 17\nh_eq : row j i\u2082 = row 0 i\u2081\n\u22a2 ?m.176054 < 17", "unknown tactic", "unsolved goals\ncase pos\ni : Fin n\nj : \u2115\nhx : row j i \u2208 A i\nh\u271d\u00b9 : j < 14\nh\u271d : j % 2 = 0\nleft\u271d : j < 17\n\u22a2 j * 117 + \u2191i \u2264 1988\n\ncase neg\ni : Fin n\nj : \u2115\nhx : row j i \u2208 A i\nh\u271d\u00b9 : j < 14\nleft\u271d : j < 17\nh\u271d : j % 2 = 1\n\u22a2 1 \u2264 (j + 1) * 117 - \u2191i \u2227 (j + 1) * 117 \u2264 1989 + \u2191i\n\ncase pos\ni : Fin n\nj : \u2115\nhx : row j i \u2208 A i\nh\u271d\u00b9 : j = 14\nleft\u271d : j < 17\nh\u271d : 14 \u2264 j\n\u22a2 1638 + \u2191i \u2264 1988\n\ncase pos\ni : Fin n\nj : \u2115\nhx : row j i \u2208 A i\nh\u271d\u00b2 : \u00acj = 14\nh\u271d\u00b9 : j = 15\nleft\u271d : j < 17\nh\u271d : 14 \u2264 j\n\u22a2 1755 + (\u2191i + 58) % 117 \u2264 1988\n\ncase neg\ni : Fin n\nj : \u2115\nhx : row j i \u2208 A i\nh\u271d\u00b2 : \u00acj = 14\nh\u271d\u00b9 : \u00acj = 15\nleft\u271d : j < 17\nh\u271d : 14 \u2264 j\n\u22a2 1872 + (233 - 2 * \u2191i) % 117 \u2264 1988", "unknown option 'backward.isDefEq.respectTransparency'", "unknown option 'backward.isDefEq.respectTransparency'"], "timeout_s": 600.0, "latency_s": 3.5145, "verified_at": "2026-03-26T18:17:15.954408+00:00"}} | false | true | false | 3.5145 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.