datatype (plugins only: code extraction) sumbool = Left | Right
subsection \<open>Type of extracted program\<close>
extract_type "typeof (Trueprop P) \ typeof P"
"typeof P \ Type (TYPE(Null)) \ typeof Q \ Type (TYPE('Q)) \
typeof (P \<longrightarrow> Q) \<equiv> Type (TYPE('Q))"
"typeof Q \ Type (TYPE(Null)) \ typeof (P \ Q) \ Type (TYPE(Null))"
"typeof P \ Type (TYPE('P)) \ typeof Q \ Type (TYPE('Q)) \
typeof (P \<longrightarrow> Q) \<equiv> Type (TYPE('P \<Rightarrow> 'Q))"
"(\x. typeof (P x)) \ (\x. Type (TYPE(Null))) \
typeof (\<forall>x. P x) \<equiv> Type (TYPE(Null))"
"(\x. typeof (P x)) \ (\x. Type (TYPE('P))) \
typeof (\<forall>x::'a. P x) \<equiv> Type (TYPE('a \<Rightarrow> 'P))"
"(\x. typeof (P x)) \ (\x. Type (TYPE(Null))) \
typeof (\<exists>x::'a. P x) \<equiv> Type (TYPE('a))"
"(\x. typeof (P x)) \ (\x. Type (TYPE('P))) \
typeof (\<exists>x::'a. P x) \<equiv> Type (TYPE('a \<times> 'P))"
"typeof P \ Type (TYPE(Null)) \ typeof Q \ Type (TYPE(Null)) \
typeof (P \<or> Q) \<equiv> Type (TYPE(sumbool))"
"typeof P \ Type (TYPE(Null)) \ typeof Q \ Type (TYPE('Q)) \
typeof (P \<or> Q) \<equiv> Type (TYPE('Q option))"
"typeof P \ Type (TYPE('P)) \ typeof Q \ Type (TYPE(Null)) \
typeof (P \<or> Q) \<equiv> Type (TYPE('P option))"
"typeof P \ Type (TYPE('P)) \ typeof Q \ Type (TYPE('Q)) \
typeof (P \<or> Q) \<equiv> Type (TYPE('P + 'Q))"
"typeof P \ Type (TYPE(Null)) \ typeof Q \ Type (TYPE('Q)) \
typeof (P \<and> Q) \<equiv> Type (TYPE('Q))"
"typeof P \ Type (TYPE('P)) \ typeof Q \ Type (TYPE(Null)) \
typeof (P \<and> Q) \<equiv> Type (TYPE('P))"
"typeof P \ Type (TYPE('P)) \ typeof Q \ Type (TYPE('Q)) \
typeof (P \<and> Q) \<equiv> Type (TYPE('P \<times> 'Q))"
"typeof (P = Q) \ typeof ((P \ Q) \ (Q \ P))"
"typeof (x \ P) \ typeof P"
subsection \<open>Realizability\<close>
realizability "(realizes t (Trueprop P)) \ (Trueprop (realizes t P))"
"(typeof P) \ (Type (TYPE(Null))) \
(realizes t (P \<longrightarrow> Q)) \<equiv> (realizes Null P \<longrightarrow> realizes t Q)"
"(typeof P) \ (Type (TYPE('P))) \
(typeof Q) \<equiv> (Type (TYPE(Null))) \<Longrightarrow>
(realizes t (P \<longrightarrow> Q)) \<equiv> (\<forall>x::'P. realizes x P \<longrightarrow> realizes Null Q)"
"(realizes t (P \ Q)) \ (\x. realizes x P \ realizes (t x) Q)"
"(\x. typeof (P x)) \ (\x. Type (TYPE(Null))) \
(realizes t (\<forall>x. P x)) \<equiv> (\<forall>x. realizes Null (P x))"
"(realizes t (\x. P x)) \ (\x. realizes (t x) (P x))"
"(\x. typeof (P x)) \ (\x. Type (TYPE(Null))) \
(realizes t (\<exists>x. P x)) \<equiv> (realizes Null (P t))"
"(realizes t (\x. P x)) \ (realizes (snd t) (P (fst t)))"
"(typeof P) \ (Type (TYPE(Null))) \
(typeof Q) \<equiv> (Type (TYPE(Null))) \<Longrightarrow>
(realizes t (P \<or> Q)) \<equiv>
(case t of Left \<Rightarrow> realizes Null P | Right \<Rightarrow> realizes Null Q)"
"(typeof P) \ (Type (TYPE(Null))) \
(realizes t (P \<or> Q)) \<equiv>
(case t of None \<Rightarrow> realizes Null P | Some q \<Rightarrow> realizes q Q)"
"(typeof Q) \ (Type (TYPE(Null))) \
(realizes t (P \<or> Q)) \<equiv>
(case t of None \<Rightarrow> realizes Null Q | Some p \<Rightarrow> realizes p P)"
"(realizes t (P \ Q)) \
(case t of Inl p \<Rightarrow> realizes p P | Inr q \<Rightarrow> realizes q Q)"
"(typeof P) \ (Type (TYPE(Null))) \
(realizes t (P \<and> Q)) \<equiv> (realizes Null P \<and> realizes t Q)"
"(typeof Q) \ (Type (TYPE(Null))) \
(realizes t (P \<and> Q)) \<equiv> (realizes t P \<and> realizes Null Q)"
"(realizes t (P \ Q)) \ (realizes (fst t) P \ realizes (snd t) Q)"
"typeof P \ Type (TYPE(Null)) \
realizes t (\<not> P) \<equiv> \<not> realizes Null P"
"typeof P \ Type (TYPE('P)) \
realizes t (\<not> P) \<equiv> (\<forall>x::'P. \<not> realizes x P)"
"typeof (P::bool) \ Type (TYPE(Null)) \
typeof Q \<equiv> Type (TYPE(Null)) \<Longrightarrow>
realizes t (P = Q) \<equiv> realizes Null P = realizes Null Q"
"(realizes t (P = Q)) \ (realizes t ((P \ Q) \ (Q \ P)))"
subsection \<open>Computational content of basic inference rules\<close>
theorem disjE_realizer: assumes r: "case x of Inl p \ P p | Inr q \ Q q" and r1: "\p. P p \ R (f p)" and r2: "\q. Q q \ R (g q)" shows"R (case x of Inl p \ f p | Inr q \ g q)" proof (cases x) case Inl with r show ?thesis by simp (rule r1) next case Inr with r show ?thesis by simp (rule r2) qed
theorem disjE_realizer2: assumes r: "case x of None \ P | Some q \ Q q" and r1: "P \ R f" and r2: "\q. Q q \ R (g q)" shows"R (case x of None \ f | Some q \ g q)" proof (cases x) case None with r show ?thesis by simp (rule r1) next case Some with r show ?thesis by simp (rule r2) qed
theorem disjE_realizer3: assumes r: "case x of Left \ P | Right \ Q" and r1: "P \ R f" and r2: "Q \ R g" shows"R (case x of Left \ f | Right \ g)" proof (cases x) case Left with r show ?thesis by simp (rule r1) next case Right with r show ?thesis by simp (rule r2) qed
theorem conjI_realizer: "P p \ Q q \ P (fst (p, q)) \ Q (snd (p, q))" by simp
theorem exI_realizer: "P y x \ P (snd (x, y)) (fst (x, y))" by simp
theorem exE_realizer: "P (snd p) (fst p) \
(\<And>x y. P y x \<Longrightarrow> Q (f x y)) \<Longrightarrow> Q (let (x, y) = p in f x y)" by (cases p) (simp add: Let_def)
theorem exE_realizer': "P (snd p) (fst p) \
(\<And>x y. P y x \<Longrightarrow> Q) \<Longrightarrow> Q" by (cases p) simp
disjE (P, Q, R): "\pq pr qr.
(case pq of Inl p \<Rightarrow> pr p | Inr q \<Rightarrow> qr q)" "\<^bold>\(c: _) (d: _) (e: _) P Q R pq (h1: _) pr (h2: _) qr.
disjE_realizer \<cdot> _ \<cdot> _ \<cdot> pq \<cdot> R \<cdot> pr \<cdot> qr \<bullet> c \<bullet> d \<bullet> e \<bullet> h1 \<bullet> h2"
disjE (Q, R): "\pq pr qr.
(case pq of None \<Rightarrow> pr | Some q \<Rightarrow> qr q)" "\<^bold>\(c: _) (d: _) P Q R pq (h1: _) pr (h2: _) qr.
disjE_realizer2 \<cdot> _ \<cdot> _ \<cdot> pq \<cdot> R \<cdot> pr \<cdot> qr \<bullet> c \<bullet> d \<bullet> h1 \<bullet> h2"
disjE (P, R): "\pq pr qr.
(case pq of None \<Rightarrow> qr | Some p \<Rightarrow> pr p)" "\<^bold>\(c: _) (d: _) P Q R pq (h1: _) pr (h2: _) qr (h3: _).
disjE_realizer2 \<cdot> _ \<cdot> _ \<cdot> pq \<cdot> R \<cdot> qr \<cdot> pr \<bullet> c \<bullet> d \<bullet> h1 \<bullet> h3 \<bullet> h2"
disjE (R): "\pq pr qr.
(case pq of Left \<Rightarrow> pr | Right \<Rightarrow> qr)" "\<^bold>\(c: _) P Q R pq (h1: _) pr (h2: _) qr.
disjE_realizer3 \<cdot> _ \<cdot> _ \<cdot> pq \<cdot> R \<cdot> pr \<cdot> qr \<bullet> c \<bullet> h1 \<bullet> h2"
disjE (P, Q): "Null" "\<^bold>\(c: _) (d: _) P Q R pq. disjE_realizer \ _ \ _ \ pq \ (\x. R) \ _ \ _ \ c \ d \ arity_type_bool"
disjE (Q): "Null" "\<^bold>\(c: _) P Q R pq. disjE_realizer2 \ _ \ _ \ pq \ (\x. R) \ _ \ _ \ c \ arity_type_bool"
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 ist noch experimentell.