Tuesday, 15 March 2011

agda - Flattened matrix vs 2D matrix lookup equivalence (proof) - seeking more elegance -


I have a clear evidence (statement) that the elements in the form of a meter * n in the flat representation of a matrix Seeing length vector is similar to vector-of-vector representation. But my evidence seems terrible. [I will not give it proof here, doing so would be a prerogative!]. To make this question self-reliant, I give some self-contained Egga modules below, which are helpful. [Some of these limas should be in the standard library, but not.]

Actually, I'm looking for a great way to fill the hole below, proof of lookup concat . If you can make my lames more elegant, feel free!

  Module NN where open import data Net Open ImportDetate Properties Simple Open Import Data met. Open Properties, Import Data. Import Import Open. Open (Fin; inject≤; fromℕ; toℕ) Import data. Finn Open import data using properties (bounded) The product to be used (_ _ _ _ _ _ _ _ _ _) Open Import Relationship Binary.PropositionalEquality - Some useful lemurs cong + r≤: ∀ {ij} → i ≤ j → (k: ℕ) → i + k ≤ J + k cong + r≤ {0} {j} z≤nk = n ≤m + njk cong + r≤ {suc}} {0} () k - absurd cong + r≤ {suc i} {suc j} (Sssi≤j) k = s≤s (cong + r≤) {I} {j} i≤jk) cong + l≤: ∀ {ij} → i ≤ j → (k: ℕ) → k + i ≤ K + j cong + l≤ {i} {j} ijjk = start (k + i ≡⟨ + -comm key⟩ i + k ≤⟨ cong + r≤ i≤jk⟩ j + k ≡⟨ + -comm jk⟩ K + j ∎) where open ≤-recieving cong * r≤: ∀ {is} → i ≤ j → (k: ℕ) → i * k ≤ j * k cong * r≤ {0} {j} z≤nk = Z≤n cong * r≤ {success}} {0} () k - absurd cong * r≤ {suc i} {suc j} (s≤si≤j) k = cong + l≤ (cong * r≤ I≤jk) k sinj≤: ∀ {ij} → success i Suc j → i ≤ j sinj≤ {0} {j} _ = z≤n sin ({iSP) = p * n + kmm * n: ∀ {mn} → (ii: fin m) → (k: fin N) → (success (toe i * n + toℕ k) ≤ m * n) i * n + k≤m * n {0} {_} () _ i * n + k≤m * n {_} { 0} _ () i * n + k≤m * n {success meter} {success} Ik = start (success (toℕ i * suc n + toℕ k) ≡⟨ cong suc (+ -comm (to ii)) ( ℕ k))⟩ suc (tok k + toℕ i * suc n) ≡⟨ refl⟩ suc (toℕ k) + (to ii) * n) ≤⟨ cong + r≤ (bounded k) (to ii) success n +⟩ Suc n + (to ii) * ≤⟨ cong + l≤ (cong * r (sin i) (success n)) (success n)⟩ success n + (m * success n) ≡⟨ rifle Success M * success n ∎) where open ≤-logic fwd: {mn: (I) + Kmm * nik) Lookup: Context: ∀ {mn} {A: Set} (Lookup J (Lookup IXSS) LookupCanc ij xss = {Lookup Lookup (XML)) (XMC) !!}   fwd  by induction, then it follows the rest: pre> 

  Open import data.Note. Open the banner import data. Hide Fine (_ + _) Open import data. Import Import Open. Open properties import relationship Binary.PropositionalEquality fwd: ∀ {mn} - & gt; Fin M - & gt; Fin N - & gt; FIN (M * N) FWD {Successful M} {N} Zero J = Inject + (M * N) JFWD {N = N} (Success I) J = N (FWD ID) - It should be Standard in Library . Lookup - ++ - raise: ∀ {m}} {a} set} (j: fin n) (xs: vac am) (ys: vac an) - & gt; Lookup (increase MEG) (XS ++ YS) ≡ Lookup which YS Lookup - ++ - h raise J [] ys = Rifle lookup - ++ - h raise J (x ∷ xs) ys = lookup - ++ - jacks xs Increase YS Lookup∘concat: ∀ {mn} {A: Set} ij (xss: VAC AN) M) - & gt; Lookup J (Lookup I xss) LookupCanChat Zero J (xs ∷ xss) = Lookup - ++ - Inject + X (Context XSS) J LookupConChat (Seu-i) J (X  Strong proof for fwd : << code>   : - 

  Module soundness where open import data .net properties. Open import data. Finn Properties Voice: ∀ {mn} (i: fin min) (j: fin n) -> toe (fwd ij) ≡ to ii * n + to jj soundness {suc m} {n} Zero j = sym (inject + -lemma (m * n) j) Increase the sound of {n = n} (suc i) j rewrite to-n (FWD IJ) | Strength I am Jammu = SMM (+ -sok n (toℕ i * n) (toℕ j))  

No comments:

Post a Comment