diff --git a/thys/FOL_Seq_Calc3/Syntax.thy b/thys/FOL_Seq_Calc3/Syntax.thy --- a/thys/FOL_Seq_Calc3/Syntax.thy +++ b/thys/FOL_Seq_Calc3/Syntax.thy @@ -1,97 +1,97 @@ section \Syntax\ theory Syntax imports List_Syntax begin subsection \Terms and Formulas\ datatype tm = Var nat (\\<^bold>#\) | Fun nat \tm list\ (\\<^bold>\\) datatype fm = Falsity (\\<^bold>\\) | Pre nat \tm list\ (\\<^bold>\\) | Imp fm fm (infixr \\<^bold>\\ 55) | Uni fm (\\<^bold>\\) type_synonym sequent = \fm list \ fm list\ subsubsection \Substitution\ -primrec add_env (infix \\\ 0) where +primrec add_env :: \'a \ (nat \ 'a) \ nat \ 'a\ (infix \\\ 0) where \(t \ s) 0 = t\ | \(t \ s) (Suc n) = s n\ -primrec lift_tm where +primrec lift_tm :: \tm \ tm\ where \lift_tm (\<^bold>#n) = \<^bold>#(n+1)\ | \lift_tm (\<^bold>\f ts) = \<^bold>\f (map lift_tm ts)\ -primrec sub_tm where +primrec sub_tm :: \(nat \ tm) \ tm \ tm\ where \sub_tm s (\<^bold>#n) = s n\ | \sub_tm s (\<^bold>\f ts) = \<^bold>\f (map (sub_tm s) ts)\ -primrec sub_fm where +primrec sub_fm :: \(nat \ tm) \ fm \ fm\ where \sub_fm s \<^bold>\ = \<^bold>\\ | \sub_fm s (\<^bold>\P ts) = \<^bold>\P (map (sub_tm s) ts)\ | \sub_fm s (p \<^bold>\ q) = sub_fm s p \<^bold>\ sub_fm s q\ | \sub_fm s (\<^bold>\p) = \<^bold>\(sub_fm (\<^bold>#0 \ \n. lift_tm (s n)) p)\ -abbreviation inst_single (\\_\\) where +abbreviation inst_single :: \tm \ fm \ fm\ (\\_\\) where \\t\p \ sub_fm (t \ \<^bold>#) p\ subsubsection \Variables\ primrec vars_tm :: \tm \ nat list\ where \vars_tm (\<^bold>#n) = [n]\ | \vars_tm (\<^bold>\_ ts) = concat (map vars_tm ts)\ primrec vars_fm :: \fm \ nat list\ where \vars_fm \<^bold>\ = []\ | \vars_fm (\<^bold>\_ ts) = concat (map vars_tm ts)\ | \vars_fm (p \<^bold>\ q) = vars_fm p @ vars_fm q\ | \vars_fm (\<^bold>\p) = vars_fm p\ primrec max_list :: \nat list \ nat\ where \max_list [] = 0\ | \max_list (x # xs) = max x (max_list xs)\ lemma max_list_append: \max_list (xs @ ys) = max (max_list xs) (max_list ys)\ by (induct xs) auto lemma max_list_concat: \xs [\] xss \ max_list xs \ max_list (concat xss)\ by (induct xss) (auto simp: max_list_append) lemma max_list_in: \max_list xs < n \ n [\] xs\ by (induct xs) auto definition vars_fms :: \fm list \ nat list\ where \vars_fms A \ concat (map vars_fm A)\ lemma vars_fms_member: \p [\] A \ vars_fm p [\] vars_fms A\ unfolding vars_fms_def by (induct A) auto lemma max_list_mono: \A [\] B \ max_list A \ max_list B\ by (induct A) (simp, metis linorder_not_le list.set_intros(1) max.absorb2 max.absorb3 max_list.simps(2) max_list_in set_subset_Cons subset_code(1)) lemma max_list_vars_fms: assumes \max_list (vars_fms A) \ n\ \p [\] A\ shows \max_list (vars_fm p) \ n\ using assms max_list_mono vars_fms_member by (meson dual_order.trans) definition fresh :: \fm list \ nat\ where \fresh A \ Suc (max_list (vars_fms A))\ subsection \Rules\ datatype rule = Idle | Axiom nat \tm list\ | FlsL | FlsR | ImpL fm fm | ImpR fm fm | UniL tm fm | UniR fm end