From 257561ff4036d0eb5b51e649f2590b61e08d6fc5 Mon Sep 17 00:00:00 2001 From: Josh Chen Date: Wed, 15 Aug 2018 12:42:52 +0200 Subject: Basic compute method --- ex/Methods.thy | 29 +++++++++++++++++++++++++++++ ex/Synthesis.thy | 10 +++++----- 2 files changed, 34 insertions(+), 5 deletions(-) (limited to 'ex') diff --git a/ex/Methods.thy b/ex/Methods.thy index 699d620..871964f 100644 --- a/ex/Methods.thy +++ b/ex/Methods.thy @@ -10,6 +10,8 @@ theory Methods begin +text "Wellformedness results, metatheorems written into the object theory using the wellformedness rules." + lemma assumes "A : U(i)" "B: A \ U(i)" "\x. x : A \ C x: B x \ U(i)" shows "\x:A. \y:B x. \z:C x y. \w:A. x =\<^sub>A w : U(i)" @@ -45,4 +47,31 @@ apply (rule Sum_intro) apply assumption+ done + +text " + Function application. + The proof methods are not yet automated as well as I would like; we still often have to explicitly specify types. +" + +lemma + assumes "A: U(i)" "a: A" + shows "(\<^bold>\x. )`a \ " +proof compute + show "\x. x: A \ : A \ \" by simple +qed (simple lems: assms) + + +lemma + assumes "A: U(i)" "B: A \ U(i)" "a: A" "b: B(a)" + shows "(\<^bold>\x y. )`a`b \ " +proof compute + show "\x. x: A \ \<^bold>\y. : \y:B(x). \x:A. B(x)" by (simple lems: assms) + + show "(\<^bold>\b. )`b \ " + proof compute + show "\b. b: B(a) \ : \x:A. B(x)" by (simple lems: assms) + qed fact +qed fact + + end \ No newline at end of file diff --git a/ex/Synthesis.thy b/ex/Synthesis.thy index 48d762c..ef6673c 100644 --- a/ex/Synthesis.thy +++ b/ex/Synthesis.thy @@ -33,8 +33,8 @@ text " " schematic_goal "?p`0 \ 0" and "\n. n: \ \ (?p`(succ n)) \ n" -apply (subst comp) -prefer 4 apply (subst comp) +apply compute +prefer 4 apply compute prefer 3 apply (rule Nat_rules) apply (rule Nat_rules | assumption)+ done @@ -51,7 +51,7 @@ lemma pred_type: "pred: \ \ \" unfolding pred_def by simpl lemma pred_props: "\n. refl(n)>: ((pred`0) =\<^sub>\ 0) \ (\n:\. (pred`(succ n)) =\<^sub>\ n)" proof (simple lems: pred_type) have *: "pred`0 \ 0" unfolding pred_def - proof (subst comp) + proof compute show "\n. n: \ \ ind\<^sub>\ (\a b. a) n n: \" by simple show "ind\<^sub>\ (\a b. a) 0 0 \ 0" proof (rule Nat_comps) @@ -63,10 +63,10 @@ proof (simple lems: pred_type) show "\<^bold>\n. refl(n): \n:\. (pred`(succ(n))) =\<^sub>\ n" unfolding pred_def proof show "\n. n: \ \ refl(n): ((\<^bold>\n. ind\<^sub>\ (\a b. a) n n)`succ(n)) =\<^sub>\ n" - proof (subst comp) + proof compute show "\n. n: \ \ ind\<^sub>\ (\a b. a) n n: \" by simple show "\n. n: \ \ refl(n): ind\<^sub>\ (\a b. a) (succ n) (succ n) =\<^sub>\ n" - proof (subst comp) + proof compute show "\: U(O)" .. qed simple qed rule -- cgit v1.2.3