-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data.Fin and with statement #2106
Comments
I think this isn't a bug in Agda, maybe some inconvenience with the new Also, I think here is more expertise how to prove stuff about functions defined with Here is the code from the OP with polished import statements: {-# OPTIONS --cubical-compatible --safe #-}
module _ where
open import Data.Fin using (Fin; zero; suc; #_)
open import Data.Fin.Permutation using (Permutation; _⟨$⟩ˡ_; _⟨$⟩ʳ_; inverseˡ; inverseʳ; permutation)
open import Data.Nat.Base using (ℕ; suc; zero; s≤s ; z≤n )
open import Relation.Binary.PropositionalEquality using (_≡_; cong; refl; sym; module ≡-Reasoning)
open import Relation.Nullary using (¬_)
open import Data.Empty using (⊥-elim)
shlem→ : {n : ℕ} → (perm : Permutation (suc n) (suc n) ) → (p0=0 : perm ⟨$⟩ˡ (# 0) ≡ # 0 ) → (x : Fin (suc n) ) → perm ⟨$⟩ˡ x ≡ zero → x ≡ zero
shlem→ perm p0=0 x px=0 = begin
x ≡⟨ sym ( inverseʳ perm ) ⟩
perm ⟨$⟩ʳ ( perm ⟨$⟩ˡ x) ≡⟨ cong (λ k → perm ⟨$⟩ʳ k ) px=0 ⟩
perm ⟨$⟩ʳ zero ≡⟨ cong (λ k → perm ⟨$⟩ʳ k ) (sym p0=0) ⟩
perm ⟨$⟩ʳ ( perm ⟨$⟩ˡ zero) ≡⟨ inverseʳ perm ⟩
zero
∎ where open ≡-Reasoning
shlem← : {n : ℕ} → (perm : Permutation (suc n) (suc n) ) → (p0=0 : perm ⟨$⟩ˡ (# 0) ≡ # 0 ) → (x : Fin (suc n)) → perm ⟨$⟩ʳ x ≡ zero → x ≡ zero
shlem← perm p0=0 x px=0 = begin
x ≡⟨ sym (inverseˡ perm ) ⟩
perm ⟨$⟩ˡ ( perm ⟨$⟩ʳ x ) ≡⟨ cong (λ k → perm ⟨$⟩ˡ k ) px=0 ⟩
perm ⟨$⟩ˡ zero ≡⟨ p0=0 ⟩
zero
∎ where open ≡-Reasoning
sh2 : {n : ℕ} → (perm : Permutation (suc n) (suc n) ) → (p0=0 : perm ⟨$⟩ˡ (# 0) ≡ # 0 ) → {x : Fin n} → ¬ perm ⟨$⟩ˡ (suc x) ≡ zero
sh2 perm p0=0 {x} eq with shlem→ perm p0=0 (suc x) eq
sh2 perm p0=0 {x} eq | ()
sh1 : {n : ℕ} → (perm : Permutation (suc n) (suc n) ) → (p0=0 : perm ⟨$⟩ˡ (# 0) ≡ # 0 ) → {x : Fin n} → ¬ perm ⟨$⟩ʳ (suc x) ≡ zero
sh1 perm p0=0 {x} eq with shlem← perm p0=0 (suc x) eq
sh1 perm p0=0 {x} eq | ()
-- 0 ∷ 1 ∷ 2 ∷ 3 ∷ [] → 0 ∷ 1 ∷ 2 ∷ []
shrink : {n : ℕ} → (perm : Permutation (suc n) (suc n) ) → perm ⟨$⟩ˡ (# 0) ≡ # 0 → Permutation n n
shrink {n} perm p0=0 = permutation p→ p← piso← piso→ where
p→ : Fin n → Fin n
p→ x with perm ⟨$⟩ʳ (suc x) in eq
p→ x | zero = ⊥-elim ( sh1 perm p0=0 {x} eq )
p→ x | suc t = t
p← : Fin n → Fin n
p← x with perm ⟨$⟩ˡ (suc x) in eq
p← x | zero = ⊥-elim ( sh2 perm p0=0 {x} eq )
p← x | suc t = t
abbrv : (x : Fin n) → Fin (suc n)
abbrv x = perm ⟨$⟩ˡ (suc x)
-- using "with" something bound in ≡ is prohibited
piso← : (x : Fin n ) → p→ ( p← x ) ≡ x
piso← x = {!!}
piso→ : (x : Fin n ) → p← ( p→ x ) ≡ x
piso→ x = {!!}
p01 : (x : Fin n) → p→ ( p← x ) ≡ x
p01 x with perm ⟨$⟩ˡ (suc x) in eq
... | t = {!!} The task is to prove If I wanted to make progress on this, I probably would reformulate |
Ha! Thanks to each of @Taneb and @andreasabel for this... but I might also wish to loop @gallais and even notorious Meanwhile, my continuing tracking of @omelkonian 's issues in the main Agda issue tracker have led me to the (reluctant!) conclusion that we
Meanwhile, I'll scratch my head a bit harder about this example, and throw back to the main developers the question concerning how |
The other thing to ask for here @shinji-kono is the original working version of the code under 2.6.3/stdlib-v?.?.?, again in as cleaned-up a state as possible. Thanks! UPDATED: looking over the code for |
@jamesmckinna did one of the PRs fix this or is this still an outstanding problem? |
@MatthewDaggitt wrote:
This is still outstanding, AFAIU. (And I have not solved the problem, except see below) I requested a look at the original code said to be working under 2.6.3, but have yet to see it. The definition of Saying something "doesn't work" using shrink = remove zero perm seems a solution to the definitional problem. As would the followup of going through the definition of @andreasabel , @shinji-kono do you think that this is a problem that still concerns The fact that the proposed 'solution' via As for the general case of |
@MatthewDaggitt TL;DR : suggest we |
Yup I agree with your analysis. Unless @shinji-kono can provide us with code that works in Will close, but @shinji-kono feel free to post proof your code worked with the previous version of the standard library and Agda, in which case we'll reopen it. |
I'm using Agda version 2.6.4 and standard-library-2.0
In the fixing a working code in Agda 2.6.3 and standard-library, (simialar one with
Data.Fin.Permutation.remove
)This gives me ...
pm.agda
The text was updated successfully, but these errors were encountered: