mathlib documentation


Palindromes #

This module defines palindromes, lists which are equal to their reverse.

The main result is the palindrome inductive type, and its associated palindrome.rec_on induction principle. Also provided are conversions to and from other equivalent definitions.

References #

Tags #

palindrome, reverse, induction

inductive list.palindrome {α : Type u_1} :
list α → Prop

palindrome l asserts that l is a palindrome. This is defined inductively:

  • The empty list is a palindrome;
  • A list with one element is a palindrome;
  • Adding the same element to both ends of a palindrome results in a bigger palindrome.
Instances for list.palindrome
theorem list.palindrome.reverse_eq {α : Type u_1} {l : list α} (p : l.palindrome) :
theorem list.palindrome.of_reverse_eq {α : Type u_1} {l : list α} :
l.reverse = l → l.palindrome
theorem list.palindrome.iff_reverse_eq {α : Type u_1} {l : list α} :
theorem list.palindrome.append_reverse {α : Type u_1} (l : list α) :
theorem {α : Type u_1} {β : Type u_2} {l : list α} (f : α → β) (p : l.palindrome) :