Metamath Proof Explorer


Theorem ofpreima

Description: Express the preimage of a function operation as a union of preimages. (Contributed by Thierry Arnoux, 8-Mar-2018)

Ref Expression
Hypotheses ofpreima.1 ( 𝜑𝐹 : 𝐴𝐵 )
ofpreima.2 ( 𝜑𝐺 : 𝐴𝐶 )
ofpreima.3 ( 𝜑𝐴𝑉 )
ofpreima.4 ( 𝜑𝑅 Fn ( 𝐵 × 𝐶 ) )
Assertion ofpreima ( 𝜑 → ( ( 𝐹f 𝑅 𝐺 ) “ 𝐷 ) = 𝑝 ∈ ( 𝑅𝐷 ) ( ( 𝐹 “ { ( 1st𝑝 ) } ) ∩ ( 𝐺 “ { ( 2nd𝑝 ) } ) ) )

Proof

Step Hyp Ref Expression
1 ofpreima.1 ( 𝜑𝐹 : 𝐴𝐵 )
2 ofpreima.2 ( 𝜑𝐺 : 𝐴𝐶 )
3 ofpreima.3 ( 𝜑𝐴𝑉 )
4 ofpreima.4 ( 𝜑𝑅 Fn ( 𝐵 × 𝐶 ) )
5 nfmpt1 𝑠 ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ )
6 eqidd ( 𝜑 → ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) = ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) )
7 fnov ( 𝑅 Fn ( 𝐵 × 𝐶 ) ↔ 𝑅 = ( 𝑥𝐵 , 𝑦𝐶 ↦ ( 𝑥 𝑅 𝑦 ) ) )
8 4 7 sylib ( 𝜑𝑅 = ( 𝑥𝐵 , 𝑦𝐶 ↦ ( 𝑥 𝑅 𝑦 ) ) )
9 5 1 2 3 6 8 ofoprabco ( 𝜑 → ( 𝐹f 𝑅 𝐺 ) = ( 𝑅 ∘ ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) ) )
10 9 cnveqd ( 𝜑 ( 𝐹f 𝑅 𝐺 ) = ( 𝑅 ∘ ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) ) )
11 cnvco ( 𝑅 ∘ ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) ) = ( ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) ∘ 𝑅 )
12 10 11 eqtrdi ( 𝜑 ( 𝐹f 𝑅 𝐺 ) = ( ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) ∘ 𝑅 ) )
13 12 imaeq1d ( 𝜑 → ( ( 𝐹f 𝑅 𝐺 ) “ 𝐷 ) = ( ( ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) ∘ 𝑅 ) “ 𝐷 ) )
14 imaco ( ( ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) ∘ 𝑅 ) “ 𝐷 ) = ( ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) “ ( 𝑅𝐷 ) )
15 13 14 eqtrdi ( 𝜑 → ( ( 𝐹f 𝑅 𝐺 ) “ 𝐷 ) = ( ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) “ ( 𝑅𝐷 ) ) )
16 dfima2 ( ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) “ ( 𝑅𝐷 ) ) = { 𝑞 ∣ ∃ 𝑝 ∈ ( 𝑅𝐷 ) 𝑝 ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) 𝑞 }
17 vex 𝑝 ∈ V
18 vex 𝑞 ∈ V
19 17 18 brcnv ( 𝑝 ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) 𝑞𝑞 ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) 𝑝 )
20 funmpt Fun ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ )
21 funbrfv2b ( Fun ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) → ( 𝑞 ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) 𝑝 ↔ ( 𝑞 ∈ dom ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) ∧ ( ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) ‘ 𝑞 ) = 𝑝 ) ) )
22 20 21 ax-mp ( 𝑞 ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) 𝑝 ↔ ( 𝑞 ∈ dom ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) ∧ ( ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) ‘ 𝑞 ) = 𝑝 ) )
23 opex ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ∈ V
24 eqid ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) = ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ )
25 23 24 dmmpti dom ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) = 𝐴
26 25 eleq2i ( 𝑞 ∈ dom ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) ↔ 𝑞𝐴 )
27 26 anbi1i ( ( 𝑞 ∈ dom ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) ∧ ( ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) ‘ 𝑞 ) = 𝑝 ) ↔ ( 𝑞𝐴 ∧ ( ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) ‘ 𝑞 ) = 𝑝 ) )
28 22 27 bitri ( 𝑞 ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) 𝑝 ↔ ( 𝑞𝐴 ∧ ( ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) ‘ 𝑞 ) = 𝑝 ) )
29 fveq2 ( 𝑠 = 𝑞 → ( 𝐹𝑠 ) = ( 𝐹𝑞 ) )
30 fveq2 ( 𝑠 = 𝑞 → ( 𝐺𝑠 ) = ( 𝐺𝑞 ) )
31 29 30 opeq12d ( 𝑠 = 𝑞 → ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ = ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ )
32 opex ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ ∈ V
33 31 24 32 fvmpt ( 𝑞𝐴 → ( ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) ‘ 𝑞 ) = ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ )
34 33 eqeq1d ( 𝑞𝐴 → ( ( ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) ‘ 𝑞 ) = 𝑝 ↔ ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ = 𝑝 ) )
35 34 pm5.32i ( ( 𝑞𝐴 ∧ ( ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) ‘ 𝑞 ) = 𝑝 ) ↔ ( 𝑞𝐴 ∧ ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ = 𝑝 ) )
36 19 28 35 3bitri ( 𝑝 ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) 𝑞 ↔ ( 𝑞𝐴 ∧ ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ = 𝑝 ) )
37 36 rexbii ( ∃ 𝑝 ∈ ( 𝑅𝐷 ) 𝑝 ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) 𝑞 ↔ ∃ 𝑝 ∈ ( 𝑅𝐷 ) ( 𝑞𝐴 ∧ ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ = 𝑝 ) )
38 37 abbii { 𝑞 ∣ ∃ 𝑝 ∈ ( 𝑅𝐷 ) 𝑝 ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) 𝑞 } = { 𝑞 ∣ ∃ 𝑝 ∈ ( 𝑅𝐷 ) ( 𝑞𝐴 ∧ ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ = 𝑝 ) }
39 nfv 𝑞 𝜑
40 nfab1 𝑞 { 𝑞 ∣ ∃ 𝑝 ∈ ( 𝑅𝐷 ) ( 𝑞𝐴 ∧ ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ = 𝑝 ) }
41 nfcv 𝑞 𝑝 ∈ ( 𝑅𝐷 ) ( ( 𝐹 “ { ( 1st𝑝 ) } ) ∩ ( 𝐺 “ { ( 2nd𝑝 ) } ) )
42 eliun ( 𝑞 𝑝 ∈ ( 𝑅𝐷 ) ( ( 𝐹 “ { ( 1st𝑝 ) } ) ∩ ( 𝐺 “ { ( 2nd𝑝 ) } ) ) ↔ ∃ 𝑝 ∈ ( 𝑅𝐷 ) 𝑞 ∈ ( ( 𝐹 “ { ( 1st𝑝 ) } ) ∩ ( 𝐺 “ { ( 2nd𝑝 ) } ) ) )
43 ffn ( 𝐹 : 𝐴𝐵𝐹 Fn 𝐴 )
44 fniniseg ( 𝐹 Fn 𝐴 → ( 𝑞 ∈ ( 𝐹 “ { ( 1st𝑝 ) } ) ↔ ( 𝑞𝐴 ∧ ( 𝐹𝑞 ) = ( 1st𝑝 ) ) ) )
45 1 43 44 3syl ( 𝜑 → ( 𝑞 ∈ ( 𝐹 “ { ( 1st𝑝 ) } ) ↔ ( 𝑞𝐴 ∧ ( 𝐹𝑞 ) = ( 1st𝑝 ) ) ) )
46 ffn ( 𝐺 : 𝐴𝐶𝐺 Fn 𝐴 )
47 fniniseg ( 𝐺 Fn 𝐴 → ( 𝑞 ∈ ( 𝐺 “ { ( 2nd𝑝 ) } ) ↔ ( 𝑞𝐴 ∧ ( 𝐺𝑞 ) = ( 2nd𝑝 ) ) ) )
48 2 46 47 3syl ( 𝜑 → ( 𝑞 ∈ ( 𝐺 “ { ( 2nd𝑝 ) } ) ↔ ( 𝑞𝐴 ∧ ( 𝐺𝑞 ) = ( 2nd𝑝 ) ) ) )
49 45 48 anbi12d ( 𝜑 → ( ( 𝑞 ∈ ( 𝐹 “ { ( 1st𝑝 ) } ) ∧ 𝑞 ∈ ( 𝐺 “ { ( 2nd𝑝 ) } ) ) ↔ ( ( 𝑞𝐴 ∧ ( 𝐹𝑞 ) = ( 1st𝑝 ) ) ∧ ( 𝑞𝐴 ∧ ( 𝐺𝑞 ) = ( 2nd𝑝 ) ) ) ) )
50 elin ( 𝑞 ∈ ( ( 𝐹 “ { ( 1st𝑝 ) } ) ∩ ( 𝐺 “ { ( 2nd𝑝 ) } ) ) ↔ ( 𝑞 ∈ ( 𝐹 “ { ( 1st𝑝 ) } ) ∧ 𝑞 ∈ ( 𝐺 “ { ( 2nd𝑝 ) } ) ) )
51 anandi ( ( 𝑞𝐴 ∧ ( ( 𝐹𝑞 ) = ( 1st𝑝 ) ∧ ( 𝐺𝑞 ) = ( 2nd𝑝 ) ) ) ↔ ( ( 𝑞𝐴 ∧ ( 𝐹𝑞 ) = ( 1st𝑝 ) ) ∧ ( 𝑞𝐴 ∧ ( 𝐺𝑞 ) = ( 2nd𝑝 ) ) ) )
52 49 50 51 3bitr4g ( 𝜑 → ( 𝑞 ∈ ( ( 𝐹 “ { ( 1st𝑝 ) } ) ∩ ( 𝐺 “ { ( 2nd𝑝 ) } ) ) ↔ ( 𝑞𝐴 ∧ ( ( 𝐹𝑞 ) = ( 1st𝑝 ) ∧ ( 𝐺𝑞 ) = ( 2nd𝑝 ) ) ) ) )
53 52 adantr ( ( 𝜑𝑝 ∈ ( 𝑅𝐷 ) ) → ( 𝑞 ∈ ( ( 𝐹 “ { ( 1st𝑝 ) } ) ∩ ( 𝐺 “ { ( 2nd𝑝 ) } ) ) ↔ ( 𝑞𝐴 ∧ ( ( 𝐹𝑞 ) = ( 1st𝑝 ) ∧ ( 𝐺𝑞 ) = ( 2nd𝑝 ) ) ) ) )
54 cnvimass ( 𝑅𝐷 ) ⊆ dom 𝑅
55 4 fndmd ( 𝜑 → dom 𝑅 = ( 𝐵 × 𝐶 ) )
56 54 55 sseqtrid ( 𝜑 → ( 𝑅𝐷 ) ⊆ ( 𝐵 × 𝐶 ) )
57 56 sselda ( ( 𝜑𝑝 ∈ ( 𝑅𝐷 ) ) → 𝑝 ∈ ( 𝐵 × 𝐶 ) )
58 1st2nd2 ( 𝑝 ∈ ( 𝐵 × 𝐶 ) → 𝑝 = ⟨ ( 1st𝑝 ) , ( 2nd𝑝 ) ⟩ )
59 eqeq2 ( 𝑝 = ⟨ ( 1st𝑝 ) , ( 2nd𝑝 ) ⟩ → ( ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ = 𝑝 ↔ ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ = ⟨ ( 1st𝑝 ) , ( 2nd𝑝 ) ⟩ ) )
60 57 58 59 3syl ( ( 𝜑𝑝 ∈ ( 𝑅𝐷 ) ) → ( ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ = 𝑝 ↔ ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ = ⟨ ( 1st𝑝 ) , ( 2nd𝑝 ) ⟩ ) )
61 fvex ( 𝐹𝑞 ) ∈ V
62 fvex ( 𝐺𝑞 ) ∈ V
63 61 62 opth ( ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ = ⟨ ( 1st𝑝 ) , ( 2nd𝑝 ) ⟩ ↔ ( ( 𝐹𝑞 ) = ( 1st𝑝 ) ∧ ( 𝐺𝑞 ) = ( 2nd𝑝 ) ) )
64 60 63 bitrdi ( ( 𝜑𝑝 ∈ ( 𝑅𝐷 ) ) → ( ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ = 𝑝 ↔ ( ( 𝐹𝑞 ) = ( 1st𝑝 ) ∧ ( 𝐺𝑞 ) = ( 2nd𝑝 ) ) ) )
65 64 anbi2d ( ( 𝜑𝑝 ∈ ( 𝑅𝐷 ) ) → ( ( 𝑞𝐴 ∧ ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ = 𝑝 ) ↔ ( 𝑞𝐴 ∧ ( ( 𝐹𝑞 ) = ( 1st𝑝 ) ∧ ( 𝐺𝑞 ) = ( 2nd𝑝 ) ) ) ) )
66 53 65 bitr4d ( ( 𝜑𝑝 ∈ ( 𝑅𝐷 ) ) → ( 𝑞 ∈ ( ( 𝐹 “ { ( 1st𝑝 ) } ) ∩ ( 𝐺 “ { ( 2nd𝑝 ) } ) ) ↔ ( 𝑞𝐴 ∧ ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ = 𝑝 ) ) )
67 66 rexbidva ( 𝜑 → ( ∃ 𝑝 ∈ ( 𝑅𝐷 ) 𝑞 ∈ ( ( 𝐹 “ { ( 1st𝑝 ) } ) ∩ ( 𝐺 “ { ( 2nd𝑝 ) } ) ) ↔ ∃ 𝑝 ∈ ( 𝑅𝐷 ) ( 𝑞𝐴 ∧ ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ = 𝑝 ) ) )
68 abid ( 𝑞 ∈ { 𝑞 ∣ ∃ 𝑝 ∈ ( 𝑅𝐷 ) ( 𝑞𝐴 ∧ ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ = 𝑝 ) } ↔ ∃ 𝑝 ∈ ( 𝑅𝐷 ) ( 𝑞𝐴 ∧ ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ = 𝑝 ) )
69 67 68 bitr4di ( 𝜑 → ( ∃ 𝑝 ∈ ( 𝑅𝐷 ) 𝑞 ∈ ( ( 𝐹 “ { ( 1st𝑝 ) } ) ∩ ( 𝐺 “ { ( 2nd𝑝 ) } ) ) ↔ 𝑞 ∈ { 𝑞 ∣ ∃ 𝑝 ∈ ( 𝑅𝐷 ) ( 𝑞𝐴 ∧ ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ = 𝑝 ) } ) )
70 42 69 bitr2id ( 𝜑 → ( 𝑞 ∈ { 𝑞 ∣ ∃ 𝑝 ∈ ( 𝑅𝐷 ) ( 𝑞𝐴 ∧ ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ = 𝑝 ) } ↔ 𝑞 𝑝 ∈ ( 𝑅𝐷 ) ( ( 𝐹 “ { ( 1st𝑝 ) } ) ∩ ( 𝐺 “ { ( 2nd𝑝 ) } ) ) ) )
71 39 40 41 70 eqrd ( 𝜑 → { 𝑞 ∣ ∃ 𝑝 ∈ ( 𝑅𝐷 ) ( 𝑞𝐴 ∧ ⟨ ( 𝐹𝑞 ) , ( 𝐺𝑞 ) ⟩ = 𝑝 ) } = 𝑝 ∈ ( 𝑅𝐷 ) ( ( 𝐹 “ { ( 1st𝑝 ) } ) ∩ ( 𝐺 “ { ( 2nd𝑝 ) } ) ) )
72 38 71 eqtrid ( 𝜑 → { 𝑞 ∣ ∃ 𝑝 ∈ ( 𝑅𝐷 ) 𝑝 ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) 𝑞 } = 𝑝 ∈ ( 𝑅𝐷 ) ( ( 𝐹 “ { ( 1st𝑝 ) } ) ∩ ( 𝐺 “ { ( 2nd𝑝 ) } ) ) )
73 16 72 eqtrid ( 𝜑 → ( ( 𝑠𝐴 ↦ ⟨ ( 𝐹𝑠 ) , ( 𝐺𝑠 ) ⟩ ) “ ( 𝑅𝐷 ) ) = 𝑝 ∈ ( 𝑅𝐷 ) ( ( 𝐹 “ { ( 1st𝑝 ) } ) ∩ ( 𝐺 “ { ( 2nd𝑝 ) } ) ) )
74 15 73 eqtrd ( 𝜑 → ( ( 𝐹f 𝑅 𝐺 ) “ 𝐷 ) = 𝑝 ∈ ( 𝑅𝐷 ) ( ( 𝐹 “ { ( 1st𝑝 ) } ) ∩ ( 𝐺 “ { ( 2nd𝑝 ) } ) ) )