Metamath Proof Explorer


Theorem fnwe

Description: A variant on lexicographic order, which sorts first by some function of the base set, and then by a "backup" well-ordering when the function value is equal on both elements. (Contributed by Mario Carneiro, 10-Mar-2013) (Revised by Mario Carneiro, 18-Nov-2014)

Ref Expression
Hypotheses fnwe.1 𝑇 = { ⟨ 𝑥 , 𝑦 ⟩ ∣ ( ( 𝑥𝐴𝑦𝐴 ) ∧ ( ( 𝐹𝑥 ) 𝑅 ( 𝐹𝑦 ) ∨ ( ( 𝐹𝑥 ) = ( 𝐹𝑦 ) ∧ 𝑥 𝑆 𝑦 ) ) ) }
fnwe.2 ( 𝜑𝐹 : 𝐴𝐵 )
fnwe.3 ( 𝜑𝑅 We 𝐵 )
fnwe.4 ( 𝜑𝑆 We 𝐴 )
fnwe.5 ( 𝜑 → ( 𝐹𝑤 ) ∈ V )
Assertion fnwe ( 𝜑𝑇 We 𝐴 )

Proof

Step Hyp Ref Expression
1 fnwe.1 𝑇 = { ⟨ 𝑥 , 𝑦 ⟩ ∣ ( ( 𝑥𝐴𝑦𝐴 ) ∧ ( ( 𝐹𝑥 ) 𝑅 ( 𝐹𝑦 ) ∨ ( ( 𝐹𝑥 ) = ( 𝐹𝑦 ) ∧ 𝑥 𝑆 𝑦 ) ) ) }
2 fnwe.2 ( 𝜑𝐹 : 𝐴𝐵 )
3 fnwe.3 ( 𝜑𝑅 We 𝐵 )
4 fnwe.4 ( 𝜑𝑆 We 𝐴 )
5 fnwe.5 ( 𝜑 → ( 𝐹𝑤 ) ∈ V )
6 eqid { ⟨ 𝑢 , 𝑣 ⟩ ∣ ( ( 𝑢 ∈ ( 𝐵 × 𝐴 ) ∧ 𝑣 ∈ ( 𝐵 × 𝐴 ) ) ∧ ( ( 1st𝑢 ) 𝑅 ( 1st𝑣 ) ∨ ( ( 1st𝑢 ) = ( 1st𝑣 ) ∧ ( 2nd𝑢 ) 𝑆 ( 2nd𝑣 ) ) ) ) } = { ⟨ 𝑢 , 𝑣 ⟩ ∣ ( ( 𝑢 ∈ ( 𝐵 × 𝐴 ) ∧ 𝑣 ∈ ( 𝐵 × 𝐴 ) ) ∧ ( ( 1st𝑢 ) 𝑅 ( 1st𝑣 ) ∨ ( ( 1st𝑢 ) = ( 1st𝑣 ) ∧ ( 2nd𝑢 ) 𝑆 ( 2nd𝑣 ) ) ) ) }
7 eqid ( 𝑧𝐴 ↦ ⟨ ( 𝐹𝑧 ) , 𝑧 ⟩ ) = ( 𝑧𝐴 ↦ ⟨ ( 𝐹𝑧 ) , 𝑧 ⟩ )
8 1 2 3 4 5 6 7 fnwelem ( 𝜑𝑇 We 𝐴 )