{-# OPTIONS --safe --without-K #-} module Helium.Data.Pseudocode where open import Algebra.Core open import Data.Bool using (Bool; if_then_else_) open import Data.Fin hiding (_+_; cast) import Data.Fin.Properties as Finₚ open import Data.Nat using (ℕ; zero; suc; _+_; _^_) import Data.Vec as Vec open import Level using (_⊔_) renaming (suc to ℓsuc) open import Relation.Binary using (REL; Rel; Symmetric; Transitive; Decidable) open import Relation.Binary.PropositionalEquality using (_≡_; refl; sym) open import Relation.Nullary using (Dec; does) open import Relation.Nullary.Decidable private map-False : ∀ {p q} {P : Set p} {Q : Set q} {P? : Dec P} {Q? : Dec Q} → (P → Q) → False Q? → False P? map-False ⇒ f = fromWitnessFalse (λ x → toWitnessFalse f (⇒ x)) record RawPseudocode b₁ b₂ i₁ i₂ i₃ r₁ r₂ r₃ : Set (ℓsuc (b₁ ⊔ b₂ ⊔ i₁ ⊔ i₂ ⊔ i₃ ⊔ r₁ ⊔ r₂ ⊔ r₃)) where infix 9 _^ᶻ_ _^ʳ_ infix 8 _⁻¹ infixr 7 _*ᶻ_ _*ʳ_ infix 6 -ᶻ_ -ʳ_ infixr 5 _+ᶻ_ _+ʳ_ _∶_ infix 4 _≈ᵇ_ _≟ᵇ_ _≈ᶻ_ _≟ᶻ_ _<ᶻ_ _>_ : ℤ → ℕ → ℤ x >> n = (x div (2ℤ ^ᶻ n)) {2^n≢0 n} getᶻ : ℕ → ℤ → Bits 1 getᶻ i x = if (does ((x mod (2ℤ ^ᶻ suc i)) {2^n≢0 (suc i)}