Skip to content

Commit d2e05f9

Browse files
committed
Add combined binder_inductive command for POPL submission
1 parent 3699847 commit d2e05f9

File tree

14 files changed

+47
-46
lines changed

14 files changed

+47
-46
lines changed

Tools/binder_inductive.ML

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
signature BINDER_INDUCTIVE =
22
sig
3-
3+
val binder_inductive_cmd: (string * (string * string list) list option) * (string list option * string list option)
4+
-> local_theory -> Proof.state;
45
end
56

67
structure Binder_Inductive : BINDER_INDUCTIVE =
@@ -991,7 +992,7 @@ val binder_inductive_parser = Parse.name -- Scan.option (
991992
) -- parse_perm_supps
992993

993994
val _ =
994-
Outer_Syntax.local_theory_to_proof \<^command_keyword>\<open>binder_inductive\<close> "derive strengthened induction theorems for inductive predicates"
995+
Outer_Syntax.local_theory_to_proof \<^command_keyword>\<open>binder_inductive_split\<close> "derive strengthened induction theorems for inductive predicates"
995996
(binder_inductive_parser >> binder_inductive_cmd);
996997

997998
end

Tools/binder_inductive_combined.ML

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
structure Binder_Inductive_Combined =
2+
struct
3+
4+
fun ind_decl co args =
5+
let
6+
val names = map (fn (x, _, _) => x) (fst (Parse.vars args));
7+
val (inductive, rest) = Inductive.gen_ind_decl Inductive.add_ind_def co args;
8+
in (fn lthy =>
9+
let
10+
val lthy = snd (Local_Theory.begin_nested lthy);
11+
val lthy = inductive lthy;
12+
val (lthy, old_lthy) = `Local_Theory.end_nested lthy;
13+
val state = Binder_Inductive.binder_inductive_cmd ((Binding.name_of (hd names), NONE), (NONE, NONE)) lthy
14+
in state end, rest) end;
15+
16+
val _ =
17+
Outer_Syntax.local_theory_to_proof \<^command_keyword>\<open>binder_inductive\<close> "derive strengthened induction theorems for inductive predicates"
18+
(ind_decl false);
19+
20+
end

thys/Infinitary_FOL/InfFOL.thy

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,16 +342,14 @@ qed
342342
lemma Int_Diff_empty: "A \<inter> (B - C) = {} \<Longrightarrow> A \<inter> C = {} \<Longrightarrow> A \<inter> B = {}"
343343
by blast
344344

345-
inductive deduct :: "ifol set\<^sub>k \<Rightarrow> ifol \<Rightarrow> bool" (infix "\<turnstile>" 100) where
345+
binder_inductive deduct :: "ifol set\<^sub>k \<Rightarrow> ifol \<Rightarrow> bool" (infix "\<turnstile>" 100) where
346346
Hyp: "f \<in>\<^sub>k \<Delta> \<Longrightarrow> \<Delta> \<turnstile> f"
347347
| ConjI: "(\<And>f. f \<in>\<^sub>k\<^sub>1 F \<Longrightarrow> \<Delta> \<turnstile> f) \<Longrightarrow> \<Delta> \<turnstile> Conj F"
348348
| ConjE: "\<lbrakk> \<Delta> \<turnstile> Conj F ; f \<in>\<^sub>k\<^sub>1 F \<rbrakk> \<Longrightarrow> \<Delta> \<turnstile> f"
349349
| NegI: "\<Delta>,f \<turnstile> \<bottom> \<Longrightarrow> \<Delta> \<turnstile> Neg f"
350350
| NegE: "\<lbrakk> \<Delta> \<turnstile> Neg f ; \<Delta> \<turnstile> f \<rbrakk> \<Longrightarrow> \<Delta> \<turnstile> \<bottom>"
351351
| AllI: "\<lbrakk> \<Delta> \<turnstile> f ; set\<^sub>k\<^sub>2 V \<inter> \<Union>(FFVars_ifol' ` set\<^sub>k \<Delta>) = {} \<rbrakk> \<Longrightarrow> \<Delta> \<turnstile> All V f"
352352
| AllE: "\<lbrakk> \<Delta> \<turnstile> All V f ; supp \<rho> \<subseteq> set\<^sub>k\<^sub>2 V \<rbrakk> \<Longrightarrow> \<Delta> \<turnstile> f\<lbrakk>\<rho>\<rbrakk>"
353-
354-
binder_inductive deduct
355353
subgoal for R B \<sigma> x1 x2
356354
unfolding induct_rulify_fallback split_beta
357355
apply (elim disj_forward exE)

thys/Infinitary_Lambda_Calculus/ILC_Beta.thy

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@ lemma small_Tsupp: "small (Tsupp t1 t2)"
1818
lemma Tvars_dsset: "(Tsupp t1 t2 - dsset xs) \<inter> dsset xs = {}" "|Tsupp t1 t2 - dsset xs| <o |UNIV::ivar set|"
1919
apply auto by (meson card_of_minus_bound small_Tsupp small_def)
2020

21-
inductive istep :: "itrm \<Rightarrow> itrm \<Rightarrow> bool" where
21+
binder_inductive istep :: "itrm \<Rightarrow> itrm \<Rightarrow> bool" where
2222
Beta: "istep (iApp (iLam xs e1) es2) (itvsubst (imkSubst xs es2) e1)"
2323
| iAppL: "istep e1 e1' \<Longrightarrow> istep (iApp e1 es2) (iApp e1' es2)"
2424
| iAppR: "istep (snth es2 i) e2' \<Longrightarrow> istep (iApp e1 es2) (iApp e1 (supd es2 i e2'))"
2525
| Xi: "istep e e' \<Longrightarrow> istep (iLam xs e) (iLam xs e')"
26-
27-
binder_inductive istep
2826
subgoal for R B \<sigma> x1 x2
2927
apply (elim disj_forward exE conjE)
3028
subgoal for xs e1 es2

thys/Infinitary_Lambda_Calculus/ILC_affine.thy

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ begin
1010
lemma Tvars_dsset: "(FFVars t - dsset xs) \<inter> dsset xs = {}" "|FFVars t - dsset xs| <o |UNIV::ivar set|"
1111
apply auto using card_of_minus_bound iterm.set_bd_UNIV by blast
1212

13-
inductive affine :: "itrm \<Rightarrow> bool" where
13+
binder_inductive affine :: "itrm \<Rightarrow> bool" where
1414
iVar[simp,intro!]: "affine (iVar x)"
1515
|iLam: "affine e \<Longrightarrow> affine (iLam xs e)"
1616
|iApp:
@@ -20,8 +20,6 @@ inductive affine :: "itrm \<Rightarrow> bool" where
2020
(\<And>i j. i \<noteq> j \<Longrightarrow> FFVars (snth es2 i) \<inter> FFVars (snth es2 j) = {})
2121
\<Longrightarrow>
2222
affine (iApp e1 es2)"
23-
24-
binder_inductive affine
2523
unfolding isPerm_def induct_rulify_fallback
2624
subgoal for R B \<sigma> t
2725
apply(elim disjE)

thys/MRBNF_Recursor.thy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ theory MRBNF_Recursor
22
imports MRBNF_FP
33
keywords "binder_datatype" :: thy_defn
44
and "binder_inductive" :: thy_goal_defn
5+
and "binder_inductive_split" :: thy_goal_defn
56
and "binds"
67
begin
78

@@ -14,6 +15,7 @@ context begin
1415
ML_file \<open>../Tools/binder_induction.ML\<close>
1516
end
1617
ML_file \<open>../Tools/binder_inductive.ML\<close>
18+
ML_file \<open>../Tools/binder_inductive_combined.ML\<close>
1719

1820
typedecl ('a, 'b) var_selector (infix "::" 999)
1921

thys/POPLmark/SystemFSub.thy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ declare ty.intros[intro]
276276
lemma ty_fresh_extend: "\<Gamma>, x <: U \<turnstile> S <: T \<Longrightarrow> x \<notin> dom \<Gamma> \<union> FFVars_ctxt \<Gamma> \<and> x \<notin> FFVars_typ U"
277277
by (metis (no_types, lifting) UnE fst_conv snd_conv subsetD wf_ConsE wf_FFVars wf_context)
278278

279-
binder_inductive ty
279+
binder_inductive_split ty
280280
subgoal for R B \<sigma> \<Gamma> T1 T2
281281
unfolding split_beta
282282
by (elim disj_forward exE)

thys/Pi_Calculus/Pi_Transition_Early.thy

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@ theory Pi_Transition_Early
22
imports Pi_Transition_Common
33
begin
44

5-
inductive trans :: "trm \<Rightarrow> cmt \<Rightarrow> bool" where
6-
InpE: "trans (Inp a x P) (Finp a y (P[y/x]))"
7-
| ComLeftE: "\<lbrakk> trans P (Finp a x P') ; trans Q (Fout a x Q') \<rbrakk> \<Longrightarrow> trans (P \<parallel> Q) (Tau (P' \<parallel> Q'))"
8-
| CloseLeftE: "\<lbrakk> trans P (Finp a x P') ; trans Q (Bout a x Q') ; x \<notin> {a} \<union> FFVars P \<rbrakk> \<Longrightarrow> trans (P \<parallel> Q) (Tau (Res x (P' \<parallel> Q')))"
9-
| Open: "\<lbrakk> trans P (Fout a x P') ; a \<noteq> x \<rbrakk> \<Longrightarrow> trans (Res x P) (Bout a x P')"
10-
| ScopeFree: "\<lbrakk> trans P (Cmt \<alpha> P') ; fra \<alpha> ; x \<notin> ns \<alpha> \<rbrakk> \<Longrightarrow> trans (Res x P) (Cmt \<alpha> (Res x P'))"
11-
| ScopeBound: "\<lbrakk> trans P (Bout a x P') ; y \<notin> {a, x} ; x \<notin> FFVars P \<union> {a} \<rbrakk> \<Longrightarrow> trans (Res y P) (Bout a x (Res y P'))"
12-
| ParLeft: "\<lbrakk> trans P (Cmt \<alpha> P') ; bns \<alpha> \<inter> (FFVars P \<union> FFVars Q) = {} \<rbrakk> \<Longrightarrow> trans (P \<parallel> Q) (Cmt \<alpha> (P' \<parallel> Q))"
13-
145
(*
156
lemma "B = bvars \<alpha>' \<Longrightarrow> P = Paa \<parallel> Qaa \<Longrightarrow> Q = Cmt \<alpha>' (P'a \<parallel> Qaa) \<Longrightarrow> R Paa (Cmt \<alpha>' P'a) \<Longrightarrow>
167
bvars \<alpha>' \<inter> (FFVars Paa \<union> FFVars Qaa) = {} \<Longrightarrow>
@@ -22,7 +13,14 @@ lemma "B = bvars \<alpha>' \<Longrightarrow> P = Paa \<parallel> Qaa \<Longright
2213
apply (cases \<alpha>'; hypsubst_thin; unfold Cmt.simps bns.simps)
2314
*)
2415

25-
binder_inductive trans
16+
binder_inductive trans :: "trm \<Rightarrow> cmt \<Rightarrow> bool" where
17+
InpE: "trans (Inp a x P) (Finp a y (P[y/x]))"
18+
| ComLeftE: "\<lbrakk> trans P (Finp a x P') ; trans Q (Fout a x Q') \<rbrakk> \<Longrightarrow> trans (P \<parallel> Q) (Tau (P' \<parallel> Q'))"
19+
| CloseLeftE: "\<lbrakk> trans P (Finp a x P') ; trans Q (Bout a x Q') ; x \<notin> {a} \<union> FFVars P \<rbrakk> \<Longrightarrow> trans (P \<parallel> Q) (Tau (Res x (P' \<parallel> Q')))"
20+
| Open: "\<lbrakk> trans P (Fout a x P') ; a \<noteq> x \<rbrakk> \<Longrightarrow> trans (Res x P) (Bout a x P')"
21+
| ScopeFree: "\<lbrakk> trans P (Cmt \<alpha> P') ; fra \<alpha> ; x \<notin> ns \<alpha> \<rbrakk> \<Longrightarrow> trans (Res x P) (Cmt \<alpha> (Res x P'))"
22+
| ScopeBound: "\<lbrakk> trans P (Bout a x P') ; y \<notin> {a, x} ; x \<notin> FFVars P \<union> {a} \<rbrakk> \<Longrightarrow> trans (Res y P) (Bout a x (Res y P'))"
23+
| ParLeft: "\<lbrakk> trans P (Cmt \<alpha> P') ; bns \<alpha> \<inter> (FFVars P \<union> FFVars Q) = {} \<rbrakk> \<Longrightarrow> trans (P \<parallel> Q) (Cmt \<alpha> (P' \<parallel> Q))"
2624
subgoal for R B \<sigma> x1 x2
2725
apply simp
2826
apply (elim disj_forward)

thys/Pi_Calculus/Pi_Transition_Late.thy

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@ theory Pi_Transition_Late
22
imports Pi_Transition_Common
33
begin
44

5-
inductive trans :: "trm \<Rightarrow> cmt \<Rightarrow> bool" where
5+
binder_inductive trans :: "trm \<Rightarrow> cmt \<Rightarrow> bool" where
66
InpL: "trans (Inp a x P) (Binp a x P)"
77
| ComLeftL: "\<lbrakk> trans P (Binp a x P') ; trans Q (Fout a y Q') \<rbrakk> \<Longrightarrow> trans (P \<parallel> Q) (Tau ((P'[y/x]) \<parallel> Q'))"
88
| CloseLeftL: "\<lbrakk> trans P (Binp a x P') ; trans Q (Bout a x Q') \<rbrakk> \<Longrightarrow> trans (P \<parallel> Q) (Tau (Res x (P' \<parallel> Q')))"
99
| Open: "\<lbrakk> trans P (Fout a x P') ; a \<noteq> x \<rbrakk> \<Longrightarrow> trans (Res x P) (Bout a x P')"
1010
| ScopeFree: "\<lbrakk> trans P (Cmt \<alpha> P') ; fra \<alpha> ; x \<notin> ns \<alpha> \<rbrakk> \<Longrightarrow> trans (Res x P) (Cmt \<alpha> (Res x P'))"
1111
| ScopeBound: "\<lbrakk> trans P (Bout a x P') ; y \<notin> {a, x} ; x \<notin> FFVars P \<union> {a} \<rbrakk> \<Longrightarrow> trans (Res y P) (Bout a x (Res y P'))"
1212
| ParLeft: "\<lbrakk> trans P (Cmt \<alpha> P') ; bns \<alpha> \<inter> (FFVars P \<union> FFVars Q) = {} \<rbrakk> \<Longrightarrow> trans (P \<parallel> Q) (Cmt \<alpha> (P' \<parallel> Q))"
13-
14-
binder_inductive trans
1513
subgoal for R B \<sigma> x1 x2
1614
apply simp
1715
apply (elim disj_forward)

thys/Pi_Calculus/Pi_cong.thy

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ lemma fresh: "\<exists>xx. xx \<notin> Tsupp (t :: trm) t2"
99
by (metis (no_types, lifting) exists_var finite_iff_le_card_var term.Un_bound term.set_bd_UNIV)
1010

1111
(* Structural congurence *)
12-
inductive cong :: "trm \<Rightarrow> trm \<Rightarrow> bool" (infix "(\<equiv>\<^sub>\<pi>)" 40) where
12+
binder_inductive cong :: "trm \<Rightarrow> trm \<Rightarrow> bool" (infix "(\<equiv>\<^sub>\<pi>)" 40) where
1313
"P = Q \<Longrightarrow> P \<equiv>\<^sub>\<pi> Q"
1414
| "Par P Q \<equiv>\<^sub>\<pi> Par Q P"
1515
| "Par (Par P Q) R \<equiv>\<^sub>\<pi> Par P (Par Q R)"
@@ -18,8 +18,6 @@ inductive cong :: "trm \<Rightarrow> trm \<Rightarrow> bool" (infix "(\<equiv>\<
1818
| "Res x Zero \<equiv>\<^sub>\<pi> Zero"
1919
| "Bang P \<equiv>\<^sub>\<pi> Par P (Bang P)"
2020
| cong_3: "x \<notin> FFVars Q \<Longrightarrow> Res x (Par P Q) \<equiv>\<^sub>\<pi> Par (Res x P) Q"
21-
22-
binder_inductive cong
2321
subgoal for R B \<sigma> x1 x2
2422
apply simp
2523
by (elim disj_forward case_prodE)
@@ -55,13 +53,11 @@ proof-
5553
thus ?thesis by auto
5654
qed
5755

58-
inductive trans :: "trm \<Rightarrow> trm \<Rightarrow> bool" (infix "(\<rightarrow>)" 30) where
56+
binder_inductive trans :: "trm \<Rightarrow> trm \<Rightarrow> bool" (infix "(\<rightarrow>)" 30) where
5957
"Par (Out x z P) (Inp x y Q) \<rightarrow> Par P (usub Q z y)"
6058
| "P \<rightarrow> Q \<Longrightarrow> Par P R \<rightarrow> Par P Q"
6159
| "P \<rightarrow> Q \<Longrightarrow> Res x P \<rightarrow> Res x Q"
6260
| "P \<equiv>\<^sub>\<pi> P' \<Longrightarrow> P' \<rightarrow> Q' \<Longrightarrow> Q' \<equiv>\<^sub>\<pi> Q \<Longrightarrow> P \<rightarrow> Q"
63-
64-
binder_inductive trans
6561
subgoal for R B \<sigma> x1 x2
6662
apply simp
6763
apply (elim disj_forward exE)

0 commit comments

Comments
 (0)