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

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?
How to prove the reversion of a doubling function equals the doubling of a reversion function in Isabelle?
Giving a list a partial order in Isabelle/HOLCF

Categories

HOME
arduino-uno
mediawiki
fft
disassembler
bs4
portia
paradox
cross-validation
applepay
gnupg
mapserver
correlation
visual-studio-2005
pc
http-status-code-504
oracle-coherence
nhibernate-envers
ml
one-hot-encoding
web-sql
wkwebview
kudan
mmap
firebase-crash-reporting
facet
uninstall
tooltipster
gitignore
kendo-datasource
wallpaper
force-layout
sequential
bower-install
main
web-mining
x11-forwarding
theano.scan
angularjs-factory
elmah
cubic-spline
rainbowtable
jedis
errordocument
ionicons
sage-one
directory-structure
or-tools
migradoc
root-framework
nested-sets
parallel-data-warehouse
gridpane
log4c
azure-virtual-network
transmitfile
qpid
multiple-regression
prettytensor
ptrace
simple-framework
tableau-online
ibaction
apache-commons-fileupload
remobjects
umbraco6
google-style-guide
asp.net-web-api-odata
device-manager
onactivityresult
algebraic-data-types
html5-notifications
terminal-services
runtime.exec
soundtouch
ril
comaddin
cassini-dev
typoscript2
pvrtc
venn-diagram
labwindows
appconkit
chrono
pydot
deobfuscation
celltable
gdlib
imac
gallio
dmx512
sef
ti-dsp
ctp4
aquaticprime
putchar
grid-system
uiq3

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