Metamath Proof Explorer


Theorem metakunt26

Description: Construction of one solution of the increment equation system. (Contributed by metakunt, 7-Jul-2024)

Ref Expression
Hypotheses metakunt26.1 ( 𝜑𝑀 ∈ ℕ )
metakunt26.2 ( 𝜑𝐼 ∈ ℕ )
metakunt26.3 ( 𝜑𝐼𝑀 )
metakunt26.4 𝐴 = ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) )
metakunt26.5 𝐶 = ( 𝑦 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑦 = 𝑀 , 𝐼 , if ( 𝑦 < 𝐼 , 𝑦 , ( 𝑦 + 1 ) ) ) )
metakunt26.6 𝐵 = ( 𝑧 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑧 = 𝑀 , 𝑀 , if ( 𝑧 < 𝐼 , ( 𝑧 + ( 𝑀𝐼 ) ) , ( 𝑧 + ( 1 − 𝐼 ) ) ) ) )
metakunt26.7 ( 𝜑𝑋 = 𝐼 )
Assertion metakunt26 ( 𝜑 → ( 𝐶 ‘ ( 𝐵 ‘ ( 𝐴𝑋 ) ) ) = 𝑋 )

Proof

Step Hyp Ref Expression
1 metakunt26.1 ( 𝜑𝑀 ∈ ℕ )
2 metakunt26.2 ( 𝜑𝐼 ∈ ℕ )
3 metakunt26.3 ( 𝜑𝐼𝑀 )
4 metakunt26.4 𝐴 = ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) )
5 metakunt26.5 𝐶 = ( 𝑦 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑦 = 𝑀 , 𝐼 , if ( 𝑦 < 𝐼 , 𝑦 , ( 𝑦 + 1 ) ) ) )
6 metakunt26.6 𝐵 = ( 𝑧 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑧 = 𝑀 , 𝑀 , if ( 𝑧 < 𝐼 , ( 𝑧 + ( 𝑀𝐼 ) ) , ( 𝑧 + ( 1 − 𝐼 ) ) ) ) )
7 metakunt26.7 ( 𝜑𝑋 = 𝐼 )
8 4 a1i ( 𝜑𝐴 = ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) ) )
9 7 eqeq2d ( 𝜑 → ( 𝑥 = 𝑋𝑥 = 𝐼 ) )
10 simpr ( ( 𝜑𝑥 = 𝐼 ) → 𝑥 = 𝐼 )
11 10 iftrued ( ( 𝜑𝑥 = 𝐼 ) → if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) = 𝑀 )
12 11 ex ( 𝜑 → ( 𝑥 = 𝐼 → if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) = 𝑀 ) )
13 9 12 sylbid ( 𝜑 → ( 𝑥 = 𝑋 → if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) = 𝑀 ) )
14 13 imp ( ( 𝜑𝑥 = 𝑋 ) → if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) = 𝑀 )
15 1zzd ( 𝜑 → 1 ∈ ℤ )
16 nnz ( 𝑀 ∈ ℕ → 𝑀 ∈ ℤ )
17 1 16 syl ( 𝜑𝑀 ∈ ℤ )
18 2 nnzd ( 𝜑𝐼 ∈ ℤ )
19 2 nnge1d ( 𝜑 → 1 ≤ 𝐼 )
20 15 17 18 19 3 elfzd ( 𝜑𝐼 ∈ ( 1 ... 𝑀 ) )
21 7 eleq1d ( 𝜑 → ( 𝑋 ∈ ( 1 ... 𝑀 ) ↔ 𝐼 ∈ ( 1 ... 𝑀 ) ) )
22 20 21 mpbird ( 𝜑𝑋 ∈ ( 1 ... 𝑀 ) )
23 8 14 22 1 fvmptd ( 𝜑 → ( 𝐴𝑋 ) = 𝑀 )
24 23 fveq2d ( 𝜑 → ( 𝐵 ‘ ( 𝐴𝑋 ) ) = ( 𝐵𝑀 ) )
25 6 a1i ( 𝜑𝐵 = ( 𝑧 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑧 = 𝑀 , 𝑀 , if ( 𝑧 < 𝐼 , ( 𝑧 + ( 𝑀𝐼 ) ) , ( 𝑧 + ( 1 − 𝐼 ) ) ) ) ) )
26 simpr ( ( 𝜑𝑧 = 𝑀 ) → 𝑧 = 𝑀 )
27 26 iftrued ( ( 𝜑𝑧 = 𝑀 ) → if ( 𝑧 = 𝑀 , 𝑀 , if ( 𝑧 < 𝐼 , ( 𝑧 + ( 𝑀𝐼 ) ) , ( 𝑧 + ( 1 − 𝐼 ) ) ) ) = 𝑀 )
28 1zzd ( 𝑀 ∈ ℕ → 1 ∈ ℤ )
29 nnge1 ( 𝑀 ∈ ℕ → 1 ≤ 𝑀 )
30 nnre ( 𝑀 ∈ ℕ → 𝑀 ∈ ℝ )
31 30 leidd ( 𝑀 ∈ ℕ → 𝑀𝑀 )
32 28 16 16 29 31 elfzd ( 𝑀 ∈ ℕ → 𝑀 ∈ ( 1 ... 𝑀 ) )
33 1 32 syl ( 𝜑𝑀 ∈ ( 1 ... 𝑀 ) )
34 25 27 33 1 fvmptd ( 𝜑 → ( 𝐵𝑀 ) = 𝑀 )
35 24 34 eqtrd ( 𝜑 → ( 𝐵 ‘ ( 𝐴𝑋 ) ) = 𝑀 )
36 35 fveq2d ( 𝜑 → ( 𝐶 ‘ ( 𝐵 ‘ ( 𝐴𝑋 ) ) ) = ( 𝐶𝑀 ) )
37 5 a1i ( 𝜑𝐶 = ( 𝑦 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑦 = 𝑀 , 𝐼 , if ( 𝑦 < 𝐼 , 𝑦 , ( 𝑦 + 1 ) ) ) ) )
38 simpr ( ( 𝜑𝑦 = 𝑀 ) → 𝑦 = 𝑀 )
39 38 iftrued ( ( 𝜑𝑦 = 𝑀 ) → if ( 𝑦 = 𝑀 , 𝐼 , if ( 𝑦 < 𝐼 , 𝑦 , ( 𝑦 + 1 ) ) ) = 𝐼 )
40 37 39 33 2 fvmptd ( 𝜑 → ( 𝐶𝑀 ) = 𝐼 )
41 36 40 eqtrd ( 𝜑 → ( 𝐶 ‘ ( 𝐵 ‘ ( 𝐴𝑋 ) ) ) = 𝐼 )
42 7 eqcomd ( 𝜑𝐼 = 𝑋 )
43 41 42 eqtrd ( 𝜑 → ( 𝐶 ‘ ( 𝐵 ‘ ( 𝐴𝑋 ) ) ) = 𝑋 )