Downset calculation code
Naming

According to the Swift API Design Guidelines,


  Names of types and protocols are UpperCamelCase. Everything else is lowerCamelCase


therefore it should be func oneDeletion, oldPerms, newPerms etc.

Some variable names such as A, L are non-descriptive.

I would use a different name for the array inside struct Permutation,
for example

struct Permutation: Hashable {
    let sigma: [Int]
    // ...
}


so that perm can be used for a Permutation variable without
causing confusion. (This is of course opinion-based.)

Hashing

You don't need to implement

static func == (lhs: Permutation, rhs: Permutation) -&gt; Bool


because that is automatically synthesized in Swift 4.1. A future version
of Swift will also synthesize the hashValue automatically, this
is currently discussed at


Let Optional, Dictionary and Array conditionally conform to Hashable in the Swift forum.


and implemented in https://github.com/apple/swift/pull/15382.

Until that is implemented, you have to provide a hashValue method.
I would probably not choose the description method because that
requires a conversion to strings. A good choice would be the
_combineHashValues function in Hashing.swift from the above pull
request, this is also what hash.hpp from the Boost library uses:

// From https://github.com/lorentey/swift/blob/e03cb1340ad89013bbaef1c4f802a72de06e9e1a/stdlib/public/core/Hashing.swift
func combineHashValues(_ firstValue: Int, _ secondValue: Int) -&gt; Int {
    let magic = 0x9e3779b9 as UInt
    var x = UInt(bitPattern: firstValue)
    x ^= UInt(bitPattern: secondValue) &amp;+ magic &amp;+ (x &amp;&lt;&lt; 6) &amp;+ (x &amp;&gt;&gt; 2)
    return Int(bitPattern: x)
}

struct Permutation: Hashable {
    let sigma: [Int]

    var hashValue: Int {
        return sigma.reduce(0, combineHashValues)
    }

    // ...
} 


Use functional methods

The loop 

var A = [Int]() // Empty array of integers
for val in sigma.perm {
    if val &lt; i {
        A.append(val)
    } else if val &gt; i {
        A.append(val-1)
    }
}


in func one_deletion can be simplified using compactMap:

let a = sigma.perm.compactMap { val in
    val &lt; i ? val : val &gt; i ? val - 1 : nil
}


and in func downset the inner loop

        for val in sigma.perm {
            new_perms.insert(one_deletion(sigma:sigma, i:val))
        }


can be simplified using map:

        new_perms.formUnion(sigma.perm.map { one_deletion(sigma: sigma, i: $0) } )


Define instance methods

Both func one_deletion and func downset operate on an instance of
struct Permutation, therefore I would replace the free functions by
instance methods:

struct Permutation: Hashable {
    // ... 

    func deleting(i: Int) -&gt; Permutation { /* ... */ }
    func downset() -&gt; [Set&lt;Permutation&gt;] { /* ... */ }
}


which would then be used as

let reduced = perm.deleting(val: i)


or

let ds = perm.downset()


Further remarks

Array&lt;Int&gt; and [Int] are equivalent notations for an array of integers, but I would
suggest to use only one of them consistently.

The comment in

var A = [Int]() // Empty array of integers


is useless, and here

let B = Permutation(perm:A)
return B


the intermediate variable is not needed.

Instead of re-initializing the set with an empty set

    new_perms = []


it might be more efficient to call

    new_perms.removeAll(keepingCapacity: true)


to avoid subsequence reallocations of the element storage.

Putting it all together

// From https://github.com/lorentey/swift/blob/e03cb1340ad89013bbaef1c4f802a72de06e9e1a/stdlib/public/core/Hashing.swift
func combineHashValues(_ firstValue: Int, _ secondValue: Int) -&gt; Int {
    let magic = 0x9e3779b9 as UInt
    var x = UInt(bitPattern: firstValue)
    x ^= UInt(bitPattern: secondValue) &amp;+ magic &amp;+ (x &amp;&lt;&lt; 6) &amp;+ (x &amp;&gt;&gt; 2)
    return Int(bitPattern: x)
}

struct Permutation: Hashable {
    let sigma: [Int]

    var hashValue: Int {
        return sigma.reduce(0, combineHashValues)
    }

    func deleting(val: Int) -&gt; Permutation {
        let newSigma = sigma.compactMap { j in
            j &lt; val ? j : j &gt; val ? j - 1 : nil
        }
        return Permutation(sigma: newSigma)
    }

    func downset() -&gt; [Set&lt;Permutation&gt;] {
        var newPerms = Set([self])
        var result = [newPerms]

        for _ in 0..&lt;sigma.count {
            let oldPerms = newPerms
            newPerms.removeAll(keepingCapacity: true)
            for perm in oldPerms {
                newPerms.formUnion(perm.sigma.map { perm.deleting(val: $0)} )
            }
            result.append(newPerms)
        }

        return result
    }
}

let u3 = Permutation(sigma: [2,5,3,1,4])
let ds = u3.downset()