Metamath Proof Explorer


Theorem metakunt34

Description: D is a permutation. (Contributed by metakunt, 18-Jul-2024)

Ref Expression
Hypotheses metakunt34.1 ( 𝜑𝑀 ∈ ℕ )
metakunt34.2 ( 𝜑𝐼 ∈ ℕ )
metakunt34.3 ( 𝜑𝐼𝑀 )
metakunt34.4 𝐷 = ( 𝑤 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑤 = 𝐼 , 𝑤 , if ( 𝑤 < 𝐼 , ( ( 𝑤 + ( 𝑀𝐼 ) ) + if ( 𝐼 ≤ ( 𝑤 + ( 𝑀𝐼 ) ) , 1 , 0 ) ) , ( ( 𝑤𝐼 ) + if ( 𝐼 ≤ ( 𝑤𝐼 ) , 1 , 0 ) ) ) ) )
Assertion metakunt34 ( 𝜑𝐷 : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) )

Proof

Step Hyp Ref Expression
1 metakunt34.1 ( 𝜑𝑀 ∈ ℕ )
2 metakunt34.2 ( 𝜑𝐼 ∈ ℕ )
3 metakunt34.3 ( 𝜑𝐼𝑀 )
4 metakunt34.4 𝐷 = ( 𝑤 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑤 = 𝐼 , 𝑤 , if ( 𝑤 < 𝐼 , ( ( 𝑤 + ( 𝑀𝐼 ) ) + if ( 𝐼 ≤ ( 𝑤 + ( 𝑀𝐼 ) ) , 1 , 0 ) ) , ( ( 𝑤𝐼 ) + if ( 𝐼 ≤ ( 𝑤𝐼 ) , 1 , 0 ) ) ) ) )
5 eqid ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) ) = ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) )
6 eqid ( 𝑧 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑧 = 𝑀 , 𝐼 , if ( 𝑧 < 𝐼 , 𝑧 , ( 𝑧 + 1 ) ) ) ) = ( 𝑧 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑧 = 𝑀 , 𝐼 , if ( 𝑧 < 𝐼 , 𝑧 , ( 𝑧 + 1 ) ) ) )
7 1 2 3 5 6 metakunt14 ( 𝜑 → ( ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) ) : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) ∧ ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) ) = ( 𝑧 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑧 = 𝑀 , 𝐼 , if ( 𝑧 < 𝐼 , 𝑧 , ( 𝑧 + 1 ) ) ) ) ) )
8 7 simpld ( 𝜑 → ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) ) : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) )
9 f1ocnv ( ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) ) : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) → ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) ) : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) )
10 8 9 syl ( 𝜑 ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) ) : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) )
11 7 simprd ( 𝜑 ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) ) = ( 𝑧 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑧 = 𝑀 , 𝐼 , if ( 𝑧 < 𝐼 , 𝑧 , ( 𝑧 + 1 ) ) ) ) )
12 11 f1oeq1d ( 𝜑 → ( ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) ) : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) ↔ ( 𝑧 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑧 = 𝑀 , 𝐼 , if ( 𝑧 < 𝐼 , 𝑧 , ( 𝑧 + 1 ) ) ) ) : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) ) )
13 10 12 mpbid ( 𝜑 → ( 𝑧 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑧 = 𝑀 , 𝐼 , if ( 𝑧 < 𝐼 , 𝑧 , ( 𝑧 + 1 ) ) ) ) : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) )
14 eqid ( 𝑦 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑦 = 𝑀 , 𝑀 , if ( 𝑦 < 𝐼 , ( 𝑦 + ( 𝑀𝐼 ) ) , ( 𝑦 + ( 1 − 𝐼 ) ) ) ) ) = ( 𝑦 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑦 = 𝑀 , 𝑀 , if ( 𝑦 < 𝐼 , ( 𝑦 + ( 𝑀𝐼 ) ) , ( 𝑦 + ( 1 − 𝐼 ) ) ) ) )
15 1 2 3 14 metakunt25 ( 𝜑 → ( 𝑦 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑦 = 𝑀 , 𝑀 , if ( 𝑦 < 𝐼 , ( 𝑦 + ( 𝑀𝐼 ) ) , ( 𝑦 + ( 1 − 𝐼 ) ) ) ) ) : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) )
16 f1oco ( ( ( 𝑦 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑦 = 𝑀 , 𝑀 , if ( 𝑦 < 𝐼 , ( 𝑦 + ( 𝑀𝐼 ) ) , ( 𝑦 + ( 1 − 𝐼 ) ) ) ) ) : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) ∧ ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) ) : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) ) → ( ( 𝑦 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑦 = 𝑀 , 𝑀 , if ( 𝑦 < 𝐼 , ( 𝑦 + ( 𝑀𝐼 ) ) , ( 𝑦 + ( 1 − 𝐼 ) ) ) ) ) ∘ ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) ) ) : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) )
17 15 8 16 syl2anc ( 𝜑 → ( ( 𝑦 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑦 = 𝑀 , 𝑀 , if ( 𝑦 < 𝐼 , ( 𝑦 + ( 𝑀𝐼 ) ) , ( 𝑦 + ( 1 − 𝐼 ) ) ) ) ) ∘ ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) ) ) : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) )
18 f1oco ( ( ( 𝑧 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑧 = 𝑀 , 𝐼 , if ( 𝑧 < 𝐼 , 𝑧 , ( 𝑧 + 1 ) ) ) ) : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) ∧ ( ( 𝑦 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑦 = 𝑀 , 𝑀 , if ( 𝑦 < 𝐼 , ( 𝑦 + ( 𝑀𝐼 ) ) , ( 𝑦 + ( 1 − 𝐼 ) ) ) ) ) ∘ ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) ) ) : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) ) → ( ( 𝑧 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑧 = 𝑀 , 𝐼 , if ( 𝑧 < 𝐼 , 𝑧 , ( 𝑧 + 1 ) ) ) ) ∘ ( ( 𝑦 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑦 = 𝑀 , 𝑀 , if ( 𝑦 < 𝐼 , ( 𝑦 + ( 𝑀𝐼 ) ) , ( 𝑦 + ( 1 − 𝐼 ) ) ) ) ) ∘ ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) ) ) ) : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) )
19 13 17 18 syl2anc ( 𝜑 → ( ( 𝑧 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑧 = 𝑀 , 𝐼 , if ( 𝑧 < 𝐼 , 𝑧 , ( 𝑧 + 1 ) ) ) ) ∘ ( ( 𝑦 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑦 = 𝑀 , 𝑀 , if ( 𝑦 < 𝐼 , ( 𝑦 + ( 𝑀𝐼 ) ) , ( 𝑦 + ( 1 − 𝐼 ) ) ) ) ) ∘ ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) ) ) ) : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) )
20 1 2 3 5 14 6 4 metakunt33 ( 𝜑 → ( ( 𝑧 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑧 = 𝑀 , 𝐼 , if ( 𝑧 < 𝐼 , 𝑧 , ( 𝑧 + 1 ) ) ) ) ∘ ( ( 𝑦 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑦 = 𝑀 , 𝑀 , if ( 𝑦 < 𝐼 , ( 𝑦 + ( 𝑀𝐼 ) ) , ( 𝑦 + ( 1 − 𝐼 ) ) ) ) ) ∘ ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) ) ) ) = 𝐷 )
21 20 f1oeq1d ( 𝜑 → ( ( ( 𝑧 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑧 = 𝑀 , 𝐼 , if ( 𝑧 < 𝐼 , 𝑧 , ( 𝑧 + 1 ) ) ) ) ∘ ( ( 𝑦 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑦 = 𝑀 , 𝑀 , if ( 𝑦 < 𝐼 , ( 𝑦 + ( 𝑀𝐼 ) ) , ( 𝑦 + ( 1 − 𝐼 ) ) ) ) ) ∘ ( 𝑥 ∈ ( 1 ... 𝑀 ) ↦ if ( 𝑥 = 𝐼 , 𝑀 , if ( 𝑥 < 𝐼 , 𝑥 , ( 𝑥 − 1 ) ) ) ) ) ) : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) ↔ 𝐷 : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) ) )
22 19 21 mpbid ( 𝜑𝐷 : ( 1 ... 𝑀 ) –1-1-onto→ ( 1 ... 𝑀 ) )