Metamath Proof Explorer


Theorem metakunt27

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

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

Proof

Step Hyp Ref Expression
1 metakunt27.1 ( 𝜑𝑀 ∈ ℕ )
2 metakunt27.2 ( 𝜑𝐼 ∈ ℕ )
3 metakunt27.3 ( 𝜑𝐼𝑀 )
4 metakunt27.4 ( 𝜑𝑋 ∈ ( 1 ... 𝑀 ) )
5 metakunt27.5 𝐴 = ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) )
6 metakunt27.6 𝐵 = ( 𝑧 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑧 = 𝑀 , 𝑀 , if ( 𝑧 < 𝐼 , ( 𝑧 + ( 𝑀𝐼 ) ) , ( 𝑧 + ( 1 − 𝐼 ) ) ) ) )
7 metakunt27.7 ( 𝜑 → ¬ 𝑋 = 𝐼 )
8 metakunt27.8 ( 𝜑𝑋 < 𝐼 )
9 5 a1i ( 𝜑𝐴 = ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) ) )
10 7 adantr ( ( 𝜑𝑥 = 𝑋 ) → ¬ 𝑋 = 𝐼 )
11 simpr ( ( 𝜑𝑥 = 𝑋 ) → 𝑥 = 𝑋 )
12 11 eqeq1d ( ( 𝜑𝑥 = 𝑋 ) → ( 𝑥 = 𝐼𝑋 = 𝐼 ) )
13 12 notbid ( ( 𝜑𝑥 = 𝑋 ) → ( ¬ 𝑥 = 𝐼 ↔ ¬ 𝑋 = 𝐼 ) )
14 10 13 mpbird ( ( 𝜑𝑥 = 𝑋 ) → ¬ 𝑥 = 𝐼 )
15 14 iffalsed ( ( 𝜑𝑥 = 𝑋 ) → if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) = if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) )
16 8 adantr ( ( 𝜑𝑥 = 𝑋 ) → 𝑋 < 𝐼 )
17 11 breq1d ( ( 𝜑𝑥 = 𝑋 ) → ( 𝑥 < 𝐼𝑋 < 𝐼 ) )
18 16 17 mpbird ( ( 𝜑𝑥 = 𝑋 ) → 𝑥 < 𝐼 )
19 18 iftrued ( ( 𝜑𝑥 = 𝑋 ) → if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) = 𝑥 )
20 19 11 eqtrd ( ( 𝜑𝑥 = 𝑋 ) → if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) = 𝑋 )
21 15 20 eqtrd ( ( 𝜑𝑥 = 𝑋 ) → if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) = 𝑋 )
22 9 21 4 4 fvmptd ( 𝜑 → ( 𝐴𝑋 ) = 𝑋 )
23 22 fveq2d ( 𝜑 → ( 𝐵 ‘ ( 𝐴𝑋 ) ) = ( 𝐵𝑋 ) )
24 6 a1i ( 𝜑𝐵 = ( 𝑧 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑧 = 𝑀 , 𝑀 , if ( 𝑧 < 𝐼 , ( 𝑧 + ( 𝑀𝐼 ) ) , ( 𝑧 + ( 1 − 𝐼 ) ) ) ) ) )
25 elfznn ( 𝑋 ∈ ( 1 ... 𝑀 ) → 𝑋 ∈ ℕ )
26 4 25 syl ( 𝜑𝑋 ∈ ℕ )
27 26 nnred ( 𝜑𝑋 ∈ ℝ )
28 2 nnred ( 𝜑𝐼 ∈ ℝ )
29 1 nnred ( 𝜑𝑀 ∈ ℝ )
30 27 28 29 8 3 ltletrd ( 𝜑𝑋 < 𝑀 )
31 27 30 ltned ( 𝜑𝑋𝑀 )
32 31 neneqd ( 𝜑 → ¬ 𝑋 = 𝑀 )
33 32 adantr ( ( 𝜑𝑧 = 𝑋 ) → ¬ 𝑋 = 𝑀 )
34 simpr ( ( 𝜑𝑧 = 𝑋 ) → 𝑧 = 𝑋 )
35 34 eqeq1d ( ( 𝜑𝑧 = 𝑋 ) → ( 𝑧 = 𝑀𝑋 = 𝑀 ) )
36 35 notbid ( ( 𝜑𝑧 = 𝑋 ) → ( ¬ 𝑧 = 𝑀 ↔ ¬ 𝑋 = 𝑀 ) )
37 33 36 mpbird ( ( 𝜑𝑧 = 𝑋 ) → ¬ 𝑧 = 𝑀 )
38 37 iffalsed ( ( 𝜑𝑧 = 𝑋 ) → if ( 𝑧 = 𝑀 , 𝑀 , if ( 𝑧 < 𝐼 , ( 𝑧 + ( 𝑀𝐼 ) ) , ( 𝑧 + ( 1 − 𝐼 ) ) ) ) = if ( 𝑧 < 𝐼 , ( 𝑧 + ( 𝑀𝐼 ) ) , ( 𝑧 + ( 1 − 𝐼 ) ) ) )
39 8 adantr ( ( 𝜑𝑧 = 𝑋 ) → 𝑋 < 𝐼 )
40 34 breq1d ( ( 𝜑𝑧 = 𝑋 ) → ( 𝑧 < 𝐼𝑋 < 𝐼 ) )
41 39 40 mpbird ( ( 𝜑𝑧 = 𝑋 ) → 𝑧 < 𝐼 )
42 41 iftrued ( ( 𝜑𝑧 = 𝑋 ) → if ( 𝑧 < 𝐼 , ( 𝑧 + ( 𝑀𝐼 ) ) , ( 𝑧 + ( 1 − 𝐼 ) ) ) = ( 𝑧 + ( 𝑀𝐼 ) ) )
43 34 oveq1d ( ( 𝜑𝑧 = 𝑋 ) → ( 𝑧 + ( 𝑀𝐼 ) ) = ( 𝑋 + ( 𝑀𝐼 ) ) )
44 42 43 eqtrd ( ( 𝜑𝑧 = 𝑋 ) → if ( 𝑧 < 𝐼 , ( 𝑧 + ( 𝑀𝐼 ) ) , ( 𝑧 + ( 1 − 𝐼 ) ) ) = ( 𝑋 + ( 𝑀𝐼 ) ) )
45 38 44 eqtrd ( ( 𝜑𝑧 = 𝑋 ) → if ( 𝑧 = 𝑀 , 𝑀 , if ( 𝑧 < 𝐼 , ( 𝑧 + ( 𝑀𝐼 ) ) , ( 𝑧 + ( 1 − 𝐼 ) ) ) ) = ( 𝑋 + ( 𝑀𝐼 ) ) )
46 4 elfzelzd ( 𝜑𝑋 ∈ ℤ )
47 1 nnzd ( 𝜑𝑀 ∈ ℤ )
48 2 nnzd ( 𝜑𝐼 ∈ ℤ )
49 47 48 zsubcld ( 𝜑 → ( 𝑀𝐼 ) ∈ ℤ )
50 46 49 zaddcld ( 𝜑 → ( 𝑋 + ( 𝑀𝐼 ) ) ∈ ℤ )
51 24 45 4 50 fvmptd ( 𝜑 → ( 𝐵𝑋 ) = ( 𝑋 + ( 𝑀𝐼 ) ) )
52 23 51 eqtrd ( 𝜑 → ( 𝐵 ‘ ( 𝐴𝑋 ) ) = ( 𝑋 + ( 𝑀𝐼 ) ) )