Metamath Proof Explorer


Theorem marrepfval

Description: First substitution for the definition of the matrix row replacement function. (Contributed by AV, 12-Feb-2019) (Proof shortened by AV, 2-Mar-2024)

Ref Expression
Hypotheses marrepfval.a 𝐴 = ( 𝑁 Mat 𝑅 )
marrepfval.b 𝐵 = ( Base ‘ 𝐴 )
marrepfval.q 𝑄 = ( 𝑁 matRRep 𝑅 )
marrepfval.z 0 = ( 0g𝑅 )
Assertion marrepfval 𝑄 = ( 𝑚𝐵 , 𝑠 ∈ ( Base ‘ 𝑅 ) ↦ ( 𝑘𝑁 , 𝑙𝑁 ↦ ( 𝑖𝑁 , 𝑗𝑁 ↦ if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , 0 ) , ( 𝑖 𝑚 𝑗 ) ) ) ) )

Proof

Step Hyp Ref Expression
1 marrepfval.a 𝐴 = ( 𝑁 Mat 𝑅 )
2 marrepfval.b 𝐵 = ( Base ‘ 𝐴 )
3 marrepfval.q 𝑄 = ( 𝑁 matRRep 𝑅 )
4 marrepfval.z 0 = ( 0g𝑅 )
5 2 fvexi 𝐵 ∈ V
6 fvexd ( ( 𝑁 ∈ V ∧ 𝑅 ∈ V ) → ( Base ‘ 𝑅 ) ∈ V )
7 mpoexga ( ( 𝐵 ∈ V ∧ ( Base ‘ 𝑅 ) ∈ V ) → ( 𝑚𝐵 , 𝑠 ∈ ( Base ‘ 𝑅 ) ↦ ( 𝑘𝑁 , 𝑙𝑁 ↦ ( 𝑖𝑁 , 𝑗𝑁 ↦ if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , 0 ) , ( 𝑖 𝑚 𝑗 ) ) ) ) ) ∈ V )
8 5 6 7 sylancr ( ( 𝑁 ∈ V ∧ 𝑅 ∈ V ) → ( 𝑚𝐵 , 𝑠 ∈ ( Base ‘ 𝑅 ) ↦ ( 𝑘𝑁 , 𝑙𝑁 ↦ ( 𝑖𝑁 , 𝑗𝑁 ↦ if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , 0 ) , ( 𝑖 𝑚 𝑗 ) ) ) ) ) ∈ V )
9 oveq12 ( ( 𝑛 = 𝑁𝑟 = 𝑅 ) → ( 𝑛 Mat 𝑟 ) = ( 𝑁 Mat 𝑅 ) )
10 9 fveq2d ( ( 𝑛 = 𝑁𝑟 = 𝑅 ) → ( Base ‘ ( 𝑛 Mat 𝑟 ) ) = ( Base ‘ ( 𝑁 Mat 𝑅 ) ) )
11 1 fveq2i ( Base ‘ 𝐴 ) = ( Base ‘ ( 𝑁 Mat 𝑅 ) )
12 2 11 eqtri 𝐵 = ( Base ‘ ( 𝑁 Mat 𝑅 ) )
13 10 12 eqtr4di ( ( 𝑛 = 𝑁𝑟 = 𝑅 ) → ( Base ‘ ( 𝑛 Mat 𝑟 ) ) = 𝐵 )
14 fveq2 ( 𝑟 = 𝑅 → ( Base ‘ 𝑟 ) = ( Base ‘ 𝑅 ) )
15 14 adantl ( ( 𝑛 = 𝑁𝑟 = 𝑅 ) → ( Base ‘ 𝑟 ) = ( Base ‘ 𝑅 ) )
16 simpl ( ( 𝑛 = 𝑁𝑟 = 𝑅 ) → 𝑛 = 𝑁 )
17 fveq2 ( 𝑟 = 𝑅 → ( 0g𝑟 ) = ( 0g𝑅 ) )
18 17 4 eqtr4di ( 𝑟 = 𝑅 → ( 0g𝑟 ) = 0 )
19 18 ifeq2d ( 𝑟 = 𝑅 → if ( 𝑗 = 𝑙 , 𝑠 , ( 0g𝑟 ) ) = if ( 𝑗 = 𝑙 , 𝑠 , 0 ) )
20 19 ifeq1d ( 𝑟 = 𝑅 → if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , ( 0g𝑟 ) ) , ( 𝑖 𝑚 𝑗 ) ) = if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , 0 ) , ( 𝑖 𝑚 𝑗 ) ) )
21 20 adantl ( ( 𝑛 = 𝑁𝑟 = 𝑅 ) → if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , ( 0g𝑟 ) ) , ( 𝑖 𝑚 𝑗 ) ) = if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , 0 ) , ( 𝑖 𝑚 𝑗 ) ) )
22 16 16 21 mpoeq123dv ( ( 𝑛 = 𝑁𝑟 = 𝑅 ) → ( 𝑖𝑛 , 𝑗𝑛 ↦ if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , ( 0g𝑟 ) ) , ( 𝑖 𝑚 𝑗 ) ) ) = ( 𝑖𝑁 , 𝑗𝑁 ↦ if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , 0 ) , ( 𝑖 𝑚 𝑗 ) ) ) )
23 16 16 22 mpoeq123dv ( ( 𝑛 = 𝑁𝑟 = 𝑅 ) → ( 𝑘𝑛 , 𝑙𝑛 ↦ ( 𝑖𝑛 , 𝑗𝑛 ↦ if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , ( 0g𝑟 ) ) , ( 𝑖 𝑚 𝑗 ) ) ) ) = ( 𝑘𝑁 , 𝑙𝑁 ↦ ( 𝑖𝑁 , 𝑗𝑁 ↦ if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , 0 ) , ( 𝑖 𝑚 𝑗 ) ) ) ) )
24 13 15 23 mpoeq123dv ( ( 𝑛 = 𝑁𝑟 = 𝑅 ) → ( 𝑚 ∈ ( Base ‘ ( 𝑛 Mat 𝑟 ) ) , 𝑠 ∈ ( Base ‘ 𝑟 ) ↦ ( 𝑘𝑛 , 𝑙𝑛 ↦ ( 𝑖𝑛 , 𝑗𝑛 ↦ if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , ( 0g𝑟 ) ) , ( 𝑖 𝑚 𝑗 ) ) ) ) ) = ( 𝑚𝐵 , 𝑠 ∈ ( Base ‘ 𝑅 ) ↦ ( 𝑘𝑁 , 𝑙𝑁 ↦ ( 𝑖𝑁 , 𝑗𝑁 ↦ if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , 0 ) , ( 𝑖 𝑚 𝑗 ) ) ) ) ) )
25 df-marrep matRRep = ( 𝑛 ∈ V , 𝑟 ∈ V ↦ ( 𝑚 ∈ ( Base ‘ ( 𝑛 Mat 𝑟 ) ) , 𝑠 ∈ ( Base ‘ 𝑟 ) ↦ ( 𝑘𝑛 , 𝑙𝑛 ↦ ( 𝑖𝑛 , 𝑗𝑛 ↦ if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , ( 0g𝑟 ) ) , ( 𝑖 𝑚 𝑗 ) ) ) ) ) )
26 24 25 ovmpoga ( ( 𝑁 ∈ V ∧ 𝑅 ∈ V ∧ ( 𝑚𝐵 , 𝑠 ∈ ( Base ‘ 𝑅 ) ↦ ( 𝑘𝑁 , 𝑙𝑁 ↦ ( 𝑖𝑁 , 𝑗𝑁 ↦ if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , 0 ) , ( 𝑖 𝑚 𝑗 ) ) ) ) ) ∈ V ) → ( 𝑁 matRRep 𝑅 ) = ( 𝑚𝐵 , 𝑠 ∈ ( Base ‘ 𝑅 ) ↦ ( 𝑘𝑁 , 𝑙𝑁 ↦ ( 𝑖𝑁 , 𝑗𝑁 ↦ if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , 0 ) , ( 𝑖 𝑚 𝑗 ) ) ) ) ) )
27 8 26 mpd3an3 ( ( 𝑁 ∈ V ∧ 𝑅 ∈ V ) → ( 𝑁 matRRep 𝑅 ) = ( 𝑚𝐵 , 𝑠 ∈ ( Base ‘ 𝑅 ) ↦ ( 𝑘𝑁 , 𝑙𝑁 ↦ ( 𝑖𝑁 , 𝑗𝑁 ↦ if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , 0 ) , ( 𝑖 𝑚 𝑗 ) ) ) ) ) )
28 25 mpondm0 ( ¬ ( 𝑁 ∈ V ∧ 𝑅 ∈ V ) → ( 𝑁 matRRep 𝑅 ) = ∅ )
29 matbas0pc ( ¬ ( 𝑁 ∈ V ∧ 𝑅 ∈ V ) → ( Base ‘ ( 𝑁 Mat 𝑅 ) ) = ∅ )
30 12 29 syl5eq ( ¬ ( 𝑁 ∈ V ∧ 𝑅 ∈ V ) → 𝐵 = ∅ )
31 30 orcd ( ¬ ( 𝑁 ∈ V ∧ 𝑅 ∈ V ) → ( 𝐵 = ∅ ∨ ( Base ‘ 𝑅 ) = ∅ ) )
32 0mpo0 ( ( 𝐵 = ∅ ∨ ( Base ‘ 𝑅 ) = ∅ ) → ( 𝑚𝐵 , 𝑠 ∈ ( Base ‘ 𝑅 ) ↦ ( 𝑘𝑁 , 𝑙𝑁 ↦ ( 𝑖𝑁 , 𝑗𝑁 ↦ if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , 0 ) , ( 𝑖 𝑚 𝑗 ) ) ) ) ) = ∅ )
33 31 32 syl ( ¬ ( 𝑁 ∈ V ∧ 𝑅 ∈ V ) → ( 𝑚𝐵 , 𝑠 ∈ ( Base ‘ 𝑅 ) ↦ ( 𝑘𝑁 , 𝑙𝑁 ↦ ( 𝑖𝑁 , 𝑗𝑁 ↦ if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , 0 ) , ( 𝑖 𝑚 𝑗 ) ) ) ) ) = ∅ )
34 28 33 eqtr4d ( ¬ ( 𝑁 ∈ V ∧ 𝑅 ∈ V ) → ( 𝑁 matRRep 𝑅 ) = ( 𝑚𝐵 , 𝑠 ∈ ( Base ‘ 𝑅 ) ↦ ( 𝑘𝑁 , 𝑙𝑁 ↦ ( 𝑖𝑁 , 𝑗𝑁 ↦ if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , 0 ) , ( 𝑖 𝑚 𝑗 ) ) ) ) ) )
35 27 34 pm2.61i ( 𝑁 matRRep 𝑅 ) = ( 𝑚𝐵 , 𝑠 ∈ ( Base ‘ 𝑅 ) ↦ ( 𝑘𝑁 , 𝑙𝑁 ↦ ( 𝑖𝑁 , 𝑗𝑁 ↦ if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , 0 ) , ( 𝑖 𝑚 𝑗 ) ) ) ) )
36 3 35 eqtri 𝑄 = ( 𝑚𝐵 , 𝑠 ∈ ( Base ‘ 𝑅 ) ↦ ( 𝑘𝑁 , 𝑙𝑁 ↦ ( 𝑖𝑁 , 𝑗𝑁 ↦ if ( 𝑖 = 𝑘 , if ( 𝑗 = 𝑙 , 𝑠 , 0 ) , ( 𝑖 𝑚 𝑗 ) ) ) ) )