Cookies disclaimer

I agree Our site saves small pieces of text information (cookies) on your device in order to deliver better content and for statistical purposes. You can disable the usage of cookies by changing the settings of your browser. By browsing our website without changing the browser settings you grant us permission to store that information on your device.

Triple Rev

Is there a function rev of type "nat list => nat list" that applied thrice on a list of nats returns the original list again.

i.e. find a function rev and prove the following lemma:

rev (rev (rev xs)) = xs

Making sure you do not use the identity function, if your input is longer than 1.

length xs >= 2 ==> rev xs ~= xs

Resources

Download Files

Definitions File

theory Defs
  imports Main
begin  
  
end

Template File

theory Submission
  imports Defs
begin

lemma showmewhatyougot: "\<exists>f::(nat list \<Rightarrow> nat list). (\<forall> xs. (length xs \<ge> 2 \<longrightarrow> f xs \<noteq> xs))
           \<and> (\<forall> xs. (f (f (f xs))) = xs)"
sorry


end

Check File

theory Check
  imports Submission
begin

lemma  "\<exists>f::(nat list \<Rightarrow> nat list). (\<forall> xs. (length xs \<ge> 2 \<longrightarrow> f xs \<noteq> xs))
           \<and> (\<forall> xs. (f (f (f xs))) = xs)"
by (rule Submission.showmewhatyougot)


end
Download Files

Definitions File

theory Defs
  imports Main
begin  
  
end

Template File

theory Submission
  imports Defs
begin

lemma showmewhatyougot: "\<exists>f::(nat list \<Rightarrow> nat list). (\<forall> xs. (length xs \<ge> 2 \<longrightarrow> f xs \<noteq> xs))
           \<and> (\<forall> xs. (f (f (f xs))) = xs)"
sorry


end

Check File

theory Check
  imports Submission
begin

lemma  "\<exists>f::(nat list \<Rightarrow> nat list). (\<forall> xs. (length xs \<ge> 2 \<longrightarrow> f xs \<noteq> xs))
           \<and> (\<forall> xs. (f (f (f xs))) = xs)"
by (rule Submission.showmewhatyougot)


end
Download Files

Definitions File

theory Defs
  imports Main
begin  
  
end

Template File

theory Submission
  imports Defs
begin

lemma showmewhatyougot: "\<exists>f::(nat list \<Rightarrow> nat list). (\<forall> xs. (length xs \<ge> 2 \<longrightarrow> f xs \<noteq> xs))
           \<and> (\<forall> xs. (f (f (f xs))) = xs)"
sorry


end

Check File

theory Check
  imports Submission
begin

lemma  "\<exists>f::(nat list \<Rightarrow> nat list). (\<forall> xs. (length xs \<ge> 2 \<longrightarrow> f xs \<noteq> xs))
           \<and> (\<forall> xs. (f (f (f xs))) = xs)"
by (rule Submission.showmewhatyougot)


end

Terms and Conditions