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

Embedding SMT in Isabelle/HOL functions
Termination proof for function on datatype involving a map
Isabelle HOLCF doesn't understand fixrec
Isabelle function to find the longest sequence of members of a relation
Is it possible to run Isabelle 2005 proofs with Proof General?
Multicast using Isabelle
Mutual recursion in primcofix
How to prove that addition of a new variable to the expression doesn't change its semantics?
How to define functions with overlapping patterns?
Non-terminating inductive predicates
Parts of mathematics not yet formalized / Isabelle wishlist
Instantiating theorems in Isabelle
Proving a basic identity in Isabelle
Error in an Isabelle function definition taken from lecture notes
Proving the cardinality of a more involved set
Function returns 0 when it should return 1, eliminating parantheses

Categories

HOME
magnific-popup
homebrew
view
include
rsyslog
yum
wamp
fancybox
mouse
constraint-programming
communication
nano-server
kentor-authservices
izpack
mapserver
modelica
qt-creator
correlation
google-cloud-spanner
alignment
remote-access
event-handling
libtiff
finite-automata
visual-composer
plunker
predix
wkwebview
google-search-api
autosys
smb
tdd
info.plist
filezilla
xacml
madlib
airconsole
typed.js
pim
windows-dev-center
language-concepts
rotational-matrices
environment-modules
mapdb
bytecode-manipulation
sqlite2
sas-visual-analytics
s
logfiles
filepicker
powercli
veracode
magma
pg-dump
r-forge
akka-cluster
dwscript
account-kit
word-vba-mac
gridpane
probability-density
skobbler-maps
ctest
clang-static-analyzer
itextpdf
xpath-1.0
msys
marching-cubes
cyclomatic-complexity
ruby-2.2
arcanist
iiviewdeckcontroller
system32
angular-local-storage
directoryservices
block-device
ng-animate
knuth
winddk
internet-connection
elliptic-curve
resty-gwt
balanced-payments
gnu-smalltalk
gridfs
web2py-modules
shellexecute
ember-app-kit
jelly
kyotocabinet
quickdialog
google-email-migration
armcc
postgresql-performance
adk
external-accessory
infobox
coercion
paster
infrastructure
nsviewanimation
database-management
scripting-languages

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App