Skip to content

Commit

Permalink
lib/monads: use experiment for demo lemmas
Browse files Browse the repository at this point in the history
Use the experiment context to discard demo lemmas from the theory in the
Monad session. Some of these demo lemmas confuse sledgehammer.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
  • Loading branch information
lsf37 committed Dec 2, 2024
1 parent c9c4d49 commit 33ba304
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
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

0 comments on commit 33ba304

Please sign in to comment.