Metamath Proof Explorer


Theorem f1ofvswap

Description: Swapping two values in a bijection between two classes yields another bijection between those classes. (Contributed by BTernaryTau, 31-Aug-2024)

Ref Expression
Assertion f1ofvswap ( ( 𝐹 : 𝐴1-1-onto𝐵𝑋𝐴𝑌𝐴 ) → ( ( 𝐹 ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , ( 𝐹𝑌 ) ⟩ , ⟨ 𝑌 , ( 𝐹𝑋 ) ⟩ } ) : 𝐴1-1-onto𝐵 )

Proof

Step Hyp Ref Expression
1 f1oi ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) : ( 𝐴 ∖ { 𝑋 , 𝑌 } ) –1-1-onto→ ( 𝐴 ∖ { 𝑋 , 𝑌 } )
2 f1oprswap ( ( 𝑋𝐴𝑌𝐴 ) → { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } : { 𝑋 , 𝑌 } –1-1-onto→ { 𝑋 , 𝑌 } )
3 disjdifr ( ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∩ { 𝑋 , 𝑌 } ) = ∅
4 f1oun ( ( ( ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) : ( 𝐴 ∖ { 𝑋 , 𝑌 } ) –1-1-onto→ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∧ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } : { 𝑋 , 𝑌 } –1-1-onto→ { 𝑋 , 𝑌 } ) ∧ ( ( ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∩ { 𝑋 , 𝑌 } ) = ∅ ∧ ( ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∩ { 𝑋 , 𝑌 } ) = ∅ ) ) → ( ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) : ( ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∪ { 𝑋 , 𝑌 } ) –1-1-onto→ ( ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∪ { 𝑋 , 𝑌 } ) )
5 3 3 4 mpanr12 ( ( ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) : ( 𝐴 ∖ { 𝑋 , 𝑌 } ) –1-1-onto→ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∧ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } : { 𝑋 , 𝑌 } –1-1-onto→ { 𝑋 , 𝑌 } ) → ( ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) : ( ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∪ { 𝑋 , 𝑌 } ) –1-1-onto→ ( ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∪ { 𝑋 , 𝑌 } ) )
6 1 2 5 sylancr ( ( 𝑋𝐴𝑌𝐴 ) → ( ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) : ( ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∪ { 𝑋 , 𝑌 } ) –1-1-onto→ ( ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∪ { 𝑋 , 𝑌 } ) )
7 prssi ( ( 𝑋𝐴𝑌𝐴 ) → { 𝑋 , 𝑌 } ⊆ 𝐴 )
8 undif ( { 𝑋 , 𝑌 } ⊆ 𝐴 ↔ ( { 𝑋 , 𝑌 } ∪ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) = 𝐴 )
9 uncom ( { 𝑋 , 𝑌 } ∪ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) = ( ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∪ { 𝑋 , 𝑌 } )
10 9 eqeq1i ( ( { 𝑋 , 𝑌 } ∪ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) = 𝐴 ↔ ( ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∪ { 𝑋 , 𝑌 } ) = 𝐴 )
11 8 10 bitri ( { 𝑋 , 𝑌 } ⊆ 𝐴 ↔ ( ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∪ { 𝑋 , 𝑌 } ) = 𝐴 )
12 7 11 sylib ( ( 𝑋𝐴𝑌𝐴 ) → ( ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∪ { 𝑋 , 𝑌 } ) = 𝐴 )
13 f1oeq23 ( ( ( ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∪ { 𝑋 , 𝑌 } ) = 𝐴 ∧ ( ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∪ { 𝑋 , 𝑌 } ) = 𝐴 ) → ( ( ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) : ( ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∪ { 𝑋 , 𝑌 } ) –1-1-onto→ ( ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∪ { 𝑋 , 𝑌 } ) ↔ ( ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) : 𝐴1-1-onto𝐴 ) )
14 12 12 13 syl2anc ( ( 𝑋𝐴𝑌𝐴 ) → ( ( ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) : ( ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∪ { 𝑋 , 𝑌 } ) –1-1-onto→ ( ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ∪ { 𝑋 , 𝑌 } ) ↔ ( ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) : 𝐴1-1-onto𝐴 ) )
15 6 14 mpbid ( ( 𝑋𝐴𝑌𝐴 ) → ( ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) : 𝐴1-1-onto𝐴 )
16 f1oco ( ( 𝐹 : 𝐴1-1-onto𝐵 ∧ ( ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) : 𝐴1-1-onto𝐴 ) → ( 𝐹 ∘ ( ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) ) : 𝐴1-1-onto𝐵 )
17 15 16 sylan2 ( ( 𝐹 : 𝐴1-1-onto𝐵 ∧ ( 𝑋𝐴𝑌𝐴 ) ) → ( 𝐹 ∘ ( ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) ) : 𝐴1-1-onto𝐵 )
18 17 3impb ( ( 𝐹 : 𝐴1-1-onto𝐵𝑋𝐴𝑌𝐴 ) → ( 𝐹 ∘ ( ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) ) : 𝐴1-1-onto𝐵 )
19 f1ofn ( 𝐹 : 𝐴1-1-onto𝐵𝐹 Fn 𝐴 )
20 coundi ( 𝐹 ∘ ( ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) ) = ( ( 𝐹 ∘ ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ) ∪ ( 𝐹 ∘ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) )
21 fcoconst ( ( 𝐹 Fn 𝐴𝑌𝐴 ) → ( 𝐹 ∘ ( { 𝑋 } × { 𝑌 } ) ) = ( { 𝑋 } × { ( 𝐹𝑌 ) } ) )
22 21 3adant2 ( ( 𝐹 Fn 𝐴𝑋𝐴𝑌𝐴 ) → ( 𝐹 ∘ ( { 𝑋 } × { 𝑌 } ) ) = ( { 𝑋 } × { ( 𝐹𝑌 ) } ) )
23 xpsng ( ( 𝑋𝐴𝑌𝐴 ) → ( { 𝑋 } × { 𝑌 } ) = { ⟨ 𝑋 , 𝑌 ⟩ } )
24 23 coeq2d ( ( 𝑋𝐴𝑌𝐴 ) → ( 𝐹 ∘ ( { 𝑋 } × { 𝑌 } ) ) = ( 𝐹 ∘ { ⟨ 𝑋 , 𝑌 ⟩ } ) )
25 24 3adant1 ( ( 𝐹 Fn 𝐴𝑋𝐴𝑌𝐴 ) → ( 𝐹 ∘ ( { 𝑋 } × { 𝑌 } ) ) = ( 𝐹 ∘ { ⟨ 𝑋 , 𝑌 ⟩ } ) )
26 fvex ( 𝐹𝑌 ) ∈ V
27 xpsng ( ( 𝑋𝐴 ∧ ( 𝐹𝑌 ) ∈ V ) → ( { 𝑋 } × { ( 𝐹𝑌 ) } ) = { ⟨ 𝑋 , ( 𝐹𝑌 ) ⟩ } )
28 26 27 mpan2 ( 𝑋𝐴 → ( { 𝑋 } × { ( 𝐹𝑌 ) } ) = { ⟨ 𝑋 , ( 𝐹𝑌 ) ⟩ } )
29 28 3ad2ant2 ( ( 𝐹 Fn 𝐴𝑋𝐴𝑌𝐴 ) → ( { 𝑋 } × { ( 𝐹𝑌 ) } ) = { ⟨ 𝑋 , ( 𝐹𝑌 ) ⟩ } )
30 22 25 29 3eqtr3d ( ( 𝐹 Fn 𝐴𝑋𝐴𝑌𝐴 ) → ( 𝐹 ∘ { ⟨ 𝑋 , 𝑌 ⟩ } ) = { ⟨ 𝑋 , ( 𝐹𝑌 ) ⟩ } )
31 fcoconst ( ( 𝐹 Fn 𝐴𝑋𝐴 ) → ( 𝐹 ∘ ( { 𝑌 } × { 𝑋 } ) ) = ( { 𝑌 } × { ( 𝐹𝑋 ) } ) )
32 31 3adant3 ( ( 𝐹 Fn 𝐴𝑋𝐴𝑌𝐴 ) → ( 𝐹 ∘ ( { 𝑌 } × { 𝑋 } ) ) = ( { 𝑌 } × { ( 𝐹𝑋 ) } ) )
33 xpsng ( ( 𝑌𝐴𝑋𝐴 ) → ( { 𝑌 } × { 𝑋 } ) = { ⟨ 𝑌 , 𝑋 ⟩ } )
34 33 coeq2d ( ( 𝑌𝐴𝑋𝐴 ) → ( 𝐹 ∘ ( { 𝑌 } × { 𝑋 } ) ) = ( 𝐹 ∘ { ⟨ 𝑌 , 𝑋 ⟩ } ) )
35 34 ancoms ( ( 𝑋𝐴𝑌𝐴 ) → ( 𝐹 ∘ ( { 𝑌 } × { 𝑋 } ) ) = ( 𝐹 ∘ { ⟨ 𝑌 , 𝑋 ⟩ } ) )
36 35 3adant1 ( ( 𝐹 Fn 𝐴𝑋𝐴𝑌𝐴 ) → ( 𝐹 ∘ ( { 𝑌 } × { 𝑋 } ) ) = ( 𝐹 ∘ { ⟨ 𝑌 , 𝑋 ⟩ } ) )
37 fvex ( 𝐹𝑋 ) ∈ V
38 xpsng ( ( 𝑌𝐴 ∧ ( 𝐹𝑋 ) ∈ V ) → ( { 𝑌 } × { ( 𝐹𝑋 ) } ) = { ⟨ 𝑌 , ( 𝐹𝑋 ) ⟩ } )
39 37 38 mpan2 ( 𝑌𝐴 → ( { 𝑌 } × { ( 𝐹𝑋 ) } ) = { ⟨ 𝑌 , ( 𝐹𝑋 ) ⟩ } )
40 39 3ad2ant3 ( ( 𝐹 Fn 𝐴𝑋𝐴𝑌𝐴 ) → ( { 𝑌 } × { ( 𝐹𝑋 ) } ) = { ⟨ 𝑌 , ( 𝐹𝑋 ) ⟩ } )
41 32 36 40 3eqtr3d ( ( 𝐹 Fn 𝐴𝑋𝐴𝑌𝐴 ) → ( 𝐹 ∘ { ⟨ 𝑌 , 𝑋 ⟩ } ) = { ⟨ 𝑌 , ( 𝐹𝑋 ) ⟩ } )
42 30 41 uneq12d ( ( 𝐹 Fn 𝐴𝑋𝐴𝑌𝐴 ) → ( ( 𝐹 ∘ { ⟨ 𝑋 , 𝑌 ⟩ } ) ∪ ( 𝐹 ∘ { ⟨ 𝑌 , 𝑋 ⟩ } ) ) = ( { ⟨ 𝑋 , ( 𝐹𝑌 ) ⟩ } ∪ { ⟨ 𝑌 , ( 𝐹𝑋 ) ⟩ } ) )
43 df-pr { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } = ( { ⟨ 𝑋 , 𝑌 ⟩ } ∪ { ⟨ 𝑌 , 𝑋 ⟩ } )
44 43 coeq2i ( 𝐹 ∘ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) = ( 𝐹 ∘ ( { ⟨ 𝑋 , 𝑌 ⟩ } ∪ { ⟨ 𝑌 , 𝑋 ⟩ } ) )
45 coundi ( 𝐹 ∘ ( { ⟨ 𝑋 , 𝑌 ⟩ } ∪ { ⟨ 𝑌 , 𝑋 ⟩ } ) ) = ( ( 𝐹 ∘ { ⟨ 𝑋 , 𝑌 ⟩ } ) ∪ ( 𝐹 ∘ { ⟨ 𝑌 , 𝑋 ⟩ } ) )
46 44 45 eqtri ( 𝐹 ∘ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) = ( ( 𝐹 ∘ { ⟨ 𝑋 , 𝑌 ⟩ } ) ∪ ( 𝐹 ∘ { ⟨ 𝑌 , 𝑋 ⟩ } ) )
47 df-pr { ⟨ 𝑋 , ( 𝐹𝑌 ) ⟩ , ⟨ 𝑌 , ( 𝐹𝑋 ) ⟩ } = ( { ⟨ 𝑋 , ( 𝐹𝑌 ) ⟩ } ∪ { ⟨ 𝑌 , ( 𝐹𝑋 ) ⟩ } )
48 42 46 47 3eqtr4g ( ( 𝐹 Fn 𝐴𝑋𝐴𝑌𝐴 ) → ( 𝐹 ∘ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) = { ⟨ 𝑋 , ( 𝐹𝑌 ) ⟩ , ⟨ 𝑌 , ( 𝐹𝑋 ) ⟩ } )
49 48 uneq2d ( ( 𝐹 Fn 𝐴𝑋𝐴𝑌𝐴 ) → ( ( 𝐹 ∘ ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ) ∪ ( 𝐹 ∘ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) ) = ( ( 𝐹 ∘ ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ) ∪ { ⟨ 𝑋 , ( 𝐹𝑌 ) ⟩ , ⟨ 𝑌 , ( 𝐹𝑋 ) ⟩ } ) )
50 20 49 eqtrid ( ( 𝐹 Fn 𝐴𝑋𝐴𝑌𝐴 ) → ( 𝐹 ∘ ( ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) ) = ( ( 𝐹 ∘ ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ) ∪ { ⟨ 𝑋 , ( 𝐹𝑌 ) ⟩ , ⟨ 𝑌 , ( 𝐹𝑋 ) ⟩ } ) )
51 coires1 ( 𝐹 ∘ ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ) = ( 𝐹 ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) )
52 51 uneq1i ( ( 𝐹 ∘ ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ) ∪ { ⟨ 𝑋 , ( 𝐹𝑌 ) ⟩ , ⟨ 𝑌 , ( 𝐹𝑋 ) ⟩ } ) = ( ( 𝐹 ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , ( 𝐹𝑌 ) ⟩ , ⟨ 𝑌 , ( 𝐹𝑋 ) ⟩ } )
53 50 52 eqtrdi ( ( 𝐹 Fn 𝐴𝑋𝐴𝑌𝐴 ) → ( 𝐹 ∘ ( ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) ) = ( ( 𝐹 ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , ( 𝐹𝑌 ) ⟩ , ⟨ 𝑌 , ( 𝐹𝑋 ) ⟩ } ) )
54 19 53 syl3an1 ( ( 𝐹 : 𝐴1-1-onto𝐵𝑋𝐴𝑌𝐴 ) → ( 𝐹 ∘ ( ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) ) = ( ( 𝐹 ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , ( 𝐹𝑌 ) ⟩ , ⟨ 𝑌 , ( 𝐹𝑋 ) ⟩ } ) )
55 54 f1oeq1d ( ( 𝐹 : 𝐴1-1-onto𝐵𝑋𝐴𝑌𝐴 ) → ( ( 𝐹 ∘ ( ( I ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , 𝑌 ⟩ , ⟨ 𝑌 , 𝑋 ⟩ } ) ) : 𝐴1-1-onto𝐵 ↔ ( ( 𝐹 ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , ( 𝐹𝑌 ) ⟩ , ⟨ 𝑌 , ( 𝐹𝑋 ) ⟩ } ) : 𝐴1-1-onto𝐵 ) )
56 18 55 mpbid ( ( 𝐹 : 𝐴1-1-onto𝐵𝑋𝐴𝑌𝐴 ) → ( ( 𝐹 ↾ ( 𝐴 ∖ { 𝑋 , 𝑌 } ) ) ∪ { ⟨ 𝑋 , ( 𝐹𝑌 ) ⟩ , ⟨ 𝑌 , ( 𝐹𝑋 ) ⟩ } ) : 𝐴1-1-onto𝐵 )