Metamath Proof Explorer


Theorem elim2if

Description: Elimination of two conditional operators contained in a wff ch . (Contributed by Thierry Arnoux, 25-Jan-2017)

Ref Expression
Hypotheses elim2if.1 ( if ( 𝜑 , 𝐴 , if ( 𝜓 , 𝐵 , 𝐶 ) ) = 𝐴 → ( 𝜒𝜃 ) )
elim2if.2 ( if ( 𝜑 , 𝐴 , if ( 𝜓 , 𝐵 , 𝐶 ) ) = 𝐵 → ( 𝜒𝜏 ) )
elim2if.3 ( if ( 𝜑 , 𝐴 , if ( 𝜓 , 𝐵 , 𝐶 ) ) = 𝐶 → ( 𝜒𝜂 ) )
Assertion elim2if ( 𝜒 ↔ ( ( 𝜑𝜃 ) ∨ ( ¬ 𝜑 ∧ ( ( 𝜓𝜏 ) ∨ ( ¬ 𝜓𝜂 ) ) ) ) )

Proof

Step Hyp Ref Expression
1 elim2if.1 ( if ( 𝜑 , 𝐴 , if ( 𝜓 , 𝐵 , 𝐶 ) ) = 𝐴 → ( 𝜒𝜃 ) )
2 elim2if.2 ( if ( 𝜑 , 𝐴 , if ( 𝜓 , 𝐵 , 𝐶 ) ) = 𝐵 → ( 𝜒𝜏 ) )
3 elim2if.3 ( if ( 𝜑 , 𝐴 , if ( 𝜓 , 𝐵 , 𝐶 ) ) = 𝐶 → ( 𝜒𝜂 ) )
4 iftrue ( 𝜑 → if ( 𝜑 , 𝐴 , if ( 𝜓 , 𝐵 , 𝐶 ) ) = 𝐴 )
5 4 1 syl ( 𝜑 → ( 𝜒𝜃 ) )
6 iffalse ( ¬ 𝜑 → if ( 𝜑 , 𝐴 , if ( 𝜓 , 𝐵 , 𝐶 ) ) = if ( 𝜓 , 𝐵 , 𝐶 ) )
7 6 eqeq1d ( ¬ 𝜑 → ( if ( 𝜑 , 𝐴 , if ( 𝜓 , 𝐵 , 𝐶 ) ) = 𝐵 ↔ if ( 𝜓 , 𝐵 , 𝐶 ) = 𝐵 ) )
8 7 2 syl6bir ( ¬ 𝜑 → ( if ( 𝜓 , 𝐵 , 𝐶 ) = 𝐵 → ( 𝜒𝜏 ) ) )
9 6 eqeq1d ( ¬ 𝜑 → ( if ( 𝜑 , 𝐴 , if ( 𝜓 , 𝐵 , 𝐶 ) ) = 𝐶 ↔ if ( 𝜓 , 𝐵 , 𝐶 ) = 𝐶 ) )
10 9 3 syl6bir ( ¬ 𝜑 → ( if ( 𝜓 , 𝐵 , 𝐶 ) = 𝐶 → ( 𝜒𝜂 ) ) )
11 8 10 elimifd ( ¬ 𝜑 → ( 𝜒 ↔ ( ( 𝜓𝜏 ) ∨ ( ¬ 𝜓𝜂 ) ) ) )
12 5 11 cases ( 𝜒 ↔ ( ( 𝜑𝜃 ) ∨ ( ¬ 𝜑 ∧ ( ( 𝜓𝜏 ) ∨ ( ¬ 𝜓𝜂 ) ) ) ) )