isabelle


How to define a linear ordering on a type?


I'm trying to define a conjunction function for 4-valued logic (false, true, null, and error). In my case the conjunction is equivavlent to min function on linear order false < error < null < true.
datatype bool4 = JF | JT | BN | BE
instantiation bool4 :: linear_order
begin
fun leq_bool4 :: "bool4 ⇒ bool4 ⇒ bool" where
"leq_bool4 JF b = True"
| "leq_bool4 BE b = (b = BE ∨ b = BN ∨ b = JT)"
| "leq_bool4 BN b = (b = BN ∨ b = JT)"
| "leq_bool4 JT b = (b = JT)"
instance proof
fix x y z :: bool4
show "x ⊑ x"
by (induct x) simp_all
show "x ⊑ y ⟹ y ⊑ z ⟹ x ⊑ z"
by (induct x; induct y) simp_all
show "x ⊑ y ⟹ y ⊑ x ⟹ x = y"
by (induct x; induct y) simp_all
show "x ⊑ y ∨ y ⊑ x"
by (induct x; induct y) simp_all
qed
end
definition and4 :: "bool4 ⇒ bool4 ⇒ bool4" where
"and4 a b ≡ minimum a b"
I guess there must be an easier way to define a linear order in Isabelle HOL. Could you suggest a simplification of the theory?
You can use the "Datatype_Order_Generator" AFP entry.
Then it's as simple as importing "$AFP/Datatype_Order_Generator/Order_Generator" and declaring derive linorder "bool4". Note that the constructors must be declared in the order you want them when defining your datatype.
Details on how to download and use the AFP locally can be found here.

Related Links

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
Isabelle return numbers instead of Suc(Suc( … 0 ))
Finding the `card` function

Categories

HOME
listview
kde
programming-languages
yarn
microservices
electronics
sqlite3
win32gui
sql-server-2016
mvvmcross
acquia
opengl-es-2.0
wamp
multiple-records
kibana-4
tomcat6
midi
wheelnav.js
postgres-xl
dtrace
windows-server-2012
propel
evopdf
immutable.js
opencover
tokenize
extjs5
claims-based-identity
firebase-crash-reporting
h2db
spring-mybatis
publish
opentype
atlassian-crucible
react-chartjs
jspresso
wallpaper
http-referer
mpmediaquery
picasso
catalog
appfabric
space-complexity
azure-ml
dism
broadcastreceiver
galen
modelmapper
s
eclipse-gef
segment
wptoolkit
skeleton-css-boilerplate
apache-fop
prolog-setof
ionicons
hls.js
elgg
knockout-components
nsarray
r-forge
python-cryptography
pillow
arrow-keys
google-feed-api
google-web-starter-kit
fputcsv
blackberry-10
ubuntu-10.04
uid
iad
teamcity-8.0
intellij-14
simple-framework
wireshark-dissector
inmobi
umbraco6
geonetwork
nstableviewcell
jscript.net
qpainter
codeigniter-url
cdt
nsbutton
project-planning
contenttype
braille
flexmojos
uv-mapping
ruby-datamapper
flash-builder4.5
ora-00911
eventual-consistency
orchardcms-1.7
sharp-repository
tinn-r
selected
anonymous-methods
mhtml
word-processor
manchester-syntax
cascalog
onsubmit
punbb
cufon
custom-backend
window-management
blackberry-playbook
winbugs14
mongomapper
gin
getresponsestream
web-architecture
zune
w3wp

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