Metamath Proof Explorer


Theorem nnwos

Description: Well-ordering principle: any nonempty set of positive integers has a least element (schema form). (Contributed by NM, 17-Aug-2001)

Ref Expression
Hypothesis nnwos.1 ( 𝑥 = 𝑦 → ( 𝜑𝜓 ) )
Assertion nnwos ( ∃ 𝑥 ∈ ℕ 𝜑 → ∃ 𝑥 ∈ ℕ ( 𝜑 ∧ ∀ 𝑦 ∈ ℕ ( 𝜓𝑥𝑦 ) ) )

Proof

Step Hyp Ref Expression
1 nnwos.1 ( 𝑥 = 𝑦 → ( 𝜑𝜓 ) )
2 nfrab1 𝑥 { 𝑥 ∈ ℕ ∣ 𝜑 }
3 nfcv 𝑦 { 𝑥 ∈ ℕ ∣ 𝜑 }
4 2 3 nnwof ( ( { 𝑥 ∈ ℕ ∣ 𝜑 } ⊆ ℕ ∧ { 𝑥 ∈ ℕ ∣ 𝜑 } ≠ ∅ ) → ∃ 𝑥 ∈ { 𝑥 ∈ ℕ ∣ 𝜑 } ∀ 𝑦 ∈ { 𝑥 ∈ ℕ ∣ 𝜑 } 𝑥𝑦 )
5 ssrab2 { 𝑥 ∈ ℕ ∣ 𝜑 } ⊆ ℕ
6 5 biantrur ( { 𝑥 ∈ ℕ ∣ 𝜑 } ≠ ∅ ↔ ( { 𝑥 ∈ ℕ ∣ 𝜑 } ⊆ ℕ ∧ { 𝑥 ∈ ℕ ∣ 𝜑 } ≠ ∅ ) )
7 rabn0 ( { 𝑥 ∈ ℕ ∣ 𝜑 } ≠ ∅ ↔ ∃ 𝑥 ∈ ℕ 𝜑 )
8 6 7 bitr3i ( ( { 𝑥 ∈ ℕ ∣ 𝜑 } ⊆ ℕ ∧ { 𝑥 ∈ ℕ ∣ 𝜑 } ≠ ∅ ) ↔ ∃ 𝑥 ∈ ℕ 𝜑 )
9 df-rex ( ∃ 𝑥 ∈ { 𝑥 ∈ ℕ ∣ 𝜑 } ∀ 𝑦 ∈ { 𝑥 ∈ ℕ ∣ 𝜑 } 𝑥𝑦 ↔ ∃ 𝑥 ( 𝑥 ∈ { 𝑥 ∈ ℕ ∣ 𝜑 } ∧ ∀ 𝑦 ∈ { 𝑥 ∈ ℕ ∣ 𝜑 } 𝑥𝑦 ) )
10 rabid ( 𝑥 ∈ { 𝑥 ∈ ℕ ∣ 𝜑 } ↔ ( 𝑥 ∈ ℕ ∧ 𝜑 ) )
11 df-ral ( ∀ 𝑦 ∈ { 𝑥 ∈ ℕ ∣ 𝜑 } 𝑥𝑦 ↔ ∀ 𝑦 ( 𝑦 ∈ { 𝑥 ∈ ℕ ∣ 𝜑 } → 𝑥𝑦 ) )
12 1 elrab ( 𝑦 ∈ { 𝑥 ∈ ℕ ∣ 𝜑 } ↔ ( 𝑦 ∈ ℕ ∧ 𝜓 ) )
13 12 imbi1i ( ( 𝑦 ∈ { 𝑥 ∈ ℕ ∣ 𝜑 } → 𝑥𝑦 ) ↔ ( ( 𝑦 ∈ ℕ ∧ 𝜓 ) → 𝑥𝑦 ) )
14 impexp ( ( ( 𝑦 ∈ ℕ ∧ 𝜓 ) → 𝑥𝑦 ) ↔ ( 𝑦 ∈ ℕ → ( 𝜓𝑥𝑦 ) ) )
15 13 14 bitri ( ( 𝑦 ∈ { 𝑥 ∈ ℕ ∣ 𝜑 } → 𝑥𝑦 ) ↔ ( 𝑦 ∈ ℕ → ( 𝜓𝑥𝑦 ) ) )
16 15 albii ( ∀ 𝑦 ( 𝑦 ∈ { 𝑥 ∈ ℕ ∣ 𝜑 } → 𝑥𝑦 ) ↔ ∀ 𝑦 ( 𝑦 ∈ ℕ → ( 𝜓𝑥𝑦 ) ) )
17 11 16 bitri ( ∀ 𝑦 ∈ { 𝑥 ∈ ℕ ∣ 𝜑 } 𝑥𝑦 ↔ ∀ 𝑦 ( 𝑦 ∈ ℕ → ( 𝜓𝑥𝑦 ) ) )
18 10 17 anbi12i ( ( 𝑥 ∈ { 𝑥 ∈ ℕ ∣ 𝜑 } ∧ ∀ 𝑦 ∈ { 𝑥 ∈ ℕ ∣ 𝜑 } 𝑥𝑦 ) ↔ ( ( 𝑥 ∈ ℕ ∧ 𝜑 ) ∧ ∀ 𝑦 ( 𝑦 ∈ ℕ → ( 𝜓𝑥𝑦 ) ) ) )
19 18 exbii ( ∃ 𝑥 ( 𝑥 ∈ { 𝑥 ∈ ℕ ∣ 𝜑 } ∧ ∀ 𝑦 ∈ { 𝑥 ∈ ℕ ∣ 𝜑 } 𝑥𝑦 ) ↔ ∃ 𝑥 ( ( 𝑥 ∈ ℕ ∧ 𝜑 ) ∧ ∀ 𝑦 ( 𝑦 ∈ ℕ → ( 𝜓𝑥𝑦 ) ) ) )
20 df-ral ( ∀ 𝑦 ∈ ℕ ( 𝜓𝑥𝑦 ) ↔ ∀ 𝑦 ( 𝑦 ∈ ℕ → ( 𝜓𝑥𝑦 ) ) )
21 20 anbi2i ( ( ( 𝑥 ∈ ℕ ∧ 𝜑 ) ∧ ∀ 𝑦 ∈ ℕ ( 𝜓𝑥𝑦 ) ) ↔ ( ( 𝑥 ∈ ℕ ∧ 𝜑 ) ∧ ∀ 𝑦 ( 𝑦 ∈ ℕ → ( 𝜓𝑥𝑦 ) ) ) )
22 anass ( ( ( 𝑥 ∈ ℕ ∧ 𝜑 ) ∧ ∀ 𝑦 ∈ ℕ ( 𝜓𝑥𝑦 ) ) ↔ ( 𝑥 ∈ ℕ ∧ ( 𝜑 ∧ ∀ 𝑦 ∈ ℕ ( 𝜓𝑥𝑦 ) ) ) )
23 21 22 bitr3i ( ( ( 𝑥 ∈ ℕ ∧ 𝜑 ) ∧ ∀ 𝑦 ( 𝑦 ∈ ℕ → ( 𝜓𝑥𝑦 ) ) ) ↔ ( 𝑥 ∈ ℕ ∧ ( 𝜑 ∧ ∀ 𝑦 ∈ ℕ ( 𝜓𝑥𝑦 ) ) ) )
24 23 exbii ( ∃ 𝑥 ( ( 𝑥 ∈ ℕ ∧ 𝜑 ) ∧ ∀ 𝑦 ( 𝑦 ∈ ℕ → ( 𝜓𝑥𝑦 ) ) ) ↔ ∃ 𝑥 ( 𝑥 ∈ ℕ ∧ ( 𝜑 ∧ ∀ 𝑦 ∈ ℕ ( 𝜓𝑥𝑦 ) ) ) )
25 df-rex ( ∃ 𝑥 ∈ ℕ ( 𝜑 ∧ ∀ 𝑦 ∈ ℕ ( 𝜓𝑥𝑦 ) ) ↔ ∃ 𝑥 ( 𝑥 ∈ ℕ ∧ ( 𝜑 ∧ ∀ 𝑦 ∈ ℕ ( 𝜓𝑥𝑦 ) ) ) )
26 24 25 bitr4i ( ∃ 𝑥 ( ( 𝑥 ∈ ℕ ∧ 𝜑 ) ∧ ∀ 𝑦 ( 𝑦 ∈ ℕ → ( 𝜓𝑥𝑦 ) ) ) ↔ ∃ 𝑥 ∈ ℕ ( 𝜑 ∧ ∀ 𝑦 ∈ ℕ ( 𝜓𝑥𝑦 ) ) )
27 9 19 26 3bitri ( ∃ 𝑥 ∈ { 𝑥 ∈ ℕ ∣ 𝜑 } ∀ 𝑦 ∈ { 𝑥 ∈ ℕ ∣ 𝜑 } 𝑥𝑦 ↔ ∃ 𝑥 ∈ ℕ ( 𝜑 ∧ ∀ 𝑦 ∈ ℕ ( 𝜓𝑥𝑦 ) ) )
28 4 8 27 3imtr3i ( ∃ 𝑥 ∈ ℕ 𝜑 → ∃ 𝑥 ∈ ℕ ( 𝜑 ∧ ∀ 𝑦 ∈ ℕ ( 𝜓𝑥𝑦 ) ) )