src/HOL/Bali/Basis.thy
changeset 80914 d97fdabd9e2b
parent 80768 c7723cc15de8
equal deleted inserted replaced
80913:46f59511b7bb 80914:d97fdabd9e2b
    24    apply (rule disjI2)
    24    apply (rule disjI2)
    25    apply (rule_tac x = "A - {x}" in exI)
    25    apply (rule_tac x = "A - {x}" in exI)
    26    apply fast+
    26    apply fast+
    27   done
    27   done
    28 
    28 
    29 abbreviation nat3 :: nat  ("3") where "3 \<equiv> Suc 2"
    29 abbreviation nat3 :: nat  (\<open>3\<close>) where "3 \<equiv> Suc 2"
    30 abbreviation nat4 :: nat  ("4") where "4 \<equiv> Suc 3"
    30 abbreviation nat4 :: nat  (\<open>4\<close>) where "4 \<equiv> Suc 3"
    31 
    31 
    32 (* irrefl_tranclI in Transitive_Closure.thy is more general *)
    32 (* irrefl_tranclI in Transitive_Closure.thy is more general *)
    33 lemma irrefl_tranclI': "r\<inverse> \<inter> r\<^sup>+ = {} \<Longrightarrow> \<forall>x. (x, x) \<notin> r\<^sup>+"
    33 lemma irrefl_tranclI': "r\<inverse> \<inter> r\<^sup>+ = {} \<Longrightarrow> \<forall>x. (x, x) \<notin> r\<^sup>+"
    34   by (blast elim: tranclE dest: trancl_into_rtrancl)
    34   by (blast elim: tranclE dest: trancl_into_rtrancl)
    35 
    35 
   142   by auto
   142   by auto
   143 
   143 
   144 
   144 
   145 subsubsection "sums"
   145 subsubsection "sums"
   146 
   146 
   147 notation case_sum  (infixr "'(+')" 80)
   147 notation case_sum  (infixr \<open>'(+')\<close> 80)
   148 
   148 
   149 primrec the_Inl :: "'a + 'b \<Rightarrow> 'a"
   149 primrec the_Inl :: "'a + 'b \<Rightarrow> 'a"
   150   where "the_Inl (Inl a) = a"
   150   where "the_Inl (Inl a) = a"
   151 
   151 
   152 primrec the_Inr :: "'a + 'b \<Rightarrow> 'b"
   152 primrec the_Inr :: "'a + 'b \<Rightarrow> 'b"
   186 
   186 
   187 
   187 
   188 subsubsection "quantifiers for option type"
   188 subsubsection "quantifiers for option type"
   189 
   189 
   190 syntax
   190 syntax
   191   "_Oall" :: "[pttrn, 'a option, bool] \<Rightarrow> bool"   ("(3! _:_:/ _)" [0,0,10] 10)
   191   "_Oall" :: "[pttrn, 'a option, bool] \<Rightarrow> bool"   (\<open>(3! _:_:/ _)\<close> [0,0,10] 10)
   192   "_Oex"  :: "[pttrn, 'a option, bool] \<Rightarrow> bool"   ("(3? _:_:/ _)" [0,0,10] 10)
   192   "_Oex"  :: "[pttrn, 'a option, bool] \<Rightarrow> bool"   (\<open>(3? _:_:/ _)\<close> [0,0,10] 10)
   193 
   193 
   194 syntax (symbols)
   194 syntax (symbols)
   195   "_Oall" :: "[pttrn, 'a option, bool] \<Rightarrow> bool"   ("(3\<forall>_\<in>_:/ _)"  [0,0,10] 10)
   195   "_Oall" :: "[pttrn, 'a option, bool] \<Rightarrow> bool"   (\<open>(3\<forall>_\<in>_:/ _)\<close>  [0,0,10] 10)
   196   "_Oex"  :: "[pttrn, 'a option, bool] \<Rightarrow> bool"   ("(3\<exists>_\<in>_:/ _)"  [0,0,10] 10)
   196   "_Oex"  :: "[pttrn, 'a option, bool] \<Rightarrow> bool"   (\<open>(3\<exists>_\<in>_:/ _)\<close>  [0,0,10] 10)
   197 
   197 
   198 syntax_consts
   198 syntax_consts
   199   "_Oall" \<rightleftharpoons> Ball and
   199   "_Oall" \<rightleftharpoons> Ball and
   200   "_Oex" \<rightleftharpoons> Bex
   200   "_Oex" \<rightleftharpoons> Bex
   201 
   201 
   258 definition lsplit :: "[['a, 'a list] \<Rightarrow> 'b, 'a list] \<Rightarrow> 'b"
   258 definition lsplit :: "[['a, 'a list] \<Rightarrow> 'b, 'a list] \<Rightarrow> 'b"
   259   where "lsplit = (\<lambda>f l. f (hd l) (tl l))"
   259   where "lsplit = (\<lambda>f l. f (hd l) (tl l))"
   260 
   260 
   261 text \<open>list patterns -- extends pre-defined type "pttrn" used in abstractions\<close>
   261 text \<open>list patterns -- extends pre-defined type "pttrn" used in abstractions\<close>
   262 syntax
   262 syntax
   263   "_lpttrn" :: "[pttrn, pttrn] \<Rightarrow> pttrn"    ("_#/_" [901,900] 900)
   263   "_lpttrn" :: "[pttrn, pttrn] \<Rightarrow> pttrn"    (\<open>_#/_\<close> [901,900] 900)
   264 syntax_consts
   264 syntax_consts
   265   "_lpttrn" \<rightleftharpoons> lsplit
   265   "_lpttrn" \<rightleftharpoons> lsplit
   266 translations
   266 translations
   267   "\<lambda>y # x # xs. b" \<rightleftharpoons> "CONST lsplit (\<lambda>y x # xs. b)"
   267   "\<lambda>y # x # xs. b" \<rightleftharpoons> "CONST lsplit (\<lambda>y x # xs. b)"
   268   "\<lambda>x # xs. b" \<rightleftharpoons> "CONST lsplit (\<lambda>x xs. b)"
   268   "\<lambda>x # xs. b" \<rightleftharpoons> "CONST lsplit (\<lambda>x xs. b)"