Compfiles/Usa2012P4.lean
Explanation legend Lean4 Domain Explanation Language (L4DEL)
L4DEL explanations are a separate layer. They do not change the Lean source. Intuition is explanatory prose; numbered items are a reading path; sources link the wording back to evidence.
- L4DEL
- Lean4 Domain Explanation Language
Credit: The upstream authors and contributors retain credit for the project and mathematics. lean4-explainer only renders their pinned source and adds the separately disclosed explanation layer.
Project sources: Pinned compfiles documentation, Pinned compfiles corpus index
11 declarations, 0 contain sorry, 0 declared as axioms
USA Mathematical Olympiad 2012, Problem 4
Find all functions $f : \mathbb{N} \to \mathbb{N}$ such that $f(n!) = f(n)!$ for all positive integers $n$ and such that $m - n$ divides $f(m) - f(n)$ for all distinct positive integers $m, n$.
Imports (6)
Imported by 1 file
- def
Usa2012P4.IsSolutionThe conditions of the problem on a functionf : ℕ → ℕline 37 sourceSource documentation
The conditions of the problem on a function
f : ℕ → ℕ. Since the problem is about functions on the positive integers, we require positivity offon positive inputs explicitly; the valuef 0is irrelevant.no axioms what this means
Statement uses:
NatProof uses:
And,LT.lt,OfNat.ofNat,Eq,Nat.factorial,Ne,Dvd.dvd,Int,HSub.hSub7 instances, coercions and auxiliary constants left out.
def IsSolution (f : ℕ → ℕ) : Prop := …
Mentions: f
- lemma
Usa2012P4.eq_one_or_two_of_factorial_eq_selfIf a positive integer equals its own factorial, then it is1or2line 47 sourceSource documentation
If a positive integer equals its own factorial, then it is
1or2.standard axioms: propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Eq,Nat.factorial,OrProof uses:
Nat.succ,Exists,Nat.exists_eq_succ_of_ne_zero,Iff.mp,Ne,Nat.pos_iff_ne_zero,id,HMul.hMul,HAdd.hAdd,Eq.mpr,congrArg,Eq.mp,Nat.factorial_succ,Mathlib.Tactic.Ring.of_eq,Nat.rawCast,HPow.hPow,Mathlib.Tactic.Ring.Common.add_congr,Mathlib.Tactic.Ring.Common.atom_pf,rfl,Eq.symmand 29 more29 instances, coercions and auxiliary constants left out.
Tactic trace: 14 steps
Open to load the checked before-and-after goal states.
lemma eq_one_or_two_of_factorial_eq_self {x : ℕ} (hx : 0 < x) (h : x ! = x) : x = 1 ∨ x = 2 := by …Mentions: h
- lemma
Usa2012P4.lt_of_dvd_factorial_subIfd ≥ 2divides `(t ! line 62 sourceSource documentation
If
d ≥ 2divides(t ! : ℤ) - cbut does not dividec, thent < d, becaused ∣ t !as soon ast ≥ d.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Int,Dvd.dvd,HSub.hSub,Nat.factorial,LE.le,OfNat.ofNat,Not,LT.ltProof uses:
Decidable.byContradiction,Iff.mp,not_lt,Iff.mpr,Int.natCast_dvd_natCast,Nat.dvd_factorial,dvd_sub,Eq,Mathlib.Tactic.Ring.of_eq,HAdd.hAdd,HMul.hMul,HPow.hPow,Nat.rawCast,Mathlib.Meta.NormNum.instAddMonoidWithOne,inferInstance,Ring,Mathlib.Tactic.Ring.Common.sub_congr,Int.rawCast,Int.negOfNat,Mathlib.Tactic.Ring.Common.atom_pfand 25 more52 instances, coercions and auxiliary constants left out.
Tactic trace: 9 steps
Open to load the checked before-and-after goal states.
lemma lt_of_dvd_factorial_sub {d t : ℕ} {c : ℤ} (h : (d : ℤ) ∣ (t ! : ℤ) - c) (hd : 2 ≤ d) (hdc : ¬(d : ℤ) ∣ c) : t < d := by …Mentions: h
- def
Usa2012P4.iterFacIterated factorials starting at3:iterFac 0 = 3anditerFac (r + 1) = (iterFac r)!line 76 sourceSource documentation
Iterated factorials starting at
3:iterFac 0 = 3anditerFac (r + 1) = (iterFac r)!. These are used to produce arbitrarily large fixed points off(Shankar Padmanabhan's argument).no axioms what this means
Statement uses:
Nat2 instances, coercions and auxiliary constants left out.
def iterFac : ℕ → ℕ | 0 => 3 | r + 1 => (iterFac r)!
- lemma
Usa2012P4.iterFac_geline 80 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,HAdd.hAdd,OfNat.ofNat, Usa2012P4.iterFacProof uses:
Nat.recAux,le_refl,LT.lt,Nat.factorial,Nat.lt_factorial_self,le_trans,id12 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2012P4.f_iterFacEvery iterated factorial of3is a fixed point off, oncef 3 = 3line 89 sourceSource documentation
Every iterated factorial of
3is a fixed point off, oncef 3 = 3.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Eq,Nat.factorial, Usa2012P4.iterFacProof uses:
Nat.recAux,LE.le,HAdd.hAdd, Usa2012P4.iterFac_ge,id,Eq.mpr,congrArg,Eq.refl8 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.
lemma f_iterFac {f : ℕ → ℕ} (hfact : ∀ n, 0 < n → f (n !) = (f n)!) (hf3 : f 3 = 3) (r : ℕ) : f (iterFac r) = iterFac r := by …Mentions: f, Usa2012P4.iterFac
- lemma
Usa2012P4.eq_one_const_of_f_two_eq_oneCasef 2 = 1: thenfis identically1on positive integers line 99 sourceSource documentation
Case
f 2 = 1: thenfis identically1on positive integers.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Eq,Nat.factorial,Ne,Dvd.dvd,Int,HSub.hSubProof uses:
LE.le,Nat.factorial_le,rfl,Nat.factorial_pos,Mathlib.Meta.NormNum.isNat_lt_true,Mathlib.Meta.NormNum.isNat_ofNat,Eq.refl,Bool,Bool.false,Iff.mpr,Int.natCast_dvd_natCast,Nat.dvd_factorial,of_decide_eq_true,id,Decidable.decide,Bool.true,dvd_trans,dvd_sub,Eq.mp,congrArgand 21 more51 instances, coercions and auxiliary constants left out.
Tactic trace: 47 steps
Open to load the checked before-and-after goal states.
lemma eq_one_const_of_f_two_eq_one {f : ℕ → ℕ} (hpos : ∀ n, 0 < n → 0 < f n) (hfact : ∀ n, 0 < n → f (n !) = (f n)!) (hdiv : ∀ (m n : ℕ), 0 < m → 0 < n → m ≠ n → (m : ℤ) - n ∣ (f m : ℤ) - f n) (hf2 : f 2 = 1) (n : ℕ) (hn : 0 < n) : f n = 1 := by …Mentions: f
- lemma
Usa2012P4.eq_two_const_of_f_one_two_eq_twoCasef 1 = f 2 = 2: thenfis identically2on positive integers line 133 sourceSource documentation
Case
f 1 = f 2 = 2: thenfis identically2on positive integers.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Eq,Nat.factorial,Ne,Dvd.dvd,Int,HSub.hSubProof uses:
Nat.zero_lt_succ,Eq.mp,congrArg,rfl,Mathlib.Meta.NormNum.isNat_eq_false,Mathlib.Meta.NormNum.isNat_ofNat,Eq.refl,Bool,Bool.false, Usa2012P4.lt_of_dvd_factorial_sub,Mathlib.Meta.NormNum.isNat_le_true,Bool.true,of_decide_eq_true,Not,id,Decidable.decide,dite,LE.le,absurd,Eq.symmand 19 more49 instances, coercions and auxiliary constants left out.
Tactic trace: 64 steps
Open to load the checked before-and-after goal states.
lemma eq_two_const_of_f_one_two_eq_two {f : ℕ → ℕ} (hpos : ∀ n, 0 < n → 0 < f n) (hfact : ∀ n, 0 < n → f (n !) = (f n)!) (hdiv : ∀ (m n : ℕ), 0 < m → 0 < n → m ≠ n → (m : ℤ) - n ∣ (f m : ℤ) - f n) (hf1 : f 1 = 2) (hf2 : f 2 = 2) (n : ℕ) (hn : 0 < n) : f n = 2 := by …Mentions: f
- lemma
Usa2012P4.eq_id_of_f_one_eq_oneCasef 1 = 1andf 2 = 2: thenfis the identity on positive integers line 176 sourceSource documentation
Case
f 1 = 1andf 2 = 2: thenfis the identity on positive integers.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Eq,Nat.factorial,Ne,Dvd.dvd,Int,HSub.hSubProof uses:
Nat.zero_lt_succ,Mathlib.Meta.NormNum.isNat_eq_false,Mathlib.Meta.NormNum.isNat_ofNat,Eq.refl,Bool,Bool.false, Usa2012P4.lt_of_dvd_factorial_sub,Eq.mp,congrArg,Mathlib.Meta.NormNum.isNat_le_true,Bool.true,of_decide_eq_true,Not,id,Decidable.decide,Mathlib.Meta.NormNum.isNat_lt_true,dite,LE.le,absurd,Eq.symmand 63 more80 instances, coercions and auxiliary constants left out.
Tactic trace: 48 steps
Open to load the checked before-and-after goal states.
lemma eq_id_of_f_one_eq_one {f : ℕ → ℕ} (hpos : ∀ n, 0 < n → 0 < f n) (hfact : ∀ n, 0 < n → f (n !) = (f n)!) (hdiv : ∀ (m n : ℕ), 0 < m → 0 < n → m ≠ n → (m : ℤ) - n ∣ (f m : ℤ) - f n) (hf1 : f 1 = 1) (hf2 : f 2 = 2) (n : ℕ) (hn : 0 < n) : f n = n := by …Mentions: f
- determine
Usa2012P4.solution_setThe answer: the constant functions1and2, and the identity (on positive integers) line 221 sourceSource documentation
The answer: the constant functions
1and2, and the identity (on positive integers).no axioms what this means
Statement uses:
Set,NatProof uses:
Set.ofPred,Or,LT.lt,OfNat.ofNat,Eq2 instances, coercions and auxiliary constants left out.
determine solution_set : Set (ℕ → ℕ) := …
- problem
Usa2012P4.usa2012_p4line 224 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Iff,Membership.mem,Set, Usa2012P4.solution_set, Usa2012P4.IsSolutionProof uses:
Iff.intro,LT.lt,OfNat.ofNat,Eq,Or,And.intro,And,Nat.factorial,Ne,Dvd.dvd,Int,HSub.hSub,Eq.mpr,id,congrArg,zero_lt_one,Nat.factorial_pos,Nat.factorial_one,Eq.refl,sub_selfand 16 more42 instances, coercions and auxiliary constants left out.
Tactic trace: 65 steps
Open to load the checked before-and-after goal states.