Skip to content

Latest commit

 

History

History
334 lines (271 loc) · 5.33 KB

File metadata and controls

334 lines (271 loc) · 5.33 KB

Lecture 6: Reasoning & Specialisation

Pointwise Proof

image-20250201121603535 $$ a, (P; Q), b \Lrarr (\exist x. a , P , x \wedge x , Q, b) $$ Proof. $$ \begin{align*} &\lang a, c\rang\text{ LHS }\lang b, d\rang

\\Lrarr&, a, (P; Q) , b \and c , (R;S) , d

\\Lrarr&, (\exist x. a, P , x \and x ,Q, b) \and (\exist y. c, R , y \and y ,S, d)

\\Lrarr&, \exist x, y. (a, P , x \and x ,Q, b) \and ( c, R , y \and y ,S, d)

\\Lrarr&, \exist x, y. (a, P , x \and c, R , y) \and ( x ,Q, b \and y ,S, d)

\\Lrarr&, \exist x, y. \lang a, c\rang [P, R] \lang x, y\rang \and \lang x, y\rang [R, S] \lang b, d\rang

\\Lrarr&, \lang a, c\rang \text{ RHS } \lang b, d\rang

\& \square. \end{align*} $$

Pointfree Proof

To Proof: $$ \text{snd } (\text{map}_n, Q); \text{row}_n , R; \text{fst }(\text{map}_n , S)

\text{row}_n, (\text{snd } Q; R; \text{fst }S) $$

Base Case $n=0$

To Proof: $$ \text{snd } (\text{map}_0, R); \text{row}_0 , R; \text{fst }(\text{map}_0 , S)

\text{row}_0, (\text{snd } S; R; \text{fst }S) $$

$$ \begin{cases} \text{map}_0 , R = []\ \text{row}_0, R =\text{snd }[]; \text{swap};\text{fst }[]

\end{cases} $$

$$ \begin{align*} \text{LHS} &= \text{snd } (\text{map}_0, Q); \text{row}_0 , R; \text{fst }(\text{map}_0 , S) \&= \text{snd }[]; (\text{snd }[]; \text{swap}; \text{fst } []); \text{fst }[] \&= \text{snd } []; \text{swap} ; \text{fst }[] \&= \text{row}_0, * &= \text{RHS}

\end{align*} $$

Induction Case

To Proof: $$ \text{snd } (\text{map}{n+1}, Q); \text{row}{n+1} , R; \text{fst }(\text{map}_{n+1} , S)

\text{row}_{n+1}, (\text{snd } Q; R; \text{fst }S) $$

Step 1: Unfold

image-20250201124150821

$$ \begin{align*} \text{LHS} =& \text{snd } (\text{map}_{n+1}\, Q); \text{row}_{n+1} \, R; \text{fst }(\text{map}_{n+1} \, S) \\=&

\text{snd } ( \text{apl}n^{-1}; [Q; \text{map}{n}, Q]; \text{apl}_n ); \&

( \text{snd } \text{apl}_n^{-1}; (R \lrarr \text{row}_n , R); \text{fst } \text{apl}_n );

\& \text{fst }( \text{apl}n^{-1}; [S; \text{map}{n}, S]; \text{apl}_n )

\ \text{RHS}=& \text{row}_{n+1}, (\text{snd } Q; R; \text{fst }S) \=& \text{snd }\text{apl}_n^{-1}; \& ( (\text{snd } Q; R; \text{fst }S) \lrarr \text{row}_n, (\text{snd } Q; R; \text{fst }S) );

\& \text{fst }\text{apl}_n

\end{align*} $$

Step 2: Transform

Step 3: Apply

Overview

$$ \begin{align*} \text{LHS} =& \text{snd } (\text{map}{n+1}, Q); \text{row}{n+1} , R; \text{fst }(\text{map}_{n+1} , S) \=&

\text{snd } ( \text{apl}n^{-1}; [Q; \text{map}{n}, Q]; \text{apl}_n ); \&

( \text{snd } \text{apl}_n^{-1}; (R \lrarr \text{row}_n , R); \text{fst } \text{apl}_n );

\& \text{fst }( \text{apl}n^{-1}; [S; \text{map}{n}, S]; \text{apl}_n )

\ \text{RHS}=& \text{row}_{n+1}, (\text{snd } Q; R; \text{fst }S) \=& \text{snd }\text{apl}_n^{-1}; \& ( (\text{snd } Q; R; \text{fst }S) \lrarr \text{row}_n, (\text{snd } Q; R; \text{fst }S) );

\& \text{fst }\text{apl}_n

\end{align*} $$

$$ \begin{align*} \text{LHS} =& \text{snd } (\text{map}{n+1}, Q); \text{row}{n+1} , R; \text{fst }(\text{map}_{n+1} , S) \=&

\text{snd } ( \text{apl}n^{-1}; [Q; \text{map}{n}, Q]; \text{apl}_n ); \&

( \text{snd } \text{apl}_n^{-1}; (R \lrarr \text{row}_n , R); \text{fst } \text{apl}_n );

\& \text{fst }( \text{apl}n^{-1}; [S; \text{map}{n}, S]; \text{apl}_n )

\=& \text{snd } ( \text{apl}n^{-1}; [Q; \text{map}{n}, Q] ); \&

(R \lrarr \text{row}_n , R);

\& \text{fst }( [S; \text{map}_{n}, S]; \text{apl}_n ) \ \vdash & \text{snd }\text{apl}_n^{-1}; \& ((\text{snd } Q; R; \text{fst }S) \lrarr \text{row}_n, (\text{snd } Q; R; \text{fst }S) ); \& \text{fst }\text{apl}_n

\end{align*} $$

Given $\text{snd }[A, B]; C\lrarr D;\text{fst }[E, F] =(\text{snd } A; C; \text{fst }E) \lrarr (\text{snd } B; D; \text{fst }F)$, leads to last $\vdash$ pass. Which leads to RHS. This proof see $\Gamma_1$.

To Proof: $\text{snd }[A, B]; C\lrarr D;\text{fst }[E, F] =(\text{snd } A; C; \text{fst }E) \lrarr (\text{snd } B; D; \text{fst }F)$

$\Gamma_1$: $$ \begin{align*} \text{LHS} = & \text{snd }[A, B]; C\lrarr D;\text{fst }[E, F]

\ \vdash& (\text{snd } A; C; \text{fst }E) \lrarr (\text{snd } B; D; \text{fst }F)

\ \lang a, \lang b_1, b_2\rang\rang \text{ LHS }\lang \lang c_1, c_2\rang, d\rang

\Lrarr & (\exist \beta_1. b, A ,\beta_1) \and (\exist \beta_2. b, B ,\beta_2) \& \and (\exist \alpha,\theta. \lang a, \beta_1\rang , C , \lang\theta, \alpha\rang) \& \and (\exist \alpha, \beta_2, \delta. \lang\alpha, \beta_2, \delta\rang, D , \lang\delta, d \rang) \& \and (\exist \theta. \theta , E , c_1) \and (\exist \delta. \delta , F , c_2) ) \ \Lrarr& SORRY

\end{align*} $$

$\square$

Reduction: Specialisation of row & Column

$R : \lang x, y\rang \sim z$$R ; \pi_2^{-1} : \lang x, y\rang \sim \lang ?, z\rang$