fact
stringlengths
1
2.11k
type
stringclasses
27 values
library
stringclasses
888 values
imports
listlengths
0
81
filename
stringlengths
9
106
symbolic_name
stringlengths
1
113
docstring
stringlengths
0
1.34k
NF_no_trancl_step: assumes "a \<in> NF A" shows "\<forall>b. (a, b) \<notin> A\<^sup>+" proof - from assms have "\<forall>b. (a, b) \<notin> A" by auto show ?thesis proof (intro allI notI) fix b assume "(a, b) \<in> A\<^sup>+" then show False by (induct) (auto simp: \<open>\<forall>b. (a, b) \<notin> A\<close>) qed qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
NF_no_trancl_step
null
NF_Id_on_fst_image[simp]: "NF (Id_on (fst ` A)) = NF A" by force
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
NF_Id_on_fst_image
\<forall>b. (a, b) \<notin> A
fst_image_NF_Id_on[simp]: "fst ` R = Q \<Longrightarrow> NF (Id_on Q) = NF R" by force
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
fst_image_NF_Id_on
null
NF_empty[simp]: "NF {} = UNIV" by auto
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
NF_empty
null
normalizability_I: "(a, b) \<in> A\<^sup>* \<Longrightarrow> b \<in> NF A \<Longrightarrow> (a, b) \<in> A\<^sup>!" by (simp add: normalizability_def)
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
normalizability_I
null
normalizability_I': "(a, b) \<in> A\<^sup>* \<Longrightarrow> (b, c) \<in> A\<^sup>! \<Longrightarrow> (a, c) \<in> A\<^sup>!" by (auto simp add: normalizability_def)
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
normalizability_I'
null
normalizability_E: "(a, b) \<in> A\<^sup>! \<Longrightarrow> ((a, b) \<in> A\<^sup>* \<Longrightarrow> b \<in> NF A \<Longrightarrow> P) \<Longrightarrow> P" by (simp add: normalizability_def) declare normalizability_I' [intro] declare normalizability_I [intro] declare normalizability_E [elim]
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
normalizability_E
null
CR_on:: "'a rel \<Rightarrow> 'a set \<Rightarrow> bool" where "CR_on r A \<longleftrightarrow> (\<forall>a\<in>A. \<forall>b c. (a, b) \<in> r\<^sup>* \<and> (a, c) \<in> r\<^sup>* \<longrightarrow> (b, c) \<in> join r)"
definition
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
CR_on
Properties of ARSs
CR:: "'a rel \<Rightarrow> bool" where "CR r \<equiv> CR_on r UNIV"
abbreviation
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
CR
null
SN_on:: "'a rel \<Rightarrow> 'a set \<Rightarrow> bool" where "SN_on r A \<longleftrightarrow> \<not> (\<exists>f. f 0 \<in> A \<and> chain r f)"
definition
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_on
null
SN:: "'a rel \<Rightarrow> bool" where "SN r \<equiv> SN_on r UNIV"
abbreviation
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN
null
SN_def: "SN r = (\<forall>x. SN_on r {x})" unfolding SN_on_def by blast
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_def
Alternative definition of @{term "SN"}.
UNF_on:: "'a rel \<Rightarrow> 'a set \<Rightarrow> bool" where "UNF_on r A \<longleftrightarrow> (\<forall>a\<in>A. \<forall>b c. (a, b) \<in> r\<^sup>! \<and> (a, c) \<in> r\<^sup>! \<longrightarrow> b = c)"
definition
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
UNF_on
Alternative definition of @{term "SN"}.
UNF:: "'a rel \<Rightarrow> bool" where "UNF r \<equiv> UNF_on r UNIV"
abbreviation
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
UNF
null
WCR_on:: "'a rel \<Rightarrow> 'a set \<Rightarrow> bool" where "WCR_on r A \<longleftrightarrow> (\<forall>a\<in>A. \<forall>b c. (a, b) \<in> r \<and> (a, c) \<in> r \<longrightarrow> (b, c) \<in> join r)"
definition
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
WCR_on
null
WCR:: "'a rel \<Rightarrow> bool" where "WCR r \<equiv> WCR_on r UNIV"
abbreviation
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
WCR
null
WN_on:: "'a rel \<Rightarrow> 'a set \<Rightarrow> bool" where "WN_on r A \<longleftrightarrow> (\<forall>a\<in>A. \<exists>b. (a, b) \<in> r\<^sup>!)"
definition
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
WN_on
null
WN:: "'a rel \<Rightarrow> bool" where "WN r \<equiv> WN_on r UNIV" lemmas CR_defs = CR_on_def lemmas SN_defs = SN_on_def lemmas UNF_defs = UNF_on_def lemmas WCR_defs = WCR_on_def lemmas WN_defs = WN_on_def
abbreviation
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
WN
null
complete_on:: "'a rel \<Rightarrow> 'a set \<Rightarrow> bool" where "complete_on r A \<longleftrightarrow> SN_on r A \<and> CR_on r A"
definition
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
complete_on
null
complete:: "'a rel \<Rightarrow> bool" where "complete r \<equiv> complete_on r UNIV"
abbreviation
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
complete
null
semi_complete_on:: "'a rel \<Rightarrow> 'a set \<Rightarrow> bool" where "semi_complete_on r A \<longleftrightarrow> WN_on r A \<and> CR_on r A"
definition
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
semi_complete_on
null
semi_complete:: "'a rel \<Rightarrow> bool" where "semi_complete r \<equiv> semi_complete_on r UNIV" lemmas complete_defs = complete_on_def lemmas semi_complete_defs = semi_complete_on_def
abbreviation
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
semi_complete
null
UNC:: "'a rel \<Rightarrow> bool" where "UNC A \<longleftrightarrow> (\<forall>a b. a \<in> NF A \<and> b \<in> NF A \<and> (a, b) \<in> A\<^sup>\<leftrightarrow>\<^sup>* \<longrightarrow> a = b)"
definition
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
UNC
Unique normal forms with respect to conversion.
complete_onI: "SN_on r A \<Longrightarrow> CR_on r A \<Longrightarrow> complete_on r A" by (simp add: complete_defs)
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
complete_onI
Unique normal forms with respect to conversion.
complete_onE: "complete_on r A \<Longrightarrow> (SN_on r A \<Longrightarrow> CR_on r A \<Longrightarrow> P) \<Longrightarrow> P" by (simp add: complete_defs)
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
complete_onE
null
CR_onI: "(\<And>a b c. a \<in> A \<Longrightarrow> (a, b) \<in> r\<^sup>* \<Longrightarrow> (a, c) \<in> r\<^sup>* \<Longrightarrow> (b, c) \<in> join r) \<Longrightarrow> CR_on r A" by (simp add: CR_defs)
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
CR_onI
null
CR_on_singletonI: "(\<And>b c. (a, b) \<in> r\<^sup>* \<Longrightarrow> (a, c) \<in> r\<^sup>* \<Longrightarrow> (b, c) \<in> join r) \<Longrightarrow> CR_on r {a}" by (simp add: CR_defs)
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
CR_on_singletonI
null
CR_onE: "CR_on r A \<Longrightarrow> a \<in> A \<Longrightarrow> ((b, c) \<in> join r \<Longrightarrow> P) \<Longrightarrow> ((a, b) \<notin> r\<^sup>* \<Longrightarrow> P) \<Longrightarrow> ((a, c) \<notin> r\<^sup>* \<Longrightarrow> P) \<Longrightarrow> P" unfolding CR_defs by blast
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
CR_onE
null
CR_onD: "CR_on r A \<Longrightarrow> a \<in> A \<Longrightarrow> (a, b) \<in> r\<^sup>* \<Longrightarrow> (a, c) \<in> r\<^sup>* \<Longrightarrow> (b, c) \<in> join r" by (blast elim: CR_onE)
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
CR_onD
null
semi_complete_onI: "WN_on r A \<Longrightarrow> CR_on r A \<Longrightarrow> semi_complete_on r A" by (simp add: semi_complete_defs)
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
semi_complete_onI
null
semi_complete_onE: "semi_complete_on r A \<Longrightarrow> (WN_on r A \<Longrightarrow> CR_on r A \<Longrightarrow> P) \<Longrightarrow> P" by (simp add: semi_complete_defs) declare semi_complete_onI [intro] declare semi_complete_onE [elim] declare complete_onI [intro] declare complete_onE [elim] declare CR_onI [intro] declare CR_on_singletonI [intro] declare CR_onD [dest] declare CR_onE [elim]
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
semi_complete_onE
null
UNC_I: "(\<And>a b. a \<in> NF A \<Longrightarrow> b \<in> NF A \<Longrightarrow> (a, b) \<in> A\<^sup>\<leftrightarrow>\<^sup>* \<Longrightarrow> a = b) \<Longrightarrow> UNC A" by (simp add: UNC_def)
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
UNC_I
null
UNC_E: "\<lbrakk>UNC A; a = b \<Longrightarrow> P; a \<notin> NF A \<Longrightarrow> P; b \<notin> NF A \<Longrightarrow> P; (a, b) \<notin> A\<^sup>\<leftrightarrow>\<^sup>* \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P" unfolding UNC_def by blast
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
UNC_E
null
UNF_onI: "(\<And>a b c. a \<in> A \<Longrightarrow> (a, b) \<in> r\<^sup>! \<Longrightarrow> (a, c) \<in> r\<^sup>! \<Longrightarrow> b = c) \<Longrightarrow> UNF_on r A" by (simp add: UNF_defs)
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
UNF_onI
null
UNF_onE: "UNF_on r A \<Longrightarrow> a \<in> A \<Longrightarrow> (b = c \<Longrightarrow> P) \<Longrightarrow> ((a, b) \<notin> r\<^sup>! \<Longrightarrow> P) \<Longrightarrow> ((a, c) \<notin> r\<^sup>! \<Longrightarrow> P) \<Longrightarrow> P" unfolding UNF_on_def by blast
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
UNF_onE
null
UNF_onD: "UNF_on r A \<Longrightarrow> a \<in> A \<Longrightarrow> (a, b) \<in> r\<^sup>! \<Longrightarrow> (a, c) \<in> r\<^sup>! \<Longrightarrow> b = c" by (blast elim: UNF_onE) declare UNF_onI [intro] declare UNF_onD [dest] declare UNF_onE [elim]
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
UNF_onD
null
SN_onI: assumes "\<And>f. \<lbrakk>f 0 \<in> A; chain r f\<rbrakk> \<Longrightarrow> False" shows "SN_on r A" using assms unfolding SN_defs by blast
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_onI
null
SN_I: "(\<And>a. SN_on A {a}) \<Longrightarrow> SN A" unfolding SN_on_def by blast
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_I
null
SN_on_trancl_imp_SN_on: assumes "SN_on (R\<^sup>+) T" shows "SN_on R T" proof (rule ccontr) assume "\<not> SN_on R T" then obtain s where "s 0 \<in> T" and "chain R s" unfolding SN_defs by auto then have "chain (R\<^sup>+) s" by auto with \<open>s 0 \<in> T\<close> have "\<not> SN_on (R\<^sup>+) T" unfolding SN_defs by auto with assms show False by simp qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_on_trancl_imp_SN_on
null
SN_onE: assumes "SN_on r A" and "\<not> (\<exists>f. f 0 \<in> A \<and> chain r f) \<Longrightarrow> P" shows "P" using assms unfolding SN_defs by simp
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_onE
s 0 \<in> T
not_SN_onE: assumes "\<not> SN_on r A" and "\<And>f. \<lbrakk>f 0 \<in> A; chain r f\<rbrakk> \<Longrightarrow> P" shows "P" using assms unfolding SN_defs by blast declare SN_onI [intro] declare SN_onE [elim] declare not_SN_onE [Pure.elim, elim]
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
not_SN_onE
null
refl_not_SN: "(x, x) \<in> R \<Longrightarrow> \<not> SN R" unfolding SN_defs by force
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
refl_not_SN
null
SN_on_irrefl: assumes "SN_on r A" shows "\<forall>a\<in>A. (a, a) \<notin> r" proof (intro ballI notI) fix a assume "a \<in> A" and "(a, a) \<in> r" with assms show False unfolding SN_defs by auto qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_on_irrefl
null
WCR_onI: "(\<And>a b c. a \<in> A \<Longrightarrow> (a, b) \<in> r \<Longrightarrow> (a, c) \<in> r \<Longrightarrow> (b, c) \<in> join r) \<Longrightarrow> WCR_on r A" by (simp add: WCR_defs)
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
WCR_onI
null
WCR_onE: "WCR_on r A \<Longrightarrow> a \<in> A \<Longrightarrow> ((b, c) \<in> join r \<Longrightarrow> P) \<Longrightarrow> ((a, b) \<notin> r \<Longrightarrow> P) \<Longrightarrow> ((a, c) \<notin> r \<Longrightarrow> P) \<Longrightarrow> P" unfolding WCR_on_def by blast
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
WCR_onE
null
SN_nat_bounded: "SN {(x, y :: nat). x < y \<and> y \<le> b}" (is "SN ?R") proof fix f assume "chain ?R f" then have steps: "\<And>i. (f i, f (Suc i)) \<in> ?R" .. { fix i have inc: "f 0 + i \<le> f i" proof (induct i) case 0 then show ?case by auto next case (Suc i) have "f 0 + Suc i \<le> f i + Suc 0" using Suc by simp also have "... \<le> f (Suc i)" using steps [of i] by auto finally show ?case by simp qed } from this [of "Suc b"] steps [of b] show False by simp qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_nat_bounded
null
WCR_onD: "WCR_on r A \<Longrightarrow> a \<in> A \<Longrightarrow> (a, b) \<in> r \<Longrightarrow> (a, c) \<in> r \<Longrightarrow> (b, c) \<in> join r" by (blast elim: WCR_onE)
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
WCR_onD
null
WN_onI: "(\<And>a. a \<in> A \<Longrightarrow> \<exists>b. (a, b) \<in> r\<^sup>!) \<Longrightarrow> WN_on r A" by (auto simp: WN_defs)
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
WN_onI
null
WN_onE: "WN_on r A \<Longrightarrow> a \<in> A \<Longrightarrow> (\<And>b. (a, b) \<in> r\<^sup>! \<Longrightarrow> P) \<Longrightarrow> P" unfolding WN_defs by blast
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
WN_onE
null
WN_onD: "WN_on r A \<Longrightarrow> a \<in> A \<Longrightarrow> \<exists>b. (a, b) \<in> r\<^sup>!" by (blast elim: WN_onE) declare WCR_onI [intro] declare WCR_onD [dest] declare WCR_onE [elim] declare WN_onI [intro] declare WN_onD [dest] declare WN_onE [elim]
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
WN_onD
null
restrict_SN:: "'a rel \<Rightarrow> 'a rel \<Rightarrow> 'a rel" where "restrict_SN r s = {(a, b) | a b. (a, b) \<in> r \<and> SN_on s {a}}"
definition
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
restrict_SN
null
SN_restrict_SN_idemp[simp]: "SN (restrict_SN A A)" by (auto simp: restrict_SN_def SN_defs)
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_restrict_SN_idemp
null
SN_on_Image: assumes "SN_on r A" shows "SN_on r (r `` A)" proof fix f assume "f 0 \<in> r `` A" and chain: "chain r f" then obtain a where "a \<in> A" and 1: "(a, f 0) \<in> r" by auto let ?g = "case_nat a f" from cons_chain [OF 1 chain] have "chain r ?g" . moreover have "?g 0 \<in> A" by (simp add: \<open>a \<in> A\<close>) ultimately have "\<not> SN_on r A" unfolding SN_defs by best with assms show False by simp qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_on_Image
null
SN_on_subset2: assumes "A \<subseteq> B" and "SN_on r B" shows "SN_on r A" using assms unfolding SN_on_def by blast
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_on_subset2
a \<in> A
step_preserves_SN_on: assumes 1: "(a, b) \<in> r" and 2: "SN_on r {a}" shows "SN_on r {b}" using 1 and SN_on_Image [OF 2] and SN_on_subset2 [of "{b}" "r `` {a}"] by auto
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
step_preserves_SN_on
null
steps_preserve_SN_on: "(a, b) \<in> A\<^sup>* \<Longrightarrow> SN_on A {a} \<Longrightarrow> SN_on A {b}" by (induct rule: rtrancl.induct) (auto simp: step_preserves_SN_on)
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
steps_preserve_SN_on
null
relpow_seq: assumes "(x, y) \<in> r^^n" shows "\<exists>f. f 0 = x \<and> f n = y \<and> (\<forall>i<n. (f i, f (Suc i)) \<in> r)" using assms proof (induct n arbitrary: y) case 0 then show ?case by auto next case (Suc n) then obtain z where "(x, z) \<in> r^^n" and "(z, y) \<in> r" by auto from Suc(1)[OF \<open>(x, z) \<in> r^^n\<close>] obtain f where "f 0 = x" and "f n = z" and seq: "\<forall>i<n. (f i, f (Suc i)) \<in> r" by auto let ?n = "Suc n" let ?f = "\<lambda>i. if i = ?n then y else f i" have "?f ?n = y" by simp from \<open>f 0 = x\<close> have "?f 0 = x" by simp from seq have seq': "\<forall>i<n. (?f i, ?f (Suc i)) \<in> r" by auto with \<open>f n = z\<close> and \<open>(z, y) \<in> r\<close> have "\<forall>i<?n. (?f i, ?f (Suc i)) \<in> r" by auto with \<open>?f 0 = x\<close> and \<open>?f ?n = y\<close> show ?case by best qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
relpow_seq
FIXME: move
rtrancl_imp_seq: assumes "(x, y) \<in> r\<^sup>*" shows "\<exists>f n. f 0 = x \<and> f n = y \<and> (\<forall>i<n. (f i, f (Suc i)) \<in> r)" using assms [unfolded rtrancl_power] and relpow_seq [of x y _ r] by blast
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
rtrancl_imp_seq
f n = z ?f 0 = x
SN_on_Image_rtrancl: assumes "SN_on r A" shows "SN_on r (r\<^sup>* `` A)" proof fix f assume f0: "f 0 \<in> r\<^sup>* `` A" and chain: "chain r f" then obtain a where a: "a \<in> A" and "(a, f 0) \<in> r\<^sup>*" by auto then obtain n where "(a, f 0) \<in> r^^n" unfolding rtrancl_power by auto show False proof (cases n) case 0 with \<open>(a, f 0) \<in> r^^n\<close> have "f 0 = a" by simp then have "f 0 \<in> A" by (simp add: a) with chain have "\<not> SN_on r A" by auto with assms show False by simp next case (Suc m) from relpow_seq [OF \<open>(a, f 0) \<in> r^^n\<close>] obtain g where g0: "g 0 = a" and "g n = f 0" and gseq: "\<forall>i<n. (g i, g (Suc i)) \<in> r" by auto let ?f = "\<lambda>i. if i < n then g i else f (i - n)" have "chain r ?f" proof fix i { assume "Suc i < n" then have "(?f i, ?f (Suc i)) \<in> r" by (simp add: gseq) } moreover {
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_on_Image_rtrancl
null
restrict_SN_trancl_simp[simp]: "(restrict_SN A A)\<^sup>+ = restrict_SN (A\<^sup>+) A" (is "?lhs = ?rhs") proof show "?lhs \<subseteq> ?rhs" proof fix a b assume "(a, b) \<in> ?lhs" then show "(a, b) \<in> ?rhs" unfolding restrict_SN_def by (induct rule: trancl.induct) auto qed next show "?rhs \<subseteq> ?lhs" proof fix a b assume "(a, b) \<in> ?rhs" then have "(a, b) \<in> A\<^sup>+" and "SN_on A {a}" unfolding restrict_SN_def by auto then show "(a, b) \<in> ?lhs" proof (induct rule: trancl.induct) case (r_into_trancl x y) then show ?case unfolding restrict_SN_def by auto next case (trancl_into_trancl a b c) then have IH: "(a, b) \<in> ?lhs" by auto from trancl_into_trancl have "(a, b) \<in> A\<^sup>*" by auto from this and \<open>SN_on A {a}\<close> have "SN_on A {b}" by (rule steps_preserve_SN_on) with \<open>(b, c) \<in> A\<close> have "(b, c) \<in> ?lhs" unfolding restrict_SN_def by auto with IH show ?case by simp qed qed qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
restrict_SN_trancl_simp
FIXME: move somewhere else
SN_imp_WN: assumes "SN A" shows "WN A" proof - from \<open>SN A\<close> have "wf (A\<inverse>)" by (simp add: SN_defs wf_iff_no_infinite_down_chain) show "WN A" proof fix a show "\<exists>b. (a, b) \<in> A\<^sup>!" unfolding normalizability_def NF_def Image_def by (rule wfE_min [OF \<open>wf (A\<inverse>)\<close>, of a "A\<^sup>* `` {a}", simplified]) (auto intro: rtrancl_into_rtrancl) qed qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_imp_WN
null
UNC_imp_UNF: assumes "UNC r" shows "UNF r" proof - { fix x y z assume "(x, y) \<in> r\<^sup>!" and "(x, z) \<in> r\<^sup>!" then have "(x, y) \<in> r\<^sup>*" and "(x, z) \<in> r\<^sup>*" and "y \<in> NF r" and "z \<in> NF r" by auto then have "(x, y) \<in> r\<^sup>\<leftrightarrow>\<^sup>*" and "(x, z) \<in> r\<^sup>\<leftrightarrow>\<^sup>*" by auto then have "(z, x) \<in> r\<^sup>\<leftrightarrow>\<^sup>*" using conversion_sym unfolding sym_def by best with \<open>(x, y) \<in> r\<^sup>\<leftrightarrow>\<^sup>*\<close> have "(z, y) \<in> r\<^sup>\<leftrightarrow>\<^sup>*" using conversion_trans unfolding trans_def by best from assms and this and \<open>z \<in> NF r\<close> and \<open>y \<in> NF r\<close> have "z = y" unfolding UNC_def by auto } then show ?thesis by auto qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
UNC_imp_UNF
wf (A\<inverse>)
join_NF_imp_eq: assumes "(x, y) \<in> r\<^sup>\<down>" and "x \<in> NF r" and "y \<in> NF r" shows "x = y" proof - from \<open>(x, y) \<in> r\<^sup>\<down>\<close> obtain z where "(x, z)\<in>r\<^sup>*" and "(z, y)\<in>(r\<inverse>)\<^sup>*" unfolding join_def by auto then have "(y, z) \<in> r\<^sup>*" unfolding rtrancl_converse by simp from \<open>x \<in> NF r\<close> have "(x, z) \<notin> r\<^sup>+" using NF_no_trancl_step by best then have "x = z" using rtranclD [OF \<open>(x, z) \<in> r\<^sup>*\<close>] by auto from \<open>y \<in> NF r\<close> have "(y, z) \<notin> r\<^sup>+" using NF_no_trancl_step by best then have "y = z" using rtranclD [OF \<open>(y, z) \<in> r\<^sup>*\<close>] by auto with \<open>x = z\<close> show ?thesis by simp qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
join_NF_imp_eq
(x, y) \<in> r\<^sup>\<leftrightarrow>\<^sup>* z \<in> NF r
rtrancl_Restr: assumes "(x, y) \<in> (Restr r A)\<^sup>*" shows "(x, y) \<in> r\<^sup>*" using assms by induct auto
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
rtrancl_Restr
y \<in> NF r (y, z) \<in> r\<^sup>* x = z
join_mono: assumes "r \<subseteq> s" shows "r\<^sup>\<down> \<subseteq> s\<^sup>\<down>" using rtrancl_mono [OF assms] by (auto simp: join_def rtrancl_converse)
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
join_mono
null
CR_iff_meet_subset_join: "CR r = (r\<^sup>\<up> \<subseteq> r\<^sup>\<down>)" proof assume "CR r" show "r\<^sup>\<up> \<subseteq> r\<^sup>\<down>" proof (rule subrelI) fix x y assume "(x, y) \<in> r\<^sup>\<up>" then obtain z where "(z, x) \<in> r\<^sup>*" and "(z, y) \<in> r\<^sup>*" using meetD by best with \<open>CR r\<close> show "(x, y) \<in> r\<^sup>\<down>" by (auto simp: CR_defs) qed next assume "r\<^sup>\<up> \<subseteq> r\<^sup>\<down>" { fix x y z assume "(x, y) \<in> r\<^sup>*" and "(x, z) \<in> r\<^sup>*" then have "(y, z) \<in> r\<^sup>\<up>" unfolding meet_def rtrancl_converse by auto with \<open>r\<^sup>\<up> \<subseteq> r\<^sup>\<down>\<close> have "(y, z) \<in> r\<^sup>\<down>" by auto } then show "CR r" by (auto simp: CR_defs) qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
CR_iff_meet_subset_join
null
CR_divergence_imp_join: assumes "CR r" and "(x, y) \<in> r\<^sup>*" and "(x, z) \<in> r\<^sup>*" shows "(y, z) \<in> r\<^sup>\<down>" using assms by auto
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
CR_divergence_imp_join
r\<^sup>\<up> \<subseteq> r\<^sup>\<down>
join_imp_conversion: "r\<^sup>\<down> \<subseteq> r\<^sup>\<leftrightarrow>\<^sup>*" proof fix x z assume "(x, z) \<in> r\<^sup>\<down>" then obtain y where "(x, y) \<in> r\<^sup>*" and "(z, y) \<in> r\<^sup>*" by auto then have "(x, y) \<in> r\<^sup>\<leftrightarrow>\<^sup>*" and "(z, y) \<in> r\<^sup>\<leftrightarrow>\<^sup>*" by auto from \<open>(z, y) \<in> r\<^sup>\<leftrightarrow>\<^sup>*\<close> have "(y, z) \<in> r\<^sup>\<leftrightarrow>\<^sup>*" using conversion_sym unfolding sym_def by best with \<open>(x, y) \<in> r\<^sup>\<leftrightarrow>\<^sup>*\<close> show "(x, z) \<in> r\<^sup>\<leftrightarrow>\<^sup>*" using conversion_trans unfolding trans_def by best qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
join_imp_conversion
null
meet_imp_conversion: "r\<^sup>\<up> \<subseteq> r\<^sup>\<leftrightarrow>\<^sup>*" proof (rule subrelI) fix y z assume "(y, z) \<in> r\<^sup>\<up>" then obtain x where "(x, y) \<in> r\<^sup>*" and "(x, z) \<in> r\<^sup>*" by auto then have "(x, y) \<in> r\<^sup>\<leftrightarrow>\<^sup>*" and "(x, z) \<in> r\<^sup>\<leftrightarrow>\<^sup>*" by auto from \<open>(x, y) \<in> r\<^sup>\<leftrightarrow>\<^sup>*\<close> have "(y, x) \<in> r\<^sup>\<leftrightarrow>\<^sup>*" using conversion_sym unfolding sym_def by best with \<open>(x, z) \<in> r\<^sup>\<leftrightarrow>\<^sup>*\<close> show "(y, z) \<in> r\<^sup>\<leftrightarrow>\<^sup>*" using conversion_trans unfolding trans_def by best qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
meet_imp_conversion
(z, y) \<in> r\<^sup>\<leftrightarrow>\<^sup>* (x, y) \<in> r\<^sup>\<leftrightarrow>\<^sup>*
CR_imp_UNF: assumes "CR r" shows "UNF r" proof - { fix x y z assume "(x, y) \<in> r\<^sup>!" and "(x, z) \<in> r\<^sup>!" then have "(x, y) \<in> r\<^sup>*" and "y \<in> NF r" and "(x, z) \<in> r\<^sup>*" and "z \<in> NF r" unfolding normalizability_def by auto from assms and \<open>(x, y) \<in> r\<^sup>*\<close> and \<open>(x, z) \<in> r\<^sup>*\<close> have "(y, z) \<in> r\<^sup>\<down>" by (rule CR_divergence_imp_join) from this and \<open>y \<in> NF r\<close> and \<open>z \<in> NF r\<close> have "y = z" by (rule join_NF_imp_eq) } then show ?thesis by auto qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
CR_imp_UNF
(x, y) \<in> r\<^sup>\<leftrightarrow>\<^sup>* (x, z) \<in> r\<^sup>\<leftrightarrow>\<^sup>*
CR_iff_conversion_imp_join: "CR r = (r\<^sup>\<leftrightarrow>\<^sup>* \<subseteq> r\<^sup>\<down>)" proof (intro iffI subrelI) fix x y assume "CR r" and "(x, y) \<in> r\<^sup>\<leftrightarrow>\<^sup>*" then obtain n where "(x, y) \<in> (r\<^sup>\<leftrightarrow>)^^n" unfolding conversion_def rtrancl_is_UN_relpow by auto then show "(x, y) \<in> r\<^sup>\<down>" proof (induct n arbitrary: x) case 0 assume "(x, y) \<in> r\<^sup>\<leftrightarrow> ^^ 0" then have "x = y" by simp show ?case unfolding \<open>x = y\<close> by auto next case (Suc n) from \<open>(x, y) \<in> r\<^sup>\<leftrightarrow> ^^ Suc n\<close> obtain z where "(x, z) \<in> r\<^sup>\<leftrightarrow>" and "(z, y) \<in> r\<^sup>\<leftrightarrow> ^^ n" using relpow_Suc_D2 by best with Suc have "(z, y) \<in> r\<^sup>\<down>" by simp from \<open>(x, z) \<in> r\<^sup>\<leftrightarrow>\<close> show ?case proof assume "(x, z) \<in> r" with \<open>(z, y) \<in> r\<^sup>\<down>\<close> show ?thesis by (auto intro: rtrancl_join_join) next assume "(x, z) \<in> r\<inverse>" then have "(z, x) \<in> r\<^sup>*" by simp from \<open>(z, y) \<in> r\<^sup>\<down>\<close> obtain z' where "(z, z') \<in> r\<^sup>*" and "(y, z') \<in> r\<^sup>*" by auto from \<open>CR r\<close> and \<open>(z, x) \<in> r\<^sup>*\<close> and \<open>(z, z') \<in> r\<^sup>*\<close> have "(x, z') \<in> r\<^sup>\<down>" by (rule CR_divergence_imp_join) then obtain x' where "(x, x') \<in> r\<^sup>*" and "(z', x') \<in> r\<^sup>*" by auto with \<open>(y, z') \<in> r\<^sup>*\<close> show ?thesis by auto qed qed next assume "r\<^sup>\<leftrightarrow>\<^sup>* \<subseteq> r\<^sup>\<down>" then show "CR r" unfolding CR_iff_meet_subset_join using meet_imp_conversion by auto
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
CR_iff_conversion_imp_join
y \<in> NF r
CR_imp_conversionIff_join: assumes "CR r" shows "r\<^sup>\<leftrightarrow>\<^sup>* = r\<^sup>\<down>" proof show "r\<^sup>\<leftrightarrow>\<^sup>* \<subseteq> r\<^sup>\<down>" using CR_iff_conversion_imp_join assms by auto next show "r\<^sup>\<down> \<subseteq> r\<^sup>\<leftrightarrow>\<^sup>*" by (rule join_imp_conversion) qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
CR_imp_conversionIff_join
null
sym_join: "sym (join r)" by (auto simp: sym_def)
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
sym_join
null
join_sym: "(s, t) \<in> A\<^sup>\<down> \<Longrightarrow> (t, s) \<in> A\<^sup>\<down>" by auto
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
join_sym
null
CR_join_left_I: assumes "CR r" and "(x, y) \<in> r\<^sup>*" and "(x, z) \<in> r\<^sup>\<down>" shows "(y, z) \<in> r\<^sup>\<down>" proof - from \<open>(x, z) \<in> r\<^sup>\<down>\<close> obtain x' where "(x, x') \<in> r\<^sup>*" and "(z, x') \<in> r\<^sup>\<down>" by auto from \<open>CR r\<close> and \<open>(x, x') \<in> r\<^sup>*\<close> and \<open>(x, y) \<in> r\<^sup>*\<close> have "(x, y) \<in> r\<^sup>\<down>" by auto then have "(y, x) \<in> r\<^sup>\<down>" using join_sym by best from \<open>CR r\<close> have "r\<^sup>\<leftrightarrow>\<^sup>* = r\<^sup>\<down>" by (rule CR_imp_conversionIff_join) from \<open>(y, x) \<in> r\<^sup>\<down>\<close> and \<open>(x, z) \<in> r\<^sup>\<down>\<close> show ?thesis using conversion_trans unfolding trans_def \<open>r\<^sup>\<leftrightarrow>\<^sup>* = r\<^sup>\<down>\<close> [symmetric] by best qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
CR_join_left_I
null
CR_join_right_I: assumes "CR r" and "(x, y) \<in> r\<^sup>\<down>" and "(y, z) \<in> r\<^sup>*" shows "(x, z) \<in> r\<^sup>\<down>" proof - have "r\<^sup>\<leftrightarrow>\<^sup>* = r\<^sup>\<down>" by (rule CR_imp_conversionIff_join [OF \<open>CR r\<close>]) from \<open>(y, z) \<in> r\<^sup>*\<close> have "(y, z) \<in> r\<^sup>\<leftrightarrow>\<^sup>*" by auto with \<open>(x, y) \<in> r\<^sup>\<down>\<close> show ?thesis unfolding \<open>r\<^sup>\<leftrightarrow>\<^sup>* = r\<^sup>\<down>\<close> [symmetric] using conversion_trans unfolding trans_def by fast qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
CR_join_right_I
CR r (y, x) \<in> r\<^sup>\<down> r\<^sup>\<leftrightarrow>\<^sup>* = r\<^sup>\<down>
NF_not_suc: assumes "(x, y) \<in> r\<^sup>*" and "x \<in> NF r" shows "x = y" proof - from \<open>x \<in> NF r\<close> have "\<forall>y. (x, y) \<notin> r" using NF_no_step by auto then have "x \<notin> Domain r" unfolding Domain_unfold by simp from \<open>(x, y) \<in> r\<^sup>*\<close> show ?thesis unfolding Not_Domain_rtrancl [OF \<open>x \<notin> Domain r\<close>] by simp qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
NF_not_suc
(y, z) \<in> r\<^sup>* (x, y) \<in> r\<^sup>\<down>
semi_complete_imp_conversionIff_same_NF: assumes "semi_complete r" shows "((x, y) \<in> r\<^sup>\<leftrightarrow>\<^sup>*) = (\<forall>u v. (x, u) \<in> r\<^sup>! \<and> (y, v) \<in> r\<^sup>! \<longrightarrow> u = v)" proof - from assms have "WN r" and "CR r" unfolding semi_complete_defs by auto then have "r\<^sup>\<leftrightarrow>\<^sup>* = r\<^sup>\<down>" using CR_imp_conversionIff_join by auto show ?thesis proof assume "(x, y) \<in> r\<^sup>\<leftrightarrow>\<^sup>*" from \<open>(x, y) \<in> r\<^sup>\<leftrightarrow>\<^sup>*\<close> have "(x, y) \<in> r\<^sup>\<down>" unfolding \<open>r\<^sup>\<leftrightarrow>\<^sup>* = r\<^sup>\<down>\<close> . show "\<forall>u v. (x, u) \<in> r\<^sup>! \<and> (y, v) \<in> r\<^sup>! \<longrightarrow> u = v" proof (intro allI impI, elim conjE) fix u v assume "(x, u) \<in> r\<^sup>!" and "(y, v) \<in> r\<^sup>!" then have "(x, u) \<in> r\<^sup>*" and "(y, v) \<in> r\<^sup>*" and "u \<in> NF r" and "v \<in> NF r" by auto from \<open>CR r\<close> and \<open>(x, u) \<in> r\<^sup>*\<close> and \<open>(x, y) \<in> r\<^sup>\<down>\<close> have "(u, y) \<in> r\<^sup>\<down>" by (auto intro: CR_join_left_I) then have "(y, u) \<in> r\<^sup>\<down>" using join_sym by best with \<open>(x, y) \<in> r\<^sup>\<down>\<close> have "(x, u) \<in> r\<^sup>\<down>" unfolding \<open>r\<^sup>\<leftrightarrow>\<^sup>* = r\<^sup>\<down>\<close> [symmetric] using conversion_trans unfolding trans_def by best from \<open>CR r\<close> and \<open>(x, y) \<in> r\<^sup>\<down>\<close> and \<open>(y, v) \<in> r\<^sup>*\<close> have "(x, v) \<in> r\<^sup>\<down>" by (auto intro: CR_join_right_I) then have "(v, x) \<in> r\<^sup>\<down>" using join_sym unfolding sym_def by best with \<open>(x, u) \<in> r\<^sup>\<down>\<close> have "(v, u) \<in> r\<^sup>\<down>" unfolding \<open>r\<^sup>\<leftrightarrow>\<^sup>* = r\<^sup>\<down>\<close> [symmetric] using conversion_trans unfolding trans_def by b ...
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
semi_complete_imp_conversionIff_same_NF
x \<in> NF r (x, y) \<in> r\<^sup>*
CR_imp_UNC: assumes "CR r" shows "UNC r" proof - { fix x y assume "x \<in> NF r" and "y \<in> NF r" and "(x, y) \<in> r\<^sup>\<leftrightarrow>\<^sup>*" have "r\<^sup>\<leftrightarrow>\<^sup>* = r\<^sup>\<down>" by (rule CR_imp_conversionIff_join [OF assms]) from \<open>(x, y) \<in> r\<^sup>\<leftrightarrow>\<^sup>*\<close> have "(x, y) \<in> r\<^sup>\<down>" unfolding \<open>r\<^sup>\<leftrightarrow>\<^sup>* = r\<^sup>\<down>\<close> by simp then obtain x' where "(x, x') \<in> r\<^sup>*" and "(y, x') \<in> r\<^sup>*" by best from \<open>(x, x') \<in> r\<^sup>*\<close> and \<open>x \<in> NF r\<close> have "x = x'" by (rule NF_not_suc) from \<open>(y, x') \<in> r\<^sup>*\<close> and \<open>y \<in> NF r\<close> have "y = x'" by (rule NF_not_suc) then have "x = y" unfolding \<open>x = x'\<close> by simp } then show ?thesis by (auto simp: UNC_def) qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
CR_imp_UNC
(y, v) \<in> r\<^sup>\<leftrightarrow>\<^sup>* (x, v) \<in> r\<^sup>\<leftrightarrow>\<^sup>*
WN_UNF_imp_CR: assumes "WN r" and "UNF r" shows "CR r" proof - { fix x y z assume "(x, y) \<in> r\<^sup>*" and "(x, z) \<in> r\<^sup>*" from assms obtain y' where "(y, y') \<in> r\<^sup>!" unfolding WN_defs by best with \<open>(x, y) \<in> r\<^sup>*\<close> have "(x, y') \<in> r\<^sup>!" by auto from assms obtain z' where "(z, z') \<in> r\<^sup>!" unfolding WN_defs by best with \<open>(x, z) \<in> r\<^sup>*\<close> have "(x, z') \<in> r\<^sup>!" by auto with \<open>(x, y') \<in> r\<^sup>!\<close> have "y' = z'" using \<open>UNF r\<close> unfolding UNF_defs by auto from \<open>(y, y') \<in> r\<^sup>!\<close> and \<open>(z, z') \<in> r\<^sup>!\<close> have "(y, z) \<in> r\<^sup>\<down>" unfolding \<open>y' = z'\<close> by auto } then show ?thesis by auto qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
WN_UNF_imp_CR
(y, x') \<in> r\<^sup>* x = x'
diamond:: "'a rel \<Rightarrow> bool" ("\<diamond>") where "\<diamond> r \<longleftrightarrow> (r\<inverse> O r) \<subseteq> (r O r\<inverse>)"
definition
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
diamond
(x, y') \<in> r\<^sup>! (y, y') \<in> r\<^sup>!
diamond_I[intro]: "(r\<inverse> O r) \<subseteq> (r O r\<inverse>) \<Longrightarrow> \<diamond> r" unfolding diamond_def by simp
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
diamond_I
null
diamond_E[elim]: "\<diamond> r \<Longrightarrow> ((r\<inverse> O r) \<subseteq> (r O r\<inverse>) \<Longrightarrow> P) \<Longrightarrow> P" unfolding diamond_def by simp
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
diamond_E
null
diamond_imp_semi_confluence: assumes "\<diamond> r" shows "(r\<inverse> O r\<^sup>*) \<subseteq> r\<^sup>\<down>" proof (rule subrelI) fix y z assume "(y, z) \<in> r\<inverse> O r\<^sup>*" then obtain x where "(x, y) \<in> r" and "(x, z) \<in> r\<^sup>*" by best then obtain n where "(x, z) \<in> r^^n" using rtrancl_imp_UN_relpow by best with \<open>(x, y) \<in> r\<close> show "(y, z) \<in> r\<^sup>\<down>" proof (induct n arbitrary: x z y) case 0 then show ?case by auto next case (Suc n) from \<open>(x, z) \<in> r^^Suc n\<close> obtain x' where "(x, x') \<in> r" and "(x', z) \<in> r^^n" using relpow_Suc_D2 by best with \<open>(x, y) \<in> r\<close> have "(y, x') \<in> (r\<inverse> O r)" by auto with \<open>\<diamond> r\<close> have "(y, x') \<in> (r O r\<inverse>)" by auto then obtain y' where "(x', y') \<in> r" and "(y, y') \<in> r" by best with Suc and \<open>(x', z) \<in> r^^n\<close> have "(y', z) \<in> r\<^sup>\<down>" by auto with \<open>(y, y') \<in> r\<close> show ?case by (auto intro: rtrancl_join_join) qed qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
diamond_imp_semi_confluence
null
semi_confluence_imp_CR: assumes "(r\<inverse> O r\<^sup>*) \<subseteq> r\<^sup>\<down>" shows "CR r" proof - { fix x y z assume "(x, y) \<in> r\<^sup>*" and "(x, z) \<in> r\<^sup>*" then obtain n where "(x, z) \<in> r^^n" using rtrancl_imp_UN_relpow by best with \<open>(x, y) \<in> r\<^sup>*\<close> have "(y, z) \<in> r\<^sup>\<down>" proof (induct n arbitrary: x y z) case 0 then show ?case by auto next case (Suc n) from \<open>(x, z) \<in> r^^Suc n\<close> obtain x' where "(x, x') \<in> r" and "(x', z) \<in> r^^n" using relpow_Suc_D2 by best from \<open>(x, x') \<in> r\<close> and \<open>(x, y) \<in> r\<^sup>*\<close> have "(x', y) \<in> (r\<inverse> O r\<^sup>* )" by auto with assms have "(x', y) \<in> r\<^sup>\<down>" by auto then obtain y' where "(x', y') \<in> r\<^sup>*" and "(y, y') \<in> r\<^sup>*" by best with Suc and \<open>(x', z) \<in> r^^n\<close> have "(y', z) \<in> r\<^sup>\<down>" by simp then obtain u where "(z, u) \<in> r\<^sup>*" and "(y', u) \<in> r\<^sup>*" by best from \<open>(y, y') \<in> r\<^sup>*\<close> and \<open>(y', u) \<in> r\<^sup>*\<close> have "(y, u) \<in> r\<^sup>*" by auto with \<open>(z, u) \<in> r\<^sup>*\<close> show ?case by best qed } then show ?thesis by auto qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
semi_confluence_imp_CR
(x', z) \<in> r^^n (y, y') \<in> r
diamond_imp_CR: assumes "\<diamond> r" shows "CR r" using assms by (rule diamond_imp_semi_confluence [THEN semi_confluence_imp_CR])
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
diamond_imp_CR
(z, u) \<in> r\<^sup>*
diamond_imp_CR': assumes "\<diamond> s" and "r \<subseteq> s" and "s \<subseteq> r\<^sup>*" shows "CR r" unfolding CR_iff_meet_subset_join proof - from \<open>\<diamond> s\<close> have "CR s" by (rule diamond_imp_CR) then have "s\<^sup>\<up> \<subseteq> s\<^sup>\<down>" unfolding CR_iff_meet_subset_join by simp from \<open>r \<subseteq> s\<close> have "r\<^sup>* \<subseteq> s\<^sup>*" by (rule rtrancl_mono) from \<open>s \<subseteq> r\<^sup>*\<close> have "s\<^sup>* \<subseteq> (r\<^sup>*)\<^sup>*" by (rule rtrancl_mono) then have "s\<^sup>* \<subseteq> r\<^sup>*" by simp with \<open>r\<^sup>* \<subseteq> s\<^sup>*\<close> have "r\<^sup>* = s\<^sup>*" by simp show "r\<^sup>\<up> \<subseteq> r\<^sup>\<down>" unfolding meet_def join_def rtrancl_converse \<open>r\<^sup>* = s\<^sup>*\<close> unfolding rtrancl_converse [symmetric] meet_def [symmetric] join_def [symmetric] by (rule \<open>s\<^sup>\<up> \<subseteq> s\<^sup>\<down>\<close>) qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
diamond_imp_CR'
null
SN_imp_minimal: assumes "SN A" shows "\<forall>Q x. x \<in> Q \<longrightarrow> (\<exists>z\<in>Q. \<forall>y. (z, y) \<in> A \<longrightarrow> y \<notin> Q)" proof (rule ccontr) assume "\<not> (\<forall>Q x. x \<in> Q \<longrightarrow> (\<exists>z\<in>Q. \<forall>y. (z, y) \<in> A \<longrightarrow> y \<notin> Q))" then obtain Q x where "x \<in> Q" and "\<forall>z\<in>Q. \<exists>y. (z, y) \<in> A \<and> y \<in> Q" by auto then have "\<forall>z. \<exists>y. z \<in> Q \<longrightarrow> (z, y) \<in> A \<and> y \<in> Q" by auto then have "\<exists>f. \<forall>x. x \<in> Q \<longrightarrow> (x, f x) \<in> A \<and> f x \<in> Q" by (rule choice) then obtain f where a:"\<forall>x. x \<in> Q \<longrightarrow> (x, f x) \<in> A \<and> f x \<in> Q" (is "\<forall>x. ?P x") by best let ?S = "\<lambda>i. (f ^^ i) x" have "?S 0 = x" by simp have "\<forall>i. (?S i, ?S (Suc i)) \<in> A \<and> ?S (Suc i) \<in> Q" proof fix i show "(?S i, ?S (Suc i)) \<in> A \<and> ?S (Suc i) \<in> Q" by (induct i) (auto simp: \<open>x \<in> Q\<close> a) qed with \<open>?S 0 = x\<close> have "\<exists>S. S 0 = x \<and> chain A S" by fast with assms show False by auto qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_imp_minimal
r\<^sup>* = s\<^sup>* s\<^sup>\<up> \<subseteq> s\<^sup>\<down>
SN_on_imp_on_minimal: assumes "SN_on r {x}" shows "\<forall>Q. x \<in> Q \<longrightarrow> (\<exists>z\<in>Q. \<forall>y. (z, y) \<in> r \<longrightarrow> y \<notin> Q)" proof (rule ccontr) assume "\<not>(\<forall>Q. x \<in> Q \<longrightarrow> (\<exists>z\<in>Q. \<forall>y. (z, y) \<in> r \<longrightarrow> y \<notin> Q))" then obtain Q where "x \<in> Q" and "\<forall>z\<in>Q. \<exists>y. (z, y) \<in> r \<and> y \<in> Q" by auto then have "\<forall>z. \<exists>y. z \<in> Q \<longrightarrow> (z, y) \<in> r \<and> y \<in> Q" by auto then have "\<exists>f. \<forall>x. x \<in> Q \<longrightarrow> (x, f x) \<in> r \<and> f x \<in> Q" by (rule choice) then obtain f where a: "\<forall>x. x \<in> Q \<longrightarrow> (x, f x) \<in> r \<and> f x \<in> Q" (is "\<forall>x. ?P x") by best let ?S = "\<lambda>i. (f ^^ i) x" have "?S 0 = x" by simp have "\<forall>i. (?S i,?S(Suc i)) \<in> r \<and> ?S(Suc i) \<in> Q" proof fix i show "(?S i,?S(Suc i)) \<in> r \<and> ?S(Suc i) \<in> Q" by (induct i) (auto simp:\<open>x \<in> Q\<close> a) qed with \<open>?S 0 = x\<close> have "\<exists>S. S 0 = x \<and> chain r S" by fast with assms show False by auto qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_on_imp_on_minimal
?S 0 = x
minimal_imp_wf: assumes "\<forall>Q x. x \<in> Q \<longrightarrow> (\<exists>z\<in>Q. \<forall>y. (z, y) \<in> r \<longrightarrow> y \<notin> Q)" shows "wf(r\<inverse>)" proof (rule ccontr) assume "\<not> wf(r\<inverse>)" then have "\<exists>P. (\<forall>x. (\<forall>y. (x, y) \<in> r \<longrightarrow> P y) \<longrightarrow> P x) \<and> (\<exists>x. \<not> P x)" unfolding wf_def by simp then obtain P x where suc:"\<forall>x. (\<forall>y. (x, y) \<in> r \<longrightarrow> P y) \<longrightarrow> P x" and "\<not> P x" by auto let ?Q = "{x. \<not> P x}" from \<open>\<not> P x\<close> have "x \<in> ?Q" by simp from assms have "\<forall>x. x \<in> ?Q \<longrightarrow> (\<exists>z\<in>?Q. \<forall>y. (z, y) \<in> r \<longrightarrow> y \<notin> ?Q)" by (rule allE [where x = ?Q]) with \<open>x \<in> ?Q\<close> obtain z where "z \<in> ?Q" and min:" \<forall>y. (z, y) \<in> r \<longrightarrow> y \<notin> ?Q" by best from \<open>z \<in> ?Q\<close> have "\<not> P z" by simp with suc obtain y where "(z, y) \<in> r" and "\<not> P y" by best then have "y \<in> ?Q" by simp with \<open>(z, y) \<in> r\<close> and min show False by simp qed lemmas SN_imp_wf = SN_imp_minimal [THEN minimal_imp_wf]
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
minimal_imp_wf
?S 0 = x
wf_imp_SN: assumes "wf (A\<inverse>)" shows "SN A" proof - { fix a let ?P = "\<lambda>a. \<not>(\<exists>S. S 0 = a \<and> chain A S)" from \<open>wf (A\<inverse>)\<close> have "?P a" proof induct case (less a) then have IH: "\<And>b. (a, b) \<in> A \<Longrightarrow> ?P b" by auto show "?P a" proof (rule ccontr) assume "\<not> ?P a" then obtain S where "S 0 = a" and "chain A S" by auto then have "(S 0, S 1) \<in> A" by auto with IH have "?P (S 1)" unfolding \<open>S 0 = a\<close> by auto with \<open>chain A S\<close> show False by auto qed qed then have "SN_on A {a}" unfolding SN_defs by auto } then show ?thesis by fast qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
wf_imp_SN
(z, y) \<in> r
SN_nat_gt: "SN {(a, b :: nat) . a > b}" proof - from wf_less have "wf ({(x, y) . (x :: nat) > y}\<inverse>)" unfolding converse_unfold by auto from wf_imp_SN [OF this] show ?thesis . qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_nat_gt
null
SN_iff_wf: "SN A = wf (A\<inverse>)" by (auto simp: SN_imp_wf wf_imp_SN)
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_iff_wf
null
SN_imp_acyclic: "SN R \<Longrightarrow> acyclic R" using wf_acyclic [of "R\<inverse>", unfolded SN_iff_wf [symmetric]] by auto
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_imp_acyclic
null
SN_induct: assumes sn: "SN r" and step: "\<And>a. (\<And>b. (a, b) \<in> r \<Longrightarrow> P b) \<Longrightarrow> P a" shows "P a" using sn unfolding SN_iff_wf proof induct case (less a) with step show ?case by best qed lemmas SN_induct_rule = SN_induct [consumes 1, case_names IH, induct pred: SN]
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_induct
null
SN_on_induct[consumes 2, case_names IH, induct pred: SN_on]: assumes SN: "SN_on R A" and "s \<in> A" and imp: "\<And>t. (\<And>u. (t, u) \<in> R \<Longrightarrow> P u) \<Longrightarrow> P t" shows "P s" proof - let ?R = "restrict_SN R R" let ?P = "\<lambda>t. SN_on R {t} \<longrightarrow> P t" have "SN_on R {s} \<longrightarrow> P s" proof (rule SN_induct [OF SN_restrict_SN_idemp [of R], of ?P]) fix a assume ind: "\<And>b. (a, b) \<in> ?R \<Longrightarrow> SN_on R {b} \<longrightarrow> P b" show "SN_on R {a} \<longrightarrow> P a" proof assume SN: "SN_on R {a}" show "P a" proof (rule imp) fix b assume "(a, b) \<in> R" with SN step_preserves_SN_on [OF this SN] show "P b" using ind [of b] unfolding restrict_SN_def by auto qed qed qed with SN show "P s" using \<open>s \<in> A\<close> unfolding SN_on_def by blast qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_on_induct
The same as well-founded induction, but in the 'correct' direction.
accp_imp_SN_on: assumes "\<And>x. x \<in> A \<Longrightarrow> Wellfounded.accp g x" shows "SN_on {(y, z). g z y} A" proof - { fix x assume "x \<in> A" from assms [OF this] have "SN_on {(y, z). g z y} {x}" proof (induct rule: accp.induct) case (accI x) show ?case proof fix f assume x: "f 0 \<in> {x}" and steps: "\<forall> i. (f i, f (Suc i)) \<in> {a. (\<lambda>(y, z). g z y) a}" then have "g (f 1) x" by auto from accI(2)[OF this] steps x show False unfolding SN_on_def by auto qed qed } then show ?thesis unfolding SN_on_def by blast qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
accp_imp_SN_on
s \<in> A link SN_on to acc / accp
SN_on_imp_accp: assumes "SN_on {(y, z). g z y} A" shows "\<forall>x\<in>A. Wellfounded.accp g x" proof fix x assume "x \<in> A" with assms show "Wellfounded.accp g x" proof (induct rule: SN_on_induct) case (IH x) show ?case proof fix y assume "g y x" with IH show "Wellfounded.accp g y" by simp qed qed qed
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_on_imp_accp
null
SN_on_conv_accp: "SN_on {(y, z). g z y} {x} = Wellfounded.accp g x" using SN_on_imp_accp [of g "{x}"] accp_imp_SN_on [of "{x}" g] by auto
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_on_conv_accp
null
SN_on_conv_acc: "SN_on {(y, z). (z, y) \<in> r} {x} \<longleftrightarrow> x \<in> Wellfounded.acc r" unfolding SN_on_conv_accp accp_acc_eq ..
lemma
Abstract-Rewriting
[ "HOL-Library.Infinite_Set", "Regular-Sets.Regexp_Method", "Seq" ]
Abstract-Rewriting/Abstract_Rewriting.thy
SN_on_conv_acc
null