{ localUrl: '../page/partial_function.html', arbitalUrl: 'https://arbital.com/p/partial_function', rawJsonUrl: '../raw/5p2.json', likeableId: '3351', likeableType: 'page', myLikeValue: '0', likeCount: '2', dislikeCount: '0', likeScore: '2', individualLikes: [ 'EricBruylant', 'PatrickStaples' ], pageId: 'partial_function', edit: '3', editSummary: '', prevEdit: '2', currentEdit: '3', wasPublished: 'true', type: 'wiki', title: 'Partial function', clickbait: 'A partial function is one which "might not be defined everywhere one might expect it to be".', textLength: '2226', alias: 'partial_function', externalUrl: '', sortChildrenBy: 'likes', hasVote: 'false', voteType: '', votesAnonymous: 'false', editCreatorId: 'PatrickStevens', editCreatedAt: '2016-08-06 12:41:39', pageCreatorId: 'PatrickStevens', pageCreatedAt: '2016-07-30 19:07:58', seeDomainId: '0', editDomainId: 'AlexeiAndreev', submitToDomainId: '0', isAutosave: 'false', isSnapshot: 'false', isLiveEdit: 'true', isMinorEdit: 'false', indirectTeacher: 'false', todoCount: '1', isEditorComment: 'false', isApprovedComment: 'true', isResolved: 'false', snapshotText: '', anchorContext: '', anchorText: '', anchorOffset: '0', mergedInto: '', isDeleted: 'false', viewCount: '38', text: 'A **partial function** is like a [-3jy] $f: A \\to B$, but where we relax the requirement that $f(a)$ must be defined for all $a \\in A$.\nThat is, it must still be the case that "$a = b$ and $f(a)$ is defined" implies "$f(b)$ is defined and $f(a) = f(b)$", but now we no longer need $f(a)$ to be defined everywhere.\nWe can write $f: A \\rightharpoonup B$ %%note:In LaTeX, this symbol is given by `\\rightharpoonup`.%%to denote that $f$ is a partial function with **domain** $A$ and **codomain** $B$: that is, whenever $f(x)$ is defined then we have $x \\in A$ and $f(x) \\in B$.\n\nThis idea is essentially the "flip side" to the distinction between the [-3lv] dichotomy.\n\n# Implementation in set theory\n\nJust as a function can be implemented as a set $f$ of ordered pairs $(a, b)$ such that: \n\n- every $x \\in A$ appears as the first element of some ordered pair in $f$\n- if $(a, b)$ is an ordered pair in $f$ then $a \\in A$ and $b \\in B$\n- if $(a, b)$ and $(a, c)$ are ordered pairs in $f$, then $b=c$\n\nso we can define a *partial* function as a set $f$ of ordered pairs $(a,b)$ such that:\n\n- if $(a, b)$ is an ordered pair in $f$ then $a \\in A$ and $b \\in B$\n- if $(a, b)$ and $(a, c)$ are ordered pairs in $f$, then $b=c$\n\n(That is, we omit the first listed requirement from the definition of a *bona fide* function.)\n\n# Relationship to Turing machines\n[todo: maybe this should be under Turing machine rather than partial function?]\n\nMorally speaking, every [5pd Turing machine] $\\mathcal{T}$ may be viewed as computing some function $f: \\mathbb{N} \\to \\mathbb{N}$, by defining $f(n)$ to be the state of the tape after $\\mathcal{T}$ has been allowed to execute on the tape which has been initialised with the value $n$.\n\nHowever, if $\\mathcal{T}$ does not terminate on input $n$ (for example, it may be the machine "if $n = 3$ then return $1$; otherwise loop indefinitely"), then this "morally correct" state of affairs is not accurate: how should we define $f(4)$?\nThe answer is that we should instead view $f$ as a *partial* function which is just undefined if $\\mathcal{T}$ fails to halt on the input in question.\nSo with the example $\\mathcal{T}$ above, $f$ is the partial function which is only defined at $3$, and $f(3) = 1$.', metaText: '', isTextLoaded: 'true', isSubscribedToDiscussion: 'false', isSubscribedToUser: 'false', isSubscribedAsMaintainer: 'false', discussionSubscriberCount: '1', maintainerCount: '1', userSubscriberCount: '0', lastVisit: '', hasDraft: 'false', votes: [], voteSummary: 'null', muVoteSummary: '0', voteScaling: '0', currentUserVote: '-2', voteCount: '0', lockedVoteType: '', maxEditEver: '0', redLinkCount: '0', lockedBy: '', lockedUntil: '', nextPageId: '', prevPageId: '', usedAsMastery: 'false', proposalEditNum: '0', permissions: { edit: { has: 'false', reason: 'You don't have domain permission to edit this page' }, proposeEdit: { has: 'true', reason: '' }, delete: { has: 'false', reason: 'You don't have domain permission to delete this page' }, comment: { has: 'false', reason: 'You can't comment in this domain because you are not a member' }, proposeComment: { has: 'true', reason: '' } }, summaries: {}, creatorIds: [ 'PatrickStevens' ], childIds: [], parentIds: [ 'function' ], commentIds: [], questionIds: [], tagIds: [], relatedIds: [], markIds: [], explanations: [], learnMore: [], requirements: [], subjects: [], lenses: [], lensParentId: '', pathPages: [], learnMoreTaughtMap: {}, learnMoreCoveredMap: {}, learnMoreRequiredMap: {}, editHistory: {}, domainSubmissions: {}, answers: [], answerCount: '0', commentCount: '0', newCommentCount: '0', linkedMarkCount: '0', changeLogs: [ { likeableId: '0', likeableType: 'changeLog', myLikeValue: '0', likeCount: '0', dislikeCount: '0', likeScore: '0', individualLikes: [], id: '18495', pageId: 'partial_function', userId: 'PatrickStevens', edit: '3', type: 'newEdit', createdAt: '2016-08-06 12:41:39', auxPageId: '', oldSettingsValue: '', newSettingsValue: '' }, { likeableId: '0', likeableType: 'changeLog', myLikeValue: '0', likeCount: '0', dislikeCount: '0', likeScore: '0', individualLikes: [], id: '17795', pageId: 'partial_function', userId: 'PatrickStevens', edit: '2', type: 'newEdit', createdAt: '2016-07-30 19:08:43', auxPageId: '', oldSettingsValue: '', newSettingsValue: '' }, { likeableId: '0', likeableType: 'changeLog', myLikeValue: '0', likeCount: '0', dislikeCount: '0', likeScore: '0', individualLikes: [], id: '17794', pageId: 'partial_function', userId: 'PatrickStevens', edit: '0', type: 'newParent', createdAt: '2016-07-30 19:08:00', auxPageId: 'function', oldSettingsValue: '', newSettingsValue: '' }, { likeableId: '0', likeableType: 'changeLog', myLikeValue: '0', likeCount: '0', dislikeCount: '0', likeScore: '0', individualLikes: [], id: '17792', pageId: 'partial_function', userId: 'PatrickStevens', edit: '1', type: 'newEdit', createdAt: '2016-07-30 19:07:58', auxPageId: '', oldSettingsValue: '', newSettingsValue: '' } ], feedSubmissions: [], searchStrings: {}, hasChildren: 'false', hasParents: 'true', redAliases: {}, improvementTagIds: [], nonMetaTagIds: [], todos: [], slowDownMap: 'null', speedUpMap: 'null', arcPageIds: 'null', contentRequests: {} }