Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib/monads: use experiment for demo lemmas #832

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Monads/wp/Datatype_Schematic.thy
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ declare option.sel[datatype_schematic]
declare list.sel(1,3)[datatype_schematic]
declare sum.sel[datatype_schematic]

locale datatype_schem_demo begin
experiment begin

lemma handles_nested_constructors:
"\<exists>f. \<forall>y. f True (Some [x, (y, z)]) = y"
Expand Down
5 changes: 5 additions & 0 deletions lib/Monads/wp/WPBang.thy
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ method_setup wpe = \<open>WP_Safe.wpe_args\<close>

text \<open>Testing.\<close>

experiment
begin

lemma
assumes x: "\<lbrace> P \<rbrace> f \<lbrace> \<lambda>rv. Q \<rbrace>"
and y: "\<lbrace> P \<rbrace> f \<lbrace> \<lambda>rv. R \<rbrace>"
Expand All @@ -71,3 +74,5 @@ lemma
done

end

end
11 changes: 9 additions & 2 deletions lib/Monads/wp/WPFix.thy
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ end

method_setup wpfix = \<open>WPFix.method\<close>

experiment
begin

lemma demo1:
"(\<exists>Ia Ib Ic Id Ra.
(Ia (Suc 0) \<longrightarrow> Qa)
Expand Down Expand Up @@ -260,10 +263,14 @@ lemma demo2:
\<comment> \<open>
Shows how to use @{attribute datatype_schematic} rules as "accessors".
\<close>
lemma (in datatype_schem_demo) demo3:
datatype foo = basic (a:nat) (b:int) | another nat

lemma demo3:
"\<exists>x. \<forall>a b. x (basic a b) = a"
apply (rule exI, (rule allI)+)
apply (wpfix add: get_basic_0.simps) \<comment> \<open>Only exposes `a` to the schematic.\<close>
apply (wpfix add: foo.sel(1)) \<comment> \<open>Only exposes `a` to the schematic.\<close>
by (rule refl)

end

end
5 changes: 5 additions & 0 deletions lib/Monads/wp/WP_Pre.thy
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ named_theorems wp_pre
method wp_pre0 = pre_tac wp_pre
method wp_pre = wp_pre0?

experiment
begin

definition
test_wp_pre :: "bool \<Rightarrow> bool \<Rightarrow> bool"
where
Expand All @@ -121,3 +124,5 @@ lemma demo:
done

end

end
Loading