### isabelle

#### How to analyze if-expressions in assumptions?

```I'm trying to prove the following lemma:
lemma if_assumption: "(if a = 1 then 2 else 3) = 2 ⟹ a = 1"
apply (cases "a = 1")
apply simp_all
After simplification I get the following formula:
3 = 2 ⟹ a ≠ 1 ⟹ False
The result of if-expression equals 2 iff a equals 1. So, I guess that I can deduce this fact somehow.
How to prove this lemma?
```
```Your statement is not correct as you wrote it down. Numbers in Isabelle are polymorphic by default (you can check that by hovering over the numbers while pressing Ctrl). There might be a number type for which 3 = 2 holds (e.g. the finite field {0,1,2}). In that case, a may not be equal to 1.
If instead you fix the number type:
lemma if_assumption: "(if a = 1 then 2 else 3) = (2::nat) ⟹ a = 1"
the proof script you wrote goes through. Or shorter:
apply (auto split: if_splits)
... which tells the system to split the if _ then _ else _ into two subgoals.```

Database Users
RDBMS discuss
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App