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.

Related Links

How to define Subtypes in Isabelle and what they mean?
type_synonym vs consts in Isabelle definition
Organizing constraints in isabelle in order to model a system
Trouble with Int Theory in Isabelle/HOL
How do I do simple multithreading in Isabelle ML?
Isabelle: Proof on difference between 2 lists
Printing out / showing detailed steps of proof methods (like simp) in a proof in isabelle
Defining disjoint union of different types in Isabelle and more
Case names for locale interpretation
“invalid map function” when defining a corecursive tree
Trying to generalize a bit vector that uses typedef, bool list, and nat length
Factoring out a lemma premise as a definition causes failure in proof method (auto) application in isabelle
How do I convert “thm conjI” to an ASCII string I can save to a file?
Express that a function is constant on a set
What's the difference between the empty sort, 'a::{}, and a sort of “type”, 'a::type
How can I pass a ML value as an argument to an outer syntax command?

Categories

HOME
netsuite
reflection
grep
objectgears
mean-stack
rsyslog
gis
setup-deployment
youtube-api-v3
cakephp-2.5
ebean
flyway4
convolution
google-translate
vault
offline
export-to-csv
zebra-printers
try-catch
caml
facebook-page
oxyplot
django-cms
textfield
mps
crosstab
spark-jobserver
greendao
facebook-apps
libuv
frame
catel
phpfreechat
revolution-slider
web-mining
android-browser
service-discovery
optix
password-encryption
mime
node-sass
businessworks
wso2carbon
hibernate-tools
revapi
datastax-startup
alphabet
chord-diagram
eventkit
nested-sets
medium.com
static-ip-address
spring-android
grails-tomcat-plugin
asp.net-4.5
pcf
impresspages
two-factor-authentication
phpcas
freedesktop.org
iad
msys
t4mvc
retina
simple-framework
atk4
computer-algebra-systems
appfabric-cache
nsight
sniffer
remobjects
kineticjs
nstableviewcell
document-classification
jquery-layout
phpthumb
kgdb
rtmfp
bundles
ivyde
eclipse-memory-analyzer
http-unit
delphi-6
dmoz
mt
armcc
jmock
lang
cxxtest
gin
audio-capture
mtj
uimenucontroller
3gp

Resources

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