(* Title: A Definitional Encoding of TLA in Isabelle/HOL Authors:GudmundGrov<ggrovatinf.ed.ac.uk> StephanMerz<Stephan.Merzatloria.fr> Year:2011 Maintainer:GudmundGrov<ggrovatinf.ed.ac.uk>
*)
section‹Representing Intensional Logic›
theory Intensional imports Main begin
text‹
In higher-order logic, every proof rule has a corresponding tautology, i.e.
the \emph{deduction theorem} holds. Isabelle/HOL implements this since object-level
implication ($\longrightarrow$) and meta-level entailment ($\Longrightarrow$)
commute, viz. the proof rule ‹impI:› @{thm impI}.
However, the deduction theorem does not hold for
most modal and temporal logics cite‹‹page 95› in "Lamport02"›cite‹"Merz98"›.
For example $A \vdash\Box A$ holds, meaning that if $A$ holds in any world, then
it always holds. However, $\vdash A \longrightarrow\Box A$, stating that
$A$ always holds if it initially holds, is not valid.
Merz cite‹"Merz98"› overcame this problem by creating an
@{term Intensional} logic. It exploits Isabelle's
axiomatic type class feature cite‹"Wenzel00b"› by creating a type
class @{term world}, which provides Skolem constants to associate formulas
with the world they hold in. The class is trivial, not requiring any axioms. ›
class world text‹
@{term world} is a type class of possible worlds. It is a subclass
of all HOL types @{term type}. No axioms are provided, since its only
purpose is to avoid silly use of the @{term Intensional} syntax. ›
text‹The intention is that @{typ 'a} will be used for unlifted
(class @{term type}), while @{typ 'w} is lifted (class @{term world}). ›
definition Valid :: "('w::world) form ==> bool" where"Valid A ≡∀w. A w"
definition const :: "'a ==> ('w::world, 'a) expr" where unl_con: "const c w ≡ c"
definition lift :: "['a ==> 'b, ('w::world, 'a) expr] ==> ('w,'b) expr" where unl_lift: "lift f x w ≡ f (x w)"
definition lift2 :: "['a ==> 'b ==> 'c, ('w::world,'a) expr, ('w,'b) expr] ==> ('w,'c) expr" where unl_lift2: "lift2 f x y w ≡ f (x w) (y w)"
definition lift3 :: "['a ==> 'b => 'c ==> 'd, ('w::world,'a) expr, ('w,'b) expr, ('w,'c) expr] ==> ('w,'d) expr" where unl_lift3: "lift3 f x y z w ≡ f (x w) (y w) (z w)"
definition lift4 :: "['a ==> 'b => 'c ==> 'd ==> 'e, ('w::world,'a) expr, ('w,'b) expr, ('w,'c) expr,('w,'d) expr] ==> ('w,'e) expr" where unl_lift4: "lift4 f x y z zz w ≡ f (x w) (y w) (z w) (zz w)"
text‹
@{term "Valid F"} asserts that the lifted formula @{term F} holds everywhere.
@{term const} allows lifting of a constant, while @{term lift} through
@{term lift4} allow functions with arity 1--4 to be lifted. (Note that there
is no way to define a generic lifting operator for functions of arbitrary arity.) ›
definition RAll :: "('a ==> ('w::world) form) ==> 'w form" (binder‹Rall ›10) where unl_Rall: "(Rall x. A x) w ≡∀x. A x w"
definition REx :: "('a ==> ('w::world) form) ==> 'w form" (binder‹Rex ›10) where unl_Rex: "(Rex x. A x) w ≡∃x. A x w"
definition REx1 :: "('a ==> ('w::world) form) ==> 'w form" (binder‹Rex! ›10) where unl_Rex1: "(Rex! x. A x) w ≡∃!x. A x w"
text‹
@{term RAll}, @{term REx} and @{term REx1} introduces ``rigid'' quantification
over values (of non-world types) within ``intensional'' formulas. @{term RAll}
is universal quantification, @{term REx} is existential quantifcation.
@{term REx1} requires unique existence. ›
text‹
We declare the ``unlifting rules'' as rewrite rules that will be applied
automatically. ›
text‹
The non-terminal @{term lift} represents lifted expressions. The idea is to use
Isabelle's macro mechanism to convert between the concrete and abstract syntax. ›
translations "_liftFinset (_liftargs x xs)"⇌"_lift2 (CONST insert) x (_liftFinset xs)" "_liftFinset x"⇌"_lift2 (CONST insert) x (_const (CONST Set.empty))" "_liftPair x (_liftargs y z)"⇌"_liftPair x (_liftPair y z)" "_liftPair"⇌"_lift2 (CONST Pair)" "_liftCons"⇌"_lift2 (CONST Cons)" "_liftApp"⇌"_lift2 (@)" "_liftList (_liftargs x xs)"⇌"_liftCons x (_liftList xs)" "_liftList x"⇌"_liftCons x (_const [])"
"w ⊨¬ A"↽"_liftNot A w" "w ⊨ A ∧ B"↽"_liftAnd A B w" "w ⊨ A ∨ B"↽"_liftOr A B w" "w ⊨ A ⟶ B"↽"_liftImp A B w" "w ⊨ u = v"↽"_liftEqu u v w" "w ⊨∀x. A"↽"_RAll x A w" "w ⊨∃x. A"↽"_REx x A w" "w ⊨∃!x. A"↽"_REx1 x A w"
lemma intD[dest]: "⊨ A ==> w ⊨ A" proof - assume a:"⊨ A" from a have"∀w. w ⊨ A"by (auto simp add: Valid_def) thus ?thesis .. qed
lemma intI [intro!]: assumes P1:"(∧ w. w ⊨ A)"shows"⊨ A" using assms by (auto simp: Valid_def)
text‹
Basic unlifting introduces a parameter @{term w} and applies basic rewrites, e.g
@{term "⊨ F = G"} becomes @{term "F w = G w"} and @{term "⊨ F ⟶ G"} becomes
@{term "F w ⟶ G w"}. ›
method_setup int_unlift = ‹
Scan.succeed (fn ctxt => SIMPLE_METHOD'
(resolve_tac ctxt @{thms intI} THEN' rewrite_goal_tac ctxt @{thms intensional_rews})) ›"method to unlift and followed by intensional rewrites"
lemma inteq_reflection: assumes P1: "⊨ x=y"shows"(x ≡ y)" proof - from P1 have P2: "∀w. x w = y w"by (unfold Valid_def unl_lift2) hence P3:"x=y"by blast thus"x ≡ y"by (rule "eq_reflection") qed
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.