Skip to content

Commit f2636ad

Browse files
committed
Added "matches" predicate to prisms
1 parent 47edbcd commit f2636ad

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Prisms.thy

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ record ('v, 's) prism =
1717
type_notation
1818
prism (infixr "\<Longrightarrow>\<^sub>\<triangle>" 0)
1919

20+
definition prism_matches :: "('a \<Longrightarrow>\<^sub>\<triangle> 'e) \<Rightarrow> 'e \<Rightarrow> bool" ("matches\<index>") where
21+
"prism_matches a e = (match\<^bsub>a\<^esub> e \<noteq> None)"
22+
2023
locale wb_prism =
2124
fixes x :: "'v \<Longrightarrow>\<^sub>\<triangle> 's" (structure)
2225
assumes match_build: "match (build v) = Some v"
@@ -32,10 +35,14 @@ begin
3235
lemma inj_build: "inj build"
3336
by (metis injI match_build option.inject)
3437

38+
lemma matches_build: "matches (build v)"
39+
by (simp add: prism_matches_def match_build)
40+
3541
end
3642

3743
declare wb_prism.match_build [simp]
3844
declare wb_prism.build_match [simp]
45+
declare wb_prism.matches_build [simp]
3946

4047
subsection \<open> Co-dependence \<close>
4148

0 commit comments

Comments
 (0)