<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="es">
	<id>https://www.glc.us.es/~jalonso/DAO2011/index.php?action=history&amp;feed=atom&amp;title=Rel_1</id>
	<title>Rel 1 - Historial de revisiones</title>
	<link rel="self" type="application/atom+xml" href="https://www.glc.us.es/~jalonso/DAO2011/index.php?action=history&amp;feed=atom&amp;title=Rel_1"/>
	<link rel="alternate" type="text/html" href="https://www.glc.us.es/~jalonso/DAO2011/index.php?title=Rel_1&amp;action=history"/>
	<updated>2026-07-19T09:43:49Z</updated>
	<subtitle>Historial de revisiones para esta página en el wiki</subtitle>
	<generator>MediaWiki 1.31.14</generator>
	<entry>
		<id>https://www.glc.us.es/~jalonso/DAO2011/index.php?title=Rel_1&amp;diff=77&amp;oldid=prev</id>
		<title>Jalonso en 18:17 15 jul 2018</title>
		<link rel="alternate" type="text/html" href="https://www.glc.us.es/~jalonso/DAO2011/index.php?title=Rel_1&amp;diff=77&amp;oldid=prev"/>
		<updated>2018-07-15T18:17:56Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;es&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Revisión anterior&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revisión del 18:17 15 jul 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Línea 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Línea 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;isar&lt;/del&gt;&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;isabelle&lt;/ins&gt;&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;header {* Razonamiento en Isabelle sobre programas *}&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;header {* Razonamiento en Isabelle sobre programas *}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jalonso</name></author>
		
	</entry>
	<entry>
		<id>https://www.glc.us.es/~jalonso/DAO2011/index.php?title=Rel_1&amp;diff=12&amp;oldid=prev</id>
		<title>Jalonso: Protegió «Rel 1» ([edit=sysop] (indefinido) [move=sysop] (indefinido))</title>
		<link rel="alternate" type="text/html" href="https://www.glc.us.es/~jalonso/DAO2011/index.php?title=Rel_1&amp;diff=12&amp;oldid=prev"/>
		<updated>2011-03-01T21:54:57Z</updated>

		<summary type="html">&lt;p&gt;Protegió «&lt;a href=&quot;/~jalonso/DAO2011/index.php/Rel_1&quot; title=&quot;Rel 1&quot;&gt;Rel 1&lt;/a&gt;» ([edit=sysop] (indefinido) [move=sysop] (indefinido))&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;es&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Revisión anterior&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revisión del 21:54 1 mar 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;es&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(Sin diferencias)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Jalonso</name></author>
		
	</entry>
	<entry>
		<id>https://www.glc.us.es/~jalonso/DAO2011/index.php?title=Rel_1&amp;diff=11&amp;oldid=prev</id>
		<title>Jalonso en 21:53 1 mar 2011</title>
		<link rel="alternate" type="text/html" href="https://www.glc.us.es/~jalonso/DAO2011/index.php?title=Rel_1&amp;diff=11&amp;oldid=prev"/>
		<updated>2011-03-01T21:53:18Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://www.glc.us.es/~jalonso/DAO2011/index.php?title=Rel_1&amp;amp;diff=11&amp;amp;oldid=10&quot;&gt;Mostrar los cambios&lt;/a&gt;</summary>
		<author><name>Jalonso</name></author>
		
	</entry>
	<entry>
		<id>https://www.glc.us.es/~jalonso/DAO2011/index.php?title=Rel_1&amp;diff=10&amp;oldid=prev</id>
		<title>Jalonso: Página creada con &#039;&lt;source lang=&quot;isar&quot;&gt; header {* Razonamiento en Isabelle sobre programas *}  theory Relacion_1_sol imports Main Efficient_Nat begin  text {* -------------------------------------...&#039;</title>
		<link rel="alternate" type="text/html" href="https://www.glc.us.es/~jalonso/DAO2011/index.php?title=Rel_1&amp;diff=10&amp;oldid=prev"/>
		<updated>2011-03-01T21:50:54Z</updated>

		<summary type="html">&lt;p&gt;Página creada con &amp;#039;&amp;lt;source lang=&amp;quot;isar&amp;quot;&amp;gt; header {* Razonamiento en Isabelle sobre programas *}  theory Relacion_1_sol imports Main Efficient_Nat begin  text {* -------------------------------------...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Página nueva&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;isar&amp;quot;&amp;gt;&lt;br /&gt;
header {* Razonamiento en Isabelle sobre programas *}&lt;br /&gt;
&lt;br /&gt;
theory Relacion_1_sol&lt;br /&gt;
imports Main Efficient_Nat&lt;br /&gt;
begin&lt;br /&gt;
&lt;br /&gt;
text {* --------------------------------------------------------------- &lt;br /&gt;
  Ejercicio 1. Definir la función&lt;br /&gt;
     sumaImpares :: &amp;quot;nat \&amp;lt;Rightarrow&amp;gt; nat&amp;quot;&lt;br /&gt;
  tal que (sumaImpares n) es la suma de los n primeros números&lt;br /&gt;
  impares. Por ejemplo,&lt;br /&gt;
     sumaImpares 5  =  25&lt;br /&gt;
  ------------------------------------------------------------------ *}&lt;br /&gt;
&lt;br /&gt;
fun sumaImpares :: &amp;quot;nat \&amp;lt;Rightarrow&amp;gt; nat&amp;quot; where&lt;br /&gt;
  &amp;quot;sumaImpares 0 = 0&amp;quot;&lt;br /&gt;
| &amp;quot;sumaImpares (Suc n) = sumaImpares n + (2*n+1)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
value &amp;quot;sumaImpares 5&amp;quot; -- &amp;quot;= 25&amp;quot;&lt;br /&gt;
&lt;br /&gt;
text {* --------------------------------------------------------------- &lt;br /&gt;
  Ejercicio 2. Demostrar que &lt;br /&gt;
     sumaImpares n = n*n&lt;br /&gt;
  ------------------------------------------------------------------- *}&lt;br /&gt;
&lt;br /&gt;
lemma &amp;quot;sumaImpares n = n*n&amp;quot;&lt;br /&gt;
by (induct n) auto&lt;br /&gt;
&lt;br /&gt;
text {* --------------------------------------------------------------- &lt;br /&gt;
  Ejercicio 3. Definir la función&lt;br /&gt;
     sumaPotenciasDeDosMasUno :: &amp;quot;nat \&amp;lt;Rightarrow&amp;gt; nat&amp;quot;&lt;br /&gt;
  tal que &lt;br /&gt;
     (sumaPotenciasDeDosMasUno n) = 1 + 2^0 + 2^1 + 2^2 + ... + 2^n. &lt;br /&gt;
  Por ejemplo, &lt;br /&gt;
     sumaPotenciasDeDosMasUno 3  =  16&lt;br /&gt;
  ------------------------------------------------------------------ *}&lt;br /&gt;
&lt;br /&gt;
fun sumaPotenciasDeDosMasUno :: &amp;quot;nat \&amp;lt;Rightarrow&amp;gt; nat&amp;quot; where&lt;br /&gt;
  &amp;quot;sumaPotenciasDeDosMasUno 0 = 2&amp;quot;&lt;br /&gt;
| &amp;quot;sumaPotenciasDeDosMasUno (Suc n) = &lt;br /&gt;
      sumaPotenciasDeDosMasUno n + 2^(n+1)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
value &amp;quot;sumaPotenciasDeDosMasUno 3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
text {* --------------------------------------------------------------- &lt;br /&gt;
  Ejercicio 4. Demostrar que &lt;br /&gt;
     sumaPotenciasDeDosMasUno n = 2^(n+1)&lt;br /&gt;
  ------------------------------------------------------------------- *}&lt;br /&gt;
&lt;br /&gt;
lemma &amp;quot;sumaPotenciasDeDosMasUno n = 2^(n+1)&amp;quot;&lt;br /&gt;
by (induct n) auto&lt;br /&gt;
&lt;br /&gt;
text {* --------------------------------------------------------------- &lt;br /&gt;
  Ejercicio 5. Definir la función&lt;br /&gt;
     copia :: &amp;quot;nat \&amp;lt;Rightarrow&amp;gt; &amp;#039;a \&amp;lt;Rightarrow&amp;gt; &amp;#039;a list&amp;quot;&lt;br /&gt;
  tal que (copia n x) es la lista formado por n copias del elemento&lt;br /&gt;
  x. Por ejemplo, &lt;br /&gt;
     copia 3 2 = [2,2,2]&lt;br /&gt;
  ------------------------------------------------------------------ *}&lt;br /&gt;
&lt;br /&gt;
fun copia :: &amp;quot;nat \&amp;lt;Rightarrow&amp;gt; &amp;#039;a \&amp;lt;Rightarrow&amp;gt; &amp;#039;a list&amp;quot; where&lt;br /&gt;
  &amp;quot;copia 0 x       = []&amp;quot;&lt;br /&gt;
| &amp;quot;copia (Suc n) x = x # copia n x&amp;quot;&lt;br /&gt;
&lt;br /&gt;
value &amp;quot;copia 3 2&amp;quot; -- &amp;quot;= [2,2,2]&amp;quot;&lt;br /&gt;
&lt;br /&gt;
text {* --------------------------------------------------------------- &lt;br /&gt;
  Ejercicio 6. Definir la función&lt;br /&gt;
     todos :: &amp;quot;(&amp;#039;a \&amp;lt;Rightarrow&amp;gt; bool) \&amp;lt;Rightarrow&amp;gt; &amp;#039;a list \&amp;lt;Rightarrow&amp;gt; bool&amp;quot;&lt;br /&gt;
  tal que (todos p xs) se verifica si todos los elementos de xs cumplen&lt;br /&gt;
  la propiedad p. Por ejemplo,&lt;br /&gt;
     todos (\&amp;lt;lambda&amp;gt;x. x&amp;gt;(1::nat)) [2,6,4] = True&lt;br /&gt;
     todos (\&amp;lt;lambda&amp;gt;x. x&amp;gt;(2::nat)) [2,6,4] = False&lt;br /&gt;
  Nota; La conjunción se representa por \&amp;lt;and&amp;gt;&lt;br /&gt;
  ------------------------------------------------------------------ *}&lt;br /&gt;
&lt;br /&gt;
fun todos :: &amp;quot;(&amp;#039;a \&amp;lt;Rightarrow&amp;gt; bool) \&amp;lt;Rightarrow&amp;gt; &amp;#039;a list \&amp;lt;Rightarrow&amp;gt; bool&amp;quot; where&lt;br /&gt;
  &amp;quot;todos p []     = True&amp;quot;&lt;br /&gt;
| &amp;quot;todos p (x#xs) = (p x \&amp;lt;and&amp;gt; todos p xs)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
value &amp;quot;todos (\&amp;lt;lambda&amp;gt;x. x&amp;gt;(1::nat)) [2,6,4]&amp;quot; -- &amp;quot;= True&amp;quot;&lt;br /&gt;
value &amp;quot;todos (\&amp;lt;lambda&amp;gt;x. x&amp;gt;(2::nat)) [2,6,4]&amp;quot; -- &amp;quot;= False&amp;quot;&lt;br /&gt;
&lt;br /&gt;
text {* --------------------------------------------------------------- &lt;br /&gt;
  Ejercicio 7. Demostrar que todos los elementos de (copia n x) son&lt;br /&gt;
  iguales a x. &lt;br /&gt;
  ------------------------------------------------------------------- *}&lt;br /&gt;
&lt;br /&gt;
lemma &amp;quot;todos (\&amp;lt;lambda&amp;gt;y. y=x) (copia n x)&amp;quot;&lt;br /&gt;
by (induct n) auto&lt;br /&gt;
&lt;br /&gt;
text {* --------------------------------------------------------------- &lt;br /&gt;
  Ejercicio 8. Definir la función&lt;br /&gt;
    factR :: &amp;quot;nat \&amp;lt;Rightarrow&amp;gt; nat&amp;quot;&lt;br /&gt;
  tal que (factR n) es el factorial de n. Por ejemplo,&lt;br /&gt;
    factR 4  =  24&lt;br /&gt;
  ------------------------------------------------------------------ *}&lt;br /&gt;
&lt;br /&gt;
fun factR :: &amp;quot;nat \&amp;lt;Rightarrow&amp;gt; nat&amp;quot; where&lt;br /&gt;
  &amp;quot;factR 0 = 1&amp;quot;&lt;br /&gt;
| &amp;quot;factR (Suc n) = Suc n * factR n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
value &amp;quot;factR 4&amp;quot; -- &amp;quot;= 24&amp;quot;&lt;br /&gt;
&lt;br /&gt;
text {* --------------------------------------------------------------- &lt;br /&gt;
  Ejercicio 9. Se considera la siguiente definición iterativa de la&lt;br /&gt;
  función factorial &lt;br /&gt;
     factI :: Integer -&amp;gt; Integer&lt;br /&gt;
     factI n = factI&amp;#039; n 1&lt;br /&gt;
     &lt;br /&gt;
     factI&amp;#039; :: Integer -&amp;gt; Integer -&amp;gt; Integer&lt;br /&gt;
     factI&amp;#039; 0     x = x                  -- factI&amp;#039;.1&lt;br /&gt;
     factI&amp;#039; (n+1) x = factI&amp;#039; n (n+1)*x   -- factI&amp;#039;.2&lt;br /&gt;
  Comprobar con QuickCheck que factI y factR son equivalentes sobre los&lt;br /&gt;
  números naturales.&lt;br /&gt;
  ------------------------------------------------------------------- *}&lt;br /&gt;
&lt;br /&gt;
fun factI&amp;#039; :: &amp;quot;nat \&amp;lt;Rightarrow&amp;gt; nat \&amp;lt;Rightarrow&amp;gt; nat&amp;quot; where&lt;br /&gt;
  &amp;quot;factI&amp;#039; 0       x = x&amp;quot;&lt;br /&gt;
| &amp;quot;factI&amp;#039; (Suc n) x = factI&amp;#039; n (Suc n)*x&amp;quot;&lt;br /&gt;
&lt;br /&gt;
fun factI :: &amp;quot;nat \&amp;lt;Rightarrow&amp;gt; nat&amp;quot; where&lt;br /&gt;
  &amp;quot;factI n = factI&amp;#039; n 1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
value &amp;quot;factI 4&amp;quot; -- &amp;quot;= 24&amp;quot;&lt;br /&gt;
     &lt;br /&gt;
text {* --------------------------------------------------------------- &lt;br /&gt;
  Ejercicio 10. Demostrar que, para todo n y todo x, se tiene &lt;br /&gt;
     factI&amp;#039; n x = x * factR n&lt;br /&gt;
  y, como corolario, que&lt;br /&gt;
     factI n = factR n&lt;br /&gt;
  ------------------------------------------------------------------- *}&lt;br /&gt;
&lt;br /&gt;
lemma fact: &amp;quot;factI&amp;#039; n x = x * factR n&amp;quot;&lt;br /&gt;
by (induct n arbitrary: x) auto&lt;br /&gt;
&lt;br /&gt;
corollary &amp;quot;factI n = factR n&amp;quot;&lt;br /&gt;
by (simp add: fact)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
text {* --------------------------------------------------------------- &lt;br /&gt;
  Ejercicio 12. Definir, recursivamente y sin usar (@). la función&lt;br /&gt;
     amplia :: &amp;quot;&amp;#039;a list \&amp;lt;Rightarrow&amp;gt; &amp;#039;a \&amp;lt;Rightarrow&amp;gt; &amp;#039;a list&amp;quot;&lt;br /&gt;
  tal que (amplia xs y) es la lista obtenida añadiendo el elemento y al&lt;br /&gt;
  final de la lista xs. Por ejemplo,&lt;br /&gt;
     amplia [2,5] 3 = [2,5,3]&lt;br /&gt;
  ------------------------------------------------------------------ *}&lt;br /&gt;
&lt;br /&gt;
fun amplia :: &amp;quot;&amp;#039;a list \&amp;lt;Rightarrow&amp;gt; &amp;#039;a \&amp;lt;Rightarrow&amp;gt; &amp;#039;a list&amp;quot; where&lt;br /&gt;
  &amp;quot;amplia []     y = [y]&amp;quot;&lt;br /&gt;
| &amp;quot;amplia (x#xs) y = x # amplia xs y&amp;quot;&lt;br /&gt;
&lt;br /&gt;
value &amp;quot;amplia [2,5] 3&amp;quot; -- &amp;quot;= [2,5,3]&amp;quot;&lt;br /&gt;
&lt;br /&gt;
text {* --------------------------------------------------------------- &lt;br /&gt;
  Ejercicio 13. Demostrar que &lt;br /&gt;
     amplia xs y = xs @ [y]&lt;br /&gt;
  ------------------------------------------------------------------- *}&lt;br /&gt;
&lt;br /&gt;
lemma &amp;quot;amplia xs y = xs @ [y]&amp;quot;&lt;br /&gt;
by (induct xs) auto&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jalonso</name></author>
		
	</entry>
</feed>