(*********************************************************************************** * Copyright (c) 2025 Université Paris-Saclay * * Author: Benoît Ballenghien, Université Paris-Saclay, CNRS, ENS Paris-Saclay, LMF * Author: Benjamin Puyobro, Université Paris-Saclay, IRT SystemX, CNRS, ENS Paris-Saclay, LMF * Author: Burkhart Wolff, Université Paris-Saclay, CNRS, ENS Paris-Saclay, LMF * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * SPDX-License-Identifier: BSD-2-Clause ***********************************************************************************) section ‹Lists› (*<*) theory RS_List imports Restriction_Spaces "HOL-Library.Prefix_Order" begin (*>*) text ‹List is a restriction space using \<^const>‹take› as the restriction function› instantiation list :: (type) restriction begin definition restriction_list :: ‹'a list ⇒ nat ⇒ 'a list› where ‹L ↓ n ≡ take n L› instance by intro_classes (simp add: restriction_list_def min.commute) end instance list :: (type) order_restriction_space proof intro_classes show ‹L ↓ 0 ≤ M ↓ 0› for L M :: ‹'a list› by (simp add: restriction_list_def) next show ‹L ≤ M ⟹ L ↓ n ≤ M ↓ n› for L M :: ‹'a list› and n unfolding restriction_list_def by (metis less_eq_list_def prefix_def take_append) next show ‹¬ L ≤ M ⟹ ∃n. ¬ L ↓ n ≤ M ↓ n› for M L :: ‹'a list› unfolding restriction_list_def by (metis linorder_linear take_all_iff) qed lemma ‹OFCLASS('a list, restriction_space_class)› .. text ‹Of course, this space is not complete. We prove this with by exhibiting a counter-example.› notepad begin define σ :: ‹nat ⇒ 'a list› where ‹σ n = replicate n undefined› for n have ‹chain⇩↓ σ› by (intro restriction_chainI ext) (simp add: σ_def restriction_list_def flip: replicate_append_same) hence ‹∄Σ. σ ─↓→ Σ› by (metis σ_def convergent_restriction_chain_imp_ex1 length_replicate lessI nat_less_le restriction_convergentI restriction_list_def take_all) end (*<*) end (*>*)