theory_file
stringlengths
5
95
lemma_name
stringlengths
5
250
lemma_command
stringlengths
17
21.3k
lemma_object
stringlengths
5
62.8k
template
stringlengths
7
63.6k
symbols
listlengths
0
89
defs
listlengths
0
63
Combinatorial_Enumeration_Algorithms/n_Subsets
n_Subsets.n_subset_enum_distinct
theorem n_subset_enum_distinct: "distinct xs \<Longrightarrow> distinct (n_subset_enum xs n)"
distinct ?xs \<Longrightarrow> distinct (n_subset_enum ?xs ?n)
?H1 x_1 \<Longrightarrow> ?H2 (?H3 x_1 x_2)
[ "Filter_Bool_List.filter_bool_list", "n_Subsets.n_subset_enum_dom", "List.distinct", "n_Subsets.n_subset_enum", "List.append" ]
[ "fun filter_bool_list :: \"bool list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n \"filter_bool_list [] _ = []\"\n| \"filter_bool_list _ [] = []\"\n| \"filter_bool_list (b#bs) (x#xs) =\n (if b then x#(filter_bool_list bs xs) else (filter_bool_list bs xs))\"", "primrec distinct :: \"'a list \\<Rightarrow> bool\" where\n\"distinct [] \\<longleftrightarrow> True\" |\n\"distinct (x # xs) \\<longleftrightarrow> x \\<notin> set xs \\<and> distinct xs\"", "fun n_subset_enum :: \"'a list \\<Rightarrow> nat \\<Rightarrow> 'a list list\" where\n \"n_subset_enum xs n = [(filter_bool_list bs xs) . bs \\<leftarrow> (n_bool_lists n (length xs))]\"", "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"" ]
Combinatorial_Enumeration_Algorithms/n_Subsets
n_Subsets.n_bool_lists2_correct
lemma n_bool_lists2_correct: "set (n_bool_lists n x) = n_bool_lists2 n x"
set (n_bool_lists ?n ?x) = n_bool_lists2 ?n ?x
?H1 (?H2 x_1 x_2) = ?H3 x_1 x_2
[ "n_Subsets.n_bool_lists2", "n_Subsets.n_bool_lists", "List.list.set", "List.append", "Nat.Suc", "List.distinct" ]
[ "fun n_bool_lists2 :: \"nat \\<Rightarrow> nat \\<Rightarrow> bool list set\" where\n \"n_bool_lists2 n x = (if n > x then {}\n else permutations_of_multiset (mset (replicate n True @ replicate (x-n) False)))\"", "fun n_bool_lists :: \"nat \\<Rightarrow> nat \\<Rightarrow> bool list list\" where\n \"n_bool_lists n 0 = (if n > 0 then [] else [[]])\"\n| \"n_bool_lists n (Suc x) = (if n = 0 then [replicate (Suc x) False]\n else if n = Suc x then [replicate (Suc x) True]\n else if n > x then []\n else [False#xs . xs \\<leftarrow> n_bool_lists n x] @ [True#xs . xs \\<leftarrow> n_bool_lists (n-1) x])\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "primrec distinct :: \"'a list \\<Rightarrow> bool\" where\n\"distinct [] \\<longleftrightarrow> True\" |\n\"distinct (x # xs) \\<longleftrightarrow> x \\<notin> set xs \\<and> distinct xs\"" ]
Combinatorial_Enumeration_Algorithms/n_Subsets
n_Subsets.n_bool_lists_distinct
lemma n_bool_lists_distinct: "distinct (n_bool_lists n x)"
distinct (n_bool_lists ?n ?x)
?H1 (?H2 x_1 x_2)
[ "Filter_Bool_List.filter_bool_list", "List.distinct", "n_Subsets.n_bool_lists" ]
[ "fun filter_bool_list :: \"bool list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n \"filter_bool_list [] _ = []\"\n| \"filter_bool_list _ [] = []\"\n| \"filter_bool_list (b#bs) (x#xs) =\n (if b then x#(filter_bool_list bs xs) else (filter_bool_list bs xs))\"", "primrec distinct :: \"'a list \\<Rightarrow> bool\" where\n\"distinct [] \\<longleftrightarrow> True\" |\n\"distinct (x # xs) \\<longleftrightarrow> x \\<notin> set xs \\<and> distinct xs\"", "fun n_bool_lists :: \"nat \\<Rightarrow> nat \\<Rightarrow> bool list list\" where\n \"n_bool_lists n 0 = (if n > 0 then [] else [[]])\"\n| \"n_bool_lists n (Suc x) = (if n = 0 then [replicate (Suc x) False]\n else if n = Suc x then [replicate (Suc x) True]\n else if n > x then []\n else [False#xs . xs \\<leftarrow> n_bool_lists n x] @ [True#xs . xs \\<leftarrow> n_bool_lists (n-1) x])\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Partitions
Integer_Partitions.integer_partitions_enum_aux_head_minus
lemma integer_partitions_enum_aux_head_minus: "h \<le> m \<Longrightarrow> h > 0 \<Longrightarrow> n \<ge> h \<Longrightarrow> ys \<in> set (integer_partitions_enum_aux (n-h) h)\<Longrightarrow> h#ys \<in> set (integer_partitions_enum_aux n m)"
?h \<le> ?m \<Longrightarrow> 0 < ?h \<Longrightarrow> ?h \<le> ?n \<Longrightarrow> ?ys \<in> set (integer_partitions_enum_aux (?n - ?h) ?h) \<Longrightarrow> ?h # ?ys \<in> set (integer_partitions_enum_aux ?n ?m)
\<lbrakk>x_1 \<le> x_2; ?H1 < x_1; x_1 \<le> x_3; x_4 \<in> ?H2 (?H3 (?H4 x_3 x_1) x_1)\<rbrakk> \<Longrightarrow> ?H5 x_1 x_4 \<in> ?H2 (?H3 x_3 x_2)
[ "Orderings.ord_class.min", "Groups.zero_class.zero", "List.list.Cons", "Groups.minus_class.minus", "List.list.set", "Number_Partition.partitions", "List.concat", "Integer_Partitions.integer_partitions_enum_aux", "Set_Interval.ord_class.atMost" ]
[ "class ord =\n fixes less_eq :: \"'a \\<Rightarrow> 'a \\<Rightarrow> bool\"\n and less :: \"'a \\<Rightarrow> 'a \\<Rightarrow> bool\"\nbegin", "class zero =\n fixes zero :: 'a (\"0\")", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "class minus =\n fixes minus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"-\" 65)", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "definition partitions :: \"(nat \\<Rightarrow> nat) \\<Rightarrow> nat \\<Rightarrow> bool\" (infix \"partitions\" 50)\nwhere\n \"p partitions n = ((\\<forall>i. p i \\<noteq> 0 \\<longrightarrow> 1 \\<le> i \\<and> i \\<le> n) \\<and> (\\<Sum>i\\<le>n. p i * i) = n)\"", "primrec concat:: \"'a list list \\<Rightarrow> 'a list\" where\n\"concat [] = []\" |\n\"concat (x # xs) = x @ concat xs\"", "fun integer_partitions_enum_aux :: \"nat \\<Rightarrow> nat \\<Rightarrow> nat list list\" where\n \"integer_partitions_enum_aux 0 m = [[]]\"\n| \"integer_partitions_enum_aux n m =\n [h#r . h \\<leftarrow> [1..< Suc (min n m)], r \\<leftarrow> integer_partitions_enum_aux (n-h) h]\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Partitions
Integer_Partitions.integer_partitions_enum_aux_head_plus
lemma integer_partitions_enum_aux_head_plus: "h \<le> m \<Longrightarrow> h > 0 \<Longrightarrow> ys \<in> set (integer_partitions_enum_aux n h) \<Longrightarrow> h#ys \<in> set (integer_partitions_enum_aux (h + n) m)"
?h \<le> ?m \<Longrightarrow> 0 < ?h \<Longrightarrow> ?ys \<in> set (integer_partitions_enum_aux ?n ?h) \<Longrightarrow> ?h # ?ys \<in> set (integer_partitions_enum_aux (?h + ?n) ?m)
\<lbrakk>x_1 \<le> x_2; ?H1 < x_1; x_3 \<in> ?H2 (?H3 x_4 x_1)\<rbrakk> \<Longrightarrow> ?H4 x_1 x_3 \<in> ?H2 (?H3 (?H5 x_1 x_4) x_2)
[ "Integer_Partitions.integer_partitions_enum", "List.list.set", "List.list.Cons", "Groups.plus_class.plus", "Groups.zero_class.zero", "Integer_Partitions.integer_partitions_enum_aux" ]
[ "fun integer_partitions_enum :: \"nat \\<Rightarrow> nat list list\" where\n \"integer_partitions_enum n = integer_partitions_enum_aux n n\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "class plus =\n fixes plus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"+\" 65)", "class zero =\n fixes zero :: 'a (\"0\")", "fun integer_partitions_enum_aux :: \"nat \\<Rightarrow> nat \\<Rightarrow> nat list list\" where\n \"integer_partitions_enum_aux 0 m = [[]]\"\n| \"integer_partitions_enum_aux n m =\n [h#r . h \\<leftarrow> [1..< Suc (min n m)], r \\<leftarrow> integer_partitions_enum_aux (n-h) h]\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Partitions
Integer_Partitions.integer_partitions_enum_correct_aux1
lemma integer_partitions_enum_correct_aux1: assumes "0 \<notin># A " and "\<forall>x \<in># A. x \<le> m" shows" \<exists>xs\<in>set (integer_partitions_enum_aux (\<Sum>\<^sub># A) m). A = mset xs"
0 \<notin># ?A \<Longrightarrow> \<forall>x\<in>#?A. x \<le> ?m \<Longrightarrow> \<exists>xs\<in>set (integer_partitions_enum_aux (\<Sum>\<^sub># ?A) ?m). ?A = mset xs
\<lbrakk>?H1 ?H2 x_1; ?H3 x_1 (\<lambda>y_0. y_0 \<le> x_2)\<rbrakk> \<Longrightarrow> \<exists>y_1\<in>?H4 (?H5 (?H6 x_1) x_2). x_1 = ?H7 y_1
[ "Multiset.mset", "Groups.zero_class.zero", "List.distinct", "List.list.set", "Multiset.not_member_mset", "Multiset.Ball", "Integer_Partitions.integer_partitions_enum_aux", "Multiset.comm_monoid_add_class.sum_mset" ]
[ "primrec mset :: \"'a list \\<Rightarrow> 'a multiset\" where\n \"mset [] = {#}\" |\n \"mset (a # x) = add_mset a (mset x)\"", "class zero =\n fixes zero :: 'a (\"0\")", "primrec distinct :: \"'a list \\<Rightarrow> bool\" where\n\"distinct [] \\<longleftrightarrow> True\" |\n\"distinct (x # xs) \\<longleftrightarrow> x \\<notin> set xs \\<and> distinct xs\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation not_member_mset :: \\<open>'a \\<Rightarrow> 'a multiset \\<Rightarrow> bool\\<close>\n where \\<open>not_member_mset a M \\<equiv> a \\<notin> set_mset M\\<close>", "abbreviation Ball :: \"'a multiset \\<Rightarrow> ('a \\<Rightarrow> bool) \\<Rightarrow> bool\"\n where \"Ball M \\<equiv> Set.Ball (set_mset M)\"", "fun integer_partitions_enum_aux :: \"nat \\<Rightarrow> nat \\<Rightarrow> nat list list\" where\n \"integer_partitions_enum_aux 0 m = [[]]\"\n| \"integer_partitions_enum_aux n m =\n [h#r . h \\<leftarrow> [1..< Suc (min n m)], r \\<leftarrow> integer_partitions_enum_aux (n-h) h]\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Partitions
Integer_Partitions.integer_partitions_enum_aux_not_null
lemma integer_partitions_enum_aux_not_null: "xs \<in> set (integer_partitions_enum_aux n m) \<Longrightarrow> x \<in> set xs \<Longrightarrow> x \<noteq> 0"
?xs \<in> set (integer_partitions_enum_aux ?n ?m) \<Longrightarrow> ?x \<in> set ?xs \<Longrightarrow> ?x \<noteq> 0
\<lbrakk>x_1 \<in> ?H1 (?H2 x_2 x_3); x_4 \<in> ?H3 x_1\<rbrakk> \<Longrightarrow> x_4 \<noteq> ?H4
[ "Num.num.Bit0", "List.list.set", "Integer_Partitions.integer_partitions_enum_aux", "Groups.zero_class.zero", "List.distinct" ]
[ "datatype num = One | Bit0 num | Bit1 num", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "fun integer_partitions_enum_aux :: \"nat \\<Rightarrow> nat \\<Rightarrow> nat list list\" where\n \"integer_partitions_enum_aux 0 m = [[]]\"\n| \"integer_partitions_enum_aux n m =\n [h#r . h \\<leftarrow> [1..< Suc (min n m)], r \\<leftarrow> integer_partitions_enum_aux (n-h) h]\"", "class zero =\n fixes zero :: 'a (\"0\")", "primrec distinct :: \"'a list \\<Rightarrow> bool\" where\n\"distinct [] \\<longleftrightarrow> True\" |\n\"distinct (x # xs) \\<longleftrightarrow> x \\<notin> set xs \\<and> distinct xs\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Partitions
Integer_Partitions.integer_partitions_enum_aux_first
lemma integer_partitions_enum_aux_first: "x # xs \<in> set (integer_partitions_enum_aux n m) \<Longrightarrow> xs \<in> set (integer_partitions_enum_aux (n-x) x)"
?x # ?xs \<in> set (integer_partitions_enum_aux ?n ?m) \<Longrightarrow> ?xs \<in> set (integer_partitions_enum_aux (?n - ?x) ?x)
?H1 x_1 x_2 \<in> ?H2 (?H3 x_3 x_4) \<Longrightarrow> x_2 \<in> ?H2 (?H3 (?H4 x_3 x_1) x_1)
[ "List.list.set", "List.list.Cons", "Groups_List.monoid_add_class.sum_list", "Integer_Partitions.integer_partitions", "Integer_Partitions.integer_partitions_enum_aux", "Groups.minus_class.minus", "Multiset.comm_monoid_add_class.sum_mset" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "definition integer_partitions :: \"nat \\<Rightarrow> nat multiset set\" where\n \"integer_partitions i = {A. sum_mset A = i \\<and> 0 \\<notin># A}\"", "fun integer_partitions_enum_aux :: \"nat \\<Rightarrow> nat \\<Rightarrow> nat list list\" where\n \"integer_partitions_enum_aux 0 m = [[]]\"\n| \"integer_partitions_enum_aux n m =\n [h#r . h \\<leftarrow> [1..< Suc (min n m)], r \\<leftarrow> integer_partitions_enum_aux (n-h) h]\"", "class minus =\n fixes minus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"-\" 65)" ]
Combinatorial_Enumeration_Algorithms/Integer_Partitions
Integer_Partitions.integer_partitions_enum_aux_max
lemma integer_partitions_enum_aux_max: "xs \<in> set (integer_partitions_enum_aux n m) \<Longrightarrow> x \<in> set xs \<Longrightarrow> x \<le> m"
?xs \<in> set (integer_partitions_enum_aux ?n ?m) \<Longrightarrow> ?x \<in> set ?xs \<Longrightarrow> ?x \<le> ?m
\<lbrakk>x_1 \<in> ?H1 (?H2 x_2 x_3); x_4 \<in> ?H3 x_1\<rbrakk> \<Longrightarrow> x_4 \<le> x_3
[ "Fun.bij_betw", "List.list.set", "Integer_Partitions.integer_partitions_enum_aux", "Number_Partition.number_partition" ]
[ "definition bij_betw :: \"('a \\<Rightarrow> 'b) \\<Rightarrow> 'a set \\<Rightarrow> 'b set \\<Rightarrow> bool\" \\<comment> \\<open>bijective\\<close>\n where \"bij_betw f A B \\<longleftrightarrow> inj_on f A \\<and> f ` A = B\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "fun integer_partitions_enum_aux :: \"nat \\<Rightarrow> nat \\<Rightarrow> nat list list\" where\n \"integer_partitions_enum_aux 0 m = [[]]\"\n| \"integer_partitions_enum_aux n m =\n [h#r . h \\<leftarrow> [1..< Suc (min n m)], r \\<leftarrow> integer_partitions_enum_aux (n-h) h]\"", "definition number_partition :: \"nat \\<Rightarrow> nat multiset \\<Rightarrow> bool\"\nwhere\n \"number_partition n N = (sum_mset N = n \\<and> 0 \\<notin># N)\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Partitions
Integer_Partitions.integer_partitions_enum_aux_not_null_aux
lemma integer_partitions_enum_aux_not_null_aux: "x#xs \<in> set (integer_partitions_enum_aux n m) \<Longrightarrow> x \<noteq> 0"
?x # ?xs \<in> set (integer_partitions_enum_aux ?n ?m) \<Longrightarrow> ?x \<noteq> 0
?H1 x_1 x_2 \<in> ?H2 (?H3 x_3 x_4) \<Longrightarrow> x_1 \<noteq> ?H4
[ "List.list.set", "List.list.Cons", "Integer_Partitions.integer_partitions_enum", "Integer_Partitions.integer_partitions_enum_aux", "Groups.zero_class.zero" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "fun integer_partitions_enum :: \"nat \\<Rightarrow> nat list list\" where\n \"integer_partitions_enum n = integer_partitions_enum_aux n n\"", "fun integer_partitions_enum_aux :: \"nat \\<Rightarrow> nat \\<Rightarrow> nat list list\" where\n \"integer_partitions_enum_aux 0 m = [[]]\"\n| \"integer_partitions_enum_aux n m =\n [h#r . h \\<leftarrow> [1..< Suc (min n m)], r \\<leftarrow> integer_partitions_enum_aux (n-h) h]\"", "class zero =\n fixes zero :: 'a (\"0\")" ]
Combinatorial_Enumeration_Algorithms/Integer_Partitions
Integer_Partitions.card_partitions_count_partitions
lemma card_partitions_count_partitions: "card {p. p partitions n} = card {N. count N partitions n}"
card {p. p partitions ?n} = card {N. count N partitions ?n}
?H1 (?H2 (\<lambda>y_0. ?H3 y_0 x_1)) = ?H4 (?H5 (\<lambda>y_1. ?H3 (?H6 y_1) x_1))
[ "Number_Partition.partitions", "Set.Collect", "List.list.Cons", "Finite_Set.card", "Multiset.multiset.count", "Num.num.Bit0", "Integer_Partitions.integer_partitions_enum_aux" ]
[ "definition partitions :: \"(nat \\<Rightarrow> nat) \\<Rightarrow> nat \\<Rightarrow> bool\" (infix \"partitions\" 50)\nwhere\n \"p partitions n = ((\\<forall>i. p i \\<noteq> 0 \\<longrightarrow> 1 \\<le> i \\<and> i \\<le> n) \\<and> (\\<Sum>i\\<le>n. p i * i) = n)\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype num = One | Bit0 num | Bit1 num", "fun integer_partitions_enum_aux :: \"nat \\<Rightarrow> nat \\<Rightarrow> nat list list\" where\n \"integer_partitions_enum_aux 0 m = [[]]\"\n| \"integer_partitions_enum_aux n m =\n [h#r . h \\<leftarrow> [1..< Suc (min n m)], r \\<leftarrow> integer_partitions_enum_aux (n-h) h]\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Partitions
Integer_Partitions.integer_partitions_enum_aux_max_n
lemma integer_partitions_enum_aux_max_n: "x#xs \<in> set (integer_partitions_enum_aux n m) \<Longrightarrow> x \<le> n"
?x # ?xs \<in> set (integer_partitions_enum_aux ?n ?m) \<Longrightarrow> ?x \<le> ?n
?H1 x_1 x_2 \<in> ?H2 (?H3 x_3 x_4) \<Longrightarrow> x_1 \<le> x_3
[ "Integer_Partitions.integer_partitions_enum_aux", "List.list.set", "Set.Collect", "Groups.times_class.times", "Multiset.comm_monoid_add_class.sum_mset", "List.distinct", "List.list.Cons" ]
[ "fun integer_partitions_enum_aux :: \"nat \\<Rightarrow> nat \\<Rightarrow> nat list list\" where\n \"integer_partitions_enum_aux 0 m = [[]]\"\n| \"integer_partitions_enum_aux n m =\n [h#r . h \\<leftarrow> [1..< Suc (min n m)], r \\<leftarrow> integer_partitions_enum_aux (n-h) h]\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "class times =\n fixes times :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"*\" 70)", "primrec distinct :: \"'a list \\<Rightarrow> bool\" where\n\"distinct [] \\<longleftrightarrow> True\" |\n\"distinct (x # xs) \\<longleftrightarrow> x \\<notin> set xs \\<and> distinct xs\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Partitions
Integer_Partitions.integer_partitions_enum_aux_max_head
lemma integer_partitions_enum_aux_max_head: "x#xs \<in> set (integer_partitions_enum_aux n m) \<Longrightarrow> x \<le> m"
?x # ?xs \<in> set (integer_partitions_enum_aux ?n ?m) \<Longrightarrow> ?x \<le> ?m
?H1 x_1 x_2 \<in> ?H2 (?H3 x_3 x_4) \<Longrightarrow> x_1 \<le> x_4
[ "Nat.Suc", "Multiset.not_member_mset", "Fun.bij_betw", "List.list.Cons", "List.list.set", "Num.numeral_class.numeral", "Integer_Partitions.integer_partitions_enum_aux" ]
[ "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "abbreviation not_member_mset :: \\<open>'a \\<Rightarrow> 'a multiset \\<Rightarrow> bool\\<close>\n where \\<open>not_member_mset a M \\<equiv> a \\<notin> set_mset M\\<close>", "definition bij_betw :: \"('a \\<Rightarrow> 'b) \\<Rightarrow> 'a set \\<Rightarrow> 'b set \\<Rightarrow> bool\" \\<comment> \\<open>bijective\\<close>\n where \"bij_betw f A B \\<longleftrightarrow> inj_on f A \\<and> f ` A = B\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec numeral :: \"num \\<Rightarrow> 'a\"\n where\n numeral_One: \"numeral One = 1\"\n | numeral_Bit0: \"numeral (Bit0 n) = numeral n + numeral n\"\n | numeral_Bit1: \"numeral (Bit1 n) = numeral n + numeral n + 1\"", "fun integer_partitions_enum_aux :: \"nat \\<Rightarrow> nat \\<Rightarrow> nat list list\" where\n \"integer_partitions_enum_aux 0 m = [[]]\"\n| \"integer_partitions_enum_aux n m =\n [h#r . h \\<leftarrow> [1..< Suc (min n m)], r \\<leftarrow> integer_partitions_enum_aux (n-h) h]\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Partitions
Integer_Partitions.card_partitions_number_partition
lemma card_partitions_number_partition: "card {p. p partitions n} = card {N. number_partition n N}"
card {p. p partitions ?n} = card {N. number_partition ?n N}
?H1 (?H2 (\<lambda>y_0. ?H3 y_0 x_1)) = ?H4 (?H5 (?H6 x_1))
[ "Finite_Set.card", "Number_Partition.partitions", "Num.numeral_class.numeral", "Set.Collect", "Number_Partition.number_partition" ]
[ "definition partitions :: \"(nat \\<Rightarrow> nat) \\<Rightarrow> nat \\<Rightarrow> bool\" (infix \"partitions\" 50)\nwhere\n \"p partitions n = ((\\<forall>i. p i \\<noteq> 0 \\<longrightarrow> 1 \\<le> i \\<and> i \\<le> n) \\<and> (\\<Sum>i\\<le>n. p i * i) = n)\"", "primrec numeral :: \"num \\<Rightarrow> 'a\"\n where\n numeral_One: \"numeral One = 1\"\n | numeral_Bit0: \"numeral (Bit0 n) = numeral n + numeral n\"\n | numeral_Bit1: \"numeral (Bit1 n) = numeral n + numeral n + 1\"", "definition number_partition :: \"nat \\<Rightarrow> nat multiset \\<Rightarrow> bool\"\nwhere\n \"number_partition n N = (sum_mset N = n \\<and> 0 \\<notin># N)\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Partitions
Integer_Partitions.partitions_bij_betw_count
lemma partitions_bij_betw_count: "bij_betw count {N. count N partitions n} {p. p partitions n}"
bij_betw count {N. count N partitions ?n} {p. p partitions ?n}
?H1 ?H2 (?H3 (\<lambda>y_0. ?H4 (?H2 y_0) x_1)) (?H5 (\<lambda>y_1. ?H4 y_1 x_1))
[ "Number_Partition.partitions", "List.list.map", "Multiset.multiset.count", "Set.Collect", "List.list.Cons", "Multiset.comm_monoid_add_class.sum_mset", "Fun.bij_betw" ]
[ "definition partitions :: \"(nat \\<Rightarrow> nat) \\<Rightarrow> nat \\<Rightarrow> bool\" (infix \"partitions\" 50)\nwhere\n \"p partitions n = ((\\<forall>i. p i \\<noteq> 0 \\<longrightarrow> 1 \\<le> i \\<and> i \\<le> n) \\<and> (\\<Sum>i\\<le>n. p i * i) = n)\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "definition bij_betw :: \"('a \\<Rightarrow> 'b) \\<Rightarrow> 'a set \\<Rightarrow> 'b set \\<Rightarrow> bool\" \\<comment> \\<open>bijective\\<close>\n where \"bij_betw f A B \\<longleftrightarrow> inj_on f A \\<and> f ` A = B\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Partitions
Integer_Partitions.integer_partitions_enum_aux_sum
lemma integer_partitions_enum_aux_sum: "xs \<in> set (integer_partitions_enum_aux n m) \<Longrightarrow> sum_list xs = n"
?xs \<in> set (integer_partitions_enum_aux ?n ?m) \<Longrightarrow> sum_list ?xs = ?n
x_1 \<in> ?H1 (?H2 x_2 x_3) \<Longrightarrow> ?H3 x_1 = x_2
[ "Groups.zero_class.zero", "Num.numeral_class.numeral", "Groups_List.monoid_add_class.sum_list", "List.upt", "Integer_Partitions.integer_partitions", "Integer_Partitions.integer_partitions_enum_aux", "List.list.set" ]
[ "class zero =\n fixes zero :: 'a (\"0\")", "primrec numeral :: \"num \\<Rightarrow> 'a\"\n where\n numeral_One: \"numeral One = 1\"\n | numeral_Bit0: \"numeral (Bit0 n) = numeral n + numeral n\"\n | numeral_Bit1: \"numeral (Bit1 n) = numeral n + numeral n + 1\"", "primrec upt :: \"nat \\<Rightarrow> nat \\<Rightarrow> nat list\" (\"(1[_..</_'])\") where\nupt_0: \"[i..<0] = []\" |\nupt_Suc: \"[i..<(Suc j)] = (if i \\<le> j then [i..<j] @ [j] else [])\"", "definition integer_partitions :: \"nat \\<Rightarrow> nat multiset set\" where\n \"integer_partitions i = {A. sum_mset A = i \\<and> 0 \\<notin># A}\"", "fun integer_partitions_enum_aux :: \"nat \\<Rightarrow> nat \\<Rightarrow> nat list list\" where\n \"integer_partitions_enum_aux 0 m = [[]]\"\n| \"integer_partitions_enum_aux n m =\n [h#r . h \\<leftarrow> [1..< Suc (min n m)], r \\<leftarrow> integer_partitions_enum_aux (n-h) h]\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Partitions
Integer_Partitions.integer_partitions_empty
lemma integer_partitions_empty: "[] \<in> set (integer_partitions_enum_aux n m) \<Longrightarrow> n = 0"
[] \<in> set (integer_partitions_enum_aux ?n ?m) \<Longrightarrow> ?n = 0
?H1 \<in> ?H2 (?H3 x_1 x_2) \<Longrightarrow> x_1 = ?H4
[ "Integer_Partitions.integer_partitions_enum_aux", "List.list.Nil", "Set_Interval.ord_class.atMost", "List.list.set", "Multiset.mset", "Groups.zero_class.zero" ]
[ "fun integer_partitions_enum_aux :: \"nat \\<Rightarrow> nat \\<Rightarrow> nat list list\" where\n \"integer_partitions_enum_aux 0 m = [[]]\"\n| \"integer_partitions_enum_aux n m =\n [h#r . h \\<leftarrow> [1..< Suc (min n m)], r \\<leftarrow> integer_partitions_enum_aux (n-h) h]\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec mset :: \"'a list \\<Rightarrow> 'a multiset\" where\n \"mset [] = {#}\" |\n \"mset (a # x) = add_mset a (mset x)\"", "class zero =\n fixes zero :: 'a (\"0\")" ]
Combinatorial_Enumeration_Algorithms/Integer_Partitions
Integer_Partitions.integer_partitions_cardinality_aux
lemma integer_partitions_cardinality_aux: "card (integer_partitions n) = (\<Sum>k\<le>n. Partition n k)"
card (integer_partitions ?n) = sum (Partition ?n) {..?n}
?H1 (?H2 x_1) = ?H3 (?H4 x_1) (?H5 x_1)
[ "Groups_Big.comm_monoid_add_class.sum", "Card_Number_Partitions.Partition", "Integer_Partitions.integer_partitions_enum", "List.list.Cons", "Set_Interval.ord_class.atMost", "Integer_Partitions.integer_partitions", "Finite_Set.card" ]
[ "fun Partition :: \"nat \\<Rightarrow> nat \\<Rightarrow> nat\"\nwhere\n \"Partition 0 0 = 1\"\n| \"Partition 0 (Suc k) = 0\"\n| \"Partition (Suc m) 0 = 0\"\n| \"Partition (Suc m) (Suc k) = Partition m k + Partition (m - k) (Suc k)\"", "fun integer_partitions_enum :: \"nat \\<Rightarrow> nat list list\" where\n \"integer_partitions_enum n = integer_partitions_enum_aux n n\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "definition integer_partitions :: \"nat \\<Rightarrow> nat multiset set\" where\n \"integer_partitions i = {A. sum_mset A = i \\<and> 0 \\<notin># A}\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Partitions
Integer_Partitions.integer_partitions_cardinality
theorem integer_partitions_cardinality: "card (integer_partitions n) = Partition (2*n) n"
card (integer_partitions ?n) = Partition (2 * ?n) ?n
?H1 (?H2 x_1) = ?H3 (?H4 (?H5 (?H6 ?H7)) x_1) x_1
[ "Finite_Set.card", "Num.numeral_class.numeral", "Integer_Partitions.integer_partitions", "List.distinct", "Num.num.Bit0", "Num.num.One", "Card_Number_Partitions.Partition", "Groups.times_class.times" ]
[ "primrec numeral :: \"num \\<Rightarrow> 'a\"\n where\n numeral_One: \"numeral One = 1\"\n | numeral_Bit0: \"numeral (Bit0 n) = numeral n + numeral n\"\n | numeral_Bit1: \"numeral (Bit1 n) = numeral n + numeral n + 1\"", "definition integer_partitions :: \"nat \\<Rightarrow> nat multiset set\" where\n \"integer_partitions i = {A. sum_mset A = i \\<and> 0 \\<notin># A}\"", "primrec distinct :: \"'a list \\<Rightarrow> bool\" where\n\"distinct [] \\<longleftrightarrow> True\" |\n\"distinct (x # xs) \\<longleftrightarrow> x \\<notin> set xs \\<and> distinct xs\"", "datatype num = One | Bit0 num | Bit1 num", "datatype num = One | Bit0 num | Bit1 num", "fun Partition :: \"nat \\<Rightarrow> nat \\<Rightarrow> nat\"\nwhere\n \"Partition 0 0 = 1\"\n| \"Partition 0 (Suc k) = 0\"\n| \"Partition (Suc m) 0 = 0\"\n| \"Partition (Suc m) (Suc k) = Partition m k + Partition (m - k) (Suc k)\"", "class times =\n fixes times :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"*\" 70)" ]
Combinatorial_Enumeration_Algorithms/Integer_Partitions
Integer_Partitions.integer_partitions_enum_correct
theorem integer_partitions_enum_correct: "set (map mset (integer_partitions_enum n)) = integer_partitions n"
set (map mset (integer_partitions_enum ?n)) = integer_partitions ?n
?H1 (?H2 ?H3 (?H4 x_1)) = ?H5 x_1
[ "Num.numeral_class.numeral", "Multiset.mset", "Groups.times_class.times", "Integer_Partitions.integer_partitions", "List.list.map", "Orderings.ord_class.min", "Integer_Partitions.integer_partitions_enum", "List.list.set" ]
[ "primrec numeral :: \"num \\<Rightarrow> 'a\"\n where\n numeral_One: \"numeral One = 1\"\n | numeral_Bit0: \"numeral (Bit0 n) = numeral n + numeral n\"\n | numeral_Bit1: \"numeral (Bit1 n) = numeral n + numeral n + 1\"", "primrec mset :: \"'a list \\<Rightarrow> 'a multiset\" where\n \"mset [] = {#}\" |\n \"mset (a # x) = add_mset a (mset x)\"", "class times =\n fixes times :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"*\" 70)", "definition integer_partitions :: \"nat \\<Rightarrow> nat multiset set\" where\n \"integer_partitions i = {A. sum_mset A = i \\<and> 0 \\<notin># A}\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "class ord =\n fixes less_eq :: \"'a \\<Rightarrow> 'a \\<Rightarrow> bool\"\n and less :: \"'a \\<Rightarrow> 'a \\<Rightarrow> bool\"\nbegin", "fun integer_partitions_enum :: \"nat \\<Rightarrow> nat list list\" where\n \"integer_partitions_enum n = integer_partitions_enum_aux n n\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Partitions
Integer_Partitions.integer_partitions_number_partition_eq
lemma integer_partitions_number_partition_eq: "integer_partitions n = {N. number_partition n N}"
integer_partitions ?n = {N. number_partition ?n N}
?H1 x_1 = ?H2 (?H3 x_1)
[ "List.list.set", "Set.Collect", "Groups.times_class.times", "Set_Interval.ord_class.atMost", "List.list.Cons", "Number_Partition.number_partition", "Integer_Partitions.integer_partitions" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "class times =\n fixes times :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"*\" 70)", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "definition number_partition :: \"nat \\<Rightarrow> nat multiset \\<Rightarrow> bool\"\nwhere\n \"number_partition n N = (sum_mset N = n \\<and> 0 \\<notin># N)\"", "definition integer_partitions :: \"nat \\<Rightarrow> nat multiset set\" where\n \"integer_partitions i = {A. sum_mset A = i \\<and> 0 \\<notin># A}\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Partitions
Integer_Partitions.integer_partitions_enum_aux_distinct
lemma integer_partitions_enum_aux_distinct: "distinct (integer_partitions_enum_aux n m)"
distinct (integer_partitions_enum_aux ?n ?m)
?H1 (?H2 x_1 x_2)
[ "Groups.plus_class.plus", "Multiset.Ball", "List.distinct", "Integer_Partitions.integer_partitions_enum_aux" ]
[ "class plus =\n fixes plus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"+\" 65)", "abbreviation Ball :: \"'a multiset \\<Rightarrow> ('a \\<Rightarrow> bool) \\<Rightarrow> bool\"\n where \"Ball M \\<equiv> Set.Ball (set_mset M)\"", "primrec distinct :: \"'a list \\<Rightarrow> bool\" where\n\"distinct [] \\<longleftrightarrow> True\" |\n\"distinct (x # xs) \\<longleftrightarrow> x \\<notin> set xs \\<and> distinct xs\"", "fun integer_partitions_enum_aux :: \"nat \\<Rightarrow> nat \\<Rightarrow> nat list list\" where\n \"integer_partitions_enum_aux 0 m = [[]]\"\n| \"integer_partitions_enum_aux n m =\n [h#r . h \\<leftarrow> [1..< Suc (min n m)], r \\<leftarrow> integer_partitions_enum_aux (n-h) h]\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Partitions
Integer_Partitions.integer_partitions_enum_distinct
theorem integer_partitions_enum_distinct: "distinct (integer_partitions_enum n)"
distinct (integer_partitions_enum ?n)
?H1 (?H2 x_1)
[ "List.distinct", "Integer_Partitions.integer_partitions_enum", "Set_Interval.ord_class.atMost", "Groups.times_class.times", "Integer_Partitions.integer_partitions_enum_dom" ]
[ "primrec distinct :: \"'a list \\<Rightarrow> bool\" where\n\"distinct [] \\<longleftrightarrow> True\" |\n\"distinct (x # xs) \\<longleftrightarrow> x \\<notin> set xs \\<and> distinct xs\"", "fun integer_partitions_enum :: \"nat \\<Rightarrow> nat list list\" where\n \"integer_partitions_enum n = integer_partitions_enum_aux n n\"", "class times =\n fixes times :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"*\" 70)" ]
Combinatorial_Enumeration_Algorithms/Integer_Compositions
Integer_Compositions.sum_list_two_pow_aux
lemma sum_list_two_pow_aux: "(\<Sum>x\<leftarrow>[0..< n]. (2::nat) ^ (n - x)) + 2 ^ (0 - 1) + 2 ^ 0 = 2 ^ (Suc n)"
(\<Sum>x\<leftarrow>[0..<?n]. 2 ^ (?n - x)) + 2 ^ (0 - 1) + 2 ^ 0 = 2 ^ Suc ?n
?H1 (?H1 (?H2 (?H3 (\<lambda>y_0. ?H4 (?H5 (?H6 ?H7)) (?H8 x_1 y_0)) (?H9 ?H10 x_1))) (?H4 (?H5 (?H6 ?H7)) (?H8 ?H10 ?H11))) (?H4 (?H5 (?H6 ?H7)) ?H10) = ?H4 (?H5 (?H6 ?H7)) (?H12 x_1)
[ "List.list.map", "Nat.Suc", "Groups.one_class.one", "Groups.plus_class.plus", "Num.num.One", "Groups.zero_class.zero", "List.upt", "Groups_List.monoid_add_class.sum_list", "Num.num.Bit0", "Groups.minus_class.minus", "List.list.Nil", "Num.numeral_class.numeral", "Power.power_class.power", "Integer_Compositions.integer_compositions" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "class one =\n fixes one :: 'a (\"1\")", "class plus =\n fixes plus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"+\" 65)", "datatype num = One | Bit0 num | Bit1 num", "class zero =\n fixes zero :: 'a (\"0\")", "primrec upt :: \"nat \\<Rightarrow> nat \\<Rightarrow> nat list\" (\"(1[_..</_'])\") where\nupt_0: \"[i..<0] = []\" |\nupt_Suc: \"[i..<(Suc j)] = (if i \\<le> j then [i..<j] @ [j] else [])\"", "datatype num = One | Bit0 num | Bit1 num", "class minus =\n fixes minus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"-\" 65)", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec numeral :: \"num \\<Rightarrow> 'a\"\n where\n numeral_One: \"numeral One = 1\"\n | numeral_Bit0: \"numeral (Bit0 n) = numeral n + numeral n\"\n | numeral_Bit1: \"numeral (Bit1 n) = numeral n + numeral n + 1\"", "primrec power :: \"'a \\<Rightarrow> nat \\<Rightarrow> 'a\" (infixr \"^\" 80)\n where\n power_0: \"a ^ 0 = 1\"\n | power_Suc: \"a ^ Suc n = a * a ^ n\"", "definition integer_compositions :: \"nat \\<Rightarrow> nat list set\" where\n \"integer_compositions i = {xs. sum_list xs = i \\<and> 0 \\<notin> set xs}\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Compositions
Integer_Compositions.integer_composition_enum_head_set
lemma integer_composition_enum_head_set: assumes"x \<noteq> 0" and "x \<le> n" shows" xs \<in> set (integer_composition_enum (n-x)) \<Longrightarrow> x#xs \<in> set (integer_composition_enum n)"
?x \<noteq> 0 \<Longrightarrow> ?x \<le> ?n \<Longrightarrow> ?xs \<in> set (integer_composition_enum (?n - ?x)) \<Longrightarrow> ?x # ?xs \<in> set (integer_composition_enum ?n)
\<lbrakk>x_1 \<noteq> ?H1; x_1 \<le> x_2; x_3 \<in> ?H2 (?H3 (?H4 x_2 x_1))\<rbrakk> \<Longrightarrow> ?H5 x_1 x_3 \<in> ?H2 (?H3 x_2)
[ "List.list.set", "Integer_Compositions.integer_composition_enum", "Groups.minus_class.minus", "Integer_Compositions.integer_compositions", "List.list.Cons", "Groups.zero_class.zero", "Integer_Compositions.integer_composition_enum_dom" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "fun integer_composition_enum :: \"nat \\<Rightarrow> nat list list\" where\n \"integer_composition_enum 0 = [[]]\"\n| \"integer_composition_enum (Suc n) =\n [Suc m #xs. m \\<leftarrow> [0..< Suc n], xs \\<leftarrow> integer_composition_enum (n-m)]\"", "class minus =\n fixes minus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"-\" 65)", "definition integer_compositions :: \"nat \\<Rightarrow> nat list set\" where\n \"integer_compositions i = {xs. sum_list xs = i \\<and> 0 \\<notin> set xs}\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "class zero =\n fixes zero :: 'a (\"0\")" ]
Combinatorial_Enumeration_Algorithms/Integer_Compositions
Integer_Compositions.sum_list_two_pow
lemma sum_list_two_pow: "Suc (\<Sum>x\<leftarrow>[0..<n]. 2 ^ (n - Suc x)) = 2 ^ n"
Suc (\<Sum>x\<leftarrow>[0..<?n]. 2 ^ (?n - Suc x)) = 2 ^ ?n
?H1 (?H2 (?H3 (\<lambda>y_0. ?H4 (?H5 (?H6 ?H7)) (?H8 x_1 (?H1 y_0))) (?H9 ?H10 x_1))) = ?H4 (?H5 (?H6 ?H7)) x_1
[ "Power.power_class.power", "Num.num.One", "Num.num.Bit0", "Num.numeral_class.numeral", "Finite_Set.card", "List.list.map", "Groups.minus_class.minus", "Set.not_member", "List.upt", "Groups.zero_class.zero", "Groups_List.monoid_add_class.sum_list", "Nat.Suc", "List.list.set" ]
[ "primrec power :: \"'a \\<Rightarrow> nat \\<Rightarrow> 'a\" (infixr \"^\" 80)\n where\n power_0: \"a ^ 0 = 1\"\n | power_Suc: \"a ^ Suc n = a * a ^ n\"", "datatype num = One | Bit0 num | Bit1 num", "datatype num = One | Bit0 num | Bit1 num", "primrec numeral :: \"num \\<Rightarrow> 'a\"\n where\n numeral_One: \"numeral One = 1\"\n | numeral_Bit0: \"numeral (Bit0 n) = numeral n + numeral n\"\n | numeral_Bit1: \"numeral (Bit1 n) = numeral n + numeral n + 1\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "class minus =\n fixes minus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"-\" 65)", "abbreviation not_member\n where \"not_member x A \\<equiv> \\<not> (x \\<in> A)\" \\<comment> \\<open>non-membership\\<close>", "primrec upt :: \"nat \\<Rightarrow> nat \\<Rightarrow> nat list\" (\"(1[_..</_'])\") where\nupt_0: \"[i..<0] = []\" |\nupt_Suc: \"[i..<(Suc j)] = (if i \\<le> j then [i..<j] @ [j] else [])\"", "class zero =\n fixes zero :: 'a (\"0\")", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Compositions
Integer_Compositions.integer_composition_enum_tail_elem
lemma integer_composition_enum_tail_elem: "x#xs \<in> set (integer_composition_enum n) \<Longrightarrow> xs \<in> set (integer_composition_enum (n - x))"
?x # ?xs \<in> set (integer_composition_enum ?n) \<Longrightarrow> ?xs \<in> set (integer_composition_enum (?n - ?x))
?H1 x_1 x_2 \<in> ?H2 (?H3 x_3) \<Longrightarrow> x_2 \<in> ?H2 (?H3 (?H4 x_3 x_1))
[ "Integer_Compositions.integer_composition_enum", "List.upt", "List.list.set", "Groups.minus_class.minus", "List.list.Cons" ]
[ "fun integer_composition_enum :: \"nat \\<Rightarrow> nat list list\" where\n \"integer_composition_enum 0 = [[]]\"\n| \"integer_composition_enum (Suc n) =\n [Suc m #xs. m \\<leftarrow> [0..< Suc n], xs \\<leftarrow> integer_composition_enum (n-m)]\"", "primrec upt :: \"nat \\<Rightarrow> nat \\<Rightarrow> nat list\" (\"(1[_..</_'])\") where\nupt_0: \"[i..<0] = []\" |\nupt_Suc: \"[i..<(Suc j)] = (if i \\<le> j then [i..<j] @ [j] else [])\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "class minus =\n fixes minus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"-\" 65)", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Compositions
Integer_Compositions.integer_composition_enum_not_null_aux
lemma integer_composition_enum_not_null_aux: "x#xs \<in> set (integer_composition_enum n) \<Longrightarrow> x \<noteq> 0"
?x # ?xs \<in> set (integer_composition_enum ?n) \<Longrightarrow> ?x \<noteq> 0
?H1 x_1 x_2 \<in> ?H2 (?H3 x_3) \<Longrightarrow> x_1 \<noteq> ?H4
[ "Integer_Compositions.integer_composition_enum", "Num.num.One", "List.list.Cons", "Num.numeral_class.numeral", "List.list.set", "Groups.zero_class.zero", "Integer_Compositions.integer_compositions" ]
[ "fun integer_composition_enum :: \"nat \\<Rightarrow> nat list list\" where\n \"integer_composition_enum 0 = [[]]\"\n| \"integer_composition_enum (Suc n) =\n [Suc m #xs. m \\<leftarrow> [0..< Suc n], xs \\<leftarrow> integer_composition_enum (n-m)]\"", "datatype num = One | Bit0 num | Bit1 num", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec numeral :: \"num \\<Rightarrow> 'a\"\n where\n numeral_One: \"numeral One = 1\"\n | numeral_Bit0: \"numeral (Bit0 n) = numeral n + numeral n\"\n | numeral_Bit1: \"numeral (Bit1 n) = numeral n + numeral n + 1\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "class zero =\n fixes zero :: 'a (\"0\")", "definition integer_compositions :: \"nat \\<Rightarrow> nat list set\" where\n \"integer_compositions i = {xs. sum_list xs = i \\<and> 0 \\<notin> set xs}\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Compositions
Integer_Compositions.integer_composition_enum_correct_aux
lemma integer_composition_enum_correct_aux: "0 \<notin> set xs \<Longrightarrow> xs \<in> set (integer_composition_enum (sum_list xs))"
0 \<notin> set ?xs \<Longrightarrow> ?xs \<in> set (integer_composition_enum (sum_list ?xs))
?H1 ?H2 (?H3 x_1) \<Longrightarrow> x_1 \<in> ?H4 (?H5 (?H6 x_1))
[ "List.list.set", "Groups_List.monoid_add_class.sum_list", "Set.not_member", "Groups.zero_class.zero", "Integer_Compositions.integer_composition_enum" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation not_member\n where \"not_member x A \\<equiv> \\<not> (x \\<in> A)\" \\<comment> \\<open>non-membership\\<close>", "class zero =\n fixes zero :: 'a (\"0\")", "fun integer_composition_enum :: \"nat \\<Rightarrow> nat list list\" where\n \"integer_composition_enum 0 = [[]]\"\n| \"integer_composition_enum (Suc n) =\n [Suc m #xs. m \\<leftarrow> [0..< Suc n], xs \\<leftarrow> integer_composition_enum (n-m)]\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Compositions
Integer_Compositions.integer_composition_enum_not_null
lemma integer_composition_enum_not_null: "xs \<in> set (integer_composition_enum n) \<Longrightarrow> 0 \<notin> set xs"
?xs \<in> set (integer_composition_enum ?n) \<Longrightarrow> 0 \<notin> set ?xs
x_1 \<in> ?H1 (?H2 x_2) \<Longrightarrow> ?H3 ?H4 (?H5 x_1)
[ "List.list.set", "Num.numeral_class.numeral", "List.list.map", "List.list.Cons", "Integer_Compositions.integer_composition_enum", "Set.not_member", "Nat.Suc", "Groups.zero_class.zero" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec numeral :: \"num \\<Rightarrow> 'a\"\n where\n numeral_One: \"numeral One = 1\"\n | numeral_Bit0: \"numeral (Bit0 n) = numeral n + numeral n\"\n | numeral_Bit1: \"numeral (Bit1 n) = numeral n + numeral n + 1\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "fun integer_composition_enum :: \"nat \\<Rightarrow> nat list list\" where\n \"integer_composition_enum 0 = [[]]\"\n| \"integer_composition_enum (Suc n) =\n [Suc m #xs. m \\<leftarrow> [0..< Suc n], xs \\<leftarrow> integer_composition_enum (n-m)]\"", "abbreviation not_member\n where \"not_member x A \\<equiv> \\<not> (x \\<in> A)\" \\<comment> \\<open>non-membership\\<close>", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "class zero =\n fixes zero :: 'a (\"0\")" ]
Combinatorial_Enumeration_Algorithms/Integer_Compositions
Integer_Compositions.integer_composition_enum_sum
lemma integer_composition_enum_sum: "xs \<in> set (integer_composition_enum n) \<Longrightarrow> sum_list xs = n"
?xs \<in> set (integer_composition_enum ?n) \<Longrightarrow> sum_list ?xs = ?n
x_1 \<in> ?H1 (?H2 x_2) \<Longrightarrow> ?H3 x_1 = x_2
[ "List.list.map", "List.list.set", "Groups_List.monoid_add_class.sum_list", "Integer_Compositions.integer_composition_enum" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "fun integer_composition_enum :: \"nat \\<Rightarrow> nat list list\" where\n \"integer_composition_enum 0 = [[]]\"\n| \"integer_composition_enum (Suc n) =\n [Suc m #xs. m \\<leftarrow> [0..< Suc n], xs \\<leftarrow> integer_composition_enum (n-m)]\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Compositions
Integer_Compositions.integer_composition_enum_length
lemma integer_composition_enum_length: "length (integer_composition_enum n) = 2^(n-1)"
length (integer_composition_enum ?n) = 2 ^ (?n - 1)
?H1 (?H2 x_1) = ?H3 (?H4 (?H5 ?H6)) (?H7 x_1 ?H8)
[ "Integer_Compositions.integer_composition_enum", "Groups.minus_class.minus", "List.length", "Groups.one_class.one", "Num.numeral_class.numeral", "Power.power_class.power", "Num.num.One", "List.list.Cons", "List.list.Nil", "Num.num.Bit0", "List.list.set" ]
[ "fun integer_composition_enum :: \"nat \\<Rightarrow> nat list list\" where\n \"integer_composition_enum 0 = [[]]\"\n| \"integer_composition_enum (Suc n) =\n [Suc m #xs. m \\<leftarrow> [0..< Suc n], xs \\<leftarrow> integer_composition_enum (n-m)]\"", "class minus =\n fixes minus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"-\" 65)", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "class one =\n fixes one :: 'a (\"1\")", "primrec numeral :: \"num \\<Rightarrow> 'a\"\n where\n numeral_One: \"numeral One = 1\"\n | numeral_Bit0: \"numeral (Bit0 n) = numeral n + numeral n\"\n | numeral_Bit1: \"numeral (Bit1 n) = numeral n + numeral n + 1\"", "primrec power :: \"'a \\<Rightarrow> nat \\<Rightarrow> 'a\" (infixr \"^\" 80)\n where\n power_0: \"a ^ 0 = 1\"\n | power_Suc: \"a ^ Suc n = a * a ^ n\"", "datatype num = One | Bit0 num | Bit1 num", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype num = One | Bit0 num | Bit1 num", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Compositions
Integer_Compositions.integer_compositions_card
theorem integer_compositions_card: "card (integer_compositions n) = 2^(n-1)"
card (integer_compositions ?n) = 2 ^ (?n - 1)
?H1 (?H2 x_1) = ?H3 (?H4 (?H5 ?H6)) (?H7 x_1 ?H8)
[ "Finite_Set.card", "List.list.map", "Num.numeral_class.numeral", "Power.power_class.power", "Num.num.Bit0", "Integer_Compositions.integer_composition_enum", "Groups.minus_class.minus", "Integer_Compositions.integer_compositions", "List.distinct", "Num.num.One", "Groups.one_class.one" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec numeral :: \"num \\<Rightarrow> 'a\"\n where\n numeral_One: \"numeral One = 1\"\n | numeral_Bit0: \"numeral (Bit0 n) = numeral n + numeral n\"\n | numeral_Bit1: \"numeral (Bit1 n) = numeral n + numeral n + 1\"", "primrec power :: \"'a \\<Rightarrow> nat \\<Rightarrow> 'a\" (infixr \"^\" 80)\n where\n power_0: \"a ^ 0 = 1\"\n | power_Suc: \"a ^ Suc n = a * a ^ n\"", "datatype num = One | Bit0 num | Bit1 num", "fun integer_composition_enum :: \"nat \\<Rightarrow> nat list list\" where\n \"integer_composition_enum 0 = [[]]\"\n| \"integer_composition_enum (Suc n) =\n [Suc m #xs. m \\<leftarrow> [0..< Suc n], xs \\<leftarrow> integer_composition_enum (n-m)]\"", "class minus =\n fixes minus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"-\" 65)", "definition integer_compositions :: \"nat \\<Rightarrow> nat list set\" where\n \"integer_compositions i = {xs. sum_list xs = i \\<and> 0 \\<notin> set xs}\"", "primrec distinct :: \"'a list \\<Rightarrow> bool\" where\n\"distinct [] \\<longleftrightarrow> True\" |\n\"distinct (x # xs) \\<longleftrightarrow> x \\<notin> set xs \\<and> distinct xs\"", "datatype num = One | Bit0 num | Bit1 num", "class one =\n fixes one :: 'a (\"1\")" ]
Combinatorial_Enumeration_Algorithms/Integer_Compositions
Integer_Compositions.integer_composition_enum_empty
lemma integer_composition_enum_empty: "[] \<in> set (integer_composition_enum n) \<Longrightarrow> n = 0"
[] \<in> set (integer_composition_enum ?n) \<Longrightarrow> ?n = 0
?H1 \<in> ?H2 (?H3 x_1) \<Longrightarrow> x_1 = ?H4
[ "Integer_Compositions.integer_composition_enum_dom", "Groups.zero_class.zero", "List.list.set", "List.upt", "List.list.Nil", "Integer_Compositions.integer_composition_enum" ]
[ "class zero =\n fixes zero :: 'a (\"0\")", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec upt :: \"nat \\<Rightarrow> nat \\<Rightarrow> nat list\" (\"(1[_..</_'])\") where\nupt_0: \"[i..<0] = []\" |\nupt_Suc: \"[i..<(Suc j)] = (if i \\<le> j then [i..<j] @ [j] else [])\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "fun integer_composition_enum :: \"nat \\<Rightarrow> nat list list\" where\n \"integer_composition_enum 0 = [[]]\"\n| \"integer_composition_enum (Suc n) =\n [Suc m #xs. m \\<leftarrow> [0..< Suc n], xs \\<leftarrow> integer_composition_enum (n-m)]\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Compositions
Integer_Compositions.integer_composition_enum_correct
theorem integer_composition_enum_correct: "set (integer_composition_enum n) = integer_compositions n"
set (integer_composition_enum ?n) = integer_compositions ?n
?H1 (?H2 x_1) = ?H3 x_1
[ "List.list.set", "Integer_Compositions.integer_compositions", "Num.num.One", "Integer_Compositions.integer_composition_enum", "Nat.Suc" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "definition integer_compositions :: \"nat \\<Rightarrow> nat list set\" where\n \"integer_compositions i = {xs. sum_list xs = i \\<and> 0 \\<notin> set xs}\"", "datatype num = One | Bit0 num | Bit1 num", "fun integer_composition_enum :: \"nat \\<Rightarrow> nat list list\" where\n \"integer_composition_enum 0 = [[]]\"\n| \"integer_composition_enum (Suc n) =\n [Suc m #xs. m \\<leftarrow> [0..< Suc n], xs \\<leftarrow> integer_composition_enum (n-m)]\"", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"" ]
Combinatorial_Enumeration_Algorithms/Integer_Compositions
Integer_Compositions.integer_composition_enum_distinct
theorem integer_composition_enum_distinct: "distinct (integer_composition_enum n)"
distinct (integer_composition_enum ?n)
?H1 (?H2 x_1)
[ "List.distinct", "Integer_Compositions.integer_composition_enum", "List.length", "Power.power_class.power", "Groups.one_class.one", "Integer_Compositions.integer_compositions" ]
[ "primrec distinct :: \"'a list \\<Rightarrow> bool\" where\n\"distinct [] \\<longleftrightarrow> True\" |\n\"distinct (x # xs) \\<longleftrightarrow> x \\<notin> set xs \\<and> distinct xs\"", "fun integer_composition_enum :: \"nat \\<Rightarrow> nat list list\" where\n \"integer_composition_enum 0 = [[]]\"\n| \"integer_composition_enum (Suc n) =\n [Suc m #xs. m \\<leftarrow> [0..< Suc n], xs \\<leftarrow> integer_composition_enum (n-m)]\"", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "primrec power :: \"'a \\<Rightarrow> nat \\<Rightarrow> 'a\" (infixr \"^\" 80)\n where\n power_0: \"a ^ 0 = 1\"\n | power_Suc: \"a ^ Suc n = a * a ^ n\"", "class one =\n fixes one :: 'a (\"1\")", "definition integer_compositions :: \"nat \\<Rightarrow> nat list set\" where\n \"integer_compositions i = {xs. sum_list xs = i \\<and> 0 \\<notin> set xs}\"" ]
Combinatorial_Enumeration_Algorithms/Filter_Bool_List
Filter_Bool_List.filter_bool_list_exist_length_card_True
lemma filter_bool_list_exist_length_card_True: "\<lbrakk>distinct xs; A \<subseteq> set xs; n = card A\<rbrakk> \<Longrightarrow> \<exists>bs. length bs = length xs \<and> count_list bs True = card A \<and> A = set (filter_bool_list bs xs)"
distinct ?xs \<Longrightarrow> ?A \<subseteq> set ?xs \<Longrightarrow> ?n = card ?A \<Longrightarrow> \<exists>bs. length bs = length ?xs \<and> count_list bs True = card ?A \<and> ?A = set (filter_bool_list bs ?xs)
\<lbrakk>?H1 x_1; ?H2 x_2 (?H3 x_1); x_3 = ?H4 x_2\<rbrakk> \<Longrightarrow> \<exists>y_0. ?H5 y_0 = ?H6 x_1 \<and> ?H7 y_0 True = ?H4 x_2 \<and> x_2 = ?H3 (?H8 y_0 x_1)
[ "List.length", "Set.subset_eq", "Set.not_member", "List.nth", "List.list.Nil", "List.distinct", "Finite_Set.card", "List.count_list", "Set.Collect", "Filter_Bool_List.filter_bool_list", "List.list.set" ]
[ "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "abbreviation subset_eq :: \"'a set \\<Rightarrow> 'a set \\<Rightarrow> bool\"\n where \"subset_eq \\<equiv> less_eq\"", "abbreviation not_member\n where \"not_member x A \\<equiv> \\<not> (x \\<in> A)\" \\<comment> \\<open>non-membership\\<close>", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec distinct :: \"'a list \\<Rightarrow> bool\" where\n\"distinct [] \\<longleftrightarrow> True\" |\n\"distinct (x # xs) \\<longleftrightarrow> x \\<notin> set xs \\<and> distinct xs\"", "primrec count_list :: \"'a list \\<Rightarrow> 'a \\<Rightarrow> nat\" where\n\"count_list [] y = 0\" |\n\"count_list (x#xs) y = (if x=y then count_list xs y + 1 else count_list xs y)\"", "fun filter_bool_list :: \"bool list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n \"filter_bool_list [] _ = []\"\n| \"filter_bool_list _ [] = []\"\n| \"filter_bool_list (b#bs) (x#xs) =\n (if b then x#(filter_bool_list bs xs) else (filter_bool_list bs xs))\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"" ]
Combinatorial_Enumeration_Algorithms/Filter_Bool_List
Filter_Bool_List.filter_bool_list_not_in
lemma filter_bool_list_not_in: "distinct xs \<Longrightarrow> n < length xs\<Longrightarrow> n < length bs \<Longrightarrow> bs!n = False \<Longrightarrow> xs!n \<notin> set (filter_bool_list bs xs)"
distinct ?xs \<Longrightarrow> ?n < length ?xs \<Longrightarrow> ?n < length ?bs \<Longrightarrow> ?bs ! ?n = False \<Longrightarrow> ?xs ! ?n \<notin> set (filter_bool_list ?bs ?xs)
\<lbrakk>?H1 x_1; x_2 < ?H2 x_1; x_2 < ?H3 x_3; ?H4 x_3 x_2 = False\<rbrakk> \<Longrightarrow> ?H5 (?H6 x_1 x_2) (?H7 (?H8 x_3 x_1))
[ "List.distinct", "List.length", "Set.subset_eq", "Filter_Bool_List.filter_bool_list", "Set.not_member", "List.list.Cons", "Finite_Set.card", "List.count_list", "List.list.set", "List.nth" ]
[ "primrec distinct :: \"'a list \\<Rightarrow> bool\" where\n\"distinct [] \\<longleftrightarrow> True\" |\n\"distinct (x # xs) \\<longleftrightarrow> x \\<notin> set xs \\<and> distinct xs\"", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "abbreviation subset_eq :: \"'a set \\<Rightarrow> 'a set \\<Rightarrow> bool\"\n where \"subset_eq \\<equiv> less_eq\"", "fun filter_bool_list :: \"bool list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n \"filter_bool_list [] _ = []\"\n| \"filter_bool_list _ [] = []\"\n| \"filter_bool_list (b#bs) (x#xs) =\n (if b then x#(filter_bool_list bs xs) else (filter_bool_list bs xs))\"", "abbreviation not_member\n where \"not_member x A \\<equiv> \\<not> (x \\<in> A)\" \\<comment> \\<open>non-membership\\<close>", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec count_list :: \"'a list \\<Rightarrow> 'a \\<Rightarrow> nat\" where\n\"count_list [] y = 0\" |\n\"count_list (x#xs) y = (if x=y then count_list xs y + 1 else count_list xs y)\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>" ]
Combinatorial_Enumeration_Algorithms/Filter_Bool_List
Filter_Bool_List.filter_bool_list_inj_aux
lemma filter_bool_list_inj_aux: assumes "length bs1 = length xs" and "length xs = length bs2" and "distinct xs" shows "filter_bool_list bs1 xs = filter_bool_list bs2 xs \<Longrightarrow> bs1 = bs2"
length ?bs1.0 = length ?xs \<Longrightarrow> length ?xs = length ?bs2.0 \<Longrightarrow> distinct ?xs \<Longrightarrow> filter_bool_list ?bs1.0 ?xs = filter_bool_list ?bs2.0 ?xs \<Longrightarrow> ?bs1.0 = ?bs2.0
\<lbrakk>?H1 x_1 = ?H2 x_2; ?H2 x_2 = ?H1 x_3; ?H3 x_2; ?H4 x_1 x_2 = ?H4 x_3 x_2\<rbrakk> \<Longrightarrow> x_1 = x_3
[ "List.distinct", "Filter_Bool_List.filter_bool_list", "List.length" ]
[ "primrec distinct :: \"'a list \\<Rightarrow> bool\" where\n\"distinct [] \\<longleftrightarrow> True\" |\n\"distinct (x # xs) \\<longleftrightarrow> x \\<notin> set xs \\<and> distinct xs\"", "fun filter_bool_list :: \"bool list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n \"filter_bool_list [] _ = []\"\n| \"filter_bool_list _ [] = []\"\n| \"filter_bool_list (b#bs) (x#xs) =\n (if b then x#(filter_bool_list bs xs) else (filter_bool_list bs xs))\"", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"" ]
Combinatorial_Enumeration_Algorithms/Filter_Bool_List
Filter_Bool_List.filter_bool_list_elem_nth
lemma filter_bool_list_elem_nth: "ys \<in> set (filter_bool_list bs xs) \<Longrightarrow> \<exists>n. ys = xs ! n \<and> bs ! n \<and> n < length bs \<and> n < length xs"
?ys \<in> set (filter_bool_list ?bs ?xs) \<Longrightarrow> \<exists>n. ?ys = ?xs ! n \<and> ?bs ! n \<and> n < length ?bs \<and> n < length ?xs
x_1 \<in> ?H1 (?H2 x_2 x_3) \<Longrightarrow> \<exists>y_0. x_1 = ?H3 x_3 y_0 \<and> ?H4 x_2 y_0 \<and> y_0 < ?H5 x_2 \<and> y_0 < ?H6 x_3
[ "List.nth", "List.count_list", "List.length", "List.list.set", "Filter_Bool_List.filter_bool_list" ]
[ "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "primrec count_list :: \"'a list \\<Rightarrow> 'a \\<Rightarrow> nat\" where\n\"count_list [] y = 0\" |\n\"count_list (x#xs) y = (if x=y then count_list xs y + 1 else count_list xs y)\"", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "fun filter_bool_list :: \"bool list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n \"filter_bool_list [] _ = []\"\n| \"filter_bool_list _ [] = []\"\n| \"filter_bool_list (b#bs) (x#xs) =\n (if b then x#(filter_bool_list bs xs) else (filter_bool_list bs xs))\"" ]
Combinatorial_Enumeration_Algorithms/Filter_Bool_List
Filter_Bool_List.filter_bool_list_set_nth
lemma filter_bool_list_set_nth: "set (filter_bool_list bs xs) = {xs ! n |n. bs ! n \<and> n < length bs \<and> n < length xs}"
set (filter_bool_list ?bs ?xs) = {?xs ! n |n. ?bs ! n \<and> n < length ?bs \<and> n < length ?xs}
?H1 (?H2 x_1 x_2) = ?H3 (\<lambda>y_0. \<exists>y_1. y_0 = ?H4 x_2 y_1 \<and> ?H5 x_1 y_1 \<and> y_1 < ?H6 x_1 \<and> y_1 < ?H7 x_2)
[ "List.length", "Set.Collect", "Filter_Bool_List.filter_bool_list", "List.nth", "List.list.set", "List.count_list" ]
[ "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "fun filter_bool_list :: \"bool list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n \"filter_bool_list [] _ = []\"\n| \"filter_bool_list _ [] = []\"\n| \"filter_bool_list (b#bs) (x#xs) =\n (if b then x#(filter_bool_list bs xs) else (filter_bool_list bs xs))\"", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec count_list :: \"'a list \\<Rightarrow> 'a \\<Rightarrow> nat\" where\n\"count_list [] y = 0\" |\n\"count_list (x#xs) y = (if x=y then count_list xs y + 1 else count_list xs y)\"" ]
Combinatorial_Enumeration_Algorithms/Filter_Bool_List
Filter_Bool_List.filter_bool_list_in
lemma filter_bool_list_in: "n < length xs \<Longrightarrow> n < length bs \<Longrightarrow> bs!n \<Longrightarrow> xs!n \<in> set (filter_bool_list bs xs)"
?n < length ?xs \<Longrightarrow> ?n < length ?bs \<Longrightarrow> ?bs ! ?n \<Longrightarrow> ?xs ! ?n \<in> set (filter_bool_list ?bs ?xs)
\<lbrakk>x_1 < ?H1 x_2; x_1 < ?H2 x_3; ?H3 x_3 x_1\<rbrakk> \<Longrightarrow> ?H4 x_2 x_1 \<in> ?H5 (?H6 x_3 x_2)
[ "List.list.Nil", "Filter_Bool_List.filter_bool_list", "List.list.set", "List.length", "List.nth" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "fun filter_bool_list :: \"bool list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n \"filter_bool_list [] _ = []\"\n| \"filter_bool_list _ [] = []\"\n| \"filter_bool_list (b#bs) (x#xs) =\n (if b then x#(filter_bool_list bs xs) else (filter_bool_list bs xs))\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>" ]
Combinatorial_Enumeration_Algorithms/Filter_Bool_List
Filter_Bool_List.filter_bool_list_card
lemma filter_bool_list_card: "\<lbrakk>distinct xs; length xs = length bs\<rbrakk> \<Longrightarrow> card (set (filter_bool_list bs xs)) = count_list bs True"
distinct ?xs \<Longrightarrow> length ?xs = length ?bs \<Longrightarrow> card (set (filter_bool_list ?bs ?xs)) = count_list ?bs True
\<lbrakk>?H1 x_1; ?H2 x_1 = ?H3 x_2\<rbrakk> \<Longrightarrow> ?H4 (?H5 (?H6 x_2 x_1)) = ?H7 x_2 True
[ "List.length", "Set.not_member", "List.list.set", "Filter_Bool_List.filter_bool_list", "List.list.Cons", "Finite_Set.card", "List.count_list", "Filter_Bool_List.filter_bool_list_dom", "List.distinct" ]
[ "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "abbreviation not_member\n where \"not_member x A \\<equiv> \\<not> (x \\<in> A)\" \\<comment> \\<open>non-membership\\<close>", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "fun filter_bool_list :: \"bool list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n \"filter_bool_list [] _ = []\"\n| \"filter_bool_list _ [] = []\"\n| \"filter_bool_list (b#bs) (x#xs) =\n (if b then x#(filter_bool_list bs xs) else (filter_bool_list bs xs))\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec count_list :: \"'a list \\<Rightarrow> 'a \\<Rightarrow> nat\" where\n\"count_list [] y = 0\" |\n\"count_list (x#xs) y = (if x=y then count_list xs y + 1 else count_list xs y)\"", "primrec distinct :: \"'a list \\<Rightarrow> bool\" where\n\"distinct [] \\<longleftrightarrow> True\" |\n\"distinct (x # xs) \\<longleftrightarrow> x \\<notin> set xs \\<and> distinct xs\"" ]
Combinatorial_Enumeration_Algorithms/Filter_Bool_List
Filter_Bool_List.filter_bool_list_exist_length
lemma filter_bool_list_exist_length: "A \<subseteq> set xs \<Longrightarrow> \<exists>bs. length bs = length xs \<and> A = set (filter_bool_list bs xs)"
?A \<subseteq> set ?xs \<Longrightarrow> \<exists>bs. length bs = length ?xs \<and> ?A = set (filter_bool_list bs ?xs)
?H1 x_1 (?H2 x_2) \<Longrightarrow> \<exists>y_0. ?H3 y_0 = ?H4 x_2 \<and> x_1 = ?H2 (?H5 y_0 x_2)
[ "List.length", "List.list.set", "Set.subset_eq", "Filter_Bool_List.filter_bool_list" ]
[ "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation subset_eq :: \"'a set \\<Rightarrow> 'a set \\<Rightarrow> bool\"\n where \"subset_eq \\<equiv> less_eq\"", "fun filter_bool_list :: \"bool list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n \"filter_bool_list [] _ = []\"\n| \"filter_bool_list _ [] = []\"\n| \"filter_bool_list (b#bs) (x#xs) =\n (if b then x#(filter_bool_list bs xs) else (filter_bool_list bs xs))\"" ]
Combinatorial_Enumeration_Algorithms/Filter_Bool_List
Filter_Bool_List.filter_bool_list_inj
lemma filter_bool_list_inj: "distinct xs \<Longrightarrow> inj_on (\<lambda>bs. filter_bool_list bs xs) {bs. length bs = length xs}"
distinct ?xs \<Longrightarrow> inj_on (\<lambda>bs. filter_bool_list bs ?xs) {bs. length bs = length ?xs}
?H1 x_1 \<Longrightarrow> ?H2 (\<lambda>y_0. ?H3 y_0 x_1) (?H4 (\<lambda>y_1. ?H5 y_1 = ?H6 x_1))
[ "Set.Collect", "Filter_Bool_List.filter_bool_list", "Fun.inj_on", "List.length", "List.distinct" ]
[ "fun filter_bool_list :: \"bool list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n \"filter_bool_list [] _ = []\"\n| \"filter_bool_list _ [] = []\"\n| \"filter_bool_list (b#bs) (x#xs) =\n (if b then x#(filter_bool_list bs xs) else (filter_bool_list bs xs))\"", "definition inj_on :: \"('a \\<Rightarrow> 'b) \\<Rightarrow> 'a set \\<Rightarrow> bool\" \\<comment> \\<open>injective\\<close>\n where \"inj_on f A \\<longleftrightarrow> (\\<forall>x\\<in>A. \\<forall>y\\<in>A. f x = f y \\<longrightarrow> x = y)\"", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "primrec distinct :: \"'a list \\<Rightarrow> bool\" where\n\"distinct [] \\<longleftrightarrow> True\" |\n\"distinct (x # xs) \\<longleftrightarrow> x \\<notin> set xs \\<and> distinct xs\"" ]
Combinatorial_Enumeration_Algorithms/Filter_Bool_List
Filter_Bool_List.filter_bool_list_not_elem
lemma filter_bool_list_not_elem: "x \<notin> set xs \<Longrightarrow> x \<notin> set (filter_bool_list bs xs)"
?x \<notin> set ?xs \<Longrightarrow> ?x \<notin> set (filter_bool_list ?bs ?xs)
?H1 x_1 (?H2 x_2) \<Longrightarrow> ?H1 x_1 (?H2 (?H3 x_3 x_2))
[ "List.list.set", "Set.not_member", "List.nth", "Finite_Set.card", "Filter_Bool_List.filter_bool_list", "List.distinct" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation not_member\n where \"not_member x A \\<equiv> \\<not> (x \\<in> A)\" \\<comment> \\<open>non-membership\\<close>", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "fun filter_bool_list :: \"bool list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n \"filter_bool_list [] _ = []\"\n| \"filter_bool_list _ [] = []\"\n| \"filter_bool_list (b#bs) (x#xs) =\n (if b then x#(filter_bool_list bs xs) else (filter_bool_list bs xs))\"", "primrec distinct :: \"'a list \\<Rightarrow> bool\" where\n\"distinct [] \\<longleftrightarrow> True\" |\n\"distinct (x # xs) \\<longleftrightarrow> x \\<notin> set xs \\<and> distinct xs\"" ]
Combinatorial_Enumeration_Algorithms/Filter_Bool_List
Filter_Bool_List.filter_bool_list_elem
lemma filter_bool_list_elem: "x \<in> set (filter_bool_list bs xs) \<Longrightarrow> x \<in> set xs"
?x \<in> set (filter_bool_list ?bs ?xs) \<Longrightarrow> ?x \<in> set ?xs
x_1 \<in> ?H1 (?H2 x_2 x_3) \<Longrightarrow> x_1 \<in> ?H1 x_3
[ "List.list.set", "List.nth", "Filter_Bool_List.filter_bool_list_dom", "List.distinct", "Filter_Bool_List.filter_bool_list", "Set.not_member" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "primrec distinct :: \"'a list \\<Rightarrow> bool\" where\n\"distinct [] \\<longleftrightarrow> True\" |\n\"distinct (x # xs) \\<longleftrightarrow> x \\<notin> set xs \\<and> distinct xs\"", "fun filter_bool_list :: \"bool list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n \"filter_bool_list [] _ = []\"\n| \"filter_bool_list _ [] = []\"\n| \"filter_bool_list (b#bs) (x#xs) =\n (if b then x#(filter_bool_list bs xs) else (filter_bool_list bs xs))\"", "abbreviation not_member\n where \"not_member x A \\<equiv> \\<not> (x \\<in> A)\" \\<comment> \\<open>non-membership\\<close>" ]
Combinatorial_Enumeration_Algorithms/Filter_Bool_List
Filter_Bool_List.filter_bool_list_distinct
lemma filter_bool_list_distinct: "distinct xs \<Longrightarrow> distinct (filter_bool_list bs xs)"
distinct ?xs \<Longrightarrow> distinct (filter_bool_list ?bs ?xs)
?H1 x_1 \<Longrightarrow> ?H1 (?H2 x_2 x_1)
[ "List.distinct", "List.count_list", "List.length", "Filter_Bool_List.filter_bool_list" ]
[ "primrec distinct :: \"'a list \\<Rightarrow> bool\" where\n\"distinct [] \\<longleftrightarrow> True\" |\n\"distinct (x # xs) \\<longleftrightarrow> x \\<notin> set xs \\<and> distinct xs\"", "primrec count_list :: \"'a list \\<Rightarrow> 'a \\<Rightarrow> nat\" where\n\"count_list [] y = 0\" |\n\"count_list (x#xs) y = (if x=y then count_list xs y + 1 else count_list xs y)\"", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "fun filter_bool_list :: \"bool list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n \"filter_bool_list [] _ = []\"\n| \"filter_bool_list _ [] = []\"\n| \"filter_bool_list (b#bs) (x#xs) =\n (if b then x#(filter_bool_list bs xs) else (filter_bool_list bs xs))\"" ]
Isabelle_hoops/Totally_Ordered_Hoops
Totally_Ordered_Hoops.irr_test
lemma irr_test: assumes "totally_ordered_hoop A PA RA a" "\<not>totally_ordered_irreducible_hoop A PA RA a" shows "\<exists> B C. (A = B \<union> C) \<and> ({a} = B \<inter> C) \<and> (\<exists> y \<in> B. y \<noteq> a) \<and> (\<exists> y \<in> C. y \<noteq> a) \<and> (hoop B PA RA a) \<and> (hoop C PA RA a) \<and> (\<forall> x \<in> B-{a}. \<forall> y \<in> C. PA x y = x) \<and> (\<forall> x \<in> B-{a}. \<forall> y \<in> C. RA x y = a) \<and> (\<forall> x \<in> C. \<forall> y \<in> B. RA x y = y)"
totally_ordered_hoop ?A ?PA ?RA ?a \<Longrightarrow> \<not> totally_ordered_irreducible_hoop ?A ?PA ?RA ?a \<Longrightarrow> \<exists>B C. ?A = B \<union> C \<and> {?a} = B \<inter> C \<and> (\<exists>y\<in>B. y \<noteq> ?a) \<and> (\<exists>y\<in>C. y \<noteq> ?a) \<and> hoop B ?PA ?RA ?a \<and> hoop C ?PA ?RA ?a \<and> (\<forall>x\<in>B - {?a}. \<forall>y\<in>C. ?PA x y = x) \<and> (\<forall>x\<in>B - {?a}. \<forall>y\<in>C. ?RA x y = ?a) \<and> (\<forall>x\<in>C. \<forall>y\<in>B. ?RA x y = y)
\<lbrakk>?H1 x_1 x_2 x_3 x_4; \<not> ?H2 x_1 x_2 x_3 x_4\<rbrakk> \<Longrightarrow> \<exists>y_0 y_1. x_1 = ?H3 y_0 y_1 \<and> ?H4 x_4 ?H5 = ?H6 y_0 y_1 \<and> (\<exists>y_2\<in>y_0. y_2 \<noteq> x_4) \<and> (\<exists>y_3\<in>y_1. y_3 \<noteq> x_4) \<and> ?H7 y_0 x_2 x_3 x_4 \<and> ?H7 y_1 x_2 x_3 x_4 \<and> (\<forall>y_4\<in>?H8 y_0 (?H4 x_4 ?H5). \<forall>y_5\<in>y_1. x_2 y_4 y_5 = y_4) \<and> (\<forall>y_6\<in>?H8 y_0 (?H4 x_4 ?H5). \<forall>y_7\<in>y_1. x_3 y_6 y_7 = x_4) \<and> (\<forall>y_8\<in>y_1. \<forall>y_9\<in>y_0. x_3 y_8 y_9 = y_9)
[ "Groups.minus_class.minus", "Set.empty", "Totally_Ordered_Hoops.totally_ordered_irreducible_hoop", "Set.inter", "Set.union", "Totally_Ordered_Hoops.totally_ordered_hoop", "Set.insert", "Hoops.hoop" ]
[ "class minus =\n fixes minus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"-\" 65)", "abbreviation empty :: \"'a set\" (\"{}\")\n where \"{} \\<equiv> bot\"", "abbreviation inter :: \"'a set \\<Rightarrow> 'a set \\<Rightarrow> 'a set\" (infixl \"\\<inter>\" 70)\n where \"(\\<inter>) \\<equiv> inf\"", "abbreviation union :: \"'a set \\<Rightarrow> 'a set \\<Rightarrow> 'a set\" (infixl \"\\<union>\" 65)\n where \"union \\<equiv> sup\"", "definition insert :: \"'a \\<Rightarrow> 'a set \\<Rightarrow> 'a set\"\n where insert_compr: \"insert a B = {x. x = a \\<or> x \\<in> B}\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_suffix_fst_1
lemma Interleaves_suffix_fst_1 [rule_format]: assumes A: "\<forall>n < length ws. P (ws ! n) (drop (Suc n) ws)" shows "xs \<cong> {ys, zs, \<lambda>v vs. P v (vs @ ws)} \<longrightarrow> xs @ ws \<cong> {ys @ ws, zs, P}" (is "_ \<cong> {_, _, ?P'} \<longrightarrow> _")
(\<And>n. n < length ?ws \<Longrightarrow> ?P (?ws ! n) (drop (Suc n) ?ws)) \<Longrightarrow> ?xs \<cong> {?ys, ?zs, \<lambda>v vs. ?P v (vs @ ?ws)} \<Longrightarrow> ?xs @ ?ws \<cong> {?ys @ ?ws, ?zs, ?P}
\<lbrakk>\<And>y_0. y_0 < ?H1 x_1 \<Longrightarrow> x_2 (?H2 x_1 y_0) (?H3 (?H4 y_0) x_1); ?H5 x_3 x_4 x_5 (\<lambda>y_1 y_2. x_2 y_1 (?H6 y_2 x_1))\<rbrakk> \<Longrightarrow> ?H5 (?H6 x_3 x_1) (?H6 x_4 x_1) x_5 x_2
[ "ListInterleaving.Interleaves_syntax", "Nat.Suc", "List.drop", "ListInterleaving.Interleaves_dom", "List.nth", "List.append", "List.length" ]
[ "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_suffix_fst_2
lemma Interleaves_suffix_fst_2 [rule_format]: assumes A: "\<forall>n < length ws. P (ws ! n) (drop (Suc n) ws)" shows "xs @ ws \<cong> {ys @ ws, zs, P} \<longrightarrow> xs \<cong> {ys, zs, \<lambda>v vs. P v (vs @ ws)}" (is "_ \<longrightarrow> _ \<cong> {_, _, ?P'}")
(\<And>n. n < length ?ws \<Longrightarrow> ?P (?ws ! n) (drop (Suc n) ?ws)) \<Longrightarrow> ?xs @ ?ws \<cong> {?ys @ ?ws, ?zs, ?P} \<Longrightarrow> ?xs \<cong> {?ys, ?zs, \<lambda>v vs. ?P v (vs @ ?ws)}
\<lbrakk>\<And>y_0. y_0 < ?H1 x_1 \<Longrightarrow> x_2 (?H2 x_1 y_0) (?H3 (?H4 y_0) x_1); ?H5 (?H6 x_3 x_1) (?H6 x_4 x_1) x_5 x_2\<rbrakk> \<Longrightarrow> ?H5 x_3 x_4 x_5 (\<lambda>y_1 y_2. x_2 y_1 (?H6 y_2 x_1))
[ "ListInterleaving.interleaves_dom", "ListInterleaving.interleaves_syntax", "ListInterleaving.Interleaves_syntax", "List.append", "List.drop", "Nat.Suc", "List.nth", "List.length" ]
[ "abbreviation interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\" \n (\"(_ \\<simeq> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<simeq> {ys, zs, P} \\<equiv> interleaves P xs ys zs\"", "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"", "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_suffix_snd
lemma Interleaves_suffix_snd [rule_format]: "\<forall>n < length ws. \<not> P (ws ! n) (drop (Suc n) ws) \<Longrightarrow> xs \<cong> {ys, zs, \<lambda>v vs. P v (vs @ ws)} = xs @ ws \<cong> {ys, zs @ ws, P}"
(\<And>n. n < length ?ws \<Longrightarrow> \<not> ?P (?ws ! n) (drop (Suc n) ?ws)) \<Longrightarrow> ?xs \<cong> {?ys, ?zs, \<lambda>v vs. ?P v (vs @ ?ws)} = ?xs @ ?ws \<cong> {?ys, ?zs @ ?ws, ?P}
(\<And>y_0. y_0 < ?H1 x_1 \<Longrightarrow> \<not> x_2 (?H2 x_1 y_0) (?H3 (?H4 y_0) x_1)) \<Longrightarrow> ?H5 x_3 x_4 x_5 (\<lambda>y_1 y_2. x_2 y_1 (?H6 y_2 x_1)) = ?H5 (?H6 x_3 x_1) x_4 (?H6 x_5 x_1) x_2
[ "List.append", "List.list.Nil", "List.drop", "ListInterleaving.interleaves_dom", "Groups.plus_class.plus", "List.nth", "Nat.Suc", "List.length", "ListInterleaving.Interleaves_syntax", "ListInterleaving.Interleaves_dom" ]
[ "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "class plus =\n fixes plus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"+\" 65)", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_suffix_fst
lemma Interleaves_suffix_fst [rule_format]: "\<forall>n < length ws. P (ws ! n) (drop (Suc n) ws) \<Longrightarrow> xs \<cong> {ys, zs, \<lambda>v vs. P v (vs @ ws)} = xs @ ws \<cong> {ys @ ws, zs, P}"
(\<And>n. n < length ?ws \<Longrightarrow> ?P (?ws ! n) (drop (Suc n) ?ws)) \<Longrightarrow> ?xs \<cong> {?ys, ?zs, \<lambda>v vs. ?P v (vs @ ?ws)} = ?xs @ ?ws \<cong> {?ys @ ?ws, ?zs, ?P}
(\<And>y_0. y_0 < ?H1 x_1 \<Longrightarrow> x_2 (?H2 x_1 y_0) (?H3 (?H4 y_0) x_1)) \<Longrightarrow> ?H5 x_3 x_4 x_5 (\<lambda>y_1 y_2. x_2 y_1 (?H6 y_2 x_1)) = ?H5 (?H6 x_3 x_1) (?H6 x_4 x_1) x_5 x_2
[ "ListInterleaving.Interleaves_syntax", "List.nth", "Nat.Suc", "List.filter", "List.list.Nil", "List.append", "ListInterleaving.Interleaves_dom", "List.length", "List.drop" ]
[ "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "primrec filter:: \"('a \\<Rightarrow> bool) \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n\"filter P [] = []\" |\n\"filter P (x # xs) = (if P x then x # filter P xs else filter P xs)\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>" ]
List_Interleaving/ListInterleaving
ListInterleaving.interleaves_prefix_fst_2
lemma interleaves_prefix_fst_2 [rule_format]: "ws @ xs \<simeq> {ws @ ys, zs, P} \<longrightarrow> (\<forall>n < length ws. P (ws ! n) (drop (Suc n) ws @ xs)) \<longrightarrow> xs \<simeq> {ys, zs, P}"
?ws @ ?xs \<simeq> {?ws @ ?ys, ?zs, ?P} \<Longrightarrow> (\<And>n. n < length ?ws \<Longrightarrow> ?P (?ws ! n) (drop (Suc n) ?ws @ ?xs)) \<Longrightarrow> ?xs \<simeq> {?ys, ?zs, ?P}
\<lbrakk>?H1 (?H2 x_1 x_2) (?H2 x_1 x_3) x_4 x_5; \<And>y_0. y_0 < ?H3 x_1 \<Longrightarrow> x_5 (?H4 x_1 y_0) (?H2 (?H5 (?H6 y_0) x_1) x_2)\<rbrakk> \<Longrightarrow> ?H1 x_2 x_3 x_4 x_5
[ "Groups.plus_class.plus", "List.length", "Nat.Suc", "List.nth", "ListInterleaving.interleaves_syntax", "List.append", "Fun.inj", "List.list.map", "List.drop", "List.list.Nil" ]
[ "class plus =\n fixes plus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"+\" 65)", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "abbreviation interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\" \n (\"(_ \\<simeq> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<simeq> {ys, zs, P} \\<equiv> interleaves P xs ys zs\"", "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"", "abbreviation inj :: \"('a \\<Rightarrow> 'b) \\<Rightarrow> bool\"\n where \"inj f \\<equiv> inj_on f UNIV\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_prefix_fst_2
lemma Interleaves_prefix_fst_2 [rule_format]: "ws @ xs \<cong> {ws @ ys, zs, P} \<longrightarrow> (\<forall>n < length ws. P (ws ! n) (drop (Suc n) ws @ xs)) \<longrightarrow> xs \<cong> {ys, zs, P}"
?ws @ ?xs \<cong> {?ws @ ?ys, ?zs, ?P} \<Longrightarrow> (\<And>n. n < length ?ws \<Longrightarrow> ?P (?ws ! n) (drop (Suc n) ?ws @ ?xs)) \<Longrightarrow> ?xs \<cong> {?ys, ?zs, ?P}
\<lbrakk>?H1 (?H2 x_1 x_2) (?H2 x_1 x_3) x_4 x_5; \<And>y_0. y_0 < ?H3 x_1 \<Longrightarrow> x_5 (?H4 x_1 y_0) (?H2 (?H5 (?H6 y_0) x_1) x_2)\<rbrakk> \<Longrightarrow> ?H1 x_2 x_3 x_4 x_5
[ "ListInterleaving.Interleaves_syntax", "List.length", "List.nth", "List.append", "List.drop", "Nat.Suc" ]
[ "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"", "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.interleaves_prefix_fst_1
lemma interleaves_prefix_fst_1 [rule_format]: assumes A: "xs \<simeq> {ys, zs, P}" shows "(\<forall>n < length ws. P (ws ! n) (drop (Suc n) ws @ xs)) \<longrightarrow> ws @ xs \<simeq> {ws @ ys, zs, P}"
?xs \<simeq> {?ys, ?zs, ?P} \<Longrightarrow> (\<And>n. n < length ?ws \<Longrightarrow> ?P (?ws ! n) (drop (Suc n) ?ws @ ?xs)) \<Longrightarrow> ?ws @ ?xs \<simeq> {?ws @ ?ys, ?zs, ?P}
\<lbrakk>?H1 x_1 x_2 x_3 x_4; \<And>y_0. y_0 < ?H2 x_5 \<Longrightarrow> x_4 (?H3 x_5 y_0) (?H4 (?H5 (?H6 y_0) x_5) x_1)\<rbrakk> \<Longrightarrow> ?H1 (?H4 x_5 x_1) (?H4 x_5 x_2) x_3 x_4
[ "List.drop", "List.filter", "Groups.plus_class.plus", "Nat.Suc", "ListInterleaving.interleaves_syntax", "List.length", "List.append", "List.list.map", "ListInterleaving.interleaves_dom", "List.nth" ]
[ "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "primrec filter:: \"('a \\<Rightarrow> bool) \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n\"filter P [] = []\" |\n\"filter P (x # xs) = (if P x then x # filter P xs else filter P xs)\"", "class plus =\n fixes plus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"+\" 65)", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "abbreviation interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\" \n (\"(_ \\<simeq> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<simeq> {ys, zs, P} \\<equiv> interleaves P xs ys zs\"", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_prefix_fst_1
lemma Interleaves_prefix_fst_1 [rule_format]: assumes A: "xs \<cong> {ys, zs, P}" shows "(\<forall>n < length ws. P (ws ! n) (drop (Suc n) ws @ xs)) \<longrightarrow> ws @ xs \<cong> {ws @ ys, zs, P}"
?xs \<cong> {?ys, ?zs, ?P} \<Longrightarrow> (\<And>n. n < length ?ws \<Longrightarrow> ?P (?ws ! n) (drop (Suc n) ?ws @ ?xs)) \<Longrightarrow> ?ws @ ?xs \<cong> {?ws @ ?ys, ?zs, ?P}
\<lbrakk>?H1 x_1 x_2 x_3 x_4; \<And>y_0. y_0 < ?H2 x_5 \<Longrightarrow> x_4 (?H3 x_5 y_0) (?H4 (?H5 (?H6 y_0) x_5) x_1)\<rbrakk> \<Longrightarrow> ?H1 (?H4 x_5 x_1) (?H4 x_5 x_2) x_3 x_4
[ "ListInterleaving.Interleaves_syntax", "ListInterleaving.interleaves_dom", "List.append", "List.drop", "List.list.Cons", "List.length", "List.nth", "Nat.Suc", "List.filter" ]
[ "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"", "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "primrec filter:: \"('a \\<Rightarrow> bool) \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n\"filter P [] = []\" |\n\"filter P (x # xs) = (if P x then x # filter P xs else filter P xs)\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.interleaves_prefix_snd
lemma interleaves_prefix_snd [rule_format]: "\<forall>n < length ws. \<not> P (ws ! n) (drop (Suc n) ws @ xs) \<Longrightarrow> xs \<simeq> {ys, zs, P} = ws @ xs \<simeq> {ys, ws @ zs, P}"
(\<And>n. n < length ?ws \<Longrightarrow> \<not> ?P (?ws ! n) (drop (Suc n) ?ws @ ?xs)) \<Longrightarrow> ?xs \<simeq> {?ys, ?zs, ?P} = ?ws @ ?xs \<simeq> {?ys, ?ws @ ?zs, ?P}
(\<And>y_0. y_0 < ?H1 x_1 \<Longrightarrow> \<not> x_2 (?H2 x_1 y_0) (?H3 (?H4 (?H5 y_0) x_1) x_3)) \<Longrightarrow> ?H6 x_3 x_4 x_5 x_2 = ?H6 (?H3 x_1 x_3) x_4 (?H3 x_1 x_5) x_2
[ "ListInterleaving.interleaves_syntax", "List.append", "List.nth", "Nat.Suc", "List.drop", "List.length" ]
[ "abbreviation interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\" \n (\"(_ \\<simeq> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<simeq> {ys, zs, P} \\<equiv> interleaves P xs ys zs\"", "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_prefix_snd
lemma Interleaves_prefix_snd [rule_format]: "\<forall>n < length ws. \<not> P (ws ! n) (drop (Suc n) ws @ xs) \<Longrightarrow> xs \<cong> {ys, zs, P} = ws @ xs \<cong> {ys, ws @ zs, P}"
(\<And>n. n < length ?ws \<Longrightarrow> \<not> ?P (?ws ! n) (drop (Suc n) ?ws @ ?xs)) \<Longrightarrow> ?xs \<cong> {?ys, ?zs, ?P} = ?ws @ ?xs \<cong> {?ys, ?ws @ ?zs, ?P}
(\<And>y_0. y_0 < ?H1 x_1 \<Longrightarrow> \<not> x_2 (?H2 x_1 y_0) (?H3 (?H4 (?H5 y_0) x_1) x_3)) \<Longrightarrow> ?H6 x_3 x_4 x_5 x_2 = ?H6 (?H3 x_1 x_3) x_4 (?H3 x_1 x_5) x_2
[ "List.nth", "ListInterleaving.interleaves_dom", "List.filter", "List.length", "List.append", "ListInterleaving.interleaves_syntax", "ListInterleaving.Interleaves_syntax", "List.list.Nil", "Nat.Suc", "List.drop" ]
[ "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "primrec filter:: \"('a \\<Rightarrow> bool) \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n\"filter P [] = []\" |\n\"filter P (x # xs) = (if P x then x # filter P xs else filter P xs)\"", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"", "abbreviation interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\" \n (\"(_ \\<simeq> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<simeq> {ys, zs, P} \\<equiv> interleaves P xs ys zs\"", "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_suffix_aux
lemma Interleaves_suffix_aux [rule_format]: "(\<forall>n < length ws. P (ws ! n) (drop (Suc n) ws)) \<longrightarrow> x # xs @ ws \<cong> {ws, zs, P} \<longrightarrow> \<not> P x (xs @ ws)"
(\<And>n. n < length ?ws \<Longrightarrow> ?P (?ws ! n) (drop (Suc n) ?ws)) \<Longrightarrow> ?x # ?xs @ ?ws \<cong> {?ws, ?zs, ?P} \<Longrightarrow> \<not> ?P ?x (?xs @ ?ws)
\<lbrakk>\<And>y_0. y_0 < ?H1 x_1 \<Longrightarrow> x_2 (?H2 x_1 y_0) (?H3 (?H4 y_0) x_1); ?H5 (?H6 x_3 (?H7 x_4 x_1)) x_1 x_5 x_2\<rbrakk> \<Longrightarrow> \<not> x_2 x_3 (?H7 x_4 x_1)
[ "List.drop", "List.length", "List.list.Cons", "ListInterleaving.interleaves_dom", "ListInterleaving.Interleaves_syntax", "Nat.Suc", "List.nth", "List.append" ]
[ "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.interleaves_prefix_fst
lemma interleaves_prefix_fst [rule_format]: "\<forall>n < length ws. P (ws ! n) (drop (Suc n) ws @ xs) \<Longrightarrow> xs \<simeq> {ys, zs, P} = ws @ xs \<simeq> {ws @ ys, zs, P}"
(\<And>n. n < length ?ws \<Longrightarrow> ?P (?ws ! n) (drop (Suc n) ?ws @ ?xs)) \<Longrightarrow> ?xs \<simeq> {?ys, ?zs, ?P} = ?ws @ ?xs \<simeq> {?ws @ ?ys, ?zs, ?P}
(\<And>y_0. y_0 < ?H1 x_1 \<Longrightarrow> x_2 (?H2 x_1 y_0) (?H3 (?H4 (?H5 y_0) x_1) x_3)) \<Longrightarrow> ?H6 x_3 x_4 x_5 x_2 = ?H6 (?H3 x_1 x_3) (?H3 x_1 x_4) x_5 x_2
[ "List.nth", "List.length", "Nat.Suc", "List.drop", "List.append", "ListInterleaving.interleaves_syntax" ]
[ "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"", "abbreviation interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\" \n (\"(_ \\<simeq> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<simeq> {ys, zs, P} \\<equiv> interleaves P xs ys zs\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_prefix_fst
lemma Interleaves_prefix_fst [rule_format]: "\<forall>n < length ws. P (ws ! n) (drop (Suc n) ws @ xs) \<Longrightarrow> xs \<cong> {ys, zs, P} = ws @ xs \<cong> {ws @ ys, zs, P}"
(\<And>n. n < length ?ws \<Longrightarrow> ?P (?ws ! n) (drop (Suc n) ?ws @ ?xs)) \<Longrightarrow> ?xs \<cong> {?ys, ?zs, ?P} = ?ws @ ?xs \<cong> {?ws @ ?ys, ?zs, ?P}
(\<And>y_0. y_0 < ?H1 x_1 \<Longrightarrow> x_2 (?H2 x_1 y_0) (?H3 (?H4 (?H5 y_0) x_1) x_3)) \<Longrightarrow> ?H6 x_3 x_4 x_5 x_2 = ?H6 (?H3 x_1 x_3) (?H3 x_1 x_4) x_5 x_2
[ "List.append", "List.drop", "List.length", "ListInterleaving.Interleaves_syntax", "List.nth", "Nat.Suc" ]
[ "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"", "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.interleaves_map
lemma interleaves_map [rule_format]: assumes A: "inj f" shows "xs \<simeq> {ys, zs, P} \<longrightarrow> map f xs \<simeq> {map f ys, map f zs, \<lambda>w ws. P (inv f w) (map (inv f) ws)}" (is "_ \<longrightarrow> _ \<simeq> {_, _, ?P'}")
inj ?f \<Longrightarrow> ?xs \<simeq> {?ys, ?zs, ?P} \<Longrightarrow> map ?f ?xs \<simeq> {map ?f ?ys, map ?f ?zs, \<lambda>w ws. ?P (inv ?f w) (map (inv ?f) ws)}
\<lbrakk>?H1 x_1; ?H2 x_2 x_3 x_4 x_5\<rbrakk> \<Longrightarrow> ?H3 (?H4 x_1 x_2) (?H4 x_1 x_3) (?H4 x_1 x_4) (\<lambda>y_0 y_1. x_5 (?H5 x_1 y_0) (?H6 (?H5 x_1) y_1))
[ "Fun.inj", "Hilbert_Choice.inv", "ListInterleaving.interleaves_syntax", "Nat.Suc", "List.list.Cons", "List.list.map", "List.list.Nil" ]
[ "abbreviation inj :: \"('a \\<Rightarrow> 'b) \\<Rightarrow> bool\"\n where \"inj f \\<equiv> inj_on f UNIV\"", "abbreviation inv :: \"('a \\<Rightarrow> 'b) \\<Rightarrow> ('b \\<Rightarrow> 'a)\" where\n\"inv \\<equiv> inv_into UNIV\"", "abbreviation interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\" \n (\"(_ \\<simeq> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<simeq> {ys, zs, P} \\<equiv> interleaves P xs ys zs\"", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_map
lemma Interleaves_map [rule_format]: assumes A: "inj f" shows "xs \<cong> {ys, zs, P} \<longrightarrow> map f xs \<cong> {map f ys, map f zs, \<lambda>w ws. P (inv f w) (map (inv f) ws)}" (is "_ \<longrightarrow> _ \<cong> {_, _, ?P'}")
inj ?f \<Longrightarrow> ?xs \<cong> {?ys, ?zs, ?P} \<Longrightarrow> map ?f ?xs \<cong> {map ?f ?ys, map ?f ?zs, \<lambda>w ws. ?P (inv ?f w) (map (inv ?f) ws)}
\<lbrakk>?H1 x_1; ?H2 x_2 x_3 x_4 x_5\<rbrakk> \<Longrightarrow> ?H3 (?H4 x_1 x_2) (?H4 x_1 x_3) (?H4 x_1 x_4) (\<lambda>y_0 y_1. x_5 (?H5 x_1 y_0) (?H6 (?H5 x_1) y_1))
[ "Fun.inj", "ListInterleaving.Interleaves_syntax", "Hilbert_Choice.inv", "ListInterleaving.Interleaves_dom", "List.list.map" ]
[ "abbreviation inj :: \"('a \\<Rightarrow> 'b) \\<Rightarrow> bool\"\n where \"inj f \\<equiv> inj_on f UNIV\"", "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "abbreviation inv :: \"('a \\<Rightarrow> 'b) \\<Rightarrow> ('b \\<Rightarrow> 'a)\" where\n\"inv \\<equiv> inv_into UNIV\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.interleaves_filter
lemma interleaves_filter [rule_format]: assumes A: "\<forall>x xs. P x (filter Q xs) = P x xs" shows "xs \<simeq> {ys, zs, P} \<longrightarrow> filter Q xs \<simeq> {filter Q ys, filter Q zs, P}"
(\<And>x xs. ?P x (filter ?Q xs) = ?P x xs) \<Longrightarrow> ?xs \<simeq> {?ys, ?zs, ?P} \<Longrightarrow> filter ?Q ?xs \<simeq> {filter ?Q ?ys, filter ?Q ?zs, ?P}
\<lbrakk>\<And>y_0 y_1. x_1 y_0 (?H1 x_2 y_1) = x_1 y_0 y_1; ?H2 x_3 x_4 x_5 x_1\<rbrakk> \<Longrightarrow> ?H2 (?H1 x_2 x_3) (?H1 x_2 x_4) (?H1 x_2 x_5) x_1
[ "List.list.Cons", "List.list.map", "ListInterleaving.interleaves_syntax", "Hilbert_Choice.inv", "List.filter", "ListInterleaving.Interleaves_dom" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\" \n (\"(_ \\<simeq> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<simeq> {ys, zs, P} \\<equiv> interleaves P xs ys zs\"", "abbreviation inv :: \"('a \\<Rightarrow> 'b) \\<Rightarrow> ('b \\<Rightarrow> 'a)\" where\n\"inv \\<equiv> inv_into UNIV\"", "primrec filter:: \"('a \\<Rightarrow> bool) \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n\"filter P [] = []\" |\n\"filter P (x # xs) = (if P x then x # filter P xs else filter P xs)\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_filter
lemma Interleaves_filter [rule_format]: assumes A: "\<forall>x xs. P x (filter Q xs) = P x xs" shows "xs \<cong> {ys, zs, P} \<longrightarrow> filter Q xs \<cong> {filter Q ys, filter Q zs, P}"
(\<And>x xs. ?P x (filter ?Q xs) = ?P x xs) \<Longrightarrow> ?xs \<cong> {?ys, ?zs, ?P} \<Longrightarrow> filter ?Q ?xs \<cong> {filter ?Q ?ys, filter ?Q ?zs, ?P}
\<lbrakk>\<And>y_0 y_1. x_1 y_0 (?H1 x_2 y_1) = x_1 y_0 y_1; ?H2 x_3 x_4 x_5 x_1\<rbrakk> \<Longrightarrow> ?H2 (?H1 x_2 x_3) (?H1 x_2 x_4) (?H1 x_2 x_5) x_1
[ "ListInterleaving.Interleaves_syntax", "List.list.Nil", "Hilbert_Choice.inv", "List.filter", "List.append", "Groups.plus_class.plus" ]
[ "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation inv :: \"('a \\<Rightarrow> 'b) \\<Rightarrow> ('b \\<Rightarrow> 'a)\" where\n\"inv \\<equiv> inv_into UNIV\"", "primrec filter:: \"('a \\<Rightarrow> bool) \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n\"filter P [] = []\" |\n\"filter P (x # xs) = (if P x then x # filter P xs else filter P xs)\"", "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"", "class plus =\n fixes plus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"+\" 65)" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_suffix_one_fst_1
lemma Interleaves_suffix_one_fst_1 [rule_format]: "P x [] \<Longrightarrow> xs \<cong> {ys, zs, \<lambda>w ws. P w (ws @ [x])} \<Longrightarrow> xs @ [x] \<cong> {ys @ [x], zs, P}"
?P ?x [] \<Longrightarrow> ?xs \<cong> {?ys, ?zs, \<lambda>w ws. ?P w (ws @ [?x])} \<Longrightarrow> ?xs @ [?x] \<cong> {?ys @ [?x], ?zs, ?P}
\<lbrakk>x_1 x_2 ?H1; ?H2 x_3 x_4 x_5 (\<lambda>y_0 y_1. x_1 y_0 (?H3 y_1 (?H4 x_2 ?H1)))\<rbrakk> \<Longrightarrow> ?H2 (?H3 x_3 (?H4 x_2 ?H1)) (?H3 x_4 (?H4 x_2 ?H1)) x_5 x_1
[ "ListInterleaving.Interleaves_syntax", "List.list.Cons", "List.filter", "List.list.Nil", "List.length", "ListInterleaving.Interleaves_dom", "List.nth", "List.append" ]
[ "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec filter:: \"('a \\<Rightarrow> bool) \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n\"filter P [] = []\" |\n\"filter P (x # xs) = (if P x then x # filter P xs else filter P xs)\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_suffix_one_fst_2
lemma Interleaves_suffix_one_fst_2 [rule_format]: assumes A: "P x []" shows "xs @ [x] \<cong> {ys @ [x], zs, P} \<longrightarrow> xs \<cong> {ys, zs, \<lambda>w ws. P w (ws @ [x])}" (is "_ \<longrightarrow> _ \<cong> {_, _, ?P'}")
?P ?x [] \<Longrightarrow> ?xs @ [?x] \<cong> {?ys @ [?x], ?zs, ?P} \<Longrightarrow> ?xs \<cong> {?ys, ?zs, \<lambda>w ws. ?P w (ws @ [?x])}
\<lbrakk>x_1 x_2 ?H1; ?H2 (?H3 x_3 (?H4 x_2 ?H1)) (?H3 x_4 (?H4 x_2 ?H1)) x_5 x_1\<rbrakk> \<Longrightarrow> ?H2 x_3 x_4 x_5 (\<lambda>y_0 y_1. x_1 y_0 (?H3 y_1 (?H4 x_2 ?H1)))
[ "Nat.Suc", "List.length", "List.list.Cons", "List.append", "List.list.Nil", "ListInterleaving.Interleaves_syntax" ]
[ "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_suffix_one_snd
lemma Interleaves_suffix_one_snd: "\<not> P x [] \<Longrightarrow> xs \<cong> {ys, zs, \<lambda>w ws. P w (ws @ [x])} = xs @ [x] \<cong> {ys, zs @ [x], P}"
\<not> ?P ?x [] \<Longrightarrow> ?xs \<cong> {?ys, ?zs, \<lambda>w ws. ?P w (ws @ [?x])} = ?xs @ [?x] \<cong> {?ys, ?zs @ [?x], ?P}
\<not> x_1 x_2 ?H1 \<Longrightarrow> ?H2 x_3 x_4 x_5 (\<lambda>y_0 y_1. x_1 y_0 (?H3 y_1 (?H4 x_2 ?H1))) = ?H2 (?H3 x_3 (?H4 x_2 ?H1)) x_4 (?H3 x_5 (?H4 x_2 ?H1)) x_1
[ "Hilbert_Choice.inv", "List.list.Cons", "List.append", "ListInterleaving.Interleaves_syntax", "List.drop", "ListInterleaving.interleaves_syntax", "List.list.Nil", "List.list.map" ]
[ "abbreviation inv :: \"('a \\<Rightarrow> 'b) \\<Rightarrow> ('b \\<Rightarrow> 'a)\" where\n\"inv \\<equiv> inv_into UNIV\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"", "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "abbreviation interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\" \n (\"(_ \\<simeq> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<simeq> {ys, zs, P} \\<equiv> interleaves P xs ys zs\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_suffix_one_fst
lemma Interleaves_suffix_one_fst: "P x [] \<Longrightarrow> xs \<cong> {ys, zs, \<lambda>w ws. P w (ws @ [x])} = xs @ [x] \<cong> {ys @ [x], zs, P}"
?P ?x [] \<Longrightarrow> ?xs \<cong> {?ys, ?zs, \<lambda>w ws. ?P w (ws @ [?x])} = ?xs @ [?x] \<cong> {?ys @ [?x], ?zs, ?P}
x_1 x_2 ?H1 \<Longrightarrow> ?H2 x_3 x_4 x_5 (\<lambda>y_0 y_1. x_1 y_0 (?H3 y_1 (?H4 x_2 ?H1))) = ?H2 (?H3 x_3 (?H4 x_2 ?H1)) (?H3 x_4 (?H4 x_2 ?H1)) x_5 x_1
[ "List.append", "List.list.Nil", "ListInterleaving.Interleaves_syntax", "List.list.Cons" ]
[ "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_all_nil_2
lemma Interleaves_all_nil_2 [rule_format]: "\<forall>n < length xs. P (xs ! n) (drop (Suc n) xs) \<Longrightarrow> xs \<cong> {xs, [], P}"
(\<And>n. n < length ?xs \<Longrightarrow> ?P (?xs ! n) (drop (Suc n) ?xs)) \<Longrightarrow> ?xs \<cong> {?xs, [], ?P}
(\<And>y_0. y_0 < ?H1 x_1 \<Longrightarrow> x_2 (?H2 x_1 y_0) (?H3 (?H4 y_0) x_1)) \<Longrightarrow> ?H5 x_1 x_1 ?H6 x_2
[ "List.list.Cons", "List.drop", "Nat.Suc", "List.length", "List.list.Nil", "List.nth", "ListInterleaving.interleaves_dom", "ListInterleaving.Interleaves_syntax" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_nil_all
lemma Interleaves_nil_all: "xs \<cong> {[], xs, P} = (\<forall>n < length xs. \<not> P (xs ! n) (drop (Suc n) xs))"
?xs \<cong> {[], ?xs, ?P} = (\<forall>n<length ?xs. \<not> ?P (?xs ! n) (drop (Suc n) ?xs))
?H1 x_1 ?H2 x_1 x_2 = (\<forall>y_0<?H3 x_1. \<not> x_2 (?H4 x_1 y_0) (?H5 (?H6 y_0) x_1))
[ "List.nth", "Nat.Suc", "List.list.Nil", "ListInterleaving.Interleaves_syntax", "List.length", "List.drop" ]
[ "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_all_nil_1
lemma Interleaves_all_nil_1 [rule_format]: "xs \<cong> {xs, [], P} \<longrightarrow> (\<forall>n < length xs. P (xs ! n) (drop (Suc n) xs))"
?xs \<cong> {?xs, [], ?P} \<Longrightarrow> ?n < length ?xs \<Longrightarrow> ?P (?xs ! ?n) (drop (Suc ?n) ?xs)
\<lbrakk>?H1 x_1 x_1 ?H2 x_2; x_3 < ?H3 x_1\<rbrakk> \<Longrightarrow> x_2 (?H4 x_1 x_3) (?H5 (?H6 x_3) x_1)
[ "Nat.Suc", "List.nth", "ListInterleaving.Interleaves_syntax", "List.drop", "List.length", "List.list.map", "List.list.Nil" ]
[ "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_all_nil
lemma Interleaves_all_nil: "xs \<cong> {xs, [], P} = (\<forall>n < length xs. P (xs ! n) (drop (Suc n) xs))"
?xs \<cong> {?xs, [], ?P} = (\<forall>n<length ?xs. ?P (?xs ! n) (drop (Suc n) ?xs))
?H1 x_1 x_1 ?H2 x_2 = (\<forall>y_0<?H3 x_1. x_2 (?H4 x_1 y_0) (?H5 (?H6 y_0) x_1))
[ "List.nth", "ListInterleaving.Interleaves_syntax", "List.list.Nil", "List.drop", "List.length", "Nat.Suc" ]
[ "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.interleaves_equal_fst
lemma interleaves_equal_fst [rule_format]: "xs \<simeq> {ys, zs, P} \<longrightarrow> xs \<simeq> {ys', zs, P} \<longrightarrow> ys = ys'"
?xs \<simeq> {?ys, ?zs, ?P} \<Longrightarrow> ?xs \<simeq> {?ys', ?zs, ?P} \<Longrightarrow> ?ys = ?ys'
\<lbrakk>?H1 x_1 x_2 x_3 x_4; ?H1 x_1 x_5 x_3 x_4\<rbrakk> \<Longrightarrow> x_2 = x_5
[ "List.list.Nil", "List.list.map", "Fun.inj", "ListInterleaving.interleaves_syntax" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation inj :: \"('a \\<Rightarrow> 'b) \\<Rightarrow> bool\"\n where \"inj f \\<equiv> inj_on f UNIV\"", "abbreviation interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\" \n (\"(_ \\<simeq> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<simeq> {ys, zs, P} \\<equiv> interleaves P xs ys zs\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.interleaves_equal_snd
lemma interleaves_equal_snd: "xs \<simeq> {ys, zs, P} \<Longrightarrow> xs \<simeq> {ys, zs', P} \<Longrightarrow> zs = zs'"
?xs \<simeq> {?ys, ?zs, ?P} \<Longrightarrow> ?xs \<simeq> {?ys, ?zs', ?P} \<Longrightarrow> ?zs = ?zs'
\<lbrakk>?H1 x_1 x_2 x_3 x_4; ?H1 x_1 x_2 x_5 x_4\<rbrakk> \<Longrightarrow> x_3 = x_5
[ "ListInterleaving.Interleaves_syntax", "List.list.Cons", "ListInterleaving.interleaves_syntax", "List.list.map" ]
[ "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\" \n (\"(_ \\<simeq> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<simeq> {ys, zs, P} \\<equiv> interleaves P xs ys zs\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_equal_fst
lemma Interleaves_equal_fst: "xs \<cong> {ys, zs, P} \<Longrightarrow> xs \<cong> {ys', zs, P} \<Longrightarrow> ys = ys'"
?xs \<cong> {?ys, ?zs, ?P} \<Longrightarrow> ?xs \<cong> {?ys', ?zs, ?P} \<Longrightarrow> ?ys = ?ys'
\<lbrakk>?H1 x_1 x_2 x_3 x_4; ?H1 x_1 x_5 x_3 x_4\<rbrakk> \<Longrightarrow> x_2 = x_5
[ "ListInterleaving.Interleaves_syntax", "List.nth" ]
[ "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_equal_snd
lemma Interleaves_equal_snd: "xs \<cong> {ys, zs, P} \<Longrightarrow> xs \<cong> {ys, zs', P} \<Longrightarrow> zs = zs'"
?xs \<cong> {?ys, ?zs, ?P} \<Longrightarrow> ?xs \<cong> {?ys, ?zs', ?P} \<Longrightarrow> ?zs = ?zs'
\<lbrakk>?H1 x_1 x_2 x_3 x_4; ?H1 x_1 x_2 x_5 x_4\<rbrakk> \<Longrightarrow> x_3 = x_5
[ "ListInterleaving.Interleaves_syntax", "List.length", "List.list.Nil", "Nat.Suc", "List.filter" ]
[ "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"", "primrec filter:: \"('a \\<Rightarrow> bool) \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n\"filter P [] = []\" |\n\"filter P (x # xs) = (if P x then x # filter P xs else filter P xs)\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.interleaves_swap
lemma interleaves_swap: "xs \<simeq> {ys, zs, P} = xs \<simeq> {zs, ys, \<lambda>w ws. \<not> P w ws}"
?xs \<simeq> {?ys, ?zs, ?P} = ?xs \<simeq> {?zs, ?ys, \<lambda>w ws. \<not> ?P w ws}
?H1 x_1 x_2 x_3 x_4 = ?H1 x_1 x_3 x_2 (\<lambda>y_0 y_1. \<not> x_4 y_0 y_1)
[ "ListInterleaving.interleaves_syntax", "List.nth", "Groups.plus_class.plus", "ListInterleaving.Interleaves_dom" ]
[ "abbreviation interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\" \n (\"(_ \\<simeq> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<simeq> {ys, zs, P} \\<equiv> interleaves P xs ys zs\"", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "class plus =\n fixes plus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"+\" 65)" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_swap
lemma Interleaves_swap: "xs \<cong> {ys, zs, P} = xs \<cong> {zs, ys, \<lambda>w ws. \<not> P w ws}"
?xs \<cong> {?ys, ?zs, ?P} = ?xs \<cong> {?zs, ?ys, \<lambda>w ws. \<not> ?P w ws}
?H1 x_1 x_2 x_3 x_4 = ?H1 x_1 x_3 x_2 (\<lambda>y_0 y_1. \<not> x_4 y_0 y_1)
[ "List.list.map", "ListInterleaving.Interleaves_syntax", "ListInterleaving.Interleaves_dom" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.interleaves_length
lemma interleaves_length [rule_format]: "xs \<simeq> {ys, zs, P} \<longrightarrow> length xs = length ys + length zs"
?xs \<simeq> {?ys, ?zs, ?P} \<Longrightarrow> length ?xs = length ?ys + length ?zs
?H1 x_1 x_2 x_3 x_4 \<Longrightarrow> ?H2 x_1 = ?H3 (?H2 x_2) (?H2 x_3)
[ "List.length", "ListInterleaving.Interleaves_dom", "ListInterleaving.interleaves_syntax", "Groups.plus_class.plus", "Nat.Suc" ]
[ "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "abbreviation interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\" \n (\"(_ \\<simeq> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<simeq> {ys, zs, P} \\<equiv> interleaves P xs ys zs\"", "class plus =\n fixes plus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"+\" 65)", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_length
lemma Interleaves_length: "xs \<cong> {ys, zs, P} \<Longrightarrow> length xs = length ys + length zs"
?xs \<cong> {?ys, ?zs, ?P} \<Longrightarrow> length ?xs = length ?ys + length ?zs
?H1 x_1 x_2 x_3 x_4 \<Longrightarrow> ?H2 x_1 = ?H3 (?H2 x_2) (?H2 x_3)
[ "Groups.plus_class.plus", "List.length", "Hilbert_Choice.inv", "ListInterleaving.Interleaves_syntax", "List.list.map" ]
[ "class plus =\n fixes plus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"+\" 65)", "abbreviation length :: \"'a list \\<Rightarrow> nat\" where\n\"length \\<equiv> size\"", "abbreviation inv :: \"('a \\<Rightarrow> 'b) \\<Rightarrow> ('b \\<Rightarrow> 'a)\" where\n\"inv \\<equiv> inv_into UNIV\"", "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_suffix_one_aux
lemma Interleaves_suffix_one_aux: assumes A: "P x []" shows "\<not> xs @ [x] \<cong> {[], zs, P}"
?P ?x [] \<Longrightarrow> \<not> ?xs @ [?x] \<cong> {[], ?zs, ?P}
x_1 x_2 ?H1 \<Longrightarrow> \<not> ?H2 (?H3 x_3 (?H4 x_2 ?H1)) ?H1 x_4 x_1
[ "List.list.Nil", "List.list.Cons", "ListInterleaving.Interleaves_syntax", "List.append" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.interleaves_nil
lemma interleaves_nil: "[] \<simeq> {ys, zs, P} \<Longrightarrow> ys = [] \<and> zs = []"
[] \<simeq> {?ys, ?zs, ?P} \<Longrightarrow> ?ys = [] \<and> ?zs = []
?H1 ?H2 x_1 x_2 x_3 \<Longrightarrow> x_1 = ?H2 \<and> x_2 = ?H2
[ "List.list.Cons", "List.append", "List.list.Nil", "ListInterleaving.interleaves_syntax", "List.drop", "Groups.plus_class.plus" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "primrec append :: \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" (infixr \"@\" 65) where\nappend_Nil: \"[] @ ys = ys\" |\nappend_Cons: \"(x#xs) @ ys = x # xs @ ys\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\" \n (\"(_ \\<simeq> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<simeq> {ys, zs, P} \\<equiv> interleaves P xs ys zs\"", "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "class plus =\n fixes plus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"+\" 65)" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_nil
lemma Interleaves_nil: "[] \<cong> {ys, zs, P} \<Longrightarrow> ys = [] \<and> zs = []"
[] \<cong> {?ys, ?zs, ?P} \<Longrightarrow> ?ys = [] \<and> ?zs = []
?H1 ?H2 x_1 x_2 x_3 \<Longrightarrow> x_1 = ?H2 \<and> x_2 = ?H2
[ "ListInterleaving.interleaves_dom", "ListInterleaving.Interleaves_syntax", "List.drop", "List.list.Cons", "List.list.Nil" ]
[ "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_interleaves
lemma Interleaves_interleaves [rule_format]: "xs \<cong> {ys, zs, P} \<longrightarrow> xs \<simeq> {ys, zs, P}"
?xs \<cong> {?ys, ?zs, ?P} \<Longrightarrow> ?xs \<simeq> {?ys, ?zs, ?P}
?H1 x_1 x_2 x_3 x_4 \<Longrightarrow> ?H2 x_1 x_2 x_3 x_4
[ "List.list.Cons", "List.list.map", "ListInterleaving.Interleaves_syntax", "Fun.inj", "ListInterleaving.interleaves_syntax" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "abbreviation inj :: \"('a \\<Rightarrow> 'b) \\<Rightarrow> bool\"\n where \"inj f \\<equiv> inj_on f UNIV\"", "abbreviation interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\" \n (\"(_ \\<simeq> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<simeq> {ys, zs, P} \\<equiv> interleaves P xs ys zs\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.interleaves_equal_all_nil
lemma interleaves_equal_all_nil: "xs \<simeq> {ys, [], P} \<Longrightarrow> xs = ys"
?xs \<simeq> {?ys, [], ?P} \<Longrightarrow> ?xs = ?ys
?H1 x_1 x_2 ?H2 x_3 \<Longrightarrow> x_1 = x_2
[ "ListInterleaving.interleaves_syntax", "List.list.Nil" ]
[ "abbreviation interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\" \n (\"(_ \\<simeq> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<simeq> {ys, zs, P} \\<equiv> interleaves P xs ys zs\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.interleaves_equal_nil_all
lemma interleaves_equal_nil_all: "xs \<simeq> {[], zs, P} \<Longrightarrow> xs = zs"
?xs \<simeq> {[], ?zs, ?P} \<Longrightarrow> ?xs = ?zs
?H1 x_1 ?H2 x_2 x_3 \<Longrightarrow> x_1 = x_2
[ "List.list.Nil", "ListInterleaving.interleaves_dom", "Fun.inj", "List.nth", "ListInterleaving.interleaves_syntax", "ListInterleaving.Interleaves_syntax" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation inj :: \"('a \\<Rightarrow> 'b) \\<Rightarrow> bool\"\n where \"inj f \\<equiv> inj_on f UNIV\"", "primrec (nonexhaustive) nth :: \"'a list => nat => 'a\" (infixl \"!\" 100) where\nnth_Cons: \"(x # xs) ! n = (case n of 0 \\<Rightarrow> x | Suc k \\<Rightarrow> xs ! k)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "abbreviation interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\" \n (\"(_ \\<simeq> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<simeq> {ys, zs, P} \\<equiv> interleaves P xs ys zs\"", "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_equal_all_nil
lemma Interleaves_equal_all_nil: "xs \<cong> {ys, [], P} \<Longrightarrow> xs = ys"
?xs \<cong> {?ys, [], ?P} \<Longrightarrow> ?xs = ?ys
?H1 x_1 x_2 ?H2 x_3 \<Longrightarrow> x_1 = x_2
[ "List.list.map", "ListInterleaving.Interleaves_syntax", "List.list.Nil", "List.list.Cons" ]
[ "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.Interleaves_equal_nil_all
lemma Interleaves_equal_nil_all: "xs \<cong> {[], zs, P} \<Longrightarrow> xs = zs"
?xs \<cong> {[], ?zs, ?P} \<Longrightarrow> ?xs = ?zs
?H1 x_1 ?H2 x_2 x_3 \<Longrightarrow> x_1 = x_2
[ "List.drop", "List.filter", "ListInterleaving.Interleaves_dom", "List.list.Nil", "ListInterleaving.interleaves_dom", "ListInterleaving.Interleaves_syntax" ]
[ "primrec drop:: \"nat \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\ndrop_Nil: \"drop n [] = []\" |\ndrop_Cons: \"drop n (x # xs) = (case n of 0 \\<Rightarrow> x # xs | Suc m \\<Rightarrow> drop m xs)\"\n \\<comment> \\<open>Warning: simpset does not contain this definition, but separate\n theorems for \\<open>n = 0\\<close> and \\<open>n = Suc k\\<close>\\<close>", "primrec filter:: \"('a \\<Rightarrow> bool) \\<Rightarrow> 'a list \\<Rightarrow> 'a list\" where\n\"filter P [] = []\" |\n\"filter P (x # xs) = (if P x then x # filter P xs else filter P xs)\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation Interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\"\n (\"(_ \\<cong> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<cong> {ys, zs, P} \\<equiv> Interleaves P xs ys zs\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.interleaves_all_nil
lemma interleaves_all_nil: "xs \<simeq> {xs, [], P}"
?xs \<simeq> {?xs, [], ?P}
?H1 x_1 x_1 ?H2 x_2
[ "Groups.plus_class.plus", "List.list.Nil", "ListInterleaving.interleaves_syntax" ]
[ "class plus =\n fixes plus :: \"'a \\<Rightarrow> 'a \\<Rightarrow> 'a\" (infixl \"+\" 65)", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"", "abbreviation interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\" \n (\"(_ \\<simeq> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<simeq> {ys, zs, P} \\<equiv> interleaves P xs ys zs\"" ]
List_Interleaving/ListInterleaving
ListInterleaving.interleaves_nil_all
lemma interleaves_nil_all: "xs \<simeq> {[], xs, P}"
?xs \<simeq> {[], ?xs, ?P}
?H1 x_1 ?H2 x_1 x_2
[ "ListInterleaving.interleaves_syntax", "List.list.Nil" ]
[ "abbreviation interleaves_syntax ::\n \"'a list \\<Rightarrow> 'a list \\<Rightarrow> 'a list \\<Rightarrow> ('a \\<Rightarrow> 'a list \\<Rightarrow> bool) \\<Rightarrow> bool\" \n (\"(_ \\<simeq> {_, _, _})\" [60, 60, 60] 51)\n where \"xs \\<simeq> {ys, zs, P} \\<equiv> interleaves P xs ys zs\"", "datatype (set: 'a) list =\n Nil (\"[]\")\n | Cons (hd: 'a) (tl: \"'a list\") (infixr \"#\" 65)\nfor\n map: map\n rel: list_all2\n pred: list_all\nwhere\n \"tl [] = []\"" ]
Stream-Fusion/StreamFusion
StreamFusion.unfold_zipWithStep
lemma unfold_zipWithStep: fixes f :: "'a \<rightarrow> 'b \<rightarrow> 'c" fixes ha :: "'s \<rightarrow> ('a, 's) Step" fixes hb :: "'t \<rightarrow> ('b, 't) Step" defines h_def: "h \<equiv> zipWithStep\<cdot>f\<cdot>ha\<cdot>hb" shows "(\<forall>sa sb. sa \<noteq> \<bottom> \<longrightarrow> sb \<noteq> \<bottom> \<longrightarrow> unfold\<cdot>h\<cdot>(sa :!: sb :!: Nothing) = zipWithL\<cdot>f\<cdot>(unfold\<cdot>ha\<cdot>sa)\<cdot>(unfold\<cdot>hb\<cdot>sb)) \<and> (\<forall>sa sb a. sa \<noteq> \<bottom> \<longrightarrow> sb \<noteq> \<bottom> \<longrightarrow> unfold\<cdot>h\<cdot>(sa :!: sb :!: Just\<cdot>(L\<cdot>a)) = zipWithL\<cdot>f\<cdot>(LCons\<cdot>a\<cdot>(unfold\<cdot>ha\<cdot>sa))\<cdot>(unfold\<cdot>hb\<cdot>sb))"
(\<forall>sa sb. sa \<noteq> \<bottom> \<longrightarrow> sb \<noteq> \<bottom> \<longrightarrow> unfold\<cdot>(zipWithStep\<cdot>?f\<cdot>?ha\<cdot>?hb)\<cdot>(sa :!: sb :!: Nothing) = zipWithL\<cdot>?f\<cdot>(unfold\<cdot>?ha\<cdot>sa)\<cdot>(unfold\<cdot>?hb\<cdot>sb)) \<and> (\<forall>sa sb a. sa \<noteq> \<bottom> \<longrightarrow> sb \<noteq> \<bottom> \<longrightarrow> unfold\<cdot>(zipWithStep\<cdot>?f\<cdot>?ha\<cdot>?hb)\<cdot>(sa :!: sb :!: Just\<cdot>(L\<cdot>a)) = zipWithL\<cdot>?f\<cdot>(LCons\<cdot>a\<cdot>(unfold\<cdot>?ha\<cdot>sa))\<cdot>(unfold\<cdot>?hb\<cdot>sb))
(\<forall>y_0 y_1. y_0 \<noteq> ?H1 \<longrightarrow> y_1 \<noteq> ?H2 \<longrightarrow> ?H3 (?H4 ?H5 (?H6 (?H7 (?H8 ?H9 x_1) x_2) x_3)) (?H10 (?H11 ?H12 (?H13 (?H14 ?H15 y_0) y_1)) ?H16) = ?H17 (?H18 (?H19 ?H20 x_1) (?H21 (?H22 ?H23 x_2) y_0)) (?H24 (?H25 ?H26 x_3) y_1)) \<and> (\<forall>y_2 y_3 y_4. y_2 \<noteq> ?H1 \<longrightarrow> y_3 \<noteq> ?H2 \<longrightarrow> ?H3 (?H4 ?H5 (?H6 (?H7 (?H8 ?H9 x_1) x_2) x_3)) (?H10 (?H11 ?H12 (?H13 (?H14 ?H15 y_2) y_3)) (?H27 ?H28 (?H29 ?H30 y_4))) = ?H17 (?H18 (?H19 ?H20 x_1) (?H31 (?H32 ?H33 y_4) (?H21 (?H22 ?H23 x_2) y_2))) (?H24 (?H25 ?H26 x_3) y_3))
[ "StreamFusion.Maybe.Nothing", "StreamFusion.Maybe.Just", "LazyList.LList.LCons", "StreamFusion.L.L", "LazyList.zipWithL", "StreamFusion.Both.Both", "StreamFusion.zipWithStep", "StreamFusion.enumFromToS", "StreamFusion.L_defl", "Pcpo.pcpo_class.bottom", "Stream.unfold", "Cfun.cfun.Rep_cfun" ]
[ "class pcpo = cpo +\n assumes least: \"\\<exists>x. \\<forall>y. x \\<sqsubseteq> y\"\nbegin" ]
Stream-Fusion/StreamFusion
StreamFusion.zipWithS_fix_ind
lemma zipWithS_fix_ind: assumes x: "x = fix\<cdot>f" and y: "y = fix\<cdot>g" assumes adm_P: "adm (\<lambda>x. P (fst x) (snd x))" assumes adm_Q: "adm (\<lambda>x. Q (fst x) (snd x))" assumes P_0: "\<And>b. P \<bottom> b" and P_Suc: "\<And>a b. P a b \<Longrightarrow> Q a b \<Longrightarrow> P (f\<cdot>a) b" assumes Q_0: "\<And>a. Q a \<bottom>" and Q_Suc: "\<And>a b. P a b \<Longrightarrow> Q a b \<Longrightarrow> Q a (g\<cdot>b)" shows "P x y \<and> Q x y"
?x = fix\<cdot>?f \<Longrightarrow> ?y = fix\<cdot>?g \<Longrightarrow> adm (\<lambda>x. ?P (fst x) (snd x)) \<Longrightarrow> adm (\<lambda>x. ?Q (fst x) (snd x)) \<Longrightarrow> (\<And>b. ?P \<bottom> b) \<Longrightarrow> (\<And>a b. ?P a b \<Longrightarrow> ?Q a b \<Longrightarrow> ?P (?f\<cdot>a) b) \<Longrightarrow> (\<And>a. ?Q a \<bottom>) \<Longrightarrow> (\<And>a b. ?P a b \<Longrightarrow> ?Q a b \<Longrightarrow> ?Q a (?g\<cdot>b)) \<Longrightarrow> ?P ?x ?y \<and> ?Q ?x ?y
\<lbrakk>x_1 = ?H1 ?H2 x_2; x_3 = ?H3 ?H4 x_4; ?H5 (\<lambda>y_0. x_5 (?H6 y_0) (?H7 y_0)); ?H5 (\<lambda>y_1. x_6 (?H6 y_1) (?H7 y_1)); \<And>y_2. x_5 ?H8 y_2; \<And>y_3 y_4. \<lbrakk>x_5 y_3 y_4; x_6 y_3 y_4\<rbrakk> \<Longrightarrow> x_5 (?H9 x_2 y_3) y_4; \<And>y_5. x_6 y_5 ?H10; \<And>y_6 y_7. \<lbrakk>x_5 y_6 y_7; x_6 y_6 y_7\<rbrakk> \<Longrightarrow> x_6 y_6 (?H11 x_4 y_7)\<rbrakk> \<Longrightarrow> x_5 x_1 x_3 \<and> x_6 x_1 x_3
[ "Pcpo.pcpo_class.bottom", "Adm.adm", "StreamFusion.Maybe.match_Just", "Product_Type.prod.fst", "Stream.Step.Yield", "Fix.fix", "Cfun.cfun.Rep_cfun", "Tr.cifte_syn", "Product_Type.prod.snd", "StreamFusion.Either.Left" ]
[ "class pcpo = cpo +\n assumes least: \"\\<exists>x. \\<forall>y. x \\<sqsubseteq> y\"\nbegin", "definition adm :: \"('a::cpo \\<Rightarrow> bool) \\<Rightarrow> bool\"\n where \"adm P \\<longleftrightarrow> (\\<forall>Y. chain Y \\<longrightarrow> (\\<forall>i. P (Y i)) \\<longrightarrow> P (\\<Squnion>i. Y i))\"", "definition \"prod = {f. \\<exists>a b. f = Pair_Rep (a::'a) (b::'b)}\"", "definition \"fix\" :: \"('a \\<rightarrow> 'a) \\<rightarrow> 'a\"\n where \"fix = (\\<Lambda> F. \\<Squnion>i. iterate i\\<cdot>F\\<cdot>\\<bottom>)\"", "abbreviation cifte_syn :: \"[tr, 'c, 'c] \\<Rightarrow> 'c\" (\"(If (_)/ then (_)/ else (_))\" [0, 0, 60] 60)\n where \"If b then e1 else e2 \\<equiv> tr_case\\<cdot>e1\\<cdot>e2\\<cdot>b\"", "definition \"prod = {f. \\<exists>a b. f = Pair_Rep (a::'a) (b::'b)}\"" ]
Stream-Fusion/StreamFusion
StreamFusion.unfold_concatMapStep
lemma unfold_concatMapStep: fixes ha :: "'s \<rightarrow> ('a, 's) Step" fixes f :: "'a \<rightarrow> ('b, 't) Stream" defines h_def: "h \<equiv> concatMapStep\<cdot>f\<cdot>ha" defines f'_def: "f' \<equiv> unstream oo f" shows "(\<forall>sa. sa \<noteq> \<bottom> \<longrightarrow> unfold\<cdot>h\<cdot>(sa :!: Nothing) = concatMapL\<cdot>f'\<cdot>(unfold\<cdot>ha\<cdot>sa)) \<and> (\<forall>sa hb sb. sa \<noteq> \<bottom> \<longrightarrow> sb \<noteq> \<bottom> \<longrightarrow> unfold\<cdot>h\<cdot>(sa :!: Just\<cdot>(Stream\<cdot>hb\<cdot>sb)) = appendL\<cdot>(unfold\<cdot>hb\<cdot>sb)\<cdot>(concatMapL\<cdot>f'\<cdot>(unfold\<cdot>ha\<cdot>sa)))"
(\<forall>sa. sa \<noteq> \<bottom> \<longrightarrow> unfold\<cdot>(concatMapStep\<cdot>?f\<cdot>?ha)\<cdot>(sa :!: Nothing) = concatMapL\<cdot>(unstream oo ?f)\<cdot>(unfold\<cdot>?ha\<cdot>sa)) \<and> (\<forall>sa hb sb. sa \<noteq> \<bottom> \<longrightarrow> sb \<noteq> \<bottom> \<longrightarrow> unfold\<cdot>(concatMapStep\<cdot>?f\<cdot>?ha)\<cdot>(sa :!: Just\<cdot>(Stream\<cdot>hb\<cdot>sb)) = appendL\<cdot>(unfold\<cdot>hb\<cdot>sb)\<cdot> (concatMapL\<cdot>(unstream oo ?f)\<cdot>(unfold\<cdot>?ha\<cdot>sa)))
(\<forall>y_0. y_0 \<noteq> ?H1 \<longrightarrow> ?H2 (?H3 ?H4 (?H5 (?H6 ?H7 x_1) x_2)) (?H8 (?H9 ?H10 y_0) ?H11) = ?H12 (?H13 ?H14 (?H15 ?H16 x_1)) (?H17 (?H18 ?H19 x_2) y_0)) \<and> (\<forall>y_1 y_2 y_3. y_1 \<noteq> ?H1 \<longrightarrow> y_3 \<noteq> ?H20 \<longrightarrow> ?H2 (?H3 ?H4 (?H5 (?H6 ?H7 x_1) x_2)) (?H8 (?H9 ?H10 y_1) (?H21 ?H22 (?H23 (?H24 ?H25 y_2) y_3))) = ?H26 (?H27 ?H28 (?H29 (?H30 ?H31 y_2) y_3)) (?H12 (?H13 ?H14 (?H15 ?H16 x_1)) (?H17 (?H18 ?H19 x_2) y_1)))
[ "StreamFusion.Maybe.Just", "Cfun.cfun.Rep_cfun", "StreamFusion.Maybe.Nothing", "Stream.unstream", "StreamFusion.zipWithS", "Stream.unfold", "StreamFusion.Both.Both", "StreamFusion.concatMapStep", "Pcpo.pcpo_class.bottom", "LazyList.concatMapL", "LazyList.appendL", "Cfun.cfcomp_syn", "Stream.Stream.Stream" ]
[ "class pcpo = cpo +\n assumes least: \"\\<exists>x. \\<forall>y. x \\<sqsubseteq> y\"\nbegin", "abbreviation cfcomp_syn :: \"['b \\<rightarrow> 'c, 'a \\<rightarrow> 'b] \\<Rightarrow> 'a \\<rightarrow> 'c\" (infixr \"oo\" 100)\n where \"f oo g == cfcomp\\<cdot>f\\<cdot>g\"" ]
Stream-Fusion/StreamFusion
StreamFusion.unfold_appendStep
lemma unfold_appendStep: fixes ha :: "'s \<rightarrow> ('a, 's) Step" fixes hb :: "'t \<rightarrow> ('a, 't) Step" assumes sb0 [simp]: "sb0 \<noteq> \<bottom>" shows "(\<forall>sa. sa \<noteq> \<bottom> \<longrightarrow> unfold\<cdot>(appendStep\<cdot>ha\<cdot>hb\<cdot>sb0)\<cdot>(Left\<cdot>sa) = appendL\<cdot>(unfold\<cdot>ha\<cdot>sa)\<cdot>(unfold\<cdot>hb\<cdot>sb0)) \<and> (\<forall>sb. sb \<noteq> \<bottom> \<longrightarrow> unfold\<cdot>(appendStep\<cdot>ha\<cdot>hb\<cdot>sb0)\<cdot>(Right\<cdot>sb) = unfold\<cdot>hb\<cdot>sb)"
?sb0.0 \<noteq> \<bottom> \<Longrightarrow> (\<forall>sa. sa \<noteq> \<bottom> \<longrightarrow> unfold\<cdot>(appendStep\<cdot>?ha\<cdot>?hb\<cdot>?sb0.0)\<cdot>(Either.Left\<cdot>sa) = appendL\<cdot>(unfold\<cdot>?ha\<cdot>sa)\<cdot>(unfold\<cdot>?hb\<cdot>?sb0.0)) \<and> (\<forall>sb. sb \<noteq> \<bottom> \<longrightarrow> unfold\<cdot>(appendStep\<cdot>?ha\<cdot>?hb\<cdot>?sb0.0)\<cdot>(Either.Right\<cdot>sb) = unfold\<cdot>?hb\<cdot>sb)
x_1 \<noteq> ?H1 \<Longrightarrow> (\<forall>y_0. y_0 \<noteq> ?H2 \<longrightarrow> ?H3 (?H4 ?H5 (?H6 (?H7 (?H8 ?H9 x_2) x_3) x_1)) (?H10 ?H11 y_0) = ?H12 (?H13 ?H14 (?H15 (?H16 ?H17 x_2) y_0)) (?H18 (?H19 ?H20 x_3) x_1)) \<and> (\<forall>y_1. y_1 \<noteq> ?H1 \<longrightarrow> ?H3 (?H4 ?H5 (?H6 (?H7 (?H8 ?H9 x_2) x_3) x_1)) (?H21 ?H22 y_1) = ?H18 (?H19 ?H20 x_3) y_1)
[ "LazyList.appendL", "Cfun.cfun.Rep_cfun", "Product_Type.prod.snd", "StreamFusion.Either.Left", "Pcpo.pcpo_class.bottom", "StreamFusion.appendStep", "Stream.unfold", "StreamFusion.L.match_L", "StreamFusion.Either.Right", "StreamFusion.Either.is_Right", "StreamFusion.Maybe_finite" ]
[ "definition \"prod = {f. \\<exists>a b. f = Pair_Rep (a::'a) (b::'b)}\"", "class pcpo = cpo +\n assumes least: \"\\<exists>x. \\<forall>y. x \\<sqsubseteq> y\"\nbegin" ]
Stream-Fusion/StreamFusion
StreamFusion.zipWithS_fix_ind_lemma
lemma zipWithS_fix_ind_lemma: fixes P Q :: "nat \<Rightarrow> nat \<Rightarrow> bool" assumes P_0: "\<And>j. P 0 j" and P_Suc: "\<And>i j. P i j \<Longrightarrow> Q i j \<Longrightarrow> P (Suc i) j" assumes Q_0: "\<And>i. Q i 0" and Q_Suc: "\<And>i j. P i j \<Longrightarrow> Q i j \<Longrightarrow> Q i (Suc j)" shows "P i j \<and> Q i j"
(\<And>j. ?P 0 j) \<Longrightarrow> (\<And>i j. ?P i j \<Longrightarrow> ?Q i j \<Longrightarrow> ?P (Suc i) j) \<Longrightarrow> (\<And>i. ?Q i 0) \<Longrightarrow> (\<And>i j. ?P i j \<Longrightarrow> ?Q i j \<Longrightarrow> ?Q i (Suc j)) \<Longrightarrow> ?P ?i ?j \<and> ?Q ?i ?j
\<lbrakk>\<And>y_0. x_1 ?H1 y_0; \<And>y_1 y_2. \<lbrakk>x_1 y_1 y_2; x_2 y_1 y_2\<rbrakk> \<Longrightarrow> x_1 (?H2 y_1) y_2; \<And>y_3. x_2 y_3 ?H1; \<And>y_4 y_5. \<lbrakk>x_1 y_4 y_5; x_2 y_4 y_5\<rbrakk> \<Longrightarrow> x_2 y_4 (?H2 y_5)\<rbrakk> \<Longrightarrow> x_1 x_3 x_4 \<and> x_2 x_3 x_4
[ "Groups.zero_class.zero", "Nat.Suc" ]
[ "class zero =\n fixes zero :: 'a (\"0\")", "definition Suc :: \"nat \\<Rightarrow> nat\"\n where \"Suc n = Abs_Nat (Suc_Rep (Rep_Nat n))\"" ]
Stream-Fusion/StreamFusion
StreamFusion.foldrS_Stream
null
?s \<noteq> \<bottom> \<Longrightarrow> foldrS\<cdot>?f\<cdot>?z\<cdot>(Stream\<cdot>?h\<cdot>?s) = (case ?h\<cdot>?s of Done \<Rightarrow> ?z | Skip\<cdot>s' \<Rightarrow> foldrS\<cdot>?f\<cdot>?z\<cdot>(Stream\<cdot>?h\<cdot>s') | Yield\<cdot>x\<cdot>s' \<Rightarrow> ?f\<cdot>x\<cdot>(foldrS\<cdot>?f\<cdot>?z\<cdot>(Stream\<cdot>?h\<cdot>s')))
x_1 \<noteq> ?H1 \<Longrightarrow> ?H2 (?H3 (?H4 ?H5 x_2) x_3) (?H6 (?H7 ?H8 x_4) x_1) = ?H9 (?H10 (?H11 (?H12 ?H13 x_3) (?H14 (\<lambda>y_0. ?H2 (?H3 (?H4 ?H5 x_2) x_3) (?H6 (?H7 ?H8 x_4) y_0)))) (?H15 (\<lambda>y_1. ?H14 (\<lambda>y_2. ?H16 (?H17 x_2 y_1) (?H2 (?H3 (?H4 ?H5 x_2) x_3) (?H6 (?H7 ?H8 x_4) y_2)))))) (?H18 x_4 x_1)
[ "Cfun.cfun.Abs_cfun", "Stream.Step.Step_case", "Cfun.cfun.Rep_cfun", "StreamFusion.foldrS", "Pcpo.pcpo_class.bottom", "Stream.Stream.Stream" ]
[ "class pcpo = cpo +\n assumes least: \"\\<exists>x. \\<forall>y. x \\<sqsubseteq> y\"\nbegin" ]
Stream-Fusion/StreamFusion
StreamFusion.concatMapS_cong
lemma concatMapS_cong: fixes f :: "'a \<Rightarrow> ('b, 's) Stream" fixes g :: "'a \<Rightarrow> ('b, 't) Stream" fixes a :: "('a, 'u) Stream" fixes b :: "('a, 'v) Stream" shows "(\<And>x. f x \<approx> g x) \<Longrightarrow> a \<approx> b \<Longrightarrow> cont f \<Longrightarrow> cont g \<Longrightarrow> concatMapS\<cdot>(\<Lambda> x. f x)\<cdot>a \<approx> concatMapS\<cdot>(\<Lambda> x. g x)\<cdot>b"
(\<And>x. ?f x \<approx> ?g x) \<Longrightarrow> ?a \<approx> ?b \<Longrightarrow> cont ?f \<Longrightarrow> cont ?g \<Longrightarrow> concatMapS\<cdot>(\<Lambda> x. ?f x)\<cdot>?a \<approx> concatMapS\<cdot>(\<Lambda> x. ?g x)\<cdot>?b
\<lbrakk>\<And>y_0. ?H1 (x_1 y_0) (x_2 y_0); ?H2 x_3 x_4; ?H3 x_1; ?H4 x_2\<rbrakk> \<Longrightarrow> ?H5 (?H6 (?H7 ?H8 (?H9 x_1)) x_3) (?H10 (?H11 ?H12 (?H13 x_2)) x_4)
[ "StreamFusion.Switch.Switch_case", "Cfun.cfun.Rep_cfun", "LazyList.enumFromToL", "Cont.cont", "Cfun.cfun.Abs_cfun", "StreamFusion.concatMapS", "StreamFusion.filterS", "Stream.bisimilar", "StreamFusion.Switch_bisim" ]
[ "definition cont :: \"('a::cpo \\<Rightarrow> 'b::cpo) \\<Rightarrow> bool\"\n where \"cont f = (\\<forall>Y. chain Y \\<longrightarrow> range (\\<lambda>i. f (Y i)) <<| f (\\<Squnion>i. Y i))\"", "definition\n bisimilar :: \"('a, 's) Stream \\<Rightarrow> ('a, 't) Stream \\<Rightarrow> bool\" (infix \"\\<approx>\" 50)\nwhere\n \"a \\<approx> b \\<longleftrightarrow> unstream\\<cdot>a = unstream\\<cdot>b \\<and> a \\<noteq> \\<bottom> \\<and> b \\<noteq> \\<bottom>\"" ]
Stream-Fusion/StreamFusion
StreamFusion.unstream_zipWithS
lemma unstream_zipWithS: "a \<noteq> \<bottom> \<Longrightarrow> b \<noteq> \<bottom> \<Longrightarrow> unstream\<cdot>(zipWithS\<cdot>f\<cdot>a\<cdot>b) = zipWithL\<cdot>f\<cdot>(unstream\<cdot>a)\<cdot>(unstream\<cdot>b)"
?a \<noteq> \<bottom> \<Longrightarrow> ?b \<noteq> \<bottom> \<Longrightarrow> unstream\<cdot>(zipWithS\<cdot>?f\<cdot>?a\<cdot>?b) = zipWithL\<cdot>?f\<cdot>(unstream\<cdot>?a)\<cdot>(unstream\<cdot>?b)
\<lbrakk>x_1 \<noteq> ?H1; x_2 \<noteq> ?H2\<rbrakk> \<Longrightarrow> ?H3 ?H4 (?H5 (?H6 (?H7 ?H8 x_3) x_1) x_2) = ?H9 (?H10 (?H11 ?H12 x_3) (?H13 ?H14 x_1)) (?H15 ?H16 x_2)
[ "Stream.unstream", "StreamFusion.Both_rep", "Cfun.cfun.Rep_cfun", "Fix.fix", "Product_Type.prod.snd", "LazyList.zipWithL", "Pcpo.pcpo_class.bottom", "StreamFusion.zipWithS" ]
[ "definition \"fix\" :: \"('a \\<rightarrow> 'a) \\<rightarrow> 'a\"\n where \"fix = (\\<Lambda> F. \\<Squnion>i. iterate i\\<cdot>F\\<cdot>\\<bottom>)\"", "definition \"prod = {f. \\<exists>a b. f = Pair_Rep (a::'a) (b::'b)}\"", "class pcpo = cpo +\n assumes least: \"\\<exists>x. \\<forall>y. x \\<sqsubseteq> y\"\nbegin" ]