can be done in linear time? Yuri Gurevich Tallinn, April 29, 2014 - - PowerPoint PPT Presentation

β–Ά
can be done in linear time
SMART_READER_LITE
LIVE PREVIEW

can be done in linear time? Yuri Gurevich Tallinn, April 29, 2014 - - PowerPoint PPT Presentation

What, if anything, can be done in linear time? Yuri Gurevich Tallinn, April 29, 2014 Agenda 1. What linear time? Why linear time? 2. Propositional primal infon logic 3. A linear time decision algorithm 4. Extensions with 1. Disjunction 2.


slide-1
SLIDE 1

What, if anything, can be done in linear time?

Yuri Gurevich Tallinn, April 29, 2014

slide-2
SLIDE 2

Agenda

  • 1. What linear time? Why linear time?
  • 2. Propositional primal infon logic
  • 3. A linear time decision algorithm
  • 4. Extensions with
  • 1. Disjunction
  • 2. Conjunctions as sets
  • 3. Transitivity
slide-3
SLIDE 3

WHAT LINEAR TIME? WHY LINEAR TIME?

slide-4
SLIDE 4

Why

  • Big data.
  • Remark. In many cases, big-data algorithms

are approximate and randomized, necessarily so.

slide-5
SLIDE 5

What linear time?

  • A short answer:

We use the standard computation model of the analysis of algorithms.

  • A longer answer, with examples and all,

follows.

slide-6
SLIDE 6

Example 1: Sorting.

  • A well-known lower bond is this:

Sorting π‘œ items requires Ξ©(π‘œ β‹… log π‘œ ) comparisons and thus Ξ©(π‘œ β‹… log π‘œ ) time.

  • There is no way around the lower bound.

Or maybe there is?

slide-7
SLIDE 7

An array A if length n

  • Indices: 0, 1, …, n-1
  • Values A[0], A[1], …, A[n-1]
slide-8
SLIDE 8

Distinct natural numbers < π‘œ can be sorted in time 𝑃(π‘œ).

We illustrate this with π‘œ = 7 and 𝐡 = 𝐡 0 , 𝐡 1 , 𝐡 2 = 3,6,0 .

  • 1. Create and auxiliary array 𝐢 and zero it:

𝐢 = 〈0,0,0,0,0,0,0βŒͺ.

  • 2. Traverse 𝐡; for each value 𝑙, set 𝐢[𝑙] = 1.

𝐢 becomes 1,0,0,1,0,0,1 .

  • 3. Traverse 𝐢 outputing indices with positive

values: 〈0,3,6βŒͺ. We forgo interesting generalizations.

slide-9
SLIDE 9

The computation model

  • Random Access Machine

with registers of length 𝑃(log π‘œ).

– Only the initial polynomial many registers are used, with address of length 𝑃(log π‘œ). – Relations =, β‰₯, ≀, and operations +, βˆ’ are constant time.

  • The model reflects the standard computer

architecture and the regular intuition of programmers.

slide-10
SLIDE 10

Example 2: Tries

One application: lexical analyzers to, tea, ted, ten, A, inn

slide-11
SLIDE 11

Example 3: Suffix arrays.

  • Let 𝑑 = 𝑑0 … π‘‘π‘œβˆ’1. Each 𝑗 < π‘œ is the 𝑙𝑓𝑧 for

the suffix 𝑑𝑗 … π‘‘π‘œβˆ’1.

  • The suffix array for 𝑑 is an array 𝐡 of length π‘œ
  • f 𝑑 where each 𝐡[π‘˜] is (the key of) the π‘˜-th

suffix in the lexicographical order.

  • An amazing algorithm constructs the suffix array

in linear time.

slide-12
SLIDE 12

Parsing logic formulas

  • Using the tools above + a deterministic

pushdown automaton, produce – in linear time – the parse tree of a given logic formula.

  • The nodes and edges are decorated with useful

labels and pointers.

  • Two nodes may represent different occurrences
  • f the same subformula; call them homonyms. All

pointers 𝐼 𝑣 from any node 𝑣 to its homonymy

  • riginal can be constructed in 𝑃(π‘œ).
slide-13
SLIDE 13

PROPOSITIONAL PRIMAL INFON LOGIC

slide-14
SLIDE 14

Motivation for primal logic

  • Access control. DKAL
slide-15
SLIDE 15

Why propositional?

  • DKAL rules have the form

𝑀1: π‘ˆ

1, 𝑀2: π‘ˆ2, …

upon 𝜌(π‘₯1, … ) if 𝛽(… ) actions Meaning: If an arriving message fits the pattern 𝜌 and if the condition 𝛽 follows from your knowledge assertions, perform the actions.

  • Often, by the time you arrive to check 𝛽, it is ground. The assertion

are typically not ground but only few particular ground instances are relevant.

slide-16
SLIDE 16

Expository simplifications

  • For expository reasons, we restrict attention

to the β€œtopless” (without ⊀) fragment that is quote-free.

slide-17
SLIDE 17

The derivation rules

𝑦 ∧ 𝑧 𝑦 𝑦 ∧ 𝑧 𝑧 𝑦, 𝑧 𝑦 ∧ 𝑧 𝑦, 𝑦 β†’ 𝑧 𝑧 𝑧 𝑦 β†’ 𝑧

slide-18
SLIDE 18

The subformula property

  • Theorem. If

𝛽1, … , 𝛽ℓ is a shortest derivation of πœ’ from 𝐼 then every 𝛽𝑗 is a subformula of 𝐼, πœ’.

  • In the β€œquoteful” case, instead of subformulas
  • f a formula 𝛽, we have formulas local to 𝛽.

There are < |𝛽| such local formulas.

slide-19
SLIDE 19

An interpolation lemma of sorts

  • Lemma. If 𝐼 ⊒ πœ’ then there is a set 𝐽 of

subformulas of 𝐼 that are also subformulas of πœ’, such that

  • 1. Formulas 𝐽 are derivable from H, and
  • 2. πœ’ is derivable from 𝐽 using only introduction

rules.

  • We will not use the interpolation lemma but it

gives a useful optimization in the case where the hypotheses change rarely.

slide-20
SLIDE 20

The multi-derivation problem

  • Definition. Given sets 𝐼 (hypotheses) and 𝑅

(queries) of formulas, decide which queries follow from the hypotheses.

  • Theorem. The multi-derivation problem for

propositional infon logic is solvable in linear time.

  • We explain the main ideas.
  • π‘œ is always the input size,

essentially 𝐼 + |𝑅|.

slide-21
SLIDE 21

A LINEAR TIME DECISION ALGORITHM FOR THE MULTI-DERIVATION PROBLEM

slide-22
SLIDE 22

Approach: derive them all

Compute all subformulas of 𝐼, 𝑅 derivable from the hypotheses 𝐼.

slide-23
SLIDE 23

High-level algorithm

  • Initially all subformulas of 𝐼, 𝑅 are raw,
  • nly hypotheses are pending and

there are no processed formulas.

  • Pick the first pending formula 𝛽,

apply all possible inference rules to 𝛽, then mark 𝛽 processed. – In the process some raw formulas may become pending.

  • Repeat until no formula is pending.
slide-24
SLIDE 24

One easy case

  • Apply the ∧-elimination rule π‘¦βˆ§π‘§

𝑦 .

  • In this case, 𝛽 is a conjunction. If the first

conjunct of 𝛽 is raw, mark it pending.

slide-25
SLIDE 25

One harder case

  • Apply the ∧-introduction rule

𝑦,𝑧 π‘¦βˆ§π‘§

with 𝛽 playing the role of 𝑦.

  • All raw formulas of the form 𝛽 ∧ 𝑧 where y is

pending or processed, should be marked pending.

  • How do we find them? We don’t have the

time to walk through the raw formulas.

slide-26
SLIDE 26

Local search

  • Every homonymy original node 𝑣 is endowed

with four so-called use sets denoted ∧, π‘š , ∧, 𝑠 , β†’, π‘š , β†’, 𝑠 computed as follows.

  • Traverse the parse tree, in the depth-first way.
  • If a homonymy original 𝑣 is the left child of a

conjunction node π‘₯, put 𝐼(π‘₯) into the use set (∧, π‘š) of 𝑣. If u is the right child of π‘₯, put 𝐼(π‘₯) use ∧, 𝑠 instead.

  • Similarly for β†’.
slide-27
SLIDE 27

Back to applying

π‘¦βˆ§π‘§ 𝑦

  • Recall: we are looking for raw formulas of the

form 𝛽 ∧ 𝑧 where 𝛽 is the first pending formula.

  • Just walk through the use set (∧, π‘š) of 𝛽.
slide-28
SLIDE 28

EXTENTION 1: DISJUNCTIONS

slide-29
SLIDE 29

Motivations

Recall the DKAL rule 𝑀1: π‘ˆ

1, … , π‘€π‘˜: π‘ˆ π‘˜

upon 𝜌 π‘₯1, … if 𝛽 … actions and suppose that 𝛽 = 𝛾 ∨ 𝛿, e.g. passport(traveller,UK) ∨ passport(traveller,EU). There may be many such disjunctions. They may be eliminated but they make rule much more succinct.

slide-30
SLIDE 30

Add only introduction rules

𝑦 𝑦 ∨ 𝑧 𝑧 𝑦 ∨ 𝑧 The linear decision algorithm generalizes in a rather obvious way.

slide-31
SLIDE 31

EXTENSION 2: CONJUNCTIONS (AND DISJUNCTIONS) AS SETS

slide-32
SLIDE 32

Motivation

While 𝑦 ∧ 𝑧 entails 𝑧 ∧ 𝑦,

  • 𝑦 ∧ 𝑧 β†’ 𝑨 doesn’t entail 𝑧 ∧ 𝑦 β†’ 𝑨,
  • 𝑨 β†’ (𝑦 ∧ 𝑧) doesn’t entail 𝑨 β†’ 𝑧 ∧ 𝑦 ,
  • 𝑦 ∧ 𝑧 ∧ 𝑨 β†’ π‘₯ doesn’t entail

𝑦 ∧ 𝑧 ∧ 𝑨 β†’ π‘₯, etc.

slide-33
SLIDE 33

The idea, a problem, and a solution

  • View conjunctions as sets of conjuncts.

This repairs the missing entailments.

  • But sets are not constructive objects.
  • Represent sets as sequences by ordering the

conjuncts lexicographically.

slide-34
SLIDE 34

The decision algorithm

  • The resulting multi-derivability problem is

solvable in expected linear time.

  • It is the algorithm that introduces
  • randomization. No probability distribution on

inputs is assumed.

slide-35
SLIDE 35

EXTENSION 3: TRANSITIVE PRIMAL INFON LOGIC

slide-36
SLIDE 36

Motivation

  • In primal infon logic,

𝑦 β†’ 𝑧 , (𝑧 β†’ 𝑨) don’t entail (𝑦 β†’ 𝑨).

slide-37
SLIDE 37

New axiom and rule

  • In the quoteless case, transitive primal infon

logic is the extension of primal infon logic with an axiom 𝑦 β†’ 𝑦 and the rule 𝑦 β†’ 𝑧, 𝑧 β†’ 𝑨 𝑦 β†’ 𝑨

slide-38
SLIDE 38

An alternative presentation of transitivity

𝑦1 β†’ 𝑦2, 𝑦2 β†’ 𝑦3, … , π‘¦π‘™βˆ’1 β†’ 𝑦𝑙 𝑦1 β†’ 𝑦𝑙 Logically the alternative presentation is equivalent to the original one but algorithmically it makes a lot of difference.

slide-39
SLIDE 39

Multi-derivability

  • Multi-derivability problem for the transitive

primal infon logic is solvable in quadratic time.

slide-40
SLIDE 40

THANK YOU

slide-41
SLIDE 41

VAULT

slide-42
SLIDE 42

High-level algorithm

Initially all local formulas are raw, except that hypotheses are pending. No formulas are processed. 1. Pick the first pending formula 𝛽, 2. apply all (applicable) inference rules 𝑆 to 𝛽; if any of the conclusions are raw, make them pending. 3. mark 𝛽 processed. 4. Repeat until no formula is pending.

  • Pending and processed formulas have been derived.
  • Formulas move only from raw to pending to processed.
slide-43
SLIDE 43

One easy case

  • 𝛽 = 𝛾 ∧ 𝛿, 𝑆 is 𝑦 ∧ 𝑧

𝑦

β‹…

  • If 𝛾 is raw, mark it pending.
slide-44
SLIDE 44

One harder case

  • Apply 𝑆 =

𝑦, 𝑧 𝑦 ∧ 𝑧 to 𝛽, with 𝛽 being the left

premise.

– It will be convenient to abbreviate this sentence thus: apply π‘†π‘š to 𝛽.

  • All raw formulas 𝛽 ∧ 𝑧, with 𝑧 pending or

processed, should be marked pending. But how do we find them?

slide-45
SLIDE 45

Succinct representation, 1

  • Local formulas are too big objects to manipulate in

linear time. So we work with the parse tree of 𝐼, 𝑅. The subtree rooted at a node u of ParseTree(𝐼, 𝑅) is the parse tree of some formula πœ’, the formula of 𝑣.

  • Draft definition. If πœ’ = Formula(𝑣) then 𝑣 represents

πœ’.

  • But then πœ’ may have many representations.
  • Call nodes 𝑣, 𝑀 homonyms if their formulas are

isomorphic.

slide-46
SLIDE 46

Succinct representation, 2

  • Lemma. There is a linear-time algorithm that

– chooses a homonymy leader in every homonymy class, and – sets pointers 𝐼𝑣 from any node 𝑣 to its homonymy leader.

  • The algorithm uses suffix arrays.
  • Def. If πœ’ = Formula(𝑣) then 𝐼𝑣 represents πœ’.

Further, 𝐼𝑣 = N𝑝𝑒𝑓(πœ’).

slide-47
SLIDE 47

The use sets US(π‘†π‘š, 𝑣)

  • Traverse the parse tree in the depth-first
  • manner. For every homonymy leader π‘₯ with

Formula(π‘₯) = 𝑦 ∧ 𝑧, put π‘₯ into the use set US(π‘†π‘š, 𝐼π‘₯π‘š).

– Here π‘₯π‘š is the left child of π‘₯. – Notice that 𝐼π‘₯π‘š =Node(𝑦). – Notice that every Node(𝛽 ∧ 𝑧) occurs in US(π‘†π‘š,Node(Ξ±)).

slide-48
SLIDE 48

Applying π‘†π‘š to 𝛽

  • Walk through US(π‘†π‘š, Node(𝛽)) and mark

every raw π‘₯ there pending.

  • How do you find Node(𝛽)?

That is how 𝛽 is given in the first place.