(*<*) theory Wellformed imports IVSubst BTVSubst begin (*>*)
chapter‹Wellformed Terms›
text‹We require that expressions and values are well-formed. This includes a notion
well-sortedness. We identify a sort with a basic type and
the judgement as two clusters of mutually recursive
predicates. Some of the proofs are across all of the predicates and
they seemed at first to be daunting, they have all
out well.›
named_theorems ms_wb "Facts for helping with well-sortedness"
| wfV_consI: "[ AF_typedef s dclist ∈ set Θ; (dc, { x : b' | c }) ∈ set dclist ; Θ; B; Γ ⊨wf v : b' \<rbrakk> ==> Θ; B; Γ ⊨wf V_cons s dc v : B_id s"
| wfV_conspI: "[ AF_typedef_poly s bv dclist ∈ set Θ; (dc, { x : b' | c }) ∈ set dclist ; Θ ; B⊨wf b; atom bv ♯ (Θ, B, Γ, b , v); Θ; B; Γ ⊨wf v : b'[bv::=b]bb \<rbrakk> ==> Θ; B; Γ ⊨wf V_consp s dc b v : B_app s b"
| wfCE_valI : "[ Θ; B; Γ ⊨wf v : b \<rbrakk> ==> Θ; B; Γ ⊨wf CE_val v : b"
text‹This setup of 'avoiding' is not complete and for some of lemmas, such as weakening,
it the hard way› nominal_inductive wfV avoids wfV_conspI: bv | wfTI: z proof(goal_cases) case (1 s bv dclist Θ dc x b' c B b Γ v)
moreoverhence"atom bv ♯ V_consp s dc b v"using v.fresh fresh_prodN pure_fresh by metis moreoverhave"atom bv ♯ B_app s b"using b.fresh fresh_prodN pure_fresh 1by metis ultimatelyshow ?caseusing b.fresh v.fresh pure_fresh fresh_star_def fresh_prodN by fastforce next case (2 s bv dclist Θ dc x b' c B b Γ v) thenshow ?caseby auto next case (3 z Γ Θ B b c) thenshow ?caseusing τ.fresh fresh_star_def fresh_prodN by fastforce next case (4 z Γ Θ B b c) thenshow ?caseby auto qed
| wfE_appI: "[ Θ ⊨wf Φ ; Θ; B; Γ ⊨wf Δ; Some (AF_fundef f (AF_fun_typ_none (AF_fun_typ x b c τ s))) = lookup_fun Φ f ; Θ; B; Γ ⊨wf v : b \<rbrakk> ==> Θ; Φ; B; Γ; Δ ⊨wf AE_app f v : b_of τ"
| wfE_appPI: "[ Θ ⊨wf Φ ; Θ; B; Γ ⊨wf Δ; Θ; B⊨wf b'; atom bv ♯ (Φ, Θ, B, Γ, Δ, b', v, (b_of τ)[bv::=b']b); Some (AF_fundef f (AF_fun_typ_some bv (AF_fun_typ x b c τ s))) = lookup_fun Φ f; Θ; B; Γ ⊨wf v : (b[bv::=b']b) \<rbrakk> ==> Θ; Φ; B; Γ; Δ ⊨wf (AE_appP f b' v) : ((b_of τ)[bv::=b']b)"
| wfS_letI: "[ wfE Θ Φ B Γ Δ e b' ; Θ ; Φ ; B ; (x,b',C_true) #\<Gamma> Γ ; Δ ⊨wf s : b; Θ; B; Γ ⊨wf Δ ; atom x ♯ (Φ, Θ, B, Γ, Δ, e, b) \<rbrakk> ==> Θ; Φ; B; Γ; Δ ⊨wf LET x = e IN s : b"
| wfS_assertI: "[ Θ ; Φ ; B ; (x,B_bool,c) #\<Gamma> Γ ; Δ ⊨wf s : b; Θ; B; Γ ⊨wf c ; Θ; B; Γ ⊨wf Δ ; atom x ♯ (Φ, Θ, B, Γ, Δ, c, b, s) \<rbrakk> ==> Θ; Φ; B; Γ; Δ ⊨wf ASSERT c IN s : b"
| wfS_let2I: "[ Θ; Φ; B; Γ; Δ ⊨wf s1 : b_of τ ; Θ; B; Γ ⊨wf τ; Θ ; Φ ; B ; (x,b_of τ,C_true) #\<Gamma> Γ ; Δ ⊨wf s2 : b ; atom x ♯ (Φ, Θ, B, Γ, Δ, s1, b,τ) \<rbrakk> ==> Θ; Φ; B; Γ; Δ ⊨wf LET x : τ = s1 IN s2 : b"
| wfS_ifI: "[ Θ; B; Γ ⊨wf v : B_bool; Θ; Φ; B; Γ; Δ ⊨wf s1 : b ; Θ; Φ; B; Γ; Δ ⊨wf s2 : b \<rbrakk> ==> Θ; Φ; B; Γ; Δ ⊨wf IF v THEN s1 ELSE s2 : b"
| wfS_varI : "[ wfT Θ B Γ τ ; Θ; B; Γ ⊨wf v : b_of τ; atom u ♯ (Φ, Θ, B, Γ, Δ, τ, v, b); Θ ; Φ ; B ; Γ ; (u,τ)#\<Delta>Δ ⊨wf s : b \<rbrakk> ==> Θ; Φ; B; Γ; Δ ⊨wf VAR u : τ = v IN s : b "
| wfFTI: "[ Θ ; B ⊨wf b; supp s ⊆ {atom x} ∪ supp B ; supp c ⊆ { atom x } ; Θ ; B ; (x,b,c) #\<Gamma> GNil ⊨wf τ; Θ ⊨wf Φ \<rbrakk> ==> Θ ; Φ ; B ⊨wf (AF_fun_typ x b c τ s)"
inductive_cases wfFTQ_elims: "Θ ; Φ ⊨wf AF_fun_typ_none ft" "Θ ; Φ ⊨wf AF_fun_typ_some bv ft" "Θ ; Φ ⊨wf AF_fun_typ_some bv (AF_fun_typ x b c τ s)"
inductive_cases wfFT_elims: "Θ ; Φ ; B⊨wf AF_fun_typ x b c τ s"
declare[[ simproc add: alpha_lst]]
inductive_cases wfD_elims: "Π ; B ; (Γ::Γ) ⊨wf []\<Delta>" "Π ; B ; (Γ::Γ) ⊨wf (u,τ) #\<Delta> Δ::Δ"
equivariance wfE
nominal_inductive wfE avoids wfE_appPI: bv | wfS_varI: u | wfS_letI: x | wfS_let2I: x | wfS_branchI: x | wfS_assertI: x
proof(goal_cases) case (1 Θ Φ B Γ Δ b' bv v τ f x b c s) moreoverhence"atom bv ♯ AE_appP f b' v"using pure_fresh fresh_prodN e.fresh by auto ultimatelyshow ?caseusing fresh_star_def by fastforce next case (2 Θ Φ B Γ Δ b' bv v τ f x b c s) thenshow ?caseby auto next case (3 Φ Θ B Γ Δ e b' x s b) moreoverhence"atom x ♯ LET x = e IN s"using fresh_prodN by auto ultimatelyshow ?caseusing fresh_prodN fresh_star_def by fastforce next case (4 Φ Θ B Γ Δ e b' x s b) thenshow ?caseby auto next case (5 Θ Φ B x c Γ Δ s b) hence"atom x ♯ ASSERT c IN s"using s_branch_s_branch_list.fresh by auto thenshow ?caseusing fresh_prodN fresh_star_def 5by fastforce next case (6 Θ Φ B x c Γ Δ s b) thenshow ?caseby auto next case (7 Φ Θ B Γ Δ s1 τ x s2 b) hence"atom x ♯ τ ∧ atom x ♯ s1"using fresh_prodN by metis moreoverhence"atom x ♯ LET x : τ = s1 IN s2" using s_branch_s_branch_list.fresh(3)[of "atom x" x "τ" s1 s2 ] fresh_prodN by simp ultimatelyshow ?caseusing fresh_prodN fresh_star_def 7by fastforce next case (8 Φ Θ B Γ Δ s1 τ x s2 b) thenshow ?caseby auto next case (9 Θ B Γ τ v u Φ Δ b s) moreoverhence" atom u ♯ AS_var u τ v s"using fresh_prodN s_branch_s_branch_list.fresh by simp ultimatelyshow ?caseusing fresh_star_def fresh_prodN s_branch_s_branch_list.fresh by fastforce next case (10 Θ B Γ τ v u Φ Δ b s) thenshow ?caseby auto next case (11 Φ Θ B x τ Γ Δ s b tid dc) moreoverhave"atom x ♯ (dc x ==> s)"using pure_fresh s_branch_s_branch_list.fresh byauto ultimatelyshow ?caseusing fresh_prodN fresh_star_def pure_fresh by fastforce next case (12 Φ Θ B x τ Γ Δ s b tid dc) thenshow ?caseby auto qed
inductive wfVDs :: "var_def list ==> bool"where
wfVDs_nilI: "wfVDs []"
| wfVDs_consI: "[ atom u ♯ ts; wfV ([]::Θ) {||} GNil v (b_of τ); wfT ([]::Θ) {||} GNil τ; wfVDs ts \<rbrakk> ==> wfVDs ((AV_def u τ v)#ts)"
equivariance wfVDs nominal_inductive wfVDs .
end
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.4 Sekunden
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.