fact
stringlengths 5
2k
| type
stringclasses 22
values | library
stringclasses 1
value | imports
listlengths 0
15.1k
| filename
stringlengths 13
83
| symbolic_name
stringlengths 1
82
| docstring
stringclasses 1
value |
|---|---|---|---|---|---|---|
prog = "term" default_sort prog
|
class
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
prog
| |
i :: prog .. consts (*** Evaluation Judgement ***) Eval :: "[i,i]\<Rightarrow>prop" (infixl \<open>\<longlongrightarrow>\<close> 20) (*** Bisimulations for pre-order and equality ***) po :: "['a,'a]\<Rightarrow>o" (infixl \<open>[=\<close> 50) (*** Term Formers ***) true :: "i" false :: "i" pair :: "[i,i]\<Rightarrow>i" (\<open>(\<open>indent=1 notation=\<open>mixfix pair\<close>\<close><_,/_>)\<close>) lambda :: "(i\<Rightarrow>i)\<Rightarrow>i" (binder \<open>lam \<close> 55) "case" :: "[i,i,i,[i,i]\<Rightarrow>i,(i\<Rightarrow>i)\<Rightarrow>i]\<Rightarrow>i" "apply" :: "[i,i]\<Rightarrow>i" (infixl \<open>`\<close> 56) bot :: "i" (******* EVALUATION SEMANTICS *******) (** This is the evaluation semantics from which the axioms below were derived. **) (** It is included here just as an evaluator for FUN and has no influence on **) (** inference in the theory CCL. **)
|
instance
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
i
| |
where trueV: "true \<longlongrightarrow> true" and falseV: "false \<longlongrightarrow> false" and pairV: "<a,b> \<longlongrightarrow> <a,b>" and lamV: "\<And>b. lam x. b(x) \<longlongrightarrow> lam x. b(x)" and caseVtrue: "\<lbrakk>t \<longlongrightarrow> true; d \<longlongrightarrow> c\<rbrakk> \<Longrightarrow> case(t,d,e,f,g) \<longlongrightarrow> c" and caseVfalse: "\<lbrakk>t \<longlongrightarrow> false; e \<longlongrightarrow> c\<rbrakk> \<Longrightarrow> case(t,d,e,f,g) \<longlongrightarrow> c" and caseVpair: "\<lbrakk>t \<longlongrightarrow> <a,b>; f(a,b) \<longlongrightarrow> c\<rbrakk> \<Longrightarrow> case(t,d,e,f,g) \<longlongrightarrow> c" and caseVlam: "\<And>b. \<lbrakk>t \<longlongrightarrow> lam x. b(x); g(b) \<longlongrightarrow> c\<rbrakk> \<Longrightarrow> case(t,d,e,f,g) \<longlongrightarrow> c" (*** Properties of evaluation: note that "t \<longlongrightarrow> c" impies that c is canonical ***)
|
axiomatization
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
where
| |
where canonical: "\<lbrakk>t \<longlongrightarrow> c; c==true \<Longrightarrow> u\<longlongrightarrow>v; c==false \<Longrightarrow> u\<longlongrightarrow>v; \<And>a b. c==<a,b> \<Longrightarrow> u\<longlongrightarrow>v; \<And>f. c==lam x. f(x) \<Longrightarrow> u\<longlongrightarrow>v\<rbrakk> \<Longrightarrow> u\<longlongrightarrow>v" (* Should be derivable - but probably a bitch! *)
|
axiomatization
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
where
| |
where substitute: "\<lbrakk>a==a'; t(a)\<longlongrightarrow>c(a)\<rbrakk> \<Longrightarrow> t(a')\<longlongrightarrow>c(a')" (************** LOGIC ***************) (*** Definitions used in the following rules ***)
|
axiomatization
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
where
| |
where bot_def: "bot == (lam x. x`x)`(lam x. x`x)" and apply_def: "f ` t == case(f, bot, bot, \<lambda>x y. bot, \<lambda>u. u(t))"
|
axiomatization
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
where
| |
SIM :: "[i,i,i set]\<Rightarrow>o" where "SIM(t,t',R) == (t=true \<and> t'=true) | (t=false \<and> t'=false) | (\<exists>a a' b b'. t=<a,b> \<and> t'=<a',b'> \<and> <a,a'> : R \<and> <b,b'> : R) | (\<exists>f f'. t=lam x. f(x) \<and> t'=lam x. f'(x) \<and> (ALL x.<f(x),f'(x)> : R))"
|
definition
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
SIM
| |
POgen :: "i set \<Rightarrow> i set" where "POgen(R) == {p. \<exists>t t'. p=<t,t'> \<and> (t = bot | SIM(t,t',R))}"
|
definition
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
POgen
| |
EQgen :: "i set \<Rightarrow> i set" where "EQgen(R) == {p. \<exists>t t'. p=<t,t'> \<and> (t = bot \<and> t' = bot | SIM(t,t',R))}"
|
definition
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
EQgen
| |
PO :: "i set" where "PO == gfp(POgen)"
|
definition
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
PO
| |
EQ :: "i set" where "EQ == gfp(EQgen)" (*** Rules ***) (** Partial Order **)
|
definition
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
EQ
| |
where po_refl: "a [= a" and po_trans: "\<lbrakk>a [= b; b [= c\<rbrakk> \<Longrightarrow> a [= c" and po_cong: "a [= b \<Longrightarrow> f(a) [= f(b)" and (* Extend definition of [= to program fragments of higher type *) po_abstractn: "(\<And>x. f(x) [= g(x)) \<Longrightarrow> (\<lambda>x. f(x)) [= (\<lambda>x. g(x))" (** Equality - equivalence axioms inherited from FOL.thy **) (** - congruence of "=" is axiomatised implicitly **)
|
axiomatization
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
where
| |
where eq_iff: "t = t' \<longleftrightarrow> t [= t' \<and> t' [= t" (** Properties of canonical values given by greatest fixed point definitions **)
|
axiomatization
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
where
| |
where PO_iff: "t [= t' \<longleftrightarrow> <t,t'> : PO" and EQ_iff: "t = t' \<longleftrightarrow> <t,t'> : EQ" (** Behaviour of non-canonical terms (ie case) given by the following beta-rules **)
|
axiomatization
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
where
| |
where caseBtrue: "case(true,d,e,f,g) = d" and caseBfalse: "case(false,d,e,f,g) = e" and caseBpair: "case(<a,b>,d,e,f,g) = f(a,b)" and caseBlam: "\<And>b. case(lam x. b(x),d,e,f,g) = g(b)" and caseBbot: "case(bot,d,e,f,g) = bot" (* strictness *) (** The theory is non-trivial **)
|
axiomatization
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
where
| |
where distinctness: "\<not> lam x. b(x) = bot" (*** Definitions of Termination and Divergence ***)
|
axiomatization
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
where
| |
Dvg :: "i \<Rightarrow> o" where "Dvg(t) == t = bot"
|
definition
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
Dvg
| |
Trm :: "i \<Rightarrow> o" where "Trm(t) == \<not> Dvg(t)" text \<open> Would be interesting to build a similar theory for a typed programming language: ie. true :: bool, fix :: ('a\<Rightarrow>'a)\<Rightarrow>'a etc...... This is starting to look like LCF. What are the advantages of this approach? - less axiomatic - wfd induction / coinduction and fixed point induction available \<close> lemmas ccl_data_defs = apply_def fix_def declare po_refl [simp]
|
definition
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
Trm
| |
fun_cong : "(f::'a\<Rightarrow>'b) = g \<Longrightarrow> f(x)=g(x)" by simp (*similar to AP_TERM in Gordon's HOL and FOL's subst_context*)
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
fun_cong
| |
arg_cong : "x=y \<Longrightarrow> f(x)=f(y)" by simp
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
arg_cong
| |
abstractn : "(\<And>x. f(x) = g(x)) \<Longrightarrow> f = g" apply (simp add: eq_iff) apply (blast intro: po_abstractn) done lemmas caseBs = caseBtrue caseBfalse caseBpair caseBlam caseBbot
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
abstractn
| |
Trm_iff : "Trm(t) \<longleftrightarrow> \<not> t = bot" by (simp add: Trm_def Dvg_def)
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
Trm_iff
| |
Dvg_iff : "Dvg(t) \<longleftrightarrow> t = bot" by (simp add: Trm_def Dvg_def)
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
Dvg_iff
| |
eq_lemma : "\<lbrakk>x=a; y=b; x=y\<rbrakk> \<Longrightarrow> a=b" by simp ML \<open>
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
eq_lemma
| |
ccl_injs : "<a,b> = <a',b'> \<longleftrightarrow> (a=a' \<and> b=b')" "\<And>b b'. (lam x. b(x) = lam x. b'(x)) \<longleftrightarrow> ((ALL z. b(z)=b'(z)))" by (inj_rl caseBs)
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
ccl_injs
| |
pair_inject : "<a,b> = <a',b'> \<Longrightarrow> (a = a' \<Longrightarrow> b = b' \<Longrightarrow> R) \<Longrightarrow> R" by (simp add: ccl_injs)
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
pair_inject
| |
lem : "t=t' \<Longrightarrow> case(t,b,c,d,e) = case(t',b,c,d,e)" by simp ML \<open> local
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
lem
| |
mk_dstnct_thms ctxt defs inj_rls xs = let val thy = Proof_Context.theory_of ctxt;
|
fun
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
mk_dstnct_thms
| |
mkall_dstnct_thms ctxt defs i_rls xss = maps (mk_dstnct_thms ctxt defs i_rls) xss (*** Rewriting and Proving ***)
|
fun
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
mkall_dstnct_thms
| |
XH_to_I rl = rl RS @{thm iffD2}
|
fun
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
XH_to_I
| |
XH_to_D rl = rl RS @{thm iffD1} val XH_to_E = make_elim o XH_to_D val XH_to_Is = map XH_to_I val XH_to_Ds = map XH_to_D val XH_to_Es = map XH_to_E; ML_Thms.bind_thms ("ccl_rews", @{thms caseBs} @ @{thms ccl_injs} @ ccl_dstncts); ML_Thms.bind_thms ("ccl_dstnctsEs", ccl_dstncts RL [@{thm notE}]); ML_Thms.bind_thms ("ccl_injDs", XH_to_Ds @{thms ccl_injs}); \<close> lemmas [simp] = ccl_rews and [elim!] = pair_inject ccl_dstnctsEs and [dest!] = ccl_injDs
|
fun
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
XH_to_D
| |
XHlemma1 : "\<lbrakk>A=B; a:B \<longleftrightarrow> P\<rbrakk> \<Longrightarrow> a:A \<longleftrightarrow> P" by simp
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
XHlemma1
| |
XHlemma2 : "(P(t,t') \<longleftrightarrow> Q) \<Longrightarrow> (<t,t'> : {p. \<exists>t t'. p=<t,t'> \<and> P(t,t')} \<longleftrightarrow> Q)" by blast
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
XHlemma2
| |
POgen_mono : "mono(\<lambda>X. POgen(X))" apply (unfold POgen_def SIM_def) apply (rule monoI) apply blast done
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
POgen_mono
| |
POgenXH : "<t,t'> : POgen(R) \<longleftrightarrow> t= bot | (t=true \<and> t'=true) | (t=false \<and> t'=false) | (EX a a' b b'. t=<a,b> \<and> t'=<a',b'> \<and> <a,a'> : R \<and> <b,b'> : R) | (EX f f'. t=lam x. f(x) \<and> t'=lam x. f'(x) \<and> (ALL x. <f(x),f'(x)> : R))" apply (unfold POgen_def SIM_def) apply (rule iff_refl [THEN XHlemma2]) done
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
POgenXH
| |
poXH : "t [= t' \<longleftrightarrow> t=bot | (t=true \<and> t'=true) | (t=false \<and> t'=false) | (EX a a' b b'. t=<a,b> \<and> t'=<a',b'> \<and> a [= a' \<and> b [= b') | (EX f f'. t=lam x. f(x) \<and> t'=lam x. f'(x) \<and> (ALL x. f(x) [= f'(x)))" apply (simp add: PO_iff del: ex_simps) apply (rule POgen_mono [THEN PO_def [THEN def_gfp_Tarski], THEN XHlemma1, unfolded POgen_def SIM_def]) apply (rule iff_refl [THEN XHlemma2]) done
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
poXH
| |
po_bot : "bot [= b" apply (rule poXH [THEN iffD2]) apply simp done
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
po_bot
| |
bot_poleast : "a [= bot \<Longrightarrow> a=bot" apply (drule poXH [THEN iffD1]) apply simp done
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
bot_poleast
| |
po_pair : "<a,b> [= <a',b'> \<longleftrightarrow> a [= a' \<and> b [= b'" apply (rule poXH [THEN iff_trans]) apply simp done
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
po_pair
| |
po_lam : "lam x. f(x) [= lam x. f'(x) \<longleftrightarrow> (ALL x. f(x) [= f'(x))" apply (rule poXH [THEN iff_trans]) apply fastforce done lemmas ccl_porews = po_bot po_pair po_lam
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
po_lam
| |
case_pocong : assumes 1: "t [= t'" and 2: "a [= a'" and 3: "b [= b'" and 4: "\<And>x y. c(x,y) [= c'(x,y)" and 5: "\<And>u. d(u) [= d'(u)" shows "case(t,a,b,c,d) [= case(t',a',b',c',d')" apply (rule 1 [THEN po_cong, THEN po_trans]) apply (rule 2 [THEN po_cong, THEN po_trans]) apply (rule 3 [THEN po_cong, THEN po_trans]) apply (rule 4 [THEN po_abstractn, THEN po_abstractn, THEN po_cong, THEN po_trans]) apply (rule_tac f1 = "\<lambda>d. case (t',a',b',c',d)" in 5 [THEN po_abstractn, THEN po_cong, THEN po_trans]) apply (rule po_refl) done
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
case_pocong
| |
apply_pocong : "\<lbrakk>f [= f'; a [= a'\<rbrakk> \<Longrightarrow> f ` a [= f' ` a'" unfolding ccl_data_defs apply (rule case_pocong, (rule po_refl | assumption)+) apply (erule po_cong) done
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
apply_pocong
| |
npo_lam_bot : "\<not> lam x. b(x) [= bot" apply (rule notI) apply (drule bot_poleast) apply (erule distinctness [THEN notE]) done
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
npo_lam_bot
| |
po_lemma : "\<lbrakk>x=a; y=b; x[=y\<rbrakk> \<Longrightarrow> a[=b" by simp
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
po_lemma
| |
npo_pair_lam : "\<not> <a,b> [= lam x. f(x)" apply (rule notI) apply (rule npo_lam_bot [THEN notE]) apply (erule case_pocong [THEN caseBlam [THEN caseBpair [THEN po_lemma]]]) apply (rule po_refl npo_lam_bot)+ done
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
npo_pair_lam
| |
npo_lam_pair : "\<not> lam x. f(x) [= <a,b>" apply (rule notI) apply (rule npo_lam_bot [THEN notE]) apply (erule case_pocong [THEN caseBpair [THEN caseBlam [THEN po_lemma]]]) apply (rule po_refl npo_lam_bot)+ done
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
npo_lam_pair
| |
npo_rls1 : "\<not> true [= false" "\<not> false [= true" "\<not> true [= <a,b>" "\<not> <a,b> [= true" "\<not> true [= lam x. f(x)" "\<not> lam x. f(x) [= true" "\<not> false [= <a,b>" "\<not> <a,b> [= false" "\<not> false [= lam x. f(x)" "\<not> lam x. f(x) [= false" by (rule notI, drule case_pocong, erule_tac [5] rev_mp, simp_all, (rule po_refl npo_lam_bot)+)+ lemmas npo_rls = npo_pair_lam npo_lam_pair npo_rls1
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
npo_rls1
| |
po_coinduct : "\<lbrakk><t,u> : R; R <= POgen(R)\<rbrakk> \<Longrightarrow> t [= u" apply (rule PO_def [THEN def_coinduct, THEN PO_iff [THEN iffD2]]) apply assumption+ done
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
po_coinduct
| |
EQgen_mono : "mono(\<lambda>X. EQgen(X))" apply (unfold EQgen_def SIM_def) apply (rule monoI) apply blast done
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
EQgen_mono
| |
EQgenXH : "<t,t'> : EQgen(R) \<longleftrightarrow> (t=bot \<and> t'=bot) | (t=true \<and> t'=true) | (t=false \<and> t'=false) | (EX a a' b b'. t=<a,b> \<and> t'=<a',b'> \<and> <a,a'> : R \<and> <b,b'> : R) | (EX f f'. t=lam x. f(x) \<and> t'=lam x. f'(x) \<and> (ALL x.<f(x),f'(x)> : R))" apply (unfold EQgen_def SIM_def) apply (rule iff_refl [THEN XHlemma2]) done
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
EQgenXH
| |
eqXH : "t=t' \<longleftrightarrow> (t=bot \<and> t'=bot) | (t=true \<and> t'=true) | (t=false \<and> t'=false) | (EX a a' b b'. t=<a,b> \<and> t'=<a',b'> \<and> a=a' \<and> b=b') | (EX f f'. t=lam x. f(x) \<and> t'=lam x. f'(x) \<and> (ALL x. f(x)=f'(x)))" apply (subgoal_tac "<t,t'> : EQ \<longleftrightarrow> (t=bot \<and> t'=bot) | (t=true \<and> t'=true) | (t=false \<and> t'=false) | (EX a a' b b'. t=<a,b> \<and> t'=<a',b'> \<and> <a,a'> : EQ \<and> <b,b'> : EQ) | (EX f f'. t=lam x. f (x) \<and> t'=lam x. f' (x) \<and> (ALL x. <f (x) ,f' (x) > : EQ))") apply (erule rev_mp) apply (simp add: EQ_iff [THEN iff_sym]) apply (rule EQgen_mono [THEN EQ_def [THEN def_gfp_Tarski], THEN XHlemma1, unfolded EQgen_def SIM_def]) apply (rule iff_refl [THEN XHlemma2]) done
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
eqXH
| |
eq_coinduct : "\<lbrakk><t,u> : R; R <= EQgen(R)\<rbrakk> \<Longrightarrow> t = u" apply (rule EQ_def [THEN def_coinduct, THEN EQ_iff [THEN iffD2]]) apply assumption+ done
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
eq_coinduct
| |
eq_coinduct3 : "\<lbrakk><t,u> : R; R <= EQgen(lfp(\<lambda>x. EQgen(x) Un R Un EQ))\<rbrakk> \<Longrightarrow> t = u" apply (rule EQ_def [THEN def_coinduct3, THEN EQ_iff [THEN iffD2]]) apply (rule EQgen_mono | assumption)+ done method_setup eq_coinduct3 = \<open> Scan.lift Parse.embedded_inner_syntax >> (fn s => fn ctxt => SIMPLE_METHOD' (Rule_Insts.res_inst_tac ctxt [((("R", 0), Position.none), s)] [] @{thm eq_coinduct3})) \<close>
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
eq_coinduct3
| |
cond_eta : "(EX f. t=lam x. f(x)) \<Longrightarrow> t = lam x.(t ` x)" by (auto simp: apply_def)
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
cond_eta
| |
exhaustion : "(t=bot) | (t=true) | (t=false) | (EX a b. t=<a,b>) | (EX f. t=lam x. f(x))" apply (cut_tac refl [THEN eqXH [THEN iffD1]]) apply blast done
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
exhaustion
| |
term_case : "\<lbrakk>P(bot); P(true); P(false); \<And>x y. P(<x,y>); \<And>b. P(lam x. b(x))\<rbrakk> \<Longrightarrow> P(t)" using exhaustion [of t] by blast
|
lemma
|
src
|
[
"Gfp"
] |
src/CCL/CCL.thy
|
term_case
| |
idgen :: "i \<Rightarrow> i" where "idgen(f) == lam t. case(t,true,false, \<lambda>x y.<f`x, f`y>, \<lambda>u. lam x. f ` u(x))"
|
definition
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
idgen
| |
INCL :: "[i\<Rightarrow>o]\<Rightarrow>o" where INCL_def: "INCL(\<lambda>x. P(x)) == (ALL f.(ALL n:Nat. P(f^n`bot)) \<longrightarrow> P(fix(f)))" and po_INCL: "INCL(\<lambda>x. a(x) [= b(x))" and INCL_subst: "INCL(P) \<Longrightarrow> INCL(\<lambda>x. P((g::i\<Rightarrow>i)(x)))"
|
axiomatization
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
INCL
| |
fix_ind : assumes base: "P(bot)" and step: "\<And>x. P(x) \<Longrightarrow> P(f(x))" and incl: "INCL(P)" shows "P(fix(f))" apply (rule incl [unfolded INCL_def, rule_format]) apply (rule Nat_ind [THEN ballI], assumption) apply simp_all apply (rule base) apply (erule step) done
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
fix_ind
| |
inclXH : "INCL(P) \<longleftrightarrow> (ALL f. (ALL n:Nat. P(f ^ n ` bot)) \<longrightarrow> P(fix(f)))" by (simp add: INCL_def)
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
inclXH
| |
inclI : "\<lbrakk>\<And>f. ALL n:Nat. P(f^n`bot) \<Longrightarrow> P(fix(f))\<rbrakk> \<Longrightarrow> INCL(\<lambda>x. P(x))" unfolding inclXH by blast
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
inclI
| |
inclD : "\<lbrakk>INCL(P); \<And>n. n:Nat \<Longrightarrow> P(f^n`bot)\<rbrakk> \<Longrightarrow> P(fix(f))" unfolding inclXH by blast
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
inclD
| |
inclE : "\<lbrakk>INCL(P); (ALL n:Nat. P(f^n`bot)) \<longrightarrow> P(fix(f)) \<Longrightarrow> R\<rbrakk> \<Longrightarrow> R" by (blast dest: inclD)
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
inclE
| |
npo_INCL : "INCL(\<lambda>x. \<not> a(x) [= t)" apply (rule inclI) apply (drule bspec) apply (rule zeroT) apply (erule contrapos) apply (rule po_trans) prefer 2 apply assumption apply (subst napplyBzero) apply (rule po_cong, rule po_bot) done
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
npo_INCL
| |
conj_INCL : "\<lbrakk>INCL(P); INCL(Q)\<rbrakk> \<Longrightarrow> INCL(\<lambda>x. P(x) \<and> Q(x))" by (blast intro!: inclI dest!: inclD)
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
conj_INCL
| |
all_INCL : "(\<And>a. INCL(P(a))) \<Longrightarrow> INCL(\<lambda>x. ALL a. P(a,x))" by (blast intro!: inclI dest!: inclD)
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
all_INCL
| |
ball_INCL : "(\<And>a. a:A \<Longrightarrow> INCL(P(a))) \<Longrightarrow> INCL(\<lambda>x. ALL a:A. P(a,x))" by (blast intro!: inclI dest!: inclD)
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
ball_INCL
| |
eq_INCL : "INCL(\<lambda>x. a(x) = (b(x)::'a::prog))" apply (simp add: eq_iff) apply (rule conj_INCL po_INCL)+ done
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
eq_INCL
| |
fix_idgenfp : "idgen(fix(idgen)) = fix(idgen)" apply (rule fixB [symmetric]) done
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
fix_idgenfp
| |
id_idgenfp : "idgen(lam x. x) = lam x. x" apply (simp add: idgen_def) apply (rule term_case [THEN allI]) apply simp_all done (* All fixed points are lam-expressions *) schematic_goal idgenfp_lam: "idgen(d) = d \<Longrightarrow> d = lam x. ?f(x)" apply (unfold idgen_def) apply (erule ssubst) apply (rule refl) done (* Lemmas for rewriting fixed points of idgen *)
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
id_idgenfp
| |
l_lemma : "\<lbrakk>a = b; a ` t = u\<rbrakk> \<Longrightarrow> b ` t = u" by (simp add: idgen_def)
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
l_lemma
| |
idgen_lemmas : "idgen(d) = d \<Longrightarrow> d ` bot = bot" "idgen(d) = d \<Longrightarrow> d ` true = true" "idgen(d) = d \<Longrightarrow> d ` false = false" "idgen(d) = d \<Longrightarrow> d ` <a,b> = <d ` a,d ` b>" "idgen(d) = d \<Longrightarrow> d ` (lam x. f(x)) = lam x. d ` f(x)" by (erule l_lemma, simp add: idgen_def)+ (* Proof of Reachability law - show that fix and lam x.x both give LEAST fixed points of idgen and hence are they same *)
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
idgen_lemmas
| |
po_eta : "\<lbrakk>ALL x. t ` x [= u ` x; EX f. t=lam x. f(x); EX f. u=lam x. f(x)\<rbrakk> \<Longrightarrow> t [= u" apply (drule cond_eta)+ apply (erule ssubst) apply (erule ssubst) apply (rule po_lam [THEN iffD2]) apply simp done schematic_goal po_eta_lemma: "idgen(d) = d \<Longrightarrow> d = lam x. ?f(x)" apply (unfold idgen_def) apply (erule sym) done
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
po_eta
| |
lemma1 : "idgen(d) = d \<Longrightarrow> {p. EX a b. p=<a,b> \<and> (EX t. a=fix(idgen) ` t \<and> b = d ` t)} <= POgen({p. EX a b. p=<a,b> \<and> (EX t. a=fix(idgen) ` t \<and> b = d ` t)})" apply clarify apply (rule_tac t = t in term_case) apply (simp_all add: POgenXH idgen_lemmas idgen_lemmas [OF fix_idgenfp]) apply blast apply fast done
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
lemma1
| |
fix_least_idgen : "idgen(d) = d \<Longrightarrow> fix(idgen) [= d" apply (rule allI [THEN po_eta]) apply (rule lemma1 [THEN [2] po_coinduct]) apply (blast intro: po_eta_lemma fix_idgenfp)+ done
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
fix_least_idgen
| |
lemma2 : "idgen(d) = d \<Longrightarrow> {p. EX a b. p=<a,b> \<and> b = d ` a} <= POgen({p. EX a b. p=<a,b> \<and> b = d ` a})" apply clarify apply (rule_tac t = a in term_case) apply (simp_all add: POgenXH idgen_lemmas) apply fast done
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
lemma2
| |
id_least_idgen : "idgen(d) = d \<Longrightarrow> lam x. x [= d" apply (rule allI [THEN po_eta]) apply (rule lemma2 [THEN [2] po_coinduct]) apply simp apply (fast intro: po_eta_lemma fix_idgenfp)+ done
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
id_least_idgen
| |
reachability : "fix(idgen) = lam x. x" apply (fast intro: eq_iff [THEN iffD2] id_idgenfp [THEN fix_least_idgen] fix_idgenfp [THEN id_least_idgen]) done (********)
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
reachability
| |
id_apply : "f = lam x. x \<Longrightarrow> f`t = t" apply (erule ssubst) apply (rule applyB) done
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
id_apply
| |
term_ind : assumes 1: "P(bot)" and 2: "P(true)" and 3: "P(false)" and 4: "\<And>x y. \<lbrakk>P(x); P(y)\<rbrakk> \<Longrightarrow> P(<x,y>)" and 5: "\<And>u.(\<And>x. P(u(x))) \<Longrightarrow> P(lam x. u(x))" and 6: "INCL(P)" shows "P(t)" apply (rule reachability [THEN id_apply, THEN subst]) apply (rule_tac x = t in spec) apply (rule fix_ind) apply (unfold idgen_def) apply (rule allI) apply (subst applyBbot) apply (rule 1) apply (rule allI) apply (rule applyB [THEN ssubst]) apply (rule_tac t = "xa" in term_case) apply simp_all apply (fast intro: assms INCL_subst all_INCL)+ done
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Fix.thy
|
term_ind
| |
gfp :: "['a set\<Rightarrow>'a set] \<Rightarrow> 'a set" where \<comment> \<open>greatest fixed point\<close> "gfp(f) == Union({u. u <= f(u)})" (* gfp(f) is the least upper bound of {u. u <= f(u)} *)
|
definition
|
src
|
[
"Lfp"
] |
src/CCL/Gfp.thy
|
gfp
| |
gfp_upperbound : "A <= f(A) \<Longrightarrow> A <= gfp(f)" unfolding gfp_def by blast
|
lemma
|
src
|
[
"Lfp"
] |
src/CCL/Gfp.thy
|
gfp_upperbound
| |
gfp_least : "(\<And>u. u <= f(u) \<Longrightarrow> u <= A) \<Longrightarrow> gfp(f) <= A" unfolding gfp_def by blast
|
lemma
|
src
|
[
"Lfp"
] |
src/CCL/Gfp.thy
|
gfp_least
| |
gfp_lemma2 : "mono(f) \<Longrightarrow> gfp(f) <= f(gfp(f))" by (rule gfp_least, rule subset_trans, assumption, erule monoD, rule gfp_upperbound, assumption)
|
lemma
|
src
|
[
"Lfp"
] |
src/CCL/Gfp.thy
|
gfp_lemma2
| |
gfp_lemma3 : "mono(f) \<Longrightarrow> f(gfp(f)) <= gfp(f)" by (rule gfp_upperbound, frule monoD, rule gfp_lemma2, assumption+)
|
lemma
|
src
|
[
"Lfp"
] |
src/CCL/Gfp.thy
|
gfp_lemma3
| |
gfp_Tarski : "mono(f) \<Longrightarrow> gfp(f) = f(gfp(f))" by (rule equalityI gfp_lemma2 gfp_lemma3 | assumption)+ (*** Coinduction rules for greatest fixed points ***) (*weak version*)
|
lemma
|
src
|
[
"Lfp"
] |
src/CCL/Gfp.thy
|
gfp_Tarski
| |
coinduct : "\<lbrakk>a: A; A <= f(A)\<rbrakk> \<Longrightarrow> a : gfp(f)" by (blast dest: gfp_upperbound)
|
lemma
|
src
|
[
"Lfp"
] |
src/CCL/Gfp.thy
|
coinduct
| |
coinduct2_lemma : "\<lbrakk>A <= f(A) Un gfp(f); mono(f)\<rbrakk> \<Longrightarrow> A Un gfp(f) <= f(A Un gfp(f))" apply (rule subset_trans) prefer 2 apply (erule mono_Un) apply (rule subst, erule gfp_Tarski) apply (erule Un_least) apply (rule Un_upper2) done (*strong version, thanks to Martin Coen*)
|
lemma
|
src
|
[
"Lfp"
] |
src/CCL/Gfp.thy
|
coinduct2_lemma
| |
coinduct2 : "\<lbrakk>a: A; A <= f(A) Un gfp(f); mono(f)\<rbrakk> \<Longrightarrow> a : gfp(f)" apply (rule coinduct) prefer 2 apply (erule coinduct2_lemma, assumption) apply blast done (*** Even Stronger version of coinduct [by Martin Coen] - instead of the condition A <= f(A) consider A <= (f(A) Un f(f(A)) ...) Un gfp(A) ***)
|
lemma
|
src
|
[
"Lfp"
] |
src/CCL/Gfp.thy
|
coinduct2
| |
coinduct3_mono_lemma : "mono(f) \<Longrightarrow> mono(\<lambda>x. f(x) Un A Un B)" by (rule monoI) (blast dest: monoD)
|
lemma
|
src
|
[
"Lfp"
] |
src/CCL/Gfp.thy
|
coinduct3_mono_lemma
| |
coinduct3_lemma : assumes prem: "A <= f(lfp(\<lambda>x. f(x) Un A Un gfp(f)))" and mono: "mono(f)" shows "lfp(\<lambda>x. f(x) Un A Un gfp(f)) <= f(lfp(\<lambda>x. f(x) Un A Un gfp(f)))" apply (rule subset_trans) apply (rule mono [THEN coinduct3_mono_lemma, THEN lfp_lemma3]) apply (rule Un_least [THEN Un_least]) apply (rule subset_refl) apply (rule prem) apply (rule mono [THEN gfp_Tarski, THEN equalityD1, THEN subset_trans]) apply (rule mono [THEN monoD]) apply (subst mono [THEN coinduct3_mono_lemma, THEN lfp_Tarski]) apply (rule Un_upper2) done
|
lemma
|
src
|
[
"Lfp"
] |
src/CCL/Gfp.thy
|
coinduct3_lemma
| |
coinduct3 : assumes 1: "a:A" and 2: "A <= f(lfp(\<lambda>x. f(x) Un A Un gfp(f)))" and 3: "mono(f)" shows "a : gfp(f)" apply (rule coinduct) prefer 2 apply (rule coinduct3_lemma [OF 2 3]) apply (subst lfp_Tarski [OF coinduct3_mono_lemma, OF 3]) using 1 apply blast done
|
lemma
|
src
|
[
"Lfp"
] |
src/CCL/Gfp.thy
|
coinduct3
| |
def_gfp_Tarski : "\<lbrakk>h == gfp(f); mono(f)\<rbrakk> \<Longrightarrow> h = f(h)" apply unfold apply (erule gfp_Tarski) done
|
lemma
|
src
|
[
"Lfp"
] |
src/CCL/Gfp.thy
|
def_gfp_Tarski
| |
def_coinduct : "\<lbrakk>h == gfp(f); a:A; A <= f(A)\<rbrakk> \<Longrightarrow> a: h" apply unfold apply (erule coinduct) apply assumption done
|
lemma
|
src
|
[
"Lfp"
] |
src/CCL/Gfp.thy
|
def_coinduct
| |
def_coinduct2 : "\<lbrakk>h == gfp(f); a:A; A <= f(A) Un h; mono(f)\<rbrakk> \<Longrightarrow> a: h" apply unfold apply (erule coinduct2) apply assumption apply assumption done
|
lemma
|
src
|
[
"Lfp"
] |
src/CCL/Gfp.thy
|
def_coinduct2
| |
def_coinduct3 : "\<lbrakk>h == gfp(f); a:A; A <= f(lfp(\<lambda>x. f(x) Un A Un h)); mono(f)\<rbrakk> \<Longrightarrow> a: h" apply unfold apply (erule coinduct3) apply assumption apply assumption done (*Monotonicity of gfp!*)
|
lemma
|
src
|
[
"Lfp"
] |
src/CCL/Gfp.thy
|
def_coinduct3
| |
gfp_mono : "\<lbrakk>mono(f); \<And>Z. f(Z) <= g(Z)\<rbrakk> \<Longrightarrow> gfp(f) <= gfp(g)" apply (rule gfp_upperbound) apply (rule subset_trans) apply (rule gfp_lemma2) apply assumption apply (erule meta_spec) done
|
lemma
|
src
|
[
"Lfp"
] |
src/CCL/Gfp.thy
|
gfp_mono
| |
HTTgen :: "i set \<Rightarrow> i set" where "HTTgen(R) == {t. t=true | t=false | (EX a b. t= <a, b> \<and> a : R \<and> b : R) | (EX f. t = lam x. f(x) \<and> (ALL x. f(x) : R))}"
|
definition
|
src
|
[
"Type"
] |
src/CCL/Hered.thy
|
HTTgen
| |
HTT :: "i set" where "HTT == gfp(HTTgen)"
|
definition
|
src
|
[
"Type"
] |
src/CCL/Hered.thy
|
HTT
| |
HTTgen_mono : "mono(\<lambda>X. HTTgen(X))" apply (unfold HTTgen_def) apply (rule monoI) apply blast done
|
lemma
|
src
|
[
"Type"
] |
src/CCL/Hered.thy
|
HTTgen_mono
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.