-------------------------------------------------------------------------------
-- Copyright 2026 Janek Spaderna
-- 
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
-- 
-- http://www.apache.org/licenses/LICENSE-2.0
-- 
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-------------------------------------------------------------------------------

module GenSim.Prelude where

import Level as StdlibLevel
import Relation.Binary.PropositionalEquality
import Relation.Binary.HeterogeneousEquality

open module ≡ = Relation.Binary.PropositionalEquality
  renaming (trans to infixr 1 _■_)
  hiding ([_])
  public

open module ≅ = Relation.Binary.HeterogeneousEquality
  using (_≅_; refl; ≅-irrelevant; ≅-to-≡; ≡-to-≅; ≅-to-type-≡; ≅-to-subst-≡; module ≅-Reasoning)
  renaming (trans to infixr 1 _≅■_)
  public

open import Relation.Binary.PropositionalEquality.WithK using (≡-irrelevant) public

import Relation.Binary
import Relation.Unary

open module Bin = Relation.Binary
  using (REL; Rel; DecidableEquality; IsEquivalence; Setoid; DecSetoid; Symmetric; Transitive)
  public

open module Un = Relation.Unary
  using (Pred)
  public

open import Data.Bool using (true; false) public
open import Relation.Nullary public

module Level = StdlibLevel
open Level
  using (Level; 0ℓ)
  public

open import Function
  hiding (id)
  public

open import Data.Empty
  using (⊥; ⊥-elim; ⊥-elim-irr)
  public

open import Data.Unit
  using (⊤)
  public
open import Data.Unit.Polymorphic
  using ()
  renaming (⊤ to ↑⊤)
  public

module Nat where
  open import Data.Nat public
  open import Data.Nat.Properties public

  module Variables where
    variable m m₁ m₂ m₃ n n₁ n₂ n₃ k k₁ k₂ m′ n′ : ℕ

open Nat
  using (ℕ; zero; suc; _+_; +-identityʳ; +-suc; +-assoc)
  renaming (suc-injective to suc⁻¹)
  public

module Fin where
  open import Data.Fin public
  open import Data.Fin.Properties public

  ↑ˡ≢↑ʳ : ∀ {m} {x : Fin m} {n} {y : Fin n} → x ↑ˡ n ≢ m ↑ʳ y
  ↑ˡ≢↑ʳ {suc m} {suc x} {suc n} {y} eq = ↑ˡ≢↑ʳ (suc-injective eq)

open Fin
  using ( zero; suc; _↑ˡ_; _↑ʳ_; ↑ˡ≢↑ʳ
        ; ↑ˡ-injective; ↑ʳ-injective
        ; splitAt; join-splitAt; splitAt-↑ˡ; splitAt-↑ʳ; splitAt⁻¹-↑ˡ; splitAt⁻¹-↑ʳ
        )
  renaming (Fin to 𝔽) public

module V where
  open import Data.Vec public
  open import Data.Vec.Properties public

open V using (Vec; []; _∷_) public

module Π where
  open import Data.Product public
  open import Data.Product.Properties public

open Π using (_×_; _,_; proj₁; proj₂; Σ-syntax; ∃; ∄; ∃₂;  curry; uncurry) public

module Sum where
  open import Data.Sum public
  open import Data.Sum.Properties public

open Sum
  using ( _⊎_; inj₁; inj₂; inj₁-injective; inj₂-injective
        ; [_,_]; [_,_]′; [,]-∘; [,]-cong; [-,]-cong; [,-]-cong; [,]-map
        )
  public

module L where
  open import Data.List public
  open import Data.List.Properties public

  module All where
    open import Data.List.Relation.Unary.All public
    open import Data.List.Relation.Unary.All.Properties public

  module Any where
    open import Data.List.Relation.Unary.Any public
    open import Data.List.Relation.Unary.Any.Properties public

open L using (List; []; _∷_; _++_) public
open L.All using (All; []; _∷_) public
open L.Any using (Any; here; there) public

import Data.These
import Data.Maybe

open module Th = Data.These
  using (These; this; that; these; fromThis; fromThat)
  public

open module May = Data.Maybe
  using (Maybe; just; nothing; maybe; thisM; thatM)
  public