Giuseppe Primiero
email: g.primiero@mdx.ac.uk

Jaap Boender
email: j.boender@mdx.ac.uk

Managing software uninstall with negative trust

A problematic aspect of software management systems in view of integrity preservation is the handling, approval, tracking and eventual execution of change requests. In the context of the relation between clients and repositories, trust can help identifying all packages required by the intended installation. Negative trust, in turn, can be used to approach the complementary problem induced by removing packages. In this paper we offer a logic for negative trust which allows to identify admissible and no-longer admissible software packages in the current installation profile in view of uninstall processes. We provide a simple working example and the system is formally verified using the Coq theorem prover.

Introduction

Software management configuration is among the most pervasive problems in modern personal computing, with complications caused by multiplication of users, required support for several software versions releases, increasing customization options and the need of coordination across distributed systems. One specific aspect of configuration management activities is change management, i.e. the handling, approval and tracking of change requests, with the aim of preserving the integrity of the system.

Consider the following example. A user interacts with a software package system to install or remove applications. The set of packages installed on a machine is called the installation profile of that machine. A valid installation profile is one which meets all the dependencies and conflicts clauses of all the packages installed and such that it satisfies sufficient dependencies for any desired package to be executed. Assume the current installation profile contains: two packages φ 1 , φ 2 from the main repository; one package ψ 1 from the free repository; and one package ξ 1 from the non-free repository. Assume moreover that ψ 1 depends on φ 1 and from φ 2 , while ξ 1 depends on ψ 1 . Consider now the situation where the user wishes to prevent installation of a given additional package ψ n from the free repository, while wishing to install a package ξ 2 from the non-free repository: which other packages is she safe in installing? and which ones does she need to remove in order to avoid conflicts in the new installation? Determining these consistency relations between packages in a given installation is essential for system stability, but also to prevent the possibility of security threats in critical systems.

In [START_REF] Tucker | OPIUM: Optimal Package Install/Uninstall Manager[END_REF], the problem of maintaining profile consistency and system integrity in view of uninstall processes is presented in the following terms: Definition 1. (Uninstall Problem). Given a new package φ to install, determine the minimal number of packages (possibly none) that must be removed from the system in order to make φ installable.

This means identifying and removing all packages that are in conflict with the intended installation and its dependencies. This version of the problem can be complemented by that of identifying packages that depend on an undesired one.

In this context, trust can be used to characterize the relations between clients, software packages (including their dependencies) and repositories during the installation process. A software package in conflict with the current installation profile can not be trusted under it and hence not installed; if already installed, trust needs to be removed. Hence, dealing with such processes requires an explicit treatment of negative trust. Here and in the following the term untrust is used as neutral for 'negative trust' with respect to its derivatives mistrust and distrust: the former expresses trust removal, the latter trust denial. It should be noted that we refer to negative trust in the sense of being obtained through logical negation, as opposed to other quantitative approaches, where negative numbers are used. In [START_REF] Primiero | A Calculus for Distrust and Mistrust[END_REF] a natural deduction calculus is formulated which offers a prooftheoretical semantics for both notions. On this basis, we adapt here the Uninstall Problem from Definition 1 to the two semantics of untrust:

-A user identifies a package φ which generates conflict with a desired installation; to preserve profile consistency, φ is distrusted while the set of packages not depending on φ remain installable; -A user identifies a package φ to be installed but in conflict with the current profile; to preserve profile consistency the packages ψ i , . . . , ψ n in the installation profile in conflict with φ are mistrusted.

The Uninstall Problem from Definition 1 can then be reformulated accordingly in the two variants: Definition 2. (Distrusted Uninstall Problem) Given a package φ that should not be installed, determine which other packages can be installed (i.e. that do not require φ).

In this case, we are obviously interested in determining the maximal set of installable packages that do not conflict with φ. Definition 3. (Mistrusted Uninstall Problem) Given a package φ that should be installed, but which is in conflict with the current profile, determine which packages need to be uninstalled in order for φ to become installable.

As in the approach from [START_REF] Tucker | OPIUM: Optimal Package Install/Uninstall Manager[END_REF], we are interested here in determining the minimal set of packages inconsistent with φ that have to be removed from the installation profile.

In the present paper we provide a solution to these two problems in software management through their formalization in a logic for negative trust. In our model we use a trust function to allow access relations that presuppose consistency; in the current interpretation, trust (and hence of consistency checks) applies to software packages and conflicts are treated through negative trust. Note that the kind of inconsistencies we consider are not just those induced by technical requirements of the packages, but also by security issues. This formal strategy can help in offering a computable approach to trust management and in reducing risks related to installation profile inconsistency. The logic allows to reason about statements of the form: Installation profile Γ allows consistent installation of package φ and prevents installation of conflicting package ψ.

This approach is in the first place novel from a conceptual point of view, because software dependency satisfaction as trust management has not yet been largely investigated. Secondly, it is novel from a technical point of view, as prooftheoretic solutions and the possibility of implementation in theorem provers for automatic inconsistency checking have been neglected so far. In comparison with existing approaches for the resolution of inconsistent installations, our underlying logic allows a finer-grained approach than, for example, SAT-solvers.

The paper is structured as follows. In Section 2 we offer an overview of related works in the area of computational trust and software management. In Section 3 we introduce the system (un)SecureND, which provides the formal machinery for our analysis. In Section 4 the Distrusted Uninstall Problem is reformulated within our logic and its solution illustrated. In Section 5 the same is done for the Mistrusted Uninstall Problem. In Section 6 we present a simple scenario modelled by example derivations showing both cases at work. We conclude with some general remarks and a brief overview of future work.

Related Work

The present work sits at the intersection of the literature on software dependency management and computational trust. In this section we briefly overview related works in both areas and compare those to our approach and results.

In [START_REF] Boender | Minimizing transitive trust threats in software management systems[END_REF], we have offered a trust-based version of the optimization problem from [START_REF] Tucker | OPIUM: Optimal Package Install/Uninstall Manager[END_REF], known as the minimum install problem, determining the optimal way to install a new package, where optimality is determined by an objective function to minimize the amount of dependencies satisfied such that it results in a valid installation profile. Trust is then used to guarantee that the minimal amount of dependencies for each newly installed package is satisfied by transitively accessed repositories. The complementary problem of maintaining profile consistency and system integrity in view of uninstall processes can be similarly developed by applying the logic from [START_REF] Primiero | A Calculus for Distrust and Mistrust[END_REF] to the software management context.

In the context of software management, SAT solving appears as a promising approach for the development of efficient methods of dependency graph resolution. SAT technology has been used in [START_REF] Mancinelli | Managing the Complexity of Large Free and Open Source Package-Based Software Distributions[END_REF] to validate dependencies and check installability of packages of specific Linux distribution. In Section 1 we have illustrated our current task as resolving two variants of the Uninstall Problem from [START_REF] Tucker | OPIUM: Optimal Package Install/Uninstall Manager[END_REF]. In that work the Opium package-management tool is introduced, also based on pseudo-boolean solvers. Opium is complete with respect to solution finding and can optimize a user-defined function, e.g. to prefer smaller packages over larger ones. An implementation of Opium is available as the 0install solver. 1 A review of state-of-the-art package managers and their ability to keep up with evolution and their dependency solving abilities is offered in [START_REF] Abate | Dependency solving: A separate concern in component evolution management[END_REF], with a proposal to treat dependency solving as a separate concern from other upgrade aspects. The upgrade problem is also considered in [START_REF] Abate | MPM: A Modular Package Manager[END_REF] to justify the design of a modular package manager. While we do not have an implementation of preferential settings based on user-choices, our installation profiles are defined according to a criterion of minimality for dependency satisfaction: this means that we construct installation profiles according to an ordered criterion of dependency satisfaction and package removal from a profile always proceeds to identify the minimal number of required packages. Also, in our approach we do not explicitly distinguish cases of upgrade as separate from installation of new packages: this is clearly a simplification, but the system can deal with upgrade with the more complex tactic of removing older versions and installing newer ones. The solvability of the decision problem related to software dependency management and its optimization are also considered in [START_REF] Le | On SAT Technologies for Dependency Management and Beyond[END_REF]. In the present paper our aim is to start an investigation in a proof-theoretical and trust-based approach to software dependency management, which so far has been neglected. We also hope to facilitate the introduction of automated theorem provers in the area, which can be beneficial in the checking process of intended installations in order to anticipate possible conflicts.

An associated but distinct issue is the co-installability problem: to quickly identify the components that can or cannot be installed together. It is related to boolean satisfiability and it is known to be algorithmically hard. It is shown to be especially complex for cases that include optimization by user preferences, where a combination of exact and approximate solving can help, [START_REF] Ignatiev | Towards Efficient Optimization in Package Management Systems[END_REF]. In [START_REF] Vouillon | On Software Component Co-installability[END_REF] a formally certified semantic method preserving graph-theoretic transformations is developed to associate to each concrete component repository a much smaller one with a simpler structure. One aspect of co-installability is that of reciprocal dependencies [START_REF] Boender | Formal verification of a theory of packages[END_REF], which as mentioned more explicitly later is abstracted from in the present formulation. The Mistrusted Uninstall Problem formulated below replicates the intuition of the co-installability problem in the setting for external packages (and their dependencies) which are in explicit conflict with currently installed ones (and those they depend on). As for the latter work and the work presented in [START_REF] Abate | Dependency solving: A separate concern in component evolution management[END_REF], our system enjoys a formal translation to a library for the Coq theorem prover,2 with the aim of verifying its results. Our system seems also to be the only one among those in the area of software management that relies on the explicit formulation of a natural deduction calculus.

An essential characteristic of the method implemented in our system is that integrity checking on installation profiles is guaranteed through an explicit formulation of a trust access function on packages. The logic was first introduced in [START_REF] Primiero | A typed natural deduction calculus to reason about secure trust[END_REF] and extended to deal with negative trust in [START_REF] Primiero | A Calculus for Distrust and Mistrust[END_REF]. Recently, research has started considering the advantages, implications and formal requirements needed to deal with the various aspects of negated trust, and in particular the different meanings that can be attached to mistrust and distrust, including the extension and limits of their transitivity and propagation protocols [START_REF] Shiu | Trust and Distrust Definitions: One Bite at a Time[END_REF][START_REF] Ramanathan | Propagation of trust and distrust[END_REF][START_REF] Marsh | Trust, Untrust, Distrust and Mistrust -An Exploration of the Dark(er) Side[END_REF][START_REF] Cai | Propagation Models for Trust and Distrust in Social Networks[END_REF]. Most current research ignores the difference between the procedural semantics of these two terms, possibly with the exception of [START_REF] Marsh | Trust, Untrust, Distrust and Mistrust -An Exploration of the Dark(er) Side[END_REF], which presents mistrust as misplaced trust, untrust as little trust and distrust as no trust. This approach abstracts, though, from the reasons behind the attribution of these evaluations, in favour of a purely quantitative approach. Propagation for negative (first-order) trust is formulated in [START_REF] Jøsang | Semantic Constraints for Trust Transitivity[END_REF]. Our contribution relies on a strict distinction between distrust and mistrust: the former is intended as trust denied to packages coming from outside of the current installation profile in view of inconsistencies with currently installed ones; the latter is understood as trust revoked to installed packages, in view of desired new packages to be installed. These two cases have not been in general treated separately. Our approach formalises them in the context of uninstall operations, which as far as we are aware are entirely missing from the literature. Moreover, treating (un)install operations in terms of (un)trust allows us to integrate a consistency check performed over profiles that satisfy dependencies for the packages involved.

(un)SecureND

(un)SecureND is a natural deduction calculus defining trust, mistrust and distrust protocols introduced in [START_REF] Primiero | A typed natural deduction calculus to reason about secure trust[END_REF] for the positive fragment and in [START_REF] Primiero | A Calculus for Distrust and Mistrust[END_REF] for the negation complete extension. We offer here a slightly modified version adapted for the software management problems at hand. In particular, the present version introduces a strict partial ordering on formulas to express package dependency; this is then lifted at the level of contexts to express rules for installation profile construction and finally imported at the level of repositories where the associated packages are located. In view of this order relation the system qualifies as a substructural logic, in that Weakening is constrained by a trust function, Contraction and especially Exchange by the order relation.

We start with introducing the language of our logic: Definition 4. (Syntax of (un)SecureND)

S ∼ := {A < B < . . .} φ S := a S | ¬φ S i | φ S i → φ S j | φ S i ∧ φ S j | φ S i ∨ φ S j | ⊥ | Read(φ S ) | W rite(φ S ) | T rust(φ S ) Γ S := φ S i | φ S i < φ S j | Γ S ; φ S j 3.
1 Repositories, packages and dependencies S ∼ is the set of software repositories ordered by < in view of dependencies between packages they contain, obtained below as lifting from package dependency. φ S is a meta-variable for formulae, expressing software packages and their logical composition inductively defined by connectives, including operations to read (query), trust (consistency checking) and write (install). The language includes ⊥ to express conflicts: we formulate ¬φ A i as an abbreviation for φ A i → ⊥. Packages are typed by their origin in repositories: φ S i says that package φ i can be retrieved from repository S ∈ S. An installation profile Γ S is the list of all packages sufficient to an access or execution operation; a profile is internally structured to reflect the dependency of packages through the partial order < in S ∼ . We allow extension of profiles by packages that are not dependent on previous ones, denoted by Γ S ; Γ S = {φ S i < . . . < φ S n ; φ S n+1 }. This construction allows us to consider installation profiles that have all the sufficient conditions for the valid execution of a package, but can also be extended with additional packages. When such extension comes from the same repository, we use a comma: Γ S , φ S i . The partial order allows for branching in the hierarchy, so that e.g. φ S 1 < φ S 2 < φ S 3 and φ S 1 < φ S 2 < φ S 4 , i.e. packages φ S 3 , φ S 4 have both dependencies on φ S 2 and transitively on φ S

1 , but φ S 3 , φ S 4 could have no dependencies on each other.

Definition 5 (Judgements). An (un)SecureND-judgement φ A i ψ B j says that a package ψ j from repository B can be validly executed under a profile containing package φ i from repository A. Definition 6 (Validity). An (un)SecureND-judgement φ A i says that a package φ i from repository A can be executed in any profile.

We now generalise the dependency relation between packages φ A i < ψ B j at the level of repositories. A partial order relation < over S × S intuitively expresses that dependencies are satisfied across repositories.

Definition 7. A < B iff ∃φ A i , ψ B j s.t. φ A i < ψ B j and ¬∃φ A k , ψ B l s.t. ψ B l < φ A k .
By the first clause in Definition 7, A < B means that some package in A satisfies a dependency for a package in B. By the second clause in Definition 7, our order relation abstracts from the issue of reciprocal dependencies. As noted in [START_REF] Boender | Formal verification of a theory of packages[END_REF], two packages that mutually depend on each other will either be installed together, or not installed at all. They can therefore be considered as a single package for dependency resolution purposes. Rules from Figure 1 define installation profiles construction from packages dependencies. Here we use the extra-theoretical typing declaration : prof ile to state that a formal expression can be considered a valid installation profile. By Empty Profile, an installation profile can be empty (base case); by Package Insertion, the elements in an installation profile are packages; by Dependency Insertion, a profile can be extended by satisfied dependencies; by Profile Extension, if a package can be validly executed in an empty profile, it can be added to an existing profile. Notice that unnecessary packages from any repository can still be added: this is possible for packages without dependencies through the Profile Extension rule, but more in general by an application of the Weakening Rule (see Figure 4). The result of such a profile extension is denoted by Γ A ; φ B and Γ A ; Γ B . It is worth noting that Weakening will preserve profile consistency as it requires additionally an instance of the trust rule (see Figure 3).

Empty Profile {} : prof ile φ A i Package Insertion φ A i : prof ile Γ A , φ A i : prof ile Γ A , φ A i ψ B j Dependency Insertion Γ A , φ A i < ψ B j : prof ile Γ A : prof ile ψ B j Profile Extension Γ A ; ψ B j : prof ile

Rules for package execution

The operational rules in Figure 2 formulate compositionality of package execution. A judgement of the form Γ A φ B says that package φ from repository B is executable without errors within an installation profile with packages coming from repository A.

The rule Atom establishes valid package execution within the same installation profile and across repositories with satisfied dependencies. In the present version we assume A < B. ⊥ says that if a profile is inconsistent, any package whatsoever can be executed. ∧-I allows composition of packages from distinct profiles; by ∧-E, each composing package can be obtained from the combined profiles (with I = {A, B}). ∨-I says that a combined profile can access any package from each of the composing profiles; by the elimination ∨-E, each package consistently inferred by each individual profile can also be executed under the extended profile. →-Introduction expresses inference of a package from a combined profile as inference between packages (Deduction Theorem); its elimination →-E allows to recover such inference as profile extension (Modus Ponens).

Γ A ; Γ B : prof ile Atom, for any ψ B i ∈ Γ B Γ A ; Γ B ψ B i Γ A ⊥ ⊥ Γ A φ B Γ A φ A i Γ B φ B j ∧-I Γ A ; Γ B φ A i ∧ φ B j Γ A ; Γ B φ A i ∧ φ B j ∧-E Γ A ; Γ B φ I i/j Γ A ; Γ B φ I i/j ∨-I Γ A ; Γ B φ A i ∨ φ B j Γ A ; Γ B φ A i ∨ φ B j φ I∈{A,B} i/j ψ C k ∨-E Γ A ; Γ B ψ C k Γ A ; φ B i φ C j →-I Γ A φ B i → φ C j Γ A φ B i → φ C j Γ A φ B i →-E Γ A ; φ B i φ C j Fig. 2.
The System (un)SecureND: Operational Rules

Access Rules

In Figure 3 we present the access rules. These allow a user's installation profile to act on packages available from a distinct repository. In particular, we formulate a rule to query a package from a repository (read ) and one to install a package within a profile (write). A third rule is formulated to guarantee that only packages consistent with the installation profile can be installed (trust).

read says that from any consistent profile Γ A a package φ B i can be read provided its dependencies are satisfied (if any). trust works as an elimination rule for read: it says that if a package φ B i can be read and it preserves profile consistency, then it can be trusted. write works as an elimination rule for trust: it says that a readable and trustable package can be installed. exec says that every package that is safely installed in a consistent profile can be executed in it. The Introduction rule for distrust DTrust-I expresses the principle that a package φ B i non-consistent with its installation profile can be negated to be trustworthy; the corresponding elimination DTrust-E uses →-introduction to induce write of any package consistent with the conflict resolution. The Introduction rule for mistrust MTrust-I says that trust is removed for local packages conflicting with an intended installation (a queried package); the corresponding MTrust-E allows to trust any package which is consistent with the conflict resolution by removal of the mistrusted package in the installation profile. This holds for any required dependency in other repositories, as expressed by the side condition that requires checking for any C < B. By the latter set of rules, distrust is a flag for preventing installation of conflicting external packages, while mistrust is a flag for facilitating removal of conflicting packages present in the installation profile. Notice that both untrust functions are triggered by the querying operation on a repository, hence conflicts are highlighted before installation.

read Γ A Read(φ B i ) Γ A Read(φ B i ) Γ A ; φ B i : prof ile trust Γ A T rust(φ B i ) Γ A Read(φ B i ) Γ A T rust(φ B i ) write Γ A W rite(φ B i ) Γ A W rite(φ B i ) exec Γ A φ B i Γ A Read(φ B i ) → ⊥ DTrust-I Γ A ¬T rust(φ B i ) Γ A ¬T rust(φ B i ) Γ A ¬T rust(φ B i ) → ψ C j DTrust-E Γ A W rite(ψ C j ) Γ A Read(ψ B i ) → ⊥ Γ A \ {φ A j } : prof ile MTrust-I Γ A \ {φ A j }; ψ B i ¬T rust(φ A j ) Γ A \ {φ A j }; ψ B i ¬T rust(φ A j ) Γ C ; ψ B i : prof ile MTrust-E, ∀C < B Γ A \ {φ A j }; Γ C T rust(ψ B i )
Fig. 3. The System (un)SecureND: Access Rules

Structural Rules

Structural rules hold with restrictions for (un)SecureND, see Figure 4. As a result the system qualifies as substructural, see e.g. [START_REF] Restall | An Introduction to Substructural Logics[END_REF].

Weakening is constrained by an instance of trust: it says that a valid installation of φ A i is preserved under a profile extension in view of a trusted package φ B j , i.e. one whose profile extension is provably consistent. Contraction is constrained by preservation of package ordering: it says that a valid installation of φ A k is preserved when removing an instance of identical packages φ A i ; φ B i , provided one preserves the package from the higher repository in the order dependency, so as to guarantee any further dependency below.

Exchange is doubly constrained by order: it says that a valid installation of φ A k is preserved under reorder of packages φ i , φ j , if those come from the same repository A and if there is no involved dependency between them.

Finally, the Cut rule expresses valid package execution under profile extension: if a package φ B i is validly executed under profile Γ A and a profile Γ B including φ B i allows execution of a package φ B j , then the extended profile Γ A ; Γ B allows execution of φ B j .

Γ A W rite(φ A i ) Γ A T rust(φ B j ) Profile Weakening Γ A ; φ B j W rite(φ A i ) Γ A , φ A i ; φ B i W rite(ψ A k ) A < B Profile Contraction Γ A , φ A i W rite(ψ A k ) Γ A , φ A i , φ A j W rite(φ A k ) φ A i ≮ φ A j Profile Exchange Γ A , φ A j , φ A i W rite(φ A k ) Γ A φ B i Γ B , φ B i φ B j Profile Cut Γ A ; Γ B φ B j Fig. 4. The System (un)SecureND: Structural Rules 4 The Distrusted Uninstall Problem Consider a profile Γ A = {φ A 1 < . . . < φ A n }
and a package φ B m which one wishes not to install. This might be due to a security constraint, or an explicit conflict in view of an installed package φ A i ∈ Γ , which one explicitly wants to preserve. We call such a package φ B m distrusted. In the calculus, this corresponds to the conclusion of the DTrust-I rule

Γ A ¬T rust(φ B
m ) The Distrusted Uninstall Problem is to determine which packages can be installed in Γ A that do not depend on φ B m . Our formulation allows to express this principle as the request to obtain the maximal set of formulas {ψ N i } from any repository N ≥ B such that

Γ A ¬T rust(φ B m ) → {ψ N i } By DTrust-E,
this guarantees the right to install ψ N i . The first step consists in transforming our problem in a formulation that removes the trust condition. We can now reduce the latter to an operation on all packages coming from the repository involved by the distrust operation: What has been so far restricted to one repository, can now be generalised to any repository that preserves the dependency condition:

Lemma 1. Γ A ¬T rust(φ B m ) → ψ N i iff Γ A ; ¬φ B m ψ N i . Proof.
Lemma 2. If Γ A ; ¬φ B m ψ N i then Γ A ; Γ B \ {φ B m } ψ N i ,
Lemma 3. Γ A ; φ N l W rite(ψ N i ) iff (φ N l ≮ ξ N m ≮ ψ N i )
for any distrusted package ξ N m and any repository N > A.

Proof. For the right-to-left direction. Assume the following: For the left-to-right direction. Assume (φ N l ≮ φ N m ≮ φ N i ) and Γ A ; φ N l ¬T rust(φ N m ). Then: because φ N l ≮ φ N m , the second assumption above does not require to remove φ N l as by Lemma 2; and because φ N m ≮ φ N i , installing the latter does not require installing the former. Hence Γ A ; φ N l W rite(φ N i ) holds.

Γ A ; φ N l W rite(φ N i ) and Γ A ; φ N l ¬T rust(φ N m ). Then: if φ N l < φ N m , then Γ A ; φ N
Finally, our main result is obtained:

Theorem 1. (Distrusted Uninstall) Given a package φ B m distrusted under profile Γ A , a package ψ N i can be installed in Γ A iff φ B m ≮ ψ N i .
Proof. From Definition 2 and Lemma 3 by substitution.

This last result identifies distrusted packages as those that have at least a dependency from one package conflicting with the current installation profile.

The Mistrusted Uninstall Problem

Consider a profile Γ A = {φ A 1 < . . . < φ A n } and a package φ B m which one wishes to install in it: in the calculus, this corresponds to the conclusion of an instance of the Write rule, Γ A W rite(φ B m ). Assume that φ B m is in conflict with the given profile

Γ A Read(φ B m ) → ⊥
The Mistrusted Uninstall Problem is to determine the set

Φ A = {φ A i ∈ Γ A | φ A i → ¬φ B
m } which should be removed when installing φ B m . We will call any such package φ A i a mistrusted package. Hence the problem is to identify the minimal set of formulas Φ A such that for each φ

A i ∈ Φ A Γ A \ Φ A ; φ B m ¬T rust(φ A i
) and by MTrust-E, given any other set of formulas Γ C required by φ B m , it allows

Γ A \ Φ A ; Γ C T rust(φ B m )
We start by identifying the minimal subset of packages from the current installation profile that satisfies the conflict:

Lemma 4. If Γ A Read(φ B m ) → ⊥, then ∃Φ A ⊆ Γ A such that Φ A = {φ A i < . . . < φ A n } Read(φ B m ) → ⊥. Proof. ∀φ A i , φ A j ∈ Γ A , if φ A i Read(φ B m ) → ⊥ and φ A i < φ A j , then φ A j Read(φ B m ) → ⊥. And ∀φ A h < φ A i , φ A h Read(φ B m ).
Hence it suffices to identify the maximal φ A i in conflict with φ B m and to include it in Φ A together with all packages in Γ A that depend on it. We will call Φ A a maximally mistrusted set. m to be installed under profile Γ A , a package φ A i is mistrusted in Γ A iff for all Γ A ⊆ {φ A i < φ A j } 1. Γ A φ A j → ¬φ B m , 2. φ A j < Read(φ B m ) → ⊥ and 3. φ A i ≮ φ B m . Proof. The first condition is required by Lemma 5 to include all the dependencies in the maximally mistrusted set. The second condition holds from Lemma 6. Finally, the third condition holds by contradiction: if

Lemma 5. Consider a maximally mistrusted Φ

A ⊆ Γ A such that Φ A Read(φ B m ) → ⊥ as of Lemma 4. Then ∀φ A i ∈ Φ A , φ A i < Read(φ B m ) → ⊥.
φ A i < φ B m , then φ A i φ B m
by Dependency Insertion; it follows by Weakening that φ A i ; φ B m : prof ile and hence φ B T rust(φ A i ). This last result identifies packages to be removed as those that are in maximally mistrusted set and do not satisfy any dependency for the package to be installed under the current profile.

Conclusions

In this paper we have formulated two variants to the Uninstall Problem. Each relies on a different semantic qualification of untrusted packages required to be removed or prevented from installation in a given installation profile, in order to preserve consistency.

Our approach is grounded on the logic (un)SecureND, including an explicit trust function on formulas to guarantee consistency check at each retrieval step (after a read function), before installation rights are granted for a package (by a write function). The fragment of the language presented in this paper allows to express negation over trust as a dis-installation requirement. Different pairs of introduction/elimination rules determine the selection of one of two resolution strategies: one flags a package external to the installation profile as distrusted and hence as not installable; the other identifies already installed packages to be removed. The selection takes care of identifying and removing all required dependencies. We have illustrated the working protocol through an easy example. As already mentioned, validation of the system is obtained by implementation of the (un)SecureND calculus as a large inductive type in the Coq proof assistant. The development is available at https://github.com/gprimiero/SecureNDC.

A characteristic of the logic (un)SecureND is its substructural nature, which in future work can be exploited to investigate cases of strengthened and limited resource redundancy for fault tolerance and source shuffling for security. Other applications of negative trust can be investigated to distinguish between malevolent and simply unsuccessful sources.

Fig. 1 .

 1 Fig. 1. The System (un)SecureND: Profile Construction Rules

  For the left-to-right direction: By the assumption Γ A ¬T rust(φ B m ) and consistency of negation, Γ A T rust(¬φ B m ); similarly, from the premise Γ A ¬T rust(φ B m ) → ψ N i and consistency of negation we get Γ A T rust(¬φ B m ) → ψ N i . Now apply write to T rust(¬φ B m ) and eliminate the function through exec; by →-E we obtain Γ A ; ¬φ B m ψ N i . For the right-to-left direction: By the assumption Γ A ; ¬φ B m ψ N i it holds Γ A ; ¬φ B m : prof ile, which justifies Γ A Read(¬φ B m ) by read, Γ A T rust(¬φ B m ) by the previous and trust and Γ A ¬T rust(φ B m ) by ¬-distribution. It follows Γ A ; ¬T rust(φ B m ) ψ N i by substitution from the assumption, and Γ A ¬T rust(φ B m ) → ψ N i is obtained by →-I.

  , contradicting the distrust assumption; and if φ N m < φ N i then similarly φ N m φ N i and by Weakening it is possible to obtain Γ A ; φ N l , φ N m W rite(φ N i ), again contradicting the distrust assumption.

Lemma 6 .

 6 Proof. This holds by construction of Φ A in Lemma 4 and the Dependency Insertion Rule. If φ A i Read(φ B m ) → ⊥, then φ A i ≮ φ B m . Proof. Starting from φ A i Read(φ B m ) → ⊥ we apply D-Trust-I, ¬-distribution, write and exec to obtain φ A i ¬φ B m , from which we obtain φ A i < ¬φ B m from Dependency Insertion and φ A i ≮ φ B m by contrapposition. Theorem 2. (Mistrusted Uninstall) Given a package φ B

  The above corresponds to finding the maximal set of formulas in Γ B that allows to execute ψ N i without requiring φ B m in the profile. To this aim, it is enough to find all φ B l ≯ φ B m , i.e. the set of packages in B that have no dependencies from φ B m .

		for all consistent
	profiles Γ B that include φ B m .
	Proof. Γ A can be extended with every consistent package from B; by definition
	Γ A ; ¬φ B m	¬T rust(φ B m ), hence by Weakening this is possible except for φ B m as
	it does not satisfy trust.

See http://0install.net/solver.html. An OCaml implementation is also available at http://roscidus.com/blog/blog/2014/09/17/ simplifying-the-solver-with-functors/.

The repository is available at https://github.com/gprimiero/SecureNDC.

Consider the simple scenario presented in Section 1 where a user has the following installation profile:

with the following dependencies

Assume the user distrusts a package ψ f n , e.g. because it is considered harmful or unsecure. The Distrusted Uninstall Problem asks which packages can be further installed in Γ m-f -nf without installing ψ f n . Consider now a package ψ f 2 ≯ ψ f n , then the following derivation holds:

In other words, flagging ψ f n as distrustful does not impede the installation of a package ψ f 2 if the latter does not depend on the former. Assume moreover that the user wishes to install an additional package ξ nf 2 > φ m

1 , but such that φ m 2 Read(ξ nf 2 ) → ⊥: in other words, ξ nf 2 depends on φ m 1 , but is in conflict with φ m 2 (which is possible, given the latter does not depend on φ m 1 ). Then assuming a package ψ f 2 replacing the functionalities of φ m 2 , the following derivation holds:

In other words the installation of ξ nf 2 requires removing φ m 2 < ψ f 1 and it is compatible with the installation of ψ f 2 .