The wellordering instantiation for length-ordered lists
authorpaulson <lp15@cam.ac.uk>
Tue, 02 Aug 2022 12:19:05 +0100
changeset 75716 f6695e7aff32
parent 75714 1635ee32e6d8
child 75717 b93ed38cef85
The wellordering instantiation for length-ordered lists
src/HOL/Library/List_Lenlexorder.thy
--- a/src/HOL/Library/List_Lenlexorder.thy	Fri Jul 29 08:45:51 2022 +0200
+++ b/src/HOL/Library/List_Lenlexorder.thy	Tue Aug 02 12:19:05 2022 +0100
@@ -3,6 +3,8 @@
 
 section \<open>Lexicographic order on lists\<close>
 
+text \<open>This version prioritises length and can yield wellorderings\<close>
+
 theory List_Lenlexorder
 imports Main
 begin
@@ -51,6 +53,14 @@
     by (auto simp add: total_on_def list_le_def list_less_def)
 qed
 
+instance list :: (wellorder) wellorder
+proof
+  fix P :: "'a list \<Rightarrow> bool" and a
+  assume "\<And>x. (\<And>y. y < x \<Longrightarrow> P y) \<Longrightarrow> P x" 
+  then show "P a"
+    unfolding list_less_def by (metis wf_lenlex wf_induct wf_lenlex wf)
+qed
+
 instantiation list :: (linorder) distrib_lattice
 begin